@db-ux/wc-core-components 2.0.7 → 2.0.9
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/dist/cjs/db-button.cjs.entry.js +2 -2
- package/dist/cjs/db-button.cjs.entry.js.map +1 -1
- package/dist/cjs/db-button.entry.cjs.js.map +1 -1
- package/dist/cjs/db-card.cjs.entry.js +3 -3
- package/dist/cjs/db-card.cjs.entry.js.map +1 -1
- package/dist/cjs/db-card.entry.cjs.js.map +1 -1
- package/dist/cjs/db-checkbox.cjs.entry.js +3 -2
- package/dist/cjs/db-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/db-checkbox.entry.cjs.js.map +1 -1
- package/dist/cjs/db-custom-select.cjs.entry.js +74 -65
- package/dist/cjs/db-custom-select.cjs.entry.js.map +1 -1
- package/dist/cjs/db-custom-select.entry.cjs.js.map +1 -1
- package/dist/cjs/db-link.cjs.entry.js +2 -2
- package/dist/cjs/db-link.cjs.entry.js.map +1 -1
- package/dist/cjs/db-link.entry.cjs.js.map +1 -1
- package/dist/cjs/db-navigation-item.cjs.entry.js +2 -2
- package/dist/cjs/db-navigation-item.cjs.entry.js.map +1 -1
- package/dist/cjs/db-navigation-item.entry.cjs.js.map +1 -1
- package/dist/cjs/db-radio.cjs.entry.js +3 -2
- package/dist/cjs/db-radio.cjs.entry.js.map +1 -1
- package/dist/cjs/db-radio.entry.cjs.js.map +1 -1
- package/dist/cjs/db-select.cjs.entry.js +5 -5
- package/dist/cjs/db-select.cjs.entry.js.map +1 -1
- package/dist/cjs/db-select.entry.cjs.js.map +1 -1
- package/dist/cjs/db-switch.cjs.entry.js +3 -2
- package/dist/cjs/db-switch.cjs.entry.js.map +1 -1
- package/dist/cjs/db-switch.entry.cjs.js.map +1 -1
- package/dist/cjs/db-textarea.cjs.entry.js +3 -3
- package/dist/cjs/db-textarea.cjs.entry.js.map +1 -1
- package/dist/cjs/db-textarea.entry.cjs.js.map +1 -1
- package/dist/cjs/db-ux.cjs.js +1 -1
- package/dist/cjs/{document-click-listener-BbGE8WyV.js → document-click-listener-Dfd-wUYX.js} +6 -6
- package/dist/cjs/document-click-listener-Dfd-wUYX.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/button/button.js +2 -2
- package/dist/collection/components/button/button.js.map +1 -1
- package/dist/collection/components/card/card.js +3 -3
- package/dist/collection/components/card/card.js.map +1 -1
- package/dist/collection/components/checkbox/checkbox.js +28 -2
- package/dist/collection/components/checkbox/checkbox.js.map +1 -1
- package/dist/collection/components/custom-select/custom-select.js +97 -63
- package/dist/collection/components/custom-select/custom-select.js.map +1 -1
- package/dist/collection/components/custom-select/model.js.map +1 -1
- package/dist/collection/components/link/link.js +2 -2
- package/dist/collection/components/link/link.js.map +1 -1
- package/dist/collection/components/navigation-item/navigation-item.js +2 -2
- package/dist/collection/components/navigation-item/navigation-item.js.map +1 -1
- package/dist/collection/components/radio/model.js.map +1 -1
- package/dist/collection/components/radio/radio.js +28 -2
- package/dist/collection/components/radio/radio.js.map +1 -1
- package/dist/collection/components/select/select.js +30 -5
- package/dist/collection/components/select/select.js.map +1 -1
- package/dist/collection/components/switch/switch.js +28 -2
- package/dist/collection/components/switch/switch.js.map +1 -1
- package/dist/collection/components/textarea/textarea.js +28 -3
- package/dist/collection/components/textarea/textarea.js.map +1 -1
- package/dist/collection/shared/model.js.map +1 -1
- package/dist/collection/utils/document-click-listener.js +4 -4
- package/dist/collection/utils/document-click-listener.js.map +1 -1
- package/dist/custom-elements.json +198 -19
- package/dist/db-ux/db-button.entry.esm.js.map +1 -1
- package/dist/db-ux/db-card.entry.esm.js.map +1 -1
- package/dist/db-ux/db-checkbox.entry.esm.js.map +1 -1
- package/dist/db-ux/db-custom-select.entry.esm.js.map +1 -1
- package/dist/db-ux/db-link.entry.esm.js.map +1 -1
- package/dist/db-ux/db-navigation-item.entry.esm.js.map +1 -1
- package/dist/db-ux/db-radio.entry.esm.js.map +1 -1
- package/dist/db-ux/db-select.entry.esm.js.map +1 -1
- package/dist/db-ux/db-switch.entry.esm.js.map +1 -1
- package/dist/db-ux/db-textarea.entry.esm.js.map +1 -1
- package/dist/db-ux/db-ux.esm.js +1 -1
- package/dist/db-ux/index.esm.js +1 -1
- package/dist/db-ux/index.esm.js.map +1 -1
- package/dist/db-ux/p-02f8816d.entry.js +2 -0
- package/dist/db-ux/p-02f8816d.entry.js.map +1 -0
- package/dist/db-ux/{p-33aaf986.entry.js → p-3a2fd85e.entry.js} +2 -2
- package/dist/db-ux/p-3a2fd85e.entry.js.map +1 -0
- package/dist/db-ux/{p-44f6404b.entry.js → p-3af37d5a.entry.js} +2 -2
- package/dist/db-ux/p-3af37d5a.entry.js.map +1 -0
- package/dist/db-ux/p-55913451.entry.js +2 -0
- package/dist/db-ux/p-55913451.entry.js.map +1 -0
- package/dist/db-ux/{p-a1ee66b3.entry.js → p-94471c06.entry.js} +2 -2
- package/dist/db-ux/p-94471c06.entry.js.map +1 -0
- package/dist/db-ux/{p-c989b5d8.entry.js → p-9d64dc74.entry.js} +2 -2
- package/dist/db-ux/p-9d64dc74.entry.js.map +1 -0
- package/dist/db-ux/p-YMQoOWgh.js +2 -0
- package/dist/db-ux/p-YMQoOWgh.js.map +1 -0
- package/dist/db-ux/{p-50c9112b.entry.js → p-c44f46be.entry.js} +2 -2
- package/dist/db-ux/p-c44f46be.entry.js.map +1 -0
- package/dist/db-ux/p-e2d6197f.entry.js +2 -0
- package/dist/db-ux/p-e2d6197f.entry.js.map +1 -0
- package/dist/db-ux/p-e33ddddb.entry.js +2 -0
- package/dist/db-ux/p-e33ddddb.entry.js.map +1 -0
- package/dist/db-ux/{p-61410d87.entry.js → p-eef5de38.entry.js} +2 -2
- package/dist/db-ux/p-eef5de38.entry.js.map +1 -0
- package/dist/esm/db-button.entry.js +2 -2
- package/dist/esm/db-button.entry.js.map +1 -1
- package/dist/esm/db-card.entry.js +3 -3
- package/dist/esm/db-card.entry.js.map +1 -1
- package/dist/esm/db-checkbox.entry.js +3 -2
- package/dist/esm/db-checkbox.entry.js.map +1 -1
- package/dist/esm/db-custom-select.entry.js +74 -65
- package/dist/esm/db-custom-select.entry.js.map +1 -1
- package/dist/esm/db-link.entry.js +2 -2
- package/dist/esm/db-link.entry.js.map +1 -1
- package/dist/esm/db-navigation-item.entry.js +2 -2
- package/dist/esm/db-navigation-item.entry.js.map +1 -1
- package/dist/esm/db-radio.entry.js +3 -2
- package/dist/esm/db-radio.entry.js.map +1 -1
- package/dist/esm/db-select.entry.js +5 -5
- package/dist/esm/db-select.entry.js.map +1 -1
- package/dist/esm/db-switch.entry.js +3 -2
- package/dist/esm/db-switch.entry.js.map +1 -1
- package/dist/esm/db-textarea.entry.js +3 -3
- package/dist/esm/db-textarea.entry.js.map +1 -1
- package/dist/esm/db-ux.js +1 -1
- package/dist/esm/{document-click-listener-Bn3nIGhA.js → document-click-listener-Bf90GXqB.js} +6 -6
- package/dist/esm/document-click-listener-Bf90GXqB.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/checkbox/checkbox.d.ts +1 -0
- package/dist/types/components/custom-select/custom-select.d.ts +6 -5
- package/dist/types/components/custom-select/model.d.ts +3 -3
- package/dist/types/components/radio/model.d.ts +1 -3
- package/dist/types/components/radio/radio.d.ts +1 -0
- package/dist/types/components/select/select.d.ts +1 -0
- package/dist/types/components/switch/switch.d.ts +1 -0
- package/dist/types/components/textarea/textarea.d.ts +1 -0
- package/dist/types/components.d.ts +12 -0
- package/dist/types/shared/model.d.ts +1 -0
- package/dist/vscode.html-custom-data.json +30 -8
- package/dist/web-types.json +67 -11
- package/package.json +3 -3
- package/dist/cjs/document-click-listener-BbGE8WyV.js.map +0 -1
- package/dist/db-ux/p-049844c6.entry.js +0 -2
- package/dist/db-ux/p-049844c6.entry.js.map +0 -1
- package/dist/db-ux/p-1d40e8cd.entry.js +0 -2
- package/dist/db-ux/p-1d40e8cd.entry.js.map +0 -1
- package/dist/db-ux/p-33aaf986.entry.js.map +0 -1
- package/dist/db-ux/p-44f6404b.entry.js.map +0 -1
- package/dist/db-ux/p-50c9112b.entry.js.map +0 -1
- package/dist/db-ux/p-61410d87.entry.js.map +0 -1
- package/dist/db-ux/p-623a9409.entry.js +0 -2
- package/dist/db-ux/p-623a9409.entry.js.map +0 -1
- package/dist/db-ux/p-DszXleuv.js +0 -2
- package/dist/db-ux/p-DszXleuv.js.map +0 -1
- package/dist/db-ux/p-a1ee66b3.entry.js.map +0 -1
- package/dist/db-ux/p-b5a8e9c3.entry.js +0 -2
- package/dist/db-ux/p-b5a8e9c3.entry.js.map +0 -1
- package/dist/db-ux/p-c989b5d8.entry.js.map +0 -1
- package/dist/esm/document-click-listener-Bn3nIGhA.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.js","sourceRoot":"","sources":["../../../src/components/card/card.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAGlC,OAAO,EACL,SAAS,EACT,CAAC,EAED,KAAK,EAEL,IAAI,GACL,MAAM,eAAe,CAAC;AAGvB;;;GAGG;AAIH,MAAM,OAAO,MAAM;IAWjB,WAAW,CAAC,KAA8B;QACxC,
|
|
1
|
+
{"version":3,"file":"card.js","sourceRoot":"","sources":["../../../src/components/card/card.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAGlC,OAAO,EACL,SAAS,EACT,CAAC,EAED,KAAK,EAEL,IAAI,GACL,MAAM,eAAe,CAAC;AAGvB;;;GAGG;AAIH,MAAM,OAAO,MAAM;IAWjB,WAAW,CAAC,KAA8B;QACxC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,KAAK,CAAC,eAAe,EAAE,CAAC;YACxB,IAAI,CAAC,KAAK,CAA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from \"../../utils\";\nimport { ClickEvent } from \"../../shared/model\";\n\nimport {\n Component,\n h,\n Fragment,\n Event,\n EventEmitter,\n Prop,\n} from \"@stencil/core\";\n\n\n/**\n * @slot children - This is a default/unnamed slot\n\n */\n @Component({\n tag: \"db-card\",\n})\nexport class DBCard {\n private _ref!: HTMLDivElement | any;\n @Event() click: EventEmitter<\n Parameters<Required<DBCardProps>[\"onClick\"]>[number]\n > | void;\n @Prop() id: DBCardProps[\"id\"];\n @Prop({attribute: \"classname\"}) className: DBCardProps[\"className\"];\n @Prop() behavior: DBCardProps[\"behavior\"];\n @Prop() elevationLevel: DBCardProps[\"elevationLevel\"];\n @Prop() spacing: DBCardProps[\"spacing\"];\n\n handleClick(event: ClickEvent<HTMLElement>) {\n if (this.click) {\n event.stopPropagation();\n this.click.emit(event);\n }\n }\n\n /**\n * Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.\n * @param element the ref for the component\n * @param customElementSelector the custom element like `my-component`\n */\n private enableAttributePassing(\n element: HTMLElement | null,\n customElementSelector: string\n ) {\n const parent = element?.closest(customElementSelector);\n if (element && parent) {\n const attributes = parent.attributes;\n for (let i = 0; i < attributes.length; i++) {\n const attr = attributes.item(i);\n if (\n attr &&\n (attr.name.startsWith(\"data-\") || attr.name.startsWith(\"aria-\"))\n ) {\n element.setAttribute(attr.name, attr.value);\n parent.removeAttribute(attr.name);\n }\n if (attr && attr.name === \"class\") {\n const isWebComponent = attr.value.includes(\"hydrated\");\n const value = attr.value.replace(\"hydrated\", \"\").trim();\n const currentClass = element.getAttribute(\"class\");\n element.setAttribute(\n attr.name,\n `${currentClass ? `${currentClass} ` : \"\"}${value}`\n );\n if (isWebComponent) {\n // Stencil is using this class for lazy loading component\n parent.setAttribute(\"class\", \"hydrated\");\n } else {\n parent.removeAttribute(attr.name);\n }\n }\n }\n }\n }\n\n componentDidLoad() {\n this.enableAttributePassing(this._ref, \"db-card\");\n }\n\n render() {\n return (\n <div\n class={cls(\"db-card\", this.className)}\n ref={(el: any) => {\n this._ref = el;\n }}\n id={this.id}\n data-behavior={this.behavior}\n data-elevation-level={this.elevationLevel}\n data-spacing={this.spacing}\n role={this.behavior === \"interactive\" ? \"button\" : undefined}\n tabIndex={this.behavior === \"interactive\" ? 0 : undefined}\n onClick={(event) => this.handleClick(event)}\n >\n <slot></slot>\n </div>\n );\n }\n}\n"]}
|
|
@@ -165,9 +165,10 @@ export class DBCheckbox {
|
|
|
165
165
|
this.watch3Fn();
|
|
166
166
|
}
|
|
167
167
|
render() {
|
|
168
|
-
|
|
168
|
+
var _a;
|
|
169
|
+
return (h("div", { key: 'f92f4ce6f0b52bb6070fe6e20733ecd707451e96', class: cls("db-checkbox", this.className), "data-size": this.size, "data-hide-label": getHideProp(this.showLabel) }, h("label", { key: '990945de43f9762b1df03675ef6359309af74e12', htmlFor: this._id }, h("input", { key: '936540fd8734a6dd0f36ee045fd6aeb8afd6da6d', type: "checkbox", "aria-invalid": this.validation === "invalid", "data-custom-validity": this.validation, ref: (el) => {
|
|
169
170
|
this._ref = el;
|
|
170
|
-
}, 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": this._descByIds }), this.label ? this.label : h("slot", null)), stringPropVisible(this.message, this.showMessage) ? (h("db-infotext", { size: "small", icon: this.messageIcon, id: this._messageId }, this.message)) : null, this.hasValidState() ? (h("db-infotext", { size: "small", semantic: "successful", id: this._validMessageId }, this.validMessage || DEFAULT_VALID_MESSAGE)) : null, h("db-infotext", { key: '
|
|
171
|
+
}, id: this._id, name: this.name, checked: getBoolean(this.checked, "checked"), disabled: getBoolean(this.disabled, "disabled"), value: this.value, required: getBoolean(this.required, "required"), 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 : h("slot", null)), stringPropVisible(this.message, this.showMessage) ? (h("db-infotext", { size: "small", icon: this.messageIcon, id: this._messageId }, this.message)) : null, this.hasValidState() ? (h("db-infotext", { size: "small", semantic: "successful", id: this._validMessageId }, this.validMessage || DEFAULT_VALID_MESSAGE)) : null, h("db-infotext", { key: '8ac0628f46e2c5efbad5f06cae43bc5094cff5e4', size: "small", semantic: "critical", id: this._invalidMessageId }, this._invalidMessage), h("span", { key: '2ab1e7a4747afb69201d91b84a9d9c21c8a9c0ac', "data-visually-hidden": "true", role: "status" }, this._voiceOverFallback)));
|
|
171
172
|
}
|
|
172
173
|
static get is() { return "db-checkbox"; }
|
|
173
174
|
static get properties() {
|
|
@@ -547,6 +548,31 @@ export class DBCheckbox {
|
|
|
547
548
|
"setter": false,
|
|
548
549
|
"reflect": false
|
|
549
550
|
},
|
|
551
|
+
"ariaDescribedBy": {
|
|
552
|
+
"type": "string",
|
|
553
|
+
"attribute": "aria-described-by",
|
|
554
|
+
"mutable": false,
|
|
555
|
+
"complexType": {
|
|
556
|
+
"original": "DBCheckboxProps[\"ariaDescribedBy\"]",
|
|
557
|
+
"resolved": "string",
|
|
558
|
+
"references": {
|
|
559
|
+
"DBCheckboxProps": {
|
|
560
|
+
"location": "import",
|
|
561
|
+
"path": "./model",
|
|
562
|
+
"id": "src/components/checkbox/model.ts::DBCheckboxProps"
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
},
|
|
566
|
+
"required": false,
|
|
567
|
+
"optional": false,
|
|
568
|
+
"docs": {
|
|
569
|
+
"tags": [],
|
|
570
|
+
"text": ""
|
|
571
|
+
},
|
|
572
|
+
"getter": false,
|
|
573
|
+
"setter": false,
|
|
574
|
+
"reflect": false
|
|
575
|
+
},
|
|
550
576
|
"label": {
|
|
551
577
|
"type": "string",
|
|
552
578
|
"attribute": "label",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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DBCheckboxProps, DBCheckboxState } from \"./model\";\nimport {\n DEFAULT_INVALID_MESSAGE,\n DEFAULT_INVALID_MESSAGE_ID_SUFFIX,\n DEFAULT_MESSAGE_ID_SUFFIX,\n DEFAULT_VALID_MESSAGE,\n DEFAULT_VALID_MESSAGE_ID_SUFFIX,\n} from \"../../shared/constants\";\nimport { ChangeEvent, InteractionEvent } from \"../../shared/model\";\nimport {\n handleFrameworkEventAngular,\n handleFrameworkEventVue,\n} from \"../../utils/form-components\";\nimport { DBInfotext } from \"../infotext/infotext\";\nimport {\n cls,\n delay,\n getBoolean,\n getHideProp,\n hasVoiceOver,\n stringPropVisible,\n uuid,\n} from \"../../utils\";\n\nimport {\n Component,\n h,\n Fragment,\n Watch,\n Event,\n EventEmitter,\n Prop,\n State,\n} from \"@stencil/core\";\n\n\n/**\n * @slot children - This is a default/unnamed slot\n\n */\n @Component({\n tag: \"db-checkbox\",\n})\nexport class DBCheckbox {\n private _ref!: HTMLInputElement | any;\n @Prop() id: DBCheckboxProps[\"id\"];\n @Prop() invalidMessage: DBCheckboxProps[\"invalidMessage\"];\n @Prop() message: DBCheckboxProps[\"message\"];\n @Prop() showMessage: DBCheckboxProps[\"showMessage\"];\n @Prop() indeterminate: DBCheckboxProps[\"indeterminate\"];\n @Prop() checked: DBCheckboxProps[\"checked\"];\n @Prop() validMessage: DBCheckboxProps[\"validMessage\"];\n @Prop() validation: DBCheckboxProps[\"validation\"];\n @Prop() required: DBCheckboxProps[\"required\"];\n @Event() change: EventEmitter<\n Parameters<Required<DBCheckboxProps>[\"onChange\"]>[number]\n > | void;\n @Event() blur: EventEmitter<\n Parameters<Required<DBCheckboxProps>[\"onBlur\"]>[number]\n > | void;\n @Event() focus: EventEmitter<\n Parameters<Required<DBCheckboxProps>[\"onFocus\"]>[number]\n > | void;\n @Prop({attribute: \"classname\"}) className: DBCheckboxProps[\"className\"];\n @Prop() size: DBCheckboxProps[\"size\"];\n @Prop() showLabel: DBCheckboxProps[\"showLabel\"];\n @Prop() name: DBCheckboxProps[\"name\"];\n @Prop() disabled: DBCheckboxProps[\"disabled\"];\n @Prop() value: DBCheckboxProps[\"value\"];\n @Prop() label: DBCheckboxProps[\"label\"];\n @Prop() messageIcon: DBCheckboxProps[\"messageIcon\"];\n @State() initialized = false;\n @State() _id = undefined;\n @State() _messageId = undefined;\n @State() _validMessageId = undefined;\n @State() _invalidMessageId = undefined;\n @State() _invalidMessage = undefined;\n @State() _descByIds = \"\";\n @State() _voiceOverFallback = \"\";\n\n hasValidState() {\n return !!(this.validMessage ?? this.validation === \"valid\");\n }\n handleValidation() {\n /* For a11y reasons we need to map the correct message with the checkbox */\n if (!this._ref?.validity.valid || this.validation === \"invalid\") {\n this._descByIds = this._invalidMessageId;\n this._invalidMessage =\n this.invalidMessage ||\n this._ref?.validationMessage ||\n DEFAULT_INVALID_MESSAGE;\n if (hasVoiceOver()) {\n this._voiceOverFallback = this._invalidMessage;\n delay(() => (this._voiceOverFallback = \"\"), 1000);\n }\n } else if (\n this.hasValidState() &&\n this._ref?.validity.valid &&\n this.required\n ) {\n this._descByIds = this._validMessageId;\n if (hasVoiceOver()) {\n this._voiceOverFallback = this.validMessage ?? DEFAULT_VALID_MESSAGE;\n delay(() => (this._voiceOverFallback = \"\"), 1000);\n }\n } else if (stringPropVisible(this.message, this.showMessage)) {\n this._descByIds = this._messageId;\n } else {\n this._descByIds = \"\";\n }\n }\n handleChange(event: ChangeEvent<HTMLInputElement>) {\n event.stopPropagation();\n if (this.change) {\n this.change.emit(event);\n }\n this.handleValidation();\n }\n handleBlur(event: InteractionEvent<HTMLInputElement> | any) {\n event.stopPropagation();\n if (this.blur) {\n this.blur.emit(event);\n }\n }\n handleFocus(event: InteractionEvent<HTMLInputElement> | any) {\n event.stopPropagation();\n if (this.focus) {\n this.focus.emit(event);\n }\n }\n\n /**\n * Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.\n * @param element the ref for the component\n * @param customElementSelector the custom element like `my-component`\n */\n private enableAttributePassing(\n element: HTMLInputElement | null,\n customElementSelector: string\n ) {\n const parent = element?.closest(customElementSelector);\n if (element && parent) {\n const attributes = parent.attributes;\n for (let i = 0; i < attributes.length; i++) {\n const attr = attributes.item(i);\n if (\n attr &&\n (attr.name.startsWith(\"data-\") || attr.name.startsWith(\"aria-\"))\n ) {\n element.setAttribute(attr.name, attr.value);\n parent.removeAttribute(attr.name);\n }\n if (attr && attr.name === \"class\") {\n const isWebComponent = attr.value.includes(\"hydrated\");\n const value = attr.value.replace(\"hydrated\", \"\").trim();\n const currentClass = element.getAttribute(\"class\");\n element.setAttribute(\n attr.name,\n `${currentClass ? `${currentClass} ` : \"\"}${value}`\n );\n if (isWebComponent) {\n // Stencil is using this class for lazy loading component\n parent.setAttribute(\"class\", \"hydrated\");\n } else {\n parent.removeAttribute(attr.name);\n }\n }\n }\n }\n }\n\n watch0Fn() {\n this._invalidMessage =\n this.invalidMessage ||\n this._ref?.validationMessage ||\n DEFAULT_INVALID_MESSAGE;\n }\n\n @Watch(\"_ref\")\n @Watch(\"invalidMessage\")\n watch0() {\n this.watch0Fn();\n }\n\n watch1Fn() {\n if (this._id) {\n const messageId = this._id + DEFAULT_MESSAGE_ID_SUFFIX;\n this._messageId = messageId;\n this._validMessageId = this._id + DEFAULT_VALID_MESSAGE_ID_SUFFIX;\n this._invalidMessageId = this._id + DEFAULT_INVALID_MESSAGE_ID_SUFFIX;\n if (stringPropVisible(this.message, this.showMessage)) {\n this._descByIds = messageId;\n }\n }\n }\n\n @Watch(\"_id\")\n watch1() {\n this.watch1Fn();\n }\n\n watch2Fn() {\n if (this._ref) {\n if (this.indeterminate !== undefined) {\n // When indeterminate is set, the value of the checked prop only impacts the form submitted values.\n // It has no accessibility or UX implications. (https://mui.com/material-ui/react-checkbox/)\n this._ref.indeterminate = !!getBoolean(this.indeterminate);\n }\n }\n }\n\n @Watch(\"initialized\")\n @Watch(\"_ref\")\n @Watch(\"indeterminate\")\n watch2() {\n this.watch2Fn();\n }\n\n watch3Fn() {\n if (this.initialized && this._ref) {\n // in angular this must be set via native element\n if (this.checked != undefined) {\n this._ref.checked = !!getBoolean(this.checked);\n }\n this.initialized = false;\n }\n }\n\n @Watch(\"initialized\")\n @Watch(\"_ref\")\n @Watch(\"checked\")\n watch3() {\n this.watch3Fn();\n }\n\n componentDidLoad() {\n this.enableAttributePassing(this._ref, \"db-checkbox\");\n this.initialized = true;\n const mId = this.id ?? `checkbox-${uuid()}`;\n this._id = mId;\n this._messageId = mId + DEFAULT_MESSAGE_ID_SUFFIX;\n this._validMessageId = mId + DEFAULT_VALID_MESSAGE_ID_SUFFIX;\n this._invalidMessageId = mId + DEFAULT_INVALID_MESSAGE_ID_SUFFIX;\n this._invalidMessage = this.invalidMessage || DEFAULT_INVALID_MESSAGE;\n this.watch0Fn();\n this.watch1Fn();\n this.watch2Fn();\n this.watch3Fn();\n }\n\n render() {\n return (\n <div\n class={cls(\"db-checkbox\", this.className)}\n data-size={this.size}\n data-hide-label={getHideProp(this.showLabel)}\n >\n <label htmlFor={this._id}>\n <input\n type=\"checkbox\"\n aria-invalid={this.validation === \"invalid\"}\n data-custom-validity={this.validation}\n ref={(el: any) => {\n this._ref = el;\n }}\n id={this._id}\n name={this.name}\n checked={getBoolean(this.checked, \"checked\")}\n disabled={getBoolean(this.disabled, \"disabled\")}\n value={this.value}\n required={getBoolean(this.required, \"required\")}\n onChange={(event) => this.handleChange(event)}\n onBlur={(event) => this.handleBlur(event)}\n onFocus={(event) => this.handleFocus(event)}\n aria-describedby={this._descByIds}\n />\n {this.label ? this.label : <slot></slot>}\n </label>\n {stringPropVisible(this.message, this.showMessage) ? (\n <db-infotext\n size=\"small\"\n icon={this.messageIcon}\n id={this._messageId}\n >\n {this.message}\n </db-infotext>\n ) : null}\n {this.hasValidState() ? (\n <db-infotext\n size=\"small\"\n semantic=\"successful\"\n id={this._validMessageId}\n >\n {this.validMessage || DEFAULT_VALID_MESSAGE}\n </db-infotext>\n ) : null}\n <db-infotext\n size=\"small\"\n semantic=\"critical\"\n id={this._invalidMessageId}\n >\n {this._invalidMessage}\n </db-infotext>\n <span data-visually-hidden=\"true\" role=\"status\">\n {this._voiceOverFallback}\n </span>\n </div>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../../src/components/checkbox/checkbox.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,uBAAuB,EACvB,iCAAiC,EACjC,yBAAyB,EACzB,qBAAqB,EACrB,+BAA+B,GAChC,MAAM,wBAAwB,CAAC;AAOhC,OAAO,EACL,GAAG,EACH,KAAK,EACL,UAAU,EACV,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,IAAI,GACL,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,SAAS,EACT,CAAC,EAED,KAAK,EACL,KAAK,EAEL,IAAI,EACJ,KAAK,GACN,MAAM,eAAe,CAAC;AAGvB;;;GAGG;AAIH,MAAM,OAAO,UAAU;IAHtB;QAgCU,gBAAW,GAAG,KAAK,CAAC;QACpB,QAAG,GAAG,SAAS,CAAC;QAChB,eAAU,GAAG,SAAS,CAAC;QACvB,oBAAe,GAAG,SAAS,CAAC;QAC5B,sBAAiB,GAAG,SAAS,CAAC;QAC9B,oBAAe,GAAG,SAAS,CAAC;QAC5B,eAAU,GAAG,EAAE,CAAC;QAChB,uBAAkB,GAAG,EAAE,CAAC;KAuOlC;IArOC,aAAa;;QACX,OAAO,CAAC,CAAC,CAAC,MAAA,IAAI,CAAC,YAAY,mCAAI,IAAI,CAAC,UAAU,KAAK,OAAO,CAAC,CAAC;IAC9D,CAAC;IACD,gBAAgB;;QACd,2EAA2E;QAC3E,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,QAAQ,CAAC,KAAK,CAAA,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YAChE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC;YACzC,IAAI,CAAC,eAAe;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { DBCheckboxProps, DBCheckboxState } from \"./model\";\nimport {\n DEFAULT_INVALID_MESSAGE,\n DEFAULT_INVALID_MESSAGE_ID_SUFFIX,\n DEFAULT_MESSAGE_ID_SUFFIX,\n DEFAULT_VALID_MESSAGE,\n DEFAULT_VALID_MESSAGE_ID_SUFFIX,\n} from \"../../shared/constants\";\nimport { ChangeEvent, InteractionEvent } from \"../../shared/model\";\nimport {\n handleFrameworkEventAngular,\n handleFrameworkEventVue,\n} from \"../../utils/form-components\";\nimport { DBInfotext } from \"../infotext/infotext\";\nimport {\n cls,\n delay,\n getBoolean,\n getHideProp,\n hasVoiceOver,\n stringPropVisible,\n uuid,\n} from \"../../utils\";\n\nimport {\n Component,\n h,\n Fragment,\n Watch,\n Event,\n EventEmitter,\n Prop,\n State,\n} from \"@stencil/core\";\n\n\n/**\n * @slot children - This is a default/unnamed slot\n\n */\n @Component({\n tag: \"db-checkbox\",\n})\nexport class DBCheckbox {\n private _ref!: HTMLInputElement | any;\n @Prop() id: DBCheckboxProps[\"id\"];\n @Prop() invalidMessage: DBCheckboxProps[\"invalidMessage\"];\n @Prop() message: DBCheckboxProps[\"message\"];\n @Prop() showMessage: DBCheckboxProps[\"showMessage\"];\n @Prop() indeterminate: DBCheckboxProps[\"indeterminate\"];\n @Prop() checked: DBCheckboxProps[\"checked\"];\n @Prop() validMessage: DBCheckboxProps[\"validMessage\"];\n @Prop() validation: DBCheckboxProps[\"validation\"];\n @Prop() required: DBCheckboxProps[\"required\"];\n @Event() change: EventEmitter<\n Parameters<Required<DBCheckboxProps>[\"onChange\"]>[number]\n > | void;\n @Event() blur: EventEmitter<\n Parameters<Required<DBCheckboxProps>[\"onBlur\"]>[number]\n > | void;\n @Event() focus: EventEmitter<\n Parameters<Required<DBCheckboxProps>[\"onFocus\"]>[number]\n > | void;\n @Prop({attribute: \"classname\"}) className: DBCheckboxProps[\"className\"];\n @Prop() size: DBCheckboxProps[\"size\"];\n @Prop() showLabel: DBCheckboxProps[\"showLabel\"];\n @Prop() name: DBCheckboxProps[\"name\"];\n @Prop() disabled: DBCheckboxProps[\"disabled\"];\n @Prop() value: DBCheckboxProps[\"value\"];\n @Prop() ariaDescribedBy: DBCheckboxProps[\"ariaDescribedBy\"];\n @Prop() label: DBCheckboxProps[\"label\"];\n @Prop() messageIcon: DBCheckboxProps[\"messageIcon\"];\n @State() initialized = false;\n @State() _id = undefined;\n @State() _messageId = undefined;\n @State() _validMessageId = undefined;\n @State() _invalidMessageId = undefined;\n @State() _invalidMessage = undefined;\n @State() _descByIds = \"\";\n @State() _voiceOverFallback = \"\";\n\n hasValidState() {\n return !!(this.validMessage ?? this.validation === \"valid\");\n }\n handleValidation() {\n /* For a11y reasons we need to map the correct message with the checkbox */\n if (!this._ref?.validity.valid || this.validation === \"invalid\") {\n this._descByIds = this._invalidMessageId;\n this._invalidMessage =\n this.invalidMessage ||\n this._ref?.validationMessage ||\n DEFAULT_INVALID_MESSAGE;\n if (hasVoiceOver()) {\n this._voiceOverFallback = this._invalidMessage;\n delay(() => (this._voiceOverFallback = \"\"), 1000);\n }\n } else if (\n this.hasValidState() &&\n this._ref?.validity.valid &&\n this.required\n ) {\n this._descByIds = this._validMessageId;\n if (hasVoiceOver()) {\n this._voiceOverFallback = this.validMessage ?? DEFAULT_VALID_MESSAGE;\n delay(() => (this._voiceOverFallback = \"\"), 1000);\n }\n } else if (stringPropVisible(this.message, this.showMessage)) {\n this._descByIds = this._messageId;\n } else {\n this._descByIds = \"\";\n }\n }\n handleChange(event: ChangeEvent<HTMLInputElement>) {\n event.stopPropagation();\n if (this.change) {\n this.change.emit(event);\n }\n this.handleValidation();\n }\n handleBlur(event: InteractionEvent<HTMLInputElement> | any) {\n event.stopPropagation();\n if (this.blur) {\n this.blur.emit(event);\n }\n }\n handleFocus(event: InteractionEvent<HTMLInputElement> | any) {\n event.stopPropagation();\n if (this.focus) {\n this.focus.emit(event);\n }\n }\n\n /**\n * Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.\n * @param element the ref for the component\n * @param customElementSelector the custom element like `my-component`\n */\n private enableAttributePassing(\n element: HTMLInputElement | null,\n customElementSelector: string\n ) {\n const parent = element?.closest(customElementSelector);\n if (element && parent) {\n const attributes = parent.attributes;\n for (let i = 0; i < attributes.length; i++) {\n const attr = attributes.item(i);\n if (\n attr &&\n (attr.name.startsWith(\"data-\") || attr.name.startsWith(\"aria-\"))\n ) {\n element.setAttribute(attr.name, attr.value);\n parent.removeAttribute(attr.name);\n }\n if (attr && attr.name === \"class\") {\n const isWebComponent = attr.value.includes(\"hydrated\");\n const value = attr.value.replace(\"hydrated\", \"\").trim();\n const currentClass = element.getAttribute(\"class\");\n element.setAttribute(\n attr.name,\n `${currentClass ? `${currentClass} ` : \"\"}${value}`\n );\n if (isWebComponent) {\n // Stencil is using this class for lazy loading component\n parent.setAttribute(\"class\", \"hydrated\");\n } else {\n parent.removeAttribute(attr.name);\n }\n }\n }\n }\n }\n\n watch0Fn() {\n this._invalidMessage =\n this.invalidMessage ||\n this._ref?.validationMessage ||\n DEFAULT_INVALID_MESSAGE;\n }\n\n @Watch(\"_ref\")\n @Watch(\"invalidMessage\")\n watch0() {\n this.watch0Fn();\n }\n\n watch1Fn() {\n if (this._id) {\n const messageId = this._id + DEFAULT_MESSAGE_ID_SUFFIX;\n this._messageId = messageId;\n this._validMessageId = this._id + DEFAULT_VALID_MESSAGE_ID_SUFFIX;\n this._invalidMessageId = this._id + DEFAULT_INVALID_MESSAGE_ID_SUFFIX;\n if (stringPropVisible(this.message, this.showMessage)) {\n this._descByIds = messageId;\n }\n }\n }\n\n @Watch(\"_id\")\n watch1() {\n this.watch1Fn();\n }\n\n watch2Fn() {\n if (this._ref) {\n if (this.indeterminate !== undefined) {\n // When indeterminate is set, the value of the checked prop only impacts the form submitted values.\n // It has no accessibility or UX implications. (https://mui.com/material-ui/react-checkbox/)\n this._ref.indeterminate = !!getBoolean(this.indeterminate);\n }\n }\n }\n\n @Watch(\"initialized\")\n @Watch(\"_ref\")\n @Watch(\"indeterminate\")\n watch2() {\n this.watch2Fn();\n }\n\n watch3Fn() {\n if (this.initialized && this._ref) {\n // in angular this must be set via native element\n if (this.checked != undefined) {\n this._ref.checked = !!getBoolean(this.checked);\n }\n this.initialized = false;\n }\n }\n\n @Watch(\"initialized\")\n @Watch(\"_ref\")\n @Watch(\"checked\")\n watch3() {\n this.watch3Fn();\n }\n\n componentDidLoad() {\n this.enableAttributePassing(this._ref, \"db-checkbox\");\n this.initialized = true;\n const mId = this.id ?? `checkbox-${uuid()}`;\n this._id = mId;\n this._messageId = mId + DEFAULT_MESSAGE_ID_SUFFIX;\n this._validMessageId = mId + DEFAULT_VALID_MESSAGE_ID_SUFFIX;\n this._invalidMessageId = mId + DEFAULT_INVALID_MESSAGE_ID_SUFFIX;\n this._invalidMessage = this.invalidMessage || DEFAULT_INVALID_MESSAGE;\n this.watch0Fn();\n this.watch1Fn();\n this.watch2Fn();\n this.watch3Fn();\n }\n\n render() {\n return (\n <div\n class={cls(\"db-checkbox\", this.className)}\n data-size={this.size}\n data-hide-label={getHideProp(this.showLabel)}\n >\n <label htmlFor={this._id}>\n <input\n type=\"checkbox\"\n aria-invalid={this.validation === \"invalid\"}\n data-custom-validity={this.validation}\n ref={(el: any) => {\n this._ref = el;\n }}\n id={this._id}\n name={this.name}\n checked={getBoolean(this.checked, \"checked\")}\n disabled={getBoolean(this.disabled, \"disabled\")}\n value={this.value}\n required={getBoolean(this.required, \"required\")}\n onChange={(event) => this.handleChange(event)}\n onBlur={(event) => this.handleBlur(event)}\n onFocus={(event) => this.handleFocus(event)}\n aria-describedby={this.ariaDescribedBy ?? this._descByIds}\n />\n {this.label ? this.label : <slot></slot>}\n </label>\n {stringPropVisible(this.message, this.showMessage) ? (\n <db-infotext\n size=\"small\"\n icon={this.messageIcon}\n id={this._messageId}\n >\n {this.message}\n </db-infotext>\n ) : null}\n {this.hasValidState() ? (\n <db-infotext\n size=\"small\"\n semantic=\"successful\"\n id={this._validMessageId}\n >\n {this.validMessage || DEFAULT_VALID_MESSAGE}\n </db-infotext>\n ) : null}\n <db-infotext\n size=\"small\"\n semantic=\"critical\"\n id={this._invalidMessageId}\n >\n {this._invalidMessage}\n </db-infotext>\n <span data-visually-hidden=\"true\" role=\"status\">\n {this._voiceOverFallback}\n </span>\n </div>\n );\n }\n}\n"]}
|
|
@@ -36,8 +36,9 @@ export class DBCustomSelect {
|
|
|
36
36
|
this._internalChangeTimestamp = 0;
|
|
37
37
|
this.selectAllChecked = false;
|
|
38
38
|
this.selectAllIndeterminate = false;
|
|
39
|
-
this.satisfyReact = function satisfyReact() {
|
|
40
|
-
// This is
|
|
39
|
+
this.satisfyReact = function satisfyReact(event) {
|
|
40
|
+
// This is a function to satisfy React
|
|
41
|
+
event.stopPropagation();
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
44
|
hasValidState() {
|
|
@@ -83,11 +84,17 @@ export class DBCustomSelect {
|
|
|
83
84
|
}
|
|
84
85
|
handleDropdownToggle(event) {
|
|
85
86
|
if (this.dropdownToggle) {
|
|
87
|
+
event.stopPropagation();
|
|
86
88
|
this.dropdownToggle.emit(event);
|
|
87
89
|
}
|
|
88
90
|
if (event.target.open) {
|
|
89
91
|
this._documentClickListenerCallbackId =
|
|
90
92
|
new DocumentClickListener().addCallback((event) => this.handleDocumentClose(event));
|
|
93
|
+
this.handleAutoPlacement();
|
|
94
|
+
if (!event.target.dataset.test) {
|
|
95
|
+
// We need this workaround for snapshot testing
|
|
96
|
+
this.handleOpenByKeyboardFocus();
|
|
97
|
+
}
|
|
91
98
|
}
|
|
92
99
|
else {
|
|
93
100
|
if (this._documentClickListenerCallbackId) {
|
|
@@ -133,11 +140,14 @@ export class DBCustomSelect {
|
|
|
133
140
|
return ((_b = (_a = option.id) !== null && _a !== void 0 ? _a : option.value) !== null && _b !== void 0 ? _b : uuid()).toString();
|
|
134
141
|
}
|
|
135
142
|
getTagRemoveLabel(index) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
143
|
+
if (this.removeTagsTexts && this.removeTagsTexts.length > index) {
|
|
144
|
+
return this.removeTagsTexts.at(index);
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
return `${DEFAULT_REMOVE} ${this._selectedOptions
|
|
139
148
|
? this.getOptionLabel(this._selectedOptions[index])
|
|
140
149
|
: ""}`;
|
|
150
|
+
}
|
|
141
151
|
}
|
|
142
152
|
handleTagRemove(option, event) {
|
|
143
153
|
event.stopPropagation();
|
|
@@ -150,15 +160,15 @@ export class DBCustomSelect {
|
|
|
150
160
|
if (dropdown) {
|
|
151
161
|
delay(() => {
|
|
152
162
|
handleDataOutside(dropdown);
|
|
153
|
-
},
|
|
163
|
+
}, 1);
|
|
154
164
|
}
|
|
155
165
|
}
|
|
156
166
|
}
|
|
157
167
|
handleArrowDownUp(event) {
|
|
158
168
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
159
169
|
if ((_a = this.detailsRef) === null || _a === void 0 ? void 0 : _a.open) {
|
|
160
|
-
if (document) {
|
|
161
|
-
const activeElement = document.activeElement;
|
|
170
|
+
if (self.document) {
|
|
171
|
+
const activeElement = self.document.activeElement;
|
|
162
172
|
if (activeElement) {
|
|
163
173
|
// 1. we check if we are currently focusing a checkbox in the dropdown
|
|
164
174
|
const isCheckbox = activeElement.getAttribute("type") === "checkbox" ||
|
|
@@ -215,8 +225,6 @@ export class DBCustomSelect {
|
|
|
215
225
|
}
|
|
216
226
|
}
|
|
217
227
|
}
|
|
218
|
-
event.stopPropagation();
|
|
219
|
-
event.preventDefault();
|
|
220
228
|
}
|
|
221
229
|
else if (event.key === "ArrowDown" || event.key === "ArrowRight") {
|
|
222
230
|
// Open dropdown with arrows see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/#keyboardinteraction
|
|
@@ -225,13 +233,14 @@ export class DBCustomSelect {
|
|
|
225
233
|
this.detailsRef.open = true;
|
|
226
234
|
}
|
|
227
235
|
this.handleOpenByKeyboardFocus();
|
|
228
|
-
event.stopPropagation();
|
|
229
|
-
event.preventDefault();
|
|
230
236
|
}
|
|
237
|
+
event.stopPropagation();
|
|
238
|
+
event.preventDefault();
|
|
231
239
|
}
|
|
232
240
|
handleKeyboardPress(event) {
|
|
233
241
|
var _a;
|
|
234
|
-
|
|
242
|
+
event.stopPropagation();
|
|
243
|
+
if (event.key === "Escape" && ((_a = this.detailsRef) === null || _a === void 0 ? void 0 : _a.open)) {
|
|
235
244
|
this.handleClose("close");
|
|
236
245
|
this.handleSummaryFocus();
|
|
237
246
|
}
|
|
@@ -251,25 +260,29 @@ export class DBCustomSelect {
|
|
|
251
260
|
else if (this.detailsRef.open && (event === null || event === void 0 ? void 0 : event.relatedTarget)) {
|
|
252
261
|
const relatedTarget = event.relatedTarget;
|
|
253
262
|
if (!this.detailsRef.contains(relatedTarget)) {
|
|
254
|
-
|
|
263
|
+
// We need to use delay here because the combination of `contains`
|
|
264
|
+
// and changing the DOM element causes a race condition inside browser
|
|
265
|
+
delay(() => (this.detailsRef.open = false), 1);
|
|
255
266
|
}
|
|
256
267
|
}
|
|
257
268
|
}
|
|
258
269
|
}
|
|
259
270
|
handleDocumentClose(event) {
|
|
260
|
-
var _a;
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
this.detailsRef.open
|
|
271
|
+
var _a, _b;
|
|
272
|
+
if (event) {
|
|
273
|
+
// stencil is sending a custom event which wraps the pointer event into details
|
|
274
|
+
const target = typeof event.detail === "number" ? event.target : (_a = event.detail) === null || _a === void 0 ? void 0 : _a.target;
|
|
275
|
+
if (((_b = this.detailsRef) === null || _b === void 0 ? void 0 : _b.open) && !this.detailsRef.contains(target)) {
|
|
276
|
+
this.detailsRef.open = false;
|
|
277
|
+
}
|
|
265
278
|
}
|
|
266
279
|
}
|
|
267
280
|
handleOptionSelected(values) {
|
|
268
281
|
const skip = new Date().getTime() - this._internalChangeTimestamp < 200;
|
|
269
282
|
if (skip)
|
|
270
283
|
return;
|
|
284
|
+
this._values = values;
|
|
271
285
|
if (this.optionSelected) {
|
|
272
|
-
this._values = values;
|
|
273
286
|
this.optionSelected.emit(values !== null && values !== void 0 ? values : []);
|
|
274
287
|
}
|
|
275
288
|
this._internalChangeTimestamp = new Date().getTime();
|
|
@@ -291,8 +304,9 @@ export class DBCustomSelect {
|
|
|
291
304
|
}
|
|
292
305
|
}
|
|
293
306
|
}
|
|
294
|
-
handleSelectAll() {
|
|
307
|
+
handleSelectAll(event) {
|
|
295
308
|
var _a;
|
|
309
|
+
event.stopPropagation();
|
|
296
310
|
if (((_a = this._values) === null || _a === void 0 ? void 0 : _a.length) === this.amountOptions) {
|
|
297
311
|
this.handleOptionSelected([]);
|
|
298
312
|
}
|
|
@@ -322,12 +336,12 @@ export class DBCustomSelect {
|
|
|
322
336
|
delay(() => {
|
|
323
337
|
// Takes some time until element can be focused
|
|
324
338
|
checkbox.focus();
|
|
325
|
-
},
|
|
339
|
+
}, 1);
|
|
326
340
|
}
|
|
327
341
|
}
|
|
328
342
|
}
|
|
329
343
|
}
|
|
330
|
-
handleOpenByKeyboardFocus(
|
|
344
|
+
handleOpenByKeyboardFocus() {
|
|
331
345
|
if (this.detailsRef) {
|
|
332
346
|
// Focus search if possible
|
|
333
347
|
const search = getSearchInput(this.detailsRef);
|
|
@@ -335,9 +349,9 @@ export class DBCustomSelect {
|
|
|
335
349
|
delay(() => {
|
|
336
350
|
// Takes some time until element can be focused
|
|
337
351
|
search.focus();
|
|
338
|
-
},
|
|
352
|
+
}, 1);
|
|
339
353
|
}
|
|
340
|
-
else
|
|
354
|
+
else {
|
|
341
355
|
// Focus first checkbox otherwise
|
|
342
356
|
this.handleFocusFirstDropdownCheckbox();
|
|
343
357
|
}
|
|
@@ -346,21 +360,26 @@ export class DBCustomSelect {
|
|
|
346
360
|
handleSearch(event) {
|
|
347
361
|
event.stopPropagation();
|
|
348
362
|
const filterText = event.target.value;
|
|
349
|
-
this.
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
363
|
+
if (!this.options || !filterText || filterText.length === 0) {
|
|
364
|
+
this._options = this.options;
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
this._options = this.options.filter((option) => !option.isGroupTitle &&
|
|
368
|
+
this.getOptionLabel(option)
|
|
369
|
+
.toLowerCase()
|
|
370
|
+
.includes(filterText.toLowerCase()));
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
handleClearAll(event) {
|
|
374
|
+
event.stopPropagation();
|
|
358
375
|
this.handleOptionSelected([]);
|
|
359
376
|
this.handleSummaryFocus();
|
|
360
377
|
}
|
|
361
378
|
handleSummaryFocus() {
|
|
362
|
-
var _a
|
|
363
|
-
|
|
379
|
+
var _a;
|
|
380
|
+
if (this.detailsRef) {
|
|
381
|
+
(_a = this.detailsRef.querySelector("summary")) === null || _a === void 0 ? void 0 : _a.focus();
|
|
382
|
+
}
|
|
364
383
|
}
|
|
365
384
|
/**
|
|
366
385
|
* Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.
|
|
@@ -396,19 +415,6 @@ export class DBCustomSelect {
|
|
|
396
415
|
}
|
|
397
416
|
watch0Fn() {
|
|
398
417
|
if (this.detailsRef) {
|
|
399
|
-
const summary = this.detailsRef.querySelector("summary");
|
|
400
|
-
if (summary) {
|
|
401
|
-
summary.addEventListener("click", () => {
|
|
402
|
-
this.handleAutoPlacement();
|
|
403
|
-
this.handleOpenByKeyboardFocus(true);
|
|
404
|
-
});
|
|
405
|
-
summary.addEventListener("keydown", (event) => {
|
|
406
|
-
var _a;
|
|
407
|
-
if (event.code === "Space" && !((_a = this.detailsRef) === null || _a === void 0 ? void 0 : _a.open)) {
|
|
408
|
-
this.handleOpenByKeyboardFocus();
|
|
409
|
-
}
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
418
|
this.detailsRef.addEventListener("focusout", (event) => this.handleClose(event));
|
|
413
419
|
}
|
|
414
420
|
}
|
|
@@ -435,10 +441,11 @@ export class DBCustomSelect {
|
|
|
435
441
|
this.watch1Fn();
|
|
436
442
|
}
|
|
437
443
|
watch2Fn() {
|
|
444
|
+
var _a;
|
|
438
445
|
if (this.detailsRef) {
|
|
439
446
|
const summary = this.detailsRef.querySelector("summary");
|
|
440
447
|
if (summary) {
|
|
441
|
-
summary.setAttribute("aria-describedby", this._descByIds || "");
|
|
448
|
+
summary.setAttribute("aria-describedby", (_a = this.ariaDescribedBy) !== null && _a !== void 0 ? _a : (this._descByIds || ""));
|
|
442
449
|
}
|
|
443
450
|
}
|
|
444
451
|
}
|
|
@@ -457,13 +464,15 @@ export class DBCustomSelect {
|
|
|
457
464
|
this.watch3Fn();
|
|
458
465
|
}
|
|
459
466
|
watch4Fn() {
|
|
460
|
-
|
|
467
|
+
var _a;
|
|
468
|
+
this.selectAllEnabled = Boolean(this.multiple && ((_a = this.showSelectAll) !== null && _a !== void 0 ? _a : this.amountOptions > 5));
|
|
461
469
|
}
|
|
462
470
|
watch4() {
|
|
463
471
|
this.watch4Fn();
|
|
464
472
|
}
|
|
465
473
|
watch5Fn() {
|
|
466
|
-
|
|
474
|
+
var _a;
|
|
475
|
+
this.searchEnabled = (_a = this.showSearch) !== null && _a !== void 0 ? _a : this.amountOptions > 9;
|
|
467
476
|
}
|
|
468
477
|
watch5() {
|
|
469
478
|
this.watch5Fn();
|
|
@@ -519,8 +528,8 @@ export class DBCustomSelect {
|
|
|
519
528
|
}
|
|
520
529
|
watch11Fn() {
|
|
521
530
|
var _a, _b;
|
|
522
|
-
if ((_a = this.
|
|
523
|
-
this._selectedOptions = (_b = this.
|
|
531
|
+
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.length) {
|
|
532
|
+
this._selectedOptions = (_b = this.options) === null || _b === void 0 ? void 0 : _b.filter((option) => {
|
|
524
533
|
var _a, _b;
|
|
525
534
|
if (!option.value || !((_a = this._values) === null || _a === void 0 ? void 0 : _a["includes"])) {
|
|
526
535
|
return false;
|
|
@@ -612,19 +621,19 @@ export class DBCustomSelect {
|
|
|
612
621
|
}
|
|
613
622
|
render() {
|
|
614
623
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
615
|
-
return (h("div", { key: '
|
|
624
|
+
return (h("div", { key: 'e5c84bd53166b1c2c326628705bcc7b210373257', class: cls("db-custom-select", this.className), id: this._id, ref: (el) => {
|
|
616
625
|
this._ref = el;
|
|
617
626
|
}, "aria-invalid": this._validity === "invalid", "data-custom-validity": this._validity, "data-width": this.formFieldWidth, "data-variant": this.variant === "floating" &&
|
|
618
627
|
this.selectedType === "tag" &&
|
|
619
628
|
this.multiple
|
|
620
629
|
? "above"
|
|
621
|
-
: this.variant, "data-required": getBooleanAsString(this.required), "data-placement": this.placement, "data-selected-type": this.multiple ? this.selectedType : "text", "data-hide-label": getHideProp(this.showLabel), "data-icon": this.icon, "data-hide-icon": getHideProp(this.showIcon) }, h("label", { key: '
|
|
630
|
+
: this.variant, "data-required": getBooleanAsString(this.required), "data-placement": this.placement, "data-selected-type": this.multiple ? this.selectedType : "text", "data-hide-label": getHideProp(this.showLabel), "data-icon": this.icon, "data-hide-icon": getHideProp(this.showIcon) }, h("label", { key: '6ad1c58cc832e3b305e08291b628038827d85268', id: this._labelId }, (_a = this.label) !== null && _a !== void 0 ? _a : DEFAULT_LABEL, h("select", { key: 'dc027579b87dae8efd8d35a03984283b4de335ed', role: "none", hidden: true, id: this._selectId, tabIndex: -1, ref: (el) => {
|
|
622
631
|
this.selectRef = el;
|
|
623
|
-
}, form: this.form, name: this.name, multiple: getBoolean(this.multiple, "multiple"), disabled: getBoolean(this.disabled, "disabled"), required: getBoolean(this.required, "required"), onChange: () => this.satisfyReact() }, ((_b = this.
|
|
624
|
-
? (_c = this.
|
|
625
|
-
: null)), h("details", { key: '
|
|
632
|
+
}, form: this.form, name: this.name, 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)
|
|
633
|
+
? (_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))))
|
|
634
|
+
: null)), h("details", { key: 'a0eb8cd1ebf421ee0cce62f2add79f063b3af8ec', ref: (el) => {
|
|
626
635
|
this.detailsRef = el;
|
|
627
|
-
}, open: this.open, onToggle: (event) => this.handleDropdownToggle(event), onKeyDown: (event) => this.handleKeyboardPress(event) }, h("slot", { key: '
|
|
636
|
+
}, open: this.open, onToggle: (event) => this.handleDropdownToggle(event), onKeyDown: (event) => this.handleKeyboardPress(event) }, h("slot", { key: '73b0eb2d2e0ee85a5fa03e8a167f6e29b49bee3f' }), this.options ? (h(Fragment, null, h("summary", { class: "db-custom-select-form-field", id: this._summaryId, "aria-disabled": getBooleanAsString(this.disabled), "aria-labelledby": this._labelId }, ((_d = this._selectedLabels) === null || _d === void 0 ? void 0 : _d.length) ? (h("span", { "data-visually-hidden": getBooleanAsString(this.selectedType === "tag"), id: this._selectedLabelsId }, this._selectedLabels)) : null, this.selectedType === "tag" ? (h("div", null, (_e = this._selectedOptions) === null || _e === void 0 ? void 0 : _e.map((option, index) => (h("db-tag", { emphasis: "strong", behavior: "removable", removeButton: this.getTagRemoveLabel(index), 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) => {
|
|
628
637
|
this.searchInputRef = el;
|
|
629
638
|
}, name: this._id, form: this._id, showLabel: false, 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
|
|
630
639
|
? this._infoTextId
|
|
@@ -632,9 +641,9 @@ export class DBCustomSelect {
|
|
|
632
641
|
? this.noResultsText
|
|
633
642
|
: this.loadingText)) !== null && _h !== void 0 ? _h : DEFAULT_MESSAGE)) : (h(Fragment, null, this.selectAllEnabled ? (h("div", null, h("div", { class: "db-checkbox db-custom-select-list-item" }, h("label", null, h("input", { type: "checkbox", value: "select-all", ref: (el) => {
|
|
634
643
|
this.selectAllRef = el;
|
|
635
|
-
}, form: this._id, checked: this.selectAllChecked, onChange: () => this.handleSelectAll() }), this.getSelectAllLabel())))) : null, h("db-custom-select-list", { multiple: getBoolean(this.multiple, "multiple"), label: (_k = (_j = this.ariaListLabel) !== 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
|
|
644
|
+
}, 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.ariaListLabel) !== 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
|
|
636
645
|
? this.getOptionLabel(option)
|
|
637
|
-
: null)))))), h("div", null, h("db-button", { variant: "ghost", width: "full", icon: "cross", size: "small", name: this._id, form: this._id, onClick: () => this.handleClose("close") }, (_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, onClick: () => this.handleClearAll() }, this.clearSelectionText, h("db-tooltip", { placement: "top" }, this.clearSelectionText))) : null, h("span", { key: '
|
|
646
|
+
: null)))))), h("div", null, h("db-button", { variant: "ghost", width: "full", icon: "cross", size: "small", name: this._id, form: this._id, onClick: () => this.handleClose("close") }, (_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, onClick: (event) => this.handleClearAll(event) }, this.clearSelectionText, h("db-tooltip", { placement: "top" }, this.clearSelectionText))) : null, h("span", { key: '9cc02a4b34f7ec437a89c500b1cb05edf19de421', "aria-hidden": getBooleanAsString(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: 'd0843cbcf9ef1b0505f5fe0cc0c79d9568d094a7', size: "small", semantic: "critical", id: this._invalidMessageId }, this._invalidMessage), h("span", { key: '609e7ad21eb1b0c3b131f15ec77b12e584dc7ba7', "data-visually-hidden": "true", role: "status" }, this._voiceOverFallback)));
|
|
638
647
|
}
|
|
639
648
|
static get is() { return "db-custom-select"; }
|
|
640
649
|
static get properties() {
|
|
@@ -739,6 +748,31 @@ export class DBCustomSelect {
|
|
|
739
748
|
"setter": false,
|
|
740
749
|
"reflect": false
|
|
741
750
|
},
|
|
751
|
+
"ariaDescribedBy": {
|
|
752
|
+
"type": "string",
|
|
753
|
+
"attribute": "aria-described-by",
|
|
754
|
+
"mutable": false,
|
|
755
|
+
"complexType": {
|
|
756
|
+
"original": "DBCustomSelectProps[\"ariaDescribedBy\"]",
|
|
757
|
+
"resolved": "string",
|
|
758
|
+
"references": {
|
|
759
|
+
"DBCustomSelectProps": {
|
|
760
|
+
"location": "import",
|
|
761
|
+
"path": "./model",
|
|
762
|
+
"id": "src/components/custom-select/model.ts::DBCustomSelectProps"
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
},
|
|
766
|
+
"required": false,
|
|
767
|
+
"optional": false,
|
|
768
|
+
"docs": {
|
|
769
|
+
"tags": [],
|
|
770
|
+
"text": ""
|
|
771
|
+
},
|
|
772
|
+
"getter": false,
|
|
773
|
+
"setter": false,
|
|
774
|
+
"reflect": false
|
|
775
|
+
},
|
|
742
776
|
"showNoResults": {
|
|
743
777
|
"type": "boolean",
|
|
744
778
|
"attribute": "show-no-results",
|
|
@@ -1796,7 +1830,7 @@ export class DBCustomSelect {
|
|
|
1796
1830
|
"propName": "options",
|
|
1797
1831
|
"methodName": "watch10"
|
|
1798
1832
|
}, {
|
|
1799
|
-
"propName": "
|
|
1833
|
+
"propName": "options",
|
|
1800
1834
|
"methodName": "watch11"
|
|
1801
1835
|
}, {
|
|
1802
1836
|
"propName": "_values",
|