@lion/ui 0.2.2 → 0.3.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 (269) hide show
  1. package/README.md +23 -72
  2. package/components/button/src/LionButton.js +1 -1
  3. package/components/core/src/SlotMixin.js +3 -2
  4. package/components/core/test/SlotMixin.test.js +1 -1
  5. package/components/core/types/SlotMixinTypes.ts +4 -1
  6. package/components/dialog/test/lion-dialog.test.js +56 -0
  7. package/components/form-core/src/FocusMixin.js +33 -2
  8. package/components/form-core/src/LionField.js +3 -1
  9. package/components/form-core/src/validate/LionValidationFeedback.js +2 -5
  10. package/components/form-core/src/validate/ResultValidator.js +1 -1
  11. package/components/form-core/test/FocusMixin.test.js +33 -0
  12. package/components/form-core/types/validate/ValidateMixinTypes.ts +2 -2
  13. package/components/form-integrations/test/dialog-integrations.test.js +19 -0
  14. package/components/form-integrations/test/form-group-methods.test.js +11 -37
  15. package/components/form-integrations/test/form-integrations.test.js +4 -0
  16. package/components/form-integrations/test/helpers/umbrella-form.js +21 -18
  17. package/components/input-amount/src/LionInputAmount.js +13 -4
  18. package/components/input-amount/test/lion-input-amount.test.js +19 -20
  19. package/components/input-date/src/LionInputDate.js +2 -11
  20. package/components/input-datepicker/src/LionInputDatepicker.js +5 -2
  21. package/components/input-datepicker/test/lion-input-datepicker.test.js +20 -0
  22. package/components/input-file/src/FileHandle.js +98 -0
  23. package/components/input-file/src/LionInputFile.js +892 -0
  24. package/components/input-file/src/LionSelectedFileList.js +232 -0
  25. package/components/input-file/src/localizeNamespaceLoader.js +75 -0
  26. package/components/input-file/src/validators.js +114 -0
  27. package/components/input-file/test/FileValidators.test.js +170 -0
  28. package/components/input-file/test/lion-input-file.test.js +1168 -0
  29. package/components/input-file/test/lion-selected-file-list.test.js +207 -0
  30. package/components/input-file/translations/bg-BG.js +5 -0
  31. package/components/input-file/translations/bg.js +12 -0
  32. package/components/input-file/translations/cs-CZ.js +5 -0
  33. package/components/input-file/translations/cs.js +13 -0
  34. package/components/input-file/translations/de-DE.js +5 -0
  35. package/components/input-file/translations/de.js +12 -0
  36. package/components/input-file/translations/en-AU.js +5 -0
  37. package/components/input-file/translations/en-GB.js +5 -0
  38. package/components/input-file/translations/en-PH.js +5 -0
  39. package/components/input-file/translations/en-US.js +5 -0
  40. package/components/input-file/translations/en.js +12 -0
  41. package/components/input-file/translations/es-ES.js +5 -0
  42. package/components/input-file/translations/es.js +12 -0
  43. package/components/input-file/translations/fr-BE.js +5 -0
  44. package/components/input-file/translations/fr-FR.js +5 -0
  45. package/components/input-file/translations/fr.js +13 -0
  46. package/components/input-file/translations/hu-HU.js +5 -0
  47. package/components/input-file/translations/hu.js +12 -0
  48. package/components/input-file/translations/it-IT.js +5 -0
  49. package/components/input-file/translations/it.js +12 -0
  50. package/components/input-file/translations/nl-BE.js +5 -0
  51. package/components/input-file/translations/nl-NL.js +5 -0
  52. package/components/input-file/translations/nl.js +12 -0
  53. package/components/input-file/translations/pl-PL.js +5 -0
  54. package/components/input-file/translations/pl.js +12 -0
  55. package/components/input-file/translations/ro-RO.js +5 -0
  56. package/components/input-file/translations/ro.js +12 -0
  57. package/components/input-file/translations/ru-RU.js +5 -0
  58. package/components/input-file/translations/ru.js +12 -0
  59. package/components/input-file/translations/sk-SK.js +5 -0
  60. package/components/input-file/translations/sk.js +12 -0
  61. package/components/input-file/translations/uk-UA.js +5 -0
  62. package/components/input-file/translations/uk.js +12 -0
  63. package/components/input-file/translations/zh-CN.js +5 -0
  64. package/components/input-file/translations/zh.js +12 -0
  65. package/components/input-file/types/input-file.d.ts +32 -0
  66. package/components/input-tel-dropdown/src/LionInputTelDropdown.js +1 -4
  67. package/custom-elements.json +22127 -17708
  68. package/dist-types/components/core/src/SlotMixin.d.ts.map +1 -1
  69. package/dist-types/components/core/types/SlotMixinTypes.d.ts +4 -0
  70. package/dist-types/components/core/types/SlotMixinTypes.d.ts.map +1 -1
  71. package/dist-types/components/dialog/test/lion-dialog.test.d.ts.map +1 -1
  72. package/dist-types/components/form-core/src/FocusMixin.d.ts.map +1 -1
  73. package/dist-types/components/form-core/src/LionField.d.ts +2 -1
  74. package/dist-types/components/form-core/src/LionField.d.ts.map +1 -1
  75. package/dist-types/components/form-core/src/validate/LionValidationFeedback.d.ts +4 -11
  76. package/dist-types/components/form-core/src/validate/LionValidationFeedback.d.ts.map +1 -1
  77. package/dist-types/components/form-core/src/validate/ResultValidator.d.ts +1 -1
  78. package/dist-types/components/form-core/types/validate/ValidateMixinTypes.d.ts +5 -0
  79. package/dist-types/components/form-core/types/validate/ValidateMixinTypes.d.ts.map +1 -1
  80. package/dist-types/components/form-integrations/test/dialog-integrations.test.d.ts.map +1 -1
  81. package/dist-types/components/form-integrations/test/form-group-methods.test.d.ts +1 -0
  82. package/dist-types/components/form-integrations/test/form-group-methods.test.d.ts.map +1 -1
  83. package/dist-types/components/form-integrations/test/helpers/umbrella-form.d.ts.map +1 -1
  84. package/dist-types/components/input-amount/src/LionInputAmount.d.ts +2 -4
  85. package/dist-types/components/input-amount/src/LionInputAmount.d.ts.map +1 -1
  86. package/dist-types/components/input-amount/test/lion-input-amount.test.d.ts +0 -1
  87. package/dist-types/components/input-amount/test/lion-input-amount.test.d.ts.map +1 -1
  88. package/dist-types/components/input-date/src/LionInputDate.d.ts.map +1 -1
  89. package/dist-types/components/input-datepicker/src/LionInputDatepicker.d.ts +1 -1
  90. package/dist-types/components/input-datepicker/src/LionInputDatepicker.d.ts.map +1 -1
  91. package/dist-types/components/input-file/src/FileHandle.d.ts +55 -0
  92. package/dist-types/components/input-file/src/FileHandle.d.ts.map +1 -0
  93. package/dist-types/components/input-file/src/LionInputFile.d.ts +230 -0
  94. package/dist-types/components/input-file/src/LionInputFile.d.ts.map +1 -0
  95. package/dist-types/components/input-file/src/LionSelectedFileList.d.ts +69 -0
  96. package/dist-types/components/input-file/src/LionSelectedFileList.d.ts.map +1 -0
  97. package/dist-types/components/input-file/src/localizeNamespaceLoader.d.ts +2 -0
  98. package/dist-types/components/input-file/src/localizeNamespaceLoader.d.ts.map +1 -0
  99. package/dist-types/components/input-file/src/validators.d.ts +58 -0
  100. package/dist-types/components/input-file/src/validators.d.ts.map +1 -0
  101. package/dist-types/components/input-file/test/FileValidators.test.d.ts +2 -0
  102. package/dist-types/components/input-file/test/FileValidators.test.d.ts.map +1 -0
  103. package/dist-types/components/input-file/test/lion-input-file.test.d.ts +5 -0
  104. package/dist-types/components/input-file/test/lion-input-file.test.d.ts.map +1 -0
  105. package/dist-types/components/input-file/test/lion-selected-file-list.test.d.ts +4 -0
  106. package/dist-types/components/input-file/test/lion-selected-file-list.test.d.ts.map +1 -0
  107. package/dist-types/components/input-file/translations/bg-BG.d.ts +13 -0
  108. package/dist-types/components/input-file/translations/bg-BG.d.ts.map +1 -0
  109. package/dist-types/components/input-file/translations/bg.d.ts +13 -0
  110. package/dist-types/components/input-file/translations/bg.d.ts.map +1 -0
  111. package/dist-types/components/input-file/translations/cs-CZ.d.ts +13 -0
  112. package/dist-types/components/input-file/translations/cs-CZ.d.ts.map +1 -0
  113. package/dist-types/components/input-file/translations/cs.d.ts +13 -0
  114. package/dist-types/components/input-file/translations/cs.d.ts.map +1 -0
  115. package/dist-types/components/input-file/translations/de-DE.d.ts +13 -0
  116. package/dist-types/components/input-file/translations/de-DE.d.ts.map +1 -0
  117. package/dist-types/components/input-file/translations/de.d.ts +13 -0
  118. package/dist-types/components/input-file/translations/de.d.ts.map +1 -0
  119. package/dist-types/components/input-file/translations/en-AU.d.ts +13 -0
  120. package/dist-types/components/input-file/translations/en-AU.d.ts.map +1 -0
  121. package/dist-types/components/input-file/translations/en-GB.d.ts +13 -0
  122. package/dist-types/components/input-file/translations/en-GB.d.ts.map +1 -0
  123. package/dist-types/components/input-file/translations/en-PH.d.ts +13 -0
  124. package/dist-types/components/input-file/translations/en-PH.d.ts.map +1 -0
  125. package/dist-types/components/input-file/translations/en-US.d.ts +13 -0
  126. package/dist-types/components/input-file/translations/en-US.d.ts.map +1 -0
  127. package/dist-types/components/input-file/translations/en.d.ts +13 -0
  128. package/dist-types/components/input-file/translations/en.d.ts.map +1 -0
  129. package/dist-types/components/input-file/translations/es-ES.d.ts +13 -0
  130. package/dist-types/components/input-file/translations/es-ES.d.ts.map +1 -0
  131. package/dist-types/components/input-file/translations/es.d.ts +13 -0
  132. package/dist-types/components/input-file/translations/es.d.ts.map +1 -0
  133. package/dist-types/components/input-file/translations/fr-BE.d.ts +13 -0
  134. package/dist-types/components/input-file/translations/fr-BE.d.ts.map +1 -0
  135. package/dist-types/components/input-file/translations/fr-FR.d.ts +13 -0
  136. package/dist-types/components/input-file/translations/fr-FR.d.ts.map +1 -0
  137. package/dist-types/components/input-file/translations/fr.d.ts +13 -0
  138. package/dist-types/components/input-file/translations/fr.d.ts.map +1 -0
  139. package/dist-types/components/input-file/translations/hu-HU.d.ts +13 -0
  140. package/dist-types/components/input-file/translations/hu-HU.d.ts.map +1 -0
  141. package/dist-types/components/input-file/translations/hu.d.ts +13 -0
  142. package/dist-types/components/input-file/translations/hu.d.ts.map +1 -0
  143. package/dist-types/components/input-file/translations/it-IT.d.ts +13 -0
  144. package/dist-types/components/input-file/translations/it-IT.d.ts.map +1 -0
  145. package/dist-types/components/input-file/translations/it.d.ts +13 -0
  146. package/dist-types/components/input-file/translations/it.d.ts.map +1 -0
  147. package/dist-types/components/input-file/translations/nl-BE.d.ts +13 -0
  148. package/dist-types/components/input-file/translations/nl-BE.d.ts.map +1 -0
  149. package/dist-types/components/input-file/translations/nl-NL.d.ts +13 -0
  150. package/dist-types/components/input-file/translations/nl-NL.d.ts.map +1 -0
  151. package/dist-types/components/input-file/translations/nl.d.ts +13 -0
  152. package/dist-types/components/input-file/translations/nl.d.ts.map +1 -0
  153. package/dist-types/components/input-file/translations/pl-PL.d.ts +13 -0
  154. package/dist-types/components/input-file/translations/pl-PL.d.ts.map +1 -0
  155. package/dist-types/components/input-file/translations/pl.d.ts +13 -0
  156. package/dist-types/components/input-file/translations/pl.d.ts.map +1 -0
  157. package/dist-types/components/input-file/translations/ro-RO.d.ts +13 -0
  158. package/dist-types/components/input-file/translations/ro-RO.d.ts.map +1 -0
  159. package/dist-types/components/input-file/translations/ro.d.ts +13 -0
  160. package/dist-types/components/input-file/translations/ro.d.ts.map +1 -0
  161. package/dist-types/components/input-file/translations/ru-RU.d.ts +13 -0
  162. package/dist-types/components/input-file/translations/ru-RU.d.ts.map +1 -0
  163. package/dist-types/components/input-file/translations/ru.d.ts +13 -0
  164. package/dist-types/components/input-file/translations/ru.d.ts.map +1 -0
  165. package/dist-types/components/input-file/translations/sk-SK.d.ts +13 -0
  166. package/dist-types/components/input-file/translations/sk-SK.d.ts.map +1 -0
  167. package/dist-types/components/input-file/translations/sk.d.ts +13 -0
  168. package/dist-types/components/input-file/translations/sk.d.ts.map +1 -0
  169. package/dist-types/components/input-file/translations/uk-UA.d.ts +13 -0
  170. package/dist-types/components/input-file/translations/uk-UA.d.ts.map +1 -0
  171. package/dist-types/components/input-file/translations/uk.d.ts +13 -0
  172. package/dist-types/components/input-file/translations/uk.d.ts.map +1 -0
  173. package/dist-types/components/input-file/translations/zh-CN.d.ts +13 -0
  174. package/dist-types/components/input-file/translations/zh-CN.d.ts.map +1 -0
  175. package/dist-types/components/input-file/translations/zh.d.ts +13 -0
  176. package/dist-types/components/input-file/translations/zh.d.ts.map +1 -0
  177. package/dist-types/components/input-stepper/src/LionInputStepper.d.ts +6 -0
  178. package/dist-types/components/input-stepper/src/LionInputStepper.d.ts.map +1 -1
  179. package/dist-types/components/input-tel-dropdown/src/LionInputTelDropdown.d.ts +0 -1
  180. package/dist-types/components/input-tel-dropdown/src/LionInputTelDropdown.d.ts.map +1 -1
  181. package/dist-types/exports/define/lion-input-file.d.ts +2 -0
  182. package/dist-types/exports/define/lion-input-file.d.ts.map +1 -0
  183. package/dist-types/exports/define/lion-selected-file-list.d.ts +2 -0
  184. package/dist-types/exports/define/lion-selected-file-list.d.ts.map +1 -0
  185. package/dist-types/exports/input-file.d.ts +4 -0
  186. package/dist-types/exports/input-file.d.ts.map +1 -0
  187. package/dist-types/tsconfig.tsbuildinfo +1 -1
  188. package/docs/components/button/extensions/bootstrap-button.mjs +240 -0
  189. package/docs/components/button/extensions.md +30 -0
  190. package/docs/components/checkbox-group/overview.md +2 -2
  191. package/docs/components/collapsible/overview.md +1 -1
  192. package/docs/components/combobox/{examples.md → extensions.md} +51 -43
  193. package/docs/components/combobox/overview.md +1 -1
  194. package/docs/components/combobox/src/google-combobox/google-combobox.js +4 -1
  195. package/docs/components/combobox/src/md-combobox/md-combobox.js +40 -38
  196. package/docs/components/combobox/src/wa-combobox/wa-combobox.js +204 -209
  197. package/docs/components/combobox/use-cases.md +1 -1
  198. package/docs/components/dialog/overview.md +1 -1
  199. package/docs/components/fieldset/overview.md +5 -5
  200. package/docs/components/form/overview.md +3 -3
  201. package/docs/components/icon/use-cases.md +1 -1
  202. package/docs/components/input/overview.md +1 -1
  203. package/docs/components/input-amount/overview.md +3 -3
  204. package/docs/components/input-amount/use-cases.md +4 -2
  205. package/docs/components/input-date/overview.md +3 -3
  206. package/docs/components/input-datepicker/overview.md +5 -5
  207. package/docs/components/input-datepicker/use-cases.md +11 -0
  208. package/docs/components/input-email/overview.md +2 -2
  209. package/docs/components/input-file/index.md +3 -0
  210. package/docs/components/input-file/overview.md +32 -0
  211. package/docs/components/input-file/use-cases.md +424 -0
  212. package/docs/components/input-iban/overview.md +2 -2
  213. package/docs/components/input-range/overview.md +2 -2
  214. package/docs/components/input-stepper/overview.md +1 -1
  215. package/docs/components/input-tel/overview.md +1 -1
  216. package/docs/components/input-tel/use-cases.md +6 -6
  217. package/docs/components/input-tel-dropdown/{examples.md → extensions.md} +1 -1
  218. package/docs/components/input-tel-dropdown/overview.md +1 -1
  219. package/docs/components/radio-group/overview.md +3 -3
  220. package/docs/components/select-rich/use-cases.md +1 -1
  221. package/docs/components/tabs/examples.md +1 -1
  222. package/docs/fundamentals/index.md +4 -4
  223. package/docs/fundamentals/node-tools/providence-analytics/LocalConfiguration.md +1 -1
  224. package/docs/fundamentals/node-tools/providence-analytics/QueryResult.md +1 -1
  225. package/docs/fundamentals/node-tools/providence-analytics/analyzer.md +1 -1
  226. package/docs/fundamentals/node-tools/providence-analytics/dashboard.md +1 -1
  227. package/docs/fundamentals/node-tools/providence-analytics/overview.md +3 -3
  228. package/docs/fundamentals/node-tools/publish-docs/overview.md +3 -3
  229. package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +2 -2
  230. package/docs/fundamentals/rationales/accessibility.md +28 -0
  231. package/docs/fundamentals/systems/core/SlotMixin.md +148 -0
  232. package/docs/fundamentals/systems/core/overview.md +1 -1
  233. package/docs/fundamentals/systems/form/formatting-and-parsing.md +4 -4
  234. package/docs/fundamentals/systems/form/model-value.md +1 -1
  235. package/docs/fundamentals/systems/form/overview.md +28 -28
  236. package/docs/fundamentals/systems/form/use-cases.md +2 -0
  237. package/docs/fundamentals/systems/form/validate.md +1 -1
  238. package/docs/fundamentals/systems/localize/overview.md +4 -4
  239. package/docs/fundamentals/systems/overlays/_configuration-positioning.md +116 -0
  240. package/docs/fundamentals/systems/overlays/_edge-cases.md +145 -0
  241. package/docs/fundamentals/systems/overlays/configuration.md +2 -2
  242. package/docs/fundamentals/systems/overlays/overview.md +5 -5
  243. package/docs/fundamentals/systems/overlays/use-cases.md +2 -2
  244. package/docs/fundamentals/tools/helpers/overview.md +1 -1
  245. package/docs/fundamentals/tools/singleton-manager/example-complex/index.md +21 -0
  246. package/docs/fundamentals/tools/singleton-manager/example-fail/index.md +19 -0
  247. package/docs/fundamentals/tools/singleton-manager/example-success/index.md +18 -0
  248. package/docs/fundamentals/tools/singleton-manager/overview.md +4 -4
  249. package/docs/guides/how-to/create-a-custom-field.md +5 -5
  250. package/docs/guides/how-to/create-a-form.md +88 -0
  251. package/docs/guides/how-to/extend-a-native-input.md +2 -2
  252. package/docs/guides/index.md +8 -8
  253. package/docs/guides/principles/index.md +5 -5
  254. package/docs/guides/principles/styling.md +1 -1
  255. package/exports/define/lion-input-file.js +3 -0
  256. package/exports/define/lion-selected-file-list.js +3 -0
  257. package/exports/input-file.js +3 -0
  258. package/package.json +3 -2
  259. package/docs/components/combobox/src/google-combobox/assets/googlelogo_color_272x92dp.png +0 -0
  260. package/docs/components/dialog/src/demo-dialog-style.js +0 -3
  261. package/docs/components/select-rich/src/flags.png +0 -0
  262. package/docs/components/select-rich/src/flags@2x.png +0 -0
  263. package/docs/fundamentals/systems/form/assets/FormatMixinDiagram-1.svg +0 -1
  264. package/docs/fundamentals/systems/form/assets/FormatMixinDiagram-2.svg +0 -1
  265. package/docs/fundamentals/systems/form/assets/FormatMixinDiagram-3.svg +0 -84
  266. package/docs/fundamentals/tools/ajax/assets/naga.json +0 -9
  267. package/docs/fundamentals/tools/ajax/assets/pabu.json +0 -9
  268. package/docs/fundamentals/tools/singleton-manager/.gitignore +0 -1
  269. package/docs/override.js +0 -15
