@db-ux/wc-core-components 2.4.0 → 2.4.2

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.
Files changed (99) hide show
  1. package/dist/cjs/db-checkbox.cjs.entry.js +2 -2
  2. package/dist/cjs/db-checkbox.cjs.entry.js.map +1 -1
  3. package/dist/cjs/db-checkbox.entry.cjs.js.map +1 -1
  4. 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
  5. package/dist/cjs/db-custom-select-dropdown_5.cjs.entry.js +3 -3
  6. package/dist/cjs/db-custom-select-dropdown_5.cjs.entry.js.map +1 -1
  7. package/dist/cjs/db-navigation-item.cjs.entry.js +6 -5
  8. package/dist/cjs/db-navigation-item.cjs.entry.js.map +1 -1
  9. package/dist/cjs/db-navigation-item.entry.cjs.js.map +1 -1
  10. package/dist/cjs/db-radio.cjs.entry.js +2 -2
  11. package/dist/cjs/db-radio.cjs.entry.js.map +1 -1
  12. package/dist/cjs/db-radio.entry.cjs.js.map +1 -1
  13. package/dist/cjs/db-select.cjs.entry.js +4 -4
  14. package/dist/cjs/db-select.cjs.entry.js.map +1 -1
  15. package/dist/cjs/db-select.entry.cjs.js.map +1 -1
  16. package/dist/cjs/db-switch.cjs.entry.js +2 -18
  17. package/dist/cjs/db-switch.cjs.entry.js.map +1 -1
  18. package/dist/cjs/db-switch.entry.cjs.js.map +1 -1
  19. package/dist/cjs/db-textarea.cjs.entry.js +3 -3
  20. package/dist/cjs/db-textarea.cjs.entry.js.map +1 -1
  21. package/dist/cjs/db-textarea.entry.cjs.js.map +1 -1
  22. package/dist/cjs/db-ux.cjs.js +1 -1
  23. package/dist/cjs/index.cjs.js.map +1 -1
  24. package/dist/cjs/loader.cjs.js +1 -1
  25. package/dist/collection/components/checkbox/checkbox.js +23 -23
  26. package/dist/collection/components/checkbox/checkbox.js.map +1 -1
  27. package/dist/collection/components/input/input.js +28 -28
  28. package/dist/collection/components/input/input.js.map +1 -1
  29. package/dist/collection/components/navigation-item/navigation-item.js +7 -6
  30. package/dist/collection/components/navigation-item/navigation-item.js.map +1 -1
  31. package/dist/collection/components/radio/radio.js +27 -27
  32. package/dist/collection/components/radio/radio.js.map +1 -1
  33. package/dist/collection/components/select/select.js +24 -24
  34. package/dist/collection/components/select/select.js.map +1 -1
  35. package/dist/collection/components/switch/model.js.map +1 -1
  36. package/dist/collection/components/switch/switch.js +50 -70
  37. package/dist/collection/components/switch/switch.js.map +1 -1
  38. package/dist/collection/components/textarea/textarea.js +28 -28
  39. package/dist/collection/components/textarea/textarea.js.map +1 -1
  40. package/dist/collection/shared/model.js.map +1 -1
  41. package/dist/custom-elements.json +291 -307
  42. package/dist/db-ux/db-checkbox.entry.esm.js.map +1 -1
  43. 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
  44. package/dist/db-ux/db-navigation-item.entry.esm.js.map +1 -1
  45. package/dist/db-ux/db-radio.entry.esm.js.map +1 -1
  46. package/dist/db-ux/db-select.entry.esm.js.map +1 -1
  47. package/dist/db-ux/db-switch.entry.esm.js.map +1 -1
  48. package/dist/db-ux/db-textarea.entry.esm.js.map +1 -1
  49. package/dist/db-ux/db-ux.esm.js +1 -1
  50. package/dist/db-ux/index.esm.js.map +1 -1
  51. package/dist/db-ux/{p-51f991c4.entry.js → p-2d389152.entry.js} +2 -2
  52. package/dist/db-ux/{p-51f991c4.entry.js.map → p-2d389152.entry.js.map} +1 -1
  53. package/dist/db-ux/p-684d11af.entry.js +2 -0
  54. package/dist/db-ux/p-684d11af.entry.js.map +1 -0
  55. package/dist/db-ux/{p-016e21b6.entry.js → p-77e5189c.entry.js} +2 -2
  56. package/dist/db-ux/{p-016e21b6.entry.js.map → p-77e5189c.entry.js.map} +1 -1
  57. package/dist/db-ux/{p-2f87bffd.entry.js → p-7ee7a06d.entry.js} +2 -2
  58. package/dist/db-ux/{p-2f87bffd.entry.js.map → p-7ee7a06d.entry.js.map} +1 -1
  59. package/dist/db-ux/p-81a85032.entry.js +2 -0
  60. package/dist/db-ux/{p-a258be18.entry.js.map → p-81a85032.entry.js.map} +1 -1
  61. package/dist/db-ux/p-90eef6ac.entry.js +2 -0
  62. package/dist/db-ux/p-90eef6ac.entry.js.map +1 -0
  63. package/dist/db-ux/{p-518d1a26.entry.js → p-fdb8daba.entry.js} +2 -2
  64. package/dist/db-ux/{p-518d1a26.entry.js.map → p-fdb8daba.entry.js.map} +1 -1
  65. package/dist/esm/db-checkbox.entry.js +2 -2
  66. package/dist/esm/db-checkbox.entry.js.map +1 -1
  67. 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
  68. package/dist/esm/db-custom-select-dropdown_5.entry.js +3 -3
  69. package/dist/esm/db-custom-select-dropdown_5.entry.js.map +1 -1
  70. package/dist/esm/db-navigation-item.entry.js +7 -6
  71. package/dist/esm/db-navigation-item.entry.js.map +1 -1
  72. package/dist/esm/db-radio.entry.js +3 -3
  73. package/dist/esm/db-radio.entry.js.map +1 -1
  74. package/dist/esm/db-select.entry.js +4 -4
  75. package/dist/esm/db-select.entry.js.map +1 -1
  76. package/dist/esm/db-switch.entry.js +3 -19
  77. package/dist/esm/db-switch.entry.js.map +1 -1
  78. package/dist/esm/db-textarea.entry.js +3 -3
  79. package/dist/esm/db-textarea.entry.js.map +1 -1
  80. package/dist/esm/db-ux.js +1 -1
  81. package/dist/esm/index.js.map +1 -1
  82. package/dist/esm/loader.js +1 -1
  83. package/dist/types/components/checkbox/checkbox.d.ts +1 -1
  84. package/dist/types/components/input/input.d.ts +1 -1
  85. package/dist/types/components/navigation-item/navigation-item.d.ts +1 -1
  86. package/dist/types/components/radio/radio.d.ts +1 -1
  87. package/dist/types/components/select/select.d.ts +1 -1
  88. package/dist/types/components/switch/model.d.ts +1 -3
  89. package/dist/types/components/switch/switch.d.ts +2 -5
  90. package/dist/types/components/textarea/textarea.d.ts +1 -1
  91. package/dist/types/shared/model.d.ts +1 -1
  92. package/dist/vscode.html-custom-data.json +35 -35
  93. package/dist/web-types.json +71 -72
  94. package/package.json +4 -4
  95. package/dist/db-ux/p-11228e58.entry.js +0 -2
  96. package/dist/db-ux/p-11228e58.entry.js.map +0 -1
  97. package/dist/db-ux/p-3cd03681.entry.js +0 -2
  98. package/dist/db-ux/p-3cd03681.entry.js.map +0 -1
  99. package/dist/db-ux/p-a258be18.entry.js +0 -2
