@db-ux/wc-core-components 2.4.0 → 2.4.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/dist/cjs/db-checkbox.cjs.entry.js +2 -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-dropdown.db-custom-select-list.db-custom-select-list-item.db-input.db-tag.entry.cjs.js.map +1 -1
- package/dist/cjs/db-custom-select-dropdown_5.cjs.entry.js +3 -3
- package/dist/cjs/db-custom-select-dropdown_5.cjs.entry.js.map +1 -1
- package/dist/cjs/db-radio.cjs.entry.js +2 -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 +4 -4
- 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 +2 -18
- 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/loader.cjs.js +1 -1
- package/dist/collection/components/checkbox/checkbox.js +23 -23
- package/dist/collection/components/checkbox/checkbox.js.map +1 -1
- package/dist/collection/components/input/input.js +28 -28
- package/dist/collection/components/input/input.js.map +1 -1
- package/dist/collection/components/radio/radio.js +27 -27
- package/dist/collection/components/radio/radio.js.map +1 -1
- package/dist/collection/components/select/select.js +24 -24
- package/dist/collection/components/select/select.js.map +1 -1
- package/dist/collection/components/switch/model.js.map +1 -1
- package/dist/collection/components/switch/switch.js +50 -70
- package/dist/collection/components/switch/switch.js.map +1 -1
- package/dist/collection/components/textarea/textarea.js +28 -28
- package/dist/collection/components/textarea/textarea.js.map +1 -1
- package/dist/custom-elements.json +289 -305
- package/dist/db-ux/db-checkbox.entry.esm.js.map +1 -1
- package/dist/db-ux/db-custom-select-dropdown.db-custom-select-list.db-custom-select-list-item.db-input.db-tag.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/{p-51f991c4.entry.js → p-2d389152.entry.js} +2 -2
- package/dist/db-ux/{p-51f991c4.entry.js.map → p-2d389152.entry.js.map} +1 -1
- package/dist/db-ux/p-684d11af.entry.js +2 -0
- package/dist/db-ux/p-684d11af.entry.js.map +1 -0
- package/dist/db-ux/{p-016e21b6.entry.js → p-77e5189c.entry.js} +2 -2
- package/dist/db-ux/{p-016e21b6.entry.js.map → p-77e5189c.entry.js.map} +1 -1
- package/dist/db-ux/{p-2f87bffd.entry.js → p-7ee7a06d.entry.js} +2 -2
- package/dist/db-ux/{p-2f87bffd.entry.js.map → p-7ee7a06d.entry.js.map} +1 -1
- package/dist/db-ux/p-81a85032.entry.js +2 -0
- package/dist/db-ux/{p-a258be18.entry.js.map → p-81a85032.entry.js.map} +1 -1
- package/dist/db-ux/{p-518d1a26.entry.js → p-fdb8daba.entry.js} +2 -2
- package/dist/db-ux/{p-518d1a26.entry.js.map → p-fdb8daba.entry.js.map} +1 -1
- package/dist/esm/db-checkbox.entry.js +2 -2
- package/dist/esm/db-checkbox.entry.js.map +1 -1
- package/dist/esm/db-custom-select-dropdown.db-custom-select-list.db-custom-select-list-item.db-input.db-tag.entry.js.map +1 -1
- package/dist/esm/db-custom-select-dropdown_5.entry.js +3 -3
- package/dist/esm/db-custom-select-dropdown_5.entry.js.map +1 -1
- package/dist/esm/db-radio.entry.js +3 -3
- package/dist/esm/db-radio.entry.js.map +1 -1
- package/dist/esm/db-select.entry.js +4 -4
- package/dist/esm/db-select.entry.js.map +1 -1
- package/dist/esm/db-switch.entry.js +3 -19
- 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/loader.js +1 -1
- package/dist/types/components/checkbox/checkbox.d.ts +1 -1
- package/dist/types/components/input/input.d.ts +1 -1
- package/dist/types/components/radio/radio.d.ts +1 -1
- package/dist/types/components/select/select.d.ts +1 -1
- package/dist/types/components/switch/model.d.ts +1 -3
- package/dist/types/components/switch/switch.d.ts +2 -5
- package/dist/types/components/textarea/textarea.d.ts +1 -1
- package/dist/vscode.html-custom-data.json +35 -35
- package/dist/web-types.json +71 -72
- package/package.json +4 -4
- package/dist/db-ux/p-11228e58.entry.js +0 -2
- package/dist/db-ux/p-11228e58.entry.js.map +0 -1
- package/dist/db-ux/p-a258be18.entry.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio.js","sourceRoot":"","sources":["../../../src/components/radio/radio.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAOjE,OAAO,EACL,SAAS,EACT,CAAC,EAED,KAAK,EACL,KAAK,EAEL,IAAI,EACJ,KAAK,GACN,MAAM,eAAe,CAAC;AAGvB;;;GAGG;AAIH,MAAM,OAAO,OAAO;IAHnB;QA4BU,gBAAW,GAAG,KAAK,CAAC;QACpB,QAAG,GAAG,SAAS,CAAC;KA6G1B;IA3GC,YAAY,CAAC,KAA0C;QACrD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IACD,UAA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C,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EACzC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAC3C;YACD,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,eAAa,CAClC,CACT,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { ChangeEvent, InteractionEvent } from \"../../shared/model\";\nimport { cls, getBoolean, getHideProp, uuid } from \"../../utils\";\nimport {\n handleFrameworkEventAngular,\n handleFrameworkEventVue,\n} from \"../../utils/form-components\";\nimport { DBRadioProps, DBRadioState } from \"./model\";\n\nimport {\n Component,\n h,\n Fragment,\n Watch,\n Event,\n EventEmitter,\n Prop,\n State,\n} from \"@stencil/core\";\n\n\n/**\n * @slot children - This is a default/unnamed slot\n\n */\n @Component({\n tag: \"db-radio\",\n})\nexport class DBRadio {\n private _ref!: HTMLInputElement | any;\n @Prop() id: DBRadioProps[\"id\"];\n @Prop() checked: DBRadioProps[\"checked\"];\n @Event() change: EventEmitter<\n Parameters<Required<DBRadioProps>[\"onChange\"]>[number]\n > | void;\n @Event() blur: EventEmitter<\n Parameters<Required<DBRadioProps>[\"onBlur\"]>[number]\n > | void;\n @Event() focus: EventEmitter<\n Parameters<Required<DBRadioProps>[\"onFocus\"]>[number]\n > | void;\n @Prop() size: DBRadioProps[\"size\"];\n @Prop() showLabel: DBRadioProps[\"showLabel\"];\n @Prop() showRequiredAsterisk: DBRadioProps[\"showRequiredAsterisk\"];\n @Prop({attribute: \"classname\"}) className: DBRadioProps[\"className\"];\n @Prop() validation: DBRadioProps[\"validation\"];\n @Prop() name: DBRadioProps[\"name\"];\n @Prop() disabled: DBRadioProps[\"disabled\"];\n @Prop() describedbyid: DBRadioProps[\"describedbyid\"];\n @Prop() ariaDescribedBy: DBRadioProps[\"ariaDescribedBy\"];\n @Prop() value: DBRadioProps[\"value\"];\n @Prop() required: DBRadioProps[\"required\"];\n @Prop() label: DBRadioProps[\"label\"];\n @State() initialized = false;\n @State() _id = undefined;\n\n handleChange(event: ChangeEvent<HTMLInputElement> | any) {\n if (this.change) {\n this.change.emit(event);\n }\n }\n handleBlur(event: InteractionEvent<HTMLInputElement> | any) {\n if (this.blur) {\n this.blur.emit(event);\n }\n }\n handleFocus(event: InteractionEvent<HTMLInputElement> | any) {\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 if (this.checked && this.initialized && this._ref) {\n this._ref.checked = true;\n }\n }\n\n @Watch(\"initialized\")\n @Watch(\"_ref\")\n @Watch(\"checked\")\n watch0() {\n this.watch0Fn();\n }\n\n componentDidLoad() {\n this.enableAttributePassing(this._ref, \"db-radio\");\n this.initialized = true;\n this._id = this.id ?? `radio-${uuid()}`;\n this.watch0Fn();\n }\n\n render() {\n return (\n <label\n class={cls(\"db-radio\", this.className)}\n data-size={this.size}\n data-hide-label={getHideProp(this.showLabel)}\n data-hide-asterisk={getHideProp(this.showRequiredAsterisk)}\n htmlFor={this._id}\n >\n <input\n type=\"radio\"\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 aria-describedby={this.describedbyid ?? this.ariaDescribedBy}\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 />\n {this.label ? this.label : <slot></slot>}\n </label>\n );\n }\n}\n"]}
|
|
@@ -168,14 +168,14 @@ export class DBSelect {
|
|
|
168
168
|
}
|
|
169
169
|
render() {
|
|
170
170
|
var _a, _b, _c, _d, _e, _f;
|
|
171
|
-
return (h("div", { key: '
|
|
171
|
+
return (h("div", { key: 'c55fdccdd060f36e19a34f1bcfc569bf6f4917ed', class: cls("db-select", this.className), "data-variant": this.variant, "data-hide-label": getHideProp(this.showLabel), "data-hide-asterisk": getHideProp(this.showRequiredAsterisk), "data-icon": this.icon, "data-hide-icon": getHideProp(this.showIcon) }, h("label", { key: 'c424b175cb5d4f7e7cc14ab29cfa67576684a115', htmlFor: this._id }, (_a = this.label) !== null && _a !== void 0 ? _a : DEFAULT_LABEL), h("select", { key: '8386e3eb1fdceb1ffc9933c72f2b0f04938d1108', "aria-invalid": this.validation === "invalid", "data-custom-validity": this.validation, ref: (el) => {
|
|
172
172
|
this._ref = el;
|
|
173
|
-
}, required: getBoolean(this.required, "required"),
|
|
173
|
+
}, required: getBoolean(this.required, "required"), disabled: getBoolean(this.disabled, "disabled"), id: this._id, name: this.name, size: this.size,
|
|
174
174
|
/* @ts-ignore */
|
|
175
|
-
value: (_b = this.value) !== null && _b !== void 0 ? _b : this._value, autocomplete: this.autocomplete, multiple: this.multiple, onInput: (event) => this.handleInput(event), onClick: (event) => this.handleClick(event), onChange: (event) => this.handleChange(event), onBlur: (event) => this.handleBlur(event), onFocus: (event) => this.handleFocus(event), "aria-describedby": (_c = this.ariaDescribedBy) !== null && _c !== void 0 ? _c : this._descByIds }, h("option", { key: '
|
|
175
|
+
value: (_b = this.value) !== null && _b !== void 0 ? _b : this._value, autocomplete: this.autocomplete, multiple: this.multiple, onInput: (event) => this.handleInput(event), onClick: (event) => this.handleClick(event), onChange: (event) => this.handleChange(event), onBlur: (event) => this.handleBlur(event), onFocus: (event) => this.handleFocus(event), "aria-describedby": (_c = this.ariaDescribedBy) !== null && _c !== void 0 ? _c : this._descByIds }, h("option", { key: 'c337ef04ac473d3cf00419d30c61cd38b4ca1ad6', hidden: true }), ((_d = this.options) === null || _d === void 0 ? void 0 : _d.length) ? ((_e = this.options) === null || _e === void 0 ? void 0 : _e.map((option) => {
|
|
176
176
|
var _a;
|
|
177
177
|
return (h(Fragment, null, option.options ? (h("optgroup", { label: this.getOptionLabel(option), key: undefined }, (_a = option.options) === null || _a === void 0 ? void 0 : _a.map((optgroupOption) => (h("option", { value: optgroupOption.value, selected: optgroupOption.selected, disabled: optgroupOption.disabled, key: undefined }, this.getOptionLabel(optgroupOption)))))) : (h("option", { value: option.value, disabled: option.disabled, selected: option.selected, key: undefined }, this.getOptionLabel(option)))));
|
|
178
|
-
})) : (h("slot", null))), h("span", { key: '
|
|
178
|
+
})) : (h("slot", null))), h("span", { key: '13f3711cb31601dc4e2580fbd0e165a4902cf18f', id: this._placeholderId }, (_f = this.placeholder) !== null && _f !== void 0 ? _f : 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: '743f2051458556cd1f6d900415878ac83b615132', size: "small", semantic: "critical", id: this._invalidMessageId }, this._invalidMessage), h("span", { key: '96a5cf7d9ba622214d63945bde23fe521aa73a09', "data-visually-hidden": "true", role: "status" }, this._voiceOverFallback)));
|
|
179
179
|
}
|
|
180
180
|
static get is() { return "db-select"; }
|
|
181
181
|
static get properties() {
|
|
@@ -455,13 +455,13 @@ export class DBSelect {
|
|
|
455
455
|
"setter": false,
|
|
456
456
|
"reflect": false
|
|
457
457
|
},
|
|
458
|
-
"
|
|
459
|
-
"type": "
|
|
460
|
-
"attribute": "
|
|
458
|
+
"showRequiredAsterisk": {
|
|
459
|
+
"type": "any",
|
|
460
|
+
"attribute": "show-required-asterisk",
|
|
461
461
|
"mutable": false,
|
|
462
462
|
"complexType": {
|
|
463
|
-
"original": "DBSelectProps[\"
|
|
464
|
-
"resolved": "
|
|
463
|
+
"original": "DBSelectProps[\"showRequiredAsterisk\"]",
|
|
464
|
+
"resolved": "boolean | string",
|
|
465
465
|
"references": {
|
|
466
466
|
"DBSelectProps": {
|
|
467
467
|
"location": "import",
|
|
@@ -480,13 +480,13 @@ export class DBSelect {
|
|
|
480
480
|
"setter": false,
|
|
481
481
|
"reflect": false
|
|
482
482
|
},
|
|
483
|
-
"
|
|
484
|
-
"type": "
|
|
485
|
-
"attribute": "
|
|
483
|
+
"icon": {
|
|
484
|
+
"type": "string",
|
|
485
|
+
"attribute": "icon",
|
|
486
486
|
"mutable": false,
|
|
487
487
|
"complexType": {
|
|
488
|
-
"original": "DBSelectProps[\"
|
|
489
|
-
"resolved": "
|
|
488
|
+
"original": "DBSelectProps[\"icon\"]",
|
|
489
|
+
"resolved": "BaseIconTypes | LooseAutocomplete",
|
|
490
490
|
"references": {
|
|
491
491
|
"DBSelectProps": {
|
|
492
492
|
"location": "import",
|
|
@@ -505,13 +505,13 @@ export class DBSelect {
|
|
|
505
505
|
"setter": false,
|
|
506
506
|
"reflect": false
|
|
507
507
|
},
|
|
508
|
-
"
|
|
509
|
-
"type": "
|
|
510
|
-
"attribute": "
|
|
508
|
+
"showIcon": {
|
|
509
|
+
"type": "any",
|
|
510
|
+
"attribute": "show-icon",
|
|
511
511
|
"mutable": false,
|
|
512
512
|
"complexType": {
|
|
513
|
-
"original": "DBSelectProps[\"
|
|
514
|
-
"resolved": "string",
|
|
513
|
+
"original": "DBSelectProps[\"showIcon\"]",
|
|
514
|
+
"resolved": "boolean | string",
|
|
515
515
|
"references": {
|
|
516
516
|
"DBSelectProps": {
|
|
517
517
|
"location": "import",
|
|
@@ -530,13 +530,13 @@ export class DBSelect {
|
|
|
530
530
|
"setter": false,
|
|
531
531
|
"reflect": false
|
|
532
532
|
},
|
|
533
|
-
"
|
|
534
|
-
"type": "
|
|
535
|
-
"attribute": "
|
|
533
|
+
"label": {
|
|
534
|
+
"type": "string",
|
|
535
|
+
"attribute": "label",
|
|
536
536
|
"mutable": false,
|
|
537
537
|
"complexType": {
|
|
538
|
-
"original": "DBSelectProps[\"
|
|
539
|
-
"resolved": "
|
|
538
|
+
"original": "DBSelectProps[\"label\"]",
|
|
539
|
+
"resolved": "string",
|
|
540
540
|
"references": {
|
|
541
541
|
"DBSelectProps": {
|
|
542
542
|
"location": "import",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../../src/components/select/select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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n DEFAULT_INVALID_MESSAGE,\n DEFAULT_INVALID_MESSAGE_ID_SUFFIX,\n DEFAULT_LABEL,\n DEFAULT_MESSAGE_ID_SUFFIX,\n DEFAULT_PLACEHOLDER_ID_SUFFIX,\n DEFAULT_VALID_MESSAGE,\n DEFAULT_VALID_MESSAGE_ID_SUFFIX,\n} from \"../../shared/constants\";\nimport {\n ChangeEvent,\n ClickEvent,\n InputEvent,\n InteractionEvent,\n} from \"../../shared/model\";\nimport {\n cls,\n delay,\n getBoolean,\n getHideProp,\n getOptionKey,\n hasVoiceOver,\n stringPropVisible,\n uuid,\n} from \"../../utils\";\nimport {\n handleFrameworkEventAngular,\n handleFrameworkEventVue,\n} from \"../../utils/form-components\";\nimport { DBInfotext } from \"../infotext/infotext\";\nimport { DBSelectOptionType, DBSelectProps, DBSelectState } from \"./model\";\n\nimport {\n Component,\n h,\n Fragment,\n Watch,\n Event,\n EventEmitter,\n Prop,\n State,\n} from \"@stencil/core\";\n\n\n/**\n * @slot children - This is a default/unnamed slot\n\n */\n @Component({\n tag: \"db-select\",\n})\nexport class DBSelect {\n private _ref!: HTMLSelectElement | any;\n @Prop() id: DBSelectProps[\"id\"];\n @Prop() invalidMessage: DBSelectProps[\"invalidMessage\"];\n @Prop() message: DBSelectProps[\"message\"];\n @Prop() showMessage: DBSelectProps[\"showMessage\"];\n @Prop() value: DBSelectProps[\"value\"];\n @Prop() validMessage: DBSelectProps[\"validMessage\"];\n @Prop() validation: DBSelectProps[\"validation\"];\n @Prop() required: DBSelectProps[\"required\"];\n @Event() click: EventEmitter<\n Parameters<Required<DBSelectProps>[\"onClick\"]>[number]\n > | void;\n @Event() input: EventEmitter<\n Parameters<Required<DBSelectProps>[\"onInput\"]>[number]\n > | void;\n @Event() change: EventEmitter<\n Parameters<Required<DBSelectProps>[\"onChange\"]>[number]\n > | void;\n @Event() blur: EventEmitter<\n Parameters<Required<DBSelectProps>[\"onBlur\"]>[number]\n > | void;\n @Event() focus: EventEmitter<\n Parameters<Required<DBSelectProps>[\"onFocus\"]>[number]\n > | void;\n @Prop({attribute: \"classname\"}) className: DBSelectProps[\"className\"];\n @Prop() variant: DBSelectProps[\"variant\"];\n @Prop() showLabel: DBSelectProps[\"showLabel\"];\n @Prop() icon: DBSelectProps[\"icon\"];\n @Prop() showIcon: DBSelectProps[\"showIcon\"];\n @Prop() label: DBSelectProps[\"label\"];\n @Prop() showRequiredAsterisk: DBSelectProps[\"showRequiredAsterisk\"];\n @Prop() disabled: DBSelectProps[\"disabled\"];\n @Prop() name: DBSelectProps[\"name\"];\n @Prop() size: DBSelectProps[\"size\"];\n @Prop() autocomplete: DBSelectProps[\"autocomplete\"];\n @Prop() multiple: DBSelectProps[\"multiple\"];\n @Prop() ariaDescribedBy: DBSelectProps[\"ariaDescribedBy\"];\n @Prop() options: DBSelectProps[\"options\"];\n @Prop() placeholder: DBSelectProps[\"placeholder\"];\n @Prop() messageIcon: DBSelectProps[\"messageIcon\"];\n @State() _id = undefined;\n @State() _messageId = undefined;\n @State() _validMessageId = undefined;\n @State() _invalidMessageId = undefined;\n @State() _invalidMessage = undefined;\n @State() _placeholderId = \"\";\n @State() _descByIds = \"\";\n @State() _value = \"\";\n @State() initialized = false;\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 select */\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 = this._placeholderId;\n }\n }\n handleClick(event: ClickEvent<HTMLSelectElement> | any) {\n if (this.click) {\n this.click.emit(event);\n }\n }\n handleInput(event: InputEvent<HTMLSelectElement> | any) {\n if (this.input) {\n this.input.emit(event);\n }\n this.handleValidation();\n }\n handleChange(event: ChangeEvent<HTMLSelectElement> | any) {\n if (this.change) {\n this.change.emit(event);\n }\n this.handleValidation();\n }\n handleBlur(event: InteractionEvent<HTMLSelectElement> | any) {\n if (this.blur) {\n this.blur.emit(event);\n }\n }\n handleFocus(event: InteractionEvent<HTMLSelectElement> | any) {\n if (this.focus) {\n this.focus.emit(event);\n }\n }\n getOptionLabel(option: DBSelectOptionType) {\n return option.label ?? option.value?.toString();\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: HTMLSelectElement | 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 && this.initialized) {\n const messageId = this._id + DEFAULT_MESSAGE_ID_SUFFIX;\n const placeholderId = this._id + DEFAULT_PLACEHOLDER_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 this._placeholderId = placeholderId;\n if (stringPropVisible(this.message, this.showMessage)) {\n this._descByIds = messageId;\n } else {\n this._descByIds = placeholderId;\n }\n this.initialized = false;\n }\n }\n\n @Watch(\"_id\")\n @Watch(\"initialized\")\n watch1() {\n this.watch1Fn();\n }\n\n watch2Fn() {\n this._value = this.value;\n }\n\n @Watch(\"value\")\n watch2() {\n this.watch2Fn();\n }\n\n componentDidLoad() {\n this.enableAttributePassing(this._ref, \"db-select\");\n this.initialized = true;\n const mId = this.id ?? `select-${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._placeholderId = mId + DEFAULT_PLACEHOLDER_ID_SUFFIX;\n this._invalidMessage = this.invalidMessage || DEFAULT_INVALID_MESSAGE;\n this.watch0Fn();\n this.watch1Fn();\n this.watch2Fn();\n }\n\n render() {\n return (\n <div\n class={cls(\"db-select\", this.className)}\n data-variant={this.variant}\n data-hide-label={getHideProp(this.showLabel)}\n data-icon={this.icon}\n data-hide-icon={getHideProp(this.showIcon)}\n >\n <label htmlFor={this._id}>{this.label ?? DEFAULT_LABEL}</label>\n <select\n aria-invalid={this.validation === \"invalid\"}\n data-custom-validity={this.validation}\n ref={(el: any) => {\n this._ref = el;\n }}\n required={getBoolean(this.required, \"required\")}\n data-hide-asterisk={getHideProp(this.showRequiredAsterisk)}\n disabled={getBoolean(this.disabled, \"disabled\")}\n id={this._id}\n name={this.name}\n size={this.size}\n /* @ts-ignore */\nvalue={this.value ?? this._value}\n autocomplete={this.autocomplete}\n multiple={this.multiple}\n onInput={(event) => this.handleInput(event)}\n onClick={(event) => this.handleClick(event)}\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 <option hidden={true}></option>\n {this.options?.length ? (\n this.options?.map((option) => (\n <Fragment>\n {option.options ? (\n <optgroup label={this.getOptionLabel(option)} key={undefined}>\n {option.options?.map((optgroupOption) => (\n <option\n value={optgroupOption.value}\n selected={optgroupOption.selected}\n disabled={optgroupOption.disabled}\n key={undefined}\n >\n {this.getOptionLabel(optgroupOption)}\n </option>\n ))}\n </optgroup>\n ) : (\n <option\n value={option.value}\n disabled={option.disabled}\n selected={option.selected}\n key={undefined}\n >\n {this.getOptionLabel(option)}\n </option>\n )}\n </Fragment>\n ))\n ) : (\n <slot></slot>\n )}\n </select>\n <span id={this._placeholderId}>{this.placeholder ?? this.label}</span>\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":"select.js","sourceRoot":"","sources":["../../../src/components/select/select.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,iCAAiC,EACjC,aAAa,EACb,yBAAyB,EACzB,6BAA6B,EAC7B,qBAAqB,EACrB,+BAA+B,GAChC,MAAM,wBAAwB,CAAC;AAOhC,OAAO,EACL,GAAG,EACH,KAAK,EACL,UAAU,EACV,WAAW,EAEX,YAAY,EACZ,iBAAiB,EACjB,IAAI,GACL,MAAM,aAAa,CAAC;AAQrB,OAAO,EACL,SAAS,EACT,CAAC,EACD,QAAQ,EACR,KAAK,EACL,KAAK,EAEL,IAAI,EACJ,KAAK,GACN,MAAM,eAAe,CAAC;AAGvB;;;GAGG;AAIH,MAAM,OAAO,QAAQ;IAHpB;QA4CU,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,mBAAc,GAAG,EAAE,CAAC;QACpB,eAAU,GAAG,EAAE,CAAC;QAChB,WAAM,GAAG,EAAE,CAAC;QACZ,gBAAW,GAAG,KAAK,CAAC;QACpB,uBAAkB,GAAG,EAAE,CAAC;KAsQlC;IApQC,aAAa;;QACX,OAAO,CAAC,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IAC5C,IAAI,CAAC,kBAAkB,CACnB,CACH,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n DEFAULT_INVALID_MESSAGE,\n DEFAULT_INVALID_MESSAGE_ID_SUFFIX,\n DEFAULT_LABEL,\n DEFAULT_MESSAGE_ID_SUFFIX,\n DEFAULT_PLACEHOLDER_ID_SUFFIX,\n DEFAULT_VALID_MESSAGE,\n DEFAULT_VALID_MESSAGE_ID_SUFFIX,\n} from \"../../shared/constants\";\nimport {\n ChangeEvent,\n ClickEvent,\n InputEvent,\n InteractionEvent,\n} from \"../../shared/model\";\nimport {\n cls,\n delay,\n getBoolean,\n getHideProp,\n getOptionKey,\n hasVoiceOver,\n stringPropVisible,\n uuid,\n} from \"../../utils\";\nimport {\n handleFrameworkEventAngular,\n handleFrameworkEventVue,\n} from \"../../utils/form-components\";\nimport { DBInfotext } from \"../infotext/infotext\";\nimport { DBSelectOptionType, DBSelectProps, DBSelectState } from \"./model\";\n\nimport {\n Component,\n h,\n Fragment,\n Watch,\n Event,\n EventEmitter,\n Prop,\n State,\n} from \"@stencil/core\";\n\n\n/**\n * @slot children - This is a default/unnamed slot\n\n */\n @Component({\n tag: \"db-select\",\n})\nexport class DBSelect {\n private _ref!: HTMLSelectElement | any;\n @Prop() id: DBSelectProps[\"id\"];\n @Prop() invalidMessage: DBSelectProps[\"invalidMessage\"];\n @Prop() message: DBSelectProps[\"message\"];\n @Prop() showMessage: DBSelectProps[\"showMessage\"];\n @Prop() value: DBSelectProps[\"value\"];\n @Prop() validMessage: DBSelectProps[\"validMessage\"];\n @Prop() validation: DBSelectProps[\"validation\"];\n @Prop() required: DBSelectProps[\"required\"];\n @Event() click: EventEmitter<\n Parameters<Required<DBSelectProps>[\"onClick\"]>[number]\n > | void;\n @Event() input: EventEmitter<\n Parameters<Required<DBSelectProps>[\"onInput\"]>[number]\n > | void;\n @Event() change: EventEmitter<\n Parameters<Required<DBSelectProps>[\"onChange\"]>[number]\n > | void;\n @Event() blur: EventEmitter<\n Parameters<Required<DBSelectProps>[\"onBlur\"]>[number]\n > | void;\n @Event() focus: EventEmitter<\n Parameters<Required<DBSelectProps>[\"onFocus\"]>[number]\n > | void;\n @Prop({attribute: \"classname\"}) className: DBSelectProps[\"className\"];\n @Prop() variant: DBSelectProps[\"variant\"];\n @Prop() showLabel: DBSelectProps[\"showLabel\"];\n @Prop() showRequiredAsterisk: DBSelectProps[\"showRequiredAsterisk\"];\n @Prop() icon: DBSelectProps[\"icon\"];\n @Prop() showIcon: DBSelectProps[\"showIcon\"];\n @Prop() label: DBSelectProps[\"label\"];\n @Prop() disabled: DBSelectProps[\"disabled\"];\n @Prop() name: DBSelectProps[\"name\"];\n @Prop() size: DBSelectProps[\"size\"];\n @Prop() autocomplete: DBSelectProps[\"autocomplete\"];\n @Prop() multiple: DBSelectProps[\"multiple\"];\n @Prop() ariaDescribedBy: DBSelectProps[\"ariaDescribedBy\"];\n @Prop() options: DBSelectProps[\"options\"];\n @Prop() placeholder: DBSelectProps[\"placeholder\"];\n @Prop() messageIcon: DBSelectProps[\"messageIcon\"];\n @State() _id = undefined;\n @State() _messageId = undefined;\n @State() _validMessageId = undefined;\n @State() _invalidMessageId = undefined;\n @State() _invalidMessage = undefined;\n @State() _placeholderId = \"\";\n @State() _descByIds = \"\";\n @State() _value = \"\";\n @State() initialized = false;\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 select */\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 = this._placeholderId;\n }\n }\n handleClick(event: ClickEvent<HTMLSelectElement> | any) {\n if (this.click) {\n this.click.emit(event);\n }\n }\n handleInput(event: InputEvent<HTMLSelectElement> | any) {\n if (this.input) {\n this.input.emit(event);\n }\n this.handleValidation();\n }\n handleChange(event: ChangeEvent<HTMLSelectElement> | any) {\n if (this.change) {\n this.change.emit(event);\n }\n this.handleValidation();\n }\n handleBlur(event: InteractionEvent<HTMLSelectElement> | any) {\n if (this.blur) {\n this.blur.emit(event);\n }\n }\n handleFocus(event: InteractionEvent<HTMLSelectElement> | any) {\n if (this.focus) {\n this.focus.emit(event);\n }\n }\n getOptionLabel(option: DBSelectOptionType) {\n return option.label ?? option.value?.toString();\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: HTMLSelectElement | 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 && this.initialized) {\n const messageId = this._id + DEFAULT_MESSAGE_ID_SUFFIX;\n const placeholderId = this._id + DEFAULT_PLACEHOLDER_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 this._placeholderId = placeholderId;\n if (stringPropVisible(this.message, this.showMessage)) {\n this._descByIds = messageId;\n } else {\n this._descByIds = placeholderId;\n }\n this.initialized = false;\n }\n }\n\n @Watch(\"_id\")\n @Watch(\"initialized\")\n watch1() {\n this.watch1Fn();\n }\n\n watch2Fn() {\n this._value = this.value;\n }\n\n @Watch(\"value\")\n watch2() {\n this.watch2Fn();\n }\n\n componentDidLoad() {\n this.enableAttributePassing(this._ref, \"db-select\");\n this.initialized = true;\n const mId = this.id ?? `select-${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._placeholderId = mId + DEFAULT_PLACEHOLDER_ID_SUFFIX;\n this._invalidMessage = this.invalidMessage || DEFAULT_INVALID_MESSAGE;\n this.watch0Fn();\n this.watch1Fn();\n this.watch2Fn();\n }\n\n render() {\n return (\n <div\n class={cls(\"db-select\", this.className)}\n data-variant={this.variant}\n data-hide-label={getHideProp(this.showLabel)}\n data-hide-asterisk={getHideProp(this.showRequiredAsterisk)}\n data-icon={this.icon}\n data-hide-icon={getHideProp(this.showIcon)}\n >\n <label htmlFor={this._id}>{this.label ?? DEFAULT_LABEL}</label>\n <select\n aria-invalid={this.validation === \"invalid\"}\n data-custom-validity={this.validation}\n ref={(el: any) => {\n this._ref = el;\n }}\n required={getBoolean(this.required, \"required\")}\n disabled={getBoolean(this.disabled, \"disabled\")}\n id={this._id}\n name={this.name}\n size={this.size}\n /* @ts-ignore */\nvalue={this.value ?? this._value}\n autocomplete={this.autocomplete}\n multiple={this.multiple}\n onInput={(event) => this.handleInput(event)}\n onClick={(event) => this.handleClick(event)}\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 <option hidden={true}></option>\n {this.options?.length ? (\n this.options?.map((option) => (\n <Fragment>\n {option.options ? (\n <optgroup label={this.getOptionLabel(option)} key={undefined}>\n {option.options?.map((optgroupOption) => (\n <option\n value={optgroupOption.value}\n selected={optgroupOption.selected}\n disabled={optgroupOption.disabled}\n key={undefined}\n >\n {this.getOptionLabel(optgroupOption)}\n </option>\n ))}\n </optgroup>\n ) : (\n <option\n value={option.value}\n disabled={option.disabled}\n selected={option.selected}\n key={undefined}\n >\n {this.getOptionLabel(option)}\n </option>\n )}\n </Fragment>\n ))\n ) : (\n <slot></slot>\n )}\n </select>\n <span id={this._placeholderId}>{this.placeholder ?? this.label}</span>\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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/components/switch/model.ts"],"names":[],"mappings":"","sourcesContent":["import { ChangeEventProps, ChangeEventState, EmphasisProps, FocusEventProps, FocusEventState, FormCheckProps, FormProps, FormState, GlobalProps, GlobalState, IconAfterProps, IconProps, SizeProps } from '../../shared/model';\nexport type DBSwitchDefaultProps = {\n /**\n * Add additional icons to indicate active/inactive state.\n */\n visualAid?: boolean | string;\n};\nexport type DBSwitchProps = DBSwitchDefaultProps & GlobalProps & ChangeEventProps<HTMLInputElement> & FocusEventProps<HTMLInputElement> & FormProps & FormCheckProps & EmphasisProps & SizeProps & IconProps & IconAfterProps;\nexport type DBSwitchDefaultState = {
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/components/switch/model.ts"],"names":[],"mappings":"","sourcesContent":["import { ChangeEventProps, ChangeEventState, EmphasisProps, FocusEventProps, FocusEventState, FormCheckProps, FormProps, FormState, GlobalProps, GlobalState, IconAfterProps, IconProps, SizeProps } from '../../shared/model';\nexport type DBSwitchDefaultProps = {\n /**\n * Add additional icons to indicate active/inactive state.\n */\n visualAid?: boolean | string;\n};\nexport type DBSwitchProps = DBSwitchDefaultProps & GlobalProps & ChangeEventProps<HTMLInputElement> & FocusEventProps<HTMLInputElement> & FormProps & FormCheckProps & EmphasisProps & SizeProps & IconProps & IconAfterProps;\nexport type DBSwitchDefaultState = {};\nexport type DBSwitchState = DBSwitchDefaultState & GlobalState & ChangeEventState<HTMLInputElement> & FocusEventState<HTMLInputElement> & FormState"]}
|
|
@@ -7,15 +7,11 @@ import { h, } from "@stencil/core";
|
|
|
7
7
|
export class DBSwitch {
|
|
8
8
|
constructor() {
|
|
9
9
|
this._id = undefined;
|
|
10
|
-
this._checked = false;
|
|
11
10
|
}
|
|
12
11
|
handleChange(event) {
|
|
13
|
-
var _a;
|
|
14
12
|
if (this.change) {
|
|
15
13
|
this.change.emit(event);
|
|
16
14
|
}
|
|
17
|
-
// We have different ts types in different frameworks, so we need to use any here
|
|
18
|
-
this._checked = (_a = event.target) === null || _a === void 0 ? void 0 : _a["checked"];
|
|
19
15
|
}
|
|
20
16
|
handleBlur(event) {
|
|
21
17
|
if (this.blur) {
|
|
@@ -59,25 +55,16 @@ export class DBSwitch {
|
|
|
59
55
|
}
|
|
60
56
|
}
|
|
61
57
|
}
|
|
62
|
-
watch0Fn() {
|
|
63
|
-
if (this.checked !== undefined && this.checked !== null) {
|
|
64
|
-
this._checked = getBoolean(this.checked);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
watch0() {
|
|
68
|
-
this.watch0Fn();
|
|
69
|
-
}
|
|
70
58
|
componentDidLoad() {
|
|
71
59
|
var _a;
|
|
72
60
|
this.enableAttributePassing(this._ref, "db-switch");
|
|
73
61
|
this._id = (_a = this.id) !== null && _a !== void 0 ? _a : `switch-${uuid()}`;
|
|
74
|
-
this.watch0Fn();
|
|
75
62
|
}
|
|
76
63
|
render() {
|
|
77
64
|
var _a;
|
|
78
|
-
return (h("label", { key: '
|
|
65
|
+
return (h("label", { key: '3129d97d493559a3b2965b21453be8a3755bd052', class: cls("db-switch", this.className), "data-visual-aid": getBooleanAsString(this.visualAid), "data-size": this.size, "data-hide-label": getHideProp(this.showLabel), "data-emphasis": this.emphasis, htmlFor: this._id, "data-hide-asterisk": getHideProp(this.showRequiredAsterisk) }, h("input", { key: '6ddca8c6eb199ba1cfa1d6b399937a12faba7ef9', type: "checkbox", role: "switch", id: this._id, ref: (el) => {
|
|
79
66
|
this._ref = el;
|
|
80
|
-
}, checked: getBoolean(this.checked, "checked"), value: this.value, disabled: getBoolean(this.disabled, "disabled"), "aria-describedby": (_a = this.describedbyid) !== null && _a !== void 0 ? _a : this.ariaDescribedBy, "aria-invalid": this.validation === "invalid", "data-custom-validity": this.validation, name: this.name, required: getBoolean(this.required, "required"), "data-
|
|
67
|
+
}, checked: getBoolean(this.checked, "checked"), value: this.value, disabled: getBoolean(this.disabled, "disabled"), "aria-describedby": (_a = this.describedbyid) !== null && _a !== void 0 ? _a : this.ariaDescribedBy, "aria-invalid": this.validation === "invalid", "data-custom-validity": this.validation, name: this.name, required: getBoolean(this.required, "required"), "data-aid-icon": this.icon, "data-aid-icon-after": this.iconAfter, onChange: (event) => this.handleChange(event), onBlur: (event) => this.handleBlur(event), onFocus: (event) => this.handleFocus(event) }), this.label ? this.label : h("slot", null)));
|
|
81
68
|
}
|
|
82
69
|
static get is() { return "db-switch"; }
|
|
83
70
|
static get properties() {
|
|
@@ -107,12 +94,12 @@ export class DBSwitch {
|
|
|
107
94
|
"setter": false,
|
|
108
95
|
"reflect": false
|
|
109
96
|
},
|
|
110
|
-
"
|
|
97
|
+
"visualAid": {
|
|
111
98
|
"type": "any",
|
|
112
|
-
"attribute": "
|
|
99
|
+
"attribute": "visual-aid",
|
|
113
100
|
"mutable": false,
|
|
114
101
|
"complexType": {
|
|
115
|
-
"original": "DBSwitchProps[\"
|
|
102
|
+
"original": "DBSwitchProps[\"visualAid\"]",
|
|
116
103
|
"resolved": "boolean | string",
|
|
117
104
|
"references": {
|
|
118
105
|
"DBSwitchProps": {
|
|
@@ -132,12 +119,37 @@ export class DBSwitch {
|
|
|
132
119
|
"setter": false,
|
|
133
120
|
"reflect": false
|
|
134
121
|
},
|
|
135
|
-
"
|
|
122
|
+
"size": {
|
|
123
|
+
"type": "string",
|
|
124
|
+
"attribute": "size",
|
|
125
|
+
"mutable": false,
|
|
126
|
+
"complexType": {
|
|
127
|
+
"original": "DBSwitchProps[\"size\"]",
|
|
128
|
+
"resolved": "\"medium\" | \"small\"",
|
|
129
|
+
"references": {
|
|
130
|
+
"DBSwitchProps": {
|
|
131
|
+
"location": "import",
|
|
132
|
+
"path": "./model",
|
|
133
|
+
"id": "src/components/switch/model.ts::DBSwitchProps"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"required": false,
|
|
138
|
+
"optional": false,
|
|
139
|
+
"docs": {
|
|
140
|
+
"tags": [],
|
|
141
|
+
"text": ""
|
|
142
|
+
},
|
|
143
|
+
"getter": false,
|
|
144
|
+
"setter": false,
|
|
145
|
+
"reflect": false
|
|
146
|
+
},
|
|
147
|
+
"showLabel": {
|
|
136
148
|
"type": "any",
|
|
137
|
-
"attribute": "
|
|
149
|
+
"attribute": "show-label",
|
|
138
150
|
"mutable": false,
|
|
139
151
|
"complexType": {
|
|
140
|
-
"original": "DBSwitchProps[\"
|
|
152
|
+
"original": "DBSwitchProps[\"showLabel\"]",
|
|
141
153
|
"resolved": "boolean | string",
|
|
142
154
|
"references": {
|
|
143
155
|
"DBSwitchProps": {
|
|
@@ -157,13 +169,13 @@ export class DBSwitch {
|
|
|
157
169
|
"setter": false,
|
|
158
170
|
"reflect": false
|
|
159
171
|
},
|
|
160
|
-
"
|
|
172
|
+
"emphasis": {
|
|
161
173
|
"type": "string",
|
|
162
|
-
"attribute": "
|
|
174
|
+
"attribute": "emphasis",
|
|
163
175
|
"mutable": false,
|
|
164
176
|
"complexType": {
|
|
165
|
-
"original": "DBSwitchProps[\"
|
|
166
|
-
"resolved": "\"
|
|
177
|
+
"original": "DBSwitchProps[\"emphasis\"]",
|
|
178
|
+
"resolved": "\"strong\" | \"weak\"",
|
|
167
179
|
"references": {
|
|
168
180
|
"DBSwitchProps": {
|
|
169
181
|
"location": "import",
|
|
@@ -182,12 +194,12 @@ export class DBSwitch {
|
|
|
182
194
|
"setter": false,
|
|
183
195
|
"reflect": false
|
|
184
196
|
},
|
|
185
|
-
"
|
|
197
|
+
"showRequiredAsterisk": {
|
|
186
198
|
"type": "any",
|
|
187
|
-
"attribute": "show-
|
|
199
|
+
"attribute": "show-required-asterisk",
|
|
188
200
|
"mutable": false,
|
|
189
201
|
"complexType": {
|
|
190
|
-
"original": "DBSwitchProps[\"
|
|
202
|
+
"original": "DBSwitchProps[\"showRequiredAsterisk\"]",
|
|
191
203
|
"resolved": "boolean | string",
|
|
192
204
|
"references": {
|
|
193
205
|
"DBSwitchProps": {
|
|
@@ -207,13 +219,13 @@ export class DBSwitch {
|
|
|
207
219
|
"setter": false,
|
|
208
220
|
"reflect": false
|
|
209
221
|
},
|
|
210
|
-
"
|
|
222
|
+
"className": {
|
|
211
223
|
"type": "string",
|
|
212
|
-
"attribute": "
|
|
224
|
+
"attribute": "classname",
|
|
213
225
|
"mutable": false,
|
|
214
226
|
"complexType": {
|
|
215
|
-
"original": "DBSwitchProps[\"
|
|
216
|
-
"resolved": "
|
|
227
|
+
"original": "DBSwitchProps[\"className\"]",
|
|
228
|
+
"resolved": "string",
|
|
217
229
|
"references": {
|
|
218
230
|
"DBSwitchProps": {
|
|
219
231
|
"location": "import",
|
|
@@ -232,13 +244,13 @@ export class DBSwitch {
|
|
|
232
244
|
"setter": false,
|
|
233
245
|
"reflect": false
|
|
234
246
|
},
|
|
235
|
-
"
|
|
236
|
-
"type": "
|
|
237
|
-
"attribute": "
|
|
247
|
+
"checked": {
|
|
248
|
+
"type": "any",
|
|
249
|
+
"attribute": "checked",
|
|
238
250
|
"mutable": false,
|
|
239
251
|
"complexType": {
|
|
240
|
-
"original": "DBSwitchProps[\"
|
|
241
|
-
"resolved": "string",
|
|
252
|
+
"original": "DBSwitchProps[\"checked\"]",
|
|
253
|
+
"resolved": "boolean | string",
|
|
242
254
|
"references": {
|
|
243
255
|
"DBSwitchProps": {
|
|
244
256
|
"location": "import",
|
|
@@ -432,31 +444,6 @@ export class DBSwitch {
|
|
|
432
444
|
"setter": false,
|
|
433
445
|
"reflect": false
|
|
434
446
|
},
|
|
435
|
-
"showRequiredAsterisk": {
|
|
436
|
-
"type": "any",
|
|
437
|
-
"attribute": "show-required-asterisk",
|
|
438
|
-
"mutable": false,
|
|
439
|
-
"complexType": {
|
|
440
|
-
"original": "DBSwitchProps[\"showRequiredAsterisk\"]",
|
|
441
|
-
"resolved": "boolean | string",
|
|
442
|
-
"references": {
|
|
443
|
-
"DBSwitchProps": {
|
|
444
|
-
"location": "import",
|
|
445
|
-
"path": "./model",
|
|
446
|
-
"id": "src/components/switch/model.ts::DBSwitchProps"
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
},
|
|
450
|
-
"required": false,
|
|
451
|
-
"optional": false,
|
|
452
|
-
"docs": {
|
|
453
|
-
"tags": [],
|
|
454
|
-
"text": ""
|
|
455
|
-
},
|
|
456
|
-
"getter": false,
|
|
457
|
-
"setter": false,
|
|
458
|
-
"reflect": false
|
|
459
|
-
},
|
|
460
447
|
"icon": {
|
|
461
448
|
"type": "string",
|
|
462
449
|
"attribute": "icon",
|
|
@@ -536,8 +523,7 @@ export class DBSwitch {
|
|
|
536
523
|
}
|
|
537
524
|
static get states() {
|
|
538
525
|
return {
|
|
539
|
-
"_id": {}
|
|
540
|
-
"_checked": {}
|
|
526
|
+
"_id": {}
|
|
541
527
|
};
|
|
542
528
|
}
|
|
543
529
|
static get events() {
|
|
@@ -588,11 +574,5 @@ export class DBSwitch {
|
|
|
588
574
|
}
|
|
589
575
|
}];
|
|
590
576
|
}
|
|
591
|
-
static get watchers() {
|
|
592
|
-
return [{
|
|
593
|
-
"propName": "checked",
|
|
594
|
-
"methodName": "watch0"
|
|
595
|
-
}];
|
|
596
|
-
}
|
|
597
577
|
}
|
|
598
578
|
//# sourceMappingURL=switch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.js","sourceRoot":"","sources":["../../../src/components/switch/switch.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,GAAG,EACH,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,IAAI,GACL,MAAM,aAAa,CAAC;AAOrB,OAAO,EACL,SAAS,EACT,CAAC,EAED,KAAK,
|
|
1
|
+
{"version":3,"file":"switch.js","sourceRoot":"","sources":["../../../src/components/switch/switch.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,GAAG,EACH,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,IAAI,GACL,MAAM,aAAa,CAAC;AAOrB,OAAO,EACL,SAAS,EACT,CAAC,EAED,KAAK,EAEL,IAAI,EACJ,KAAK,GACN,MAAM,eAAe,CAAC;AAGvB;;;GAGG;AAIH,MAAM,OAAO,QAAQ;IAHpB;QAgCU,QAAG,GAAG,SAAS,CAAC;KAmG1B;IAjGC,YAAY,CAAC,KAAoC;QAC/C,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IACD,UAAU,CAAC,KAAyC;QAClD,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,IAAI,CAAC,IAAI,CAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { ChangeEvent, InteractionEvent } from \"../../shared/model\";\nimport {\n cls,\n getBoolean,\n getBooleanAsString,\n getHideProp,\n uuid,\n} from \"../../utils\";\nimport {\n handleFrameworkEventAngular,\n handleFrameworkEventVue,\n} from \"../../utils/form-components\";\nimport { DBSwitchProps, DBSwitchState } from \"./model\";\n\nimport {\n Component,\n h,\n Fragment,\n Event,\n EventEmitter,\n Prop,\n State,\n} from \"@stencil/core\";\n\n\n/**\n * @slot children - This is a default/unnamed slot\n\n */\n @Component({\n tag: \"db-switch\",\n})\nexport class DBSwitch {\n private _ref!: HTMLInputElement | any;\n @Prop() id: DBSwitchProps[\"id\"];\n @Event() change: EventEmitter<\n Parameters<Required<DBSwitchProps>[\"onChange\"]>[number]\n > | void;\n @Event() blur: EventEmitter<\n Parameters<Required<DBSwitchProps>[\"onBlur\"]>[number]\n > | void;\n @Event() focus: EventEmitter<\n Parameters<Required<DBSwitchProps>[\"onFocus\"]>[number]\n > | void;\n @Prop() visualAid: DBSwitchProps[\"visualAid\"];\n @Prop() size: DBSwitchProps[\"size\"];\n @Prop() showLabel: DBSwitchProps[\"showLabel\"];\n @Prop() emphasis: DBSwitchProps[\"emphasis\"];\n @Prop() showRequiredAsterisk: DBSwitchProps[\"showRequiredAsterisk\"];\n @Prop({attribute: \"classname\"}) className: DBSwitchProps[\"className\"];\n @Prop() checked: DBSwitchProps[\"checked\"];\n @Prop() value: DBSwitchProps[\"value\"];\n @Prop() disabled: DBSwitchProps[\"disabled\"];\n @Prop() describedbyid: DBSwitchProps[\"describedbyid\"];\n @Prop() ariaDescribedBy: DBSwitchProps[\"ariaDescribedBy\"];\n @Prop() validation: DBSwitchProps[\"validation\"];\n @Prop() name: DBSwitchProps[\"name\"];\n @Prop() required: DBSwitchProps[\"required\"];\n @Prop() icon: DBSwitchProps[\"icon\"];\n @Prop() iconAfter: DBSwitchProps[\"iconAfter\"];\n @Prop() label: DBSwitchProps[\"label\"];\n @State() _id = undefined;\n\n handleChange(event: ChangeEvent<HTMLInputElement>) {\n if (this.change) {\n this.change.emit(event);\n }\n }\n handleBlur(event: InteractionEvent<HTMLInputElement>) {\n if (this.blur) {\n this.blur.emit(event);\n }\n }\n handleFocus(event: InteractionEvent<HTMLInputElement>) {\n if (this.focus) {\n this.focus.emit(event);\n }\n }\n\n /**\n * Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.\n * @param element the ref for the component\n * @param customElementSelector the custom element like `my-component`\n */\n private enableAttributePassing(\n element: HTMLInputElement | null,\n customElementSelector: string\n ) {\n const parent = element?.closest(customElementSelector);\n if (element && parent) {\n const attributes = parent.attributes;\n for (let i = 0; i < attributes.length; i++) {\n const attr = attributes.item(i);\n if (\n attr &&\n (attr.name.startsWith(\"data-\") || attr.name.startsWith(\"aria-\"))\n ) {\n element.setAttribute(attr.name, attr.value);\n parent.removeAttribute(attr.name);\n }\n if (attr && attr.name === \"class\") {\n const isWebComponent = attr.value.includes(\"hydrated\");\n const value = attr.value.replace(\"hydrated\", \"\").trim();\n const currentClass = element.getAttribute(\"class\");\n element.setAttribute(\n attr.name,\n `${currentClass ? `${currentClass} ` : \"\"}${value}`\n );\n if (isWebComponent) {\n // Stencil is using this class for lazy loading component\n parent.setAttribute(\"class\", \"hydrated\");\n } else {\n parent.removeAttribute(attr.name);\n }\n }\n }\n }\n }\n\n componentDidLoad() {\n this.enableAttributePassing(this._ref, \"db-switch\");\n this._id = this.id ?? `switch-${uuid()}`;\n }\n\n render() {\n return (\n <label\n class={cls(\"db-switch\", this.className)}\n data-visual-aid={getBooleanAsString(this.visualAid)}\n data-size={this.size}\n data-hide-label={getHideProp(this.showLabel)}\n data-emphasis={this.emphasis}\n htmlFor={this._id}\n data-hide-asterisk={getHideProp(this.showRequiredAsterisk)}\n >\n <input\n type=\"checkbox\"\n role=\"switch\"\n id={this._id}\n ref={(el: any) => {\n this._ref = el;\n }}\n checked={getBoolean(this.checked, \"checked\")}\n value={this.value}\n disabled={getBoolean(this.disabled, \"disabled\")}\n aria-describedby={this.describedbyid ?? this.ariaDescribedBy}\n aria-invalid={this.validation === \"invalid\"}\n data-custom-validity={this.validation}\n name={this.name}\n required={getBoolean(this.required, \"required\")}\n data-aid-icon={this.icon}\n data-aid-icon-after={this.iconAfter}\n onChange={(event) => this.handleChange(event)}\n onBlur={(event) => this.handleBlur(event)}\n onFocus={(event) => this.handleFocus(event)}\n />\n {this.label ? this.label : <slot></slot>}\n </label>\n );\n }\n}\n"]}
|