@@ -1,29 +1,31 @@
1
- import { LitElement, html } from 'lit';
2
- import { Required, MinLength } from '@lion/ui/form-core.js';
3
- import '@lion/ui/define/lion-form.js';
1
+ import '@lion/ui/define/lion-button-reset.js';
2
+ import '@lion/ui/define/lion-button-submit.js';
3
+ import '@lion/ui/define/lion-checkbox-group.js';
4
+ import '@lion/ui/define/lion-checkbox.js';
5
+ import '@lion/ui/define/lion-combobox.js';
4
6
  import '@lion/ui/define/lion-fieldset.js';
5
- import '@lion/ui/define/lion-input.js';
7
+ import '@lion/ui/define/lion-form.js';
8
+ import '@lion/ui/define/lion-input-amount.js';
6
9
  import '@lion/ui/define/lion-input-date.js';
7
10
  import '@lion/ui/define/lion-input-datepicker.js';
8
- import '@lion/ui/define/lion-input-amount.js';
9
- import '@lion/ui/define/lion-input-iban.js';
10
11
  import '@lion/ui/define/lion-input-email.js';
11
- import '@lion/ui/define/lion-input-tel.js';
12
+ import '@lion/ui/define/lion-input-file.js';
13
+ import '@lion/ui/define/lion-input-iban.js';
14
+ import '@lion/ui/define/lion-input-range.js';
15
+ import '@lion/ui/define/lion-input-stepper.js';
12
16
  import '@lion/ui/define/lion-input-tel-dropdown.js';
