@lion/ui 0.23.0 → 0.24.0

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 (787) hide show
  1. package/README.md +50 -20
  2. package/components/accordion/src/LionAccordion.js +31 -42
  3. package/components/accordion/test/lion-accordion.test.js +108 -134
  4. package/components/button/src/LionButton.js +9 -12
  5. package/components/button/src/LionButtonReset.js +0 -5
  6. package/components/button/src/LionButtonSubmit.js +7 -12
  7. package/components/button/test/demos.screenshots-test.js +50 -11
  8. package/components/button/test/lion-button.test.js +0 -1
  9. package/components/button/test-suites/LionButton.suite.js +135 -145
  10. package/components/button/test-suites/LionButtonReset.suite.js +54 -72
  11. package/components/button/test-suites/LionButtonSubmit.suite.js +49 -68
  12. package/components/calendar/src/LionCalendar.js +151 -104
  13. package/components/calendar/src/calendarStyle.js +0 -1
  14. package/components/calendar/src/utils/createMonth.js +3 -4
  15. package/components/calendar/src/utils/createMultipleMonth.js +15 -7
  16. package/components/calendar/src/utils/createWeek.js +0 -2
  17. package/components/calendar/src/utils/dataTemplate.js +8 -4
  18. package/components/calendar/src/utils/dayTemplate.js +0 -6
  19. package/components/calendar/src/utils/getDayMonthYear.js +6 -2
  20. package/components/calendar/test/demos.screenshots-test.js +40 -9
  21. package/components/calendar/test/lion-calendar.test.js +171 -282
  22. package/components/calendar/test/utils/createMonth.test.js +61 -22
  23. package/components/calendar/test/utils/createMultipleMonth.test.js +14 -7
  24. package/components/calendar/test/utils/createWeek.test.js +51 -17
  25. package/components/calendar/test/utils/dataTemplate.test.js +3 -4
  26. package/components/calendar/test/utils/dayTemplate.test.js +106 -34
  27. package/components/calendar/test/utils/getFirstDayNextMonth.test.js +0 -1
  28. package/components/calendar/test/utils/getLastDayPreviousMonth.test.js +0 -1
  29. package/components/calendar/test/utils/isSameDate.test.js +0 -1
  30. package/components/calendar/test/utils/snapshots/monthTemplate_en-GB_Sunday_2018-12.js +1 -2
  31. package/components/calendar/test-helpers/CalendarObject.js +31 -62
  32. package/components/calendar/test-helpers/DayObject.js +7 -15
  33. package/components/calendar/test-suites/LionCalendar.suite.js +7 -9
  34. package/components/checkbox-group/src/LionCheckboxIndeterminate.js +17 -30
  35. package/components/checkbox-group/test/lion-checkbox-group-integrations.test.js +0 -1
  36. package/components/checkbox-group/test/lion-checkbox-group.test.js +21 -16
  37. package/components/checkbox-group/test/lion-checkbox-indeterminate-integrations.test.js +3 -3
  38. package/components/checkbox-group/test/lion-checkbox-integrations.test.js +3 -2
  39. package/components/checkbox-group/test/lion-checkbox.test.js +30 -16
  40. package/components/checkbox-group/test-suites/CheckboxIndeterminate.suite.js +147 -191
  41. package/components/collapsible/src/LionCollapsible.js +10 -15
  42. package/components/collapsible/test/lion-collapsible.test.js +4 -18
  43. package/components/combobox/src/LionCombobox.js +35 -53
  44. package/components/combobox/src/utils/makeMatchingTextBold.js +2 -5
  45. package/components/combobox/src/validators.js +0 -1
  46. package/components/combobox/test/lion-combobox-integrations.test.js +6 -6
  47. package/components/combobox/test/lion-combobox.test.js +576 -869
  48. package/components/combobox/test/validators.test.js +6 -13
  49. package/components/combobox/test-helpers/combobox-helpers.js +24 -11
  50. package/components/core/src/DisabledMixin.js +61 -66
  51. package/components/core/src/DisabledWithTabIndexMixin.js +76 -83
  52. package/components/core/src/EventTargetShim.js +1 -4
  53. package/components/core/src/ScopedElementsMixin.js +4 -15
  54. package/components/core/src/ScopedStylesController.js +1 -5
  55. package/components/core/src/SlotMixin.js +236 -239
  56. package/components/core/src/browserDetection.js +5 -12
  57. package/components/core/test/DisabledMixin.test.js +24 -39
  58. package/components/core/test/DisabledWithTabIndexMixin.test.js +21 -34
  59. package/components/core/test/EventTargetShim.test.js +0 -8
  60. package/components/core/test/ScopedElementsMixin.test.js +22 -38
  61. package/components/core/test/ScopedStylesController.test.js +11 -20
  62. package/components/core/test/SlotMixin.test.js +102 -154
  63. package/components/core/test-helpers/getCachedFixture.js +5 -11
  64. package/components/core/types/SlotMixinTypes.ts +8 -3
  65. package/components/dialog/src/LionDialog.js +4 -3
  66. package/components/dialog/test/lion-dialog.integration.test.js +10 -20
  67. package/components/dialog/test/lion-dialog.test.js +48 -62
  68. package/components/dialog/test-helpers/test-router.js +4 -6
  69. package/components/drawer/src/LionDrawer.js +18 -34
  70. package/components/drawer/src/drawerStyle.js +0 -1
  71. package/components/drawer/test/lion-drawer.test.js +1 -17
  72. package/components/fieldset/test/lion-fieldset.test.js +6 -4
  73. package/components/form/src/LionForm.js +18 -13
  74. package/components/form/test/lion-form.test.js +22 -52
  75. package/components/form-core/src/FocusMixin.js +172 -174
  76. package/components/form-core/src/FormControlMixin.js +811 -813
  77. package/components/form-core/src/FormatMixin.js +537 -537
  78. package/components/form-core/src/InteractionStateMixin.js +196 -183
  79. package/components/form-core/src/LionField.js +9 -5
  80. package/components/form-core/src/NativeTextFieldMixin.js +114 -116
  81. package/components/form-core/src/choice-group/ChoiceGroupMixin.js +322 -364
  82. package/components/form-core/src/choice-group/ChoiceInputMixin.js +306 -296
  83. package/components/form-core/src/choice-group/CustomChoiceGroupMixin.js +114 -139
  84. package/components/form-core/src/form-group/FormElementsHaveNoError.js +0 -2
  85. package/components/form-core/src/form-group/FormGroupMixin.js +551 -557
  86. package/components/form-core/src/registration/FormRegisteringMixin.js +72 -71
  87. package/components/form-core/src/registration/FormRegistrarMixin.js +201 -217
  88. package/components/form-core/src/registration/FormRegistrarPortalMixin.js +31 -37
  89. package/components/form-core/src/utils/SyncUpdatableMixin.js +106 -117
  90. package/components/form-core/src/utils/getAriaElementsInRightDomOrder.js +1 -2
  91. package/components/form-core/src/validate/LionValidationFeedback.js +12 -8
  92. package/components/form-core/src/validate/Unparseable.js +4 -2
  93. package/components/form-core/src/validate/ValidateMixin.js +829 -883
  94. package/components/form-core/src/validate/Validator.js +3 -6
  95. package/components/form-core/src/validate/resultValidators/DefaultSuccess.js +1 -2
  96. package/components/form-core/src/validate/validators/DateValidators.js +0 -5
  97. package/components/form-core/src/validate/validators/NumberValidators.js +1 -5
  98. package/components/form-core/src/validate/validators/Required.js +1 -1
  99. package/components/form-core/src/validate/validators/StringValidators.js +1 -8
  100. package/components/form-core/test/FocusMixin.test.js +96 -82
  101. package/components/form-core/test/FormControlMixin.test.js +120 -176
  102. package/components/form-core/test/FormRegistrationMixins.test.js +0 -2
  103. package/components/form-core/test/FormatMixin.test.js +0 -1
  104. package/components/form-core/test/InteractionStateMixin.test.js +0 -1
  105. package/components/form-core/test/NativeTextFieldMixin.test.js +0 -1
  106. package/components/form-core/test/choice-group/ChoiceGroupMixin.test.js +0 -1
  107. package/components/form-core/test/choice-group/ChoiceInputMixin.test.js +0 -1
  108. package/components/form-core/test/choice-group/CustomChoiceGroupMixin.integrations.test.js +6 -8
  109. package/components/form-core/test/choice-group/CustomChoiceGroupMixin.test.js +0 -3
  110. package/components/form-core/test/form-group/FormGroupMixin.test.js +0 -1
  111. package/components/form-core/test/lion-field.test.js +88 -98
  112. package/components/form-core/test/utils/SyncUpdatableMixin.test.js +51 -65
  113. package/components/form-core/test/utils/getAriaElementsInRightDomOrder.test.js +3 -3
  114. package/components/form-core/test/validate/DateValidators.test.js +5 -27
  115. package/components/form-core/test/validate/NumberValidators.test.js +4 -16
  116. package/components/form-core/test/validate/Required.test.js +8 -21
  117. package/components/form-core/test/validate/ResultValidator.test.js +1 -2
  118. package/components/form-core/test/validate/StringValidators.test.js +4 -35
  119. package/components/form-core/test/validate/ValidateMixin.test.js +0 -1
  120. package/components/form-core/test/validate/ValidateMixinFeedbackPart.test.js +0 -1
  121. package/components/form-core/test/validate/Validator.test.js +39 -34
  122. package/components/form-core/test/validate/lion-validation-feedback.test.js +81 -43
  123. package/components/form-core/test-helpers/ExampleValidators.js +0 -5
  124. package/components/form-core/test-helpers/getFormControlMembers.js +2 -2
  125. package/components/form-core/test-helpers/mimicUserInput.js +5 -1
  126. package/components/form-core/test-suites/FormRegistrationMixins.suite.js +65 -122
  127. package/components/form-core/test-suites/FormatMixin.suite.js +202 -227
  128. package/components/form-core/test-suites/InteractionStateMixin.suite.js +47 -60
  129. package/components/form-core/test-suites/NativeTextFieldMixin.suite.js +8 -11
  130. package/components/form-core/test-suites/ValidateMixin.suite.js +280 -359
  131. package/components/form-core/test-suites/ValidateMixinFeedbackPart.suite.js +112 -163
  132. package/components/form-core/test-suites/choice-group/ChoiceGroupMixin.suite.js +185 -218
  133. package/components/form-core/test-suites/choice-group/ChoiceInputMixin.suite.js +116 -109
  134. package/components/form-core/test-suites/choice-group/CustomChoiceGroupMixin.suite.js +36 -70
  135. package/components/form-core/test-suites/form-group/FormGroupMixin-input.suite.js +57 -65
  136. package/components/form-core/test-suites/form-group/FormGroupMixin.suite.js +664 -523
  137. package/components/form-core/translations/bg-BG.js +0 -1
  138. package/components/form-core/translations/cs-CZ.js +0 -1
  139. package/components/form-core/translations/de-DE.js +0 -1
  140. package/components/form-core/translations/en-AU.js +0 -1
  141. package/components/form-core/translations/en-GB.js +0 -1
  142. package/components/form-core/translations/en-US.js +0 -1
  143. package/components/form-core/translations/es-ES.js +0 -1
  144. package/components/form-core/translations/fr-BE.js +0 -1
  145. package/components/form-core/translations/fr-FR.js +0 -1
  146. package/components/form-core/translations/hu-HU.js +0 -1
  147. package/components/form-core/translations/it-IT.js +0 -1
  148. package/components/form-core/translations/nl-BE.js +0 -1
  149. package/components/form-core/translations/nl-NL.js +0 -1
  150. package/components/form-core/translations/pl-PL.js +0 -1
  151. package/components/form-core/translations/ro-RO.js +0 -1
  152. package/components/form-core/translations/ru-RU.js +0 -1
  153. package/components/form-core/translations/sk-SK.js +0 -1
  154. package/components/form-core/translations/tr-TR.js +0 -1
  155. package/components/form-core/translations/uk-UA.js +0 -1
  156. package/components/form-integrations/test/dialog-integrations.test.js +1 -4
  157. package/components/form-integrations/test/form-group-methods.test.js +28 -31
  158. package/components/form-integrations/test/form-integrations.test.js +27 -28
  159. package/components/form-integrations/test/form-validation-integrations.test.js +21 -29
  160. package/components/form-integrations/test/helpers/umbrella-form.js +3 -5
  161. package/components/form-integrations/test/model-value-consistency.test.js +75 -77
  162. package/components/form-integrations/test/model-value-event.test.js +10 -20
  163. package/components/helpers/src/SbActionLogger.js +13 -17
  164. package/components/helpers/src/SbLocaleSwitcher.js +5 -5
  165. package/components/helpers/src/sortEachDepth.js +0 -2
  166. package/components/helpers/test/renderLitAsNode.test.js +0 -4
  167. package/components/helpers/test/sb-action-logger.test.js +24 -55
  168. package/components/icon/src/IconManager.js +0 -2
  169. package/components/icon/src/LionIcon.js +2 -7
  170. package/components/icon/src/icons.js +0 -2
  171. package/components/icon/test/IconManager.test.js +0 -15
  172. package/components/icon/test/hammer.svg.js +3 -4
  173. package/components/icon/test/heart.svg.js +3 -4
  174. package/components/icon/test/lion-icon.test.js +14 -43
  175. package/components/input/src/LionInput.js +2 -8
  176. package/components/input/test/input-integrations.test.js +0 -5
  177. package/components/input/test/lion-input-integrations.test.js +0 -4
  178. package/components/input/test/lion-input.test.js +28 -58
  179. package/components/input/test-helpers/getInputMembers.js +2 -2
  180. package/components/input-amount/src/LionInputAmount.js +20 -20
  181. package/components/input-amount/src/formatters.js +0 -3
  182. package/components/input-amount/src/parsers.js +0 -3
  183. package/components/input-amount/test/formatters.test.js +24 -16
  184. package/components/input-amount/test/lion-input-amount-integrations.test.js +0 -4
  185. package/components/input-amount/test/lion-input-amount.test.js +123 -147
  186. package/components/input-amount/test/parsers.test.js +33 -17
  187. package/components/input-amount/test/preprocessors.test.js +0 -3
  188. package/components/input-amount-dropdown/src/LionInputAmountDropdown.js +49 -59
  189. package/components/input-amount-dropdown/src/currencyUtil.js +8 -7
  190. package/components/input-amount-dropdown/src/parsers.js +0 -1
  191. package/components/input-amount-dropdown/src/validators.js +0 -1
  192. package/components/input-amount-dropdown/test/LionInputAmountDropdown.test.js +34 -36
  193. package/components/input-amount-dropdown/test/lion-input-amount-dropdown-integrations.test.js +18 -13
  194. package/components/input-amount-dropdown/test-helpers/mimicUserChangingDropdown.js +5 -1
  195. package/components/input-amount-dropdown/test-suites/LionInputAmountDropdown.suite.js +132 -107
  196. package/components/input-date/src/LionInputDate.js +4 -3
  197. package/components/input-date/test/lion-input-date-integrations.test.js +0 -3
  198. package/components/input-date/test/lion-input-date.test.js +19 -32
  199. package/components/input-datepicker/src/LionInputDatepicker.js +17 -29
  200. package/components/input-datepicker/src/localizeNamespaceLoader.js +1 -2
  201. package/components/input-datepicker/test/lion-input-datepicker-integrations.test.js +0 -3
  202. package/components/input-datepicker/test/lion-input-datepicker.test.js +88 -153
  203. package/components/input-datepicker/test-helpers/DatepickerInputObject.js +9 -12
  204. package/components/input-datepicker/test-suites/LionInputDatepicker.suite.js +6 -4
  205. package/components/input-datepicker/translations/bg-BG.js +0 -1
  206. package/components/input-datepicker/translations/cs-CZ.js +0 -1
  207. package/components/input-datepicker/translations/de-DE.js +0 -1
  208. package/components/input-datepicker/translations/en-AU.js +0 -1
  209. package/components/input-datepicker/translations/en-GB.js +0 -1
  210. package/components/input-datepicker/translations/en-US.js +0 -1
  211. package/components/input-datepicker/translations/es-ES.js +0 -1
  212. package/components/input-datepicker/translations/fr-BE.js +0 -1
  213. package/components/input-datepicker/translations/fr-FR.js +0 -1
  214. package/components/input-datepicker/translations/hu-HU.js +0 -1
  215. package/components/input-datepicker/translations/it-IT.js +0 -1
  216. package/components/input-datepicker/translations/nl-BE.js +0 -1
  217. package/components/input-datepicker/translations/nl-NL.js +0 -1
  218. package/components/input-datepicker/translations/pl-PL.js +0 -1
  219. package/components/input-datepicker/translations/ro-RO.js +0 -1
  220. package/components/input-datepicker/translations/ru-RU.js +0 -1
  221. package/components/input-datepicker/translations/sk-SK.js +0 -1
  222. package/components/input-datepicker/translations/tr-TR.js +0 -1
  223. package/components/input-datepicker/translations/uk-UA.js +0 -1
  224. package/components/input-email/test/lion-input-email-integrations.test.js +0 -2
  225. package/components/input-email/test/lion-input-email.test.js +1 -7
  226. package/components/input-file/src/FileHandle.js +0 -3
  227. package/components/input-file/src/LionInputFile.js +85 -83
  228. package/components/input-file/src/LionSelectedFileList.js +12 -12
  229. package/components/input-file/src/validators.js +10 -9
  230. package/components/input-file/test/FileValidators.test.js +170 -80
  231. package/components/input-file/test/lion-input-file.test.js +160 -244
  232. package/components/input-file/test/lion-selected-file-list.test.js +13 -22
  233. package/components/input-file/translations/bg-BG.js +0 -1
  234. package/components/input-file/translations/cs-CZ.js +0 -1
  235. package/components/input-file/translations/de-DE.js +0 -1
  236. package/components/input-file/translations/en-AU.js +0 -1
  237. package/components/input-file/translations/en-GB.js +0 -1
  238. package/components/input-file/translations/en-PH.js +0 -1
  239. package/components/input-file/translations/en-US.js +0 -1
  240. package/components/input-file/translations/en.js +2 -1
  241. package/components/input-file/translations/es-ES.js +0 -1
  242. package/components/input-file/translations/fr-BE.js +0 -1
  243. package/components/input-file/translations/fr-FR.js +0 -1
  244. package/components/input-file/translations/hu-HU.js +0 -1
  245. package/components/input-file/translations/id-ID.js +0 -1
  246. package/components/input-file/translations/id.js +2 -1
  247. package/components/input-file/translations/it-IT.js +0 -1
  248. package/components/input-file/translations/nl-BE.js +0 -1
  249. package/components/input-file/translations/nl-NL.js +0 -1
  250. package/components/input-file/translations/pl-PL.js +0 -1
  251. package/components/input-file/translations/ro-RO.js +0 -1
  252. package/components/input-file/translations/ru-RU.js +0 -1
  253. package/components/input-file/translations/sk-SK.js +0 -1
  254. package/components/input-file/translations/uk-UA.js +0 -1
  255. package/components/input-file/translations/zh-CN.js +0 -1
  256. package/components/input-iban/src/validators.js +6 -11
  257. package/components/input-iban/test/formatters.test.js +0 -3
  258. package/components/input-iban/test/lion-input-iban-integrations.test.js +0 -2
  259. package/components/input-iban/test/lion-input-iban.test.js +1 -9
  260. package/components/input-iban/test/parsers.test.js +0 -2
  261. package/components/input-iban/test/validators.test.js +0 -12
  262. package/components/input-iban/translations/bg-BG.js +0 -1
  263. package/components/input-iban/translations/cs-CZ.js +0 -1
  264. package/components/input-iban/translations/de-DE.js +0 -1
  265. package/components/input-iban/translations/en-AU.js +0 -1
  266. package/components/input-iban/translations/en-GB.js +0 -1
  267. package/components/input-iban/translations/en-US.js +0 -1
  268. package/components/input-iban/translations/es-ES.js +0 -1
  269. package/components/input-iban/translations/fr-BE.js +0 -1
  270. package/components/input-iban/translations/fr-FR.js +0 -1
  271. package/components/input-iban/translations/hu-HU.js +0 -1
  272. package/components/input-iban/translations/it-IT.js +0 -1
  273. package/components/input-iban/translations/nl-BE.js +0 -1
  274. package/components/input-iban/translations/nl-NL.js +0 -1
  275. package/components/input-iban/translations/pl-PL.js +0 -1
  276. package/components/input-iban/translations/ro-RO.js +0 -1
  277. package/components/input-iban/translations/ru-RU.js +0 -1
  278. package/components/input-iban/translations/sk-SK.js +0 -1
  279. package/components/input-iban/translations/uk-UA.js +0 -1
  280. package/components/input-range/src/LionInputRange.js +18 -19
  281. package/components/input-range/test/lion-input-range.test.js +23 -48
  282. package/components/input-range/translations/bg-BG.js +0 -1
  283. package/components/input-range/translations/cs-CZ.js +0 -1
  284. package/components/input-range/translations/de-DE.js +0 -1
  285. package/components/input-range/translations/en-AU.js +0 -1
  286. package/components/input-range/translations/en-GB.js +0 -1
  287. package/components/input-range/translations/en-PH.js +0 -1
  288. package/components/input-range/translations/en-US.js +0 -1
  289. package/components/input-range/translations/es-ES.js +0 -1
  290. package/components/input-range/translations/fr-BE.js +0 -1
  291. package/components/input-range/translations/fr-FR.js +0 -1
  292. package/components/input-range/translations/hu-HU.js +0 -1
  293. package/components/input-range/translations/it-IT.js +0 -1
  294. package/components/input-range/translations/nl-BE.js +0 -1
  295. package/components/input-range/translations/nl-NL.js +0 -1
  296. package/components/input-range/translations/pl-PL.js +0 -1
  297. package/components/input-range/translations/ro-RO.js +0 -1
  298. package/components/input-range/translations/ru-RU.js +0 -1
  299. package/components/input-range/translations/sk-SK.js +0 -1
  300. package/components/input-range/translations/uk-UA.js +0 -1
  301. package/components/input-range/translations/zh-CN.js +0 -1
  302. package/components/input-stepper/src/LionInputStepper.js +19 -38
  303. package/components/input-stepper/test/lion-input-stepper-integrations.test.js +0 -1
  304. package/components/input-stepper/test/lion-input-stepper.test.js +0 -1
  305. package/components/input-stepper/test-suites/lion-input-stepper.integration.suite.js +0 -2
  306. package/components/input-stepper/test-suites/lion-input-stepper.suite.js +56 -105
  307. package/components/input-stepper/translations/bg-BG.js +0 -1
  308. package/components/input-stepper/translations/cs-CZ.js +0 -1
  309. package/components/input-stepper/translations/de-DE.js +0 -1
  310. package/components/input-stepper/translations/en-AU.js +0 -1
  311. package/components/input-stepper/translations/en-GB.js +0 -1
  312. package/components/input-stepper/translations/en-US.js +0 -1
  313. package/components/input-stepper/translations/es-ES.js +0 -1
  314. package/components/input-stepper/translations/fr-BE.js +0 -1
  315. package/components/input-stepper/translations/fr-FR.js +0 -1
  316. package/components/input-stepper/translations/hu-HU.js +0 -1
  317. package/components/input-stepper/translations/it-IT.js +0 -1
  318. package/components/input-stepper/translations/nl-BE.js +0 -1
  319. package/components/input-stepper/translations/nl-NL.js +0 -1
  320. package/components/input-stepper/translations/pl-PL.js +0 -1
  321. package/components/input-stepper/translations/ro-RO.js +0 -1
  322. package/components/input-stepper/translations/ru-RU.js +0 -1
  323. package/components/input-stepper/translations/sk-SK.js +0 -1
  324. package/components/input-stepper/translations/uk-UA.js +0 -1
  325. package/components/input-tel/src/LionInputTel.js +53 -37
  326. package/components/input-tel/src/PhoneUtilManager.js +6 -4
  327. package/components/input-tel/src/formatters.js +12 -10
  328. package/components/input-tel/src/parsers.js +3 -3
  329. package/components/input-tel/src/preprocessors.js +15 -7
  330. package/components/input-tel/src/validators.js +4 -6
  331. package/components/input-tel/test/LionInputTel.test.js +4 -2
  332. package/components/input-tel/test/formatters.test.js +22 -10
  333. package/components/input-tel/test/parsers.test.js +40 -11
  334. package/components/input-tel/test/preprocessors.test.js +24 -13
  335. package/components/input-tel/test/validators.test.js +7 -14
  336. package/components/input-tel/test-helpers/mockPhoneUtilManager.js +7 -6
  337. package/components/input-tel/test-suites/LionInputTel.suite.js +33 -73
  338. package/components/input-tel/translations/bg-BG.js +0 -1
  339. package/components/input-tel/translations/cs-CZ.js +0 -1
  340. package/components/input-tel/translations/de-DE.js +0 -1
  341. package/components/input-tel/translations/en-AU.js +0 -1
  342. package/components/input-tel/translations/en-GB.js +0 -1
  343. package/components/input-tel/translations/en-US.js +0 -1
  344. package/components/input-tel/translations/es-ES.js +0 -1
  345. package/components/input-tel/translations/fr-BE.js +0 -1
  346. package/components/input-tel/translations/fr-FR.js +0 -1
  347. package/components/input-tel/translations/hu-HU.js +0 -1
  348. package/components/input-tel/translations/it-IT.js +0 -1
  349. package/components/input-tel/translations/nl-BE.js +0 -1
  350. package/components/input-tel/translations/nl-NL.js +0 -1
  351. package/components/input-tel/translations/pl-PL.js +0 -1
  352. package/components/input-tel/translations/ro-RO.js +0 -1
  353. package/components/input-tel/translations/ru-RU.js +0 -1
  354. package/components/input-tel/translations/sk-SK.js +0 -1
  355. package/components/input-tel/translations/uk-UA.js +0 -1
  356. package/components/input-tel-dropdown/src/LionInputTelDropdown.js +10 -28
  357. package/components/input-tel-dropdown/src/regionCodeToLocale.js +3 -1
  358. package/components/input-tel-dropdown/test/LionInputTelDropdown.test.js +31 -38
  359. package/components/input-tel-dropdown/test/regionCodeToLocale.test.js +0 -1
  360. package/components/input-tel-dropdown/test-helpers/mimicUserChangingDropdown.js +5 -1
  361. package/components/input-tel-dropdown/test-suites/LionInputTelDropdown--parentheses.suite.js +16 -11
  362. package/components/input-tel-dropdown/test-suites/LionInputTelDropdown.suite.js +54 -79
  363. package/components/listbox/src/LionListbox.js +4 -1
  364. package/components/listbox/src/LionOption.js +8 -7
  365. package/components/listbox/src/LionOptions.js +0 -3
  366. package/components/listbox/src/ListboxMixin.js +786 -820
  367. package/components/listbox/test/lion-listbox.test.js +0 -1
  368. package/components/listbox/test/lion-option.test.js +53 -64
  369. package/components/listbox/test/lion-options.test.js +3 -4
  370. package/components/listbox/test-helpers/getListboxMembers.js +6 -3
  371. package/components/listbox/test-suites/ListboxMixin.suite.js +101 -261
  372. package/components/localize/src/LocalizeManager.js +40 -40
  373. package/components/localize/src/LocalizeMixin.js +130 -157
  374. package/components/localize/src/date/formatDate.js +1 -5
  375. package/components/localize/src/date/getDateFormatBasedOnLocale.js +5 -3
  376. package/components/localize/src/date/getMonthNames.js +3 -5
  377. package/components/localize/src/date/getWeekdayNames.js +1 -5
  378. package/components/localize/src/date/parseDate.js +5 -20
  379. package/components/localize/src/date/utils/normalizeIntlDate.js +0 -7
  380. package/components/localize/src/getLocalizeManager.js +0 -3
  381. package/components/localize/src/number/formatNumber.js +3 -7
  382. package/components/localize/src/number/formatNumberToParts.js +52 -18
  383. package/components/localize/src/number/getCurrencyName.js +5 -5
  384. package/components/localize/src/number/getFractionDigits.js +4 -4
  385. package/components/localize/src/number/getSeparatorsFromNumber.js +1 -3
  386. package/components/localize/src/number/parseNumber.js +0 -3
  387. package/components/localize/src/number/utils/normalize-format-number-to-parts/forceAddGroupSeparators.js +0 -1
  388. package/components/localize/src/number/utils/normalize-format-number-to-parts/forceSpaceBetweenCurrencyCodeAndNumber.js +4 -1
  389. package/components/localize/test/LocalizeManager.test.js +385 -278
  390. package/components/localize/test/LocalizeMixin.test.js +28 -112
  391. package/components/localize/test/date/formatDate.test.js +18 -48
  392. package/components/localize/test/date/getDateFormatBasedOnLocale.test.js +0 -3
  393. package/components/localize/test/date/getMonthNames.test.js +27 -12
  394. package/components/localize/test/date/getWeekdayNames.test.js +93 -49
  395. package/components/localize/test/date/normalizeDateTime.test.js +0 -2
  396. package/components/localize/test/date/parseDate.test.js +12 -16
  397. package/components/localize/test/getLocalizeManager.test.js +0 -3
  398. package/components/localize/test/isLocalizeESModule.test.js +32 -13
  399. package/components/localize/test/localize.test.js +0 -4
  400. package/components/localize/test/number/formatNumber.test.js +215 -106
  401. package/components/localize/test/number/formatNumberToParts.test.js +31 -38
  402. package/components/localize/test/number/getCurrencyName.test.js +20 -6
  403. package/components/localize/test/number/getDecimalSeparator.test.js +5 -4
  404. package/components/localize/test/number/getFractionDigits.test.js +0 -2
  405. package/components/localize/test/number/getGroupSeparator.test.js +0 -2
  406. package/components/localize/test/number/getSeparatorsFromNumber.test.js +5 -3
  407. package/components/localize/test/number/parseNumber.test.js +123 -56
  408. package/components/localize/test/side-effect-free-entrypoint.test.js +0 -6
  409. package/components/localize/test-helpers/fake-imports.js +11 -6
  410. package/components/localize/test-helpers/localizeTearDown.js +0 -1
  411. package/components/menu/src/InteractiveListMixin.js +637 -638
  412. package/components/menu/src/LionMenu.js +46 -59
  413. package/components/menu/src/MoreButtonMenuMixin.js +215 -238
  414. package/components/menu/src/MultiLevelListMixin.js +240 -246
  415. package/components/menu/src/utils/isInView.js +0 -1
  416. package/components/menu/src/utils/listItemInteractions.js +4 -4
  417. package/components/menu/test/InteractiveListMixin.test.js +0 -1
  418. package/components/menu/test/MoreButtonMenuMixin.test.js +3 -2
  419. package/components/menu/test/MultiLevelListMixin.test.js +0 -1
  420. package/components/menu/test/lion-menu-interactions.test.js +0 -1
  421. package/components/menu/test/lion-menu.test.js +6 -2
  422. package/components/menu/test-helpers/mimicKeyPress.js +12 -2
  423. package/components/menu/test-suites/InteractiveListMixin.suite.js +4 -43
  424. package/components/menu/test-suites/LionMenu.suite.js +1 -8
  425. package/components/menu/test-suites/LionMenuInteractions.suite.js +22 -44
  426. package/components/menu/test-suites/MoreButtonMenuMixin.suite.js +34 -41
  427. package/components/menu/test-suites/MultiLevelListMixin.suite.js +5 -23
  428. package/components/overlays/src/ArrowMixin.js +111 -127
  429. package/components/overlays/src/OverlayController.js +166 -151
  430. package/components/overlays/src/OverlayMixin.js +61 -63
  431. package/components/overlays/src/OverlaysManager.js +30 -32
  432. package/components/overlays/src/configurations/visibility-trigger-partials/withClickInteraction.js +0 -1
  433. package/components/overlays/src/configurations/visibility-trigger-partials/withHoverInteraction.js +11 -11
  434. package/components/overlays/src/configurations/withBottomSheetConfig.js +12 -13
  435. package/components/overlays/src/configurations/withDropdownConfig.js +4 -2
  436. package/components/overlays/src/configurations/withModalDialogConfig.js +12 -13
  437. package/components/overlays/src/configurations/withPopoverConfig.js +27 -25
  438. package/components/overlays/src/configurations/withTooltipConfig.js +15 -13
  439. package/components/overlays/src/overlayDocumentStyle.js +1 -1
  440. package/components/overlays/src/overlayShadowDomStyle.js +0 -1
  441. package/components/overlays/src/singleton.js +0 -2
  442. package/components/overlays/src/utils/adopt-styles.js +18 -18
  443. package/components/overlays/src/utils/deep-contains.js +7 -6
  444. package/components/overlays/src/utils/get-focusable-elements.js +7 -10
  445. package/components/overlays/src/utils/inert-siblings.js +2 -4
  446. package/components/overlays/src/utils/is-equal-config.js +2 -3
  447. package/components/overlays/src/utils/is-visible.js +0 -1
  448. package/components/overlays/src/utils/simulate-tab.js +1 -4
  449. package/components/overlays/src/utils/sort-by-tabindex.js +2 -4
  450. package/components/overlays/test/ArrowMixin.test.js +18 -30
  451. package/components/overlays/test/OverlayController.test.js +375 -555
  452. package/components/overlays/test/OverlayMixin.test.js +0 -2
  453. package/components/overlays/test/OverlaysManager.test.js +30 -35
  454. package/components/overlays/test/global-positioning.test.js +6 -10
  455. package/components/overlays/test/local-positioning.test.js +101 -103
  456. package/components/overlays/test/utils-tests/active-element.test.js +12 -27
  457. package/components/overlays/test/utils-tests/adopt-styles.test.js +25 -56
  458. package/components/overlays/test/utils-tests/deep-contains.test.js +73 -74
  459. package/components/overlays/test/utils-tests/get-focusable-elements.test.js +6 -23
  460. package/components/overlays/test/utils-tests/is-equal-config.test.js +32 -13
  461. package/components/overlays/test/utils-tests/visibility.test.js +44 -79
  462. package/components/overlays/test-helpers/createShadowHost.js +5 -3
  463. package/components/overlays/test-helpers/normalizeTransformStyle.js +2 -4
  464. package/components/overlays/test-suites/OverlayMixin.suite.js +152 -181
  465. package/components/overlays/test-suites/WithHoverInteraction.suite.js +96 -79
  466. package/components/overlays/translations/bg-BG.js +0 -1
  467. package/components/overlays/translations/cs-CZ.js +0 -1
  468. package/components/overlays/translations/de-DE.js +0 -1
  469. package/components/overlays/translations/en-AU.js +0 -1
  470. package/components/overlays/translations/en-GB.js +0 -1
  471. package/components/overlays/translations/en-US.js +0 -1
  472. package/components/overlays/translations/es-ES.js +0 -1
  473. package/components/overlays/translations/fr-BE.js +0 -1
  474. package/components/overlays/translations/fr-FR.js +0 -1
  475. package/components/overlays/translations/hu-HU.js +0 -1
  476. package/components/overlays/translations/it-IT.js +0 -1
  477. package/components/overlays/translations/nl-BE.js +0 -1
  478. package/components/overlays/translations/nl-NL.js +0 -1
  479. package/components/overlays/translations/pl-PL.js +0 -1
  480. package/components/overlays/translations/ro-RO.js +0 -1
  481. package/components/overlays/translations/ru-RU.js +0 -1
  482. package/components/overlays/translations/sk-SK.js +0 -1
  483. package/components/overlays/translations/tr-TR.js +0 -1
  484. package/components/overlays/translations/uk-UA.js +0 -1
  485. package/components/pagination/src/LionPagination.js +9 -12
  486. package/components/pagination/test/lion-pagination.test.js +18 -50
  487. package/components/progress-indicator/src/LionProgressIndicator.js +10 -12
  488. package/components/progress-indicator/test/lion-progress-indicator.test.js +1 -22
  489. package/components/radio-group/src/LionRadioGroup.js +1 -2
  490. package/components/radio-group/test/lion-radio-group-integrations.test.js +0 -1
  491. package/components/radio-group/test/lion-radio-group.test.js +27 -27
  492. package/components/radio-group/test/lion-radio-integrations.test.js +3 -2
  493. package/components/radio-group/test/lion-radio.test.js +30 -16
  494. package/components/select/src/LionSelect.js +12 -13
  495. package/components/select/test/lion-select.test.js +7 -12
  496. package/components/select-rich/src/LionSelectInvoker.js +18 -11
  497. package/components/select-rich/src/LionSelectRich.js +20 -43
  498. package/components/select-rich/test/demos.screenshots-test.js +40 -9
  499. package/components/select-rich/test/lion-select-invoker.test.js +26 -43
  500. package/components/select-rich/test/lion-select-listbox-suite-integration.test.js +3 -3
  501. package/components/select-rich/test/lion-select-rich-dialog-integration.test.js +4 -9
  502. package/components/select-rich/test/lion-select-rich-interaction.test.js +116 -116
  503. package/components/select-rich/test/lion-select-rich-upgrade.test.js +3 -7
  504. package/components/select-rich/test/lion-select-rich.test.js +153 -195
  505. package/components/select-rich/test-helpers/getSelectRichMembers.js +4 -1
  506. package/components/steps/src/LionStep.js +21 -12
  507. package/components/steps/src/LionSteps.js +25 -25
  508. package/components/steps/test/lion-step.test.js +18 -25
  509. package/components/steps/test/lion-steps.test.js +45 -78
  510. package/components/switch/src/LionSwitch.js +2 -7
  511. package/components/switch/src/LionSwitchButton.js +5 -6
  512. package/components/switch/test/lion-switch-button.test.js +16 -28
  513. package/components/switch/test/lion-switch.test.js +17 -31
  514. package/components/tabs/src/LionTabs.js +25 -28
  515. package/components/tabs/test/lion-tabs.test.js +156 -154
  516. package/components/textarea/src/LionTextarea.js +4 -23
  517. package/components/textarea/test/lion-textarea-integrations.test.js +0 -5
  518. package/components/textarea/test/lion-textarea.test.js +2 -28
  519. package/components/tooltip/src/LionTooltip.js +6 -6
  520. package/components/tooltip/test/lion-tooltip.test.js +75 -102
  521. package/components/validate-messages/src/getLocalizedMessage.js +8 -7
  522. package/components/validate-messages/src/loadDefaultFeedbackMessages.js +3 -1
  523. package/components/validate-messages/src/loadDefaultFeedbackMessagesNoSideEffects.js +9 -5
  524. package/components/validate-messages/src/per-entrypoint/loadComboboxMessagesNoSideEffects.js +5 -2
  525. package/components/validate-messages/src/per-entrypoint/loadFormCoreMessagesNoSideEffects.js +99 -35
  526. package/components/validate-messages/src/per-entrypoint/loadInputTelMessagesNoSideEffects.js +4 -3
  527. package/components/validate-messages/test/loadDefaultFeedbackMessages.test.js +5 -3
  528. package/components/validate-messages/test/loadDefaultFeedbackMessagesNoSideEffects.test.js +80 -45
  529. package/components/validate-messages/translations/bg-BG.js +0 -1
  530. package/components/validate-messages/translations/cs-CZ.js +0 -1
  531. package/components/validate-messages/translations/de-DE.js +0 -1
  532. package/components/validate-messages/translations/en-AU.js +0 -1
  533. package/components/validate-messages/translations/en-GB.js +0 -1
  534. package/components/validate-messages/translations/en-PH.js +0 -1
  535. package/components/validate-messages/translations/en-US.js +0 -1
  536. package/components/validate-messages/translations/es-ES.js +0 -1
  537. package/components/validate-messages/translations/fr-BE.js +0 -1
  538. package/components/validate-messages/translations/fr-FR.js +0 -1
  539. package/components/validate-messages/translations/hu-HU.js +0 -1
  540. package/components/validate-messages/translations/it-IT.js +0 -1
  541. package/components/validate-messages/translations/nl-BE.js +0 -1
  542. package/components/validate-messages/translations/nl-NL.js +0 -1
  543. package/components/validate-messages/translations/pl-PL.js +0 -1
  544. package/components/validate-messages/translations/ro-RO.js +0 -1
  545. package/components/validate-messages/translations/ru-RU.js +0 -1
  546. package/components/validate-messages/translations/sk-SK.js +0 -1
  547. package/components/validate-messages/translations/tr-TR.js +0 -1
  548. package/components/validate-messages/translations/uk-UA.js +0 -1
  549. package/custom-elements.json +191 -56
  550. package/dist-types/components/core/src/SlotMixin.d.ts +6 -1
  551. package/dist-types/components/core/src/SlotMixin.d.ts.map +1 -1
  552. package/dist-types/components/core/types/SlotMixinTypes.d.ts +5 -1
  553. package/dist-types/components/core/types/SlotMixinTypes.d.ts.map +1 -1
  554. package/dist-types/components/form-core/src/LionField.d.ts +3 -1
  555. package/dist-types/components/form-core/src/LionField.d.ts.map +1 -1
  556. package/dist-types/components/input-tel/src/LionInputTel.d.ts +6 -6
  557. package/dist-types/components/input-tel/src/LionInputTel.d.ts.map +1 -1
  558. package/dist-types/components/input-tel/src/PhoneUtilManager.d.ts +2 -2
  559. package/dist-types/components/input-tel/src/PhoneUtilManager.d.ts.map +1 -1
  560. package/dist-types/components/input-tel/src/formatters.d.ts +2 -2
  561. package/dist-types/components/input-tel/src/formatters.d.ts.map +1 -1
  562. package/dist-types/components/input-tel/src/preprocessors.d.ts +2 -2
  563. package/dist-types/components/input-tel/src/preprocessors.d.ts.map +1 -1
  564. package/dist-types/components/input-tel/test/validators.test.d.ts +1 -1
  565. package/dist-types/components/input-tel/test/validators.test.d.ts.map +1 -1
  566. package/dist-types/components/listbox/src/LionOption.d.ts +5 -2
  567. package/dist-types/components/listbox/src/LionOption.d.ts.map +1 -1
  568. package/dist-types/components/overlays/src/OverlaysManager.d.ts.map +1 -1
  569. package/dist-types/components/overlays/src/overlayDocumentStyle.d.ts.map +1 -1
  570. package/dist-types/components/select-rich/src/LionSelectInvoker.d.ts +3 -1
  571. package/dist-types/components/select-rich/src/LionSelectInvoker.d.ts.map +1 -1
  572. package/dist-types/components/select-rich/src/LionSelectRich.d.ts +1 -1
  573. package/dist-types/tsconfig.tsbuildinfo +1 -1
  574. package/docs/components/accordion/overview.md +2 -2
  575. package/docs/components/accordion/reference.md +2 -2
  576. package/docs/components/accordion/use-cases.md +2 -2
  577. package/docs/components/button/examples.md +2 -2
  578. package/docs/components/button/extensions.md +2 -2
  579. package/docs/components/button/overview.md +2 -2
  580. package/docs/components/button/use-cases.md +2 -2
  581. package/docs/components/calendar/overview.md +2 -2
  582. package/docs/components/calendar/use-cases.md +2 -2
  583. package/docs/components/checkbox-group/overview.md +4 -4
  584. package/docs/components/checkbox-group/use-cases.md +2 -2
  585. package/docs/components/collapsible/examples.md +2 -2
  586. package/docs/components/collapsible/overview.md +3 -3
  587. package/docs/components/collapsible/use-cases.md +2 -2
  588. package/docs/components/combobox/extensions.md +2 -2
  589. package/docs/components/combobox/overview.md +3 -3
  590. package/docs/components/combobox/use-cases.md +3 -3
  591. package/docs/components/dialog/overview.md +3 -3
  592. package/docs/components/dialog/use-cases.md +2 -2
  593. package/docs/components/drawer/overview.md +2 -2
  594. package/docs/components/drawer/use-cases.md +2 -2
  595. package/docs/components/fieldset/overview.md +7 -7
  596. package/docs/components/fieldset/use-cases.md +2 -2
  597. package/docs/components/form/overview.md +5 -5
  598. package/docs/components/form/use-cases.md +4 -4
  599. package/docs/components/icon/overview.md +2 -2
  600. package/docs/components/icon/use-cases.md +3 -3
  601. package/docs/components/input/overview.md +3 -3
  602. package/docs/components/input/use-cases.md +2 -2
  603. package/docs/components/input-amount/overview.md +5 -5
  604. package/docs/components/input-amount/use-cases.md +2 -2
  605. package/docs/components/input-amount-dropdown/use-cases.md +2 -2
  606. package/docs/components/input-date/overview.md +5 -5
  607. package/docs/components/input-date/use-cases.md +2 -2
  608. package/docs/components/input-datepicker/overview.md +7 -7
  609. package/docs/components/input-datepicker/use-cases.md +2 -2
  610. package/docs/components/input-email/overview.md +4 -4
  611. package/docs/components/input-email/use-cases.md +2 -2
  612. package/docs/components/input-file/overview.md +3 -3
  613. package/docs/components/input-file/use-cases.md +2 -2
  614. package/docs/components/input-iban/overview.md +4 -4
  615. package/docs/components/input-iban/use-cases.md +2 -2
  616. package/docs/components/input-range/overview.md +4 -4
  617. package/docs/components/input-range/use-cases.md +2 -2
  618. package/docs/components/input-stepper/overview.md +3 -3
  619. package/docs/components/input-stepper/use-cases.md +2 -2
  620. package/docs/components/input-tel/overview.md +3 -3
  621. package/docs/components/input-tel/use-cases.md +8 -8
  622. package/docs/components/input-tel-dropdown/extensions.md +2 -2
  623. package/docs/components/input-tel-dropdown/overview.md +3 -3
  624. package/docs/components/input-tel-dropdown/use-cases.md +2 -2
  625. package/docs/components/listbox/overview.md +2 -2
  626. package/docs/components/listbox/use-cases.md +3 -3
  627. package/docs/components/menu/extensions.md +2 -2
  628. package/docs/components/menu/migration.md +2 -2
  629. package/docs/components/menu/overview.md +2 -2
  630. package/docs/components/menu/use-cases.md +1 -1
  631. package/docs/components/pagination/overview.md +2 -2
  632. package/docs/components/pagination/use-cases.md +2 -2
  633. package/docs/components/progress-indicator/examples.md +2 -2
  634. package/docs/components/progress-indicator/overview.md +2 -2
  635. package/docs/components/radio-group/overview.md +5 -5
  636. package/docs/components/radio-group/use-cases.md +2 -2
  637. package/docs/components/select/overview.md +2 -2
  638. package/docs/components/select/use-cases.md +3 -3
  639. package/docs/components/select-rich/examples.md +2 -2
  640. package/docs/components/select-rich/overview.md +2 -2
  641. package/docs/components/select-rich/use-cases.md +4 -4
  642. package/docs/components/steps/overview.md +2 -2
  643. package/docs/components/steps/use-cases.md +2 -2
  644. package/docs/components/switch/overview.md +2 -2
  645. package/docs/components/switch/reference.md +2 -2
  646. package/docs/components/switch/use-cases.md +2 -2
  647. package/docs/components/tabs/examples.md +3 -3
  648. package/docs/components/tabs/overview.md +2 -2
  649. package/docs/components/tabs/use-cases.md +2 -2
  650. package/docs/components/textarea/overview.md +2 -2
  651. package/docs/components/textarea/use-cases.md +2 -2
  652. package/docs/components/tooltip/examples.md +2 -2
  653. package/docs/components/tooltip/overview.md +2 -2
  654. package/docs/components/tooltip/use-cases.md +2 -2
  655. package/docs/fundamentals/index.md +4 -4
  656. package/docs/fundamentals/node-tools/babel-plugin-extend-docs/index.md +2 -2
  657. package/docs/fundamentals/node-tools/babel-plugin-extend-docs/overview.md +2 -2
  658. package/docs/fundamentals/node-tools/providence-analytics/index.md +2 -2
  659. package/docs/fundamentals/node-tools/providence-analytics/overview.md +2 -2
  660. package/docs/fundamentals/node-tools/publish-docs/index.md +2 -2
  661. package/docs/fundamentals/node-tools/publish-docs/overview.md +5 -5
  662. package/docs/fundamentals/node-tools/remark-extend/index.md +2 -2
  663. package/docs/fundamentals/node-tools/remark-extend/overview.md +2 -2
  664. package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/index.md +2 -2
  665. package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +4 -4
  666. package/docs/fundamentals/rationales/TypeScript.md +62 -2
  667. package/docs/fundamentals/rationales/accessibility.md +5 -5
  668. package/docs/fundamentals/rationales/side-effects.md +2 -2
  669. package/docs/fundamentals/rationales/versioning.md +2 -2
  670. package/docs/fundamentals/systems/core/SlotMixin.md +3 -3
  671. package/docs/fundamentals/systems/core/index.md +2 -2
  672. package/docs/fundamentals/systems/core/overview.md +3 -3
  673. package/docs/fundamentals/systems/form/formatting-and-parsing.md +6 -6
  674. package/docs/fundamentals/systems/form/index.md +2 -2
  675. package/docs/fundamentals/systems/form/interaction-states.md +2 -2
  676. package/docs/fundamentals/systems/form/model-value.md +3 -3
  677. package/docs/fundamentals/systems/form/overview.md +30 -30
  678. package/docs/fundamentals/systems/form/styling.md +2 -2
  679. package/docs/fundamentals/systems/form/use-cases.md +2 -2
  680. package/docs/fundamentals/systems/form/validate.md +4 -4
  681. package/docs/fundamentals/systems/icon/index.md +2 -2
  682. package/docs/fundamentals/systems/icon/overview.md +2 -2
  683. package/docs/fundamentals/systems/localize/dates.md +2 -2
  684. package/docs/fundamentals/systems/localize/index.md +2 -2
  685. package/docs/fundamentals/systems/localize/numbers.md +2 -2
  686. package/docs/fundamentals/systems/localize/overview.md +6 -6
  687. package/docs/fundamentals/systems/localize/rationale.md +2 -2
  688. package/docs/fundamentals/systems/localize/text.md +2 -2
  689. package/docs/fundamentals/systems/localize/use-cases.md +2 -2
  690. package/docs/fundamentals/systems/overlays/_edge-cases.md +2 -2
  691. package/docs/fundamentals/systems/overlays/configuration.md +4 -4
  692. package/docs/fundamentals/systems/overlays/index.md +2 -2
  693. package/docs/fundamentals/systems/overlays/overview.md +7 -7
  694. package/docs/fundamentals/systems/overlays/rationale.md +2 -2
  695. package/docs/fundamentals/systems/overlays/use-cases.md +4 -4
  696. package/docs/fundamentals/tools/ajax/index.md +2 -2
  697. package/docs/fundamentals/tools/ajax/overview.md +2 -2
  698. package/docs/fundamentals/tools/ajax/use-cases.md +2 -2
  699. package/docs/fundamentals/tools/helpers/action-logger.md +2 -2
  700. package/docs/fundamentals/tools/helpers/index.md +2 -2
  701. package/docs/fundamentals/tools/helpers/overview.md +3 -3
  702. package/docs/fundamentals/tools/singleton-manager/example-complex/index.md +2 -2
  703. package/docs/fundamentals/tools/singleton-manager/example-fail/index.md +2 -2
  704. package/docs/fundamentals/tools/singleton-manager/example-success/index.md +2 -2
  705. package/docs/fundamentals/tools/singleton-manager/index.md +2 -2
  706. package/docs/fundamentals/tools/singleton-manager/overview.md +6 -6
  707. package/docs/guides/how-to/create-a-custom-field.md +7 -7
  708. package/docs/guides/how-to/create-a-form.md +6 -6
  709. package/docs/guides/how-to/extend-a-native-input.md +4 -4
  710. package/docs/guides/how-to/get-started.md +2 -2
  711. package/docs/guides/how-to/index.md +1 -1
  712. package/docs/guides/index.md +8 -8
  713. package/docs/guides/principles/definitions-and-terms.md +2 -2
  714. package/docs/guides/principles/index.md +5 -5
  715. package/docs/guides/principles/scoped-elements.md +2 -2
  716. package/docs/guides/principles/styling.md +3 -3
  717. package/docs/guides/principles/subclasser-apis.md +2 -2
  718. package/exports/define/lion-accordion.js +0 -1
  719. package/exports/define/lion-button-reset.js +0 -1
  720. package/exports/define/lion-button-submit.js +0 -1
  721. package/exports/define/lion-button.js +0 -1
  722. package/exports/define/lion-calendar.js +0 -1
  723. package/exports/define/lion-checkbox-group.js +0 -1
  724. package/exports/define/lion-checkbox-indeterminate.js +0 -1
  725. package/exports/define/lion-checkbox.js +0 -1
  726. package/exports/define/lion-collapsible.js +0 -1
  727. package/exports/define/lion-combobox.js +0 -1
  728. package/exports/define/lion-dialog.js +0 -1
  729. package/exports/define/lion-drawer.js +0 -1
  730. package/exports/define/lion-field.js +0 -1
  731. package/exports/define/lion-fieldset.js +0 -1
  732. package/exports/define/lion-form.js +0 -1
  733. package/exports/define/lion-icon.js +0 -1
  734. package/exports/define/lion-input-amount-dropdown.js +0 -1
  735. package/exports/define/lion-input-amount.js +0 -1
  736. package/exports/define/lion-input-date.js +0 -1
  737. package/exports/define/lion-input-datepicker.js +0 -1
  738. package/exports/define/lion-input-email.js +0 -1
  739. package/exports/define/lion-input-file.js +0 -1
  740. package/exports/define/lion-input-iban.js +0 -1
  741. package/exports/define/lion-input-range.js +0 -1
  742. package/exports/define/lion-input-stepper.js +0 -1
  743. package/exports/define/lion-input-tel-dropdown.js +0 -1
  744. package/exports/define/lion-input-tel.js +0 -1
  745. package/exports/define/lion-input.js +0 -1
  746. package/exports/define/lion-item.js +0 -1
  747. package/exports/define/lion-listbox.js +0 -1
  748. package/exports/define/lion-menu.js +0 -1
  749. package/exports/define/lion-menuitem.js +0 -1
  750. package/exports/define/lion-option.js +0 -1
  751. package/exports/define/lion-options.js +0 -1
  752. package/exports/define/lion-pagination.js +0 -1
  753. package/exports/define/lion-progress-indicator.js +0 -1
  754. package/exports/define/lion-radio-group.js +0 -1
  755. package/exports/define/lion-radio.js +0 -1
  756. package/exports/define/lion-select-invoker.js +0 -1
  757. package/exports/define/lion-select-rich.js +0 -1
  758. package/exports/define/lion-select.js +0 -1
  759. package/exports/define/lion-selected-file-list.js +0 -1
  760. package/exports/define/lion-step.js +0 -1
  761. package/exports/define/lion-steps.js +0 -1
  762. package/exports/define/lion-switch-button.js +0 -1
  763. package/exports/define/lion-switch.js +0 -1
  764. package/exports/define/lion-tabs.js +0 -1
  765. package/exports/define/lion-textarea.js +0 -1
  766. package/exports/define/lion-tooltip.js +0 -1
  767. package/exports/define/lion-validation-feedback.js +0 -1
  768. package/exports/define-helpers/sb-action-logger.js +0 -1
  769. package/exports/define-helpers/sb-locale-switcher.js +0 -1
  770. package/exports/form-core.js +0 -8
  771. package/exports/localize-no-side-effects.js +0 -1
  772. package/exports/localize.js +0 -2
  773. package/exports/overlays.js +0 -4
  774. package/generated/awesome-phonenumber/LICENSE +22 -0
  775. package/generated/awesome-phonenumber/LICENSE.closure-library +176 -0
  776. package/generated/awesome-phonenumber/LICENSE.libphonenumber +176 -0
  777. package/generated/awesome-phonenumber/checksums.json +6 -0
  778. package/generated/awesome-phonenumber/index-esm.mjs +817 -0
  779. package/generated/awesome-phonenumber/index.d.ts +227 -0
  780. package/generated/awesome-phonenumber/index.js +45 -0
  781. package/generated/awesome-phonenumber/lib/index.js +710 -0
  782. package/generated/awesome-phonenumber/package.json +9 -0
  783. package/generated/awesome-phonenumber/provenance.json +13 -0
  784. package/package.json +32 -10
  785. package/web-types.json +1 -1
  786. package/vendor/README.md +0 -61
  787. package/vendor/awesome-phonenumber-7.9.0-tlouisse.libphonenumber-9.0.41.tgz +0 -0
