@lion/ui 0.7.3 → 0.7.5

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 (284) hide show
  1. package/components/combobox/src/LionCombobox.js +35 -22
  2. package/components/combobox/test/lion-combobox.test.js +109 -66
  3. package/components/form/src/LionForm.js +11 -2
  4. package/components/form/test/lion-form.test.js +21 -2
  5. package/components/form-core/src/FormControlMixin.js +0 -9
  6. package/components/form-core/src/localizeNamespaceLoader.js +75 -0
  7. package/components/form-core/src/registration/FormRegisteringMixin.js +28 -0
  8. package/components/form-core/src/validate/LionValidationFeedback.js +36 -2
  9. package/components/form-core/test/validate/lion-validation-feedback.test.js +30 -2
  10. package/components/form-core/test-suites/FormRegistrationMixins.suite.js +17 -0
  11. package/components/form-core/test-suites/ValidateMixin.suite.js +1 -1
  12. package/components/form-core/translations/bg-BG.js +5 -0
  13. package/components/form-core/translations/bg.js +6 -0
  14. package/components/form-core/translations/cs-CZ.js +5 -0
  15. package/components/form-core/translations/cs.js +6 -0
  16. package/components/form-core/translations/de-DE.js +5 -0
  17. package/components/form-core/translations/de.js +6 -0
  18. package/components/form-core/translations/en-AU.js +5 -0
  19. package/components/form-core/translations/en-GB.js +5 -0
  20. package/components/form-core/translations/en-US.js +5 -0
  21. package/components/form-core/translations/en.js +6 -0
  22. package/components/form-core/translations/es-ES.js +5 -0
  23. package/components/form-core/translations/es.js +6 -0
  24. package/components/form-core/translations/fr-BE.js +5 -0
  25. package/components/form-core/translations/fr-FR.js +5 -0
  26. package/components/form-core/translations/fr.js +6 -0
  27. package/components/form-core/translations/hu-HU.js +5 -0
  28. package/components/form-core/translations/hu.js +6 -0
  29. package/components/form-core/translations/it-IT.js +5 -0
  30. package/components/form-core/translations/it.js +6 -0
  31. package/components/form-core/translations/nl-BE.js +5 -0
  32. package/components/form-core/translations/nl-NL.js +5 -0
  33. package/components/form-core/translations/nl.js +6 -0
  34. package/components/form-core/translations/pl-PL.js +5 -0
  35. package/components/form-core/translations/pl.js +6 -0
  36. package/components/form-core/translations/ro-RO.js +5 -0
  37. package/components/form-core/translations/ro.js +6 -0
  38. package/components/form-core/translations/ru-RU.js +5 -0
  39. package/components/form-core/translations/ru.js +6 -0
  40. package/components/form-core/translations/sk-SK.js +5 -0
  41. package/components/form-core/translations/sk.js +6 -0
  42. package/components/form-core/translations/uk-UA.js +5 -0
  43. package/components/form-core/translations/uk.js +6 -0
  44. package/components/form-core/translations/zh.js +6 -0
  45. package/components/form-core/types/FormControlMixinTypes.ts +0 -4
  46. package/components/form-core/types/registration/FormRegisteringMixinTypes.ts +17 -4
  47. package/components/input-amount/test/lion-input-amount.test.js +3 -0
  48. package/components/input-file/src/LionInputFile.js +88 -30
  49. package/components/input-file/test/lion-input-file.test.js +102 -6
  50. package/components/input-file/test/lion-selected-file-list.test.js +2 -1
  51. package/components/input-file/translations/bg.js +3 -0
  52. package/components/input-file/translations/cs.js +3 -0
  53. package/components/input-file/translations/de.js +3 -0
  54. package/components/input-file/translations/en.js +3 -0
  55. package/components/input-file/translations/es.js +3 -0
  56. package/components/input-file/translations/fr.js +3 -0
  57. package/components/input-file/translations/hu.js +3 -0
  58. package/components/input-file/translations/it.js +3 -0
  59. package/components/input-file/translations/nl.js +3 -0
  60. package/components/input-file/translations/pl.js +3 -0
  61. package/components/input-file/translations/ro.js +3 -0
  62. package/components/input-file/translations/ru.js +3 -0
  63. package/components/input-file/translations/sk.js +3 -0
  64. package/components/input-file/translations/uk.js +3 -0
  65. package/components/input-file/translations/zh.js +3 -0
  66. package/components/overlays/src/OverlayMixin.js +8 -1
  67. package/components/switch/src/LionSwitch.js +10 -0
  68. package/components/tabs/src/LionTabs.js +10 -0
  69. package/components/tabs/test/lion-tabs.test.js +49 -38
  70. package/custom-elements.json +85378 -74680
  71. package/dist-types/components/combobox/src/LionCombobox.d.ts +12 -8
  72. package/dist-types/components/combobox/src/LionCombobox.d.ts.map +1 -1
  73. package/dist-types/components/form/src/LionForm.d.ts.map +1 -1
  74. package/dist-types/components/form/test/lion-form.test.d.ts.map +1 -1
  75. package/dist-types/components/form-core/src/FormControlMixin.d.ts.map +1 -1
  76. package/dist-types/components/form-core/src/LionField.d.ts +1 -1
  77. package/dist-types/components/form-core/src/localizeNamespaceLoader.d.ts +2 -0
  78. package/dist-types/components/form-core/src/localizeNamespaceLoader.d.ts.map +1 -0
  79. package/dist-types/components/form-core/src/registration/FormRegisteringMixin.d.ts.map +1 -1
  80. package/dist-types/components/form-core/src/validate/LionValidationFeedback.d.ts +5 -6
  81. package/dist-types/components/form-core/src/validate/LionValidationFeedback.d.ts.map +1 -1
  82. package/dist-types/components/form-core/test-suites/FormRegistrationMixins.suite.d.ts.map +1 -1
  83. package/dist-types/components/form-core/translations/bg-BG.d.ts +8 -0
  84. package/dist-types/components/form-core/translations/bg-BG.d.ts.map +1 -0
  85. package/dist-types/components/form-core/translations/bg.d.ts +8 -0
  86. package/dist-types/components/form-core/translations/bg.d.ts.map +1 -0
  87. package/dist-types/components/form-core/translations/cs-CZ.d.ts +8 -0
  88. package/dist-types/components/form-core/translations/cs-CZ.d.ts.map +1 -0
  89. package/dist-types/components/form-core/translations/cs.d.ts +8 -0
  90. package/dist-types/components/form-core/translations/cs.d.ts.map +1 -0
  91. package/dist-types/components/form-core/translations/de-DE.d.ts +8 -0
  92. package/dist-types/components/form-core/translations/de-DE.d.ts.map +1 -0
  93. package/dist-types/components/form-core/translations/de.d.ts +8 -0
  94. package/dist-types/components/form-core/translations/de.d.ts.map +1 -0
  95. package/dist-types/components/form-core/translations/en-AU.d.ts +8 -0
  96. package/dist-types/components/form-core/translations/en-AU.d.ts.map +1 -0
  97. package/dist-types/components/form-core/translations/en-GB.d.ts +8 -0
  98. package/dist-types/components/form-core/translations/en-GB.d.ts.map +1 -0
  99. package/dist-types/components/form-core/translations/en-US.d.ts +8 -0
  100. package/dist-types/components/form-core/translations/en-US.d.ts.map +1 -0
  101. package/dist-types/components/form-core/translations/en.d.ts +8 -0
  102. package/dist-types/components/form-core/translations/en.d.ts.map +1 -0
  103. package/dist-types/components/form-core/translations/es-ES.d.ts +8 -0
  104. package/dist-types/components/form-core/translations/es-ES.d.ts.map +1 -0
  105. package/dist-types/components/form-core/translations/es.d.ts +8 -0
  106. package/dist-types/components/form-core/translations/es.d.ts.map +1 -0
  107. package/dist-types/components/form-core/translations/fr-BE.d.ts +8 -0
  108. package/dist-types/components/form-core/translations/fr-BE.d.ts.map +1 -0
  109. package/dist-types/components/form-core/translations/fr-FR.d.ts +8 -0
  110. package/dist-types/components/form-core/translations/fr-FR.d.ts.map +1 -0
  111. package/dist-types/components/form-core/translations/fr.d.ts +8 -0
  112. package/dist-types/components/form-core/translations/fr.d.ts.map +1 -0
  113. package/dist-types/components/form-core/translations/hu-HU.d.ts +8 -0
  114. package/dist-types/components/form-core/translations/hu-HU.d.ts.map +1 -0
  115. package/dist-types/components/form-core/translations/hu.d.ts +8 -0
  116. package/dist-types/components/form-core/translations/hu.d.ts.map +1 -0
  117. package/dist-types/components/form-core/translations/it-IT.d.ts +8 -0
  118. package/dist-types/components/form-core/translations/it-IT.d.ts.map +1 -0
  119. package/dist-types/components/form-core/translations/it.d.ts +8 -0
  120. package/dist-types/components/form-core/translations/it.d.ts.map +1 -0
  121. package/dist-types/components/form-core/translations/nl-BE.d.ts +8 -0
  122. package/dist-types/components/form-core/translations/nl-BE.d.ts.map +1 -0
  123. package/dist-types/components/form-core/translations/nl-NL.d.ts +8 -0
  124. package/dist-types/components/form-core/translations/nl-NL.d.ts.map +1 -0
  125. package/dist-types/components/form-core/translations/nl.d.ts +8 -0
  126. package/dist-types/components/form-core/translations/nl.d.ts.map +1 -0
  127. package/dist-types/components/form-core/translations/pl-PL.d.ts +8 -0
  128. package/dist-types/components/form-core/translations/pl-PL.d.ts.map +1 -0
  129. package/dist-types/components/form-core/translations/pl.d.ts +8 -0
  130. package/dist-types/components/form-core/translations/pl.d.ts.map +1 -0
  131. package/dist-types/components/form-core/translations/ro-RO.d.ts +8 -0
  132. package/dist-types/components/form-core/translations/ro-RO.d.ts.map +1 -0
  133. package/dist-types/components/form-core/translations/ro.d.ts +8 -0
  134. package/dist-types/components/form-core/translations/ro.d.ts.map +1 -0
  135. package/dist-types/components/form-core/translations/ru-RU.d.ts +8 -0
  136. package/dist-types/components/form-core/translations/ru-RU.d.ts.map +1 -0
  137. package/dist-types/components/form-core/translations/ru.d.ts +8 -0
  138. package/dist-types/components/form-core/translations/ru.d.ts.map +1 -0
  139. package/dist-types/components/form-core/translations/sk-SK.d.ts +8 -0
  140. package/dist-types/components/form-core/translations/sk-SK.d.ts.map +1 -0
  141. package/dist-types/components/form-core/translations/sk.d.ts +8 -0
  142. package/dist-types/components/form-core/translations/sk.d.ts.map +1 -0
  143. package/dist-types/components/form-core/translations/uk-UA.d.ts +8 -0
  144. package/dist-types/components/form-core/translations/uk-UA.d.ts.map +1 -0
  145. package/dist-types/components/form-core/translations/uk.d.ts +8 -0
  146. package/dist-types/components/form-core/translations/uk.d.ts.map +1 -0
  147. package/dist-types/components/form-core/translations/zh.d.ts +8 -0
  148. package/dist-types/components/form-core/translations/zh.d.ts.map +1 -0
  149. package/dist-types/components/form-core/types/FormControlMixinTypes.d.ts +0 -4
  150. package/dist-types/components/form-core/types/FormControlMixinTypes.d.ts.map +1 -1
  151. package/dist-types/components/form-core/types/registration/FormRegisteringMixinTypes.d.ts +14 -4
  152. package/dist-types/components/form-core/types/registration/FormRegisteringMixinTypes.d.ts.map +1 -1
  153. package/dist-types/components/input-file/src/LionInputFile.d.ts +12 -6
  154. package/dist-types/components/input-file/src/LionInputFile.d.ts.map +1 -1
  155. package/dist-types/components/input-file/translations/bg-BG.d.ts +3 -0
  156. package/dist-types/components/input-file/translations/bg.d.ts +3 -0
  157. package/dist-types/components/input-file/translations/cs-CZ.d.ts +3 -0
  158. package/dist-types/components/input-file/translations/cs.d.ts +3 -0
  159. package/dist-types/components/input-file/translations/de-DE.d.ts +3 -0
  160. package/dist-types/components/input-file/translations/de.d.ts +3 -0
  161. package/dist-types/components/input-file/translations/en-AU.d.ts +3 -0
  162. package/dist-types/components/input-file/translations/en-GB.d.ts +3 -0
  163. package/dist-types/components/input-file/translations/en-PH.d.ts +3 -0
  164. package/dist-types/components/input-file/translations/en-US.d.ts +3 -0
  165. package/dist-types/components/input-file/translations/en.d.ts +3 -0
  166. package/dist-types/components/input-file/translations/es-ES.d.ts +3 -0
  167. package/dist-types/components/input-file/translations/es.d.ts +3 -0
  168. package/dist-types/components/input-file/translations/fr-BE.d.ts +3 -0
  169. package/dist-types/components/input-file/translations/fr-FR.d.ts +3 -0
  170. package/dist-types/components/input-file/translations/fr.d.ts +3 -0
  171. package/dist-types/components/input-file/translations/hu-HU.d.ts +3 -0
  172. package/dist-types/components/input-file/translations/hu.d.ts +3 -0
  173. package/dist-types/components/input-file/translations/it-IT.d.ts +3 -0
  174. package/dist-types/components/input-file/translations/it.d.ts +3 -0
  175. package/dist-types/components/input-file/translations/nl-BE.d.ts +3 -0
  176. package/dist-types/components/input-file/translations/nl-NL.d.ts +3 -0
  177. package/dist-types/components/input-file/translations/nl.d.ts +3 -0
  178. package/dist-types/components/input-file/translations/pl-PL.d.ts +3 -0
  179. package/dist-types/components/input-file/translations/pl.d.ts +3 -0
  180. package/dist-types/components/input-file/translations/ro-RO.d.ts +3 -0
  181. package/dist-types/components/input-file/translations/ro.d.ts +3 -0
  182. package/dist-types/components/input-file/translations/ru-RU.d.ts +3 -0
  183. package/dist-types/components/input-file/translations/ru.d.ts +3 -0
  184. package/dist-types/components/input-file/translations/sk-SK.d.ts +3 -0
  185. package/dist-types/components/input-file/translations/sk.d.ts +3 -0
  186. package/dist-types/components/input-file/translations/uk-UA.d.ts +3 -0
  187. package/dist-types/components/input-file/translations/uk.d.ts +3 -0
  188. package/dist-types/components/input-file/translations/zh-CN.d.ts +3 -0
  189. package/dist-types/components/input-file/translations/zh.d.ts +3 -0
  190. package/dist-types/components/listbox/src/LionOption.d.ts +1 -1
  191. package/dist-types/components/overlays/src/OverlayMixin.d.ts.map +1 -1
  192. package/dist-types/components/switch/src/LionSwitch.d.ts.map +1 -1
  193. package/dist-types/components/tabs/src/LionTabs.d.ts.map +1 -1
  194. package/dist-types/tsconfig.tsbuildinfo +1 -1
  195. package/docs/components/accordion/api-table.md +31 -0
  196. package/docs/components/button/api-table.md +104 -0
  197. package/docs/components/calendar/api-table.md +44 -0
  198. package/docs/components/checkbox-group/api-table.md +564 -0
  199. package/docs/components/checkbox-group/overview.md +2 -2
  200. package/docs/components/collapsible/api-table.md +36 -0
  201. package/docs/components/collapsible/overview.md +1 -1
  202. package/docs/components/combobox/api-table.md +256 -0
  203. package/docs/components/combobox/overview.md +1 -1
  204. package/docs/components/combobox/use-cases.md +1 -1
  205. package/docs/components/dialog/api-table.md +45 -0
  206. package/docs/components/dialog/overview.md +1 -1
  207. package/docs/components/drawer/api-table.md +45 -0
  208. package/docs/components/fieldset/api-table.md +163 -0
  209. package/docs/components/fieldset/overview.md +5 -5
  210. package/docs/components/form/api-table.md +1 -0
  211. package/docs/components/form/overview.md +3 -3
  212. package/docs/components/icon/api-table.md +29 -0
  213. package/docs/components/icon/use-cases.md +1 -1
  214. package/docs/components/input/api-table.md +187 -0
  215. package/docs/components/input/overview.md +1 -1
  216. package/docs/components/input-amount/api-table.md +196 -0
  217. package/docs/components/input-amount/overview.md +3 -3
  218. package/docs/components/input-date/api-table.md +188 -0
  219. package/docs/components/input-date/overview.md +3 -3
  220. package/docs/components/input-datepicker/api-table.md +234 -0
  221. package/docs/components/input-datepicker/overview.md +5 -5
  222. package/docs/components/input-email/api-table.md +187 -0
  223. package/docs/components/input-email/overview.md +2 -2
  224. package/docs/components/input-file/api-table.md +272 -0
  225. package/docs/components/input-file/overview.md +1 -1
  226. package/docs/components/input-iban/api-table.md +187 -0
  227. package/docs/components/input-iban/overview.md +2 -2
  228. package/docs/components/input-range/api-table.md +198 -0
  229. package/docs/components/input-range/overview.md +2 -2
  230. package/docs/components/input-stepper/api-table.md +205 -0
  231. package/docs/components/input-stepper/overview.md +1 -1
  232. package/docs/components/input-tel/api-table.md +202 -0
  233. package/docs/components/input-tel/overview.md +1 -1
  234. package/docs/components/input-tel/use-cases.md +6 -6
  235. package/docs/components/input-tel-dropdown/api-table.md +213 -0
  236. package/docs/components/input-tel-dropdown/overview.md +1 -1
  237. package/docs/components/listbox/api-table.md +293 -0
  238. package/docs/components/listbox/use-cases.md +1 -1
  239. package/docs/components/pagination/api-table.md +33 -0
  240. package/docs/components/progress-indicator/api-table.md +36 -0
  241. package/docs/components/radio-group/api-table.md +378 -0
  242. package/docs/components/radio-group/overview.md +3 -3
  243. package/docs/components/select/api-table.md +181 -0
  244. package/docs/components/select/use-cases.md +1 -1
  245. package/docs/components/select-rich/api-table.md +288 -0
  246. package/docs/components/select-rich/use-cases.md +1 -1
  247. package/docs/components/steps/api-table.md +80 -0
  248. package/docs/components/switch/api-table.md +229 -0
  249. package/docs/components/tabs/api-table.md +32 -0
  250. package/docs/components/tabs/examples.md +1 -1
  251. package/docs/components/textarea/api-table.md +192 -0
  252. package/docs/components/tooltip/api-table.md +53 -0
  253. package/docs/fundamentals/index.md +4 -4
  254. package/docs/fundamentals/node-tools/providence-analytics/LocalConfiguration.md +1 -1
  255. package/docs/fundamentals/node-tools/providence-analytics/QueryResult.md +1 -1
  256. package/docs/fundamentals/node-tools/providence-analytics/analyzer.md +1 -1
  257. package/docs/fundamentals/node-tools/providence-analytics/dashboard.md +1 -1
  258. package/docs/fundamentals/node-tools/providence-analytics/overview.md +3 -3
  259. package/docs/fundamentals/node-tools/publish-docs/overview.md +3 -3
  260. package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +2 -2
  261. package/docs/fundamentals/rationales/accessibility.md +1 -1
  262. package/docs/fundamentals/systems/core/SlotMixin.md +1 -1
  263. package/docs/fundamentals/systems/core/api-table.md +34 -0
  264. package/docs/fundamentals/systems/core/overview.md +1 -1
  265. package/docs/fundamentals/systems/form/api-table.md +166 -0
  266. package/docs/fundamentals/systems/form/formatting-and-parsing.md +4 -4
  267. package/docs/fundamentals/systems/form/model-value.md +1 -1
  268. package/docs/fundamentals/systems/form/overview.md +28 -28
  269. package/docs/fundamentals/systems/form/validate.md +2 -2
  270. package/docs/fundamentals/systems/localize/api-table.md +65 -0
  271. package/docs/fundamentals/systems/localize/overview.md +4 -4
  272. package/docs/fundamentals/systems/overlays/api-table.md +168 -0
  273. package/docs/fundamentals/systems/overlays/configuration.md +2 -2
  274. package/docs/fundamentals/systems/overlays/overview.md +5 -5
  275. package/docs/fundamentals/systems/overlays/use-cases.md +2 -2
  276. package/docs/fundamentals/tools/helpers/overview.md +1 -1
  277. package/docs/fundamentals/tools/singleton-manager/overview.md +4 -4
  278. package/docs/guides/how-to/create-a-custom-field.md +5 -5
  279. package/docs/guides/how-to/create-a-form.md +4 -4
  280. package/docs/guides/how-to/extend-a-native-input.md +2 -2
  281. package/docs/guides/index.md +8 -8
  282. package/docs/guides/principles/index.md +5 -5
  283. package/docs/guides/principles/styling.md +1 -1
  284. package/package.json +5 -4
