@lion/ui 0.0.2 → 0.0.4

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 (319) hide show
  1. package/components/core/src/SlotMixin.js +180 -42
  2. package/components/core/test/SlotMixin.test.js +355 -145
  3. package/components/core/types/SlotMixinTypes.ts +12 -1
  4. package/components/input-tel/src/LionInputTel.js +0 -9
  5. package/components/input-tel-dropdown/src/LionInputTelDropdown.js +32 -29
  6. package/components/input-tel-dropdown/test-suites/LionInputTelDropdown.suite.js +5 -6
  7. package/components/localize/src/number/parseNumber.js +15 -36
  8. package/components/localize/test/number/parseNumber.test.js +3 -12
  9. package/components/localize/types/LocalizeMixinTypes.ts +1 -1
  10. package/custom-elements.json +1435 -133
  11. package/dist-types/components/calendar/src/LionCalendar.d.ts +1 -37
  12. package/dist-types/components/calendar/src/LionCalendar.d.ts.map +1 -1
  13. package/dist-types/components/core/src/SlotMixin.d.ts +2 -0
  14. package/dist-types/components/core/src/SlotMixin.d.ts.map +1 -1
  15. package/dist-types/components/core/test/SlotMixin.test.d.ts +1 -1
  16. package/dist-types/components/core/test/SlotMixin.test.d.ts.map +1 -1
  17. package/dist-types/components/core/types/SlotMixinTypes.d.ts +9 -1
  18. package/dist-types/components/core/types/SlotMixinTypes.d.ts.map +1 -1
  19. package/dist-types/components/input-amount/src/LionInputAmount.d.ts +1 -37
  20. package/dist-types/components/input-amount/src/LionInputAmount.d.ts.map +1 -1
  21. package/dist-types/components/input-date/src/LionInputDate.d.ts +1 -37
  22. package/dist-types/components/input-date/src/LionInputDate.d.ts.map +1 -1
  23. package/dist-types/components/input-datepicker/src/LionCalendarOverlayFrame.d.ts +1 -37
  24. package/dist-types/components/input-datepicker/src/LionCalendarOverlayFrame.d.ts.map +1 -1
  25. package/dist-types/components/input-email/src/LionInputEmail.d.ts +1 -37
  26. package/dist-types/components/input-email/src/LionInputEmail.d.ts.map +1 -1
  27. package/dist-types/components/input-iban/src/LionInputIban.d.ts +1 -37
  28. package/dist-types/components/input-iban/src/LionInputIban.d.ts.map +1 -1
  29. package/dist-types/components/input-tel/src/LionInputTel.d.ts +1 -42
  30. package/dist-types/components/input-tel/src/LionInputTel.d.ts.map +1 -1
  31. package/dist-types/components/input-tel-dropdown/src/LionInputTelDropdown.d.ts +14 -8
  32. package/dist-types/components/input-tel-dropdown/src/LionInputTelDropdown.d.ts.map +1 -1
  33. package/dist-types/components/input-tel-dropdown/test-suites/LionInputTelDropdown.suite.d.ts.map +1 -1
  34. package/dist-types/components/localize/src/LocalizeMixin.d.ts +1 -37
  35. package/dist-types/components/localize/src/LocalizeMixin.d.ts.map +1 -1
  36. package/dist-types/components/localize/src/number/parseNumber.d.ts.map +1 -1
  37. package/dist-types/components/localize/types/LocalizeMixinTypes.d.ts +1 -1
  38. package/dist-types/components/localize/types/LocalizeMixinTypes.d.ts.map +1 -1
  39. package/dist-types/components/pagination/src/LionPagination.d.ts +1 -37
  40. package/dist-types/components/pagination/src/LionPagination.d.ts.map +1 -1
  41. package/dist-types/components/progress-indicator/src/LionProgressIndicator.d.ts +1 -37
  42. package/dist-types/components/progress-indicator/src/LionProgressIndicator.d.ts.map +1 -1
  43. package/dist-types/exports/core.d.ts +1 -0
  44. package/dist-types/exports/core.d.ts.map +1 -1
  45. package/dist-types/exports/form-core.d.ts +2 -0
  46. package/dist-types/exports/form-core.d.ts.map +1 -1
  47. package/dist-types/exports/input-tel-dropdown.d.ts +2 -0
  48. package/dist-types/exports/input-tel-dropdown.d.ts.map +1 -1
  49. package/dist-types/exports/input-tel.d.ts +1 -0
  50. package/dist-types/exports/input-tel.d.ts.map +1 -1
  51. package/dist-types/exports/localize.d.ts +3 -0
  52. package/dist-types/exports/localize.d.ts.map +1 -1
  53. package/dist-types/exports/overlays.d.ts +4 -0
  54. package/dist-types/exports/overlays.d.ts.map +1 -1
  55. package/dist-types/tsconfig.tsbuildinfo +1 -1
  56. package/docs/components/accordion/index.md +3 -0
  57. package/docs/components/accordion/overview.md +129 -0
  58. package/docs/components/accordion/reference.md +47 -0
  59. package/docs/components/accordion/use-cases.md +252 -0
  60. package/docs/components/button/examples.md +30 -0
  61. package/docs/components/button/index.md +3 -0
  62. package/docs/components/button/overview.md +30 -0
  63. package/docs/components/button/src/icon.svg.js +5 -0
  64. package/docs/components/button/use-cases.md +106 -0
  65. package/docs/components/calendar/index.md +3 -0
  66. package/docs/components/calendar/overview.md +49 -0
  67. package/docs/components/calendar/use-cases.md +192 -0
  68. package/docs/components/checkbox-group/index.md +3 -0
  69. package/docs/components/checkbox-group/overview.md +40 -0
  70. package/docs/components/checkbox-group/use-cases.md +256 -0
  71. package/docs/components/collapsible/assets/CustomCollapsible.js +113 -0
  72. package/docs/components/collapsible/assets/applyDemoCollapsibleStyles.js +37 -0
  73. package/docs/components/collapsible/examples.md +83 -0
  74. package/docs/components/collapsible/index.md +3 -0
  75. package/docs/components/collapsible/overview.md +39 -0
  76. package/docs/components/collapsible/use-cases.md +79 -0
  77. package/docs/components/combobox/examples.md +153 -0
  78. package/docs/components/combobox/index.md +3 -0
  79. package/docs/components/combobox/overview.md +51 -0
  80. package/docs/components/combobox/src/LinkMixin.js +60 -0
  81. package/docs/components/combobox/src/demo-selection-display.js +191 -0
  82. package/docs/components/combobox/src/gh-combobox/gh-button.js +69 -0
  83. package/docs/components/combobox/src/gh-combobox/gh-combobox.js +508 -0
  84. package/docs/components/combobox/src/google-combobox/assets/google-clear-icon.js +9 -0
  85. package/docs/components/combobox/src/google-combobox/assets/google-search-icon.js +9 -0
  86. package/docs/components/combobox/src/google-combobox/assets/google-voice-search-icon.js +19 -0
  87. package/docs/components/combobox/src/google-combobox/assets/googlelogo_color_272x92dp.png +0 -0
  88. package/docs/components/combobox/src/google-combobox/google-combobox.js +460 -0
  89. package/docs/components/combobox/src/lazyRender.js +29 -0
  90. package/docs/components/combobox/src/levenshtein.js +95 -0
  91. package/docs/components/combobox/src/md-combobox/MdFieldMixin.js +341 -0
  92. package/docs/components/combobox/src/md-combobox/md-combobox.js +89 -0
  93. package/docs/components/combobox/src/md-combobox/md-input.js +5 -0
  94. package/docs/components/combobox/src/md-combobox/style/load-roboto.js +6 -0
  95. package/docs/components/combobox/src/md-combobox/style/md-ripple.js +81 -0
  96. package/docs/components/combobox/src/wa-combobox/wa-combobox.js +368 -0
  97. package/docs/components/combobox/use-cases.md +377 -0
  98. package/docs/components/dialog/index.md +3 -0
  99. package/docs/components/dialog/overview.md +63 -0
  100. package/docs/components/dialog/src/demo-dialog-style.js +3 -0
  101. package/docs/components/dialog/src/demoStyle.js +39 -0
  102. package/docs/components/dialog/src/slots-dialog-content.js +32 -0
  103. package/docs/components/dialog/src/styled-dialog-content.js +38 -0
  104. package/docs/components/dialog/use-cases.md +154 -0
  105. package/docs/components/drawer/index.md +3 -0
  106. package/docs/components/drawer/overview.md +68 -0
  107. package/docs/components/drawer/src/demoStyle.js +71 -0
  108. package/docs/components/drawer/use-cases.md +194 -0
  109. package/docs/components/fieldset/index.md +3 -0
  110. package/docs/components/fieldset/overview.md +49 -0
  111. package/docs/components/fieldset/use-cases.md +185 -0
  112. package/docs/components/form/index.md +3 -0
  113. package/docs/components/form/overview.md +43 -0
  114. package/docs/components/form/use-cases.md +72 -0
  115. package/docs/components/icon/assets/bugs/bug01.svg.js +2 -0
  116. package/docs/components/icon/assets/bugs/bug02.svg.js +2 -0
  117. package/docs/components/icon/assets/bugs/bug05.svg.js +2 -0
  118. package/docs/components/icon/assets/bugs/bug06.svg.js +2 -0
  119. package/docs/components/icon/assets/bugs/bug08.svg.js +2 -0
  120. package/docs/components/icon/assets/bugs/bug12.svg.js +2 -0
  121. package/docs/components/icon/assets/bugs/bug19.svg.js +2 -0
  122. package/docs/components/icon/assets/bugs/bug23.svg.js +2 -0
  123. package/docs/components/icon/assets/bugs/bug24.svg.js +2 -0
  124. package/docs/components/icon/assets/iconset-bugs.js +11 -0
  125. package/docs/components/icon/assets/iconset-misc.js +3 -0
  126. package/docs/components/icon/assets/iconset-space.js +31 -0
  127. package/docs/components/icon/assets/misc/arrowLeft.svg.js +6 -0
  128. package/docs/components/icon/assets/space/aliens-spaceship.svg.js +2 -0
  129. package/docs/components/icon/assets/space/meteor.svg.js +2 -0
  130. package/docs/components/icon/assets/space/moon-flag.svg.js +2 -0
  131. package/docs/components/icon/assets/space/moon.svg.js +2 -0
  132. package/docs/components/icon/assets/space/night.svg.js +2 -0
  133. package/docs/components/icon/assets/space/orbit.svg.js +2 -0
  134. package/docs/components/icon/assets/space/planet.svg.js +2 -0
  135. package/docs/components/icon/assets/space/robot.svg.js +2 -0
  136. package/docs/components/icon/assets/space/rocket.svg.js +2 -0
  137. package/docs/components/icon/assets/space/satellite.svg.js +2 -0
  138. package/docs/components/icon/assets/space/signal.svg.js +2 -0
  139. package/docs/components/icon/assets/space/space-helmet.svg.js +2 -0
  140. package/docs/components/icon/assets/space/sun.svg.js +2 -0
  141. package/docs/components/icon/assets/space/telescope.svg.js +2 -0
  142. package/docs/components/icon/index.md +3 -0
  143. package/docs/components/icon/overview.md +40 -0
  144. package/docs/components/icon/use-cases.md +93 -0
  145. package/docs/components/index.md +7 -0
  146. package/docs/components/input/index.md +3 -0
  147. package/docs/components/input/overview.md +36 -0
  148. package/docs/components/input/use-cases.md +77 -0
  149. package/docs/components/input-amount/index.md +3 -0
  150. package/docs/components/input-amount/overview.md +49 -0
  151. package/docs/components/input-amount/use-cases.md +122 -0
  152. package/docs/components/input-date/index.md +3 -0
  153. package/docs/components/input-date/overview.md +39 -0
  154. package/docs/components/input-date/use-cases.md +83 -0
  155. package/docs/components/input-datepicker/index.md +3 -0
  156. package/docs/components/input-datepicker/overview.md +42 -0
  157. package/docs/components/input-datepicker/use-cases.md +78 -0
  158. package/docs/components/input-email/index.md +3 -0
  159. package/docs/components/input-email/overview.md +32 -0
  160. package/docs/components/input-email/use-cases.md +48 -0
  161. package/docs/components/input-iban/index.md +3 -0
  162. package/docs/components/input-iban/overview.md +37 -0
  163. package/docs/components/input-iban/use-cases.md +102 -0
  164. package/docs/components/input-range/index.md +3 -0
  165. package/docs/components/input-range/overview.md +34 -0
  166. package/docs/components/input-range/use-cases.md +108 -0
  167. package/docs/components/input-stepper/index.md +3 -0
  168. package/docs/components/input-stepper/overview.md +36 -0
  169. package/docs/components/input-stepper/use-cases.md +41 -0
  170. package/docs/components/input-tel/index.md +3 -0
  171. package/docs/components/input-tel/overview.md +62 -0
  172. package/docs/components/input-tel/src/h-region-code-table.js +109 -0
  173. package/docs/components/input-tel/use-cases.md +307 -0
  174. package/docs/components/input-tel-dropdown/examples.md +32 -0
  175. package/docs/components/input-tel-dropdown/index.md +3 -0
  176. package/docs/components/input-tel-dropdown/overview.md +38 -0
  177. package/docs/components/input-tel-dropdown/src/intl-input-tel-dropdown.js +127 -0
  178. package/docs/components/input-tel-dropdown/use-cases.md +159 -0
  179. package/docs/components/listbox/index.md +3 -0
  180. package/docs/components/listbox/overview.md +42 -0
  181. package/docs/components/listbox/src/listboxData.js +65 -0
  182. package/docs/components/listbox/use-cases.md +147 -0
  183. package/docs/components/pagination/index.md +3 -0
  184. package/docs/components/pagination/overview.md +29 -0
  185. package/docs/components/pagination/use-cases.md +99 -0
  186. package/docs/components/progress-indicator/assets/my-determinate-progress-bar.js +30 -0
  187. package/docs/components/progress-indicator/assets/my-indeterminate-progress-spinner.js +55 -0
  188. package/docs/components/progress-indicator/examples.md +125 -0
  189. package/docs/components/progress-indicator/index.md +3 -0
  190. package/docs/components/progress-indicator/overview.md +36 -0
  191. package/docs/components/radio-group/index.md +3 -0
  192. package/docs/components/radio-group/overview.md +46 -0
  193. package/docs/components/radio-group/use-cases.md +140 -0
  194. package/docs/components/select/index.md +3 -0
  195. package/docs/components/select/overview.md +44 -0
  196. package/docs/components/select/use-cases.md +55 -0
  197. package/docs/components/select-rich/examples.md +31 -0
  198. package/docs/components/select-rich/index.md +3 -0
  199. package/docs/components/select-rich/overview.md +46 -0
  200. package/docs/components/select-rich/src/flagStyles.js +1250 -0
  201. package/docs/components/select-rich/src/flags.png +0 -0
  202. package/docs/components/select-rich/src/flags@2x.png +0 -0
  203. package/docs/components/select-rich/src/intl-select-rich.js +194 -0
  204. package/docs/components/select-rich/src/regionMetaList.js +1717 -0
  205. package/docs/components/select-rich/use-cases.md +370 -0
  206. package/docs/components/steps/index.md +3 -0
  207. package/docs/components/steps/overview.md +63 -0
  208. package/docs/components/steps/use-cases.md +163 -0
  209. package/docs/components/switch/index.md +3 -0
  210. package/docs/components/switch/overview.md +75 -0
  211. package/docs/components/switch/reference.md +39 -0
  212. package/docs/components/switch/use-cases.md +76 -0
  213. package/docs/components/tabs/examples.md +23 -0
  214. package/docs/components/tabs/index.md +3 -0
  215. package/docs/components/tabs/overview.md +48 -0
  216. package/docs/components/tabs/src/lea-tab-panel.js +24 -0
  217. package/docs/components/tabs/src/lea-tab.js +45 -0
  218. package/docs/components/tabs/src/lea-tabs.js +28 -0
  219. package/docs/components/tabs/use-cases.md +219 -0
  220. package/docs/components/textarea/index.md +3 -0
  221. package/docs/components/textarea/overview.md +35 -0
  222. package/docs/components/textarea/use-cases.md +95 -0
  223. package/docs/components/tooltip/examples.md +39 -0
  224. package/docs/components/tooltip/index.md +3 -0
  225. package/docs/components/tooltip/overview.md +44 -0
  226. package/docs/components/tooltip/use-cases.md +208 -0
  227. package/docs/fundamentals/index.md +19 -0
  228. package/docs/fundamentals/node-tools/babel-plugin-extend-docs/index.md +1 -0
  229. package/docs/fundamentals/node-tools/babel-plugin-extend-docs/overview.md +233 -0
  230. package/docs/fundamentals/node-tools/index.md +1 -0
  231. package/docs/fundamentals/node-tools/providence-analytics/LocalConfiguration.md +68 -0
  232. package/docs/fundamentals/node-tools/providence-analytics/QueryResult.md +111 -0
  233. package/docs/fundamentals/node-tools/providence-analytics/analyzer.md +69 -0
  234. package/docs/fundamentals/node-tools/providence-analytics/assets/_mermaid.svg.js +1202 -0
  235. package/docs/fundamentals/node-tools/providence-analytics/dashboard.md +22 -0
  236. package/docs/fundamentals/node-tools/providence-analytics/index.md +1 -0
  237. package/docs/fundamentals/node-tools/providence-analytics/overview.md +192 -0
  238. package/docs/fundamentals/node-tools/publish-docs/index.md +1 -0
  239. package/docs/fundamentals/node-tools/publish-docs/overview.md +136 -0
  240. package/docs/fundamentals/node-tools/remark-extend/index.md +1 -0
  241. package/docs/fundamentals/node-tools/remark-extend/overview.md +274 -0
  242. package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/index.md +1 -0
  243. package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +285 -0
  244. package/docs/fundamentals/rationales/TypeScript.md +18 -0
  245. package/docs/fundamentals/rationales/index.md +1 -0
  246. package/docs/fundamentals/rationales/side-effects.md +203 -0
  247. package/docs/fundamentals/rationales/versioning.md +35 -0
  248. package/docs/fundamentals/systems/core/index.md +3 -0
  249. package/docs/fundamentals/systems/core/overview.md +85 -0
  250. package/docs/fundamentals/systems/form/assets/FormatMixinDiagram-1.svg +1 -0
  251. package/docs/fundamentals/systems/form/assets/FormatMixinDiagram-2.svg +1 -0
  252. package/docs/fundamentals/systems/form/assets/FormatMixinDiagram-3.svg +84 -0
  253. package/docs/fundamentals/systems/form/assets/h-output.js +155 -0
  254. package/docs/fundamentals/systems/form/formatting-and-parsing.md +245 -0
  255. package/docs/fundamentals/systems/form/index.md +3 -0
  256. package/docs/fundamentals/systems/form/interaction-states.md +177 -0
  257. package/docs/fundamentals/systems/form/model-value.md +35 -0
  258. package/docs/fundamentals/systems/form/overview.md +82 -0
  259. package/docs/fundamentals/systems/form/styling.md +101 -0
  260. package/docs/fundamentals/systems/form/use-cases.md +156 -0
  261. package/docs/fundamentals/systems/form/validate.md +929 -0
  262. package/docs/fundamentals/systems/icon/index.md +3 -0
  263. package/docs/fundamentals/systems/icon/overview.md +124 -0
  264. package/docs/fundamentals/systems/index.md +1 -0
  265. package/docs/fundamentals/systems/localize/assets/all-locales.js +437 -0
  266. package/docs/fundamentals/systems/localize/assets/en-AU.js +6 -0
  267. package/docs/fundamentals/systems/localize/assets/en-GB.js +6 -0
  268. package/docs/fundamentals/systems/localize/assets/en-US.js +6 -0
  269. package/docs/fundamentals/systems/localize/assets/en.js +4 -0
  270. package/docs/fundamentals/systems/localize/assets/nl-BE.js +6 -0
  271. package/docs/fundamentals/systems/localize/assets/nl-NL.js +6 -0
  272. package/docs/fundamentals/systems/localize/assets/nl.js +4 -0
  273. package/docs/fundamentals/systems/localize/dates.md +195 -0
  274. package/docs/fundamentals/systems/localize/index.md +3 -0
  275. package/docs/fundamentals/systems/localize/numbers.md +217 -0
  276. package/docs/fundamentals/systems/localize/overview.md +48 -0
  277. package/docs/fundamentals/systems/localize/rationale.md +62 -0
  278. package/docs/fundamentals/systems/localize/text.md +125 -0
  279. package/docs/fundamentals/systems/localize/use-cases.md +319 -0
  280. package/docs/fundamentals/systems/overlays/assets/applyDemoOverlayStyles.js +22 -0
  281. package/docs/fundamentals/systems/overlays/assets/demo-overlay-backdrop.js +48 -0
  282. package/docs/fundamentals/systems/overlays/assets/demo-overlay-system.js +42 -0
  283. package/docs/fundamentals/systems/overlays/assets/umbrella-form.js +133 -0
  284. package/docs/fundamentals/systems/overlays/configuration.md +453 -0
  285. package/docs/fundamentals/systems/overlays/form-integration.md +65 -0
  286. package/docs/fundamentals/systems/overlays/index.md +3 -0
  287. package/docs/fundamentals/systems/overlays/overview.md +118 -0
  288. package/docs/fundamentals/systems/overlays/rationale.md +232 -0
  289. package/docs/fundamentals/systems/overlays/scope.md +176 -0
  290. package/docs/fundamentals/systems/overlays/use-cases.md +699 -0
  291. package/docs/fundamentals/tools/ajax/assets/naga.json +9 -0
  292. package/docs/fundamentals/tools/ajax/assets/pabu.json +9 -0
  293. package/docs/fundamentals/tools/ajax/index.md +3 -0
  294. package/docs/fundamentals/tools/ajax/overview.md +128 -0
  295. package/docs/fundamentals/tools/ajax/use-cases.md +456 -0
  296. package/docs/fundamentals/tools/helpers/action-logger.md +165 -0
  297. package/docs/fundamentals/tools/helpers/index.md +3 -0
  298. package/docs/fundamentals/tools/helpers/overview.md +30 -0
  299. package/docs/fundamentals/tools/index.md +1 -0
  300. package/docs/fundamentals/tools/singleton-manager/index.md +3 -0
  301. package/docs/fundamentals/tools/singleton-manager/overview.md +304 -0
  302. package/docs/guides/how-to/create-a-custom-field.md +200 -0
  303. package/docs/guides/how-to/extend-a-native-input.md +66 -0
  304. package/docs/guides/how-to/get-started.md +77 -0
  305. package/docs/guides/how-to/index.md +1 -0
  306. package/docs/guides/index.md +34 -0
  307. package/docs/guides/principles/definitions-and-terms.md +41 -0
  308. package/docs/guides/principles/index.md +26 -0
  309. package/docs/guides/principles/scoped-elements.md +103 -0
  310. package/docs/guides/principles/styling.md +32 -0
  311. package/docs/guides/principles/subclasser-apis.md +28 -0
  312. package/docs/override.js +15 -0
  313. package/exports/core.js +2 -0
  314. package/exports/form-core.js +3 -0
  315. package/exports/input-tel-dropdown.js +3 -0
  316. package/exports/input-tel.js +2 -0
  317. package/exports/localize.js +4 -0
  318. package/exports/overlays.js +5 -0
  319. package/package.json +3 -2
