@db-ux/wc-core-components 3.1.20 → 4.0.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.
Files changed (219) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/db-accordion-item.cjs.entry.js +2 -2
  3. package/dist/cjs/db-accordion.cjs.entry.js +2 -2
  4. package/dist/cjs/db-badge.cjs.entry.js +2 -2
  5. package/dist/cjs/db-brand.cjs.entry.js +2 -2
  6. package/dist/cjs/db-button.cjs.entry.js +2 -2
  7. package/dist/cjs/db-card.cjs.entry.js +2 -2
  8. package/dist/cjs/db-checkbox.cjs.entry.js +2 -2
  9. 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
  10. package/dist/cjs/db-custom-select-dropdown_5.cjs.entry.js +5 -15
  11. package/dist/cjs/db-custom-select-form-field.cjs.entry.js +2 -2
  12. package/dist/cjs/db-custom-select.cjs.entry.js +10 -10
  13. package/dist/cjs/db-custom-select.entry.cjs.js.map +1 -1
  14. package/dist/cjs/db-divider.cjs.entry.js +2 -2
  15. package/dist/cjs/db-drawer.cjs.entry.js +2 -2
  16. package/dist/cjs/db-header.cjs.entry.js +2 -2
  17. package/dist/cjs/db-icon.cjs.entry.js +2 -2
  18. package/dist/cjs/db-infotext.cjs.entry.js +2 -2
  19. package/dist/cjs/db-link.cjs.entry.js +2 -2
  20. package/dist/cjs/db-navigation-item.cjs.entry.js +2 -2
  21. package/dist/cjs/db-navigation.cjs.entry.js +2 -2
  22. package/dist/cjs/db-notification.cjs.entry.js +2 -2
  23. package/dist/cjs/db-page.cjs.entry.js +2 -2
  24. package/dist/cjs/db-popover.cjs.entry.js +3 -3
  25. package/dist/cjs/db-radio.cjs.entry.js +2 -2
  26. package/dist/cjs/db-section.cjs.entry.js +2 -2
  27. package/dist/cjs/db-select.cjs.entry.js +2 -2
  28. package/dist/cjs/db-stack.cjs.entry.js +2 -2
  29. package/dist/cjs/db-switch.cjs.entry.js +70 -5
  30. package/dist/cjs/db-switch.entry.cjs.js.map +1 -1
  31. package/dist/cjs/db-tab-item_3.cjs.entry.js +8 -8
  32. package/dist/cjs/db-tabs.cjs.entry.js +4 -4
  33. package/dist/cjs/db-textarea.cjs.entry.js +4 -4
  34. package/dist/cjs/db-tooltip.cjs.entry.js +3 -3
  35. package/dist/cjs/db-ux.cjs.js +3 -3
  36. package/dist/cjs/db-ux.cjs.js.map +1 -1
  37. package/dist/cjs/{document-click-listener-CKUiT8IL.js → document-click-listener-DGna8oDJ.js} +3 -3
  38. package/dist/cjs/{document-click-listener-CKUiT8IL.js.map → document-click-listener-DGna8oDJ.js.map} +1 -1
  39. package/dist/cjs/{document-scroll-listener-BlwNKh0i.js → document-scroll-listener-BBXRu9dN.js} +3 -3
  40. package/dist/cjs/{document-scroll-listener-BlwNKh0i.js.map → document-scroll-listener-BBXRu9dN.js.map} +1 -1
  41. package/dist/cjs/{index-DjV59BYq.js → index-Bm2Cw2rz.js} +22 -2
  42. package/dist/cjs/index-Bm2Cw2rz.js.map +1 -0
  43. package/dist/cjs/{index-BKsFzv8w.js → index-Cn0jjcY0.js} +7 -4
  44. package/dist/{esm/index-Bxi-mtJ7.js.map → cjs/index-Cn0jjcY0.js.map} +1 -1
  45. package/dist/cjs/index.cjs.js +7 -4
  46. package/dist/cjs/index.cjs.js.map +1 -1
  47. package/dist/cjs/loader.cjs.js +2 -2
  48. package/dist/collection/collection-manifest.json +2 -2
  49. package/dist/collection/components/custom-select/custom-select.js +9 -9
  50. package/dist/collection/components/custom-select/custom-select.js.map +1 -1
  51. package/dist/collection/components/custom-select/model.js.map +1 -1
  52. package/dist/collection/components/input/input.js +4 -14
  53. package/dist/collection/components/input/input.js.map +1 -1
  54. package/dist/collection/components/input/model.js.map +1 -1
  55. package/dist/collection/components/switch/model.js.map +1 -1
  56. package/dist/collection/components/switch/switch.js +260 -51
  57. package/dist/collection/components/switch/switch.js.map +1 -1
  58. package/dist/collection/components/tab-item/tab-item.js +2 -2
  59. package/dist/collection/components/tab-list/tab-list.js +2 -2
  60. package/dist/collection/components/tab-panel/tab-panel.js +2 -2
  61. package/dist/collection/components/tabs/tabs.js +2 -2
  62. package/dist/collection/components/textarea/textarea.js +2 -2
  63. package/dist/collection/shared/model.js +1 -0
  64. package/dist/collection/shared/model.js.map +1 -1
  65. package/dist/collection/utils/index.js +19 -0
  66. package/dist/collection/utils/index.js.map +1 -1
  67. package/dist/custom-elements.json +329 -132
  68. 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
  69. package/dist/db-ux/db-custom-select.entry.esm.js.map +1 -1
  70. package/dist/db-ux/db-switch.entry.esm.js.map +1 -1
  71. package/dist/db-ux/db-ux.esm.js +1 -1
  72. package/dist/db-ux/db-ux.esm.js.map +1 -1
  73. package/dist/db-ux/index.esm.js +1 -1
  74. package/dist/db-ux/index.esm.js.map +1 -1
  75. package/dist/db-ux/p-0530a878.entry.js +2 -0
  76. package/dist/db-ux/{p-2c457e48.entry.js.map → p-0530a878.entry.js.map} +1 -1
  77. package/dist/db-ux/{p-3390e528.entry.js → p-09bedc1a.entry.js} +2 -2
  78. package/dist/db-ux/{p-75d3a947.entry.js → p-0c4d5d88.entry.js} +2 -2
  79. package/dist/db-ux/p-38d2dfea.entry.js +2 -0
  80. package/dist/db-ux/p-38d2dfea.entry.js.map +1 -0
  81. package/dist/db-ux/{p-31b7ea66.entry.js → p-3cb7ff97.entry.js} +2 -2
  82. package/dist/db-ux/{p-1a7001bb.entry.js → p-45ca9947.entry.js} +2 -2
  83. package/dist/db-ux/p-4769ec6d.entry.js +2 -0
  84. package/dist/db-ux/{p-950bf6ab.entry.js.map → p-4769ec6d.entry.js.map} +1 -1
  85. package/dist/db-ux/{p-56488bc3.entry.js → p-68bc689b.entry.js} +2 -2
  86. package/dist/db-ux/p-71a9c2c9.entry.js +2 -0
  87. package/dist/db-ux/p-7c27fe0d.entry.js +2 -0
  88. package/dist/db-ux/{p-72bd1665.entry.js.map → p-7c27fe0d.entry.js.map} +1 -1
  89. package/dist/db-ux/{p-82083293.entry.js → p-807ad902.entry.js} +2 -2
  90. package/dist/db-ux/{p-b3ccfc6a.entry.js → p-82311da9.entry.js} +2 -2
  91. package/dist/db-ux/{p-cd51d733.entry.js → p-82369b8d.entry.js} +2 -2
  92. package/dist/db-ux/{p-43be6218.entry.js → p-85ad9dfb.entry.js} +2 -2
  93. package/dist/db-ux/{p-1c50fd87.entry.js → p-870bb35b.entry.js} +2 -2
  94. package/dist/db-ux/{p-2bc4be80.entry.js → p-88e27985.entry.js} +2 -2
  95. package/dist/db-ux/{p-a7a0c5a3.entry.js → p-9ce7a144.entry.js} +2 -2
  96. package/dist/db-ux/p-BMfF_eQJ.js +2 -0
  97. package/dist/db-ux/{p-BRouKtF5.js.map → p-BMfF_eQJ.js.map} +1 -1
  98. package/dist/db-ux/p-BX4jNwUm.js +2 -0
  99. package/dist/db-ux/{p-BwSmFFdU.js.map → p-BX4jNwUm.js.map} +1 -1
  100. package/dist/db-ux/p-DhKljLRG.js +2 -0
  101. package/dist/db-ux/p-DhKljLRG.js.map +1 -0
  102. package/dist/db-ux/{p-Bxi-mtJ7.js → p-_OYZj_2L.js} +2 -2
  103. package/dist/db-ux/{p-Bxi-mtJ7.js.map → p-_OYZj_2L.js.map} +1 -1
  104. package/dist/db-ux/p-a334df8c.entry.js +2 -0
  105. package/dist/db-ux/{p-d0a2e1d4.entry.js → p-b1be4ba0.entry.js} +2 -2
  106. package/dist/db-ux/{p-c9b2b24e.entry.js → p-b2acf6bd.entry.js} +2 -2
  107. package/dist/db-ux/{p-da7e3ac7.entry.js → p-b63d89c7.entry.js} +2 -2
  108. package/dist/db-ux/{p-132ee89d.entry.js → p-ca3555c1.entry.js} +2 -2
  109. package/dist/db-ux/p-ce826494.entry.js +2 -0
  110. package/dist/db-ux/{p-90f21d44.entry.js.map → p-ce826494.entry.js.map} +1 -1
  111. package/dist/db-ux/{p-26e115a8.entry.js → p-cf9785fe.entry.js} +2 -2
  112. package/dist/db-ux/{p-1f490d67.entry.js → p-d17fe729.entry.js} +2 -2
  113. package/dist/db-ux/{p-53c419b0.entry.js → p-d93934d2.entry.js} +2 -2
  114. package/dist/db-ux/p-eab5ef6f.entry.js +2 -0
  115. package/dist/db-ux/p-eab5ef6f.entry.js.map +1 -0
  116. package/dist/db-ux/{p-364cc533.entry.js → p-eabd7598.entry.js} +2 -2
  117. package/dist/db-ux/p-f2483bef.entry.js +2 -0
  118. package/dist/db-ux/{p-fbf46ee6.entry.js.map → p-f2483bef.entry.js.map} +1 -1
  119. package/dist/db-ux/{p-963fde68.entry.js → p-f30ec184.entry.js} +2 -2
  120. package/dist/db-ux/p-f30ec184.entry.js.map +1 -0
  121. package/dist/esm/db-accordion-item.entry.js +2 -2
  122. package/dist/esm/db-accordion.entry.js +2 -2
  123. package/dist/esm/db-badge.entry.js +2 -2
  124. package/dist/esm/db-brand.entry.js +2 -2
  125. package/dist/esm/db-button.entry.js +2 -2
  126. package/dist/esm/db-card.entry.js +2 -2
  127. package/dist/esm/db-checkbox.entry.js +2 -2
  128. 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
  129. package/dist/esm/db-custom-select-dropdown_5.entry.js +5 -15
  130. package/dist/esm/db-custom-select-form-field.entry.js +2 -2
  131. package/dist/esm/db-custom-select.entry.js +10 -10
  132. package/dist/esm/db-custom-select.entry.js.map +1 -1
  133. package/dist/esm/db-divider.entry.js +2 -2
  134. package/dist/esm/db-drawer.entry.js +2 -2
  135. package/dist/esm/db-header.entry.js +2 -2
  136. package/dist/esm/db-icon.entry.js +2 -2
  137. package/dist/esm/db-infotext.entry.js +2 -2
  138. package/dist/esm/db-link.entry.js +2 -2
  139. package/dist/esm/db-navigation-item.entry.js +2 -2
  140. package/dist/esm/db-navigation.entry.js +2 -2
  141. package/dist/esm/db-notification.entry.js +2 -2
  142. package/dist/esm/db-page.entry.js +2 -2
  143. package/dist/esm/db-popover.entry.js +3 -3
  144. package/dist/esm/db-radio.entry.js +2 -2
  145. package/dist/esm/db-section.entry.js +2 -2
  146. package/dist/esm/db-select.entry.js +2 -2
  147. package/dist/esm/db-stack.entry.js +2 -2
  148. package/dist/esm/db-switch.entry.js +70 -5
  149. package/dist/esm/db-switch.entry.js.map +1 -1
  150. package/dist/esm/db-tab-item_3.entry.js +8 -8
  151. package/dist/esm/db-tabs.entry.js +4 -4
  152. package/dist/esm/db-textarea.entry.js +4 -4
  153. package/dist/esm/db-tooltip.entry.js +3 -3
  154. package/dist/esm/db-ux.js +4 -4
  155. package/dist/esm/db-ux.js.map +1 -1
  156. package/dist/esm/{document-click-listener-B4S1N-ro.js → document-click-listener-D1ZXrKSx.js} +3 -3
  157. package/dist/esm/{document-click-listener-B4S1N-ro.js.map → document-click-listener-D1ZXrKSx.js.map} +1 -1
  158. package/dist/esm/{document-scroll-listener-DC7DAxof.js → document-scroll-listener-DF6f0ByI.js} +3 -3
  159. package/dist/esm/{document-scroll-listener-DC7DAxof.js.map → document-scroll-listener-DF6f0ByI.js.map} +1 -1
  160. package/dist/esm/{index-YECpAE3G.js → index-DhKljLRG.js} +22 -3
  161. package/dist/esm/index-DhKljLRG.js.map +1 -0
  162. package/dist/esm/{index-Bxi-mtJ7.js → index-_OYZj_2L.js} +7 -4
  163. package/dist/{cjs/index-BKsFzv8w.js.map → esm/index-_OYZj_2L.js.map} +1 -1
  164. package/dist/esm/index.js +6 -5
  165. package/dist/esm/index.js.map +1 -1
  166. package/dist/esm/loader.js +3 -3
  167. package/dist/types/components/custom-select/custom-select.d.ts +1 -1
  168. package/dist/types/components/custom-select/model.d.ts +1 -1
  169. package/dist/types/components/input/input.d.ts +0 -1
  170. package/dist/types/components/input/model.d.ts +0 -1
  171. package/dist/types/components/switch/model.d.ts +7 -3
  172. package/dist/types/components/switch/switch.d.ts +19 -4
  173. package/dist/types/components.d.ts +14 -4
  174. package/dist/types/shared/model.d.ts +2 -0
  175. package/dist/types/stencil-public-runtime.d.ts +2 -1
  176. package/dist/types/utils/index.d.ts +10 -0
  177. package/dist/vscode.html-custom-data.json +48 -23
  178. package/dist/web-types.json +96 -40
  179. package/package.json +4 -4
  180. package/dist/cjs/index-DjV59BYq.js.map +0 -1
  181. package/dist/db-ux/p-07a7eb33.entry.js +0 -2
  182. package/dist/db-ux/p-2c457e48.entry.js +0 -2
  183. package/dist/db-ux/p-69a7e5f9.entry.js +0 -2
  184. package/dist/db-ux/p-72bd1665.entry.js +0 -2
  185. package/dist/db-ux/p-90f21d44.entry.js +0 -2
  186. package/dist/db-ux/p-950bf6ab.entry.js +0 -2
  187. package/dist/db-ux/p-963fde68.entry.js.map +0 -1
  188. package/dist/db-ux/p-BRouKtF5.js +0 -2
  189. package/dist/db-ux/p-BwSmFFdU.js +0 -2
  190. package/dist/db-ux/p-YECpAE3G.js +0 -2
  191. package/dist/db-ux/p-YECpAE3G.js.map +0 -1
  192. package/dist/db-ux/p-a5b542fa.entry.js +0 -2
  193. package/dist/db-ux/p-a5b542fa.entry.js.map +0 -1
  194. package/dist/db-ux/p-ad8ff0ae.entry.js +0 -2
  195. package/dist/db-ux/p-ad8ff0ae.entry.js.map +0 -1
  196. package/dist/db-ux/p-fbf46ee6.entry.js +0 -2
  197. package/dist/esm/index-YECpAE3G.js.map +0 -1
  198. /package/dist/db-ux/{p-3390e528.entry.js.map → p-09bedc1a.entry.js.map} +0 -0
  199. /package/dist/db-ux/{p-75d3a947.entry.js.map → p-0c4d5d88.entry.js.map} +0 -0
  200. /package/dist/db-ux/{p-31b7ea66.entry.js.map → p-3cb7ff97.entry.js.map} +0 -0
  201. /package/dist/db-ux/{p-1a7001bb.entry.js.map → p-45ca9947.entry.js.map} +0 -0
  202. /package/dist/db-ux/{p-56488bc3.entry.js.map → p-68bc689b.entry.js.map} +0 -0
  203. /package/dist/db-ux/{p-07a7eb33.entry.js.map → p-71a9c2c9.entry.js.map} +0 -0
  204. /package/dist/db-ux/{p-82083293.entry.js.map → p-807ad902.entry.js.map} +0 -0
  205. /package/dist/db-ux/{p-b3ccfc6a.entry.js.map → p-82311da9.entry.js.map} +0 -0
  206. /package/dist/db-ux/{p-cd51d733.entry.js.map → p-82369b8d.entry.js.map} +0 -0
  207. /package/dist/db-ux/{p-43be6218.entry.js.map → p-85ad9dfb.entry.js.map} +0 -0
  208. /package/dist/db-ux/{p-1c50fd87.entry.js.map → p-870bb35b.entry.js.map} +0 -0
  209. /package/dist/db-ux/{p-2bc4be80.entry.js.map → p-88e27985.entry.js.map} +0 -0
  210. /package/dist/db-ux/{p-a7a0c5a3.entry.js.map → p-9ce7a144.entry.js.map} +0 -0
  211. /package/dist/db-ux/{p-69a7e5f9.entry.js.map → p-a334df8c.entry.js.map} +0 -0
  212. /package/dist/db-ux/{p-d0a2e1d4.entry.js.map → p-b1be4ba0.entry.js.map} +0 -0
  213. /package/dist/db-ux/{p-c9b2b24e.entry.js.map → p-b2acf6bd.entry.js.map} +0 -0
  214. /package/dist/db-ux/{p-da7e3ac7.entry.js.map → p-b63d89c7.entry.js.map} +0 -0
  215. /package/dist/db-ux/{p-132ee89d.entry.js.map → p-ca3555c1.entry.js.map} +0 -0
  216. /package/dist/db-ux/{p-26e115a8.entry.js.map → p-cf9785fe.entry.js.map} +0 -0
  217. /package/dist/db-ux/{p-1f490d67.entry.js.map → p-d17fe729.entry.js.map} +0 -0
  218. /package/dist/db-ux/{p-53c419b0.entry.js.map → p-d93934d2.entry.js.map} +0 -0
  219. /package/dist/db-ux/{p-364cc533.entry.js.map → p-eabd7598.entry.js.map} +0 -0