@@ -38,485 +38,493 @@ import { FormRegisteringMixin } from './registration/FormRegisteringMixin.js';
38
38
  * @type {FormControlMixin}
39
39
  */
40
40
  // prettier-ignore
41
- const FormControlMixinImplementation = /** @type {FormControlMixin} */ (superclass =>
42
- // eslint-disable-next-line no-shadow, no-unused-vars
43
- class FormControlMixin extends FormRegisteringMixin(DisabledMixin(SlotMixin(superclass))) {
44
- /** @type {any} */
45
- static get properties() {
46
- return {
47
- readOnly: { type: Boolean, attribute: 'readonly', reflect: true },
48
- label: String, // FIXME: { attribute: false } breaks a bunch of tests, but shouldn't...
49
- labelSrOnly: { type: Boolean, attribute: 'label-sr-only', reflect: true },
50
- helpText: { type: String, attribute: 'help-text' },
51
- modelValue: { attribute: false },
52
- _ariaLabelledNodes: { attribute: false },
53
- _ariaDescribedNodes: { attribute: false },
54
- _repropagationRole: { attribute: false },
55
- _isRepropagationEndpoint: { attribute: false },
56
- };
57
- }
58
-
59
- /**
60
- * The label text for the input node.
61
- * When no light dom defined via [slot=label], this value will be used.
62
- * @type {string}
63
- */
64
- get label() {
65
- return this.__label ?? (this._labelNode?.textContent || '');
66
- }
67
-
68
- /**
69
- * @param {string} newValue
41
+ const FormControlMixinImplementation = /** @type {FormControlMixin} */superclass =>
42
+ // eslint-disable-next-line no-shadow, no-unused-vars
43
+ class FormControlMixin extends FormRegisteringMixin(DisabledMixin(SlotMixin(superclass))) {
44
+ /** @type {any} */
45
+ static get properties() {
46
+ return {
47
+ readOnly: {
48
+ type: Boolean,
49
+ attribute: 'readonly',
50
+ reflect: true
51
+ },
52
+ label: String,
53
+ // FIXME: { attribute: false } breaks a bunch of tests, but shouldn't...
54
+ labelSrOnly: {
55
+ type: Boolean,
56
+ attribute: 'label-sr-only',
57
+ reflect: true
58
+ },
59
+ helpText: {
60
+ type: String,
61
+ attribute: 'help-text'
62
+ },
63
+ modelValue: {
64
+ attribute: false
65
+ },
66
+ _ariaLabelledNodes: {
67
+ attribute: false
68
+ },
69
+ _ariaDescribedNodes: {
70
+ attribute: false
71
+ },
72
+ _repropagationRole: {
73
+ attribute: false
74
+ },
75
+ _isRepropagationEndpoint: {
76
+ attribute: false
77
+ }
78
+ };
79
+ }
80
+
81
+ /**
82
+ * The label text for the input node.
83
+ * When no light dom defined via [slot=label], this value will be used.
84
+ * @type {string}
85
+ */
86
+ get label() {
87
+ return this.__label ?? (this._labelNode?.textContent || '');
88
+ }
89
+
90
+ /**
91
+ * @param {string} newValue
92
+ */
93
+ set label(newValue) {
94
+ const oldValue = this.label;
95
+ /** @type {string} */
96
+ this.__label = newValue;
97
+ this.requestUpdate('label', oldValue);
98
+ }
99
+
100
+ /**
101
+ * The helpt text for the input node.
102
+ * When no light dom defined via [slot=help-text], this value will be used
103
+ * @type {string}
104
+ */
105
+ get helpText() {
106
+ return this.__helpText ?? (this._helpTextNode?.textContent || '');
107
+ }
108
+
109
+ /**
110
+ * @param {string} newValue
111
+ */
112
+ set helpText(newValue) {
113
+ const oldValue = this.helpText;
114
+ /** @type {string} */
115
+ this.__helpText = newValue;
116
+ this.requestUpdate('helpText', oldValue);
117
+ }
118
+
119
+ /**
120
+ * Will be used in validation messages to refer to the current field
121
+ * @type {string}
122
+ */
123
+ get fieldName() {
124
+ return this.__fieldName || this.label || this.name || '';
125
+ }
126
+
127
+ /**
128
+ * @param {string} value
129
+ */
130
+ set fieldName(value) {
131
+ /** @type {string} */
132
+ this.__fieldName = value;
133
+ }
134
+
135
+ /**
136
+ * @configure SlotMixin
137
+ */
138
+ get slots() {
139
+ return {
140
+ ...super.slots,
141
+ label: () => {
142
+ const label = document.createElement('label');
143
+ label.textContent = this.label;
144
+ return label;
145
+ },
146
+ 'help-text': () => {
147
+ const helpText = document.createElement('div');
148
+ helpText.textContent = this.helpText;
149
+ return helpText;
150
+ }
151
+ };
152
+ }
153
+
154
+ /**
155
+ * The interactive (form) element. Can be a native element like input/textarea/select or
156
+ * an element with tabindex > -1
157
+ * @protected
158
+ */
159
+ get _inputNode() {
160
+ return /** @type {HTMLElementWithValue} */this.__getDirectSlotChild('input');
161
+ }
162
+
163
+ /**
164
+ * Element where label will be rendered to
165
+ * @protected
166
+ */
167
+ get _labelNode() {
168
+ return /** @type {HTMLElement} */this.__getDirectSlotChild('label');
169
+ }
170
+
171
+ /**
172
+ * Element where help text will be rendered to
173
+ * @protected
174
+ */
175
+ get _helpTextNode() {
176
+ return /** @type {HTMLElement} */this.__getDirectSlotChild('help-text');
177
+ }
178
+
179
+ /**
180
+ * Element where validation feedback will be rendered to
181
+ * @protected
182
+ */
183
+ get _feedbackNode() {
184
+ return /** @type {LionValidationFeedback} */this.__getDirectSlotChild('feedback');
185
+ }
186
+
187
+ /**
188
+ * TODO: check if this is a false positive or if we can improve
189
+ * @configure ReactiveElement
190
+ */
191
+ // @ts-ignore [ts7-2855] TS7 rejects field access via super (the parent declares this as a field). Dot form kept deliberately: bracket access is exempt from property mangling (terser keep_quoted), which could split this property into two names. Upstream fix: declare an accessor in the parent type
192
+ static enabledWarnings = super.enabledWarnings?.filter(w => w !== 'change-in-update') || [];
193
+
194
+ // N.B. add these label/helpText props for types + ce manifest output
195
+ // (explicity setting them to undefined does not have desired result)
196
+
197
+ /**
198
+ * The label text for the input node.
199
+ * When no value is defined, textContent of [slot=label] will be used
200
+ * @property {string} label
201
+ */
202
+
203
+ /**
204
+ * The helpt text for the input node.
205
+ * When no value is defined, textContent of [slot=help-text] will be used
206
+ * @property {string} helpText
207
+ */
208
+
209
+ constructor() {
210
+ super();
211
+
212
+ /**
213
+ * A Boolean attribute which, if present, indicates that the user should not be able to edit
214
+ * the value of the input. The difference between disabled and readonly is that read-only
215
+ * controls can still function, whereas disabled controls generally do not function as
216
+ * controls until they are enabled.
217
+ * (From: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly)
218
+ * @type {boolean}
219
+ */
220
+ this.readOnly = false;
221
+
222
+ /**
223
+ * The label will only be visible for srceen readers when true
224
+ * @type {boolean}
225
+ */
226
+ this.labelSrOnly = false;
227
+
228
+ /**
229
+ * The model value is the result of the parser function(when available).
230
+ * It should be considered as the internal value used for validation and reasoning/logic.
231
+ * The model value is 'ready for consumption' by the outside world (think of a Date
232
+ * object or a float). The modelValue can(and is recommended to) be used as both input
233
+ * value and output value of the `LionField`.
234
+ *
235
+ * Examples:
236
+ * - For a date input: a String '20/01/1999' will be converted to new Date('1999/01/20')
237
+ * - For a number input: a formatted String '1.234,56' will be converted to a Number:
238
+ * 1234.56
70
239
  */
71
- set label(newValue) {
72
- const oldValue = this.label;
73
- /** @type {string} */
74
- this.__label = newValue;
75
- this.requestUpdate('label', oldValue);
76
- }
77
-
240
+ // TODO: we can probably set this up properly once propert effects run from firstUpdated
241
+ // this.modelValue = undefined;
78
242
  /**
79
- * The helpt text for the input node.
80
- * When no light dom defined via [slot=help-text], this value will be used
243
+ * Unique id that can be used in all light dom
81
244
  * @type {string}
245
+ * @protected
82
246
  */
83
- get helpText() {
84
- return this.__helpText ?? (this._helpTextNode?.textContent || '');
85
- }
247
+ this._inputId = uuid(this.localName);
86
248
 
87
249
  /**
88
- * @param {string} newValue
250
+ * Contains all elements that should end up in aria-labelledby of `._inputNode`
251
+ * @type {HTMLElement[]}
89
252
  */
90
- set helpText(newValue) {
91
- const oldValue = this.helpText;
92
- /** @type {string} */
93
- this.__helpText = newValue;
94
- this.requestUpdate('helpText', oldValue);
95
- }
253
+ this._ariaLabelledNodes = [];
96
254
 
97
255
  /**
98
- * Will be used in validation messages to refer to the current field
99
- * @type {string}
256
+ * Contains all elements that should end up in aria-describedby of `._inputNode`
257
+ * @type {HTMLElement[]}
100
258
  */
101
- get fieldName() {
102
- return this.__fieldName || this.label || this.name || '';
103
- }
259
+ this._ariaDescribedNodes = [];
104
260
 
105
261
  /**
106
- * @param {string} value
262
+ * Based on the role, details of handling model-value-changed repropagation differ.
263
+ * @type {'child'|'choice-group'|'fieldset'}
107
264
  */
108
- set fieldName(value) {
109
- /** @type {string} */
110
- this.__fieldName = value;
111
- }
265
+ this._repropagationRole = 'child';
112
266
 
113
267
  /**
114
- * @configure SlotMixin
268
+ * By default, a field with _repropagationRole 'choice-group' will act as an
269
+ * 'endpoint'. This means it will be considered as an individual field: for
270
+ * a select, individual options will not be part of the formPath. They
271
+ * will.
272
+ * Similarly, components that (a11y wise) need to be fieldsets, but 'interaction wise'
273
+ * (from Application Developer perspective) need to be more like fields
274
+ * (think of an amount-input with a currency select box next to it), can set this
275
+ * to true to hide private internals in the formPath.
276
+ * @type {boolean}
115
277
  */
116
- get slots() {
117
- return {
118
- ...super.slots,
119
- label: () => {
120
- const label = document.createElement('label');
121
- label.textContent = this.label;
122
- return label;
123
- },
124
- 'help-text': () => {
125
- const helpText = document.createElement('div');
126
- helpText.textContent = this.helpText;
127
- return helpText;
128
- },
129
- };
278
+ this._isRepropagationEndpoint = false;
279
+ this.addEventListener('model-value-changed', /** @type {EventListenerOrEventListenerObject} */this.__repropagateChildrenValues);
280
+ /** @type {EventListener} */
281
+ this._onLabelClick = this._onLabelClick.bind(this);
282
+ }
283
+ connectedCallback() {
284
+ super.connectedCallback();
285
+ this._enhanceLightDomClasses();
286
+ this._enhanceLightDomA11y();
287
+ this._triggerInitialModelValueChangedEvent();
288
+ if (this._labelNode) {
289
+ this._labelNode.addEventListener('click', this._onLabelClick);
130
290
  }
131
-
132
- /**
133
- * The interactive (form) element. Can be a native element like input/textarea/select or
134
- * an element with tabindex > -1
135
- * @protected
136
- */
137
- get _inputNode() {
138
- return /** @type {HTMLElementWithValue} */ (this.__getDirectSlotChild('input'));
291
+ }
292
+ disconnectedCallback() {
293
+ super.disconnectedCallback();
294
+ if (this._labelNode) {
295
+ this._labelNode.removeEventListener('click', this._onLabelClick);
139
296
  }
297
+ }
140
298
 
141
- /**
142
- * Element where label will be rendered to
143
- * @protected
144
- */
145
- get _labelNode() {
146
- return /** @type {HTMLElement} */ (this.__getDirectSlotChild('label'));
299
+ /** @param {import('lit').PropertyValues } changedProperties */
300
+ updated(changedProperties) {
301
+ super.updated(changedProperties);
302
+ if (changedProperties.has('disabled')) {
303
+ this._inputNode?.setAttribute('aria-disabled', `${Boolean(this.disabled)}`);
147
304
  }
148
-
149
- /**
150
- * Element where help text will be rendered to
151
- * @protected
152
- */
153
- get _helpTextNode() {
154
- return /** @type {HTMLElement} */ (this.__getDirectSlotChild('help-text'));
305
+ if (changedProperties.has('_ariaLabelledNodes')) {
306
+ this.__reflectAriaAttr('aria-labelledby', this._ariaLabelledNodes, this.__reorderAriaLabelledNodes);
155
307
  }
156
-
157
- /**
158
- * Element where validation feedback will be rendered to
159
- * @protected
160
- */
161
- get _feedbackNode() {
162
- return /** @type {LionValidationFeedback} */ (this.__getDirectSlotChild('feedback'));
308
+ if (changedProperties.has('_ariaDescribedNodes')) {
309
+ this.__reflectAriaAttr('aria-describedby', this._ariaDescribedNodes, this.__reorderAriaDescribedNodes);
163
310
  }
164
-
165
- /**
166
- * TODO: check if this is a false positive or if we can improve
167
- * @configure ReactiveElement
168
- */
169
- // @ts-ignore [ts7-2855] TS7 rejects field access via super (the parent declares this as a field). Dot form kept deliberately: bracket access is exempt from property mangling (terser keep_quoted), which could split this property into two names. Upstream fix: declare an accessor in the parent type
170
- static enabledWarnings = super.enabledWarnings?.filter(w => w !== 'change-in-update') || [];
171
-
172
- // N.B. add these label/helpText props for types + ce manifest output
173
- // (explicity setting them to undefined does not have desired result)
174
-
175
- /**
176
- * The label text for the input node.
177
- * When no value is defined, textContent of [slot=label] will be used
178
- * @property {string} label
179
- */
180
-
181
- /**
182
- * The helpt text for the input node.
183
- * When no value is defined, textContent of [slot=help-text] will be used
184
- * @property {string} helpText
185
- */
186
-
187
- constructor() {
188
- super();
189
-
190
- /**
191
- * A Boolean attribute which, if present, indicates that the user should not be able to edit
192
- * the value of the input. The difference between disabled and readonly is that read-only
193
- * controls can still function, whereas disabled controls generally do not function as
194
- * controls until they are enabled.
195
- * (From: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly)
196
- * @type {boolean}
197
- */
198
- this.readOnly = false;
199
-
200
- /**
201
- * The label will only be visible for srceen readers when true
202
- * @type {boolean}
203
- */
204
- this.labelSrOnly = false;
205
-
206
- /**
207
- * The model value is the result of the parser function(when available).
208
- * It should be considered as the internal value used for validation and reasoning/logic.
209
- * The model value is 'ready for consumption' by the outside world (think of a Date
210
- * object or a float). The modelValue can(and is recommended to) be used as both input
211
- * value and output value of the `LionField`.
212
- *
213
- * Examples:
214
- * - For a date input: a String '20/01/1999' will be converted to new Date('1999/01/20')
215
- * - For a number input: a formatted String '1.234,56' will be converted to a Number:
216
- * 1234.56
217
- */
218
- // TODO: we can probably set this up properly once propert effects run from firstUpdated
219
- // this.modelValue = undefined;
220
- /**
221
- * Unique id that can be used in all light dom
222
- * @type {string}
223
- * @protected
224
- */
225
- this._inputId = uuid(this.localName);
226
-
227
- /**
228
- * Contains all elements that should end up in aria-labelledby of `._inputNode`
229
- * @type {HTMLElement[]}
230
- */
231
- this._ariaLabelledNodes = [];
232
-
233
- /**
234
- * Contains all elements that should end up in aria-describedby of `._inputNode`
235
- * @type {HTMLElement[]}
236
- */
237
- this._ariaDescribedNodes = [];
238
-
239
- /**
240
- * Based on the role, details of handling model-value-changed repropagation differ.
241
- * @type {'child'|'choice-group'|'fieldset'}
242
- */
243
- this._repropagationRole = 'child';
244
-
245
- /**
246
- * By default, a field with _repropagationRole 'choice-group' will act as an
247
- * 'endpoint'. This means it will be considered as an individual field: for
248
- * a select, individual options will not be part of the formPath. They
249
- * will.
250
- * Similarly, components that (a11y wise) need to be fieldsets, but 'interaction wise'
251
- * (from Application Developer perspective) need to be more like fields
252
- * (think of an amount-input with a currency select box next to it), can set this
253
- * to true to hide private internals in the formPath.
254
- * @type {boolean}
255
- */
256
- this._isRepropagationEndpoint = false;
257
-
258
- this.addEventListener(
259
- 'model-value-changed',
260
- /** @type {EventListenerOrEventListenerObject} */ (this.__repropagateChildrenValues),
261
- );
262
- /** @type {EventListener} */
263
- this._onLabelClick = this._onLabelClick.bind(this);
311
+ if (changedProperties.has('label') && this.__label !== undefined && this._labelNode) {
312
+ this._labelNode.textContent = this.label;
264
313
  }
265
-
266
- connectedCallback() {
267
- super.connectedCallback();
268
- this._enhanceLightDomClasses();
269
- this._enhanceLightDomA11y();
270
- this._triggerInitialModelValueChangedEvent();
271
-
272
- if (this._labelNode) {
273
- this._labelNode.addEventListener('click', this._onLabelClick);
274
- }
275
- }
276
-
277
- disconnectedCallback() {
278
- super.disconnectedCallback();
279
- if (this._labelNode) {
280
- this._labelNode.removeEventListener('click', this._onLabelClick);
281
- }
314
+ if (changedProperties.has('helpText') && this.__helpText !== undefined && this._helpTextNode) {
315
+ this._helpTextNode.textContent = this.helpText;
282
316
  }
283
-
284
- /** @param {import('lit').PropertyValues } changedProperties */
285
- updated(changedProperties) {
286
- super.updated(changedProperties);
287
-
288
- if (changedProperties.has('disabled')) {
289
- this._inputNode?.setAttribute('aria-disabled', `${Boolean(this.disabled)}`);
290
- }
291
-
292
- if (changedProperties.has('_ariaLabelledNodes')) {
293
- this.__reflectAriaAttr(
294
- 'aria-labelledby',
295
- this._ariaLabelledNodes,
296
- this.__reorderAriaLabelledNodes,
297
- );
298
- }
299
-
300
- if (changedProperties.has('_ariaDescribedNodes')) {
301
- this.__reflectAriaAttr(
302
- 'aria-describedby',
303
- this._ariaDescribedNodes,
304
- this.__reorderAriaDescribedNodes,
305
- );
306
- }
307
-
308
- if (changedProperties.has('label') && this.__label !== undefined && this._labelNode) {
309
- this._labelNode.textContent = this.label;
310
- }
311
-
312
- if (
313
- changedProperties.has('helpText') &&
314
- this.__helpText !== undefined &&
315
- this._helpTextNode
316
- ) {
317
- this._helpTextNode.textContent = this.helpText;
318
- }
319
-
320
- if (changedProperties.has('name')) {
321
- this.dispatchEvent(
322
- /** @privateEvent */
323
- new CustomEvent('form-element-name-changed', {
324
- detail: { oldName: changedProperties.get('name'), newName: this.name },
325
- bubbles: true,
326
- }),
327
- );
328
- }
329
- }
330
-
331
- /** @protected */
332
- _triggerInitialModelValueChangedEvent() {
333
- this._dispatchInitialModelValueChangedEvent();
334
- }
335
-
336
- /** @protected */
337
- _enhanceLightDomClasses() {
338
- if (this._inputNode) {
339
- this._inputNode.classList.add('form-control');
340
- }
317
+ if (changedProperties.has('name')) {
318
+ this.dispatchEvent(/** @privateEvent */
319
+ new CustomEvent('form-element-name-changed', {
320
+ detail: {
321
+ oldName: changedProperties.get('name'),
322
+ newName: this.name
323
+ },
324
+ bubbles: true
325
+ }));
326
+ }
327
+ }
328
+
329
+ /** @protected */
330
+ _triggerInitialModelValueChangedEvent() {
331
+ this._dispatchInitialModelValueChangedEvent();
332
+ }
333
+
334
+ /** @protected */
335
+ _enhanceLightDomClasses() {
336
+ if (this._inputNode) {
337
+ this._inputNode.classList.add('form-control');
338
+ }
339
+ }
340
+
341
+ /** @protected */
342
+ _enhanceLightDomA11y() {
343
+ const {
344
+ _inputNode,
345
+ _labelNode,
346
+ _helpTextNode,
347
+ _feedbackNode
348
+ } = this;
349
+ if (_inputNode) {
350
+ _inputNode.id = _inputNode.id || this._inputId;
351
+ }
352
+ if (_labelNode) {
353
+ _labelNode.setAttribute('for', this._inputId);
354
+ this.addToAriaLabelledBy(_labelNode, {
355
+ idPrefix: 'label'
356
+ });
341
357
  }
342
-
343
- /** @protected */
344
- _enhanceLightDomA11y() {
345
- const { _inputNode, _labelNode, _helpTextNode, _feedbackNode } = this;
346
-
347
- if (_inputNode) {
348
- _inputNode.id = _inputNode.id || this._inputId;
349
- }
350
- if (_labelNode) {
351
- _labelNode.setAttribute('for', this._inputId);
352
- this.addToAriaLabelledBy(_labelNode, { idPrefix: 'label' });
353
- }
354
- if (_helpTextNode) {
355
- this.addToAriaDescribedBy(_helpTextNode, { idPrefix: 'help-text' });
356
- }
357
- if (_feedbackNode) {
358
- // Generic focus/blur handling that works for both Fields/FormGroups
359
- this.addEventListener('focusin', () => {
360
- _feedbackNode.setAttribute('aria-live', 'polite');
361
- });
362
- this.addEventListener('focusout', () => {
363
- _feedbackNode.setAttribute('aria-live', 'assertive');
364
- });
365
-
366
- this.addToAriaDescribedBy(_feedbackNode, { idPrefix: 'feedback' });
367
- }
368
- this._enhanceLightDomA11yForAdditionalSlots();
358
+ if (_helpTextNode) {
359
+ this.addToAriaDescribedBy(_helpTextNode, {
360
+ idPrefix: 'help-text'
361
+ });
369
362
  }
370
-
371
- /**
372
- * Enhances additional slots(prefix, suffix, before, after) defined by developer.
373
- *
374
- * When boolean attribute data-label or data-description is found,
375
- * the slot element will be connected to the input via aria-labelledby or aria-describedby
376
- * @param {string[]} additionalSlots
377
- * @protected
378
- */
379
- _enhanceLightDomA11yForAdditionalSlots(
380
- additionalSlots = ['prefix', 'suffix', 'before', 'after'],
381
- ) {
382
- additionalSlots.forEach(additionalSlot => {
383
- const element = this.__getDirectSlotChild(additionalSlot);
384
- if (element) {
385
- if (element.hasAttribute('data-label')) {
386
- this.addToAriaLabelledBy(element, { idPrefix: additionalSlot });
387
- }
388
- if (element.hasAttribute('data-description')) {
389
- this.addToAriaDescribedBy(element, { idPrefix: additionalSlot });
390
- }
391
- }
363
+ if (_feedbackNode) {
364
+ // Generic focus/blur handling that works for both Fields/FormGroups
365
+ this.addEventListener('focusin', () => {
366
+ _feedbackNode.setAttribute('aria-live', 'polite');
367
+ });
368
+ this.addEventListener('focusout', () => {
369
+ _feedbackNode.setAttribute('aria-live', 'assertive');
370
+ });
371
+ this.addToAriaDescribedBy(_feedbackNode, {
372
+ idPrefix: 'feedback'
392
373
  });
393
374
  }
394
-
395
- /**
396
- * Will handle help text, validation feedback and character counter,
397
- * prefix/suffix/before/after (if they contain data-description flag attr).
398
- * Also, contents of id references that will be put in the <lion-field>._ariaDescribedby property
399
- * from an external context, will be read by a screen reader.
400
- * @param {string} attrName
401
- * @param {Element[]} nodes
402
- * @param {boolean|undefined} reorder
403
- */
404
- __reflectAriaAttr(attrName, nodes, reorder) {
405
- if (this._inputNode) {
406
- if (reorder) {
407
- const insideNodes = nodes.filter(n => this.contains(n));
408
- const outsideNodes = nodes.filter(n => !this.contains(n));
409
-
410
- const insideSlots = insideNodes.map(n => n.assignedSlot || n);
411
- const orderedInsideSlots = [...getAriaElementsInRightDomOrder(insideSlots)];
412
- /** @type {Element[]} */
413
- const orderedInsideNodes = [];
414
- orderedInsideSlots.forEach(assignedNode => {
415
- insideNodes.forEach(node => {
416
- // @ts-ignore
417
- if (assignedNode.name === node.slot) {
418
- orderedInsideNodes.push(node);
419
- }
420
- });
375
+ this._enhanceLightDomA11yForAdditionalSlots();
376
+ }
377
+
378
+ /**
379
+ * Enhances additional slots(prefix, suffix, before, after) defined by developer.
380
+ *
381
+ * When boolean attribute data-label or data-description is found,
382
+ * the slot element will be connected to the input via aria-labelledby or aria-describedby
383
+ * @param {string[]} additionalSlots
384
+ * @protected
385
+ */
386
+ _enhanceLightDomA11yForAdditionalSlots(additionalSlots = ['prefix', 'suffix', 'before', 'after']) {
387
+ additionalSlots.forEach(additionalSlot => {
388
+ const element = this.__getDirectSlotChild(additionalSlot);
389
+ if (element) {
390
+ if (element.hasAttribute('data-label')) {
391
+ this.addToAriaLabelledBy(element, {
392
+ idPrefix: additionalSlot
393
+ });
394
+ }
395
+ if (element.hasAttribute('data-description')) {
396
+ this.addToAriaDescribedBy(element, {
397
+ idPrefix: additionalSlot
421
398
  });
422
- // eslint-disable-next-line no-param-reassign
423
- nodes = [...orderedInsideNodes, ...outsideNodes];
424
399
  }
425
- const string = nodes.map(n => n.id).join(' ');
426
- this._inputNode.setAttribute(attrName, string);
427
400
  }
428
- }
429
-
430
- /**
431
- * Default Render Result:
432
- * <div class="form-field__group-one">
433
- * <div class="form-field__label">
434
- * <slot name="label"></slot>
435
- * </div>
436
- * <small class="form-field__help-text">
437
- * <slot name="help-text"></slot>
438
- * </small>
439
- * </div>
440
- * <div class="form-field__group-two">
441
- * <div class="input-group">
442
- * <div class="input-group__before">
443
- * <slot name="before"></slot>
444
- * </div>
445
- * <div class="input-group__container">
446
- * <div class="input-group__prefix">
447
- * <slot name="prefix"></slot>
448
- * </div>
449
- * <div class="input-group__input">
450
- * <slot name="input"></slot>
451
- * </div>
452
- * <div class="input-group__suffix">
453
- * <slot name="suffix"></slot>
454
- * </div>
455
- * </div>
456
- * <div class="input-group__after">
457
- * <slot name="after"></slot>
458
- * </div>
459
- * </div>
460
- * <div class="form-field__feedback">
461
- * <slot name="feedback"></slot>
462
- * </div>
463
- * </div>
464
- */
465
- render() {
466
- return html`
401
+ });
402
+ }
403
+
404
+ /**
405
+ * Will handle help text, validation feedback and character counter,
406
+ * prefix/suffix/before/after (if they contain data-description flag attr).
407
+ * Also, contents of id references that will be put in the <lion-field>._ariaDescribedby property
408
+ * from an external context, will be read by a screen reader.
409
+ * @param {string} attrName
410
+ * @param {Element[]} nodes
411
+ * @param {boolean|undefined} reorder
412
+ */
413
+ __reflectAriaAttr(attrName, nodes, reorder) {
414
+ if (this._inputNode) {
415
+ if (reorder) {
416
+ const insideNodes = nodes.filter(n => this.contains(n));
417
+ const outsideNodes = nodes.filter(n => !this.contains(n));
418
+ const insideSlots = insideNodes.map(n => n.assignedSlot || n);
419
+ const orderedInsideSlots = [...getAriaElementsInRightDomOrder(insideSlots)];
420
+ /** @type {Element[]} */
421
+ const orderedInsideNodes = [];
422
+ orderedInsideSlots.forEach(assignedNode => {
423
+ insideNodes.forEach(node => {
424
+ // @ts-ignore
425
+ if (assignedNode.name === node.slot) {
426
+ orderedInsideNodes.push(node);
427
+ }
428
+ });
429
+ });
430
+ // eslint-disable-next-line no-param-reassign
431
+ nodes = [...orderedInsideNodes, ...outsideNodes];
432
+ }
433
+ const string = nodes.map(n => n.id).join(' ');
434
+ this._inputNode.setAttribute(attrName, string);
435
+ }
436
+ }
437
+
438
+ /**
439
+ * Default Render Result:
440
+ * <div class="form-field__group-one">
441
+ * <div class="form-field__label">
442
+ * <slot name="label"></slot>
443
+ * </div>
444
+ * <small class="form-field__help-text">
445
+ * <slot name="help-text"></slot>
446
+ * </small>
447
+ * </div>
448
+ * <div class="form-field__group-two">
449
+ * <div class="input-group">
450
+ * <div class="input-group__before">
451
+ * <slot name="before"></slot>
452
+ * </div>
453
+ * <div class="input-group__container">
454
+ * <div class="input-group__prefix">
455
+ * <slot name="prefix"></slot>
456
+ * </div>
457
+ * <div class="input-group__input">
458
+ * <slot name="input"></slot>
459
+ * </div>
460
+ * <div class="input-group__suffix">
461
+ * <slot name="suffix"></slot>
462
+ * </div>
463
+ * </div>
464
+ * <div class="input-group__after">
465
+ * <slot name="after"></slot>
466
+ * </div>
467
+ * </div>
468
+ * <div class="form-field__feedback">
469
+ * <slot name="feedback"></slot>
470
+ * </div>
471
+ * </div>
472
+ */
473
+ render() {
474
+ return html`
467
475
  <div class="form-field__group-one">${this._groupOneTemplate()}</div>
468
476
  <div class="form-field__group-two">${this._groupTwoTemplate()}</div>
469
477
  `;
470
- }
471
-
472
- /**
473
- * @return {TemplateResult}
474
- * @protected
475
- */
476
- _groupOneTemplate() {
477
- return html` ${this._labelTemplate()} ${this._helpTextTemplate()} `;
478
- }
479
-
480
- /**
481
- * @return {TemplateResult}
482
- * @protected
483
- */
484
- _groupTwoTemplate() {
485
- return html` ${this._inputGroupTemplate()} ${this._feedbackTemplate()} `;
486
- }
487
-
488
- /**
489
- * @return {TemplateResult}
490
- * @protected
491
- */
492
- // eslint-disable-next-line class-methods-use-this
493
- _labelTemplate() {
494
- return html`
478
+ }
479
+
480
+ /**
481
+ * @return {TemplateResult}
482
+ * @protected
483
+ */
484
+ _groupOneTemplate() {
485
+ return html` ${this._labelTemplate()} ${this._helpTextTemplate()} `;
486
+ }
487
+
488
+ /**
489
+ * @return {TemplateResult}
490
+ * @protected
491
+ */
492
+ _groupTwoTemplate() {
493
+ return html` ${this._inputGroupTemplate()} ${this._feedbackTemplate()} `;
494
+ }
495
+
496
+ /**
497
+ * @return {TemplateResult}
498
+ * @protected
499
+ */
500
+ // eslint-disable-next-line class-methods-use-this
501
+ _labelTemplate() {
502
+ return html`
495
503
  <div class="form-field__label">
496
504
  <slot name="label"></slot>
497
505
  </div>
498
506
  `;
499
- }
500
-
501
- /**
502
- * @return {TemplateResult}
503
- * @protected
504
- */
505
- // eslint-disable-next-line class-methods-use-this
506
- _helpTextTemplate() {
507
- return html`
507
+ }
508
+
509
+ /**
510
+ * @return {TemplateResult}
511
+ * @protected
512
+ */
513
+ // eslint-disable-next-line class-methods-use-this
514
+ _helpTextTemplate() {
515
+ return html`
508
516
  <small class="form-field__help-text">
509
517
  <slot name="help-text"></slot>
510
518
  </small>
511
519
  `;
512
- }
513
-
514
- /**
515
- * @return {TemplateResult}
516
- * @protected
517
- */
518
- _inputGroupTemplate() {
519
- return html`
520
+ }
521
+
522
+ /**
523
+ * @return {TemplateResult}
524
+ * @protected
525
+ */
526
+ _inputGroupTemplate() {
527
+ return html`
520
528
  <div class="input-group">
521
529
  ${this._inputGroupBeforeTemplate()}
522
530
  <div class="input-group__container">
@@ -526,188 +534,182 @@ const FormControlMixinImplementation = /** @type {FormControlMixin} */ (supercla
526
534
  ${this._inputGroupAfterTemplate()}
527
535
  </div>
528
536
  `;
529
- }
530
-
531
- /**
532
- * @return {TemplateResult}
533
- * @protected
534
- */
535
- // eslint-disable-next-line class-methods-use-this
536
- _inputGroupBeforeTemplate() {
537
- return html`
537
+ }
538
+
539
+ /**
540
+ * @return {TemplateResult}
541
+ * @protected
542
+ */
543
+ // eslint-disable-next-line class-methods-use-this
544
+ _inputGroupBeforeTemplate() {
545
+ return html`
538
546
  <div class="input-group__before">
539
547
  <slot name="before"></slot>
540
548
  </div>
541
549
  `;
542
- }
543
-
544
- /**
545
- * @return {TemplateResult | typeof nothing}
546
- * @protected
547
- */
548
- _inputGroupPrefixTemplate() {
549
- return !Array.from(this.children).find(child => child.slot === 'prefix')
550
- ? nothing
551
- : html`
550
+ }
551
+
552
+ /**
553
+ * @return {TemplateResult | typeof nothing}
554
+ * @protected
555
+ */
556
+ _inputGroupPrefixTemplate() {
557
+ return !Array.from(this.children).find(child => child.slot === 'prefix') ? nothing : html`
552
558
  <div class="input-group__prefix">
553
559
  <slot name="prefix"></slot>
554
560
  </div>
555
561
  `;
556
- }
557
-
558
- /**
559
- * @return {TemplateResult}
560
- * @protected
561
- */
562
- // eslint-disable-next-line class-methods-use-this
563
- _inputGroupInputTemplate() {
564
- return html`
562
+ }
563
+
564
+ /**
565
+ * @return {TemplateResult}
566
+ * @protected
567
+ */
568
+ // eslint-disable-next-line class-methods-use-this
569
+ _inputGroupInputTemplate() {
570
+ return html`
565
571
  <div class="input-group__input">
566
572
  <slot name="input"></slot>
567
573
  </div>
568
574
  `;
569
- }
570
-
571
- /**
572
- * @return {TemplateResult | typeof nothing}
573
- * @protected
574
- */
575
- _inputGroupSuffixTemplate() {
576
- return !Array.from(this.children).find(child => child.slot === 'suffix')
577
- ? nothing
578
- : html`
575
+ }
576
+
577
+ /**
578
+ * @return {TemplateResult | typeof nothing}
579
+ * @protected
580
+ */
581
+ _inputGroupSuffixTemplate() {
582
+ return !Array.from(this.children).find(child => child.slot === 'suffix') ? nothing : html`
579
583
  <div class="input-group__suffix">
580
584
  <slot name="suffix"></slot>
581
585
  </div>
582
586
  `;
583
- }
584
-
585
- /**
586
- * @return {TemplateResult}
587
- * @protected
588
- */
589
- // eslint-disable-next-line class-methods-use-this
590
- _inputGroupAfterTemplate() {
591
- return html`
587
+ }
588
+
589
+ /**
590
+ * @return {TemplateResult}
591
+ * @protected
592
+ */
593
+ // eslint-disable-next-line class-methods-use-this
594
+ _inputGroupAfterTemplate() {
595
+ return html`
592
596
  <div class="input-group__after">
593
597
  <slot name="after"></slot>
594
598
  </div>
595
599
  `;
596
- }
597
-
598
- /**
599
- * @return {TemplateResult}
600
- * @protected
601
- */
602
- // eslint-disable-next-line class-methods-use-this
603
- _feedbackTemplate() {
604
- return html`
600
+ }
601
+
602
+ /**
603
+ * @return {TemplateResult}
604
+ * @protected
605
+ */
606
+ // eslint-disable-next-line class-methods-use-this
607
+ _feedbackTemplate() {
608
+ return html`
605
609
  <div class="form-field__feedback">
606
610
  <slot name="feedback"></slot>
607
611
  </div>
608
612
  `;
609
- }
610
-
611
- /**
612
- * Used for Required validation and computation of interaction states
613
- * @param {any} modelValue
614
- * @return {boolean}
615
- * @protected
616
- */
617
- _isEmpty(modelValue = /** @type {any} */ (this).modelValue) {
618
- let value = modelValue;
619
- if (/** @type {any} */ (this).modelValue instanceof Unparseable) {
620
- value = /** @type {any} */ (this).modelValue.viewValue;
621
- }
622
-
623
- // Checks for empty platform types: Objects, Arrays, Dates
624
- if (typeof value === 'object' && value !== null && !(value instanceof Date)) {
625
- return !Object.keys(value).length;
626
- }
627
-
628
- // eslint-disable-next-line no-mixed-operators
629
- // Checks for empty platform types: Numbers, Booleans
630
- const isNumberValue = typeof value === 'number' && (value === 0 || Number.isNaN(value));
631
- const isBooleanValue = typeof value === 'boolean' && value === false;
632
-
633
- return !value && !isNumberValue && !isBooleanValue;
634
- }
635
-
636
- /**
637
- * All CSS below is written from a generic mindset, following BEM conventions:
638
- * https://en.bem.info/methodology/
639
- * Although the CSS and HTML are implemented by the component, they should be regarded as
640
- * totally decoupled.
641
- *
642
- * Not only does this force us to write better structured css, it also allows for future
643
- * reusability in many different ways like:
644
- * - disabling shadow DOM for a component (for water proof encapsulation can be combined with
645
- * a build step)
646
- * - easier translation to more flexible, WebComponents agnostic solutions like JSS
647
- * (allowing extends, mixins, reasoning, IDE integration, tree shaking etc.)
648
- * - export to a CSS module for reuse in an outer context
649
- *
650
- *
651
- * Please note that the HTML structure is purposely 'loose', allowing multiple design systems
652
- * to be compatible
653
- * with the CSS component.
654
- * Note that every occurence of '::slotted(*)' can be rewritten to '> *' for use in an other
655
- * context
656
- */
657
-
658
- /**
659
- * {block} .form-field
660
- *
661
- * Structure:
662
- * - {element} .form-field__label : a wrapper element around the projected label
663
- * - {element} .form-field__help-text (optional) : a wrapper element around the projected
664
- * help-text
665
- * - {block} .input-group : a container around the input element, including prefixes and
666
- * suffixes
667
- * - {element} .form-field__feedback (optional) : a wrapper element around the projected
668
- * (validation) feedback message
669
- *
670
- * Modifiers:
671
- * - {state} [disabled] when .form-control (<input>, <textarea> etc.) has disabled set
672
- * to true
673
- * - {state} [filled] whether <input> has a value
674
- * - {state} [touched] whether the user had blurred the field once
675
- * - {state} [dirty] whether the value has changed since initial value
676
- *
677
- * TODO: update states below
678
- * These classes are now attributes. Check them agains the new attribute names inside ValidateMixin
679
- * and InteractionStateMixin. Some states got renamed. Make sure to use the correct ones!
680
- * - {state} .state-focused: when .form-control (<input>, <textarea> etc.) <input> has focus
681
- * - {state} .state-invalid: when input has error(s) (regardless of whether they should be
682
- * shown to the user)
683
- * - {state} .state-error: when input has error(s) and this/these should be shown to the user
684
- * - {state} .state-warning: when input has warning(s) and this/these should be shown to the
685
- * user
686
- * - {state} .state-info: when input has info feedback message(s) and this/these should be shown
687
- * to the user
688
- * - {state} .state-success: when input has success feedback message(s) and this/these should be
689
- * shown to the user
690
- */
691
-
692
- /**
693
- * {block} .input-group
694
- *
695
- * Structure:
696
- * - {element} .input-group__before (optional) : a prefix that resides outside the container
697
- * - {element} .input-group__container : an inner container: this element contains all styling
698
- * - {element} .input-group__prefix (optional) : a prefix that resides in the container,
699
- * allowing it to be detectable as a :first-child
700
- * - {element} .input-group__input : a wrapper around the form-control component
701
- * - {block} .form-control : the actual input element (input/select/textarea)
702
- * - {element} .input-group__suffix (optional) : a suffix that resides inside the container,
703
- * allowing it to be detectable as a :last-child
704
- * - {element} .input-group__bottom (optional) : placeholder element for additional styling
705
- * (like an animated line for material design input)
706
- * - {element} .input-group__after (optional) : a suffix that resides outside the container
707
- */
708
- static get styles() {
709
- return [
710
- css`
613
+ }
614
+
615
+ /**
616
+ * Used for Required validation and computation of interaction states
617
+ * @param {any} modelValue
618
+ * @return {boolean}
619
+ * @protected
620
+ */
621
+ _isEmpty(modelValue = /** @type {any} */this.modelValue) {
622
+ let value = modelValue;
623
+ if (/** @type {any} */this.modelValue instanceof Unparseable) {
624
+ value = /** @type {any} */this.modelValue.viewValue;
625
+ }
626
+
627
+ // Checks for empty platform types: Objects, Arrays, Dates
628
+ if (typeof value === 'object' && value !== null && !(value instanceof Date)) {
629
+ return !Object.keys(value).length;
630
+ }
631
+
632
+ // eslint-disable-next-line no-mixed-operators
633
+ // Checks for empty platform types: Numbers, Booleans
634
+ const isNumberValue = typeof value === 'number' && (value === 0 || Number.isNaN(value));
635
+ const isBooleanValue = typeof value === 'boolean' && value === false;
636
+ return !value && !isNumberValue && !isBooleanValue;
637
+ }
638
+
639
+ /**
640
+ * All CSS below is written from a generic mindset, following BEM conventions:
641
+ * https://en.bem.info/methodology/
642
+ * Although the CSS and HTML are implemented by the component, they should be regarded as
643
+ * totally decoupled.
644
+ *
645
+ * Not only does this force us to write better structured css, it also allows for future
646
+ * reusability in many different ways like:
647
+ * - disabling shadow DOM for a component (for water proof encapsulation can be combined with
648
+ * a build step)
649
+ * - easier translation to more flexible, WebComponents agnostic solutions like JSS
650
+ * (allowing extends, mixins, reasoning, IDE integration, tree shaking etc.)
651
+ * - export to a CSS module for reuse in an outer context
652
+ *
653
+ *
654
+ * Please note that the HTML structure is purposely 'loose', allowing multiple design systems
655
+ * to be compatible
656
+ * with the CSS component.
657
+ * Note that every occurence of '::slotted(*)' can be rewritten to '> *' for use in an other
658
+ * context
659
+ */
660
+
661
+ /**
662
+ * {block} .form-field
663
+ *
664
+ * Structure:
665
+ * - {element} .form-field__label : a wrapper element around the projected label
666
+ * - {element} .form-field__help-text (optional) : a wrapper element around the projected
667
+ * help-text
668
+ * - {block} .input-group : a container around the input element, including prefixes and
669
+ * suffixes
670
+ * - {element} .form-field__feedback (optional) : a wrapper element around the projected
671
+ * (validation) feedback message
672
+ *
673
+ * Modifiers:
674
+ * - {state} [disabled] when .form-control (<input>, <textarea> etc.) has disabled set
675
+ * to true
676
+ * - {state} [filled] whether <input> has a value
677
+ * - {state} [touched] whether the user had blurred the field once
678
+ * - {state} [dirty] whether the value has changed since initial value
679
+ *
680
+ * TODO: update states below
681
+ * These classes are now attributes. Check them agains the new attribute names inside ValidateMixin
682
+ * and InteractionStateMixin. Some states got renamed. Make sure to use the correct ones!
683
+ * - {state} .state-focused: when .form-control (<input>, <textarea> etc.) <input> has focus
684
+ * - {state} .state-invalid: when input has error(s) (regardless of whether they should be
685
+ * shown to the user)
686
+ * - {state} .state-error: when input has error(s) and this/these should be shown to the user
687
+ * - {state} .state-warning: when input has warning(s) and this/these should be shown to the
688
+ * user
689
+ * - {state} .state-info: when input has info feedback message(s) and this/these should be shown
690
+ * to the user
691
+ * - {state} .state-success: when input has success feedback message(s) and this/these should be
692
+ * shown to the user
693
+ */
694
+
695
+ /**
696
+ * {block} .input-group
697
+ *
698
+ * Structure:
699
+ * - {element} .input-group__before (optional) : a prefix that resides outside the container
700
+ * - {element} .input-group__container : an inner container: this element contains all styling
701
+ * - {element} .input-group__prefix (optional) : a prefix that resides in the container,
702
+ * allowing it to be detectable as a :first-child
703
+ * - {element} .input-group__input : a wrapper around the form-control component
704
+ * - {block} .form-control : the actual input element (input/select/textarea)
705
+ * - {element} .input-group__suffix (optional) : a suffix that resides inside the container,
706
+ * allowing it to be detectable as a :last-child
707
+ * - {element} .input-group__bottom (optional) : placeholder element for additional styling
708
+ * (like an animated line for material design input)
709
+ * - {element} .input-group__after (optional) : a suffix that resides outside the container
710
+ */
711
+ static get styles() {
712
+ return [css`
711
713
  /**********************
712
714
  {block} .form-field
713
715
  ********************/
@@ -770,223 +772,219 @@ const FormControlMixinImplementation = /** @type {FormControlMixin} */ (supercla
770
772
  margin: 0; /* remove input margin in Safari */
771
773
  font-size: 100%; /* normalize default input font-size */
772
774
  }
773
- `,
774
- ];
775
- }
776
-
777
- /**
778
- * This function exposes descripion elements that a FormGroup should expose to its
779
- * children. See FormGroupMixin.__getAllDescriptionElementsInParentChain()
780
- * @return {Array.<HTMLElement>}
781
- * @protected
782
- */
783
- // Returns dom references to all elements that should be referred to by field(s)
784
- _getAriaDescriptionElements() {
785
- return [this._helpTextNode, this._feedbackNode];
786
- }
787
-
788
- /**
789
- * Allows to add extra element references to aria-labelledby attribute.
790
- * @param {HTMLElement} element
791
- * @param {{idPrefix?:string; reorder?: boolean}} customConfig
792
- */
793
- addToAriaLabelledBy(element, { idPrefix = '', reorder = true } = {}) {
794
- // eslint-disable-next-line no-param-reassign
795
- element.id = element.id || `${idPrefix}-${this._inputId}`;
796
- if (!this._ariaLabelledNodes.includes(element)) {
797
- this._ariaLabelledNodes = [...this._ariaLabelledNodes, element];
798
- // This value will be read when we need to reflect to attr
799
- /** @type {boolean} */
800
- this.__reorderAriaLabelledNodes = Boolean(reorder);
801
- }
802
- }
803
-
804
- /**
805
- * Allows to remove element references from aria-labelledby attribute.
806
- * @param {HTMLElement} element
807
- */
808
- removeFromAriaLabelledBy(element) {
809
- if (this._ariaLabelledNodes.includes(element)) {
810
- this._ariaLabelledNodes.splice(this._ariaLabelledNodes.indexOf(element), 1);
811
- this._ariaLabelledNodes = [...this._ariaLabelledNodes];
812
- // This value will be read when we need to reflect to attr
813
- /** @type {boolean} */
814
- this.__reorderAriaLabelledNodes = false;
815
- }
816
- }
817
-
818
- /**
819
- * Allows to add element references to aria-describedby attribute.
820
- * @param {HTMLElement} element
821
- * @param {{idPrefix?:string; reorder?: boolean}} customConfig
822
- */
823
- addToAriaDescribedBy(element, { idPrefix = '', reorder = true } = {}) {
824
- // eslint-disable-next-line no-param-reassign
825
- element.id = element.id || `${idPrefix}-${this._inputId}`;
826
- if (!this._ariaDescribedNodes.includes(element)) {
827
- this._ariaDescribedNodes = [...this._ariaDescribedNodes, element];
828
- // This value will be read when we need to reflect to attr
829
- /** @type {boolean} */
830
- this.__reorderAriaDescribedNodes = Boolean(reorder);
831
- }
832
- }
833
-
834
- /**
835
- * Allows to remove element references from aria-describedby attribute.
836
- * @param {HTMLElement} element
837
- */
838
- removeFromAriaDescribedBy(element) {
839
- if (this._ariaDescribedNodes.includes(element)) {
840
- this._ariaDescribedNodes.splice(this._ariaDescribedNodes.indexOf(element), 1);
841
- this._ariaDescribedNodes = [...this._ariaDescribedNodes];
842
- // This value will be read when we need to reflect to attr
843
- /** @type {boolean} */
844
- this.__reorderAriaLabelledNodes = false;
845
- }
846
- }
847
-
848
- /**
849
- * @param {string} slotName
850
- * @return {HTMLElement | undefined}
851
- */
852
- __getDirectSlotChild(slotName) {
853
- return /** @type {HTMLElement[]} */ (Array.from(this.children)).find(
854
- el => el.slot === slotName,
855
- );
856
- }
857
-
858
- _dispatchInitialModelValueChangedEvent() {
859
- // When we are not a fieldset / choice-group, we don't need to wait for our children
860
- // to send a unified event
861
- if (this._repropagationRole === 'child') {
862
- return;
863
- }
864
-
865
- // Initially we don't repropagate model-value-changed events coming
866
- // from children. On firstUpdated we re-dispatch this event to maintain
867
- // 'count consistency' (to not confuse the application developer with a
868
- // large number of initial events). Initially the source field will not
869
- // be part of the formPath but afterwards it will.
775
+ `];
776
+ }
777
+
778
+ /**
779
+ * This function exposes descripion elements that a FormGroup should expose to its
780
+ * children. See FormGroupMixin.__getAllDescriptionElementsInParentChain()
781
+ * @return {Array.<HTMLElement>}
782
+ * @protected
783
+ */
784
+ // Returns dom references to all elements that should be referred to by field(s)
785
+ _getAriaDescriptionElements() {
786
+ return [this._helpTextNode, this._feedbackNode];
787
+ }
788
+
789
+ /**
790
+ * Allows to add extra element references to aria-labelledby attribute.
791
+ * @param {HTMLElement} element
792
+ * @param {{idPrefix?:string; reorder?: boolean}} customConfig
793
+ */
794
+ addToAriaLabelledBy(element, {
795
+ idPrefix = '',
796
+ reorder = true
797
+ } = {}) {
798
+ // eslint-disable-next-line no-param-reassign
799
+ element.id = element.id || `${idPrefix}-${this._inputId}`;
800
+ if (!this._ariaLabelledNodes.includes(element)) {
801
+ this._ariaLabelledNodes = [...this._ariaLabelledNodes, element];
802
+ // This value will be read when we need to reflect to attr
870
803
  /** @type {boolean} */
871
- this.__repropagateChildrenInitialized = true;
872
- this.dispatchEvent(
873
- new CustomEvent('model-value-changed', {
874
- bubbles: true,
875
- detail: /** @type {ModelValueEventDetails} */ ({
876
- formPath: [this],
877
- initialize: true,
878
- isTriggeredByUser: false,
879
- }),
880
- }),
881
- );
882
- }
883
-
884
- /**
885
- * Hook for Subclassers to add logic before repropagation
886
- * @configurable
887
- * @param {CustomEvent} ev
888
- * @protected
889
- */
890
- // eslint-disable-next-line class-methods-use-this, no-unused-vars
891
- _onBeforeRepropagateChildrenValues(ev) {}
892
-
893
- /**
894
- * @param {CustomEvent} ev
895
- */
896
- __repropagateChildrenValues(ev) {
897
- // Allows sub classes to internally listen to the children change events
898
- // (before stopImmediatePropagation is called below).
899
- this._onBeforeRepropagateChildrenValues(ev);
900
- // Normalize target, we also might get it from 'portals' (rich select)
901
- const target = (ev.detail && ev.detail.element) || ev.target;
902
- const isEndpoint =
903
- this._isRepropagationEndpoint || this._repropagationRole === 'choice-group';
904
-
905
- // Prevent eternal loops after we sent the event below.
906
- if (target === this) {
907
- return;
908
- }
909
-
910
- // A. Stop sibling handlers
911
- //
912
- // Make sure our sibling event listeners (added by Application developers) will not get
913
- // the child model-value-changed event, but the repropagated one at the bottom of this
914
- // method
915
- ev.stopImmediatePropagation();
916
-
917
- // B1. Are we still initializing? If so, halt...
918
- //
919
- // Stop repropagating children events before firstUpdated and make sure we de not
920
- // repropagate init events of our children (we already sent our own
921
- // initial model-value-change event in firstUpdated)
922
- const isGroup = this._repropagationRole !== 'child'; // => fieldset or choice-group
923
- const isSelfInitializing = isGroup && !this.__repropagateChildrenInitialized;
924
- const isChildGroupInitializing = ev.detail && ev.detail.initialize;
925
- if (isSelfInitializing || isChildGroupInitializing) {
926
- return;
927
- }
928
-
929
- // B2. Are we a single choice choice-group? If so, halt when target unchecked
930
- // and something else is checked, meaning we will get
931
- // another model-value-changed dispatch for the checked target
932
- //
933
- // We only send the checked changed up (not the unchecked). In this way a choice group
934
- // (radio-group, checkbox-group, select/listbox) acts as an 'endpoint' (a single Field)
935
- // just like the native <select>
936
- if (!this._repropagationCondition(target)) {
937
- return;
938
- }
939
-
940
- // C1. We are ready to dispatch. Create a formPath
941
- //
942
- // Compute the formPath. Choice groups are regarded 'end points'
943
- let parentFormPath = [];
944
- if (!isEndpoint) {
945
- parentFormPath = (ev.detail && ev.detail.formPath) || [target];
946
- }
947
- const formPath = [...parentFormPath, this];
948
-
949
- // C2. Finally, redispatch a fresh model-value-changed event from our host, consumable
950
- // for an Application Developer
951
- //
952
- // Since for a11y everything needs to be in lightdom, we don't add 'composed:true'
953
- this.dispatchEvent(
954
- new CustomEvent('model-value-changed', {
955
- bubbles: true,
956
- detail: /** @type {ModelValueEventDetails} */ ({
957
- formPath,
958
- isTriggeredByUser: Boolean(ev.detail?.isTriggeredByUser),
959
- }),
960
- }),
961
- );
962
- }
963
-
964
- /**
965
- * Based on provided target, this condition determines whether received model-value-changed
966
- * event should be repropagated
967
- * @param {FormControlHost} target
968
- * @protected
969
- * @overridable
970
- */
971
- // eslint-disable-next-line class-methods-use-this
972
- _repropagationCondition(target) {
973
- return Boolean(target);
974
- }
975
-
976
- /**
977
- * @overridable
978
- * A Subclasser should only override this method if the interactive element
979
- * ([slot=input]) is not a native element(like input, textarea, select)
980
- * that already receives focus on label click.
981
- *
982
- * @example
983
- * _onLabelClick() {
984
- * this._invokerNode.focus();
985
- * }
986
- * @protected
987
- */
988
- // eslint-disable-next-line class-methods-use-this
989
- _onLabelClick() {}
990
- });
991
-
804
+ this.__reorderAriaLabelledNodes = Boolean(reorder);
805
+ }
806
+ }
807
+
808
+ /**
809
+ * Allows to remove element references from aria-labelledby attribute.
810
+ * @param {HTMLElement} element
811
+ */
812
+ removeFromAriaLabelledBy(element) {
813
+ if (this._ariaLabelledNodes.includes(element)) {
814
+ this._ariaLabelledNodes.splice(this._ariaLabelledNodes.indexOf(element), 1);
815
+ this._ariaLabelledNodes = [...this._ariaLabelledNodes];
816
+ // This value will be read when we need to reflect to attr
817
+ /** @type {boolean} */
818
+ this.__reorderAriaLabelledNodes = false;
819
+ }
820
+ }
821
+
822
+ /**
823
+ * Allows to add element references to aria-describedby attribute.
824
+ * @param {HTMLElement} element
825
+ * @param {{idPrefix?:string; reorder?: boolean}} customConfig
826
+ */
827
+ addToAriaDescribedBy(element, {
828
+ idPrefix = '',
829
+ reorder = true
830
+ } = {}) {
831
+ // eslint-disable-next-line no-param-reassign
832
+ element.id = element.id || `${idPrefix}-${this._inputId}`;
833
+ if (!this._ariaDescribedNodes.includes(element)) {
834
+ this._ariaDescribedNodes = [...this._ariaDescribedNodes, element];
835
+ // This value will be read when we need to reflect to attr
836
+ /** @type {boolean} */
837
+ this.__reorderAriaDescribedNodes = Boolean(reorder);
838
+ }
839
+ }
840
+
841
+ /**
842
+ * Allows to remove element references from aria-describedby attribute.
843
+ * @param {HTMLElement} element
844
+ */
845
+ removeFromAriaDescribedBy(element) {
846
+ if (this._ariaDescribedNodes.includes(element)) {
847
+ this._ariaDescribedNodes.splice(this._ariaDescribedNodes.indexOf(element), 1);
848
+ this._ariaDescribedNodes = [...this._ariaDescribedNodes];
849
+ // This value will be read when we need to reflect to attr
850
+ /** @type {boolean} */
851
+ this.__reorderAriaLabelledNodes = false;
852
+ }
853
+ }
854
+
855
+ /**
856
+ * @param {string} slotName
857
+ * @return {HTMLElement | undefined}
858
+ */
859
+ __getDirectSlotChild(slotName) {
860
+ return /** @type {HTMLElement[]} */Array.from(this.children).find(el => el.slot === slotName);
861
+ }
862
+ _dispatchInitialModelValueChangedEvent() {
863
+ // When we are not a fieldset / choice-group, we don't need to wait for our children
864
+ // to send a unified event
865
+ if (this._repropagationRole === 'child') {
866
+ return;
867
+ }
868
+
869
+ // Initially we don't repropagate model-value-changed events coming
870
+ // from children. On firstUpdated we re-dispatch this event to maintain
871
+ // 'count consistency' (to not confuse the application developer with a
872
+ // large number of initial events). Initially the source field will not
873
+ // be part of the formPath but afterwards it will.
874
+ /** @type {boolean} */
875
+ this.__repropagateChildrenInitialized = true;
876
+ this.dispatchEvent(new CustomEvent('model-value-changed', {
877
+ bubbles: true,
878
+ detail: (/** @type {ModelValueEventDetails} */{
879
+ formPath: [this],
880
+ initialize: true,
881
+ isTriggeredByUser: false
882
+ })
883
+ }));
884
+ }
885
+
886
+ /**
887
+ * Hook for Subclassers to add logic before repropagation
888
+ * @configurable
889
+ * @param {CustomEvent} ev
890
+ * @protected
891
+ */
892
+ // eslint-disable-next-line class-methods-use-this, no-unused-vars
893
+ _onBeforeRepropagateChildrenValues(ev) {}
894
+
895
+ /**
896
+ * @param {CustomEvent} ev
897
+ */
898
+ __repropagateChildrenValues(ev) {
899
+ // Allows sub classes to internally listen to the children change events
900
+ // (before stopImmediatePropagation is called below).
901
+ this._onBeforeRepropagateChildrenValues(ev);
902
+ // Normalize target, we also might get it from 'portals' (rich select)
903
+ const target = ev.detail && ev.detail.element || ev.target;
904
+ const isEndpoint = this._isRepropagationEndpoint || this._repropagationRole === 'choice-group';
905
+
906
+ // Prevent eternal loops after we sent the event below.
907
+ if (target === this) {
908
+ return;
909
+ }
910
+
911
+ // A. Stop sibling handlers
912
+ //
913
+ // Make sure our sibling event listeners (added by Application developers) will not get
914
+ // the child model-value-changed event, but the repropagated one at the bottom of this
915
+ // method
916
+ ev.stopImmediatePropagation();
917
+
918
+ // B1. Are we still initializing? If so, halt...
919
+ //
920
+ // Stop repropagating children events before firstUpdated and make sure we de not
921
+ // repropagate init events of our children (we already sent our own
922
+ // initial model-value-change event in firstUpdated)
923
+ const isGroup = this._repropagationRole !== 'child'; // => fieldset or choice-group
924
+ const isSelfInitializing = isGroup && !this.__repropagateChildrenInitialized;
925
+ const isChildGroupInitializing = ev.detail && ev.detail.initialize;
926
+ if (isSelfInitializing || isChildGroupInitializing) {
927
+ return;
928
+ }
929
+
930
+ // B2. Are we a single choice choice-group? If so, halt when target unchecked
931
+ // and something else is checked, meaning we will get
932
+ // another model-value-changed dispatch for the checked target
933
+ //
934
+ // We only send the checked changed up (not the unchecked). In this way a choice group
935
+ // (radio-group, checkbox-group, select/listbox) acts as an 'endpoint' (a single Field)
936
+ // just like the native <select>
937
+ if (!this._repropagationCondition(target)) {
938
+ return;
939
+ }
940
+
941
+ // C1. We are ready to dispatch. Create a formPath
942
+ //
943
+ // Compute the formPath. Choice groups are regarded 'end points'
944
+ let parentFormPath = [];
945
+ if (!isEndpoint) {
946
+ parentFormPath = ev.detail && ev.detail.formPath || [target];
947
+ }
948
+ const formPath = [...parentFormPath, this];
949
+
950
+ // C2. Finally, redispatch a fresh model-value-changed event from our host, consumable
951
+ // for an Application Developer
952
+ //
953
+ // Since for a11y everything needs to be in lightdom, we don't add 'composed:true'
954
+ this.dispatchEvent(new CustomEvent('model-value-changed', {
955
+ bubbles: true,
956
+ detail: (/** @type {ModelValueEventDetails} */{
957
+ formPath,
958
+ isTriggeredByUser: Boolean(ev.detail?.isTriggeredByUser)
959
+ })
960
+ }));
961
+ }
962
+
963
+ /**
964
+ * Based on provided target, this condition determines whether received model-value-changed
965
+ * event should be repropagated
966
+ * @param {FormControlHost} target
967
+ * @protected
968
+ * @overridable
969
+ */
970
+ // eslint-disable-next-line class-methods-use-this
971
+ _repropagationCondition(target) {
972
+ return Boolean(target);
973
+ }
974
+
975
+ /**
976
+ * @overridable
977
+ * A Subclasser should only override this method if the interactive element
978
+ * ([slot=input]) is not a native element(like input, textarea, select)
979
+ * that already receives focus on label click.
980
+ *
981
+ * @example
982
+ * _onLabelClick() {
983
+ * this._invokerNode.focus();
984
+ * }
985
+ * @protected
986
+ */
987
+ // eslint-disable-next-line class-methods-use-this
988
+ _onLabelClick() {}
989
+ };
992
990
  export const FormControlMixin = dedupeMixin(FormControlMixinImplementation);