@@ -0,0 +1,245 @@
1
+ # Systems >> Form >> Formatting and Parsing ||21
2
+
3
+ ```js script
4
+ import { html } from '@mdjs/mdjs-preview';
5
+ import '@lion/ui/define/lion-input.js';
6
+ import { Unparseable } from '@lion/ui/form-core.js';
7
+ import { liveFormatPhoneNumber } from '@lion/ui/input-tel.js';
8
+ import './assets/h-output.js';
9
+ ```
10
+
11
+ > For demo purposes, below we use `<lion-input>` which is a basic extension of `<lion-field>`.
12
+ > Almost all fields share the same functionality as `<lion-input>`.
13
+
14
+ ## Different values
15
+
16
+ The `FormatMixin` which is used in all lion fields automatically keeps track of:
17
+
18
+ - `modelValue`, which is a result of parsing
19
+ - `formattedValue`, which is a result of formatting
20
+ - `serializedValue`, which is a result of serializing
21
+
22
+ Our fields can automatically format/parse/serialize user input or an input set imperatively by an Application Developer.
23
+
24
+ Below are some concrete examples of implementations of formatters and parsers mimicking a (basic) amount input.
25
+
26
+ > For an actual amount input, check out [lion-input-amount](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/input-amount/overview.md).
27
+ > This comes with its own formatter, parser, serializer.
28
+
29
+ ### Parsers & modelValue
30
+
31
+ A parser should return a `modelValue`.
32
+
33
+ The `modelValue` is the result of the parser function.
34
+ It should be considered as the **internal value used for validation and reasoning/logic**.
35
+ The `modelValue` is 'ready for consumption' by the outside world (think of a Date object or a float).
36
+ The `modelValue` can (and is recommended to) be used as both input value and output value of the `<lion-input>`.
37
+
38
+ In essence, the `modelValue` acts as a Single Source of Truth in our form fields and therefore a single way of programmatical interaction.
39
+ Formatted values, serialized values and reflected-back view values are derived from it.
40
+
41
+ You can listen to `model-value-changed` event on all fields.
42
+ Internally this is also used as the main trigger for re-evaluating validation, visibility and interaction states.
43
+
44
+ Examples:
45
+
46
+ - For a `date input`: a String '20/01/1999' will be converted to new Date('1999/01/20')
47
+ - For an `amount input`: a formatted String '1.234,56' will be converted to a Number: 1234.56
48
+
49
+ You can set a parser function on the `<lion-input>` to set parsing behavior.
50
+ In this example, we parse the input and try to convert it to a `Number`.
51
+
52
+ ```js preview-story
53
+ export const parser = () => html`
54
+ <lion-input
55
+ label="Number Example"
56
+ help-text="Uses .parser to create model values from view values"
57
+ .parser="${viewValue => Number(viewValue)}"
58
+ .modelValue="${1234567890}"
59
+ @model-value-changed=${({ target }) => console.log(target)}
60
+ ></lion-input>
61
+ <h-output .show="${['modelValue']}"></h-output>
62
+ `;
63
+ ```
64
+
65
+ #### Unparseable
66
+
67
+ If a parser tries to parse and it returns undefined, the `modelValue` will be an instance of
68
+ `Unparseable`.
69
+
70
+ This object contains a type `'unparseable'`, and a `viewValue` which contains the String value of
71
+ what the user tried to input.
72
+
73
+ The formatted result of this that is reflected to the user will be the `viewValue` of the
74
+ `Unparseable` instance, so basically nothing happens for the user.
75
+
76
+ ```js preview-story
77
+ export const unparseable = () => html`
78
+ <lion-input
79
+ label="Number Example"
80
+ help-text="Uses .parser and return undefined if Number() cannot parse"
81
+ .parser="${viewValue => Number(viewValue) || undefined}"
82
+ value="${'1234abc567890'}"
83
+ ></lion-input>
84
+ <h-output .show="${['modelValue']}"></h-output>
85
+ `;
86
+ ```
87
+
88
+ ### Formatters
89
+
90
+ A formatter should return a `formattedValue`. It accepts the current modelValue and an options object.
91
+
92
+ Below is a very naive and limited parser that ignores non-digits. The formatter then uses `Intl.NumberFormat` to format it with group (thousand) separators.
93
+
94
+ Formatted value is reflected back to the user `on-blur` of the field, but only if the field has no errors (validation).
95
+
96
+ ```js preview-story
97
+ export const formatters = () => {
98
+ const formatDate = (modelValue, options) => {
99
+ if (!(typeof modelValue === 'number')) {
100
+ return options.formattedValue;
101
+ }
102
+ return new Intl.NumberFormat('en-GB').format(modelValue);
103
+ };
104
+ return html`
105
+ <lion-input
106
+ label="Number Example"
107
+ help-text="Uses .formatter to create view value"
108
+ .parser="${viewValue => Number(viewValue.replace(/[^0-9]/g, ''))}"
109
+ .formatter="${formatDate}"
110
+ .modelValue="${1234567890}"
111
+ >
112
+ </lion-input>
113
+ <h-output .show="${['modelValue', 'formattedValue']}"></h-output>
114
+ `;
115
+ };
116
+ ```
117
+
118
+ > The options object holds a fallback value that shows what should be presented on
119
+ > screen when the user input resulted in an invalid `modelValue`.
120
+
121
+ ### Serializers and deserializers
122
+
123
+ A serializer converts the `modelValue` to a `serializedValue`. In this example, we decide we want to store the user input to our hypothetical database, but by parsing it with radix 8 first.
124
+
125
+ A deserializer converts a value, for example one received from an API, to a `modelValue`. This can be useful for prefilling forms with data from APIs.
126
+
127
+ > There is no `.deserializedValue` property that stays in sync by default.
128
+ > You need to call `el.deserializer(el.modelValue)` manually yourself.
129
+
130
+ ```js preview-story
131
+ export const deserializers = () => {
132
+ const mySerializer = (modelValue, options) => {
133
+ return parseInt(modelValue, 8);
134
+ };
135
+ const myDeserializer = (myValue, options) => {
136
+ return new Number(myValue);
137
+ };
138
+ return html`
139
+ <lion-input
140
+ label="Date Example"
141
+ help-text="Uses .(de)serializer to restore serialized modelValues"
142
+ .parser="${viewValue => Number(viewValue.replace(/[^0-9]/g, ''))}"
143
+ .serializer="${mySerializer}"
144
+ .deserializer="${myDeserializer}"
145
+ .modelValue="${1234567890}"
146
+ ></lion-input>
147
+ <h-output .show="${['modelValue', 'serializedValue']}"></h-output>
148
+ `;
149
+ };
150
+ ```
151
+
152
+ ### Preprocessors
153
+
154
+ A preprocessor converts the user input immediately on input.
155
+ This makes it useful for preventing invalid input or doing other processing tasks before the viewValue hits the parser.
156
+
157
+ In the example below, we do not allow you to write digits.
158
+
159
+ ```js preview-story
160
+ export const preprocessors = () => {
161
+ const preprocess = value => {
162
+ return value.replace(/[0-9]/g, '');
163
+ };
164
+ return html`
165
+ <lion-input
166
+ label="Date Example"
167
+ help-text="Uses .preprocessor to prevent digits"
168
+ .preprocessor=${preprocess}
169
+ ></lion-input>
170
+ <h-output .show="${['modelValue']}"></h-output>
171
+ `;
172
+ };
173
+ ```
174
+
175
+ ### Live formatters
176
+
177
+ Live formatters are a specific type of preprocessor, that format a view value during typing.
178
+ Examples:
179
+
180
+ - a phone number that, during typing formats `+316` as `+31 6`
181
+ - a date that follows a date mask and automatically inserts '-' characters
182
+
183
+ Type '6' in the example below and see that a space will be added and the caret in the text box
184
+ will be automatically moved along.
185
+
186
+ ```js preview-story
187
+ export const liveFormatters = () => {
188
+ return html`
189
+ <lion-input
190
+ label="Live Format"
191
+ .modelValue="${new Unparseable('+31')}"
192
+ help-text="Uses .preprocessor to format during typing"
193
+ .preprocessor=${(viewValue, { currentCaretIndex, prevViewValue }) => {
194
+ return liveFormatPhoneNumber(viewValue, {
195
+ regionCode: 'NL',
196
+ formatStrategy: 'international',
197
+ currentCaretIndex,
198
+ prevViewValue,
199
+ });
200
+ }}
201
+ ></lion-input>
202
+ <h-output .show="${['modelValue']}"></h-output>
203
+ `;
204
+ };
205
+ ```
206
+
207
+ Note that these live formatters need to make an educated guess based on the current (incomplete) view
208
+ value what the users intentions are. When implemented correctly, they can create a huge improvement
209
+ in user experience.
210
+ Next to a changed viewValue, they are also responsible for taking care of the
211
+ caretIndex. For instance, if `+316` is changed to `+31 6`, the caret needs to be moved one position
212
+ to the right (to compensate for the extra inserted space).
213
+
214
+ #### When to use a live formatter and when a regular formatter?
215
+
216
+ Although it might feel more logical to configure live formatters inside the `.formatter` function,
217
+ it should be configured inside the `.preprocessor` function. The table below shows differences
218
+ between the two mentioned methods
219
+
220
+ | Function | Value type recieved | Reflected back to user on | Supports incomplete values | Supports caret index |
221
+ | :------------ | :------------------ | :------------------------ | :------------------------- | :------------------- |
222
+ | .formatter | modelValue | blur (leave) | No | No |
223
+ | .preprocessor | viewValue | keyup (live) | Yes | Yes |
224
+
225
+ ## Flow Diagrams
226
+
227
+ Below we show three flow diagrams to show the flow of formatting, serializing and parsing user input, with the example of a date input:
228
+
229
+ ### Standard flow
230
+
231
+ Where a user changes the input with their keyboard:
232
+
233
+ ![Standard flow](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/fundamentals/systems/form/assets/FormatMixinDiagram-1.svg 'Standard flow')
234
+
235
+ ### Unparseable flow
236
+
237
+ Where a user sets the input to something that is not parseable by the parser:
238
+
239
+ ![Unparseable flow](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/fundamentals/systems/form/assets/FormatMixinDiagram-2.svg 'Unparseable flow')
240
+
241
+ ### Imperative / programmatic flow
242
+
243
+ Where the developer sets the modelValue of the input programmatically:
244
+
245
+ ![Imperative flow](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/fundamentals/systems/form/assets/FormatMixinDiagram-3.svg 'Imperative flow')
@@ -0,0 +1,3 @@
1
+ # Systems >> Form ||20
2
+
3
+ -> go to Overview
@@ -0,0 +1,177 @@
1
+ # Systems >> Form >> Interaction States ||22
2
+
3
+ ```js script
4
+ import { html, render } from '@mdjs/mdjs-preview';
5
+ import { renderLitAsNode } from '@lion/ui/helpers.js';
6
+ import '@lion/ui/define/lion-input.js';
7
+ import '@lion/ui/define/lion-input-date.js';
8
+ import { Validator, Unparseable, MinDate, Required } from '@lion/ui/form-core.js';
9
+ import './assets/h-output.js';
10
+ ```
11
+
12
+ `InteractionStateMixin` saves meta information about interaction states.
13
+ It allows for creating advanced UX scenarios.
14
+
15
+ Examples of such scenarios already in our fields:
16
+
17
+ - Show the validation message of an input only after the user has blurred the input field
18
+ - Hide the validation message when an invalid value becomes valid
19
+
20
+ Something our subclassers can implement:
21
+
22
+ - Show a red border around the input right after the input became invalid
23
+
24
+ The meta information that InteractionStateMixin collects, is stored in the Boolean properties on our fields:
25
+
26
+ - `touched`, the user blurred the field.
27
+ - `dirty`, the value in the field has changed.
28
+ - `prefilled`, a prepopulated field is not empty.
29
+
30
+ > You can listen to the events `touched-changed` and `dirty-changed`.
31
+
32
+ ```js preview-story
33
+ export const interactionStates = () => html`
34
+ <lion-input
35
+ label="Interaction States"
36
+ help-text="Interact with this field to see how dirty, touched and prefilled change"
37
+ .modelValue="${'myValue'}"
38
+ ></lion-input>
39
+ <h-output .show="${['touched', 'dirty', 'prefilled', 'focused', 'submitted']}"></h-output>
40
+ `;
41
+ ```
42
+
43
+ ## Advanced use cases
44
+
45
+ ### Overriding interaction states
46
+
47
+ When creating an extension of LionField or LionInput, it can be needed to override the way prefilled values are 'computed'.
48
+
49
+ The example below shows how this is done for checkboxes/radio-inputs.
50
+
51
+ ```js
52
+ /**
53
+ * @override
54
+ */
55
+ static _isPrefilled(modelValue) {
56
+ return modelValue.checked;
57
+ }
58
+ ```
59
+
60
+ ## When is feedback shown to the user
61
+
62
+ We show the validity feedback when one of the following conditions is met:
63
+
64
+ - **prefilled**,
65
+ the user already filled in something, or the value is prefilled
66
+ when the form is initially rendered.
67
+
68
+ - **touched** && **dirty**
69
+
70
+ - When a user starts typing for the first time in a field with for instance `required` validation,
71
+ error message should not be shown until a field becomes `touched` (a user leaves(blurs) a field).
72
+ - When a user enters a field without altering the value (making it `dirty` but not `touched`),
73
+ an error message shouldn't be shown either.
74
+
75
+ - **submitted**,
76
+ if the form is submitted, always show the error message.
77
+
78
+ ### Changing the feedback show condition (Subclassers)
79
+
80
+ You can change the condition upon which feedback gets shown.
81
+
82
+ In order to override the feedback show conditions, you need to create a custom field and override `_showFeedbackConditionFor` method.
83
+ This method accepts the a `type` parameter which is a String representing the type of feedback (e.g. 'error').
84
+ Then, it returns true of false, depending on whether feedback for that type should be shown or not. That part, you can control.
85
+
86
+ In the following example we will demonstrate this with interaction states, the most common use case for feedback visibility conditions.
87
+
88
+ ```js preview-story
89
+ export const feedbackCondition = () => {
90
+ // 1. Initialize variables
91
+ // properties we want to check conditions for
92
+ const props = ['touched', 'dirty', 'prefilled', 'focused', 'filled', 'submitted'];
93
+
94
+ // 2. Create a validator
95
+ class OddValidator extends Validator {
96
+ static get validatorName() {
97
+ return 'OddValidator';
98
+ }
99
+ // eslint-disable-next-line class-methods-use-this
100
+ execute(value) {
101
+ let hasError = false;
102
+ if (!(value.length % 2 !== 0)) {
103
+ hasError = true;
104
+ }
105
+ return hasError;
106
+ }
107
+ _getMessage() {
108
+ return 'Add or remove one character';
109
+ }
110
+ }
111
+ // 3. Create field that applies the validator and store the node reference
112
+ const fieldElement = renderLitAsNode(html`
113
+ <lion-input
114
+ name="interactionField"
115
+ label="Only an odd amount of characters allowed"
116
+ help-text="Change feedback condition"
117
+ .modelValue="${'notodd'}"
118
+ .validators="${[new OddValidator()]}"
119
+ ></lion-input>
120
+ `);
121
+
122
+ // 4. When checkboxes change, set the feedbackCondition method to a new method that checks
123
+ // whether every condition that is checked, is true on the field. Otherwise, don't show the feedback.
124
+ const fetchConditionsAndReevaluate = ({ currentTarget: { modelValue } }) => {
125
+ fieldElement._showFeedbackConditionFor = type => {
126
+ return modelValue.every(condition => fieldElement[condition]);
127
+ };
128
+ fieldElement.validate();
129
+ };
130
+
131
+ return html`
132
+ <lion-form>
133
+ <form>
134
+ ${fieldElement}
135
+ <button>Submit</button>
136
+ </form>
137
+ </lion-form>
138
+ <h-output .field="${fieldElement}" .show="${[...props, 'hasFeedbackFor']}"> </h-output>
139
+ <h3>Set conditions for validation feedback visibility</h3>
140
+ <lion-checkbox-group name="props[]" @model-value-changed="${fetchConditionsAndReevaluate}">
141
+ ${props.map(p => html` <lion-checkbox .label="${p}" .choiceValue="${p}"> </lion-checkbox> `)}
142
+ </lion-checkbox-group>
143
+ `;
144
+ };
145
+ ```
146
+
147
+ ### Changing the feedback show condition (Application Developers)
148
+
149
+ In some situations, the default condition for showing feedback messages might not apply.
150
+ The conditions as described in 'When is feedback shown to the user' can be overidden via
151
+ the `feedbackCondition` method.
152
+ In this example, we want to implement the following situation:
153
+
154
+ - for an `input-date`, we have a MinDate condition
155
+ - we want to send feedback as soon as we know the user intentionally typed a full Date
156
+ (we know if modelValue is not Unparseable)
157
+
158
+ ```js preview-story
159
+ export const feedbackVisibility = () => html`
160
+ <lion-input-date
161
+ .validators="${[
162
+ new Required(),
163
+ new MinDate(new Date('2000/10/10'), {
164
+ getMessage: () => `You provided a correctly formatted date, but it's below MinData`,
165
+ }),
166
+ ]}"
167
+ .feedbackCondition="${(type, meta, originalCondition) => {
168
+ if (meta.modelValue && !(meta.modelValue instanceof Unparseable)) {
169
+ return true;
170
+ }
171
+ return originalCondition(type, meta);
172
+ }}"
173
+ help-text="Error appears as soon as a Parseable date before 10/10/2000 is typed"
174
+ label="Custom feedback visibility"
175
+ ></lion-input-date>
176
+ `;
177
+ ```
@@ -0,0 +1,35 @@
1
+ # Systems >> Form >> ModelValue ||20
2
+
3
+ The modelValue or model can be considered as the ‘aorta’ of our form system.
4
+ It is the single source of truth; not only for the current state
5
+ of the form, also for all derived states: interaction, validation, visibility and other states are
6
+ computed from a modelValue change.
7
+
8
+ ## Single source of truth
9
+
10
+ ModelValues are designed to provide the Application Developer a single way of programmatical
11
+ interaction with the form for an Application Developer.
12
+
13
+ ### One single concept for Application Developers
14
+
15
+ Application Developers need to only care about interacting with the modelValue on a form control
16
+ level, via:
17
+
18
+ - `.modelValue`
19
+ - `@model-value-changed`
20
+
21
+ > Internal/private concepts like viewValue, formattedValue, serializedValue are therefore not
22
+ > recommended as a means of interaction.
23
+
24
+ For more information about parsing and the Unparseable type, see [Formatting and Parsing](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/fundamentals/systems/form/formatting-and-parsing.md)
25
+
26
+ ### Event meta
27
+
28
+ `model-value-changed` events have a `detail` object, containing the following meta data:
29
+
30
+ - `isTriggeredByUser`: a boolean that determines whether a change originated
31
+ from a user or was triggered programmatically
32
+ - `formPath`: an array of FormControls. It contains the path an event follows to go from a 'leaf
33
+ element' (for instance a lion-input) to a top element (for instance lion-form). An example path
34
+ could be [lionForm, lionFieldset, lionInput]
35
+ - `initialize`: whether this is the first time the event is fired (on first render of the FormControl)
@@ -0,0 +1,82 @@
1
+ # Systems >> Form >> Overview ||10
2
+
3
+ This page should be used as a starting point when first using the Form System.
4
+ It provides an overview of its essential building blocks and provides links to detailed explanations of most of its core concepts.
5
+
6
+ ## Building Blocks
7
+
8
+ Our Form System is built from a set of very fundamental building blocks: `form control`s, `field`s and `fieldset`s.
9
+
10
+ ### Form Controls
11
+
12
+ `Form control`s are the most fundamental building blocks of our Form System.
13
+ They are the fundament of both `field`s, and `fieldset`s and provide a normalized, predictable API throughout the whole form. Every form element inherits from `FormControlMixin`.
14
+
15
+ `FormControlMixin` creates the default html structure and accessibility is designed to be used in conjunction with the ValidateMixin and the FormatMixin.
16
+
17
+ ## Fields
18
+
19
+ Fields (think of an input, textarea, select) are the actual form controls the end user interacts with. They extend `LionField`, which in turn uses the `FormControlMixin`. Fields provide a normalized API for both platform components and custom made form controls.
20
+
21
+ On top of this, they feature:
22
+
23
+ - [formatting/parsing/serializing](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/fundamentals/systems/form/formatting-and-parsing.md) of view values.
24
+ - Advanced [validation](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/fundamentals/systems/form/validate.md) possibilities.
25
+ - Creation of advanced user interaction scenarios via [interaction states](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/fundamentals/systems/form/interaction-states.md).
26
+ - Provision of labels and help texts in an easy, declarative manner.
27
+ - Accessibility out of the box.
28
+ - Advanced styling possibilities: map your own Design System to the internal HTML structure.
29
+ `Form control`s are the most fundamental building block of the Forms. They are the basis of
30
+ both `field`s and `fieldset`s, and the `form` itself.
31
+
32
+ ### Platform fields (wrappers)
33
+
34
+ - [LionInput](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/input/overview.md), a wrapper for `<input>`.
35
+ - [LionTextarea](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/textarea/overview.md), a wrapper for `<textarea>`.
36
+ - [LionSelect](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/select/overview.md), a wrapper for `<select>`.
37
+
38
+ ### Custom fields (wrappers)
39
+
40
+ Whenever a native form control doesn't exist or is not sufficient, a [custom form field](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/guides/how-to/create-a-custom-field.md) should be created. One could think of components like:
41
+
42
+ - [LionCombobox](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/combobox/overview.md), a custom implementation of a combobox.
43
+ - [LionDate](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/input-date/overview.md), an alternative for `<input type="date">`.
44
+ - [LionDatepicker](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/input-datepicker/overview.md), an alternative for `<input type="date">` including a calendar dropdown.
45
+ - [LionListbox](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/listbox/overview.md), a custom implementation of a listbox.
46
+ - [LionInputAmount](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/input-amount/overview.md), an alternative for `<input type="number">` special for amounts.
47
+ - [LionInputEmail](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/input-email/overview.md), an alternative for `<input type="email">`.
48
+ - [LionInputIban](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/input-iban/overview.md), an ING specific for an input with IBAN numbers.
49
+ - [LionInputRange](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/input-range/overview.md), an alternative for `<input type="range">`.
50
+ - [LionInputStepper](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/input-stepper/overview.md), an alternative for `<input type="number">`.
51
+ - [LionSelectRich](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/select-rich/overview.md), an alternative for `<select>` with multiline options.
52
+
53
+ ### Choice Input Fields
54
+
55
+ For form controls which return a `checked-state` you can use the `lion-choice-input` mixin. It is used in:
56
+
57
+ - [LionCheckbox](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/checkbox-group/overview.md), a wrapper for `<input type="checkbox">`.
58
+ - LionOption, an alternative for `<option>`.
59
+ - [LionRadio](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/radio-group/overview.md), a wrapper for `<input type="radio">`.
60
+ - [LionSwitch](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/switch/overview.md), a custom implementation of a switch.
61
+
62
+ Which contains the following features:
63
+
64
+ - Get or set the value of the choice - `choiceValue()`.
65
+ - Get or set the modelValue (value and checked-state) of the choice - `.modelValue`.
66
+ - Pre-select an option by setting the `checked` boolean attribute.
67
+
68
+ ## Fieldsets
69
+
70
+ Fieldsets are groups of fields. They can be considered fields on their own as well, since they partly share the normalized API via `FormControlMixin`. Fieldsets are the basis for:
71
+
72
+ - [LionFieldset](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/fieldset/overview.md), a wrapper around multiple input fields or other fieldsets.
73
+ - [LionForm](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/form/overview.md), enhances the functionality of the native `<form>` component.
74
+ - [LionCheckboxGroup](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/checkbox-group/overview.md), a wrapper component for multiple checkboxes.
75
+ - [LionRadioGroup](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/components/radio-group/overview.md), a wrapper component for multiple radio inputs.
76
+
77
+ ## Other Resources
78
+
79
+ - [Model Value](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/fundamentals/systems/form/model-value.md)
80
+ - [Formatting and parsing](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/fundamentals/systems/form/formatting-and-parsing.md)
81
+ - [Interaction states](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/fundamentals/systems/form/interaction-states.md)
82
+ - [Validation System](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/fundamentals/systems/form/validate.md)
@@ -0,0 +1,101 @@
1
+ # Systems >> Form >> Styling ||40
2
+
3
+ ```js script
4
+ import { html } from '@mdjs/mdjs-preview';
5
+ import '@lion/ui/define/lion-input.js';
6
+ import '@lion/ui/define/lion-button.js';
7
+ ```
8
+
9
+ ## Label
10
+
11
+ Can be provided via the `label` attribute, but the slot can be used to change the `html` and `CSS` of the label.
12
+ For example add an `u-sr-only` class to the label to make it (partially) visually hidden.
13
+ A label is always needed for accessibility reasons.
14
+
15
+ ```js preview-story
16
+ export const label = () => html`
17
+ <style>
18
+ .u-sr-only {
19
+ position: absolute;
20
+ top: 0;
21
+ width: 1px;
22
+ height: 1px;
23
+ overflow: hidden;
24
+ clip-path: inset(100%);
25
+ clip: rect(1px, 1px, 1px, 1px);
26
+ white-space: nowrap;
27
+ border: 0;
28
+ margin: 0;
29
+ padding: 0;
30
+ }
31
+ </style>
32
+ <lion-input>
33
+ <label slot="label"
34
+ >Label <span class="u-sr-only">partially only visible for screen-readers</span></label
35
+ >
36
+ </lion-input>
37
+ `;
38
+ ```
39
+
40
+ ## Prefix
41
+
42
+ The prefix is used for addons to the input like a minus button in the `input-stepper`.
43
+
44
+ ```js preview-story
45
+ export const prefix = () => html`
46
+ <lion-input label="Prefix">
47
+ <div slot="prefix">[prefix]</div>
48
+ </lion-input>
49
+ `;
50
+ ```
51
+
52
+ ## Suffix
53
+
54
+ The suffix can be used for addons to the input like a calculator, datepicker or addressbook.
55
+ In these cases a button with an icon is used.
56
+
57
+ ```js preview-story
58
+ export const suffix = () => html`
59
+ <lion-input label="Suffix">
60
+ <div slot="suffix">[suffix]</div>
61
+ </lion-input>
62
+ `;
63
+ ```
64
+
65
+ ## Before
66
+
67
+ > Before slot does not have an active use case yet.
68
+
69
+ ```js preview-story
70
+ export const before = () => html`
71
+ <lion-input label="Before">
72
+ <div slot="before">[before]</div>
73
+ </lion-input>
74
+ `;
75
+ ```
76
+
77
+ ## After
78
+
79
+ ```js preview-story
80
+ export const after = () => html`
81
+ <lion-input label="Amount">
82
+ <div slot="after">EUR</div>
83
+ </lion-input>
84
+ <lion-input label="Percentage">
85
+ <div slot="after">%</div>
86
+ </lion-input>
87
+ `;
88
+ ```
89
+
90
+ ### Examples
91
+
92
+ Due to our custom inputs being Web Components, it is possible to put HTML content inside an input. For example if you want to add a button as a prefix or suffix.
93
+
94
+ ```js preview-story
95
+ export const ButtonsWithFields = () => html`
96
+ <lion-input label="Prefix and suffix">
97
+ <lion-button slot="prefix">prefix</lion-button>
98
+ <lion-button slot="suffix">suffix</lion-button>
99
+ </lion-input>
100
+ `;
101
+ ```