@@ -1 +1 @@
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,CAAC,CAAC,MAAA,IAAI,CAAC,YAAY,mCAAI,IAAI,CAAC,UAAU,KA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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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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() 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 = {\n _checked?: boolean;\n};\nexport type DBSwitchState = DBSwitchDefaultState & GlobalState & ChangeEventState<HTMLInputElement> & FocusEventState<HTMLInputElement> & FormState"]}
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: '69aa49920b6a66b9b63743e2d586f1a0a8b32ac1', 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 }, h("input", { key: 'aef4871ab05cecd7047944c2102e220fd4371394', type: "checkbox", role: "switch", id: this._id, "aria-checked": getBooleanAsString(this._checked), ref: (el) => {
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-hide-asterisk": getHideProp(this.showRequiredAsterisk), "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)));
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
- "checked": {
97
+ "visualAid": {
111
98
  "type": "any",
112
- "attribute": "checked",
99
+ "attribute": "visual-aid",
113
100
  "mutable": false,
114
101
  "complexType": {
115
- "original": "DBSwitchProps[\"checked\"]",
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
- "visualAid": {
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": "visual-aid",
149
+ "attribute": "show-label",
138
150
  "mutable": false,
139
151
  "complexType": {
140
- "original": "DBSwitchProps[\"visualAid\"]",
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
- "size": {
172
+ "emphasis": {
161
173
  "type": "string",
162
- "attribute": "size",
174
+ "attribute": "emphasis",
163
175
  "mutable": false,
164
176
  "complexType": {
165
- "original": "DBSwitchProps[\"size\"]",
166
- "resolved": "\"medium\" | \"small\"",
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
- "showLabel": {
197
+ "showRequiredAsterisk": {
186
198
  "type": "any",
187
- "attribute": "show-label",
199
+ "attribute": "show-required-asterisk",
188
200
  "mutable": false,
189
201
  "complexType": {
190
- "original": "DBSwitchProps[\"showLabel\"]",
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
- "emphasis": {
222
+ "className": {
211
223
  "type": "string",
212
- "attribute": "emphasis",
224
+ "attribute": "classname",
213
225
  "mutable": false,
214
226
  "complexType": {
215
- "original": "DBSwitchProps[\"emphasis\"]",
216
- "resolved": "\"strong\" | \"weak\"",
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
- "className": {
236
- "type": "string",
237
- "attribute": "classname",
247
+ "checked": {
248
+ "type": "any",
249
+ "attribute": "checked",
238
250
  "mutable": false,
239
251
  "complexType": {
240
- "original": "DBSwitchProps[\"className\"]",
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,CA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EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAC7C,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,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 {\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 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-switch\",\n})\nexport class DBSwitch {\n private _ref!: HTMLInputElement | any;\n @Prop() id: DBSwitchProps[\"id\"];\n @Prop() checked: DBSwitchProps[\"checked\"];\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({attribute: \"classname\"}) className: DBSwitchProps[\"className\"];\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() showRequiredAsterisk: DBSwitchProps[\"showRequiredAsterisk\"];\n @Prop() icon: DBSwitchProps[\"icon\"];\n @Prop() iconAfter: DBSwitchProps[\"iconAfter\"];\n @Prop() label: DBSwitchProps[\"label\"];\n @State() _id = undefined;\n @State() _checked = false;\n\n handleChange(event: ChangeEvent<HTMLInputElement>) {\n if (this.change) {\n this.change.emit(event);\n }\n\n // We have different ts types in different frameworks, so we need to use any here\n this._checked = (event.target as any)?.[\"checked\"];\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 watch0Fn() {\n if (this.checked !== undefined && this.checked !== null) {\n this._checked = getBoolean(this.checked);\n }\n }\n\n @Watch(\"checked\")\n watch0() {\n this.watch0Fn();\n }\n\n componentDidLoad() {\n this.enableAttributePassing(this._ref, \"db-switch\");\n this._id = this.id ?? `switch-${uuid()}`;\n this.watch0Fn();\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 >\n <input\n type=\"checkbox\"\n role=\"switch\"\n id={this._id}\n aria-checked={getBooleanAsString(this._checked)}\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-hide-asterisk={getHideProp(this.showRequiredAsterisk)}\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"]}
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,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IACD,WAAW,CAAC,KAAyC;QACnD,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IAED;;;;OAIG;IACK,sBAAsB,CAC5B,OAAgC,EAChC,qBAA6B;QAE7B,MAAM,MAAM,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;QACvD,IAAI,OA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EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAC7C,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,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 {\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"]}
@@ -149,10 +149,10 @@ export class DBTextarea {
149
149
  }
150
150
  render() {
151
151
  var _a, _b, _c, _d, _e;
152
- return (h("div", { key: '22cba979c0bfa7ec50663be4f4d9404e6c6f1e26', class: cls("db-textarea", this.className), "data-variant": this.variant, "data-hide-label": getHideProp(this.showLabel) }, h("label", { key: 'e98eabd338059357c24c32a79bebf84a0ad944ad', htmlFor: this._id }, (_a = this.label) !== null && _a !== void 0 ? _a : DEFAULT_LABEL), h("textarea", { key: '14f6cd83396c4f5a67b23d9c1a56e201d11b277f', "aria-invalid": this.validation === "invalid", "data-custom-validity": this.validation, "data-field-sizing": this.fieldSizing, ref: (el) => {
152
+ return (h("div", { key: '066914fb703dd14040eba1547f2a6d259c8f8bc2', class: cls("db-textarea", this.className), "data-variant": this.variant, "data-hide-asterisk": getHideProp(this.showRequiredAsterisk), "data-hide-label": getHideProp(this.showLabel) }, h("label", { key: '2037bfd141592ee0acfc2c23bb5f3c2c4abb13ce', htmlFor: this._id }, (_a = this.label) !== null && _a !== void 0 ? _a : DEFAULT_LABEL), h("textarea", { key: '255a990e807905deff1ba3dd540cfb50c85506b2', "aria-invalid": this.validation === "invalid", "data-custom-validity": this.validation, "data-field-sizing": this.fieldSizing, ref: (el) => {
153
153
  this._ref = el;
154
- }, id: this._id, "data-resize": this.resize, "data-hide-resizer": getHideProp((_b = this.showResizer) !== null && _b !== void 0 ? _b : true), disabled: getBoolean(this.disabled, "disabled"), required: getBoolean(this.required, "required"), "data-hide-asterisk": getHideProp(this.showRequiredAsterisk), readOnly: getBoolean(this.readOnly, "readOnly") ||
155
- getBoolean(this.readonly, "readonly"), form: this.form, maxLength: getNumber(this.maxLength, this.maxlength), minLength: getNumber(this.minLength, this.minlength), name: this.name, wrap: this.wrap, spellcheck: this.spellCheck, autocomplete: this.autocomplete, onInput: (event) => this.handleInput(event), onChange: (event) => this.handleChange(event), onBlur: (event) => this.handleBlur(event), onFocus: (event) => this.handleFocus(event), value: (_c = this.value) !== null && _c !== void 0 ? _c : this._value, "aria-describedby": (_d = this.ariaDescribedBy) !== null && _d !== void 0 ? _d : this._descByIds, placeholder: (_e = this.placeholder) !== null && _e !== void 0 ? _e : DEFAULT_PLACEHOLDER, rows: getNumber(this.rows, DEFAULT_ROWS), cols: getNumber(this.cols) }), 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: '55b697bc428fce94d92b1527f6bc11fc5322b1e6', size: "small", semantic: "critical", id: this._invalidMessageId }, this._invalidMessage), h("span", { key: 'd3ff952f73c0aa1cb2acb53f0f3cffcfb028de05', "data-visually-hidden": "true", role: "status" }, this._voiceOverFallback)));
154
+ }, id: this._id, "data-resize": this.resize, "data-hide-resizer": getHideProp((_b = this.showResizer) !== null && _b !== void 0 ? _b : true), disabled: getBoolean(this.disabled, "disabled"), required: getBoolean(this.required, "required"), readOnly: getBoolean(this.readOnly, "readOnly") ||
155
+ getBoolean(this.readonly, "readonly"), form: this.form, maxLength: getNumber(this.maxLength, this.maxlength), minLength: getNumber(this.minLength, this.minlength), name: this.name, wrap: this.wrap, spellcheck: this.spellCheck, autocomplete: this.autocomplete, onInput: (event) => this.handleInput(event), onChange: (event) => this.handleChange(event), onBlur: (event) => this.handleBlur(event), onFocus: (event) => this.handleFocus(event), value: (_c = this.value) !== null && _c !== void 0 ? _c : this._value, "aria-describedby": (_d = this.ariaDescribedBy) !== null && _d !== void 0 ? _d : this._descByIds, placeholder: (_e = this.placeholder) !== null && _e !== void 0 ? _e : DEFAULT_PLACEHOLDER, rows: getNumber(this.rows, DEFAULT_ROWS), cols: getNumber(this.cols) }), 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: '8f5e12098eb1a75aae4b11167e65723df250dfb6', size: "small", semantic: "critical", id: this._invalidMessageId }, this._invalidMessage), h("span", { key: '5632e00e8f1362293bd0f208e1fe26d88fb0581c', "data-visually-hidden": "true", role: "status" }, this._voiceOverFallback)));
156
156
  }
157
157
  static get is() { return "db-textarea"; }
158
158
  static get properties() {
@@ -457,6 +457,31 @@ export class DBTextarea {
457
457
  "setter": false,
458
458
  "reflect": false
459
459
  },
460
+ "showRequiredAsterisk": {
461
+ "type": "any",
462
+ "attribute": "show-required-asterisk",
463
+ "mutable": false,
464
+ "complexType": {
465
+ "original": "DBTextareaProps[\"showRequiredAsterisk\"]",
466
+ "resolved": "boolean | string",
467
+ "references": {
468
+ "DBTextareaProps": {
469
+ "location": "import",
470
+ "path": "./model",
471
+ "id": "src/components/textarea/model.ts::DBTextareaProps"
472
+ }
473
+ }
474
+ },
475
+ "required": false,
476
+ "optional": false,
477
+ "docs": {
478
+ "tags": [],
479
+ "text": ""
480
+ },
481
+ "getter": false,
482
+ "setter": false,
483
+ "reflect": false
484
+ },
460
485
  "showLabel": {
461
486
  "type": "any",
462
487
  "attribute": "show-label",
@@ -607,31 +632,6 @@ export class DBTextarea {
607
632
  "setter": false,
608
633
  "reflect": false
609
634
  },
610
- "showRequiredAsterisk": {
611
- "type": "any",
612
- "attribute": "show-required-asterisk",
613
- "mutable": false,
614
- "complexType": {
615
- "original": "DBTextareaProps[\"showRequiredAsterisk\"]",
616
- "resolved": "boolean | string",
617
- "references": {
618
- "DBTextareaProps": {
619
- "location": "import",
620
- "path": "./model",
621
- "id": "src/components/textarea/model.ts::DBTextareaProps"
622
- }
623
- }
624
- },
625
- "required": false,
626
- "optional": false,
627
- "docs": {
628
- "tags": [],
629
- "text": ""
630
- },
631
- "getter": false,
632
- "setter": false,
633
- "reflect": false
634
- },
635
635
  "readOnly": {
636
636
  "type": "any",
637
637
  "attribute": "read-only",
@@ -1 +1 @@
1
- {"version":3,"file":"textarea.js","sourceRoot":"","sources":["../../../src/components/textarea/textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,iCAAiC,EACjC,aAAa,EACb,yBAAyB,EACzB,mBAAmB,EACnB,YAAY,EACZ,qBAAqB,EACrB,+BAA+B,GAChC,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,GAAG,EACH,KAAK,EACL,UAAU,EACV,WAAW,EACX,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,IAAI,GACL,MAAM,aAAa,CAAC;AAQrB,OAAO,EACL,SAAS,EACT,CAAC,EAED,KAAK,EACL,KAAK,EAEL,IAAI,EACJ,KAAK,GACN,MAAM,eAAe,CAAC;AAGvB;;;GAGG;AAIH,MAAM,OAAO,UAAU;IAHtB;QAkDU,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,WAAM,GAAG,EAAE,CAAC;QACZ,uBAAkB,GAAG,EAAE,CAAC;KA6NlC;IA3NC,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;gBAClB,IAAI,CAAC,cAAc;qBACnB,MAAA,IAAI,CAAC,IAAI,0CAAE,iBAAiB,CAAA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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,\n DEFAULT_ROWS,\n DEFAULT_VALID_MESSAGE,\n DEFAULT_VALID_MESSAGE_ID_SUFFIX,\n} from \"../../shared/constants\";\nimport { ChangeEvent, InputEvent, InteractionEvent } from \"../../shared/model\";\nimport {\n cls,\n delay,\n getBoolean,\n getHideProp,\n getNumber,\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 { DBTextareaProps, DBTextareaState } 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-textarea\",\n})\nexport class DBTextarea {\n private _ref!: HTMLTextAreaElement | any;\n @Prop() id: DBTextareaProps[\"id\"];\n @Prop() invalidMessage: DBTextareaProps[\"invalidMessage\"];\n @Prop() message: DBTextareaProps[\"message\"];\n @Prop() showMessage: DBTextareaProps[\"showMessage\"];\n @Prop() value: DBTextareaProps[\"value\"];\n @Prop() validMessage: DBTextareaProps[\"validMessage\"];\n @Prop() validation: DBTextareaProps[\"validation\"];\n @Prop() required: DBTextareaProps[\"required\"];\n @Prop() minLength: DBTextareaProps[\"minLength\"];\n @Prop() maxLength: DBTextareaProps[\"maxLength\"];\n @Event() input: EventEmitter<\n Parameters<Required<DBTextareaProps>[\"onInput\"]>[number]\n > | void;\n @Event() change: EventEmitter<\n Parameters<Required<DBTextareaProps>[\"onChange\"]>[number]\n > | void;\n @Event() blur: EventEmitter<\n Parameters<Required<DBTextareaProps>[\"onBlur\"]>[number]\n > | void;\n @Event() focus: EventEmitter<\n Parameters<Required<DBTextareaProps>[\"onFocus\"]>[number]\n > | void;\n @Prop({attribute: \"classname\"}) className: DBTextareaProps[\"className\"];\n @Prop() variant: DBTextareaProps[\"variant\"];\n @Prop() showLabel: DBTextareaProps[\"showLabel\"];\n @Prop() label: DBTextareaProps[\"label\"];\n @Prop() fieldSizing: DBTextareaProps[\"fieldSizing\"];\n @Prop() resize: DBTextareaProps[\"resize\"];\n @Prop() showResizer: DBTextareaProps[\"showResizer\"];\n @Prop() disabled: DBTextareaProps[\"disabled\"];\n @Prop() showRequiredAsterisk: DBTextareaProps[\"showRequiredAsterisk\"];\n @Prop() readOnly: DBTextareaProps[\"readOnly\"];\n @Prop() readonly: DBTextareaProps[\"readonly\"];\n @Prop() form: DBTextareaProps[\"form\"];\n @Prop() maxlength: DBTextareaProps[\"maxlength\"];\n @Prop() minlength: DBTextareaProps[\"minlength\"];\n @Prop() name: DBTextareaProps[\"name\"];\n @Prop() wrap: DBTextareaProps[\"wrap\"];\n @Prop() spellCheck: DBTextareaProps[\"spellCheck\"];\n @Prop() autocomplete: DBTextareaProps[\"autocomplete\"];\n @Prop() ariaDescribedBy: DBTextareaProps[\"ariaDescribedBy\"];\n @Prop() placeholder: DBTextareaProps[\"placeholder\"];\n @Prop() rows: DBTextareaProps[\"rows\"];\n @Prop() cols: DBTextareaProps[\"cols\"];\n @Prop() messageIcon: DBTextareaProps[\"messageIcon\"];\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() _value = \"\";\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 textarea */\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 || this.minLength || this.maxLength)\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 handleInput(event: InputEvent<HTMLTextAreaElement>) {\n if (this.input) {\n this.input.emit(event);\n }\n this.handleValidation();\n }\n handleChange(event: ChangeEvent<HTMLTextAreaElement>) {\n if (this.change) {\n this.change.emit(event);\n }\n this.handleValidation();\n }\n handleBlur(event: InteractionEvent<HTMLTextAreaElement> | any) {\n if (this.blur) {\n this.blur.emit(event);\n }\n }\n handleFocus(event: InteractionEvent<HTMLTextAreaElement> | 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: HTMLTextAreaElement | 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 this._value = this.value;\n }\n\n @Watch(\"value\")\n watch2() {\n this.watch2Fn();\n }\n\n componentDidLoad() {\n this.enableAttributePassing(this._ref, \"db-textarea\");\n const mId = this.id ?? `textarea-${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 }\n\n render() {\n return (\n <div\n class={cls(\"db-textarea\", this.className)}\n data-variant={this.variant}\n data-hide-label={getHideProp(this.showLabel)}\n >\n <label htmlFor={this._id}>{this.label ?? DEFAULT_LABEL}</label>\n <textarea\n aria-invalid={this.validation === \"invalid\"}\n data-custom-validity={this.validation}\n data-field-sizing={this.fieldSizing}\n ref={(el: any) => {\n this._ref = el;\n }}\n id={this._id}\n data-resize={this.resize}\n data-hide-resizer={getHideProp(this.showResizer ?? true)}\n disabled={getBoolean(this.disabled, \"disabled\")}\n required={getBoolean(this.required, \"required\")}\n data-hide-asterisk={getHideProp(this.showRequiredAsterisk)}\n readOnly={\n getBoolean(this.readOnly, \"readOnly\") ||\n getBoolean(this.readonly, \"readonly\")\n }\n form={this.form}\n maxLength={getNumber(this.maxLength, this.maxlength)}\n minLength={getNumber(this.minLength, this.minlength)}\n name={this.name}\n wrap={this.wrap}\n spellcheck={this.spellCheck}\n autocomplete={this.autocomplete}\n onInput={(event) => this.handleInput(event)}\n onChange={(event) => this.handleChange(event)}\n onBlur={(event) => this.handleBlur(event)}\n onFocus={(event) => this.handleFocus(event)}\n value={this.value ?? this._value}\n aria-describedby={this.ariaDescribedBy ?? this._descByIds}\n placeholder={this.placeholder ?? DEFAULT_PLACEHOLDER}\n rows={getNumber(this.rows, DEFAULT_ROWS)}\n cols={getNumber(this.cols)}\n ></textarea>\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":"textarea.js","sourceRoot":"","sources":["../../../src/components/textarea/textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,iCAAiC,EACjC,aAAa,EACb,yBAAyB,EACzB,mBAAmB,EACnB,YAAY,EACZ,qBAAqB,EACrB,+BAA+B,GAChC,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,GAAG,EACH,KAAK,EACL,UAAU,EACV,WAAW,EACX,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,IAAI,GACL,MAAM,aAAa,CAAC;AAQrB,OAAO,EACL,SAAS,EACT,CAAC,EAED,KAAK,EACL,KAAK,EAEL,IAAI,EACJ,KAAK,GACN,MAAM,eAAe,CAAC;AAGvB;;;GAGG;AAIH,MAAM,OAAO,UAAU;IAHtB;QAkDU,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,WAAM,GAAG,EAAE,CAA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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,\n DEFAULT_ROWS,\n DEFAULT_VALID_MESSAGE,\n DEFAULT_VALID_MESSAGE_ID_SUFFIX,\n} from \"../../shared/constants\";\nimport { ChangeEvent, InputEvent, InteractionEvent } from \"../../shared/model\";\nimport {\n cls,\n delay,\n getBoolean,\n getHideProp,\n getNumber,\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 { DBTextareaProps, DBTextareaState } 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-textarea\",\n})\nexport class DBTextarea {\n private _ref!: HTMLTextAreaElement | any;\n @Prop() id: DBTextareaProps[\"id\"];\n @Prop() invalidMessage: DBTextareaProps[\"invalidMessage\"];\n @Prop() message: DBTextareaProps[\"message\"];\n @Prop() showMessage: DBTextareaProps[\"showMessage\"];\n @Prop() value: DBTextareaProps[\"value\"];\n @Prop() validMessage: DBTextareaProps[\"validMessage\"];\n @Prop() validation: DBTextareaProps[\"validation\"];\n @Prop() required: DBTextareaProps[\"required\"];\n @Prop() minLength: DBTextareaProps[\"minLength\"];\n @Prop() maxLength: DBTextareaProps[\"maxLength\"];\n @Event() input: EventEmitter<\n Parameters<Required<DBTextareaProps>[\"onInput\"]>[number]\n > | void;\n @Event() change: EventEmitter<\n Parameters<Required<DBTextareaProps>[\"onChange\"]>[number]\n > | void;\n @Event() blur: EventEmitter<\n Parameters<Required<DBTextareaProps>[\"onBlur\"]>[number]\n > | void;\n @Event() focus: EventEmitter<\n Parameters<Required<DBTextareaProps>[\"onFocus\"]>[number]\n > | void;\n @Prop({attribute: \"classname\"}) className: DBTextareaProps[\"className\"];\n @Prop() variant: DBTextareaProps[\"variant\"];\n @Prop() showRequiredAsterisk: DBTextareaProps[\"showRequiredAsterisk\"];\n @Prop() showLabel: DBTextareaProps[\"showLabel\"];\n @Prop() label: DBTextareaProps[\"label\"];\n @Prop() fieldSizing: DBTextareaProps[\"fieldSizing\"];\n @Prop() resize: DBTextareaProps[\"resize\"];\n @Prop() showResizer: DBTextareaProps[\"showResizer\"];\n @Prop() disabled: DBTextareaProps[\"disabled\"];\n @Prop() readOnly: DBTextareaProps[\"readOnly\"];\n @Prop() readonly: DBTextareaProps[\"readonly\"];\n @Prop() form: DBTextareaProps[\"form\"];\n @Prop() maxlength: DBTextareaProps[\"maxlength\"];\n @Prop() minlength: DBTextareaProps[\"minlength\"];\n @Prop() name: DBTextareaProps[\"name\"];\n @Prop() wrap: DBTextareaProps[\"wrap\"];\n @Prop() spellCheck: DBTextareaProps[\"spellCheck\"];\n @Prop() autocomplete: DBTextareaProps[\"autocomplete\"];\n @Prop() ariaDescribedBy: DBTextareaProps[\"ariaDescribedBy\"];\n @Prop() placeholder: DBTextareaProps[\"placeholder\"];\n @Prop() rows: DBTextareaProps[\"rows\"];\n @Prop() cols: DBTextareaProps[\"cols\"];\n @Prop() messageIcon: DBTextareaProps[\"messageIcon\"];\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() _value = \"\";\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 textarea */\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 || this.minLength || this.maxLength)\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 handleInput(event: InputEvent<HTMLTextAreaElement>) {\n if (this.input) {\n this.input.emit(event);\n }\n this.handleValidation();\n }\n handleChange(event: ChangeEvent<HTMLTextAreaElement>) {\n if (this.change) {\n this.change.emit(event);\n }\n this.handleValidation();\n }\n handleBlur(event: InteractionEvent<HTMLTextAreaElement> | any) {\n if (this.blur) {\n this.blur.emit(event);\n }\n }\n handleFocus(event: InteractionEvent<HTMLTextAreaElement> | 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: HTMLTextAreaElement | 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 this._value = this.value;\n }\n\n @Watch(\"value\")\n watch2() {\n this.watch2Fn();\n }\n\n componentDidLoad() {\n this.enableAttributePassing(this._ref, \"db-textarea\");\n const mId = this.id ?? `textarea-${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 }\n\n render() {\n return (\n <div\n class={cls(\"db-textarea\", this.className)}\n data-variant={this.variant}\n data-hide-asterisk={getHideProp(this.showRequiredAsterisk)}\n data-hide-label={getHideProp(this.showLabel)}\n >\n <label htmlFor={this._id}>{this.label ?? DEFAULT_LABEL}</label>\n <textarea\n aria-invalid={this.validation === \"invalid\"}\n data-custom-validity={this.validation}\n data-field-sizing={this.fieldSizing}\n ref={(el: any) => {\n this._ref = el;\n }}\n id={this._id}\n data-resize={this.resize}\n data-hide-resizer={getHideProp(this.showResizer ?? true)}\n disabled={getBoolean(this.disabled, \"disabled\")}\n required={getBoolean(this.required, \"required\")}\n readOnly={\n getBoolean(this.readOnly, \"readOnly\") ||\n getBoolean(this.readonly, \"readonly\")\n }\n form={this.form}\n maxLength={getNumber(this.maxLength, this.maxlength)}\n minLength={getNumber(this.minLength, this.minlength)}\n name={this.name}\n wrap={this.wrap}\n spellcheck={this.spellCheck}\n autocomplete={this.autocomplete}\n onInput={(event) => this.handleInput(event)}\n onChange={(event) => this.handleChange(event)}\n onBlur={(event) => this.handleBlur(event)}\n onFocus={(event) => this.handleFocus(event)}\n value={this.value ?? this._value}\n aria-describedby={this.ariaDescribedBy ?? this._descByIds}\n placeholder={this.placeholder ?? DEFAULT_PLACEHOLDER}\n rows={getNumber(this.rows, DEFAULT_ROWS)}\n cols={getNumber(this.cols)}\n ></textarea>\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"]}