13
- import '@lion/ui/define/lion-checkbox-group.js';
14
- import '@lion/ui/define/lion-checkbox.js';
17
+ import '@lion/ui/define/lion-input-tel.js';
18
+ import '@lion/ui/define/lion-input.js';
19
+ import '@lion/ui/define/lion-listbox.js';
20
+ import '@lion/ui/define/lion-option.js';
15
21
  import '@lion/ui/define/lion-radio-group.js';
16
22
  import '@lion/ui/define/lion-radio.js';
17
- import '@lion/ui/define/lion-select.js';
18
23
  import '@lion/ui/define/lion-select-rich.js';
19
- import '@lion/ui/define/lion-listbox.js';
20
- import '@lion/ui/define/lion-option.js';
21
- import '@lion/ui/define/lion-combobox.js';
22
- import '@lion/ui/define/lion-input-range.js';
23
- import '@lion/ui/define/lion-textarea.js';
24
- import '@lion/ui/define/lion-button.js';
24
+ import '@lion/ui/define/lion-select.js';
25
25
  import '@lion/ui/define/lion-switch.js';
26
- import '@lion/ui/define/lion-input-stepper.js';
26
+ import '@lion/ui/define/lion-textarea.js';
27
+ import { MinLength, Required } from '@lion/ui/form-core.js';
28
+ import { html, LitElement } from 'lit';
27
29
 