@@ -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, IconLeadingProps, IconProps, IconTrailingProps, 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 & IconTrailingProps & IconLeadingProps;\nexport type DBSwitchDefaultState = {};\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, FocusEventProps, FocusEventState, FormCheckProps, FormMessageProps, FormProps, FormState, FromValidState, GlobalProps, GlobalState, IconLeadingProps, IconProps, IconTrailingProps, LabelVariantHorizontalType, SizeProps } from '../../shared/model';\nexport type DBSwitchDefaultProps = {\n /**\n * Add additional icons to indicate active/inactive state.\n */\n visualAid?: boolean | string;\n\n /**\n * Change the variant of the label to `trailing` or `leading`. Defaults to `trailing`\n */\n variant?: LabelVariantHorizontalType;\n};\nexport type DBSwitchProps = GlobalProps & ChangeEventProps<HTMLInputElement> & FocusEventProps<HTMLInputElement> & FormProps & FormCheckProps & FormMessageProps & SizeProps & IconProps & IconTrailingProps & IconLeadingProps & DBSwitchDefaultProps;\nexport type DBSwitchDefaultState = {};\nexport type DBSwitchState = DBSwitchDefaultState & GlobalState & ChangeEventState<HTMLInputElement> & FocusEventState<HTMLInputElement> & FormState & FromValidState"]}
@@ -1,4 +1,5 @@
1
- import { cls, getBoolean, getBooleanAsString, getHideProp, uuid, } from "../../utils";
1
+ import { DEFAULT_INVALID_MESSAGE, DEFAULT_INVALID_MESSAGE_ID_SUFFIX, DEFAULT_MESSAGE_ID_SUFFIX, DEFAULT_VALID_MESSAGE, DEFAULT_VALID_MESSAGE_ID_SUFFIX, } from "../../shared/constants";
2
+ import { cls, delay, getBoolean, getBooleanAsString, getHideProp, hasVoiceOver, stringPropVisible, uuid, } from "../../utils";
2
3
  import { h, } from "@stencil/core";