@@ -456,10 +456,14 @@ export class LionCombobox extends LocalizeMixin(OverlayMixin(CustomChoiceGroupMi
456
456
  */
457
457
  this.__listboxContentChanged = false;
458
458
 
459
+ /** @type {EventListener}
460
+ * @protected
461
+ */
462
+ this._onKeyUp = this._onKeyUp.bind(this);
459
463
  /** @type {EventListener}
460
464
  * @private
461
465
  */
462
- this.__requestShowOverlay = this.__requestShowOverlay.bind(this);
466
+ this._textboxOnClick = this._textboxOnClick.bind(this);
463
467
  /** @type {EventListener}
464
468
  * @protected
465
469
  */
@@ -500,9 +504,6 @@ export class LionCombobox extends LocalizeMixin(OverlayMixin(CustomChoiceGroupMi
500
504
  }
501
505
  }
502
506
  }
503
- if (name === 'focused' && this.focused) {
504
- this.__requestShowOverlay();
505
- }
506
507
  }
507
508
 
508
509
  /**
@@ -614,11 +615,6 @@ export class LionCombobox extends LocalizeMixin(OverlayMixin(CustomChoiceGroupMi
614
615
  * that wraps the listbox with options
615
616
  *
616
617
  * @example
617
- * _showOverlayCondition(options) {
618
- * return this.focused || super._showOverlayCondition(options);
619
- * }
620
- *
621
- * @example
622
618
  * _showOverlayCondition({ lastKey }) {
623
619
  * return lastKey === 'ArrowDown';
624
620
  * }
@@ -635,19 +631,20 @@ export class LionCombobox extends LocalizeMixin(OverlayMixin(CustomChoiceGroupMi
635
631
  // TODO: batch all pending condition triggers in __pendingShowTriggers, reducing race conditions
636
632
  // eslint-disable-next-line class-methods-use-this
637
633
  _showOverlayCondition({ lastKey }) {
638
- const hideOn = ['Tab', 'Escape', 'Enter'];
639
- if (lastKey && hideOn.includes(lastKey)) {
634
+ const alwaysHideOn = ['Tab', 'Escape'];
635
+ const notMultipleChoiceHideOn = ['Enter'];
636
+ if (
637
+ lastKey &&
638
+ (alwaysHideOn.includes(lastKey) ||
639
+ (!this.multipleChoice && notMultipleChoiceHideOn.includes(lastKey)))
640
+ ) {
640
641
  return false;
641
642
  }
642
-
643
- if (this.showAllOnEmpty && this.focused) {
643
+ if (this.filled || this.showAllOnEmpty) {
644
644
  return true;
645
645
  }
646
646
  // when no keyboard action involved (on focused change), return current opened state
647
- if (!lastKey) {
648
- return /** @type {boolean} */ (this.opened);
649
- }
650
- return true;
647
+ return /** @type {boolean} */ (this.opened);
651
648
  }
