@lion/ui 0.0.2 → 0.0.3

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 (263) hide show
  1. package/components/core/test/SlotMixin.test.js +28 -21
  2. package/components/localize/src/number/parseNumber.js +15 -36
  3. package/components/localize/test/number/parseNumber.test.js +3 -12
  4. package/dist-types/components/localize/src/number/parseNumber.d.ts.map +1 -1
  5. package/dist-types/tsconfig.tsbuildinfo +1 -1
  6. package/docs/components/accordion/index.md +3 -0
  7. package/docs/components/accordion/overview.md +129 -0
  8. package/docs/components/accordion/reference.md +47 -0
  9. package/docs/components/accordion/use-cases.md +252 -0
  10. package/docs/components/button/examples.md +30 -0
  11. package/docs/components/button/index.md +3 -0
  12. package/docs/components/button/overview.md +30 -0
  13. package/docs/components/button/src/icon.svg.js +5 -0
  14. package/docs/components/button/use-cases.md +106 -0
  15. package/docs/components/calendar/index.md +3 -0
  16. package/docs/components/calendar/overview.md +49 -0
  17. package/docs/components/calendar/use-cases.md +192 -0
  18. package/docs/components/checkbox-group/index.md +3 -0
  19. package/docs/components/checkbox-group/overview.md +40 -0
  20. package/docs/components/checkbox-group/use-cases.md +256 -0
  21. package/docs/components/collapsible/assets/CustomCollapsible.js +113 -0
  22. package/docs/components/collapsible/assets/applyDemoCollapsibleStyles.js +37 -0
  23. package/docs/components/collapsible/examples.md +83 -0
  24. package/docs/components/collapsible/index.md +3 -0
  25. package/docs/components/collapsible/overview.md +39 -0
  26. package/docs/components/collapsible/use-cases.md +79 -0
  27. package/docs/components/combobox/examples.md +153 -0
  28. package/docs/components/combobox/index.md +3 -0
  29. package/docs/components/combobox/overview.md +51 -0
  30. package/docs/components/combobox/src/LinkMixin.js +60 -0
  31. package/docs/components/combobox/src/demo-selection-display.js +191 -0
  32. package/docs/components/combobox/src/gh-combobox/gh-button.js +69 -0
  33. package/docs/components/combobox/src/gh-combobox/gh-combobox.js +508 -0
  34. package/docs/components/combobox/src/google-combobox/assets/google-clear-icon.js +9 -0
  35. package/docs/components/combobox/src/google-combobox/assets/google-search-icon.js +9 -0
  36. package/docs/components/combobox/src/google-combobox/assets/google-voice-search-icon.js +19 -0
  37. package/docs/components/combobox/src/google-combobox/assets/googlelogo_color_272x92dp.png +0 -0
  38. package/docs/components/combobox/src/google-combobox/google-combobox.js +460 -0
  39. package/docs/components/combobox/src/lazyRender.js +29 -0
  40. package/docs/components/combobox/src/levenshtein.js +95 -0
  41. package/docs/components/combobox/src/md-combobox/MdFieldMixin.js +341 -0
  42. package/docs/components/combobox/src/md-combobox/md-combobox.js +89 -0
  43. package/docs/components/combobox/src/md-combobox/md-input.js +5 -0
  44. package/docs/components/combobox/src/md-combobox/style/load-roboto.js +6 -0
  45. package/docs/components/combobox/src/md-combobox/style/md-ripple.js +81 -0
  46. package/docs/components/combobox/src/wa-combobox/wa-combobox.js +368 -0
  47. package/docs/components/combobox/use-cases.md +377 -0
  48. package/docs/components/dialog/index.md +3 -0
  49. package/docs/components/dialog/overview.md +63 -0
  50. package/docs/components/dialog/src/demo-dialog-style.js +3 -0
  51. package/docs/components/dialog/src/demoStyle.js +39 -0
  52. package/docs/components/dialog/src/slots-dialog-content.js +32 -0
  53. package/docs/components/dialog/src/styled-dialog-content.js +38 -0
  54. package/docs/components/dialog/use-cases.md +154 -0
  55. package/docs/components/drawer/index.md +3 -0
  56. package/docs/components/drawer/overview.md +68 -0
  57. package/docs/components/drawer/src/demoStyle.js +71 -0
  58. package/docs/components/drawer/use-cases.md +194 -0
  59. package/docs/components/fieldset/index.md +3 -0
  60. package/docs/components/fieldset/overview.md +49 -0
  61. package/docs/components/fieldset/use-cases.md +185 -0
  62. package/docs/components/form/index.md +3 -0
  63. package/docs/components/form/overview.md +43 -0
  64. package/docs/components/form/use-cases.md +72 -0
  65. package/docs/components/icon/assets/bugs/bug01.svg.js +2 -0
  66. package/docs/components/icon/assets/bugs/bug02.svg.js +2 -0
  67. package/docs/components/icon/assets/bugs/bug05.svg.js +2 -0
  68. package/docs/components/icon/assets/bugs/bug06.svg.js +2 -0
  69. package/docs/components/icon/assets/bugs/bug08.svg.js +2 -0
  70. package/docs/components/icon/assets/bugs/bug12.svg.js +2 -0
  71. package/docs/components/icon/assets/bugs/bug19.svg.js +2 -0
  72. package/docs/components/icon/assets/bugs/bug23.svg.js +2 -0
  73. package/docs/components/icon/assets/bugs/bug24.svg.js +2 -0
  74. package/docs/components/icon/assets/iconset-bugs.js +11 -0
  75. package/docs/components/icon/assets/iconset-misc.js +3 -0
  76. package/docs/components/icon/assets/iconset-space.js +31 -0
  77. package/docs/components/icon/assets/misc/arrowLeft.svg.js +6 -0
  78. package/docs/components/icon/assets/space/aliens-spaceship.svg.js +2 -0
  79. package/docs/components/icon/assets/space/meteor.svg.js +2 -0
  80. package/docs/components/icon/assets/space/moon-flag.svg.js +2 -0
  81. package/docs/components/icon/assets/space/moon.svg.js +2 -0
  82. package/docs/components/icon/assets/space/night.svg.js +2 -0
  83. package/docs/components/icon/assets/space/orbit.svg.js +2 -0
  84. package/docs/components/icon/assets/space/planet.svg.js +2 -0
  85. package/docs/components/icon/assets/space/robot.svg.js +2 -0
  86. package/docs/components/icon/assets/space/rocket.svg.js +2 -0
  87. package/docs/components/icon/assets/space/satellite.svg.js +2 -0
  88. package/docs/components/icon/assets/space/signal.svg.js +2 -0
  89. package/docs/components/icon/assets/space/space-helmet.svg.js +2 -0
  90. package/docs/components/icon/assets/space/sun.svg.js +2 -0
  91. package/docs/components/icon/assets/space/telescope.svg.js +2 -0
  92. package/docs/components/icon/index.md +3 -0
  93. package/docs/components/icon/overview.md +40 -0
  94. package/docs/components/icon/use-cases.md +93 -0
  95. package/docs/components/index.md +7 -0
  96. package/docs/components/input/index.md +3 -0
  97. package/docs/components/input/overview.md +36 -0
  98. package/docs/components/input/use-cases.md +77 -0
  99. package/docs/components/input-amount/index.md +3 -0
  100. package/docs/components/input-amount/overview.md +49 -0
  101. package/docs/components/input-amount/use-cases.md +122 -0
  102. package/docs/components/input-date/index.md +3 -0
  103. package/docs/components/input-date/overview.md +39 -0
  104. package/docs/components/input-date/use-cases.md +83 -0
  105. package/docs/components/input-datepicker/index.md +3 -0
  106. package/docs/components/input-datepicker/overview.md +42 -0
  107. package/docs/components/input-datepicker/use-cases.md +78 -0
  108. package/docs/components/input-email/index.md +3 -0
  109. package/docs/components/input-email/overview.md +32 -0
  110. package/docs/components/input-email/use-cases.md +48 -0
  111. package/docs/components/input-iban/index.md +3 -0
  112. package/docs/components/input-iban/overview.md +37 -0
  113. package/docs/components/input-iban/use-cases.md +102 -0
  114. package/docs/components/input-range/index.md +3 -0
  115. package/docs/components/input-range/overview.md +34 -0
  116. package/docs/components/input-range/use-cases.md +108 -0
  117. package/docs/components/input-stepper/index.md +3 -0
  118. package/docs/components/input-stepper/overview.md +36 -0
  119. package/docs/components/input-stepper/use-cases.md +41 -0
  120. package/docs/components/input-tel/index.md +3 -0
  121. package/docs/components/input-tel/overview.md +62 -0
  122. package/docs/components/input-tel/src/h-region-code-table.js +109 -0
  123. package/docs/components/input-tel/use-cases.md +307 -0
  124. package/docs/components/input-tel-dropdown/examples.md +32 -0
  125. package/docs/components/input-tel-dropdown/index.md +3 -0
  126. package/docs/components/input-tel-dropdown/overview.md +38 -0
  127. package/docs/components/input-tel-dropdown/src/intl-input-tel-dropdown.js +127 -0
  128. package/docs/components/input-tel-dropdown/use-cases.md +159 -0
  129. package/docs/components/listbox/index.md +3 -0
  130. package/docs/components/listbox/overview.md +42 -0
  131. package/docs/components/listbox/src/listboxData.js +65 -0
  132. package/docs/components/listbox/use-cases.md +147 -0
  133. package/docs/components/pagination/index.md +3 -0
  134. package/docs/components/pagination/overview.md +29 -0
  135. package/docs/components/pagination/use-cases.md +99 -0
  136. package/docs/components/progress-indicator/assets/my-determinate-progress-bar.js +30 -0
  137. package/docs/components/progress-indicator/assets/my-indeterminate-progress-spinner.js +55 -0
  138. package/docs/components/progress-indicator/examples.md +125 -0
  139. package/docs/components/progress-indicator/index.md +3 -0
  140. package/docs/components/progress-indicator/overview.md +36 -0
  141. package/docs/components/radio-group/index.md +3 -0
  142. package/docs/components/radio-group/overview.md +46 -0
  143. package/docs/components/radio-group/use-cases.md +140 -0
  144. package/docs/components/select/index.md +3 -0
  145. package/docs/components/select/overview.md +44 -0
  146. package/docs/components/select/use-cases.md +55 -0
  147. package/docs/components/select-rich/examples.md +31 -0
  148. package/docs/components/select-rich/index.md +3 -0
  149. package/docs/components/select-rich/overview.md +46 -0
  150. package/docs/components/select-rich/src/flagStyles.js +1250 -0
  151. package/docs/components/select-rich/src/flags.png +0 -0
  152. package/docs/components/select-rich/src/flags@2x.png +0 -0
  153. package/docs/components/select-rich/src/intl-select-rich.js +194 -0
  154. package/docs/components/select-rich/src/regionMetaList.js +1717 -0
  155. package/docs/components/select-rich/use-cases.md +370 -0
  156. package/docs/components/steps/index.md +3 -0
  157. package/docs/components/steps/overview.md +63 -0
  158. package/docs/components/steps/use-cases.md +163 -0
  159. package/docs/components/switch/index.md +3 -0
  160. package/docs/components/switch/overview.md +75 -0
  161. package/docs/components/switch/reference.md +39 -0
  162. package/docs/components/switch/use-cases.md +76 -0
  163. package/docs/components/tabs/examples.md +23 -0
  164. package/docs/components/tabs/index.md +3 -0
  165. package/docs/components/tabs/overview.md +48 -0
  166. package/docs/components/tabs/src/lea-tab-panel.js +24 -0
  167. package/docs/components/tabs/src/lea-tab.js +45 -0
  168. package/docs/components/tabs/src/lea-tabs.js +28 -0
  169. package/docs/components/tabs/use-cases.md +219 -0
  170. package/docs/components/textarea/index.md +3 -0
  171. package/docs/components/textarea/overview.md +35 -0
  172. package/docs/components/textarea/use-cases.md +95 -0
  173. package/docs/components/tooltip/examples.md +39 -0
  174. package/docs/components/tooltip/index.md +3 -0
  175. package/docs/components/tooltip/overview.md +44 -0
  176. package/docs/components/tooltip/use-cases.md +208 -0
  177. package/docs/fundamentals/index.md +19 -0
  178. package/docs/fundamentals/node-tools/babel-plugin-extend-docs/index.md +1 -0
  179. package/docs/fundamentals/node-tools/babel-plugin-extend-docs/overview.md +233 -0
  180. package/docs/fundamentals/node-tools/index.md +1 -0
  181. package/docs/fundamentals/node-tools/providence-analytics/LocalConfiguration.md +68 -0
  182. package/docs/fundamentals/node-tools/providence-analytics/QueryResult.md +111 -0
  183. package/docs/fundamentals/node-tools/providence-analytics/analyzer.md +69 -0
  184. package/docs/fundamentals/node-tools/providence-analytics/assets/_mermaid.svg.js +1202 -0
  185. package/docs/fundamentals/node-tools/providence-analytics/dashboard.md +22 -0
  186. package/docs/fundamentals/node-tools/providence-analytics/index.md +1 -0
  187. package/docs/fundamentals/node-tools/providence-analytics/overview.md +192 -0
  188. package/docs/fundamentals/node-tools/publish-docs/index.md +1 -0
  189. package/docs/fundamentals/node-tools/publish-docs/overview.md +136 -0
  190. package/docs/fundamentals/node-tools/remark-extend/index.md +1 -0
  191. package/docs/fundamentals/node-tools/remark-extend/overview.md +274 -0
  192. package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/index.md +1 -0
  193. package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +285 -0
  194. package/docs/fundamentals/rationales/TypeScript.md +18 -0
  195. package/docs/fundamentals/rationales/index.md +1 -0
  196. package/docs/fundamentals/rationales/side-effects.md +203 -0
  197. package/docs/fundamentals/rationales/versioning.md +35 -0
  198. package/docs/fundamentals/systems/core/index.md +3 -0
  199. package/docs/fundamentals/systems/core/overview.md +85 -0
  200. package/docs/fundamentals/systems/form/assets/FormatMixinDiagram-1.svg +1 -0
  201. package/docs/fundamentals/systems/form/assets/FormatMixinDiagram-2.svg +1 -0
  202. package/docs/fundamentals/systems/form/assets/FormatMixinDiagram-3.svg +84 -0
  203. package/docs/fundamentals/systems/form/assets/h-output.js +155 -0
  204. package/docs/fundamentals/systems/form/formatting-and-parsing.md +245 -0
  205. package/docs/fundamentals/systems/form/index.md +3 -0
  206. package/docs/fundamentals/systems/form/interaction-states.md +177 -0
  207. package/docs/fundamentals/systems/form/model-value.md +35 -0
  208. package/docs/fundamentals/systems/form/overview.md +82 -0
  209. package/docs/fundamentals/systems/form/styling.md +101 -0
  210. package/docs/fundamentals/systems/form/use-cases.md +156 -0
  211. package/docs/fundamentals/systems/form/validate.md +929 -0
  212. package/docs/fundamentals/systems/icon/index.md +3 -0
  213. package/docs/fundamentals/systems/icon/overview.md +124 -0
  214. package/docs/fundamentals/systems/index.md +1 -0
  215. package/docs/fundamentals/systems/localize/assets/all-locales.js +437 -0
  216. package/docs/fundamentals/systems/localize/assets/en-AU.js +6 -0
  217. package/docs/fundamentals/systems/localize/assets/en-GB.js +6 -0
  218. package/docs/fundamentals/systems/localize/assets/en-US.js +6 -0
  219. package/docs/fundamentals/systems/localize/assets/en.js +4 -0
  220. package/docs/fundamentals/systems/localize/assets/nl-BE.js +6 -0
  221. package/docs/fundamentals/systems/localize/assets/nl-NL.js +6 -0
  222. package/docs/fundamentals/systems/localize/assets/nl.js +4 -0
  223. package/docs/fundamentals/systems/localize/dates.md +195 -0
  224. package/docs/fundamentals/systems/localize/index.md +3 -0
  225. package/docs/fundamentals/systems/localize/numbers.md +217 -0
  226. package/docs/fundamentals/systems/localize/overview.md +48 -0
  227. package/docs/fundamentals/systems/localize/rationale.md +62 -0
  228. package/docs/fundamentals/systems/localize/text.md +125 -0
  229. package/docs/fundamentals/systems/localize/use-cases.md +319 -0
  230. package/docs/fundamentals/systems/overlays/assets/applyDemoOverlayStyles.js +22 -0
  231. package/docs/fundamentals/systems/overlays/assets/demo-overlay-backdrop.js +48 -0
  232. package/docs/fundamentals/systems/overlays/assets/demo-overlay-system.js +42 -0
  233. package/docs/fundamentals/systems/overlays/assets/umbrella-form.js +133 -0
  234. package/docs/fundamentals/systems/overlays/configuration.md +453 -0
  235. package/docs/fundamentals/systems/overlays/form-integration.md +65 -0
  236. package/docs/fundamentals/systems/overlays/index.md +3 -0
  237. package/docs/fundamentals/systems/overlays/overview.md +118 -0
  238. package/docs/fundamentals/systems/overlays/rationale.md +232 -0
  239. package/docs/fundamentals/systems/overlays/scope.md +176 -0
  240. package/docs/fundamentals/systems/overlays/use-cases.md +699 -0
  241. package/docs/fundamentals/tools/ajax/assets/naga.json +9 -0
  242. package/docs/fundamentals/tools/ajax/assets/pabu.json +9 -0
  243. package/docs/fundamentals/tools/ajax/index.md +3 -0
  244. package/docs/fundamentals/tools/ajax/overview.md +128 -0
  245. package/docs/fundamentals/tools/ajax/use-cases.md +456 -0
  246. package/docs/fundamentals/tools/helpers/action-logger.md +165 -0
  247. package/docs/fundamentals/tools/helpers/index.md +3 -0
  248. package/docs/fundamentals/tools/helpers/overview.md +30 -0
  249. package/docs/fundamentals/tools/index.md +1 -0
  250. package/docs/fundamentals/tools/singleton-manager/index.md +3 -0
  251. package/docs/fundamentals/tools/singleton-manager/overview.md +304 -0
  252. package/docs/guides/how-to/create-a-custom-field.md +200 -0
  253. package/docs/guides/how-to/extend-a-native-input.md +66 -0
  254. package/docs/guides/how-to/get-started.md +77 -0
  255. package/docs/guides/how-to/index.md +1 -0
  256. package/docs/guides/index.md +34 -0
  257. package/docs/guides/principles/definitions-and-terms.md +41 -0
  258. package/docs/guides/principles/index.md +26 -0
  259. package/docs/guides/principles/scoped-elements.md +103 -0
  260. package/docs/guides/principles/styling.md +32 -0
  261. package/docs/guides/principles/subclasser-apis.md +28 -0
  262. package/docs/override.js +15 -0
  263. package/package.json +1 -1