28
30
  export class UmbrellaForm extends LitElement {
29
31
  get _lionFormNode() {
@@ -83,6 +85,7 @@ export class UmbrellaForm extends LitElement {
83
85
  <lion-input-amount name="money" label="Money"></lion-input-amount>
84
86
  <lion-input-iban name="iban" label="Iban"></lion-input-iban>
85
87
  <lion-input-email name="email" label="Email"></lion-input-email>
88
+ <lion-input-file name="file" label="File"></lion-input-file>
86
89
  <lion-input-tel name="tel" label="Telephone Number"></lion-input-tel>
87
90
  <lion-input-tel-dropdown
88
91
  name="tel-dropdown"
@@ -151,7 +154,7 @@ export class UmbrellaForm extends LitElement {
151
154
  .validators="${[new Required()]}"
152
155
  >
153
156
  <lion-checkbox
154
- .choiceValue="agreed"
157
+ .choiceValue="${'agreed'}"
155
158
  label="I blindly accept all terms and conditions"
156
159
  ></lion-checkbox>
157
160
  </lion-checkbox-group>
@@ -31,6 +31,11 @@ export class LionInputAmount extends LocalizeMixin(LionInput) {
31
31
  * validators.
32
32
  */
33
33
  modelValue: Number,
34
+ /**
35
+ * The slot to put the currency display node in. Can be 'prefix', 'suffix', 'before' and 'after'.
36
+ * Default will be 'after'.
37
+ */
38
+ _currencyDisplayNodeSlot: { attribute: false },
34
39
  locale: { attribute: false },
35
40
  };
36
41
  }
@@ -38,7 +43,7 @@ export class LionInputAmount extends LocalizeMixin(LionInput) {
38
43
  get slots() {
39
44
  return {
40
45
  ...super.slots,
41
- after: () => {
46
+ [this._currencyDisplayNodeSlot]: () => {
42
47
  const el = document.createElement('span');
43
48
  // The data-label attribute will make sure that FormControl adds this to
44
49
  // input[aria-labelledby]
@@ -70,6 +75,8 @@ export class LionInputAmount extends LocalizeMixin(LionInput) {
70
75
  this.locale = undefined;
71
76
  this.__currencyDisplayNodeIsConnected = true;
72
77
  this.defaultValidators.push(new IsNumber());
78
+ /** @protected */
79
+ this._currencyDisplayNodeSlot = 'after';
73
80
  }
74
81
 
75
82
  connectedCallback() {
@@ -103,14 +110,14 @@ export class LionInputAmount extends LocalizeMixin(LionInput) {
103
110
 
104
111
  /**
105
112
  * Upon connecting slot mixin, we should check if
106
- * the after slot was created by the slot mixin,
113
+ * the required slot was created by the slot mixin,
107
114
  * and if so, we should execute the currency changed flow
108
115
  * which evaluates whether the slot node should be
109
116
  * removed for invalid currencies
110
117
  */
111
118
  _connectSlotMixin() {
112
119
  super._connectSlotMixin();
113
- if (this._isPrivateSlot('after')) {
120
+ if (this._isPrivateSlot(this._currencyDisplayNodeSlot)) {
114
121
  this._onCurrencyChanged({ currency: this.currency || null });
115
122
  }
116
123
  }
@@ -179,7 +186,9 @@ export class LionInputAmount extends LocalizeMixin(LionInput) {
179
186
  * @private
180
187
  */
181
188
  get __currencyDisplayNode() {
182
- const node = Array.from(this.children).find(child => child.slot === 'after');
189
+ const node = Array.from(this.children).find(
190
+ child => child.slot === this._currencyDisplayNodeSlot,
191
+ );
183
192
  if (node) {
184
193
  this.__storedCurrencyDisplayNode = node;
185
194
  }
@@ -3,13 +3,12 @@ import { html } from 'lit';
3
3
  import { localize } from '@lion/ui/localize.js';
4
4
  import { localizeTearDown } from '@lion/ui/localize-test-helpers.js';
5
5
  import { getInputMembers } from '@lion/ui/input-test-helpers.js';
6
- import { formatAmount, parseAmount } from '@lion/ui/input-amount.js';
6
+ import { LionInputAmount, formatAmount, parseAmount } from '@lion/ui/input-amount.js';
7
7
 
8
8
  import '@lion/ui/define/lion-input-amount.js';
9
9
 
10
10
  /**
11
11
  * @typedef {import('../../input/src/LionInput.js').LionInput} LionInput
12
- * @typedef {import('../src/LionInputAmount.js').LionInputAmount} LionInputAmount
13
12
  */
14
13
 
15
14
  describe('<lion-input-amount>', () => {
@@ -187,24 +186,6 @@ describe('<lion-input-amount>', () => {
187
186
  ).to.equal('USD');
188
187
  });
189
188
 
190
- it('ignores currency if a suffix is already present', async () => {
191
- const el = /** @type {LionInputAmount} */ (
192
- await fixture(
193
- `<lion-input-amount currency="EUR"><span slot="suffix">my-currency</span></lion-input-amount>`,
194
- )
195
- );
196
- expect(
197
- /** @type {HTMLElement[]} */ (Array.from(el.children)).find(child => child.slot === 'suffix')
198
- ?.innerText,
199
- ).to.equal('my-currency');
200
- el.currency = 'EUR';
201
- await el.updateComplete;
202
- expect(
203
- /** @type {HTMLElement[]} */ (Array.from(el.children)).find(child => child.slot === 'suffix')
204
- ?.innerText,
205
- ).to.equal('my-currency');
206
- });
207
-
208
189
  it('reformats on locale changes', async () => {
209
190
  const el = /** @type {LionInputAmount} */ (
210
191
  await fixture(
@@ -275,6 +256,24 @@ describe('<lion-input-amount>', () => {
275
256
  expect(currLabel?.innerText).to.equal('EUR');
276
257
  });
277
258
 
259
+ it('can override the currency label slot', async () => {
260
+ customElements.define(
261
+ 'my-input-amount',
262
+ class extends LionInputAmount {
263
+ constructor() {
264
+ super();
265
+ // Put the currency label in the suffix slot
266
+ this._currencyDisplayNodeSlot = 'suffix';
267
+ }
268
+ },
269
+ );
270
+ const el = await fixture(html`<my-input-amount currency="EUR"></my-input-amount>`);
271
+ expect(
272
+ /** @type {HTMLElement[]} */ (Array.from(el.children)).find(child => child.slot === 'suffix')
273
+ ?.innerText,
274
+ ).to.equal('EUR');
275
+ });
276
+
278
277
  describe('Accessibility', () => {
279
278
  it('is accessible', async () => {
280
279
  const el = await fixture(
@@ -2,16 +2,6 @@ import { IsDate } from '@lion/ui/form-core.js';
2
2
  import { LionInput } from '@lion/ui/input.js';
3
3
  import { formatDate, LocalizeMixin, parseDate } from '@lion/ui/localize-no-side-effects.js';
4
4
 
5
- /**
6
- * @param {Date|number} date
7
- */
8
- function isValidDate(date) {
9
- // to make sure it is a valid date we use isNaN and not Number.isNaN
10
- // @ts-ignore [allow]: dirty hack, you're not supposed to pass Date instances to isNaN
11
- // eslint-disable-next-line no-restricted-globals
12
- return date instanceof Date && !isNaN(date);
13
- }
14
-
15
5
  /**
16
6
  * `LionInputDate` has a .modelValue of type Date. It parses, formats and validates based
17
7
  * on locale.
@@ -51,7 +41,8 @@ export class LionInputDate extends LocalizeMixin(LionInput) {
51
41
  */
52
42
  // eslint-disable-next-line class-methods-use-this
53
43
  serializer(modelValue) {
54
- if (!isValidDate(modelValue)) {
44
+ const isDate = new IsDate();
45
+ if (isDate.execute(modelValue)) {
55
46
  return '';
56
47
  }
57
48
  // modelValue is localized, so we take the timezone offset in milliseconds and subtract it
@@ -4,6 +4,7 @@ import { ScopedElementsMixin } from '@open-wc/scoped-elements';
4
4
  import { html, css } from 'lit';
5
5
  import { ifDefined } from 'lit/directives/if-defined.js';
6
6
  import { LionInputDate } from '@lion/ui/input-date.js';
7
+ import { IsDate } from '@lion/ui/form-core.js';
7
8
  import {
8
9
  OverlayMixin,
9
10
  withBottomSheetConfig,
@@ -373,10 +374,12 @@ export class LionInputDatepicker extends ScopedElementsMixin(
373
374
  * The LionCalendar shouldn't know anything about the modelValue;
374
375
  * it can't handle Unparseable dates, but does handle 'undefined'
375
376
  * @param {?} modelValue
376
- * @returns {Date|undefined} a 'guarded' modelValue
377
+ * @returns {Date | undefined} a 'guarded' modelValue
377
378
  */
378
379
  static __getSyncDownValue(modelValue) {
379
- return modelValue instanceof Date ? modelValue : undefined;
380
+ const isDate = new IsDate();
381
+ const hasError = isDate.execute(modelValue);
382
+ return hasError ? undefined : modelValue;
380
383
  }
381
384
 
382
385
  /**
@@ -360,6 +360,26 @@ describe('<lion-input-datepicker>', () => {
360
360
  expect(el.__calendarMaxDate.toString()).to.equal(new Date('2019/07/15').toString());
361
361
  });
362
362
 
363
+ it('should show error on invalid date passed to modelValue', async () => {
364
+ const myDate = new Date('foo');
365
+ const el = await fixture(html`
366
+ <lion-input-datepicker .modelValue="${myDate}"></lion-input-datepicker>
367
+ `);
368
+ expect(el.hasFeedbackFor).to.include('error');
369
+ expect(el.validationStates).to.have.property('error');
370
+ expect(el.validationStates.error).to.have.property('IsDate');
371
+ });
372
+
373
+ it('should show error on date with invalid format passed to modelValue', async () => {
374
+ const myDate = new Date('30/01/2022');
375
+ const el = await fixture(html`
376
+ <lion-input-datepicker .modelValue="${myDate}"></lion-input-datepicker>
377
+ `);
378
+ expect(el.hasFeedbackFor).to.include('error');
379
+ expect(el.validationStates).to.have.property('error');
380
+ expect(el.validationStates.error).to.have.property('IsDate');
381
+ });
382
+
363
383
  /**
364
384
  * Not in scope:
365
385
  * - min/max attr (like platform has): could be added in future if observers needed
@@ -0,0 +1,98 @@
1
+ import { IsAcceptedFile } from './validators.js';
2
+
3
+ /**
4
+ * @typedef {import('../types/input-file.js').SystemFile} SystemFile
5
+ */
6
+
7
+ // Do these global constants add value? They are only used in this file
8
+ // Typing filehandle would be enough
9
+
10
+ /**
11
+ * 500MB in bytes
12
+ */
13
+ export const MAX_FILE_SIZE = 524288000;
14
+
15
+ /**
16
+ * @typedef {Object} property
17
+ * @property {string} type
18
+ * @property {string} size
19
+ */
20
+ export const FILE_FAILED_PROP = {
21
+ type: 'FILE_TYPE',
22
+ size: 'FILE_SIZE',
23
+ };
24
+
25
+ export const UPLOAD_FILE_STATUS = {
26
+ fail: 'FAIL',
27
+ pass: 'SUCCESS',
28
+ };
29
+
30
+ export class FileHandle {
31
+ /**
32
+ * @param {SystemFile} systemFile
33
+ * @param {{ allowedFileTypes: Array<string>; allowedFileExtensions: Array<string>; maxFileSize: number; }} _acceptCriteria
34
+ */
35
+ constructor(systemFile, _acceptCriteria) {
36
+ /**
37
+ * @type {Array<string>}
38
+ */
39
+ this.failedProp = [];
40
+ this.systemFile = systemFile;
41
+ this._acceptCriteria = _acceptCriteria;
42
+ this.uploadFileStatus();
43
+ if (this.failedProp.length === 0) {
44
+ this.createDownloadUrl(systemFile);
45
+ }
46
+ }
47
+
48
+ // TDOO: same util as in validators.js
49
+ /**
50
+ * @param {string} fileName
51
+ * @return {string}
52
+ * @protected
53
+ */
54
+ // eslint-disable-next-line class-methods-use-this
55
+ _getFileNameExtension(fileName) {
56
+ return fileName.slice(fileName.lastIndexOf('.') + 1);
57
+ }
58
+
59
+ // TODO: seems to suggest upload is going on...
60
+ // checks the file size and type to set failedProp property
61
+ uploadFileStatus() {
62
+ if (this._acceptCriteria.allowedFileExtensions.length) {
63
+ const fileExtension = this._getFileNameExtension(this.systemFile.name);
64
+ if (
65
+ !IsAcceptedFile.isExtensionAllowed(
66
+ fileExtension,
67
+ this._acceptCriteria.allowedFileExtensions,
68
+ )
69
+ ) {
70
+ this.status = UPLOAD_FILE_STATUS.fail;
71
+ this.failedProp.push(FILE_FAILED_PROP.type);
72
+ }
73
+ } else if (this._acceptCriteria.allowedFileTypes.length) {
74
+ const fileType = this.systemFile.type;
75
+ if (!IsAcceptedFile.isFileTypeAllowed(fileType, this._acceptCriteria.allowedFileTypes)) {
76
+ this.status = UPLOAD_FILE_STATUS.fail;
77
+ this.failedProp.push(FILE_FAILED_PROP.type);
78
+ }
79
+ }
80
+
81
+ if (IsAcceptedFile.checkFileSize(this.systemFile.size, this._acceptCriteria.maxFileSize)) {
82
+ if (this.status !== UPLOAD_FILE_STATUS.fail) {
83
+ this.status = UPLOAD_FILE_STATUS.pass;
84
+ }
85
+ } else {
86
+ this.status = UPLOAD_FILE_STATUS.fail;
87
+ this.failedProp.push(FILE_FAILED_PROP.size);
88
+ }
89
+ }
90
+
91
+ /**
92
+ * @param {SystemFile} file
93
+ */
94
+ createDownloadUrl(file) {
95
+ // @ts-ignore
96
+ this.downloadUrl = window.URL.createObjectURL(file);
97
+ }
98
+ }