3
4
  /**
4
5
  * @slot children - This is a default/unnamed slot
@@ -7,11 +8,55 @@ import { h, } from "@stencil/core";
7
8
  export class DBSwitch {
8
9
  constructor() {
9
10
  this._id = undefined;
11
+ this._messageId = undefined;
12
+ this._validMessageId = undefined;
13
+ this._invalidMessageId = undefined;
14
+ this._invalidMessage = undefined;
15
+ this._descByIds = undefined;
16
+ this._voiceOverFallback = "";
17
+ }
18
+ hasValidState() {
19
+ var _a;
20
+ return !!((_a = this.validMessage) !== null && _a !== void 0 ? _a : this.validation === "valid");
21
+ }
22
+ handleValidation() {
23
+ var _a, _b, _c, _d, _e, _f;
24
+ if (!((_b = (_a = this._ref) === null || _a === void 0 ? void 0 : _a.validity) === null || _b === void 0 ? void 0 : _b.valid) || this.validation === "invalid") {
25
+ this._descByIds = this._invalidMessageId;
26
+ this._invalidMessage =
27
+ this.invalidMessage ||
28
+ ((_c = this._ref) === null || _c === void 0 ? void 0 : _c.validationMessage) ||
29
+ DEFAULT_INVALID_MESSAGE;
30
+ if (hasVoiceOver()) {
31
+ this._voiceOverFallback =
32
+ this._invalidMessage || DEFAULT_INVALID_MESSAGE;
33
+ delay(() => {
34
+ this._voiceOverFallback = "";
35
+ }, 1000);
36
+ }
37
+ return;
38
+ }
39
+ if (this.hasValidState() && ((_e = (_d = this._ref) === null || _d === void 0 ? void 0 : _d.validity) === null || _e === void 0 ? void 0 : _e.valid) && this.required) {
40
+ this._descByIds = this._validMessageId;
41
+ if (hasVoiceOver()) {
42
+ this._voiceOverFallback = (_f = this.validMessage) !== null && _f !== void 0 ? _f : DEFAULT_VALID_MESSAGE;
43
+ delay(() => {
44
+ this._voiceOverFallback = "";
45
+ }, 1000);
46
+ }
47
+ return;
48
+ }
49
+ if (stringPropVisible(this.message, this.showMessage)) {
50
+ this._descByIds = this._messageId;
51
+ return;
52
+ }
53
+ this._descByIds = undefined;
10
54
  }
11
55
  handleChange(event) {
12
56
  if (this.change) {
13
57
  this.change.emit(event);
14
58
  }
59
+ this.handleValidation();
15
60
  }
16
61
  handleBlur(event) {
17
62
  if (this.blur) {
@@ -55,16 +100,27 @@ export class DBSwitch {
55
100
  }
56
101
  }
57
102
  }
103
+ watch0Fn() {
104
+ this.handleValidation();
105
+ }
106
+ watch0() {
107
+ this.watch0Fn();
108
+ }
58
109
  componentDidLoad() {
59
110
  var _a;
60
111
  this.enableAttributePassing(this._ref, "db-switch");
61
112
  this._id = (_a = this.id) !== null && _a !== void 0 ? _a : `switch-${uuid()}`;
113
+ this._messageId = `${this._id}${DEFAULT_MESSAGE_ID_SUFFIX}`;
114
+ this._validMessageId = `${this._id}${DEFAULT_VALID_MESSAGE_ID_SUFFIX}`;
115
+ this._invalidMessageId = `${this._id}${DEFAULT_INVALID_MESSAGE_ID_SUFFIX}`;
116
+ this.handleValidation();
117
+ this.watch0Fn();
62
118
  }
63
119
  render() {
64
- var _a;
65
- return (h("label", { key: '770e7b3683b28143c1803c008fc36e3e1875e506', 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: '331cadeda5edf53bd3040f6532c31ebef6fd2017', type: "checkbox", role: "switch", id: this._id, ref: (el) => {
120
+ var _a, _b, _c, _d;
121
+ return (h("div", { key: 'eaca89f608b76584b1fa9671103faf6b4dcd3c92', class: cls("db-switch", this.className), "data-visual-aid": getBooleanAsString(this.visualAid), "data-size": this.size, "data-hide-label": getHideProp(this.showLabel), "data-variant": this.variant, "data-hide-asterisk": getHideProp(this.showRequiredAsterisk), "data-custom-validity": this.validation }, h("label", { key: '0a9aba40a632407f91c9b41e281a9f19c20f0473', htmlFor: this._id }, h("input", { key: '6b9351bea73008d4bd176371e356be5fe69f16f1', type: "checkbox", role: "switch", id: this._id, ref: (el) => {
66
122
  this._ref = el;
67
- }, checked: getBoolean(this.checked, "checked"), value: this.value, disabled: getBoolean(this.disabled, "disabled"), "aria-invalid": this.validation === "invalid", "data-custom-validity": this.validation, name: this.name, required: getBoolean(this.required, "required"), "data-aid-icon": (_a = this.iconLeading) !== null && _a !== void 0 ? _a : this.icon, "data-aid-icon-trailing": this.iconTrailing, onChange: (event) => this.handleChange(event), onBlur: (event) => this.handleBlur(event), onFocus: (event) => this.handleFocus(event) }), this.label ? this.label : h("slot", null)));
123
+ }, checked: getBoolean(this.checked, "checked"), value: this.value, disabled: getBoolean(this.disabled, "disabled"), "aria-invalid": this.validation === "invalid" ? "true" : undefined, "aria-describedby": this._descByIds, name: this.name, required: getBoolean(this.required, "required"), "data-aid-icon": (_a = this.iconLeading) !== null && _a !== void 0 ? _a : this.icon, "data-aid-icon-trailing": this.iconTrailing, onChange: (event) => this.handleChange(event), onBlur: (event) => this.handleBlur(event), onFocus: (event) => this.handleFocus(event) }), this.label ? this.label : h("slot", null)), stringPropVisible(this.message, this.showMessage) ? (h("db-infotext", { size: "small", semantic: "adaptive", id: this._messageId, icon: this.messageIcon }, this.message)) : null, this.hasValidState() ? (h("db-infotext", { size: "small", semantic: "successful", id: this._validMessageId }, (_b = this.validMessage) !== null && _b !== void 0 ? _b : DEFAULT_VALID_MESSAGE)) : null, h("db-infotext", { key: 'ab8814fd7d0dad8e03dea66eecfe9da4a245985f', size: "small", semantic: "critical", id: this._invalidMessageId }, (_d = (_c = this._invalidMessage) !== null && _c !== void 0 ? _c : this.invalidMessage) !== null && _d !== void 0 ? _d : DEFAULT_INVALID_MESSAGE), h("span", { key: 'cb5cec6bdca51ce0eab42558871d5bfd7c717a0a', "data-visually-hidden": "true", role: "status" }, this._voiceOverFallback)));
68
124
  }
69
125
  static get is() { return "db-switch"; }
70
126
  static get properties() {
@@ -94,12 +150,12 @@ export class DBSwitch {
94
150
  "reflect": false,
95
151
  "attribute": "id"
96
152
  },
97
- "visualAid": {
98
- "type": "any",
153
+ "validation": {
154
+ "type": "string",
99
155
  "mutable": false,
100
156
  "complexType": {
101
- "original": "DBSwitchProps[\"visualAid\"]",
102
- "resolved": "boolean | string",
157
+ "original": "DBSwitchProps[\"validation\"]",
158
+ "resolved": "\"invalid\" | \"no-validation\" | \"valid\"",
103
159
  "references": {
104
160
  "DBSwitchProps": {
105
161
  "location": "import",
@@ -117,14 +173,14 @@ export class DBSwitch {
117
173
  "getter": false,
118
174
  "setter": false,
119
175
  "reflect": false,
120
- "attribute": "visual-aid"
176
+ "attribute": "validation"
121
177
  },
122
- "size": {
123
- "type": "string",
178
+ "required": {
179
+ "type": "any",
124
180
  "mutable": false,
125
181
  "complexType": {
126
- "original": "DBSwitchProps[\"size\"]",
127
- "resolved": "\"medium\" | \"small\"",
182
+ "original": "DBSwitchProps[\"required\"]",
183
+ "resolved": "boolean | string",
128
184
  "references": {
129
185
  "DBSwitchProps": {
130
186
  "location": "import",
@@ -142,14 +198,14 @@ export class DBSwitch {
142
198
  "getter": false,
143
199
  "setter": false,
144
200
  "reflect": false,
145
- "attribute": "size"
201
+ "attribute": "required"
146
202
  },
147
- "showLabel": {
148
- "type": "any",
203
+ "message": {
204
+ "type": "string",
149
205
  "mutable": false,
150
206
  "complexType": {
151
- "original": "DBSwitchProps[\"showLabel\"]",
152
- "resolved": "boolean | string",
207
+ "original": "DBSwitchProps[\"message\"]",
208
+ "resolved": "string",
153
209
  "references": {
154
210
  "DBSwitchProps": {
155
211
  "location": "import",
@@ -167,14 +223,14 @@ export class DBSwitch {
167
223
  "getter": false,
168
224
  "setter": false,
169
225
  "reflect": false,
170
- "attribute": "show-label"
226
+ "attribute": "message"
171
227
  },
172
- "emphasis": {
173
- "type": "string",
228
+ "showMessage": {
229
+ "type": "any",
174
230
  "mutable": false,
175
231
  "complexType": {
176
- "original": "DBSwitchProps[\"emphasis\"]",
177
- "resolved": "\"strong\" | \"weak\"",
232
+ "original": "DBSwitchProps[\"showMessage\"]",
233
+ "resolved": "boolean | string",
178
234
  "references": {
179
235
  "DBSwitchProps": {
180
236
  "location": "import",
@@ -192,14 +248,14 @@ export class DBSwitch {
192
248
  "getter": false,
193
249
  "setter": false,
194
250
  "reflect": false,
195
- "attribute": "emphasis"
251
+ "attribute": "show-message"
196
252
  },
197
- "showRequiredAsterisk": {
198
- "type": "any",
253
+ "validMessage": {
254
+ "type": "string",
199
255
  "mutable": false,
200
256
  "complexType": {
201
- "original": "DBSwitchProps[\"showRequiredAsterisk\"]",
202
- "resolved": "boolean | string",
257
+ "original": "DBSwitchProps[\"validMessage\"]",
258
+ "resolved": "string",
203
259
  "references": {
204
260
  "DBSwitchProps": {
205
261
  "location": "import",
@@ -217,13 +273,13 @@ export class DBSwitch {
217
273
  "getter": false,
218
274
  "setter": false,
219
275
  "reflect": false,
220
- "attribute": "show-required-asterisk"
276
+ "attribute": "valid-message"
221
277
  },
222
- "className": {
278
+ "invalidMessage": {
223
279
  "type": "string",
224
280
  "mutable": false,
225
281
  "complexType": {
226
- "original": "DBSwitchProps[\"className\"]",
282
+ "original": "DBSwitchProps[\"invalidMessage\"]",
227
283
  "resolved": "string",
228
284
  "references": {
229
285
  "DBSwitchProps": {
@@ -242,7 +298,7 @@ export class DBSwitch {
242
298
  "getter": false,
243
299
  "setter": false,
244
300
  "reflect": false,
245
- "attribute": "classname"
301
+ "attribute": "invalid-message"
246
302
  },
247
303
  "checked": {
248
304
  "type": "any",
@@ -269,12 +325,12 @@ export class DBSwitch {
269
325
  "reflect": false,
270
326
  "attribute": "checked"
271
327
  },
272
- "value": {
328
+ "visualAid": {
273
329
  "type": "any",
274
330
  "mutable": false,
275
331
  "complexType": {
276
- "original": "DBSwitchProps[\"value\"]",
277
- "resolved": "any",
332
+ "original": "DBSwitchProps[\"visualAid\"]",
333
+ "resolved": "boolean | string",
278
334
  "references": {
279
335
  "DBSwitchProps": {
280
336
  "location": "import",
@@ -292,13 +348,38 @@ export class DBSwitch {
292
348
  "getter": false,
293
349
  "setter": false,
294
350
  "reflect": false,
295
- "attribute": "value"
351
+ "attribute": "visual-aid"
296
352
  },
297
- "disabled": {
353
+ "size": {
354
+ "type": "string",
355
+ "mutable": false,
356
+ "complexType": {
357
+ "original": "DBSwitchProps[\"size\"]",
358
+ "resolved": "\"medium\" | \"small\"",
359
+ "references": {
360
+ "DBSwitchProps": {
361
+ "location": "import",
362
+ "path": "./model",
363
+ "id": "src/components/switch/model.ts::DBSwitchProps"
364
+ }
365
+ }
366
+ },
367
+ "required": false,
368
+ "optional": false,
369
+ "docs": {
370
+ "tags": [],
371
+ "text": ""
372
+ },
373
+ "getter": false,
374
+ "setter": false,
375
+ "reflect": false,
376
+ "attribute": "size"
377
+ },
378
+ "showLabel": {
298
379
  "type": "any",
299
380
  "mutable": false,
300
381
  "complexType": {
301
- "original": "DBSwitchProps[\"disabled\"]",
382
+ "original": "DBSwitchProps[\"showLabel\"]",
302
383
  "resolved": "boolean | string",
303
384
  "references": {
304
385
  "DBSwitchProps": {
@@ -317,14 +398,37 @@ export class DBSwitch {
317
398
  "getter": false,
318
399
  "setter": false,
319
400
  "reflect": false,
320
- "attribute": "disabled"
401
+ "attribute": "show-label"
321
402
  },
322
- "validation": {
323
- "type": "string",
403
+ "variant": {
404
+ "type": "unknown",
324
405
  "mutable": false,
325
406
  "complexType": {
326
- "original": "DBSwitchProps[\"validation\"]",
327
- "resolved": "\"invalid\" | \"no-validation\" | \"valid\"",
407
+ "original": "DBSwitchProps[\"variant\"]",
408
+ "resolved": "never",
409
+ "references": {
410
+ "DBSwitchProps": {
411
+ "location": "import",
412
+ "path": "./model",
413
+ "id": "src/components/switch/model.ts::DBSwitchProps"
414
+ }
415
+ }
416
+ },
417
+ "required": false,
418
+ "optional": false,
419
+ "docs": {
420
+ "tags": [],
421
+ "text": ""
422
+ },
423
+ "getter": false,
424
+ "setter": false
425
+ },
426
+ "showRequiredAsterisk": {
427
+ "type": "any",
428
+ "mutable": false,
429
+ "complexType": {
430
+ "original": "DBSwitchProps[\"showRequiredAsterisk\"]",
431
+ "resolved": "boolean | string",
328
432
  "references": {
329
433
  "DBSwitchProps": {
330
434
  "location": "import",
@@ -342,13 +446,13 @@ export class DBSwitch {
342
446
  "getter": false,
343
447
  "setter": false,
344
448
  "reflect": false,
345
- "attribute": "validation"
449
+ "attribute": "show-required-asterisk"
346
450
  },
347
- "name": {
451
+ "className": {
348
452
  "type": "string",
349
453
  "mutable": false,
350
454
  "complexType": {
351
- "original": "DBSwitchProps[\"name\"]",
455
+ "original": "DBSwitchProps[\"className\"]",
352
456
  "resolved": "string",
353
457
  "references": {
354
458
  "DBSwitchProps": {
@@ -367,13 +471,38 @@ export class DBSwitch {
367
471
  "getter": false,
368
472
  "setter": false,
369
473
  "reflect": false,
370
- "attribute": "name"
474
+ "attribute": "classname"
371
475
  },
372
- "required": {
476
+ "value": {
373
477
  "type": "any",
374
478
  "mutable": false,
375
479
  "complexType": {
376
- "original": "DBSwitchProps[\"required\"]",
480
+ "original": "DBSwitchProps[\"value\"]",
481
+ "resolved": "any",
482
+ "references": {
483
+ "DBSwitchProps": {
484
+ "location": "import",
485
+ "path": "./model",
486
+ "id": "src/components/switch/model.ts::DBSwitchProps"
487
+ }
488
+ }
489
+ },
490
+ "required": false,
491
+ "optional": false,
492
+ "docs": {
493
+ "tags": [],
494
+ "text": ""
495
+ },
496
+ "getter": false,
497
+ "setter": false,
498
+ "reflect": false,
499
+ "attribute": "value"
500
+ },
501
+ "disabled": {
502
+ "type": "any",
503
+ "mutable": false,
504
+ "complexType": {
505
+ "original": "DBSwitchProps[\"disabled\"]",
377
506
  "resolved": "boolean | string",
378
507
  "references": {
379
508
  "DBSwitchProps": {
@@ -392,7 +521,32 @@ export class DBSwitch {
392
521
  "getter": false,
393
522
  "setter": false,
394
523
  "reflect": false,
395
- "attribute": "required"
524
+ "attribute": "disabled"
525
+ },
526
+ "name": {
527
+ "type": "string",
528
+ "mutable": false,
529
+ "complexType": {
530
+ "original": "DBSwitchProps[\"name\"]",
531
+ "resolved": "string",
532
+ "references": {
533
+ "DBSwitchProps": {
534
+ "location": "import",
535
+ "path": "./model",
536
+ "id": "src/components/switch/model.ts::DBSwitchProps"
537
+ }
538
+ }
539
+ },
540
+ "required": false,
541
+ "optional": false,
542
+ "docs": {
543
+ "tags": [],
544
+ "text": ""
545
+ },
546
+ "getter": false,
547
+ "setter": false,
548
+ "reflect": false,
549
+ "attribute": "name"
396
550
  },
397
551
  "iconLeading": {
398
552
  "type": "string",
@@ -493,12 +647,43 @@ export class DBSwitch {
493
647
  "setter": false,
494
648
  "reflect": false,
495
649
  "attribute": "label"
650
+ },
651
+ "messageIcon": {
652
+ "type": "string",
653
+ "mutable": false,
654
+ "complexType": {
655
+ "original": "DBSwitchProps[\"messageIcon\"]",
656
+ "resolved": "BaseIconTypes | LooseAutocomplete",
657
+ "references": {
658
+ "DBSwitchProps": {
659
+ "location": "import",
660
+ "path": "./model",
661
+ "id": "src/components/switch/model.ts::DBSwitchProps"
662
+ }
663
+ }
664
+ },
665
+ "required": false,
666
+ "optional": false,
667
+ "docs": {
668
+ "tags": [],
669
+ "text": ""
670
+ },
671
+ "getter": false,
672
+ "setter": false,
673
+ "reflect": false,
674
+ "attribute": "message-icon"
496
675
  }
497
676
  };
498
677
  }
499
678
  static get states() {
500
679
  return {
501
- "_id": {}
680
+ "_id": {},
681
+ "_messageId": {},
682
+ "_validMessageId": {},
683
+ "_invalidMessageId": {},
684
+ "_invalidMessage": {},
685
+ "_descByIds": {},
686
+ "_voiceOverFallback": {}
502
687
  };
503
688
  }
504
689
  static get events() {
@@ -549,5 +734,29 @@ export class DBSwitch {
549
734
  }
550
735
  }];
551
736
  }
737
+ static get watchers() {
738
+ return [{
739
+ "propName": "validation",
740
+ "methodName": "watch0"
741
+ }, {
742
+ "propName": "required",
743
+ "methodName": "watch0"
744
+ }, {
745
+ "propName": "message",
746
+ "methodName": "watch0"
747
+ }, {
748
+ "propName": "showMessage",
749
+ "methodName": "watch0"
750
+ }, {
751
+ "propName": "validMessage",
752
+ "methodName": "watch0"
753
+ }, {
754
+ "propName": "invalidMessage",
755
+ "methodName": "watch0"
756
+ }, {
757
+ "propName": "checked",
758
+ "methodName": "watch0"
759
+ }];
760
+ }
552
761
  }
553
762
  //# 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,EAEL,IAAI,EACJ,KAAK,GACN,MAAM,eAAe,CAAC;AAGvB;;;GAGG;AAIH,MAAM,OAAO,QAAQ;IAHpB;QA+BU,QAAG,GAAG,SAAS,CAAC;KAkG1B;IAhGC,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,OAAO,IAAI,MAAM,EAAE,CAAC;YACtB,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;YAC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AAI,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() validation: DBSwitchProps[\"validation\"];\n @Prop() name: DBSwitchProps[\"name\"];\n @Prop() required: DBSwitchProps[\"required\"];\n @Prop() iconLeading: DBSwitchProps[\"iconLeading\"];\n @Prop() icon: DBSwitchProps[\"icon\"];\n @Prop() iconTrailing: DBSwitchProps[\"iconTrailing\"];\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-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.iconLeading ?? this.icon}\n data-aid-icon-trailing={this.iconTrailing}\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":"AAAA,OAAO,EACL,uBAAuB,EACvB,iCAAiC,EACjC,yBAAyB,EACzB,qBAAqB,EACrB,+BAA+B,GAChC,MAAM,wBAAwB,CAAC;AAEhC,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T_INVALID_MESSAGE,\n DEFAULT_INVALID_MESSAGE_ID_SUFFIX,\n DEFAULT_MESSAGE_ID_SUFFIX,\n DEFAULT_VALID_MESSAGE,\n DEFAULT_VALID_MESSAGE_ID_SUFFIX,\n} from \"../../shared/constants\";\nimport { ChangeEvent, InteractionEvent } from \"../../shared/model\";\nimport {\n cls,\n delay,\n getBoolean,\n getBooleanAsString,\n getHideProp,\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 { 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() validation: DBSwitchProps[\"validation\"];\n @Prop() required: DBSwitchProps[\"required\"];\n @Prop() message: DBSwitchProps[\"message\"];\n @Prop() showMessage: DBSwitchProps[\"showMessage\"];\n @Prop() validMessage: DBSwitchProps[\"validMessage\"];\n @Prop() invalidMessage: DBSwitchProps[\"invalidMessage\"];\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() variant: DBSwitchProps[\"variant\"];\n @Prop() showRequiredAsterisk: DBSwitchProps[\"showRequiredAsterisk\"];\n @Prop({attribute: \"classname\"}) className: DBSwitchProps[\"className\"];\n @Prop() value: DBSwitchProps[\"value\"];\n @Prop() disabled: DBSwitchProps[\"disabled\"];\n @Prop() name: DBSwitchProps[\"name\"];\n @Prop() iconLeading: DBSwitchProps[\"iconLeading\"];\n @Prop() icon: DBSwitchProps[\"icon\"];\n @Prop() iconTrailing: DBSwitchProps[\"iconTrailing\"];\n @Prop() label: DBSwitchProps[\"label\"];\n @Prop() messageIcon: DBSwitchProps[\"messageIcon\"];\n @State() _id = undefined;\n @State() _messageId = undefined;\n @State() _validMessageId = undefined;\n @State() _invalidMessageId = undefined;\n @State() _invalidMessage = undefined;\n @State() _descByIds = undefined;\n @State() _voiceOverFallback = \"\";\n\n hasValidState() {\n return !!(this.validMessage ?? this.validation === \"valid\");\n }\n handleValidation() {\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 =\n this._invalidMessage || DEFAULT_INVALID_MESSAGE;\n delay(() => {\n this._voiceOverFallback = \"\";\n }, 1000);\n }\n return;\n }\n if (this.hasValidState() && this._ref?.validity?.valid && this.required) {\n this._descByIds = this._validMessageId!;\n if (hasVoiceOver()) {\n this._voiceOverFallback = this.validMessage ?? DEFAULT_VALID_MESSAGE;\n delay(() => {\n this._voiceOverFallback = \"\";\n }, 1000);\n }\n return;\n }\n if (stringPropVisible(this.message, this.showMessage)) {\n this._descByIds = this._messageId!;\n return;\n }\n this._descByIds = undefined;\n }\n handleChange(event: ChangeEvent<HTMLInputElement>) {\n if (this.change) {\n this.change.emit(event);\n }\n this.handleValidation();\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 this.handleValidation();\n }\n\n @Watch(\"validation\")\n @Watch(\"required\")\n @Watch(\"message\")\n @Watch(\"showMessage\")\n @Watch(\"validMessage\")\n @Watch(\"invalidMessage\")\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._messageId = `${this._id}${DEFAULT_MESSAGE_ID_SUFFIX}`;\n this._validMessageId = `${this._id}${DEFAULT_VALID_MESSAGE_ID_SUFFIX}`;\n this._invalidMessageId = `${this._id}${DEFAULT_INVALID_MESSAGE_ID_SUFFIX}`;\n this.handleValidation();\n this.watch0Fn();\n }\n\n render() {\n return (\n <div\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-variant={this.variant}\n data-hide-asterisk={getHideProp(this.showRequiredAsterisk)}\n data-custom-validity={this.validation}\n >\n <label htmlFor={this._id}>\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-invalid={this.validation === \"invalid\" ? \"true\" : undefined}\n aria-describedby={this._descByIds}\n name={this.name}\n required={getBoolean(this.required, \"required\")}\n data-aid-icon={this.iconLeading ?? this.icon}\n data-aid-icon-trailing={this.iconTrailing}\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 {stringPropVisible(this.message, this.showMessage) ? (\n <db-infotext\n size=\"small\"\n semantic=\"adaptive\"\n id={this._messageId}\n icon={this.messageIcon}\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 this.invalidMessage ??\n DEFAULT_INVALID_MESSAGE}\n </db-infotext>\n <span data-visually-hidden=\"true\" role=\"status\">\n {this._voiceOverFallback}\n </span>\n </div>\n );\n }\n}\n"]}
@@ -90,9 +90,9 @@ export class DBTabItem {
90
90
  }
91
91
  render() {
92
92
  var _a, _b;
93
- return (h("li", { key: '783a7b85f5d5c48bc86890a70e0f7ba497c78357', class: cls("db-tab-item", this.className), role: "none" }, h("label", { key: '1691dfe198cbbfc943ee15e8a98a5bfa8d2c38c9', htmlFor: this.id, "data-icon": (_a = this.iconLeading) !== null && _a !== void 0 ? _a : this.icon, "data-icon-trailing": this.iconTrailing, "data-show-icon": getBooleanAsString((_b = this.showIconLeading) !== null && _b !== void 0 ? _b : this.showIcon), "data-show-icon-trailing": getBooleanAsString(this.showIconTrailing), "data-no-text": getBooleanAsString(this.noText) }, h("input", { key: 'c84dbf7eecd6fca414d44f99789f31e7343be32a', type: "radio", role: "tab", disabled: getBoolean(this.disabled, "disabled"), "aria-selected": this._selected, checked: getBoolean(this.checked, "checked"), ref: (el) => {
93
+ return (h("li", { key: '6c20231d7dd76e231ec39495bc66b18c642cf673', class: cls("db-tab-item", this.className), role: "none" }, h("label", { key: 'e8262a16f9ff8babec59f85f4ce9f8a19dece89d', htmlFor: this.id, "data-icon": (_a = this.iconLeading) !== null && _a !== void 0 ? _a : this.icon, "data-icon-trailing": this.iconTrailing, "data-show-icon": getBooleanAsString((_b = this.showIconLeading) !== null && _b !== void 0 ? _b : this.showIcon), "data-show-icon-trailing": getBooleanAsString(this.showIconTrailing), "data-no-text": getBooleanAsString(this.noText) }, h("input", { key: '67bdd4a5c520eb8a0325e67c680237968af13aa5', type: "radio", role: "tab", disabled: getBoolean(this.disabled, "disabled"), "aria-selected": this._selected, checked: getBoolean(this.checked, "checked"), ref: (el) => {
94
94
  this._ref = el;
95
- }, name: this._name, id: this.id, onInput: (event) => this.handleChange(event) }), this.label ? this.label : null, h("slot", { key: 'c18d88865dc6cb537ce846d7eb290cfc6408be88' }))));
95
+ }, name: this._name, id: this.id, onInput: (event) => this.handleChange(event) }), this.label ? this.label : null, h("slot", { key: '5579426f7548f32cd9f8fc27c9a18d311f5ab4fe' }))));
96
96
  }
97
97
  static get is() { return "db-tab-item"; }
98
98
  static get properties() {
@@ -46,9 +46,9 @@ export class DBTabList {
46
46
  this._id = this.id || "tab-list-" + uuid();
47
47
  }
48
48
  render() {
49
- return (h("div", { key: 'd65855c3e219394e145bb6472be44efd8ad2f5c6', class: cls("db-tab-list", this.className), ref: (el) => {
49
+ return (h("div", { key: '4ef0a69cacaafb2205ebfea7826c3c1f64a84411', class: cls("db-tab-list", this.className), ref: (el) => {
50
50
  this._ref = el;
51
- }, id: this._id }, h("ul", { key: 'df0a48deba8650387cf824fd339094ab5a8afd32', role: "tablist" }, h("slot", { key: '56597cc2c3b344fdf4c9be7784a6b57b6f3b1f7e' }))));
51
+ }, id: this._id }, h("ul", { key: 'cfdccc43bd366eb9c71137918a8ca92fd6a81b69', role: "tablist" }, h("slot", { key: 'c09711c4b398a3d6b26d62c87aaf0f050af32bdb' }))));
52
52
  }
53
53
  static get is() { return "db-tab-list"; }
54
54
  static get properties() {
@@ -41,9 +41,9 @@ export class DBTabPanel {
41
41
  this.enableAttributePassing(this._ref, "db-tab-panel");
42
42
  }
43
43
  render() {
44
- return (h("section", { key: 'e2118080ba0bc2b7cecd50029131ca3faeb77a36', class: cls("db-tab-panel", this.className), role: "tabpanel", ref: (el) => {
44
+ return (h("section", { key: '312ef04379d3b4a094999f02ac919e3b0ac31877', class: cls("db-tab-panel", this.className), role: "tabpanel", ref: (el) => {
45
45
  this._ref = el;
46
- }, id: this.id }, this.content ? this.content : null, h("slot", { key: '2b4cb8605b0dcd313f5dfb2aeac063074b0249ae' })));
46
+ }, id: this.id }, this.content ? this.content : null, h("slot", { key: '7848155bb7734db6835c0fe7fcf85eb37635110d' })));
47
47
  }
48
48
  static get is() { return "db-tab-panel"; }
49
49
  static get properties() {
@@ -204,10 +204,10 @@ export class DBTabs {
204
204
  }
205
205
  render() {
206
206
  var _a, _b, _c, _d;
207
- return (h("div", { key: '3cba7c0fba47a0cd323e5c772fc010c552a92740', class: cls("db-tabs", this.className), ref: (el) => {
207
+ return (h("div", { key: 'a53c2737f8238bbe266baa7d6e3f90649c52512a', class: cls("db-tabs", this.className), ref: (el) => {
208
208
  this._ref = el;
209
209
  }, id: this._id, "data-orientation": this.orientation, "data-scroll-behavior": this.behavior, "data-alignment": (_a = this.alignment) !== null && _a !== void 0 ? _a : "start", "data-width": (_b = this.width) !== null && _b !== void 0 ? _b : "auto", onInput: (event) => this.handleChange(event), onChange: (event) => this.handleChange(event) }, this.showScrollLeft ? (h("db-button", { class: "tabs-scroll-left", variant: "ghost", icon: "chevron_left", type: "button", noText: true, onClick: () => this.scroll(true) }, "Scroll left")) : null, this.tabs ? (h(Fragment, null, h("db-tab-list", null, (_c = this.convertTabs()) === null || _c === void 0 ? void 0 : _c.map((tab, index) => (h("db-tab-item", { key: this.name + "tab-item" + index, active: tab.active, label: tab.label, iconTrailing: tab.iconTrailing, icon: tab.icon, noText: tab.noText })))), (_d = this.convertTabs()) === null || _d === void 0 ? void 0 :
210
- _d.map((tab, index) => (h("db-tab-panel", { key: this.name + "tab-panel" + index, content: tab.content }, tab.children))))) : null, this.showScrollRight ? (h("db-button", { class: "tabs-scroll-right", variant: "ghost", icon: "chevron_right", type: "button", noText: true, onClick: () => this.scroll() }, "Scroll right")) : null, h("slot", { key: '34e23ae2f8dd9a30065895f99929a95c41ace4f8' })));
210
+ _d.map((tab, index) => (h("db-tab-panel", { key: this.name + "tab-panel" + index, content: tab.content }, tab.children))))) : null, this.showScrollRight ? (h("db-button", { class: "tabs-scroll-right", variant: "ghost", icon: "chevron_right", type: "button", noText: true, onClick: () => this.scroll() }, "Scroll right")) : null, h("slot", { key: 'e8cf7f0c576b73cdd459ab4cf1f07f14c5ed1657' })));
211
211
  }
212
212
  static get is() { return "db-tabs"; }
213
213
  static get properties() {
@@ -150,10 +150,10 @@ export class DBTextarea {
150
150
  }
151
151
  render() {
152
152
  var _a, _b, _c, _d, _e;
153
- return (h("div", { key: '987c1133ee1ad412b77c27c5fc77735548bb4470', 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: 'e487aa66097f32caaf8cb5dd4c63ca1a9d67f37d', htmlFor: this._id }, (_a = this.label) !== null && _a !== void 0 ? _a : DEFAULT_LABEL), h("textarea", { key: '69434958df4127fe56b66df8bf57ee8b2d3e78ce', "aria-invalid": this.validation === "invalid", "data-custom-validity": this.validation, "data-field-sizing": this.fieldSizing, ref: (el) => {
153
+ return (h("div", { key: 'a649040d1fa37d907b3608a2c37beb7cbc740d4b', 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: '784fdef1d47e8193c8b89a94047d1aaa581027ad', htmlFor: this._id }, (_a = this.label) !== null && _a !== void 0 ? _a : DEFAULT_LABEL), h("textarea", { key: 'a4f4eb71a5871c5a72b250c779b2c7c4988c51a3', "aria-invalid": this.validation === "invalid", "data-custom-validity": this.validation, "data-field-sizing": this.fieldSizing, ref: (el) => {
154
154
  this._ref = el;
155
155
  }, 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") ||
156
- 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: 'e1ae4a692e1e3a115354185b0b712bfcb5c2238e', size: "small", semantic: "critical", id: this._invalidMessageId }, this._invalidMessage), h("span", { key: '1190dd7dbb597fb65cd0d83cc4770c5d5f11af27', "data-visually-hidden": "true", role: "status" }, this._voiceOverFallback)));
156
+ 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: '1c499fb00436791637cd7efaf908cf5cef66c19c', size: "small", semantic: "critical", id: this._invalidMessageId }, this._invalidMessage), h("span", { key: '6c4b23b49afa46786f3f3b088c1a8939e0a455db', "data-visually-hidden": "true", role: "status" }, this._voiceOverFallback)));
157
157
  }
158
158
  static get is() { return "db-textarea"; }
159
159
  static get properties() {