@@ -0,0 +1,370 @@
1
+ # Select Rich >> Use Cases ||20
2
+
3
+ ```js script
4
+ import { LitElement, html } from '@mdjs/mdjs-preview';
5
+ import '@lion/ui/define/lion-select-rich.js';
6
+ import '@lion/ui/define/lion-option.js';
7
+ ```
8
+
9
+ ## Model value
10
+
11
+ You can set the full `modelValue` for each option, which includes the checked property for whether it is checked or not.
12
+
13
+ ```html
14
+ <lion-option .modelValue="${{ value: 'red', checked: false }}">Red</lion-option>
15
+ ```
16
+
17
+ ## Options with HTML
18
+
19
+ The main feature of this rich select that makes it rich, is that your options can contain HTML.
20
+
21
+ ```js preview-story
22
+ export const optionsWithHTML = () => html`
23
+ <lion-select-rich label="Favorite color" name="color">
24
+ <lion-option .choiceValue="${'red'}">
25
+ <p style="color: red;">I am red</p>
26
+ <p>and multi Line</p>
27
+ </lion-option>
28
+ <lion-option .choiceValue="${'hotpink'}" checked>
29
+ <p style="color: hotpink;">I am hotpink</p>
30
+ <p>and multi Line</p>
31
+ </lion-option>
32
+ <lion-option .choiceValue="${'teal'}">
33
+ <p style="color: teal;">I am teal</p>
34
+ <p>and multi Line</p>
35
+ </lion-option>
36
+ </lion-select-rich>
37
+ `;
38
+ ```
39
+
40
+ ## Many Options with Scrolling
41
+
42
+ ```js preview-story
43
+ export const manyOptionsWithScrolling = () => html`
44
+ <style>
45
+ #scrollSelectRich lion-options {
46
+ max-height: 200px;
47
+ overflow-y: auto;
48
+ display: block;
49
+ }
50
+ </style>
51
+ <lion-select-rich id="scrollSelectRich" label="Favorite color" name="color">
52
+ <lion-option .modelValue="${{ value: 'red', checked: false }}">
53
+ <p style="color: red;">I am red</p>
54
+ </lion-option>
55
+ <lion-option .modelValue="${{ value: 'hotpink', checked: true }}">
56
+ <p style="color: hotpink;">I am hotpink</p>
57
+ </lion-option>
58
+ <lion-option .modelValue="${{ value: 'teal', checked: false }}">
59
+ <p style="color: teal;">I am teal</p>
60
+ </lion-option>
61
+ <lion-option .modelValue="${{ value: 'green', checked: false }}">
62
+ <p style="color: green;">I am green</p>
63
+ </lion-option>
64
+ <lion-option .modelValue"=${{ value: 'blue', checked: false }}">
65
+ <p style="color: blue;">I am blue</p>
66
+ </lion-option>
67
+ </lion-select-rich>
68
+ `;
69
+ ```
70
+
71
+ ## Read only prefilled
72
+
73
+ You can set the rich select as read only.
74
+ This will block the user from opening the select.
75
+
76
+ The readonly attribute is delegated to the invoker for disabling opening the overlay, and for styling purposes.
77
+
78
+ ```js preview-story
79
+ export const readOnlyPrefilled = () => html`
80
+ <lion-select-rich label="Read-only select" readonly name="color">
81
+ <lion-option .modelValue=${{ value: 'red', checked: false }}>Red</lion-option>
82
+ <lion-option .modelValue=${{ value: 'hotpink', checked: true }}>Hotpink</lion-option>
83
+ <lion-option .modelValue=${{ value: 'teal', checked: false }}>Teal</lion-option>
84
+ </lion-select-rich>
85
+ `;
86
+ ```
87
+
88
+ ## Disabled Select
89
+
90
+ You can set the `disabled` attribute to disable either specific options or the entire select.
91
+
92
+ If you disable the entire select, the disabled attribute is also delegated to the invoker, similar to readonly.
93
+
94
+ ```js preview-story
95
+ export const disabledSelect = () => html`
96
+ <lion-select-rich label="Disabled select" disabled name="color">
97
+ <lion-option .modelValue=${{ value: 'red', checked: false }}>Red</lion-option>
98
+ <lion-option .modelValue=${{ value: 'hotpink', checked: true }}>Hotpink</lion-option>
99
+ <lion-option .modelValue=${{ value: 'teal', checked: false }}>Teal</lion-option>
100
+ </lion-select-rich>
101
+ `;
102
+ ```
103
+
104
+ ```js preview-story
105
+ export const disabledOption = () => html`
106
+ <lion-select-rich label="Disabled options" name="color">
107
+ <lion-option .choiceValue=${'red'} disabled>Red</lion-option>
108
+ <lion-option .choiceValue=${'blue'}>Blue</lion-option>
109
+ <lion-option .choiceValue=${'hotpink'} disabled>Hotpink</lion-option>
110
+ <lion-option .choiceValue=${'green'}>Green</lion-option>
111
+ <lion-option .choiceValue=${'teal'} disabled>Teal</lion-option>
112
+ </lion-select-rich>
113
+ `;
114
+ ```
115
+
116
+ ## Render options
117
+
118
+ The choiceValue can also be a complex value like an Object.
119
+
120
+ It is up to you how to render this Object in the DOM.
121
+
122
+ ```js preview-story
123
+ export const renderOptions = ({ shadowRoot }) => {
124
+ const objs = [
125
+ { type: 'mastercard', label: 'Master Card', amount: 12000, active: true },
126
+ { type: 'visacard', label: 'Visa Card', amount: 0, active: false },
127
+ ];
128
+ function showOutput(ev) {
129
+ shadowRoot.querySelector('#demoRenderOutput').innerHTML = JSON.stringify(
130
+ ev.target.modelValue,
131
+ null,
132
+ 2,
133
+ );
134
+ }
135
+ return html`
136
+ <lion-select-rich label="Credit Card" name="color" @model-value-changed=${showOutput}>
137
+ ${objs.map(
138
+ obj => html`
139
+ <lion-option .modelValue=${{ value: obj, checked: false }}>${obj.label}</lion-option>
140
+ `,
141
+ )}
142
+ </lion-select-rich>
143
+ <p>Full value:</p>
144
+ <pre id="demoRenderOutput"></pre>
145
+ `;
146
+ };
147
+ ```
148
+
149
+ ## Interaction Mode
150
+
151
+ You can set the interaction mode to either `mac` or `windows/linux`.
152
+ By default, it will choose based on the user Operating System, but it can be forced.
153
+
154
+ This changes the keyboard interaction.
155
+
156
+ ```js preview-story
157
+ export const interactionMode = () => html`
158
+ <lion-select-rich label="Mac mode" name="color" interaction-mode="mac">
159
+ <lion-option .modelValue=${{ value: 'red', checked: false }}>Red</lion-option>
160
+ <lion-option .modelValue=${{ value: 'hotpink', checked: true }}>Hotpink</lion-option>
161
+ <lion-option .modelValue=${{ value: 'teal', checked: false }}>Teal</lion-option>
162
+ </lion-select-rich>
163
+ <lion-select-rich label="Windows/Linux mode" name="color" interaction-mode="windows/linux">
164
+ <lion-option .modelValue=${{ value: 'red', checked: false }}>Red</lion-option>
165
+ <lion-option .modelValue=${{ value: 'hotpink', checked: true }}>Hotpink</lion-option>
166
+ <lion-option .modelValue=${{ value: 'teal', checked: false }}>Teal</lion-option>
167
+ </lion-select-rich>
168
+ `;
169
+ ```
170
+
171
+ ## Checked index & value
172
+
173
+ You can get/set the checkedIndex and checkedValue.
174
+
175
+ ```js preview-story
176
+ export const checkedIndexAndValue = ({ shadowRoot }) => html`
177
+ <style>
178
+ .log-button {
179
+ margin: 10px 0;
180
+ }
181
+ </style>
182
+ <div>
183
+ <label id="label-richSelectCheckedInput" for="richSelectCheckedInput">
184
+ Set the checkedIndex
185
+ </label>
186
+ <input
187
+ id="richSelectCheckedInput"
188
+ aria-labelledby="label-richSelectCheckedInput"
189
+ type="number"
190
+ @change=${e => {
191
+ const selectEl = shadowRoot.querySelector('#checkedRichSelect');
192
+ selectEl.checkedIndex = e.target.value;
193
+ }}
194
+ />
195
+ </div>
196
+ <button
197
+ class="log-button"
198
+ @click=${() => {
199
+ const selectEl = shadowRoot.querySelector('#checkedRichSelect');
200
+ console.log(`checkedIndex: ${selectEl.checkedIndex}`);
201
+ console.log(`modelValue: ${selectEl.modelValue}`);
202
+ }}
203
+ >
204
+ Console log checked index and value
205
+ </button>
206
+ <lion-select-rich id="checkedRichSelect" name="favoriteColor" label="Favorite color">
207
+ <lion-option .choiceValue=${'red'}>Red</lion-option>
208
+ <lion-option .choiceValue=${'hotpink'} checked>Hotpink</lion-option>
209
+ <lion-option .choiceValue=${'teal'}>Teal</lion-option>
210
+ </lion-select-rich>
211
+ `;
212
+ ```
213
+
214
+ ## No default selection
215
+
216
+ If you want to set a placeholder option with something like 'Please select', you can of course do this, the same way you would do it in a native select.
217
+
218
+ Simply put an option with a modelValue that is `null`.
219
+
220
+ ```html
221
+ <lion-option .choiceValue="${null}">select a color</lion-option>
222
+ ```
223
+
224
+ However, this allows the user to explicitly select this option.
225
+
226
+ Often, you may want a placeholder that appears initially, but cannot be selected explicitly by the user.
227
+ For this you can use `has-no-default-selected` attribute.
228
+
229
+ ```js preview-story
230
+ export const noDefaultSelection = () => html`
231
+ <lion-select-rich name="favoriteColor" label="Favorite color" has-no-default-selected>
232
+ <lion-option .choiceValue=${'red'}>Red</lion-option>
233
+ <lion-option .choiceValue=${'hotpink'}>Hotpink</lion-option>
234
+ <lion-option .choiceValue=${'teal'}>Teal</lion-option>
235
+ </lion-select-rich>
236
+ `;
237
+ ```
238
+
239
+ > By default, the placeholder is completely empty in the `LionSelectInvoker`,
240
+ > but subclassers can easily override this in their extension, by the overriding `_noSelectionTemplate()` method.
241
+
242
+ ## Single Option
243
+
244
+ If there is a single option rendered, then `singleOption` property is set to `true` on `lion-select-rich` and invoker as well. Invoker also gets `single-option` which can be used to having desired templating and styling. As in here the arrow is not displayed for single option
245
+
246
+ ```js preview-story
247
+ export const singleOption = () => html`
248
+ <lion-select-rich label="Single Option" name="color">
249
+ <lion-option .choiceValue=${'red'}>Red</lion-option>
250
+ </lion-select-rich>
251
+ `;
252
+ ```
253
+
254
+ When adding/removing options the `singleOption` will only be `true` when there is exactly one option.
255
+
256
+ ```js preview-story
257
+ class SingleOptionRemoveAdd extends LitElement {
258
+ static get properties() {
259
+ return {
260
+ options: { type: Array },
261
+ };
262
+ }
263
+
264
+ constructor() {
265
+ super();
266
+ this.options = ['Option 1', 'Option 2'];
267
+ }
268
+
269
+ render() {
270
+ return html`
271
+ <button @click=${this.addOption}>Add an option</button>
272
+ <button @click=${this.removeOption}>Remove last option</button>
273
+ <lion-select-rich name="favoriteColor" label="Favorite color">
274
+ <lion-options slot="input">
275
+ ${this.options.map(
276
+ option => html` <lion-option .choiceValue=${option}>${option}</lion-option> `,
277
+ )}
278
+ </lion-options>
279
+ </lion-select-rich>
280
+ `;
281
+ }
282
+
283
+ addOption() {
284
+ this.options.push(`Option ${this.options.length + 1} with a long title`);
285
+ this.options = [...this.options];
286
+ this.requestUpdate();
287
+ }
288
+
289
+ removeOption() {
290
+ if (this.options.length >= 2) {
291
+ this.options.pop();
292
+ this.options = [...this.options];
293
+ this.requestUpdate();
294
+ }
295
+ }
296
+ }
297
+
298
+ customElements.define('single-option-remove-add', SingleOptionRemoveAdd);
299
+
300
+ export const singleOptionRemoveAdd = () => {
301
+ return html`<single-option-remove-add></single-option-remove-add>`;
302
+ };
303
+ ```
304
+
305
+ ## Custom Invoker
306
+
307
+ You can provide a custom invoker using the invoker slot.
308
+ LionSelectRich will give it acces to:
309
+
310
+ - the currently selected option via `.selectedElement`
311
+ - LionSelectRich itself, via `.hostElement`
312
+
313
+ Code of an advanced custom invoker is shown below (this is the code for the
314
+ invoker used in [IntlSelectRich](https://github.com/ing-bank/lion/blob/fbf0bd22378e76aa4261c2a97faf8be4f5fc461e/docs/components/select-rich/examples.md)).
315
+ The invoker is usually added in the invoker slot of the LionSelectRich subclass.
316
+ However, it would also be possible for an application developer to provide the invoker
317
+ by putting it in light dom:
318
+
319
+ ```html
320
+ <lion-select-rich>
321
+ <intl-select-invoker slot="invoker"></intl-select-invoker>
322
+ ...
323
+ </lion-select-rich>
324
+ ```
325
+
326
+ ```js
327
+ import { LionSelectInvoker } from '@lion/ui/select-rich.js';
328
+
329
+ class IntlSelectInvoker extends LionSelectInvoker {
330
+ /**
331
+ * 1. Add your own styles
332
+ * @configure LitElement
333
+ * @enhance LionSelectInvoker
334
+ */
335
+ static styles = [
336
+ /** <your custom styles> see IntlSelectRich listed above */
337
+ ];
338
+
339
+ /**
340
+ * 2. Take back control of slots (LionSelectInvoker adds slots you most likely don't want)
341
+ * @configure SlotMixin
342
+ * @override LionSelectInvoker
343
+ */
344
+ get slots() {
345
+ return {};
346
+ }
347
+
348
+ /**
349
+ * 3. Add you custom render function
350
+ * @override LionSelectInvoker
351
+ */
352
+ render() {
353
+ const ctor = /** @type {typeof LionSelectInvoker} */ (this.constructor);
354
+ return ctor._mainTemplate(this._templateData);
355
+ }
356
+
357
+ get _templateData() {
358
+ return {
359
+ data: { selectedElement: this.selectedElement, hostElement: this.hostElement },
360
+ };
361
+ }
362
+
363
+ static _mainTemplate(templateData) {
364
+ /** <your custom template> see IntlSelectRich listed above */
365
+ }
366
+ }
367
+ ```
368
+
369
+ > This example only works if your option elements don't have ShadowDOM boundaries themselves.
370
+ > Cloning deeply only works up until the first shadow boundary.
@@ -0,0 +1,3 @@
1
+ # Steps ||50
2
+
3
+ -> go to Overview
@@ -0,0 +1,63 @@
1
+ # Steps >> Overview ||10
2
+
3
+ A web component that can be used to break a single goal down into dependable sub-tasks.
4
+
5
+ ```js script
6
+ import { html } from '@mdjs/mdjs-preview';
7
+ import '@lion/ui/define/lion-steps.js';
8
+ import '@lion/ui/define/lion-step.js';
9
+ ```
10
+
11
+ ```js preview-story
12
+ export const main = () => html`
13
+ <lion-steps>
14
+ <lion-step initial-step>
15
+ Step 1
16
+ <button type="button" @click=${ev => ev.target.parentElement.controller.next()}>Next</button>
17
+ </lion-step>
18
+ <lion-step>
19
+ <button type="button" @click=${ev => ev.target.parentElement.controller.previous()}>
20
+ Previous
21
+ </button>
22
+ Step 2
23
+ <button type="button" @click=${ev => ev.target.parentElement.controller.next()}>
24
+ Next
25
+ </button></lion-step
26
+ >
27
+ <lion-step>
28
+ <button type="button" @click=${ev => ev.target.parentElement.controller.previous()}>
29
+ Previous
30
+ </button>
31
+ Step 3
32
+ </lion-step>
33
+ </lion-steps>
34
+ `;
35
+ ```
36
+
37
+ ## Features
38
+
39
+ - navigate between different steps with 'previous' and 'next' functions.
40
+ - keeps status of each step
41
+ - untouched
42
+ - entered
43
+ - left
44
+ - skipped
45
+ - options
46
+ - **initial-step**: Set to the first step of the flow, blocks calling `previous` function.
47
+ - **condition**: Dynamic condition, when true the step is added to the flow.
48
+ - **invert-condition**: Inverts the condition set.
49
+
50
+ In many application you build multi-step workflows like multi-step forms where you want to split a long process into smaller steps making the user's perception of it and filling in data easier. The idea of this component is to provide a simple way to define such steps and transition from one step to another while saving data between them and to conditionally skip some steps based on the data.
51
+
52
+ ## Installation
53
+
54
+ ```bash
55
+ npm i --save @lion/ui
56
+ ```
57
+
58
+ ```js
59
+ import { LionSteps, LionStep } from '@lion/ui/steps.js';
60
+ // or
61
+ import '@lion/ui/define/lion-steps.js';
62
+ import '@lion/ui/define/lion-step.js';
63
+ ```
@@ -0,0 +1,163 @@
1
+ # Steps >> Use Cases ||20
2
+
3
+ ```js script
4
+ import { html } from '@mdjs/mdjs-preview';
5
+ import '@lion/ui/define/lion-steps.js';
6
+ import '@lion/ui/define/lion-step.js';
7
+ ```
8
+
9
+ ```js preview-story
10
+ export const main = () => html`
11
+ <lion-steps>
12
+ <lion-step initial-step>
13
+ <p>Welcome</p>
14
+ <button disabled>previous</button> &nbsp;
15
+ <button type="button" @click=${ev => ev.target.parentElement.controller.next()}>Next</button>
16
+ </lion-step>
17
+ <lion-step>
18
+ <p>Are you single?</p>
19
+ <button
20
+ type="button"
21
+ @click=${ev => {
22
+ ev.target.parentElement.controller.data.isSingle = true;
23
+ ev.target.parentElement.controller.next();
24
+ }}
25
+ >
26
+ Yes
27
+ </button>
28
+ &nbsp;
29
+ <button
30
+ type="button"
31
+ @click=${ev => {
32
+ ev.target.parentElement.controller.data.isSingle = false;
33
+ ev.target.parentElement.controller.next();
34
+ }}
35
+ >
36
+ No
37
+ </button>
38
+ <br /><br />
39
+ <button type="button" @click=${ev => ev.target.parentElement.controller.previous()}>
40
+ Previous
41
+ </button>
42
+ </lion-step>
43
+ <lion-step id="is-single" .condition="${data => data.isSingle}">
44
+ <p>You are single</p>
45
+ <button type="button" @click=${ev => ev.target.parentElement.controller.previous()}>
46
+ Previous
47
+ </button>
48
+ &nbsp;
49
+ <button type="button" @click=${ev => ev.target.parentElement.controller.next()}>Next</button>
50
+ </lion-step>
51
+ <lion-step id="is-not-single" .condition="${data => data.isSingle}" invert-condition>
52
+ <p>You are NOT single.</p>
53
+ <button type="button" @click=${ev => ev.target.parentElement.controller.previous()}>
54
+ Previous
55
+ </button>
56
+ &nbsp;
57
+ <button type="button" @click=${ev => ev.target.parentElement.controller.next()}>Next</button>
58
+ </lion-step>
59
+ <lion-step>
60
+ <p>Finish</p>
61
+ <button type="button" @click=${ev => ev.target.parentElement.controller.previous()}>
62
+ Previous
63
+ </button>
64
+ </lion-step>
65
+ </lion-steps>
66
+ `;
67
+ ```
68
+
69
+ ## Define steps
70
+
71
+ We provide two components: `lion-steps` and `lion-step`. Steps need to be direct children of `lion-steps`.
72
+
73
+ ```html
74
+ <lion-steps>
75
+ <lion-step initial-step>Step 1</lion-step>
76
+ <lion-step>Step 2</lion-step>
77
+ <lion-step>......</lion-step>
78
+ <lion-step>Step N</lion-step>
79
+ </lion-steps>
80
+ ```
81
+
82
+ The first step needs to be explicitly set via `initial-step` so that it get status `entered`, while others are `untouched` by default. You can navigate between steps using `next()` and `previous()` methods, so that next step gets `entered` status, while previous one becomes `left`:
83
+
84
+ ```js
85
+ next() {
86
+ return this.shadowRoot.getElementById('steps').next();
87
+ }
88
+
89
+ previous() {
90
+ return this.shadowRoot.getElementById('steps').previous();
91
+ }
92
+ ```
93
+
94
+ ## Conditions
95
+
96
+ You can provide a condition to a step (with or without `invert-condition` emulating if-else flow):
97
+
98
+ ```html
99
+ <lion-steps data="[[data]]">
100
+ <lion-step>...</lion-step>
101
+ <lion-step>step where `data.smth` is set</lion-step>
102
+ <lion-step condition="myConditionFunc">if</lion-step>
103
+ <lion-step condition="myConditionFunc" invert-condition>else</lion-step>
104
+ <lion-step>...</lion-step>
105
+ </lion-steps>
106
+
107
+ <script>
108
+ // you have `data` property defined in the scope
109
+ ...
110
+ myConditionFunc(data) {
111
+ return data.smth === "what-you-need";
112
+ }
113
+ ...
114
+ </script>
115
+ ```
116
+
117
+ If a condition was not met a step gets a status `skipped`.
118
+
119
+ ## Forward only steps
120
+
121
+ If you have an intermediate step loading data via AJAX request and then automatically calling `next()`, you can flag it as `forward-only`. This will ensure that navigation to the previous step is possible and does not lead to another AJAX request which leads to next step again, breaking the flow for a user.
122
+
123
+ ```html
124
+ <lion-steps>
125
+ <lion-step>preliminary step</lion-step>
126
+ <lion-step forward-only>data is loaded and next() is called automatically afterwards</lion-step>
127
+ <!-- user decides to go to previous step here -->
128
+ <lion-step>do smth with data</lion-step>
129
+ </lion-steps>
130
+ ```
131
+
132
+ ## Events
133
+
134
+ If you need to be notified when transition between steps occurs use the `transition` event by providing steps data:
135
+
136
+ ```html
137
+ <lion-steps @transition="${onTransition}">
138
+ <lion-step>Step 1</lion-step>
139
+ <lion-step>Step 2</lion-step>
140
+ <lion-step>Step 3</lion-step>
141
+ </lion-steps>
142
+
143
+ <script>
144
+ ...
145
+ onTransition(event) {
146
+ console.log(event.detail.fromStep.number); // Number
147
+ console.log(event.detail.fromStep.element); // <lion-step>
148
+ console.log(event.detail.toStep.number); // Number
149
+ console.log(event.detail.toStep.element); // <lion-step>
150
+ }
151
+ ...
152
+ </script>
153
+ ```
154
+
155
+ For notifications about specific step status change you can use individual events like this:
156
+
157
+ ```html
158
+ <lion-steps>
159
+ <lion-step @leave="${onLeave}">Step 1</lion-step>
160
+ <lion-step @skip="${onSkip}">Step 2</lion-step>
161
+ <lion-step @enter="${onEnter}">Step 3</lion-step>
162
+ </lion-steps>
163
+ ```
@@ -0,0 +1,3 @@
1
+ # Switch ||50
2
+
3
+ -> go to Overview
@@ -0,0 +1,75 @@
1
+ # Switch >> Overview ||10
2
+
3
+ <p class="lion-paragraph--emphasis">The Switch is used to toggle a property or feature on or off.</p>
4
+
5
+ ```js script
6
+ import { html as previewHtml } from '@mdjs/mdjs-preview';
7
+ import '@lion/ui/define/lion-switch.js';
8
+ ```
9
+
10
+ ```js preview-story
11
+ import { html, LitElement } from 'lit';
12
+ import { ScopedElementsMixin } from '@open-wc/scoped-elements';
13
+ import { LionSwitch } from '@lion/ui/switch.js';
14
+
15
+ class MyComponent extends ScopedElementsMixin(LitElement) {
16
+ static get scopedElements() {
17
+ return { 'lion-switch': LionSwitch };
18
+ }
19
+ render() {
20
+ return html`<lion-switch label="Label" help-text="Help text"></lion-switch>`;
21
+ }
22
+ }
23
+ customElements.define('my-component', MyComponent);
24
+
25
+ export const main = () => previewHtml`<my-component></my-component>`;
26
+ ```
27
+
28
+ ## When to use
29
+
30
+ - Toggling the component on or off has an immediate action (no confirmation by the user required).
31
+ - The Switch is typically used in setting applications.
32
+ - The Switch is not a Checkbox in disguise and can not be used as part of a form.
33
+
34
+ ## Features
35
+
36
+ - Get or set the checked state (boolean) - `checked` boolean attribute
37
+ - Pre-select an option by setting the `checked` boolean attribute
38
+ - Get or set the value of the choice - `choiceValue()`
39
+
40
+ ## How to use
41
+
42
+ ### Code
43
+
44
+ 1. Install
45
+
46
+ ```bash
47
+ npm i --save @lion/ui
48
+ ```
49
+
50
+ 2. Use scoped registry
51
+
52
+ ```js
53
+ import { html, LitElement } from 'lit';
54
+ import { ScopedElementsMixin } from '@open-wc/scoped-elements';
55
+ import { LionSwitch } from '@lion/ui/switch.js';
56
+
57
+ class MyComponent extends ScopedElementsMixin(LitElement) {
58
+ static get scopedElements() {
59
+ return { 'lion-switch': LionSwitch };
60
+ }
61
+ render() {
62
+ return html`<lion-switch></lion-switch>`;
63
+ }
64
+ }
65
+ ```
66
+
67
+ 3. Use html
68
+
69
+ ```html
70
+ <script type="module">
71
+ import '@lion/ui/define/lion-switch.js';
72
+ </script>
73
+
74
+ <lion-switch></lion-switch>
75
+ ```