652
649
 
653
650
  /**
@@ -678,9 +675,14 @@ export class LionCombobox extends LocalizeMixin(OverlayMixin(CustomChoiceGroupMi
678
675
  this.__listboxContentChanged = true;
679
676
  }
680
677
 
678
+ /**
679
+ * @param {Event} ev
680
+ * @protected
681
+ */
681
682
  // eslint-disable-next-line no-unused-vars
682
- _textboxOnInput() {
683
+ _textboxOnInput(ev) {
683
684
  this.__shouldAutocompleteNextUpdate = true;
685
+ this.opened = true;
684
686
  }
685
687
 
686
688
  /**
@@ -1068,7 +1070,8 @@ export class LionCombobox extends LocalizeMixin(OverlayMixin(CustomChoiceGroupMi
1068
1070
  */
1069
1071
  _setupOpenCloseListeners() {
1070
1072
  super._setupOpenCloseListeners();
1071
- this._inputNode.addEventListener('keyup', this.__requestShowOverlay);
1073
+ this._inputNode.addEventListener('keyup', this._onKeyUp);
1074
+ this._inputNode.addEventListener('click', this._textboxOnClick);
1072
1075
  }
1073
1076
 
1074
1077
  /**
@@ -1077,7 +1080,8 @@ export class LionCombobox extends LocalizeMixin(OverlayMixin(CustomChoiceGroupMi
1077
1080
  */
1078
1081
  _teardownOpenCloseListeners() {
1079
1082
  super._teardownOpenCloseListeners();
1080
- this._inputNode.removeEventListener('keyup', this.__requestShowOverlay);
1083
+ this._inputNode.removeEventListener('keyup', this._onKeyUp);
1084
+ this._inputNode.removeEventListener('click', this._textboxOnClick);
1081
1085
  }
1082
1086
 
1083
1087
  /**
@@ -1225,9 +1229,9 @@ export class LionCombobox extends LocalizeMixin(OverlayMixin(CustomChoiceGroupMi
1225
1229
 
1226
1230
  /**
1227
1231
  * @param {KeyboardEvent} [ev]
1228
- * @private
1232
+ * @protected
1229
1233
  */
1230
- __requestShowOverlay(ev) {
1234
+ _onKeyUp(ev) {
1231
1235
  const lastKey = ev && ev.key;
1232
1236
  this.opened = this._showOverlayCondition({
1233
1237
  lastKey,
@@ -1235,6 +1239,15 @@ export class LionCombobox extends LocalizeMixin(OverlayMixin(CustomChoiceGroupMi
1235
1239
  });
1236
1240
  }
1237
1241
 
1242
+ /**
1243
+ * @param {FocusEvent} [ev]
1244
+ * @protected
1245
+ */
1246
+ // eslint-disable-next-line no-unused-vars
1247
+ _textboxOnClick(ev) {
1248
+ this.opened = this._showOverlayCondition({});
1249
+ }
1250
+
1238
1251
  clear() {
1239
1252
  this.value = '';
1240
1253
  super.clear();
@@ -93,11 +93,9 @@ describe('lion-combobox', () => {
93
93
  `)
94
94
  );
95
95
 
96
- const { _comboboxNode, _listboxNode } = getComboboxMembers(el);
96
+ const { _listboxNode } = getComboboxMembers(el);
97
97
 
98
98
  async function open() {
99
- // activate opened listbox
100
- _comboboxNode.dispatchEvent(new Event('focusin', { bubbles: true, composed: true }));
101
99
  mimicUserTyping(el, 'ch');
102
100
  return el.updateComplete;
103
101
  }
@@ -150,7 +148,7 @@ describe('lion-combobox', () => {
150
148
  await performChecks();
151
149
  });
152
150
 
153
- it('shows overlay on focusin', async () => {
151
+ it('shows overlay on click', async () => {
154
152
  const el = /** @type {LionCombobox} */ (
155
153
  await fixture(html`
156
154
  <lion-combobox name="foo" .showAllOnEmpty="${true}">
@@ -161,15 +159,15 @@ describe('lion-combobox', () => {
161
159
  </lion-combobox>
162
160
  `)
163
161
  );
164
- const { _comboboxNode } = getComboboxMembers(el);
162
+ const { _inputNode } = getComboboxMembers(el);
165
163
 
166
164
  expect(el.opened).to.be.false;
167
- _comboboxNode.dispatchEvent(new Event('focusin', { bubbles: true, composed: true }));
165
+ _inputNode.dispatchEvent(new Event('click', { bubbles: true, composed: true }));
168
166
  await el.updateComplete;
169
167
  expect(el.opened).to.be.true;
170
168
  });
171
169
 
172
- it('hides overlay on focusin after [Escape]', async () => {
170
+ it('hides overlay on [Escape] after being opened', async () => {
173
171
  const el = /** @type {LionCombobox} */ (
174
172
  await fixture(html`
175
173
  <lion-combobox name="foo" .showAllOnEmpty="${true}">
@@ -183,7 +181,7 @@ describe('lion-combobox', () => {
183
181
  const { _comboboxNode, _inputNode } = getComboboxMembers(el);
184
182
 
185
183
  expect(el.opened).to.be.false;
186
- _comboboxNode.dispatchEvent(new Event('focusin', { bubbles: true, composed: true }));
184
+ _comboboxNode.dispatchEvent(new Event('click', { bubbles: true, composed: true }));
187
185
  await el.updateComplete;
188
186
  expect(el.opened).to.be.true;
189
187
  _inputNode.dispatchEvent(new KeyboardEvent('keyup', { key: 'Escape' }));
@@ -203,11 +201,9 @@ describe('lion-combobox', () => {
203
201
  `)
204
202
  );
205
203
 
206
- const { _comboboxNode, _listboxNode, _inputNode } = getComboboxMembers(el);
204
+ const { _listboxNode, _inputNode } = getComboboxMembers(el);
207
205
 
208
206
  async function open() {
209
- // activate opened listbox
210
- _comboboxNode.dispatchEvent(new Event('focusin', { bubbles: true, composed: true }));
211
207
  mimicUserTyping(el, 'ch');
212
208
  return el.updateComplete;
213
209
  }
@@ -870,10 +866,10 @@ describe('lion-combobox', () => {
870
866
  });
871
867
 
872
868
  describe('Overlay visibility', () => {
873
- it('does not show overlay on focusin', async () => {
869
+ it('does not show overlay on click', async () => {
874
870
  const el = /** @type {LionCombobox} */ (
875
871
  await fixture(html`
876
- <lion-combobox name="foo" multiple-choice>
872
+ <lion-combobox name="foo">
877
873
  <lion-option .choiceValue="${'Artichoke'}">Artichoke</lion-option>
878
874
  <lion-option .choiceValue="${'Chard'}">Chard</lion-option>
879
875
  <lion-option .choiceValue="${'Chicory'}">Chicory</lion-option>
@@ -884,7 +880,26 @@ describe('lion-combobox', () => {
884
880
  const { _comboboxNode } = getComboboxMembers(el);
885
881
 
886
882
  expect(el.opened).to.equal(false);
887
- _comboboxNode.dispatchEvent(new Event('focusin', { bubbles: true, composed: true }));
883
+ _comboboxNode.dispatchEvent(new Event('click', { bubbles: true, composed: true }));
884
+ await el.updateComplete;
885
+ expect(el.opened).to.equal(false);
886
+ });
887
+
888
+ it('shows overlay on click when filled', async () => {
889
+ const el = /** @type {LionCombobox} */ (
890
+ await fixture(html`
891
+ <lion-combobox name="foo">
892
+ <lion-option .choiceValue="${'Artichoke'}">Artichoke</lion-option>
893
+ <lion-option .choiceValue="${'Chard'}">Chard</lion-option>
894
+ <lion-option .choiceValue="${'Chicory'}">Chicory</lion-option>
895
+ <lion-option .choiceValue="${'Victoria Plum'}">Victoria Plum</lion-option>
896
+ </lion-combobox>
897
+ `)
898
+ );
899
+ const { _comboboxNode } = getComboboxMembers(el);
900
+ el.modelValue = 'Art';
901
+ expect(el.opened).to.equal(false);
902
+ _comboboxNode.dispatchEvent(new Event('click', { bubbles: true, composed: true }));
888
903
  await el.updateComplete;
889
904
  expect(el.opened).to.equal(false);
890
905
  });
@@ -914,7 +929,7 @@ describe('lion-combobox', () => {
914
929
  expect(el.opened).to.equal(false);
915
930
 
916
931
  // step [1]
917
- _inputNode.dispatchEvent(new Event('focusin', { bubbles: true, composed: true }));
932
+ _inputNode.dispatchEvent(new Event('click', { bubbles: true, composed: true }));
918
933
  await el.updateComplete;
919
934
  expect(el.opened).to.equal(false);
920
935
 
@@ -948,10 +963,7 @@ describe('lion-combobox', () => {
948
963
  `)
949
964
  );
950
965
 
951
- const { _comboboxNode, _inputNode } = getComboboxMembers(el);
952
-
953
- // open
954
- _comboboxNode.dispatchEvent(new Event('focusin', { bubbles: true, composed: true }));
966
+ const { _inputNode } = getComboboxMembers(el);
955
967
 
956
968
  mimicUserTyping(el, 'art');
957
969
  await el.updateComplete;
@@ -963,7 +975,7 @@ describe('lion-combobox', () => {
963
975
  expect(_inputNode.value).to.equal('');
964
976
  });
965
977
 
966
- it('hides overlay on [Tab]', async () => {
978
+ it('hides overlay on [Enter]', async () => {
967
979
  const el = /** @type {LionCombobox} */ (
968
980
  await fixture(html`
969
981
  <lion-combobox name="foo">
@@ -975,10 +987,33 @@ describe('lion-combobox', () => {
975
987
  `)
976
988
  );
977
989
 
978
- const { _comboboxNode, _inputNode } = getComboboxMembers(el);
990
+ const { _inputNode } = getComboboxMembers(el);
979
991
 
980
- // open
981
- _comboboxNode.dispatchEvent(new Event('focusin', { bubbles: true, composed: true }));
992
+ mimicUserTyping(el, 'art');
993
+ await el.updateComplete;
994
+ expect(el.opened).to.equal(true);
995
+ expect(_inputNode.value).to.equal('Artichoke');
996
+
997
+ // N.B. we do only trigger keydown here (and not mimicKeypress (both keyup and down)),
998
+ // because this closely mimics what happens in the browser
999
+ _inputNode.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
1000
+ expect(el.opened).to.equal(false);
1001
+ expect(_inputNode.value).to.equal('Artichoke');
1002
+ });
1003
+
1004
+ it('hides overlay on [Tab]', async () => {
1005
+ const el = /** @type {LionCombobox} */ (
1006
+ await fixture(html`
1007
+ <lion-combobox name="foo">
1008
+ <lion-option .choiceValue="${'Artichoke'}">Artichoke</lion-option>
1009
+ <lion-option .choiceValue="${'Chard'}">Chard</lion-option>
1010
+ <lion-option .choiceValue="${'Chicory'}">Chicory</lion-option>
1011
+ <lion-option .choiceValue="${'Victoria Plum'}">Victoria Plum</lion-option>
1012
+ </lion-combobox>
1013
+ `)
1014
+ );
1015
+
1016
+ const { _inputNode } = getComboboxMembers(el);
982
1017
 
983
1018
  mimicUserTyping(el, 'art');
984
1019
  await el.updateComplete;
@@ -992,7 +1027,7 @@ describe('lion-combobox', () => {
992
1027
  expect(_inputNode.value).to.equal('Artichoke');
993
1028
  });
994
1029
 
995
- it('clears checkedIndex on empty text', async () => {
1030
+ it('keeps overlay open on [Shift]', async () => {
996
1031
  const el = /** @type {LionCombobox} */ (
997
1032
  await fixture(html`
998
1033
  <lion-combobox name="foo">
@@ -1004,10 +1039,33 @@ describe('lion-combobox', () => {
1004
1039
  `)
1005
1040
  );
1006
1041
 
1007
- const { _comboboxNode, _inputNode } = getComboboxMembers(el);
1042
+ const { _inputNode } = getComboboxMembers(el);
1043
+
1044
+ mimicUserTyping(el, 'art');
1045
+ await el.updateComplete;
1046
+ expect(el.opened).to.equal(true);
1047
+ expect(_inputNode.value).to.equal('Artichoke');
1048
+
1049
+ // N.B. we do only trigger keydown here (and not mimicKeypress (both keyup and down)),
1050
+ // because this closely mimics what happens in the browser
1051
+ _inputNode.dispatchEvent(new KeyboardEvent('keydown', { key: 'Shift' }));
1052
+ expect(el.opened).to.equal(true);
1053
+ expect(_inputNode.value).to.equal('Artichoke');
1054
+ });
1055
+
1056
+ it('clears checkedIndex on empty text', async () => {
1057
+ const el = /** @type {LionCombobox} */ (
1058
+ await fixture(html`
1059
+ <lion-combobox name="foo">
1060
+ <lion-option .choiceValue="${'Artichoke'}">Artichoke</lion-option>
1061
+ <lion-option .choiceValue="${'Chard'}">Chard</lion-option>
1062
+ <lion-option .choiceValue="${'Chicory'}">Chicory</lion-option>
1063
+ <lion-option .choiceValue="${'Victoria Plum'}">Victoria Plum</lion-option>
1064
+ </lion-combobox>
1065
+ `)
1066
+ );
1008
1067
 
1009
- // open
1010
- _comboboxNode.dispatchEvent(new Event('focusin', { bubbles: true, composed: true }));
1068
+ const { _inputNode } = getComboboxMembers(el);
1011
1069
 
1012
1070
  mimicUserTyping(el, 'art');
1013
1071
  await el.updateComplete;
@@ -1043,34 +1101,6 @@ describe('lion-combobox', () => {
1043
1101
 
1044
1102
  // NB: If this becomes a suite, move to separate file
1045
1103
  describe('Subclassers', () => {
1046
- it('allows to control overlay visibility via "_showOverlayCondition"', async () => {
1047
- class ShowOverlayConditionCombobox extends LionCombobox {
1048
- /** @param {{ currentValue: string, lastKey:string }} options */
1049
- _showOverlayCondition(options) {
1050
- return this.focused || super._showOverlayCondition(options);
1051
- }
1052
- }
1053
- const tagName = defineCE(ShowOverlayConditionCombobox);
1054
- const tag = unsafeStatic(tagName);
1055
-
1056
- const el = /** @type {LionCombobox} */ (
1057
- await fixture(html`
1058
- <${tag} name="foo" multiple-choice>
1059
- <lion-option .choiceValue="${'Artichoke'}">Artichoke</lion-option>
1060
- <lion-option .choiceValue="${'Chard'}">Chard</lion-option>
1061
- <lion-option .choiceValue="${'Chicory'}">Chicory</lion-option>
1062
- <lion-option .choiceValue="${'Victoria Plum'}">Victoria Plum</lion-option>
1063
- </${tag}>
1064
- `)
1065
- );
1066
- const { _comboboxNode } = getComboboxMembers(el);
1067
-
1068
- expect(el.opened).to.equal(false);
1069
- _comboboxNode.dispatchEvent(new Event('focusin', { bubbles: true, composed: true }));
1070
- await el.updateComplete;
1071
- expect(el.opened).to.equal(true);
1072
- });
1073
-
1074
1104
  it('allows to control overlay visibility via "_showOverlayCondition": should not display overlay if currentValue length condition is not fulfilled', async () => {
1075
1105
  class ShowOverlayConditionCombobox extends LionCombobox {
1076
1106
  /** @param {{ currentValue: string, lastKey:string }} options */
@@ -1164,11 +1194,8 @@ describe('lion-combobox', () => {
1164
1194
  `)
1165
1195
  );
1166
1196
  const options = el.formElements;
1167
- const { _comboboxNode } = getComboboxMembers(el);
1168
1197
  expect(el.opened).to.equal(false);
1169
1198
 
1170
- _comboboxNode.dispatchEvent(new Event('focusin', { bubbles: true, composed: true }));
1171
-
1172
1199
  mimicUserTyping(el, 'art');
1173
1200
  await el.updateComplete;
1174
1201
  expect(el.opened).to.equal(true);
@@ -1208,11 +1235,8 @@ describe('lion-combobox', () => {
1208
1235
  `)
1209
1236
  );
1210
1237
  const options = el.formElements;
1211
- const { _comboboxNode } = getComboboxMembers(el);
1212
1238
  expect(el.opened).to.equal(false);
1213
1239
 
1214
- _comboboxNode.dispatchEvent(new Event('focusin', { bubbles: true, composed: true }));
1215
-
1216
1240
  mimicUserTyping(el, 'art');
1217
1241
  expect(el.opened).to.equal(true);
1218
1242
  await el.updateComplete;
@@ -2948,7 +2972,7 @@ describe('lion-combobox', () => {
2948
2972
 
2949
2973
  describe('Multiple Choice', () => {
2950
2974
  // TODO: possibly later share test with select-rich if it officially supports multipleChoice
2951
- it('does not close listbox on click/enter', async () => {
2975
+ it('does not close listbox on click', async () => {
2952
2976
  const el = /** @type {LionCombobox} */ (
2953
2977
  await fixture(html`
2954
2978
  <lion-combobox name="foo" multiple-choice>
@@ -2960,10 +2984,7 @@ describe('lion-combobox', () => {
2960
2984
  `)
2961
2985
  );
2962
2986
 
2963
- const { _comboboxNode } = getComboboxMembers(el);
2964
-
2965
2987
  // activate opened listbox
2966
- _comboboxNode.dispatchEvent(new Event('focusin', { bubbles: true, composed: true }));
2967
2988
  mimicUserTyping(el, 'ch');
2968
2989
  await el.updateComplete;
2969
2990
 
@@ -2971,7 +2992,29 @@ describe('lion-combobox', () => {
2971
2992
  const visibleOptions = el.formElements.filter(o => o.style.display !== 'none');
2972
2993
  visibleOptions[0].click();
2973
2994
  expect(el.opened).to.equal(true);
2974
- mimicKeyPress(visibleOptions[1], 'Enter');
2995
+ });
2996
+
2997
+ it('does not close listbox on [Enter]', async () => {
2998
+ const el = /** @type {LionCombobox} */ (
2999
+ await fixture(html`
3000
+ <lion-combobox name="foo" multiple-choice>
3001
+ <lion-option .choiceValue="${'Artichoke'}">Artichoke</lion-option>
3002
+ <lion-option .choiceValue="${'Chard'}">Chard</lion-option>
3003
+ <lion-option .choiceValue="${'Chicory'}">Chicory</lion-option>
3004
+ <lion-option .choiceValue="${'Victoria Plum'}">Victoria Plum</lion-option>
3005
+ </lion-combobox>
3006
+ `)
3007
+ );
3008
+
3009
+ const { _inputNode } = getComboboxMembers(el);
3010
+
3011
+ mimicUserTyping(el, 'art');
3012
+ await el.updateComplete;
3013
+ expect(el.opened).to.equal(true);
3014
+
3015
+ // N.B. we do only trigger keydown here (and not mimicKeypress (both keyup and down)),
3016
+ // because this closely mimics what happens in the browser
3017
+ _inputNode.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
2975
3018
  expect(el.opened).to.equal(true);
2976
3019
  });
2977
3020
 
@@ -10,6 +10,15 @@ const throwFormNodeError = () => {
10
10
  );
11
11
  };
12
12
 
13
+ /**
14
+ * @param {FormRegistrarHost} formEl
15
+ * @returns {boolean}
16
+ */
17
+ function hasFocusableChildren(formEl) {
18
+ // this implies all children have the same type (either all of them are focusable or none of them are)
19
+ return formEl.formElements?.some(child => child._focusableNode);
20
+ }
21
+
13
22
  /**
14
23
  * LionForm: form wrapper providing extra features and integration with lion-field elements.
15
24
  *
@@ -63,7 +72,7 @@ export class LionForm extends LionFieldset {
63
72
  this.dispatchEvent(new Event('submit', { bubbles: true }));
64
73
 
65
74
  if (this.hasFeedbackFor?.includes('error')) {
66
- this._setFocusOnFirstErroneousFormElement(this);
75
+ this._setFocusOnFirstErroneousFormElement(/** @type { * & FormRegistrarHost } */ (this));
67
76
  }
68
77
  }
69
78
 
@@ -95,7 +104,7 @@ export class LionForm extends LionFieldset {
95
104
  element.formElements.find(child => child.hasFeedbackFor.includes('error')) ||
96
105
  element.formElements[0];
97
106
 
98
- if (firstFormElWithError.formElements?.length > 0) {
107
+ if (hasFocusableChildren(firstFormElWithError)) {
99
108
  this._setFocusOnFirstErroneousFormElement(firstFormElWithError);
100
109
  } else {
101
110
  firstFormElWithError._focusableNode.focus();
@@ -3,7 +3,8 @@ import '@lion/ui/define/lion-fieldset.js';
3
3
  import { LionField, Required } from '@lion/ui/form-core.js';
4
4
  import '@lion/ui/define/lion-field.js';
5
5
  import '@lion/ui/define/lion-validation-feedback.js';
6
-
6
+ import '@lion/ui/define/lion-listbox.js';
7
+ import '@lion/ui/define/lion-option.js';
7
8
  import '@lion/ui/define/lion-form.js';
8
9
  import {
9
10
  aTimeout,
@@ -223,7 +224,7 @@ describe('<lion-form>', () => {
223
224
  expect(document.activeElement).to.equal(el.formElements[1]._inputNode);
224
225
  });
225
226
 
226
- it('sets focus on submit to the first erroneous form element with a fieldset', async () => {
227
+ it('sets focus on submit to the first erroneous form element within a fieldset', async () => {
227
228
  const el = await fixture(html`
228
229
  <lion-form>
229
230
  <form>
@@ -266,4 +267,22 @@ describe('<lion-form>', () => {
266
267
  // @ts-ignore [allow-protected] in test
267
268
  expect(document.activeElement).to.equal(fieldset.formElements[0]._inputNode);
268
269
  });
270
+
271
+ it('sets focus on submit to the first form element within a erroneous listbox', async () => {
272
+ const el = await fixture(html`
273
+ <lion-form>
274
+ <form>
275
+ <lion-listbox name="name" .validators="${[new Required()]}">
276
+ <lion-option value="a">a</lion-option>
277
+ <lion-option value="b">b</lion-option>
278
+ </lion-listbox>
279
+ <button type="submit">submit</button>
280
+ </form>
281
+ </lion-form>
282
+ `);
283
+ const button = /** @type {HTMLButtonElement} */ (el.querySelector('button'));
284
+ button.click();
285
+ const listboxEl = el.formElements[0];
286
+ expect(document.activeElement).to.equal(listboxEl._inputNode);
287
+ });
269
288
  });
@@ -34,7 +34,6 @@ const FormControlMixinImplementation = superclass =>
34
34
  /** @type {any} */
35
35
  static get properties() {
36
36
  return {
37
- name: { type: String, reflect: true },
38
37
  readOnly: { type: Boolean, attribute: 'readonly', reflect: true },
39
38
  label: String, // FIXME: { attribute: false } breaks a bunch of tests, but shouldn't...
40
39
  labelSrOnly: { type: Boolean, attribute: 'label-sr-only', reflect: true },
@@ -156,14 +155,6 @@ const FormControlMixinImplementation = superclass =>
156
155
  constructor() {
157
156
  super();
158
157
 
159
- /**
160
- * The name the element will be registered with to the .formElements collection
161
- * of the parent. Also, it serves as the key of key/value pairs in
162
- * modelValue/serializedValue objects
163
- * @type {string}
164
- */
165
- this.name = '';
166
-
167
158
  /**
168
159
  * A Boolean attribute which, if present, indicates that the user should not be able to edit
169
160
  * the value of the input. The difference between disabled and readonly is that read-only
@@ -0,0 +1,75 @@
1
+ /* eslint-disable import/no-extraneous-dependencies */
2
+ export const localizeNamespaceLoader = /** @param {string} locale */ locale => {
3
+ switch (locale) {
4
+ case 'bg-BG':
5
+ return import('@lion/ui/form-core-translations/bg-BG.js');
6
+ case 'bg':
7
+ return import('@lion/ui/form-core-translations/bg.js');
8
+ case 'cs-CZ':
9
+ return import('@lion/ui/form-core-translations/cs-CZ.js');
10
+ case 'cs':
11
+ return import('@lion/ui/form-core-translations/cs.js');
12
+ case 'de-DE':
13
+ return import('@lion/ui/form-core-translations/de-DE.js');
14
+ case 'de':
15
+ return import('@lion/ui/form-core-translations/de.js');
16
+ case 'en-AU':
17
+ return import('@lion/ui/form-core-translations/en-AU.js');
18
+ case 'en-GB':
19
+ return import('@lion/ui/form-core-translations/en-GB.js');
20
+ case 'en-US':
21
+ return import('@lion/ui/form-core-translations/en-US.js');
22
+ case 'en-PH':
23
+ case 'en':
24
+ return import('@lion/ui/form-core-translations/en.js');
25
+ case 'es-ES':
26
+ return import('@lion/ui/form-core-translations/es-ES.js');
27
+ case 'es':
28
+ return import('@lion/ui/form-core-translations/es.js');
29
+ case 'fr-FR':
30
+ return import('@lion/ui/form-core-translations/fr-FR.js');
31
+ case 'fr-BE':
32
+ return import('@lion/ui/form-core-translations/fr-BE.js');
33
+ case 'fr':
34
+ return import('@lion/ui/form-core-translations/fr.js');
35
+ case 'hu-HU':
36
+ return import('@lion/ui/form-core-translations/hu-HU.js');
37
+ case 'hu':
38
+ return import('@lion/ui/form-core-translations/hu.js');
39
+ case 'it-IT':
40
+ return import('@lion/ui/form-core-translations/it-IT.js');
41
+ case 'it':
42
+ return import('@lion/ui/form-core-translations/it.js');
43
+ case 'nl-BE':
44
+ return import('@lion/ui/form-core-translations/nl-BE.js');
45
+ case 'nl-NL':
46
+ return import('@lion/ui/form-core-translations/nl-NL.js');
47
+ case 'nl':
48
+ return import('@lion/ui/form-core-translations/nl.js');
49
+ case 'pl-PL':
50
+ return import('@lion/ui/form-core-translations/pl-PL.js');
51
+ case 'pl':
52
+ return import('@lion/ui/form-core-translations/pl.js');
53
+ case 'ro-RO':
54
+ return import('@lion/ui/form-core-translations/ro-RO.js');
55
+ case 'ro':
56
+ return import('@lion/ui/form-core-translations/ro.js');
57
+ case 'ru-RU':
58
+ return import('@lion/ui/form-core-translations/ru-RU.js');
59
+ case 'ru':
60
+ return import('@lion/ui/form-core-translations/ru.js');
61
+ case 'sk-SK':
62
+ return import('@lion/ui/form-core-translations/sk-SK.js');
63
+ case 'sk':
64
+ return import('@lion/ui/form-core-translations/sk.js');
65
+ case 'uk-UA':
66
+ return import('@lion/ui/form-core-translations/uk-UA.js');
67
+ case 'uk':
68
+ return import('@lion/ui/form-core-translations/uk.js');
69
+ case 'zh-CN':
70
+ case 'zh':
71
+ return import('@lion/ui/form-core-translations/zh.js');
72
+ default:
73
+ return import('@lion/ui/form-core-translations/en.js');
74
+ }
75
+ };
@@ -22,6 +22,14 @@ const FormRegisteringMixinImplementation = superclass =>
22
22
  class extends superclass {
23
23
  constructor() {
24
24
  super();
25
+ /**
26
+ * The name the element will be registered with to the .formElements collection
27
+ * of the parent. Also, it serves as the key of key/value pairs in
28
+ * modelValue/serializedValue objects
29
+ * @type {string}
30
+ */
31
+ this.name = '';
32
+
25
33
  /**
26
34
  * The registrar this FormControl registers to, Usually a descendant of FormGroup or
27
35
  * ChoiceGroup
@@ -37,8 +45,28 @@ const FormRegisteringMixinImplementation = superclass =>
37
45
  this.allowCrossRootRegistration = false;
38
46
  }
39
47
 
48
+ /**
49
+ * Name attribute for the control.
50
+ * @type {string}
51
+ */
52
+ get name() {
53
+ return this.__name || '';
54
+ }
55
+
56
+ /**
57
+ * Converts values provided for the `name` attribute to string type.
58
+ * Mimics the native `input` behavior.
59
+ * @param {string} newName
60
+ */
61
+ set name(newName) {
62
+ const oldName = this.name;
63
+ this.__name = newName.toString();
64
+ this.requestUpdate('name', oldName);
65
+ }
66
+
40
67
  static get properties() {
41
68
  return {
69
+ name: { type: String, reflect: true },
42
70
  allowCrossRootRegistration: { type: Boolean, attribute: 'allow-cross-root-registration' },
43
71
  };
44
72
  }