@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,125 @@
1
+ # Progress Indicator >> Examples ||30
2
+
3
+ ```js script
4
+ import { html } from '@mdjs/mdjs-preview';
5
+ import '@lion/ui/define/lion-progress-indicator.js';
6
+ import './assets/my-indeterminate-progress-spinner.js';
7
+ import './assets/my-determinate-progress-bar.js';
8
+
9
+ const changeProgress = () => {
10
+ const progressBar = document.getElementsByName('my-bar')[0];
11
+ progressBar.value = Math.floor(Math.random() * 101);
12
+ };
13
+ ```
14
+
15
+ ## Styled progress bar example
16
+
17
+ Add custom styles and more features by extending the `LionProgressIndicator`.
18
+
19
+ ```js
20
+ export class MyDeterminateProgressBar extends LionProgressIndicator {
21
+ static get styles() {
22
+ return [
23
+ css`
24
+ :host {
25
+ display: block;
26
+ position: relative;
27
+ width: 100%;
28
+ height: 6px;
29
+ overflow: hidden;
30
+ background-color: #eee;
31
+ }
32
+
33
+ .progress__filled {
34
+ height: inherit;
35
+ background-color: green;
36
+ border-radius: inherit;
37
+ }
38
+ `,
39
+ ];
40
+ }
41
+
42
+ _graphicTemplate() {
43
+ return html`
44
+ <div class="progress__filled" style="width: \${this._progressPercentage}%"></div>
45
+ `;
46
+ }
47
+ }
48
+ ```
49
+
50
+ By given the progress-indicator a value it becomes determinate.
51
+ The min is automatically set to "0" and max to "100", but they can be set to your local needs.
52
+
53
+ ```js preview-story
54
+ export const progressBarDemo = () =>
55
+ html`
56
+ <my-determinate-progress-bar
57
+ aria-label="Interest rate"
58
+ name="my-bar"
59
+ value="50"
60
+ ></my-determinate-progress-bar>
61
+ <button @click="${changeProgress}">Randomize Value</button>
62
+ `;
63
+ ```
64
+
65
+ ## Styled progress spinner example
66
+
67
+ `LionProgressIndicator` is designed to be extended to add visuals. Implement the `_graphicTemplate()` method to set the rendered content and apply styles normally.
68
+
69
+ ```js
70
+ class MyIndeterminateProgressSpinner extends LionProgressIndicator {
71
+ static get styles() {
72
+ return [
73
+ css`
74
+ .progress__icon {
75
+ display: inline-block;
76
+ width: 48px;
77
+ height: 48px;
78
+ animation: spinner-rotate 2s linear infinite;
79
+ }
80
+
81
+ .progress__filled {
82
+ animation: spinner-dash 1.35s ease-in-out infinite;
83
+ fill: none;
84
+ stroke-width: 6px;
85
+ stroke: var(--primary-color);
86
+ }
87
+
88
+ @keyframes spinner-rotate {
89
+ to {
90
+ transform: rotate(360deg);
91
+ }
92
+ }
93
+
94
+ @keyframes spinner-dash {
95
+ 0% {
96
+ stroke-dasharray: 6, 122;
97
+ stroke-dashoffset: 0;
98
+ }
99
+ 50% {
100
+ stroke-dasharray: 100, 28;
101
+ stroke-dashoffset: -16;
102
+ }
103
+ 100% {
104
+ stroke-dasharray: 6, 122;
105
+ stroke-dashoffset: -127;
106
+ }
107
+ }
108
+ `,
109
+ ];
110
+ }
111
+
112
+ _graphicTemplate() {
113
+ return html`
114
+ <svg class="progress__icon" viewBox="20 20 47 47">
115
+ <circle class="progress__filled" cx="44" cy="44" r="20.2" />
116
+ </svg>
117
+ `;
118
+ }
119
+ }
120
+ ```
121
+
122
+ ```js preview-story
123
+ export const main = () =>
124
+ html` <my-indeterminate-progress-spinner></my-indeterminate-progress-spinner> `;
125
+ ```
@@ -0,0 +1,3 @@
1
+ # Progress Indicator ||30
2
+
3
+ -> go to Overview
@@ -0,0 +1,36 @@
1
+ # Progress Indicator >> Overview ||10
2
+
3
+ A web component that implements accessibility requirements for progress indicators.
4
+
5
+ ```js script
6
+ import { html } from '@mdjs/mdjs-preview';
7
+ import '@lion/ui/define/lion-progress-indicator.js';
8
+ ```
9
+
10
+ ```html
11
+ <lion-progress-indicator aria-label="Interest rate" value="50"></lion-progress-indicator>
12
+ ```
13
+
14
+ ## Features
15
+
16
+ This component is designed to be extended in order to add visuals.
17
+
18
+ - Can be indeterminate or determinate, depending on whether it has a value.
19
+ - Accessibility compliant
20
+ - Localized "Loading" label in case of an indeterminate progress-indicator
21
+ - Implementation independent of visuals
22
+ - `value`: progress value, setting this makes the progress-indicator determinate.
23
+ - `min`: progress min value
24
+ - `max`: progress max value
25
+
26
+ ## Installation
27
+
28
+ ```bash
29
+ npm i --save @lion/ui
30
+ ```
31
+
32
+ ```js
33
+ import { LionProgressIndicator } from '@lion/ui/progress-indicator.js';
34
+ // or
35
+ import '@lion/ui/define/lion-progress-indicator.js';
36
+ ```
@@ -0,0 +1,3 @@
1
+ # Radio Group ||30
2
+
3
+ -> go to Overview
@@ -0,0 +1,46 @@
1
+ # Radio Group >> Overview ||10
2
+
3
+ A web component that enhances the functionality of the native `<input type="radio">` element. Its purpose is to provide a way for users to check a **single** option amongst a set of choices.
4
+
5
+ You should use our `radio` inside this element.
6
+
7
+ ```js script
8
+ import { html } from '@mdjs/mdjs-preview';
9
+ import '@lion/ui/define/lion-radio-group.js';
10
+ import '@lion/ui/define/lion-radio.js';
11
+ ```
12
+
13
+ ```js preview-story
14
+ export const main = () => html`
15
+ <lion-radio-group name="dinos" label="What are your favourite dinosaurs?">
16
+ <lion-radio label="allosaurus" .choiceValue=${'allosaurus'}></lion-radio>
17
+ <lion-radio label="brontosaurus" .choiceValue=${'brontosaurus'}></lion-radio>
18
+ <lion-radio label="diplodocus" .choiceValue=${'diplodocus'}></lion-radio>
19
+ </lion-radio-group>
20
+ `;
21
+ ```
22
+
23
+ - Make sure that to use a name attribute as it is necessary for our [form](https://github.com/ing-bank/lion/blob/fbf0bd22378e76aa4261c2a97faf8be4f5fc461e/docs/components/form/overview.md)'s serialization result.
24
+ - If you have many options for a user to pick from, consider using our [select](https://github.com/ing-bank/lion/blob/fbf0bd22378e76aa4261c2a97faf8be4f5fc461e/docs/components/select/overview.md) instead.
25
+
26
+ ## Features
27
+
28
+ Since it extends from our [fieldset](https://github.com/ing-bank/lion/blob/fbf0bd22378e76aa4261c2a97faf8be4f5fc461e/docs/components/fieldset/overview.md), it has all the features a fieldset has.
29
+
30
+ - Get or set the checked value of the group:
31
+ - modelValue (default) - `checkedValue()`
32
+ - formattedValue - `formattedValue()`
33
+ - serializedValue - `serializedValue()`
34
+
35
+ ## Installation
36
+
37
+ ```bash
38
+ npm i --save @lion/ui
39
+ ```
40
+
41
+ ```js
42
+ import { LionRadioGroup, LionRadio } from '@lion/ui/radio-group.js';
43
+ // or
44
+ import '@lion/ui/define/lion-radio-group.js';
45
+ import '@lion/ui/define/lion-radio.js';
46
+ ```
@@ -0,0 +1,140 @@
1
+ # Radio Group >> Use Cases ||20
2
+
3
+ ```js script
4
+ import { html } from '@mdjs/mdjs-preview';
5
+ import '@lion/ui/define/lion-radio-group.js';
6
+ import '@lion/ui/define/lion-radio.js';
7
+ ```
8
+
9
+ ## Model value
10
+
11
+ The `modelValue` of a `lion-radio-group` is string equal to the `choiceValue` of the `lion-radio` element that has been checked.
12
+
13
+ Given the dinosaur example above, say that we were to select the last option (diplodocus).
14
+
15
+ Then the `modelValue` of the `lion-radio-group` will look as follows:
16
+
17
+ ```js
18
+ const groupElement = [parent].querySelector('lion-radio-group');
19
+ groupElement.modelValue;
20
+ => "diplodocus";
21
+ ```
22
+
23
+ ## The `name` attribute
24
+
25
+ The `name` attribute of a `lion-radio-group` automatically gets assigned to its `lion-radio` children. You can also specify names for the `lion-radio` elements, but if this name is different from the name assigned to `lion-radio-group`, then an exception will be thrown.
26
+
27
+ Our recommendation would be to set the `name` attribute only on the `lion-radio-group` and not on the `lion-checkbox` elements.
28
+
29
+ ## Pre-select
30
+
31
+ You can pre-select an option by adding the checked attribute to the selected `lion-radio`.
32
+
33
+ ```js preview-story
34
+ export const preSelect = () => html`
35
+ <lion-radio-group name="dinos_2" label="What are your favourite dinosaurs?">
36
+ <lion-radio label="allosaurus" .choiceValue=${'allosaurus'}></lion-radio>
37
+ <lion-radio label="brontosaurus" .choiceValue=${'brontosaurus'} checked></lion-radio>
38
+ <lion-radio label="diplodocus" .choiceValue=${'diplodocus'}></lion-radio>
39
+ </lion-radio-group>
40
+ `;
41
+ ```
42
+
43
+ ## Disabled
44
+
45
+ You can disable a specific `lion-radio` option by adding the `disabled` attribute.
46
+
47
+ ```js preview-story
48
+ export const disabledRadio = () => html`
49
+ <lion-radio-group name="dinos_4" label="What are your favourite dinosaurs?">
50
+ <lion-radio label="allosaurus" .choiceValue=${'allosaurus'}></lion-radio>
51
+ <lion-radio label="brontosaurus" .choiceValue=${'brontosaurus'} disabled></lion-radio>
52
+ <lion-radio label="diplodocus" .choiceValue=${'diplodocus'}></lion-radio>
53
+ </lion-radio-group>
54
+ `;
55
+ ```
56
+
57
+ You can do the same thing for the entire group by setting the `disabled` attribute on the `lion-radio-group` element.
58
+
59
+ ```js preview-story
60
+ export const disabledGroup = () => html`
61
+ <lion-radio-group name="dinos_6" label="What are your favourite dinosaurs?" disabled>
62
+ <lion-radio label="allosaurus" .choiceValue=${'allosaurus'}></lion-radio>
63
+ <lion-radio label="brontosaurus" .choiceValue=${'brontosaurus'}></lion-radio>
64
+ <lion-radio label="diplodocus" .choiceValue=${'diplodocus'}></lion-radio>
65
+ </lion-radio-group>
66
+ `;
67
+ ```
68
+
69
+ ## Label
70
+
71
+ You can use `slot="label"` instead of the `label` attribute for defining more complex labels, such as containing screen reader only text or an anchor.
72
+
73
+ ```js preview-story
74
+ export const label = () => html`
75
+ <lion-radio-group name="dinos_7" label="Favourite dinosaur">
76
+ <lion-radio .choiceValue=${'allosaurus'}>
77
+ <label slot="label"
78
+ ><a href="https://wikipedia.org/wiki/allosaurus" target="_blank">allosaurus</a></label
79
+ >
80
+ </lion-radio>
81
+ <lion-radio .choiceValue=${'brontosaurus'}>
82
+ <label slot="label"
83
+ ><a href="https://wikipedia.org/wiki/brontosaurus" target="_blank">brontosaurus</a></label
84
+ >
85
+ </lion-radio>
86
+ <lion-radio .choiceValue=${'diplodocus'}>
87
+ <label slot="label"
88
+ ><a href="https://wikipedia.org/wiki/diplodocus" target="_blank">diplodocus</a></label
89
+ >
90
+ </lion-radio>
91
+ </lion-radio-group>
92
+ `;
93
+ ```
94
+
95
+ ## Help text
96
+
97
+ You can add help text on each checkbox with `help-text` attribute on the `<lion-radio>`.
98
+
99
+ ```js preview-story
100
+ export const helpText = () => html`
101
+ <lion-radio-group name="dinosTwo" label="Favourite dinosaur">
102
+ <lion-radio
103
+ label="allosaurus"
104
+ .choiceValue=${'allosaurus'}
105
+ help-text="Allosaurus is a genus of carnivorous theropod dinosaur that lived 155 to 145 million years ago during the late Jurassic period"
106
+ ></lion-radio>
107
+ <lion-radio
108
+ label="brontosaurus"
109
+ .choiceValue=${'brontosaurus'}
110
+ help-text="Brontosaurus is a genus of gigantic quadruped sauropod dinosaurs"
111
+ ></lion-radio>
112
+ <lion-radio
113
+ label="diplodocus"
114
+ .choiceValue=${'diplodocus'}
115
+ help-text="Diplodocus is a genus of diplodocid sauropod dinosaurs whose fossils were first discovered in 1877 by S. W. Williston"
116
+ ></lion-radio>
117
+ </lion-radio-group>
118
+ `;
119
+ ```
120
+
121
+ ## Event
122
+
123
+ You can listen to the `model-value-changed` event whenever the value of the radio group is changed.
124
+
125
+ ```js preview-story
126
+ export const event = ({ shadowRoot }) => html`
127
+ <lion-radio-group
128
+ name="dinosTwo"
129
+ label="Favourite dinosaur"
130
+ @model-value-changed=${ev =>
131
+ (ev.target.parentElement.querySelector('#selectedDinosaur').innerText = ev.target.modelValue)}
132
+ >
133
+ <lion-radio label="allosaurus" .choiceValue=${'allosaurus'}></lion-radio>
134
+ <lion-radio label="brontosaurus" .choiceValue=${'brontosaurus'}></lion-radio>
135
+ <lion-radio label="diplodocus" .choiceValue=${'diplodocus'}></lion-radio>
136
+ </lion-radio-group>
137
+ <br />
138
+ <span>Selected dinosaur: <strong id="selectedDinosaur">N/A</strong></span>
139
+ `;
140
+ ```
@@ -0,0 +1,3 @@
1
+ # Select ||40
2
+
3
+ -> go to Overview
@@ -0,0 +1,44 @@
1
+ # Select >> Overview ||10
2
+
3
+ A web component that works as a wrapper around the native `select`.
4
+
5
+ You cannot use interactive elements inside the options. Avoid very long names to facilitate the understandability and perceivability for screen reader users.
6
+ Sets of options where each option name starts with the same word or phrase can also significantly degrade usability for keyboard and screen reader users.
7
+
8
+ ```js script
9
+ import { html } from '@mdjs/mdjs-preview';
10
+ import '@lion/ui/define/lion-select.js';
11
+ ```
12
+
13
+ ```js preview-story
14
+ export const main = () => html`
15
+ <lion-select name="favoriteColor" label="Favorite color">
16
+ <select slot="input">
17
+ <option selected hidden value>Please select</option>
18
+ <option value="red">Red</option>
19
+ <option value="hotpink">Hotpink</option>
20
+ <option value="teal">Teal</option>
21
+ </select>
22
+ </lion-select>
23
+ `;
24
+ ```
25
+
26
+ For this form element it is important to put the `slot="input"` with the native `select` yourself, because you are responsible for filling it with `<option>`s.
27
+ For most other form elements we do this for you, because there's no need to put html inside the native form inputs.
28
+
29
+ ## Features
30
+
31
+ - Catches and forwards the select events
32
+ - Can be set to required or disabled
33
+
34
+ ## Installation
35
+
36
+ ```bash
37
+ npm i --save @lion/ui
38
+ ```
39
+
40
+ ```js
41
+ import { LionSelect } from '@lion/ui/select.js';
42
+ // or
43
+ import '@lion/ui/define/lion-select.js';
44
+ ```
@@ -0,0 +1,55 @@
1
+ # Select >> Use Cases ||20
2
+
3
+ ```js script
4
+ import { html } from '@mdjs/mdjs-preview';
5
+ import '@lion/ui/define/lion-select.js';
6
+ ```
7
+
8
+ ## Pre-select
9
+
10
+ You can preselect an option by setting the property modelValue.
11
+
12
+ ```js preview-story
13
+ export const preSelect = () => html`
14
+ <lion-select name="favoriteColor" label="Favorite color" .modelValue=${'hotpink'}>
15
+ <select slot="input">
16
+ <option selected hidden value>Please select</option>
17
+ <option value="red">Red</option>
18
+ <option value="hotpink">Hotpink</option>
19
+ <option value="teal">Teal</option>
20
+ </select>
21
+ </lion-select>
22
+ `;
23
+ ```
24
+
25
+ ## Disabled
26
+
27
+ You can disable an option by adding the `disabled` attribute to an option.
28
+
29
+ ```js preview-story
30
+ export const disabledOption = () => html`
31
+ <lion-select name="favoriteColor" label="Favorite color">
32
+ <select slot="input">
33
+ <option selected hidden value>Please select</option>
34
+ <option value="red">Red</option>
35
+ <option value="hotpink" disabled>Hotpink</option>
36
+ <option value="teal">Teal</option>
37
+ </select>
38
+ </lion-select>
39
+ `;
40
+ ```
41
+
42
+ Or by setting the `disabled` attribute on the entire `lion-select` field.
43
+
44
+ ```js preview-story
45
+ export const disabledSelect = () => html`
46
+ <lion-select name="favoriteColor" label="Favorite color" disabled>
47
+ <select slot="input">
48
+ <option selected hidden value>Please select</option>
49
+ <option value="red">Red</option>
50
+ <option value="hotpink">Hotpink</option>
51
+ <option value="teal">Teal</option>
52
+ </select>
53
+ </lion-select>
54
+ `;
55
+ ```
@@ -0,0 +1,31 @@
1
+ # Select Rich >> Examples ||30
2
+
3
+ ```js script
4
+ import { html } from '@mdjs/mdjs-preview';
5
+ import { repeat } from 'lit/directives/repeat.js';
6
+ import '@lion/ui/define/lion-select-rich.js';
7
+ import './src/intl-select-rich.js';
8
+ import { regionMetaList } from './src/regionMetaList.js';
9
+ ```
10
+
11
+ ## Select Rich International
12
+
13
+ A visually advanced Subclasser implementation of `LionSelectRich`.
14
+
15
+ Inspired by:
16
+
17
+ - [intl-tel-input](https://intl-tel-input.com/)
18
+
19
+ ```js story
20
+ export const IntlSelectRich = () => html`
21
+ <intl-select-rich label="Choose a region" name="regions">
22
+ ${repeat(
23
+ regionMetaList,
24
+ regionMeta => regionMeta.regionCode,
25
+ regionMeta =>
26
+ html` <intl-option .choiceValue="${regionMeta.regionCode}" .regionMeta="${regionMeta}">
27
+ </intl-option>`,
28
+ )}
29
+ </intl-select-rich>
30
+ `;
31
+ ```
@@ -0,0 +1,3 @@
1
+ # Select Rich ||40
2
+
3
+ -> go to Overview
@@ -0,0 +1,46 @@
1
+ # Select Rich >> Overview ||10
2
+
3
+ This web component is a 'rich' version of the native `<select>` element.
4
+ It allows providing fully customized options and a fully customized invoker button and is meant to be used whenever the native `<select>` doesn't provide enough
5
+ styling,theming or user interaction opportunities.
6
+
7
+ Its implementation is based on the following Design pattern:
8
+ <https://www.w3.org/TR/wai-aria-practices/examples/listbox/listbox-collapsible.html>
9
+
10
+ ```js script
11
+ import { LitElement, html } from '@mdjs/mdjs-preview';
12
+ import '@lion/ui/define/lion-select-rich.js';
13
+ import '@lion/ui/define/lion-option.js';
14
+ ```
15
+
16
+ ```js preview-story
17
+ export const main = () => html`
18
+ <lion-select-rich name="favoriteColor" label="Favorite color">
19
+ <lion-option .choiceValue=${'red'}>Red</lion-option>
20
+ <lion-option .choiceValue=${'hotpink'}>Hotpink</lion-option>
21
+ <lion-option .choiceValue=${'blue'}>Blue</lion-option>
22
+ </lion-select-rich>
23
+ `;
24
+ ```
25
+
26
+ ## Features
27
+
28
+ - Fully accessible
29
+ - Flexible API
30
+ - Fully customizable option elements
31
+ - Fully customizable invoker element
32
+ - Mimics native select interaction mode (windows/linux and mac)
33
+
34
+ ## Installation
35
+
36
+ ```bash
37
+ npm i --save @lion/ui
38
+ ```
39
+
40
+ ```js
41
+ import { LionSelectRich } from '@lion/ui/select-rich.js';
42
+ import { LionOptions, LionOption } from '@lion/ui/listbox.js';
43
+ // or
44
+ import '@lion/ui/define/lion-select-rich.js';
45
+ import '@lion/ui/define/lion-option.js';
46
+ ```