@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,3 @@
1
+ # Accordion
2
+
3
+ -> go to Overview
@@ -0,0 +1,129 @@
1
+ # Accordion >> Overview ||10
2
+
3
+ <p class="lion-paragraph--emphasis">An accordion is a vertically stacked set of interactive headings that each contain a title representing a section of content. It allows users to toggle the display of sections of content.</p>
4
+
5
+ ```js script
6
+ import { html as previewHtml } from '@mdjs/mdjs-preview';
7
+ ```
8
+
9
+ ```js preview-story
10
+ import { html, LitElement } from 'lit';
11
+ import { ScopedElementsMixin } from '@open-wc/scoped-elements';
12
+ import { LionAccordion } from '@lion/ui/accordion.js';
13
+
14
+ class MyComponent extends ScopedElementsMixin(LitElement) {
15
+ static get scopedElements() {
16
+ return { 'lion-accordion': LionAccordion };
17
+ }
18
+ render() {
19
+ return html`
20
+ <lion-accordion>
21
+ <h3 slot="invoker">
22
+ <button>Sensory Factors</button>
23
+ </h3>
24
+ <div slot="content">
25
+ <p>
26
+ The taste of oranges is determined mainly by the relative ratios of sugars and acids,
27
+ whereas orange aroma derives from volatile organic compounds, including alcohols,
28
+ aldehydes, ketones, terpenes, and esters. Bitter limonoid compounds, such as limonin,
29
+ decrease gradually during development, whereas volatile aroma compounds tend to peak in
30
+ mid– to late–season development. Taste quality tends to improve later in harvests when
31
+ there is a higher sugar/acid ratio with less bitterness. As a citrus fruit, the orange
32
+ is acidic, with pH levels ranging from 2.9 to 4.0. <a href="#">Link</a>
33
+ </p>
34
+ <p>
35
+ Sensory qualities vary according to genetic background, environmental conditions during
36
+ development, ripeness at harvest, postharvest conditions, and storage duration.
37
+ </p>
38
+ </div>
39
+ <h3 slot="invoker">
40
+ <button>Nutritional value</button>
41
+ </h3>
42
+ <div slot="content">
43
+ Orange flesh is 87% water, 12% carbohydrates, 1% protein, and contains negligible fat
44
+ (table). In a 100 gram reference amount, orange flesh provides 47 calories, and is a rich
45
+ source of vitamin C, providing 64% of the Daily Value. No other micronutrients are present
46
+ in significant amounts (table).
47
+ </div>
48
+ </lion-accordion>
49
+ `;
50
+ }
51
+ }
52
+
53
+ customElements.define('my-component', MyComponent);
54
+
55
+ export const overview = () => previewHtml`<my-component></my-component>`;
56
+ ```
57
+
58
+ ## When to use
59
+
60
+ - Accordions are commonly used to reduce the need to scroll when presenting multiple sections of content on a single page
61
+ - Longer pages can benefit users. Accordions shorten pages and reduce scrolling, but they increase the interaction cost by requiring people to decide on topic headings.
62
+ - Accordions conserve space on mobile but they can also cause disorientation and too much scrolling.
63
+ - Accordions should be avoided when your audience needs most or all of the content on the page to answer their question. Better to show all page content at once when the use case supports it.
64
+ - Accordions are more suitable when people need only a few key pieces of content on a single page. By hiding most of the content, users can spend their time more efficiently focused on the few topics that matter.
65
+
66
+ ## Features
67
+
68
+ - Content gets provided by users (slotted in)
69
+ - Handles accessibility
70
+ - Support navigation via keyboard
71
+
72
+ ## How to use
73
+
74
+ ### Code
75
+
76
+ 1. Install
77
+
78
+ ```bash
79
+ npm i --save @lion/ui
80
+ ```
81
+
82
+ 2. Use scoped registry
83
+
84
+ ```js
85
+ import { html, LitElement } from 'lit';
86
+ import { ScopedElementsMixin } from '@open-wc/scoped-elements';
87
+ import { LionAccordion } from '@lion/ui/accordion.js';
88
+
89
+ class MyComponent extends ScopedElementsMixin(LitElement) {
90
+ static get scopedElements() {
91
+ return { 'lion-accordion': LionAccordion };
92
+ }
93
+ render() {
94
+ return html`
95
+ <lion-accordion>
96
+ <h3 slot="invoker">
97
+ <button>Nutritional value</button>
98
+ </h3>
99
+ <p slot="content">
100
+ Orange flesh is 87% water, 12% carbohydrates, 1% protein, and contains negligible fat
101
+ (table). In a 100 gram reference amount, orange flesh provides 47 calories, and is a rich
102
+ source of vitamin C, providing 64% of the Daily Value. No other micronutrients are present
103
+ in significant amounts (table).
104
+ </p>
105
+ </lion-accordion>
106
+ `;
107
+ }
108
+ }
109
+ ```
110
+
111
+ 3. Use html
112
+
113
+ ```html
114
+ <script type="module">
115
+ import '@lion/ui/define/lion-accordion.js';
116
+ </script>
117
+
118
+ <lion-accordion>
119
+ <h3 slot="invoker">
120
+ <button>Nutritional value</button>
121
+ </h3>
122
+ <p slot="content">
123
+ Orange flesh is 87% water, 12% carbohydrates, 1% protein, and contains negligible fat (table).
124
+ In a 100 gram reference amount, orange flesh provides 47 calories, and is a rich source of
125
+ vitamin C, providing 64% of the Daily Value. No other micronutrients are present in significant
126
+ amounts (table).
127
+ </p>
128
+ </lion-accordion>
129
+ ```
@@ -0,0 +1,47 @@
1
+ # Accordion >> Reference ||30
2
+
3
+ <p class="lion-paragraph--emphasis">Everything you need to re-use the accordion.</p>
4
+
5
+ ## Requirements
6
+
7
+ This component fulfils the following requirements:
8
+
9
+ 1. An Accordion lets you toggle the visibility of content for a specific section
10
+ 2. An Accordion contains a visual indicator/icon as an affordance to toggle the visibility of the content
11
+ 3. Every section consists of a section title (always visible) and section content (visible when expanded)
12
+ 4. The individual sections (title + content) are clearly grouped
13
+ 5. Multiple sections can be expanded at the same time
14
+ 6. The section heading (title + visual indicator) is used as the interaction trigger
15
+ 7. An Accordion does not reposition the page when content drops out of the viewport when expanding a section (no auto scrolling)
16
+
17
+ ## Rationale
18
+
19
+ ### Contents are not focusable
20
+
21
+ Focusable elements should be interactive. Contents themselves do not offer any interactivity.
22
+ If there is a button or a form inside the tab panel then these elements get focused directly.
23
+
24
+ ## Keyboard interactions
25
+
26
+ | <kbd>Key</kbd> | Action |
27
+ | :--------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
28
+ | <kbd>Enter or Spacebar</kbd> | When focus is on the accordion header for a collapsed panel, expands the associated panel. When focus is on the accordion header for an expanded panel, collapses the panel if the implementation supports collapsing |
29
+ | <kbd>Tab</kbd> | Moves focus to the next focusable element; all focusable elements in the accordion are included in the page Tab sequence. |
30
+ | <kbd>Shift+Tab</kbd> | Moves focus to the previous focusable element; all focusable elements in the accordion are included in the page Tab sequence. |
31
+ | <kbd>Down arrow </kbd> | If focus is on an accordion header, moves focus to the next accordion header. If focus is on the last accordion header, either does nothing or moves focus to the first accordion header. |
32
+ | <kbd>Up arrow</kbd> | If focus is on an accordion header, moves focus to the previous accordion header. If focus is on the first accordion header, either does nothing or moves focus to the last accordion header. |
33
+ | <kbd>Home</kbd> | When focus is on an accordion header, moves focus to the first accordion header. |
34
+ | <kbd>End</kbd> | When focus is on an accordion header, moves focus to the last accordion header. |
35
+
36
+ ## WAI-ARIA roles
37
+
38
+ - The title of each accordion header is contained in an element with role button.
39
+ - Each accordion header button is wrapped in an element with role heading that has a value set for aria-level that is appropriate for the information architecture of the page.
40
+ - If the native host language has an element with an implicit heading and aria-level, such as an HTML heading tag, a native host language element may be used.
41
+ - The button element is the only element inside the heading element. That is, if there are other visually persistent elements, they are not included inside the heading element.
42
+ - If the accordion panel associated with an accordion header is visible, the header button element has aria-expanded set to true. If the panel is not visible, aria-expanded is set to false.
43
+ - The accordion header button element has aria-controls set to the ID element containing the accordion panel content.
44
+ - If the accordion panel associated with an accordion header is visible, and if the accordion does not permit the panel to be collapsed, the header button element has aria-disabled set to true.
45
+ - Optionally, each element that serves as a container for panel content has role region and aria-labelledby with a value that refers to the button that controls display of the panel.
46
+ - Avoid using the region role in circumstances that create landmark region proliferation, e.g. in an accordion that contains more than approximately 6 panels that can be expanded at the same time.
47
+ - Role region is especially helpful to the perception of structure by screen reader users when panels contain heading elements or a nested accordion.
@@ -0,0 +1,252 @@
1
+ # Accordion >> Use Cases ||20
2
+
3
+ ```js script
4
+ import { html as previewHtml } from '@mdjs/mdjs-preview';
5
+
6
+ import '@lion/ui/define/lion-accordion.js';
7
+ ```
8
+
9
+ ## Default Accordion collapsed
10
+
11
+ All accordion panels are collapsed by default.
12
+
13
+ ```html preview-story
14
+ <lion-accordion>
15
+ <h3 slot="invoker">
16
+ <button>Sensory Factors</button>
17
+ </h3>
18
+ <div slot="content" class="lion-paragraph-container">
19
+ <p>
20
+ The taste of oranges is determined mainly by the relative ratios of sugars and acids, whereas
21
+ orange aroma derives from volatile organic compounds, including alcohols, aldehydes, ketones,
22
+ terpenes, and esters. Bitter limonoid compounds, such as limonin, decrease gradually during
23
+ development, whereas volatile aroma compounds tend to peak in mid– to late–season development.
24
+ Taste quality tends to improve later in harvests when there is a higher sugar/acid ratio with
25
+ less bitterness. As a citrus fruit, the orange is acidic, with pH levels ranging from 2.9 to
26
+ 4.0.
27
+ </p>
28
+
29
+ <p>
30
+ Sensory qualities vary according to genetic background, environmental conditions during
31
+ development, ripeness at harvest, postharvest conditions, and storage duration.
32
+ </p>
33
+ </div>
34
+ <h3 slot="invoker">
35
+ <button>Nutritional value</button>
36
+ </h3>
37
+ <div slot="content">
38
+ Orange flesh is 87% water, 12% carbohydrates, 1% protein, and contains negligible fat (table).
39
+ In a 100 gram reference amount, orange flesh provides 47 calories, and is a rich source of
40
+ vitamin C, providing 64% of the Daily Value. No other micronutrients are present in significant
41
+ amounts (table).
42
+ </div>
43
+ </lion-accordion>
44
+ ```
45
+
46
+ ## Expanded
47
+
48
+ Multiple accordion panels can be expanded at the same time. When content drops out of the viewport when expanding an accordion panel, the accordion does not reposition the page (no autoscrolling).
49
+
50
+ ```html preview-story
51
+ <lion-accordion expanded="[1]">
52
+ <h3 slot="invoker">
53
+ <button>Sensory Factors</button>
54
+ </h3>
55
+ <div slot="content" class="lion-paragraph-container">
56
+ <p>
57
+ The taste of oranges is determined mainly by the relative ratios of sugars and acids, whereas
58
+ orange aroma derives from volatile organic compounds, including alcohols, aldehydes, ketones,
59
+ terpenes, and esters. Bitter limonoid compounds, such as limonin, decrease gradually during
60
+ development, whereas volatile aroma compounds tend to peak in mid– to late–season development.
61
+ Taste quality tends to improve later in harvests when there is a higher sugar/acid ratio with
62
+ less bitterness. As a citrus fruit, the orange is acidic, with pH levels ranging from 2.9 to
63
+ 4.0.
64
+ </p>
65
+
66
+ <p>
67
+ Sensory qualities vary according to genetic background, environmental conditions during
68
+ development, ripeness at harvest, postharvest conditions, and storage duration.
69
+ </p>
70
+ </div>
71
+ <h3 slot="invoker">
72
+ <button>Nutritional value</button>
73
+ </h3>
74
+ <div slot="content">
75
+ Orange flesh is 87% water, 12% carbohydrates, 1% protein, and contains negligible fat (table).
76
+ In a 100 gram reference amount, orange flesh provides 47 calories, and is a rich source of
77
+ vitamin C, providing 64% of the Daily Value. No other micronutrients are present in significant
78
+ amounts (table).
79
+ </div>
80
+ </lion-accordion>
81
+ ```
82
+
83
+ ## Slots Order
84
+
85
+ The invoker and content slots are ordered by DOM order. This means you can put all invoker nodes at the top followed by all container nodes and it will still retain the correct order.
86
+
87
+ ```html preview-story
88
+ <lion-accordion>
89
+ <h3 slot="invoker">
90
+ <button>Sensory Factors</button>
91
+ </h3>
92
+ <h3 slot="invoker">
93
+ <button>Nutritional value</button>
94
+ </h3>
95
+ <div slot="content" class="lion-paragraph-container">
96
+ <p>
97
+ The taste of oranges is determined mainly by the relative ratios of sugars and acids, whereas
98
+ orange aroma derives from volatile organic compounds, including alcohols, aldehydes, ketones,
99
+ terpenes, and esters. Bitter limonoid compounds, such as limonin, decrease gradually during
100
+ development, whereas volatile aroma compounds tend to peak in mid– to late–season development.
101
+ Taste quality tends to improve later in harvests when there is a higher sugar/acid ratio with
102
+ less bitterness. As a citrus fruit, the orange is acidic, with pH levels ranging from 2.9 to
103
+ 4.0.
104
+ </p>
105
+
106
+ <p>
107
+ Sensory qualities vary according to genetic background, environmental conditions during
108
+ development, ripeness at harvest, postharvest conditions, and storage duration.
109
+ </p>
110
+ </div>
111
+ <div slot="content">
112
+ Orange flesh is 87% water, 12% carbohydrates, 1% protein, and contains negligible fat (table).
113
+ In a 100 gram reference amount, orange flesh provides 47 calories, and is a rich source of
114
+ vitamin C, providing 64% of the Daily Value. No other micronutrients are present in significant
115
+ amounts (table).
116
+ </div>
117
+ </lion-accordion>
118
+ ```
119
+
120
+ ## Multiline header
121
+
122
+ A header can be multiline.
123
+
124
+ ```html preview-story
125
+ <lion-accordion>
126
+ <h3 slot="invoker">
127
+ <button>
128
+ Sensory Factors <br />
129
+ <small>or the experience of taste</small>
130
+ </button>
131
+ </h3>
132
+ <div slot="content" class="lion-paragraph-container">
133
+ <p>
134
+ The taste of oranges is determined mainly by the relative ratios of sugars and acids, whereas
135
+ orange aroma derives from volatile organic compounds, including alcohols, aldehydes, ketones,
136
+ terpenes, and esters. Bitter limonoid compounds, such as limonin, decrease gradually during
137
+ development, whereas volatile aroma compounds tend to peak in mid– to late–season development.
138
+ Taste quality tends to improve later in harvests when there is a higher sugar/acid ratio with
139
+ less bitterness. As a citrus fruit, the orange is acidic, with pH levels ranging from 2.9 to
140
+ 4.0.
141
+ </p>
142
+
143
+ <p>
144
+ Sensory qualities vary according to genetic background, environmental conditions during
145
+ development, ripeness at harvest, postharvest conditions, and storage duration.
146
+ </p>
147
+ </div>
148
+ <h3 slot="invoker">
149
+ <button>
150
+ Nutritional value
151
+ <small>or the raw data</small>
152
+ </button>
153
+ </h3>
154
+ <div slot="content">
155
+ Orange flesh is 87% water, 12% carbohydrates, 1% protein, and contains negligible fat (table).
156
+ In a 100 gram reference amount, orange flesh provides 47 calories, and is a rich source of
157
+ vitamin C, providing 64% of the Daily Value. No other micronutrients are present in significant
158
+ amounts (table).
159
+ </div>
160
+ </lion-accordion>
161
+ ```
162
+
163
+ ## Distribute New Elements
164
+
165
+ Below, we demonstrate how you could dynamically add a new invoker + content.
166
+
167
+ One way is by creating the DOM elements and appending them as needed. For how this work feel tree to check out the `__handleAppendClick` function.
168
+ Another way is by adding data to the Lit property that you loop over in your template. See `__handlePushClick` for an example.
169
+
170
+ ```js preview-story
171
+ import { html, LitElement } from 'lit';
172
+
173
+ export const distributeNewElement = () => {
174
+ class DemoDistribute extends LitElement {
175
+ static get properties() {
176
+ return {
177
+ __collection: { type: Array },
178
+ };
179
+ }
180
+ render() {
181
+ return html`
182
+ <h3>Append</h3>
183
+ <lion-accordion id="appendAccordion">
184
+ <h4 slot="invoker">
185
+ <button>header 1</button>
186
+ </h4>
187
+ <p slot="content">content 1</p>
188
+ <h4 slot="invoker">
189
+ <button>header 2</button>
190
+ </h4>
191
+ <p slot="content">content 2</p>
192
+ </lion-accordion>
193
+ <button @click="${this.__handleAppendClick}">Append dom elements</button>
194
+ <hr />
195
+ <h3>Push</h3>
196
+ <lion-accordion id="pushTabs">
197
+ <h4 slot="invoker">
198
+ <button>header 1</button>
199
+ </h4>
200
+ <p slot="content">content 1</p>
201
+ <h4 slot="invoker">
202
+ <button>header 2</button>
203
+ </h4>
204
+ <p slot="content">content 2</p>
205
+ ${this.__collection.map(
206
+ item => html`
207
+ <h4 slot="invoker"><button>${item.invoker}</button></h4>
208
+ <p slot="content">${item.content}</p>
209
+ `,
210
+ )}
211
+ </lion-accordion>
212
+ <button @click="${this.__handlePushClick}">Push to tabs collection</button>
213
+ `;
214
+ }
215
+ constructor() {
216
+ super();
217
+ this.__collection = [];
218
+ }
219
+ __handleAppendClick() {
220
+ const accordionElement = this.shadowRoot.querySelector('#appendAccordion');
221
+ const c = 2;
222
+ const n = Math.floor(accordionElement.children.length / 2);
223
+ for (let i = n + 1; i < n + c; i += 1) {
224
+ const invoker = document.createElement('h4');
225
+ const button = document.createElement('button');
226
+ button.innerText = `header ${i}`;
227
+ invoker.setAttribute('slot', 'invoker');
228
+ invoker.appendChild(button);
229
+ const content = document.createElement('p');
230
+ content.setAttribute('slot', 'content');
231
+ content.innerText = `content ${i}`;
232
+ accordionElement.append(invoker);
233
+ accordionElement.append(content);
234
+ }
235
+ }
236
+ __handlePushClick() {
237
+ const accordionElement = this.shadowRoot.querySelector('#pushTabs');
238
+ const i = Math.floor(accordionElement.children.length / 2) + 1;
239
+ this.__collection = [
240
+ ...this.__collection,
241
+ {
242
+ invoker: `header ${i}`,
243
+ content: `content ${i}`,
244
+ },
245
+ ];
246
+ }
247
+ }
248
+ customElements.define('demo-distribute', DemoDistribute);
249
+
250
+ return previewHtml`<demo-distribute></demo-distribute>`;
251
+ };
252
+ ```
@@ -0,0 +1,30 @@
1
+ # Button >> Examples ||30
2
+
3
+ ```js script
4
+ import { html } from '@mdjs/mdjs-preview';
5
+ import '@lion/ui/define/lion-button.js';
6
+ import iconSvg from './src/icon.svg.js';
7
+ ```
8
+
9
+ ## Icon button
10
+
11
+ ```js preview-story
12
+ export const iconButton = () => html`<lion-button>${iconSvg(html)}Bug</lion-button>`;
13
+ ```
14
+
15
+ ## Icon only button
16
+
17
+ When only an icon is used, make sure the button still have an accessible name, via `aria-label`.
18
+
19
+ ```js preview-story
20
+ export const iconOnly = () => html`<lion-button aria-label="Bug">${iconSvg(html)}</lion-button>`;
21
+ ```
22
+
23
+ ## Multiple buttons inline
24
+
25
+ ```js preview-story
26
+ export const mainAndIconButton = () => html`
27
+ <lion-button>Default</lion-button>
28
+ <lion-button>${iconSvg(html)} Bug</lion-button>
29
+ `;
30
+ ```
@@ -0,0 +1,3 @@
1
+ # Button ||10
2
+
3
+ -> go to Overview
@@ -0,0 +1,30 @@
1
+ # Button >> Overview ||10
2
+
3
+ A button web component that is easily stylable and accessible.
4
+
5
+ ```js script
6
+ import { html } from '@mdjs/mdjs-preview';
7
+ import '@lion/ui/define/lion-button.js';
8
+ ```
9
+
10
+ ```js preview-story
11
+ export const main = () => html` <lion-button>Default</lion-button> `;
12
+ ```
13
+
14
+ ## Features
15
+
16
+ - Clickable area that is bigger than visual size
17
+ - A special `button-reset` and `button-submit` works with native form / inputs
18
+ - `button-submit` has integration for implicit form submission similar to how native `<form>`, `<input>` and `<button>` work together.
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ npm i --save @lion/ui
24
+ ```
25
+
26
+ ```js
27
+ import { LionButton, LionButtonReset, LionButtonSubmit } from '@lion/ui/button.js';
28
+ // or
29
+ import '@lion/ui/define/lion-button.js';
30
+ ```
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @param {Function} tag
3
+ */
4
+ export default tag =>
5
+ tag`<svg focusable="false" style="width: 24px; height: 24px;" version="1.1" viewBox="0 0 100 100" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g><g><path d="M44.8,44.2c-0.3-0.1-6.9-2.3-10-8c-0.9-1.7-1.7-3.6-2.4-5.4c-1.4-3.4-2.7-6.6-4.6-6.8l0.1-1.9c3.1,0.2,4.5,3.8,6.2,7.9 c0.7,1.7,1.4,3.5,2.3,5.2c2.7,5.1,8.9,7.1,8.9,7.1L44.8,44.2z"/></g><g><path d="M19.8,61.7v-1.9c4.7,0,10.7-6.6,13.4-10.7c2.6-4,11.2-2.1,12.2-1.9l-0.4,1.8c-2.3-0.5-8.6-1.4-10.2,1.1 C32.7,53.4,25.9,61.7,19.8,61.7z"/></g><g><path d="M25.1,86.5l-0.3-1.9c6-0.9,6.9-9.7,7.6-16.8c0.2-1.9,0.4-3.6,0.6-5.1c1.4-7.4,11.6-10.3,12.1-10.4l0.5,1.8 c-0.1,0-9.6,2.7-10.7,8.9c-0.3,1.4-0.4,3.1-0.6,5C33.5,75.3,32.5,85.4,25.1,86.5z"/></g><g><path d="M45.8,25.4c-0.1-1.4-0.1-4.7,0.9-5.7c0.3-0.3,0.6-0.4,1-0.4v1.9c0.2,0,0.3-0.1,0.4-0.2c-0.3,0.4-0.5,2.4-0.4,4.4 L45.8,25.4z"/></g><g><path d="M43.6,28c-0.3-0.3-6.8-6.2-6.8-11.4c0-5,1.4-8.7,1.5-8.8L40,8.5c0,0-1.3,3.6-1.3,8.1c0,4.4,6.2,10,6.2,10L43.6,28z"/></g><g><path d="M54.6,54.5c0-2.7,0.8-13-0.3-13c-1.1,0-1.8-2.2-1.8-3.4c0-1.1,4.1-3.4,4.1-8.1c0-4.8-6.6-5.6-6.6-5.6s-6.6,0.8-6.6,5.6 c0,4.8,4.1,7,4.1,8.1c0,1.1-0.7,3.4-1.8,3.4c-1.1,0-0.3,10.4-0.3,13c0,2.7-5.3,7.7-5.3,17.2s5.9,19.5,9.9,19.5 c4.1,0,9.9-9.9,9.9-19.5S54.6,57.2,54.6,54.5z"/></g><g><path d="M50,92.2c-5,0-10.9-11.1-10.9-20.4c0-6.5,2.4-11,4-14c0.7-1.4,1.4-2.6,1.4-3.3c0-0.6-0.1-1.8-0.1-3.1 c-0.3-7.6-0.2-9.8,0.5-10.5c0.2-0.2,0.5-0.4,0.8-0.4c0.3-0.1,0.8-1.4,0.9-2.3c-0.1-0.2-0.5-0.6-0.8-1c-1.2-1.4-3.3-3.7-3.3-7.3 c0-5.5,7.1-6.5,7.4-6.5c0.1,0,0.2,0,0.2,0c0.3,0,7.4,1,7.4,6.5c0,3.6-2.1,5.9-3.3,7.3c-0.3,0.3-0.7,0.8-0.8,1 c0,0.9,0.6,2.2,0.9,2.3c0.3,0,0.6,0.1,0.8,0.4c0.7,0.8,0.8,2.9,0.5,10.5c-0.1,1.3-0.1,2.4-0.1,3.1c0,0.7,0.6,1.9,1.4,3.3 c1.6,3,4,7.5,4,14C60.9,81.1,55,92.2,50,92.2z M46.2,42.4c-0.3,1.4-0.1,6.5,0,9c0.1,1.3,0.1,2.5,0.1,3.2c0,1.2-0.7,2.4-1.6,4.1 c-1.6,3-3.7,7.1-3.7,13.1c0,9.4,5.7,18.5,9,18.5s9-9.2,9-18.5c0-6-2.2-10.1-3.7-13.1c-0.9-1.7-1.6-3-1.6-4.1 c0-0.7,0.1-1.8,0.1-3.2c0.1-2.5,0.3-7.6,0-9c-1.6-0.5-2.2-3.1-2.2-4.2c0-0.7,0.5-1.3,1.3-2.1c1.2-1.3,2.8-3.1,2.8-6 c0-3.6-4.8-4.5-5.6-4.6c-0.8,0.1-5.6,1.1-5.6,4.6c0,2.8,1.6,4.7,2.8,6c0.7,0.8,1.3,1.4,1.3,2.1C48.4,39.3,47.8,41.9,46.2,42.4z"/></g><g><path d="M55.2,44.2l-0.6-1.8c0.1,0,6.2-2.1,9-7.1c0.9-1.7,1.6-3.4,2.3-5.2c1.7-4.2,3.2-7.7,6.2-7.9l0.1,1.9 c-1.9,0.1-3.2,3.3-4.6,6.8c-0.7,1.8-1.5,3.6-2.4,5.4C62.1,41.9,55.4,44.1,55.2,44.2z"/></g><g><path d="M80.2,61.7c-6.1,0-12.9-8.4-15-11.6c-1.6-2.5-8-1.6-10.2-1.1l-0.4-1.8c1-0.2,9.6-2.1,12.2,1.9c2.7,4.1,8.7,10.7,13.4,10.7 V61.7z"/></g><g><path d="M74.9,86.5c-7.4-1.1-8.5-11.2-9.2-18.5c-0.2-1.8-0.4-3.6-0.6-5c-1.1-6.3-10.6-8.9-10.7-8.9l0.5-1.8 c0.4,0.1,10.7,3,12.1,10.4c0.3,1.5,0.4,3.2,0.6,5.1c0.7,7.1,1.6,16,7.6,16.9L74.9,86.5z"/></g><g><path d="M54.2,25.4l-1.9-0.1c0.1-1.9-0.1-4-0.4-4.4c0,0,0.2,0.2,0.4,0.2v-1.9c0.4,0,0.7,0.2,1,0.4C54.3,20.7,54.3,24.1,54.2,25.4z "/></g><g><path d="M56.4,28l-1.3-1.4c0.1-0.1,6.2-5.7,6.2-10c0-4.6-1.3-8.1-1.3-8.1l1.8-0.7c0.1,0.2,1.5,3.9,1.5,8.8 C63.2,21.8,56.6,27.8,56.4,28z"/></g></g></svg>`;
@@ -0,0 +1,106 @@
1
+ # Button >> Use Cases ||20
2
+
3
+ ```js script
4
+ import { html } from '@mdjs/mdjs-preview';
5
+ import '@lion/ui/define/lion-button.js';
6
+ ```
7
+
8
+ ## With click handler
9
+
10
+ ```js preview-story
11
+ export const handler = () => html`
12
+ <lion-button @click="${ev => console.log('clicked/spaced/entered', ev)}">
13
+ Click | Space | Enter me and see log
14
+ </lion-button>
15
+ `;
16
+ ```
17
+
18
+ ## Disabled button
19
+
20
+ ```js preview-story
21
+ export const disabled = () => html`<lion-button disabled>Disabled</lion-button>`;
22
+ ```
23
+
24
+ ## Minimum click area
25
+
26
+ The minimum click area needs to be at least `44px` by `44px` according to [WCAG Success Criterion 2.5.5 Target Size (Enhanced)](https://www.w3.org/TR/WCAG22/#target-size-enhanced).
27
+
28
+ ```js preview-story
29
+ export const minimumClickArea = () => html` <style>
30
+ .small {
31
+ padding: 4px;
32
+ line-height: 1em;
33
+ }
34
+ .small::before {
35
+ border: 1px dashed #000;
36
+ }
37
+ </style>
38
+ <lion-button class="small">xs</lion-button>`;
39
+ ```
40
+
41
+ ## Usage with native form
42
+
43
+ `<lion-button-reset>` and `<lion-button-submit>` are especially created to supports the following use cases:
44
+
45
+ - Submit on button click
46
+ - Submit on button enter or space keypress
47
+ - Submit on enter keypress inside an input
48
+ - Reset native form fields when using type="reset"
49
+
50
+ ```js preview-story
51
+ export const withinForm = () => html`
52
+ <form
53
+ @submit=${ev => {
54
+ ev.preventDefault();
55
+ console.log('submit handler', ev.target);
56
+ }}
57
+ >
58
+ <label for="firstNameId">First name</label>
59
+ <input id="firstNameId" name="firstName" />
60
+ <label for="lastNameId">Last name</label>
61
+ <input id="lastNameId" name="lastName" />
62
+ <lion-button-submit @click=${ev => console.log('click submit handler', ev.target)}
63
+ >Submit</lion-button-submit
64
+ >
65
+ <lion-button-reset @click=${ev => console.log('click reset handler', ev.target)}
66
+ >Reset</lion-button-reset
67
+ >
68
+ </form>
69
+ `;
70
+ ```
71
+
72
+ Important notes:
73
+
74
+ - A `<lion-button-submit>` is mandatory for the last use case, if you have multiple inputs. This is native behaviour.
75
+ - `@click` on `<lion-button-submit>` and `@submit` on `<form>` are triggered by these use cases. We strongly encourage you to listen to the submit handler if your goal is to do something on form-submit.
76
+ - To prevent form submission full page reloads, add a **submit handler on the form** `@submit` with `event.preventDefault()`. Adding it on the `<lion-button-submit>` is not enough.
77
+
78
+ ## Considerations
79
+
80
+ ### Why a Web Component?
81
+
82
+ There are multiple reasons why we used a Web Component as opposed to a CSS component.
83
+
84
+ - **Target size**: The minimum target size is 40 pixels, which makes even the small buttons easy to activate. A container element was needed to make this size possible.
85
+ - **Advanced styling**: There are advanced styling options regarding icons in buttons, where it is a lot more maintainable to handle icons in our button using slots. An example is that a sticky icon-only buttons may looks different from buttons which have both icons and text.
86
+ - **Native form integration**: The `<lion-button-submit>` works with native `<form>` submission, and even implicit form submission on-enter. A lot of delegation logic had to be created for this to work.
87
+
88
+ ### Event target
89
+
90
+ We want to ensure that the event target returned to the user is `<lion-button>`, not `<button>`. Therefore, simply delegating the click to the native button immediately, is not desired. Instead, we catch the click event in the `<lion-button>`, and ensure delegation inside of there.
91
+
92
+ ### Flashing a native button click as a direct child of form
93
+
94
+ By delegating the `click()` to the native button, it will bubble back up to `<lion-button-reset>` and `<lion-button-submit>` which would cause duplicate actions. We have to simulate the full `.click()` however, otherwise form submission is not triggered. So this bubbling cannot be prevented.
95
+ Therefore, on click, we flash a `<button>` to the form as a direct child and fire the click on that button. We then immediately remove that button. This is a fully synchronous process; users or developers will not notice this, it should not cause problems.
96
+
97
+ ### Native button & implicit form submission
98
+
99
+ Flashing the button in the way we do solves almost all issues except for one.
100
+ One of the specs of W3C is that when you have a form with multiple inputs,
101
+ pressing enter while inside one of the inputs only triggers a form submit if that form has a button of type submit.
102
+
103
+ To get this particular implicit form submission to work, having a native button in our `<lion-button-submit>` is a hard requirement.
104
+ Therefore, not only do we flash a native button on the form to delegate `<lion-button-submit>` trigger to `<button>`
105
+ and thereby trigger form submission, we **also** add a native `button` inside the `<lion-button-submit>`
106
+ whose `type` property is synchronized with the type of the `<lion-button-submit>`.
@@ -0,0 +1,3 @@
1
+ # Calendar ||10
2
+
3
+ -> go to Overview
@@ -0,0 +1,49 @@
1
+ # Calendar >> Overview ||10
2
+
3
+ A reusable and accessible calendar view web component.
4
+
5
+ ```js script
6
+ import { html, css } from '@mdjs/mdjs-preview';
7
+ import '@lion/ui/define/lion-calendar.js';
8
+ ```
9
+
10
+ ```js preview-story
11
+ export const main = () => {
12
+ return html`
13
+ <style>
14
+ .demo-calendar {
15
+ border: 1px solid #adadad;
16
+ box-shadow: 0 0 16px #ccc;
17
+ max-width: 500px;
18
+ }
19
+ </style>
20
+ <lion-calendar class="demo-calendar"></lion-calendar>
21
+ `;
22
+ };
23
+ ```
24
+
25
+ ## Features
26
+
27
+ - fully accessible keyboard navigation (Arrow Keys, PgUp, PgDn, ALT+PgUp, ALT+PgDn)
28
+ - **minDate**: disables all dates before a given date
29
+ - **maxDate**: disables all dates after a given date
30
+ - **disableDates**: disables some dates within an available range
31
+ - **selectedDate**: currently selected date
32
+ - **centralDate**: date that determines the currently visible month and that will be focused when keyboard moves the focus to the month grid
33
+ - **focusedDate**: (getter only) currently focused date (if there is any with real focus)
34
+ - **focusDate(date)**: focus on a certain date
35
+ - **focusSelectedDate()**: focus on the current selected date
36
+ - **focusCentralDate()**: focus on the current central date
37
+ - **firstDayOfWeek**: typically Sunday (default) or Monday
38
+ - **weekdayHeaderNotation**: long/short/narrow for the current locale (e.g. Thursday/Thu/T)
39
+ - **locale**: different locale for the current component only
40
+
41
+ ## Installation
42
+
43
+ ```bash
44
+ npm i --save @lion/ui
45
+ ```
46
+
47
+ ```js
48
+ import '@lion/ui/define/lion-calendar.js';
49
+ ```