@mgdis/mg-components 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/LICENSE +29 -0
  2. package/dist/cjs/css-shim-a22512c4.js +6 -0
  3. package/dist/cjs/index-85a4a0b6.js +1674 -0
  4. package/dist/cjs/index.cjs.js +2 -0
  5. package/dist/cjs/loader.cjs.js +35 -0
  6. package/dist/cjs/mg-badge_20.cjs.entry.js +4661 -0
  7. package/dist/cjs/mg-components.cjs.js +23 -0
  8. package/dist/cjs/shadow-css-8940f82d.js +390 -0
  9. package/dist/collection/collection-manifest.json +31 -0
  10. package/dist/collection/components/atoms/mg-badge/mg-badge.conf.js +4 -0
  11. package/dist/collection/components/atoms/mg-badge/mg-badge.css +99 -0
  12. package/dist/collection/components/atoms/mg-badge/mg-badge.js +148 -0
  13. package/dist/collection/components/atoms/mg-badge/mg-badge.stories.js +27 -0
  14. package/dist/collection/components/atoms/mg-button/mg-button.conf.js +4 -0
  15. package/dist/collection/components/atoms/mg-button/mg-button.css +134 -0
  16. package/dist/collection/components/atoms/mg-button/mg-button.js +236 -0
  17. package/dist/collection/components/atoms/mg-button/mg-button.stories.js +38 -0
  18. package/dist/collection/components/atoms/mg-character-left/mg-character-left.css +3 -0
  19. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +133 -0
  20. package/dist/collection/components/atoms/mg-character-left/mg-character-left.stories.js +15 -0
  21. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +54 -0
  22. package/dist/collection/components/atoms/mg-icon/mg-icon.css +57 -0
  23. package/dist/collection/components/atoms/mg-icon/mg-icon.js +155 -0
  24. package/dist/collection/components/atoms/mg-icon/mg-icon.stories.js +34 -0
  25. package/dist/collection/components/atoms/mg-input-title/mg-input-title.css +12 -0
  26. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +95 -0
  27. package/dist/collection/components/atoms/mg-input-title/mg-input-title.stories.js +21 -0
  28. package/dist/collection/components/atoms/mg-tag/mg-tag.conf.js +4 -0
  29. package/dist/collection/components/atoms/mg-tag/mg-tag.css +73 -0
  30. package/dist/collection/components/atoms/mg-tag/mg-tag.js +94 -0
  31. package/dist/collection/components/atoms/mg-tag/mg-tag.stories.js +25 -0
  32. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.css +44 -0
  33. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +225 -0
  34. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.stories.js +26 -0
  35. package/dist/collection/components/molecules/inputs/MgInput.conf.js +7 -0
  36. package/dist/collection/components/molecules/inputs/MgInput.js +130 -0
  37. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js +1 -0
  38. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +156 -0
  39. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +444 -0
  40. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.stories.js +57 -0
  41. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.conf.js +7 -0
  42. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +171 -0
  43. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +467 -0
  44. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.stories.js +46 -0
  45. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.js +11 -0
  46. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +199 -0
  47. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +633 -0
  48. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.stories.js +68 -0
  49. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +195 -0
  50. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +401 -0
  51. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.stories.js +43 -0
  52. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.conf.js +1 -0
  53. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +156 -0
  54. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +443 -0
  55. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.stories.js +65 -0
  56. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.conf.js +1 -0
  57. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +201 -0
  58. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +532 -0
  59. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.stories.js +70 -0
  60. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +222 -0
  61. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +589 -0
  62. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.stories.js +115 -0
  63. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +217 -0
  64. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +553 -0
  65. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.stories.js +52 -0
  66. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.js +1 -0
  67. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +213 -0
  68. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +457 -0
  69. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.stories.js +73 -0
  70. package/dist/collection/components/molecules/mg-message/mg-message.conf.js +4 -0
  71. package/dist/collection/components/molecules/mg-message/mg-message.css +94 -0
  72. package/dist/collection/components/molecules/mg-message/mg-message.js +285 -0
  73. package/dist/collection/components/molecules/mg-message/mg-message.stories.js +43 -0
  74. package/dist/collection/components/molecules/mg-pagination/mg-pagination.conf.js +5 -0
  75. package/dist/collection/components/molecules/mg-pagination/mg-pagination.css +39 -0
  76. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +218 -0
  77. package/dist/collection/components/molecules/mg-pagination/mg-pagination.stories.js +23 -0
  78. package/dist/collection/components/molecules/mg-popover/mg-popover.css +59 -0
  79. package/dist/collection/components/molecules/mg-popover/mg-popover.js +249 -0
  80. package/dist/collection/components/molecules/mg-popover/mg-popover.stories.js +36 -0
  81. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +1 -0
  82. package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +30 -0
  83. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +212 -0
  84. package/dist/collection/components/molecules/mg-tabs/mg-tabs.stories.js +40 -0
  85. package/dist/collection/fonts/OpenSans-Regular.ttf +0 -0
  86. package/dist/collection/fonts/OpenSans-SemiBold.ttf +0 -0
  87. package/dist/collection/fonts/Poppins-Bold.ttf +0 -0
  88. package/dist/collection/index.js +1 -0
  89. package/dist/collection/locales/index.js +4 -0
  90. package/dist/collection/stories/buttons.stories.js +43 -0
  91. package/dist/collection/stories/grids.stories.js +50 -0
  92. package/dist/collection/stories/icons.stories.js +20 -0
  93. package/dist/collection/stories/messages.stories.js +44 -0
  94. package/dist/collection/stories/tags.stories.js +13 -0
  95. package/dist/collection/stories/typography.stories.js +28 -0
  96. package/dist/collection/utils/components.utils.js +67 -0
  97. package/dist/collection/utils/locale.utils.js +32 -0
  98. package/dist/collection/utils/test.utils.js +26 -0
  99. package/dist/collection/variables.css +177 -0
  100. package/dist/collection/variables.scss +177 -0
  101. package/dist/components/MgInput.js +140 -0
  102. package/dist/components/components.utils.js +69 -0
  103. package/dist/components/index.d.ts +26 -0
  104. package/dist/components/index.js +1 -0
  105. package/dist/components/index2.js +54 -0
  106. package/dist/components/locale.utils.js +35 -0
  107. package/dist/components/mg-badge.d.ts +11 -0
  108. package/dist/components/mg-badge.js +6 -0
  109. package/dist/components/mg-badge2.js +82 -0
  110. package/dist/components/mg-button.d.ts +11 -0
  111. package/dist/components/mg-button.js +6 -0
  112. package/dist/components/mg-button2.js +148 -0
  113. package/dist/components/mg-character-left.d.ts +11 -0
  114. package/dist/components/mg-character-left.js +6 -0
  115. package/dist/components/mg-character-left2.js +77 -0
  116. package/dist/components/mg-icon.d.ts +11 -0
  117. package/dist/components/mg-icon.js +6 -0
  118. package/dist/components/mg-icon2.js +147 -0
  119. package/dist/components/mg-input-checkbox.d.ts +11 -0
  120. package/dist/components/mg-input-checkbox.js +222 -0
  121. package/dist/components/mg-input-date.d.ts +11 -0
  122. package/dist/components/mg-input-date.js +245 -0
  123. package/dist/components/mg-input-numeric.d.ts +11 -0
  124. package/dist/components/mg-input-numeric.js +324 -0
  125. package/dist/components/mg-input-password.d.ts +11 -0
  126. package/dist/components/mg-input-password.js +171 -0
  127. package/dist/components/mg-input-radio.d.ts +11 -0
  128. package/dist/components/mg-input-radio.js +211 -0
  129. package/dist/components/mg-input-select.d.ts +11 -0
  130. package/dist/components/mg-input-select.js +6 -0
  131. package/dist/components/mg-input-select2.js +243 -0
  132. package/dist/components/mg-input-text.d.ts +11 -0
  133. package/dist/components/mg-input-text.js +242 -0
  134. package/dist/components/mg-input-textarea.d.ts +11 -0
  135. package/dist/components/mg-input-textarea.js +224 -0
  136. package/dist/components/mg-input-title.d.ts +11 -0
  137. package/dist/components/mg-input-title.js +6 -0
  138. package/dist/components/mg-input-title2.js +55 -0
  139. package/dist/components/mg-input-toggle.d.ts +11 -0
  140. package/dist/components/mg-input-toggle.js +247 -0
  141. package/dist/components/mg-message.d.ts +11 -0
  142. package/dist/components/mg-message.js +183 -0
  143. package/dist/components/mg-pagination.d.ts +11 -0
  144. package/dist/components/mg-pagination.js +175 -0
  145. package/dist/components/mg-popover.d.ts +11 -0
  146. package/dist/components/mg-popover.js +183 -0
  147. package/dist/components/mg-tabs.d.ts +11 -0
  148. package/dist/components/mg-tabs.js +160 -0
  149. package/dist/components/mg-tag.d.ts +11 -0
  150. package/dist/components/mg-tag.js +76 -0
  151. package/dist/components/mg-tooltip.d.ts +11 -0
  152. package/dist/components/mg-tooltip.js +6 -0
  153. package/dist/components/mg-tooltip2.js +150 -0
  154. package/dist/components/popper.js +1784 -0
  155. package/dist/esm/css-shim-7c240feb.js +4 -0
  156. package/dist/esm/index-e3e84606.js +1643 -0
  157. package/dist/esm/index.js +1 -0
  158. package/dist/esm/loader.js +31 -0
  159. package/dist/esm/mg-badge_20.entry.js +4638 -0
  160. package/dist/esm/mg-components.js +21 -0
  161. package/dist/esm/polyfills/core-js.js +11 -0
  162. package/dist/esm/polyfills/css-shim.js +1 -0
  163. package/dist/esm/polyfills/dom.js +79 -0
  164. package/dist/esm/polyfills/es5-html-element.js +1 -0
  165. package/dist/esm/polyfills/index.js +34 -0
  166. package/dist/esm/polyfills/system.js +6 -0
  167. package/dist/esm/shadow-css-5d2d01ce.js +388 -0
  168. package/dist/esm-es5/css-shim-7c240feb.js +1 -0
  169. package/dist/esm-es5/index-e3e84606.js +1 -0
  170. package/dist/esm-es5/index.js +0 -0
  171. package/dist/esm-es5/loader.js +1 -0
  172. package/dist/esm-es5/mg-badge_20.entry.js +2 -0
  173. package/dist/esm-es5/mg-components.js +1 -0
  174. package/dist/esm-es5/shadow-css-5d2d01ce.js +12 -0
  175. package/dist/index.cjs.js +1 -0
  176. package/dist/index.js +1 -0
  177. package/dist/mg-components/fonts/OpenSans-Regular.ttf +0 -0
  178. package/dist/mg-components/fonts/OpenSans-SemiBold.ttf +0 -0
  179. package/dist/mg-components/fonts/Poppins-Bold.ttf +0 -0
  180. package/dist/mg-components/index.esm.js +0 -0
  181. package/dist/mg-components/mg-components.css +1 -0
  182. package/dist/mg-components/mg-components.esm.js +1 -0
  183. package/dist/mg-components/mg-components.js +132 -0
  184. package/dist/mg-components/p-1cd24462.system.js +1 -0
  185. package/dist/mg-components/p-2e2f6b27.system.entry.js +2 -0
  186. package/dist/mg-components/p-366a224e.js +1 -0
  187. package/dist/mg-components/p-422c429b.system.js +1 -0
  188. package/dist/mg-components/p-50ea2036.system.js +1 -0
  189. package/dist/mg-components/p-62fa3797.js +1 -0
  190. package/dist/mg-components/p-71d57b8b.system.js +13 -0
  191. package/dist/mg-components/p-9a215712.system.js +1 -0
  192. package/dist/mg-components/p-cbf0464b.entry.js +1 -0
  193. package/dist/mg-components/p-f6455ab3.js +12 -0
  194. package/dist/mg-components/variables.css +177 -0
  195. package/dist/mg-components/variables.scss +177 -0
  196. package/dist/types/components/atoms/mg-badge/mg-badge.conf.d.ts +8 -0
  197. package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +36 -0
  198. package/dist/types/components/atoms/mg-badge/mg-badge.stories.d.ts +19 -0
  199. package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +4 -0
  200. package/dist/types/components/atoms/mg-button/mg-button.d.ts +67 -0
  201. package/dist/types/components/atoms/mg-button/mg-button.stories.d.ts +16 -0
  202. package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +39 -0
  203. package/dist/types/components/atoms/mg-character-left/mg-character-left.stories.d.ts +7 -0
  204. package/dist/types/components/atoms/mg-icon/mg-icon.conf.d.ts +12 -0
  205. package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +36 -0
  206. package/dist/types/components/atoms/mg-icon/mg-icon.stories.d.ts +26 -0
  207. package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +24 -0
  208. package/dist/types/components/atoms/mg-input-title/mg-input-title.stories.d.ts +6 -0
  209. package/dist/types/components/atoms/mg-tag/mg-tag.conf.d.ts +4 -0
  210. package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +25 -0
  211. package/dist/types/components/atoms/mg-tag/mg-tag.stories.d.ts +14 -0
  212. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +56 -0
  213. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.stories.d.ts +11 -0
  214. package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +10 -0
  215. package/dist/types/components/molecules/inputs/MgInput.d.ts +35 -0
  216. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +19 -0
  217. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +120 -0
  218. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.stories.d.ts +6 -0
  219. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.conf.d.ts +6 -0
  220. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +128 -0
  221. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.stories.d.ts +7 -0
  222. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.d.ts +10 -0
  223. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +173 -0
  224. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.stories.d.ts +21 -0
  225. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +111 -0
  226. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.stories.d.ts +9 -0
  227. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.conf.d.ts +9 -0
  228. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +121 -0
  229. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.stories.d.ts +15 -0
  230. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.conf.d.ts +18 -0
  231. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +133 -0
  232. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.stories.d.ts +14 -0
  233. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +160 -0
  234. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.stories.d.ts +26 -0
  235. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +150 -0
  236. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.stories.d.ts +6 -0
  237. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.d.ts +8 -0
  238. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +117 -0
  239. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.stories.d.ts +7 -0
  240. package/dist/types/components/molecules/mg-message/mg-message.conf.d.ts +4 -0
  241. package/dist/types/components/molecules/mg-message/mg-message.d.ts +76 -0
  242. package/dist/types/components/molecules/mg-message/mg-message.stories.d.ts +16 -0
  243. package/dist/types/components/molecules/mg-pagination/mg-pagination.conf.d.ts +4 -0
  244. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +53 -0
  245. package/dist/types/components/molecules/mg-pagination/mg-pagination.stories.d.ts +6 -0
  246. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +62 -0
  247. package/dist/types/components/molecules/mg-popover/mg-popover.stories.d.ts +12 -0
  248. package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +10 -0
  249. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +63 -0
  250. package/dist/types/components/molecules/mg-tabs/mg-tabs.stories.d.ts +7 -0
  251. package/dist/types/components.d.ts +1987 -0
  252. package/dist/types/index.d.ts +1 -0
  253. package/dist/types/locales/index.d.ts +44 -0
  254. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  255. package/dist/types/stories/buttons.stories.d.ts +13 -0
  256. package/dist/types/stories/grids.stories.d.ts +5 -0
  257. package/dist/types/stories/icons.stories.d.ts +13 -0
  258. package/dist/types/stories/messages.stories.d.ts +13 -0
  259. package/dist/types/stories/tags.stories.d.ts +5 -0
  260. package/dist/types/stories/typography.stories.d.ts +5 -0
  261. package/dist/types/utils/components.utils.d.ts +43 -0
  262. package/dist/types/utils/locale.utils.d.ts +22 -0
  263. package/dist/types/utils/test.utils.d.ts +5 -0
  264. package/loader/cdn.js +3 -0
  265. package/loader/index.cjs.js +3 -0
  266. package/loader/index.d.ts +12 -0
  267. package/loader/index.es2017.js +3 -0
  268. package/loader/index.js +4 -0
  269. package/loader/package.json +10 -0
  270. package/package.json +86 -0
  271. package/readme.md +159 -0
@@ -0,0 +1,133 @@
1
+ import { Component, h, Prop, Watch } from '@stencil/core';
2
+ import { messages } from '../../../locales';
3
+ export class MgCharacterLeft {
4
+ constructor() {
5
+ /************
6
+ * Internal *
7
+ ************/
8
+ this.mustacheCounter = '{counter}';
9
+ /**
10
+ * Template to display remaining characters.
11
+ * Must have {counter} inside
12
+ */
13
+ this.template = messages.nbCharLeft;
14
+ /**
15
+ * Sets the characters to count
16
+ */
17
+ this.characters = '';
18
+ /**
19
+ * Calculate number character left
20
+ * @returns {string}
21
+ */
22
+ this.getMessage = () => {
23
+ return this.template.replace(this.mustacheCounter, `<strong>${this.maxlength - this.characters.length}</strong>`);
24
+ };
25
+ }
26
+ validateTemplate(newValue) {
27
+ if (typeof newValue !== 'string' || newValue === '' || newValue.indexOf(this.mustacheCounter) === -1) {
28
+ throw new Error(`<mg-character-left> prop "template" must contain "${this.mustacheCounter}".`);
29
+ }
30
+ }
31
+ validateMaxlength(newValue) {
32
+ if (typeof newValue !== 'number') {
33
+ throw new Error('<mg-character-left> prop "maxlength" is required.');
34
+ }
35
+ }
36
+ /*************
37
+ * Lifecycle *
38
+ *************/
39
+ componentWillLoad() {
40
+ this.validateTemplate(this.template);
41
+ this.validateMaxlength(this.maxlength);
42
+ }
43
+ render() {
44
+ return h("span", { id: this.identifier, innerHTML: this.getMessage(), "aria-live": "polite" });
45
+ }
46
+ static get is() { return "mg-character-left"; }
47
+ static get encapsulation() { return "scoped"; }
48
+ static get originalStyleUrls() { return {
49
+ "$": ["mg-character-left.scss"]
50
+ }; }
51
+ static get styleUrls() { return {
52
+ "$": ["mg-character-left.css"]
53
+ }; }
54
+ static get properties() { return {
55
+ "identifier": {
56
+ "type": "string",
57
+ "mutable": false,
58
+ "complexType": {
59
+ "original": "string",
60
+ "resolved": "string",
61
+ "references": {}
62
+ },
63
+ "required": false,
64
+ "optional": false,
65
+ "docs": {
66
+ "tags": [],
67
+ "text": "Sets an `id` attribute.\nNeeded by the input for accessibility `aria-decribedby`."
68
+ },
69
+ "attribute": "identifier",
70
+ "reflect": false
71
+ },
72
+ "template": {
73
+ "type": "string",
74
+ "mutable": false,
75
+ "complexType": {
76
+ "original": "string",
77
+ "resolved": "string",
78
+ "references": {}
79
+ },
80
+ "required": false,
81
+ "optional": false,
82
+ "docs": {
83
+ "tags": [],
84
+ "text": "Template to display remaining characters.\nMust have {counter} inside"
85
+ },
86
+ "attribute": "template",
87
+ "reflect": false,
88
+ "defaultValue": "messages.nbCharLeft"
89
+ },
90
+ "characters": {
91
+ "type": "string",
92
+ "mutable": false,
93
+ "complexType": {
94
+ "original": "string",
95
+ "resolved": "string",
96
+ "references": {}
97
+ },
98
+ "required": false,
99
+ "optional": false,
100
+ "docs": {
101
+ "tags": [],
102
+ "text": "Sets the characters to count"
103
+ },
104
+ "attribute": "characters",
105
+ "reflect": false,
106
+ "defaultValue": "''"
107
+ },
108
+ "maxlength": {
109
+ "type": "number",
110
+ "mutable": false,
111
+ "complexType": {
112
+ "original": "number",
113
+ "resolved": "number",
114
+ "references": {}
115
+ },
116
+ "required": true,
117
+ "optional": false,
118
+ "docs": {
119
+ "tags": [],
120
+ "text": "Add maximum length"
121
+ },
122
+ "attribute": "maxlength",
123
+ "reflect": false
124
+ }
125
+ }; }
126
+ static get watchers() { return [{
127
+ "propName": "template",
128
+ "methodName": "validateTemplate"
129
+ }, {
130
+ "propName": "maxlength",
131
+ "methodName": "validateMaxlength"
132
+ }]; }
133
+ }
@@ -0,0 +1,15 @@
1
+ import { h } from '@stencil/core';
2
+ export default {
3
+ component: 'mg-character-left',
4
+ title: 'Atoms/mg-character-left',
5
+ };
6
+ const Template = args => h("mg-character-left", Object.assign({}, args));
7
+ export const MgCharacterLeft = Template.bind({});
8
+ MgCharacterLeft.args = {
9
+ identifier: 'identifier',
10
+ characters: '',
11
+ maxlength: 400,
12
+ template: undefined,
13
+ };
14
+ export const CustomTemplate = Template.bind({});
15
+ CustomTemplate.args = Object.assign(Object.assign({}, MgCharacterLeft.args), { maxlength: 100, template: 'Custom template with {counter} characters left.' });
@@ -0,0 +1,54 @@
1
+ import { h } from '@stencil/core';
2
+ /**
3
+ * Icon SVG paths
4
+ */
5
+ export const icons = {
6
+ 'arrow-down': () => (h("path", { fill: "currentColor", d: "M13,10.1H10.23a.31.31,0,0,1-.32-.28h0V.94A.3.3,0,0,0,9.59.65H6.37A.32.32,0,0,0,6,.94H6V9.81a.29.29,0,0,1-.31.29H3a.3.3,0,0,0-.31.29.27.27,0,0,0,.08.22l5.06,4.58a.36.36,0,0,0,.46,0l5-4.58a.29.29,0,0,0,0-.42C13.22,10.1,13.12,10.1,13,10.1Z" })),
7
+ 'arrow-left': () => (h("path", { fill: "currentColor", d: "M5.88,12.93V10.18a.3.3,0,0,1,.28-.32H15a.31.31,0,0,0,.29-.33h0V6.32A.31.31,0,0,0,15,6H6.17a.32.32,0,0,1-.29-.31h0V2.93a.3.3,0,0,0-.28-.32.32.32,0,0,0-.23.09L.79,7.76a.36.36,0,0,0,0,.46l4.58,5a.31.31,0,0,0,.43,0A.4.4,0,0,0,5.88,12.93Z" })),
8
+ 'arrow-right': () => (h("path", { fill: "currentColor", d: "M10.16,3V5.75a.3.3,0,0,1-.28.32H1a.31.31,0,0,0-.29.33h0V9.61A.31.31,0,0,0,1,9.94H9.87a.29.29,0,0,1,.29.31h0V13a.3.3,0,0,0,.28.32.32.32,0,0,0,.23-.09l4.58-5.06a.36.36,0,0,0,0-.46l-4.58-5a.3.3,0,0,0-.42,0C10.16,2.76,10.16,2.87,10.16,3Z" })),
9
+ 'arrow-up': () => (h("path", { fill: "currentColor", d: "M3.06,5.82H5.81a.31.31,0,0,1,.32.28h0V15a.31.31,0,0,0,.33.29H9.67A.3.3,0,0,0,10,15h0V6.11a.3.3,0,0,1,.31-.29h2.75a.3.3,0,0,0,.23-.51L8.23.73a.36.36,0,0,0-.46,0l-5,4.58a.3.3,0,0,0,0,.43C2.82,5.83,2.92,5.82,3.06,5.82Z" })),
10
+ 'arrows-rotate': () => (h("path", { fill: "currentColor", d: "M2.3,7h3.4c0.3,0,0.6-0.3,0.6-0.6c0-0.1-0.1-0.3-0.2-0.4L5.1,4.9c1.7-1.6,4.4-1.5,6,0.2c0,0,0,0,0,0 c0.5,0.5,0.8,1.2,1,1.9h2.1C13.7,3.5,10.4,1.2,7,1.8C5.7,2,4.6,2.6,3.6,3.4L2.7,2.5c-0.2-0.2-0.6-0.2-0.8,0c0,0,0,0,0,0l0,0 C1.8,2.6,1.7,2.8,1.7,2.9v3.4C1.7,6.7,1.9,7,2.3,7z M13.7,9h-3.4C9.9,9,9.7,9.3,9.7,9.6c0,0.2,0.1,0.3,0.2,0.4l1.1,1.1 c-1.7,1.6-4.4,1.5-6-0.2C4.4,10.4,4,9.7,3.8,9H1.7c0.6,3.5,3.9,5.8,7.3,5.2c1.3-0.2,2.4-0.8,3.3-1.7l0.9,0.9c0.2,0.2,0.6,0.2,0.8,0 c0,0,0,0,0,0l0,0c0.1-0.1,0.2-0.3,0.2-0.4V9.6C14.3,9.3,14.1,9,13.7,9z" })),
11
+ 'ban': () => (h("path", { fill: "currentColor", d: "M8 .67A7.33 7.33 0 1 0 15.33 8 7.33 7.33 0 0 0 8 .67Zm3.85 3.48a5.46 5.46 0 0 1 .61 7L4.88 3.54a5.46 5.46 0 0 1 6.97.61Zm-7.7 7.7a5.45 5.45 0 0 1-.61-7l7.58 7.58a5.46 5.46 0 0 1-7-.61Z" })),
12
+ 'calculator': () => (h("path", { fill: "currentColor", d: "M12.83.67H3.17a.5.5 0 0 0-.5.5v13.66a.5.5 0 0 0 .5.5h9.66a.5.5 0 0 0 .5-.5V1.17a.5.5 0 0 0-.5-.5ZM5.58 13.39a.29.29 0 0 1-.28.3H4.1a.29.29 0 0 1-.3-.28v-1.2a.29.29 0 0 1 .28-.3h1.2a.29.29 0 0 1 .3.28v1.2Zm0-3.28a.29.29 0 0 1-.3.3H4.1a.29.29 0 0 1-.3-.3V8.93a.29.29 0 0 1 .28-.3h1.2a.29.29 0 0 1 .3.28v1.2Zm3.29 3.28a.29.29 0 0 1-.3.3H7.38a.29.29 0 0 1-.3-.3v-1.18a.29.29 0 0 1 .3-.3h1.19a.29.29 0 0 1 .3.3Zm0-3.28a.32.32 0 0 1-.3.3H7.38a.32.32 0 0 1-.3-.3V8.93a.29.29 0 0 1 .3-.3h1.19a.29.29 0 0 1 .3.3Zm3.33 3.28a.29.29 0 0 1-.28.3h-1.25a.29.29 0 0 1-.3-.28V8.93a.29.29 0 0 1 .28-.3h1.25a.29.29 0 0 1 .3.28v4.48Zm0-7.15a.29.29 0 0 1-.3.3H4.1a.29.29 0 0 1-.3-.3V2.61a.29.29 0 0 1 .28-.3h7.82a.29.29 0 0 1 .3.28v3.65Z" })),
13
+ 'check': () => (h("path", { fill: "currentColor", d: "M15.3,4.2L14.2,3c-0.1-0.1-0.3-0.1-0.4,0L6,10.4l-3.8-4C2.2,6.3,2.1,6.3,2,6.4L0.7,7.6c-0.1,0.1-0.1,0.2,0,0.3l5.1,5.4c0.1,0.1,0.2,0.1,0.3,0c0,0,0,0,0,0L7.4,12l0,0l7.9-7.4C15.4,4.5,15.4,4.3,15.3,4.2C15.3,4.2,15.3,4.2,15.3,4.2z" })),
14
+ 'check-circle': () => (h("path", { fill: "currentColor", d: "M15.33 8A7.33 7.33 0 1 1 8 .67 7.33 7.33 0 0 1 15.33 8Zm-8.18 3.88 5.44-5.44a.46.46 0 0 0 0-.65l-.67-.67a.48.48 0 0 0-.67 0L6.82 9.54 4.75 7.47a.46.46 0 0 0-.65 0l-.67.67a.46.46 0 0 0 0 .65l3.07 3.07a.46.46 0 0 0 .65 0Z" })),
15
+ 'chevron-down': () => (h("path", { fill: "currentColor", d: "M7.43,12.21.9,5.69a.81.81,0,0,1,0-1.14h0l.76-.77a.81.81,0,0,1,1.14,0L8,9l5.2-5.18a.81.81,0,0,1,1.14,0l.76.77a.8.8,0,0,1,0,1.13h0L8.57,12.21a.79.79,0,0,1-1.13,0Z" })),
16
+ 'chevron-left': () => (h("path", { fill: "currentColor", d: "M3.79,7.43,10.31.9a.81.81,0,0,1,1.14,0h0l.77.76a.81.81,0,0,1,0,1.14L7,8l5.18,5.2a.81.81,0,0,1,0,1.14l-.77.76a.8.8,0,0,1-1.13,0h0L3.79,8.57a.79.79,0,0,1,0-1.13Z" })),
17
+ 'chevron-right': () => (h("path", { fill: "currentColor", d: "M12.21,8.57,5.69,15.1a.81.81,0,0,1-1.14,0h0l-.77-.76a.81.81,0,0,1,0-1.14L9,8,3.78,2.8a.81.81,0,0,1,0-1.14L4.55.9A.8.8,0,0,1,5.68.9h0l6.53,6.53a.79.79,0,0,1,0,1.13Z" })),
18
+ 'chevron-up': () => (h("path", { fill: "currentColor", d: "M8.57,3.79l6.53,6.52a.81.81,0,0,1,0,1.14h0l-.76.77a.81.81,0,0,1-1.14,0L8,7,2.8,12.22a.81.81,0,0,1-1.14,0L.9,11.45a.8.8,0,0,1,0-1.13h0L7.43,3.79a.79.79,0,0,1,1.13,0Z" })),
19
+ 'cross': () => (h("path", { fill: "currentColor", d: "M14.26 12.74 9.52 8l4.7-4.7a.29.29 0 0 0 0-.41l-1.1-1.1a.29.29 0 0 0-.41 0L8 6.48 3.26 1.74a.24.24 0 0 0-.34 0L1.74 2.91a.24.24 0 0 0 0 .34L6.48 8l-4.7 4.7a.29.29 0 0 0 0 .41l1.1 1.1a.29.29 0 0 0 .41 0L8 9.52l4.74 4.74a.24.24 0 0 0 .34 0l1.17-1.17a.24.24 0 0 0 0-.34Z" })),
20
+ 'cross-circle': () => (h("path", { fill: "currentColor", d: "M8.06.67H8A7.33 7.33 0 0 0 .68 8v.1a7.42 7.42 0 0 0 7.23 7.23A7.33 7.33 0 1 0 8.06.67Zm3.6 9.57a.28.28 0 0 1 0 .4l-.19.2-.61.61-.2.19a.27.27 0 0 1-.39 0L8 9.41l-2.23 2.24a.27.27 0 0 1-.39 0l-.2-.2-.6-.6-.19-.2a.28.28 0 0 1 0-.4L6.6 8 4.36 5.76a.28.28 0 0 1 0-.4l1-1a.28.28 0 0 1 .4 0L8 6.59l2.24-2.24a.28.28 0 0 1 .4 0l.2.2.6.6.2.2a.28.28 0 0 1 0 .4L9.42 8Z" })),
21
+ 'download': () => (h("path", { fill: "currentColor", d: "M6.44,2V6.09a.31.31,0,0,1-.31.31H4a.31.31,0,0,0-.31.29.33.33,0,0,0,.1.23l4,4a.29.29,0,0,0,.41,0h0l4-4a.3.3,0,0,0,0-.42A.29.29,0,0,0,12,6.4H9.91a.31.31,0,0,1-.31-.31h0V2a.29.29,0,0,0-.28-.3H6.74a.29.29,0,0,0-.3.28ZM1.69,13v1a.29.29,0,0,0,.29.29H14a.29.29,0,0,0,.29-.29V13a.29.29,0,0,0-.28-.3H2a.29.29,0,0,0-.33.25Z" })),
22
+ 'exclamation-circle': () => (h("path", { fill: "currentColor", d: "M8 15.33A7.33 7.33 0 1 0 .67 8 7.33 7.33 0 0 0 8 15.33ZM7 4a.29.29 0 0 1 .3-.3h1.35A.29.29 0 0 1 9 4v4.68a.29.29 0 0 1-.28.3H7.35a.29.29 0 0 1-.3-.28Zm0 6.78a.29.29 0 0 1 .3-.3h1.35a.29.29 0 0 1 .3.3H9V12a.29.29 0 0 1-.28.3H7.35a.29.29 0 0 1-.3-.28Z" })),
23
+ 'exclamation-triangle': () => (h("path", { fill: "currentColor", d: "m14.28 13.87-6-12a.32.32 0 0 0-.41-.15.36.36 0 0 0-.15.15l-6 12a.31.31 0 0 0 .14.42.33.33 0 0 0 .14 0h12a.3.3 0 0 0 .33-.28.31.31 0 0 0-.05-.14ZM7 6a.29.29 0 0 1 .28-.28h1.44A.28.28 0 0 1 9 6v4a.28.28 0 0 1-.28.29H7.28A.29.29 0 0 1 7 10Zm2 7a.31.31 0 0 1-.3.32H7.32A.32.32 0 0 1 7 13v-1.38a.31.31 0 0 1 .31-.31h1.4a.31.31 0 0 1 .31.31H9Z" })),
24
+ 'file-cog': () => (h("path", { fill: "currentColor", d: "M9,10.1C9,10.6,8.5,11,8,11l0,0c-0.6,0-1-0.4-1-1c0-0.6,0.4-1,1-1C8.6,9,9,9.4,9,10.1C9,10,9,10,9,10.1z M13.2,3.7l-2.8-2.8c-0.1-0.1-0.3-0.2-0.5-0.2H9.8v3.7h3.5V4.2C13.3,4,13.2,3.8,13.2,3.7L13.2,3.7z M9.6,5.3h3.8v9.4 c0,0.4-0.3,0.6-0.7,0.7H3.3c-0.4,0-0.7-0.3-0.7-0.7c0,0,0,0,0,0V1.3C2.7,1,3,0.7,3.3,0.7h5.5v3.9l0,0C8.9,4.9,9.2,5.2,9.6,5.3 C9.5,5.2,9.5,5.2,9.6,5.3z M10,8L9.5,8.3C9.3,8.1,9,8,8.8,7.9V7.3c0-0.1,0-0.1-0.1-0.1c-0.4-0.1-0.9-0.1-1.3,0 c-0.1,0-0.1,0.1-0.1,0.1v0.6C7,8,6.7,8.1,6.5,8.3L6,8C5.9,8,5.9,8,5.8,8C5.5,8.3,5.3,8.7,5.2,9.1c0,0.1,0,0.1,0.1,0.2l0.5,0.3 c-0.1,0.3-0.1,0.6,0,0.8l-0.5,0.3c-0.1,0-0.1,0.1-0.1,0.2c0.1,0.4,0.4,0.8,0.7,1.1c0.1,0,0.1,0,0.2,0l0.5-0.3 C6.7,11.9,7,12,7.2,12.1v0.6c0,0.1,0,0.1,0.1,0.1c0.4,0.1,0.9,0.1,1.3,0c0.1,0,0.1-0.1,0.1-0.1v-0.5C9,12.1,9.3,12,9.5,11.8l0.5,0.3 c0.1,0,0.1,0,0.2,0c0.3-0.3,0.5-0.7,0.6-1.1c0-0.1,0-0.1-0.1-0.2l0,0l-0.5-0.3c0-0.3,0-0.6,0-0.8l0.5-0.3c0.1,0,0.1-0.1,0.1-0.2 c-0.1-0.4-0.4-0.8-0.6-1.1C10.1,8,10.1,8,10,8z" })),
25
+ 'file-text': () => (h("path", { fill: "currentColor", d: "M8.9 4.6V.7H3.3c-.3 0-.6.3-.6.6v13.3c0 .4.3.7.7.7h9.3c.4 0 .7-.3.7-.7V5.3H9.6c-.4-.1-.7-.4-.7-.7zm1.8 6.7c0 .2-.2.3-.3.4H5.7c-.2 0-.3-.2-.3-.4v-.2c0-.2.2-.3.3-.3h4.6c.2 0 .3.2.3.3v.2zm0-1.8c0 .2-.2.3-.3.3H5.7c-.2 0-.3-.2-.3-.3v-.2c0-.2.2-.3.3-.3h4.6c.2 0 .3.2.3.3v.2zm0-2.1v.2c0 .2-.2.3-.3.3H5.7c-.2.1-.4-.1-.4-.2v-.3c0-.2.2-.3.3-.3h4.6c.3 0 .5.1.5.3zm2.6-3.2v.2H9.8V.7h.2c.2 0 .3.1.5.2l2.7 2.8c0 .1.1.3.1.5z" })),
26
+ 'file-upload': () => [
27
+ h("path", { fill: "currentColor", d: "M13.1 3.7 10.4.9c-.1-.1-.3-.2-.5-.2h-.1v3.7h3.5v-.2c0-.2-.1-.4-.2-.5z" }),
28
+ h("path", { fill: "currentColor", d: "M13.3 14.6V5.3H9.6c-.4 0-.7-.3-.7-.7V.7H3.3c-.3 0-.6.3-.6.6v13.3c0 .4.3.7.7.7h9.3c.3 0 .6-.3.6-.7zm-3-4.6H8.9c-.1 0-.2.1-.2.2v2.6c0 .1-.1.2-.2.2H6.9c-.1 0-.2-.1-.2-.2v-2.6c0-.1-.1-.2-.2-.2H5.1C5 9.9 5 9.8 5 9.7l2.5-2.6c.1-.1.2-.1.3 0l2.5 2.5.1.1c.1.2 0 .3-.1.3z" }),
29
+ ],
30
+ 'floppy-disk': () => (h("path", { fill: "currentColor", d: "m13.94 4.44-2.38-2.38a1.39 1.39 0 0 0-1-.39H3A1.35 1.35 0 0 0 1.67 3v10A1.35 1.35 0 0 0 3 14.33h10A1.35 1.35 0 0 0 14.33 13V5.4a1.39 1.39 0 0 0-.39-1ZM8 12.52a1.81 1.81 0 1 1 1.81-1.81A1.81 1.81 0 0 1 8 12.52Zm2.71-8.6v2.84a.34.34 0 0 1-.34.34H3.82a.34.34 0 0 1-.34-.34V3.82a.34.34 0 0 1 .34-.34h6.46a.35.35 0 0 1 .24.1l.1.1a.35.35 0 0 1 .1.24Z" })),
31
+ 'info-circle': () => (h("path", { fill: "currentColor", d: "M8 .67A7.33 7.33 0 1 0 15.33 8 7.33 7.33 0 0 0 8 .67ZM9 12a.29.29 0 0 1-.3.3H7.35a.29.29 0 0 1-.3-.3V7.32A.29.29 0 0 1 7.33 7h1.32a.29.29 0 0 1 .35.3Zm0-6.74a.29.29 0 0 1-.3.3H7.35a.29.29 0 0 1-.3-.3V4a.29.29 0 0 1 .28-.3h1.32a.29.29 0 0 1 .3.28V4Z" })),
32
+ 'loader': () => [
33
+ h("path", { fill: "currentColor", class: "loader__full-circle", d: "M8 2.67A5.33 5.33 0 1 1 2.67 8 5.33 5.33 0 0 1 8 2.67m0-2A7.33 7.33 0 1 0 15.33 8 7.33 7.33 0 0 0 8 .67Z" }),
34
+ h("path", { fill: "currentColor", d: "M8 2.67v-2A7.33 7.33 0 0 0 .67 8h2A5.33 5.33 0 0 1 8 2.67Z" }),
35
+ ],
36
+ 'log-out': () => [
37
+ h("path", { fill: "currentColor", d: "M14.25,7.77h0l-4-4a.31.31,0,0,0-.43,0A.34.34,0,0,0,9.7,4V6.07a.32.32,0,0,1-.3.32H5.23a.3.3,0,0,0-.3.3V9.25a.3.3,0,0,0,.3.3H9.4a.31.31,0,0,1,.3.31V12a.3.3,0,0,0,.3.3.33.33,0,0,0,.23-.09l4-4A.29.29,0,0,0,14.25,7.77Z" }),
38
+ h("path", { fill: "currentColor", d: "M6.71,12.72H3.27V3.26H6.69A.31.31,0,0,0,7,3V2a.3.3,0,0,0-.31-.3H2A.29.29,0,0,0,1.67,2h0V3h0V14a.27.27,0,0,0,.1.24h0a.32.32,0,0,0,.14.08H6.71A.3.3,0,0,0,7,14V13A.3.3,0,0,0,6.71,12.72Z" }),
39
+ ],
40
+ 'magnifying-glass': () => (h("path", { fill: "currentColor", d: "M11.24,9.52A5.17,5.17,0,0,0,9.51,2.41l-.17-.09A5.18,5.18,0,0,0,4,11.18a5.16,5.16,0,0,0,5.54.11L12.3,14a1,1,0,0,0,1.41,0l.33-.33a1,1,0,0,0,0-1.41Zm-4.4.5A3.19,3.19,0,1,1,10,6.8v.06A3.19,3.19,0,0,1,6.84,10Z" })),
41
+ 'paper-plane': () => (h("path", { fill: "currentColor", d: "M14 1.69 1.84 7a.28.28 0 0 0-.15.36.29.29 0 0 0 .16.15l3.27 1.82a.57.57 0 0 0 .61-.06l6.45-5.57c.05 0 .15-.1.19-.06s0 .14-.06.18l-5.59 6.29a.52.52 0 0 0 0 .63l2.09 3.44a.28.28 0 0 0 .37.12.3.3 0 0 0 .13-.12l5-12.11a.3.3 0 0 0-.14-.37.28.28 0 0 0-.17-.01Z" })),
42
+ 'paper-plane-slash': () => (h("path", { fill: "currentColor", d: "M2.67,1.69,14.26,13.28l-1,1-2.79-2.8-1.1,2.67a.3.3,0,0,1-.13.12.28.28,0,0,1-.37-.12L6.75,10.74a.52.52,0,0,1,0-.63L7.82,8.9l-.76-.76L5.76,9.27a.57.57,0,0,1-.61.06L1.88,7.51a.29.29,0,0,1-.16-.15A.28.28,0,0,1,1.87,7L4.68,5.76l-3-3Zm11.53,0a.28.28,0,0,0-.22,0L7.53,4.51,9.26,6.24l3-2.54s.15-.1.19-.06,0,.14-.06.18L9.75,6.73l1.88,1.88,2.71-6.54A.3.3,0,0,0,14.2,1.7Z" })),
43
+ 'plus-circle': () => (h("path", { fill: "currentColor", d: "M8,0.7C4,0.7,0.7,4,0.7,8S4,15.3,8,15.3S15.3,12,15.3,8l0,0C15.3,4,12,0.7,8,0.7 C8,0.7,8,0.7,8,0.7z M12.3,8.8c0,0.2-0.2,0.4-0.4,0.4H9.2v2.7c0,0.2-0.2,0.4-0.4,0.4H7.2c-0.2,0-0.4-0.2-0.3-0.4V9.2H4.1 C3.9,9.2,3.7,9,3.7,8.8V7.2c0-0.2,0.2-0.4,0.4-0.3h2.7V4.1c0-0.2,0.2-0.4,0.3-0.4h1.7c0.2,0,0.4,0.2,0.4,0.4v2.7h2.7 c0.2,0,0.4,0.2,0.4,0.3L12.3,8.8z" })),
44
+ 'user-plus': () => (h("path", { fill: "currentColor", d: "M14,3.33H12.65V2a.36.36,0,0,0-.35-.33h-.65A.36.36,0,0,0,11.3,2V3.33H10a.34.34,0,0,0-.33.34v.66a.34.34,0,0,0,.33.34H11.3V6a.37.37,0,0,0,.35.33h.65A.37.37,0,0,0,12.65,6V4.67H14a.34.34,0,0,0,.32-.34V3.67A.34.34,0,0,0,14,3.33ZM9.28,9.77h-.2a5.19,5.19,0,0,1-3.91,0H5A3,3,0,0,0,1.7,12.46h0v.72A1.27,1.27,0,0,0,3,14.33h8.25a1.26,1.26,0,0,0,1.36-1.14v-.68A3,3,0,0,0,9.37,9.76H9.28ZM7.13,3.7A2.64,2.64,0,1,1,4.5,6.34h0A2.64,2.64,0,0,1,7.13,3.7Z" })),
45
+ 'users': () => (h("path", { fill: "currentColor", d: "M12,8.76h-.2a5.24,5.24,0,0,1-3.93,0H7.61a3.05,3.05,0,0,0-3.3,2.75v.69a1.28,1.28,0,0,0,1.38,1.14H14a1.27,1.27,0,0,0,1.37-1.14v-.69A3.07,3.07,0,0,0,12,8.75Zm-6.4-.32A2,2,0,0,0,4.31,8H2.48A1.69,1.69,0,0,0,.65,9.53v.76a.85.85,0,0,0,.91.76H3.45A3.58,3.58,0,0,1,5.61,8.44ZM9.81,2.66A2.65,2.65,0,1,1,7.16,5.31h0A2.65,2.65,0,0,1,9.81,2.66ZM3.31,4.18A1.51,1.51,0,1,1,1.8,5.69,1.51,1.51,0,0,1,3.31,4.18Z" })),
46
+ };
47
+ /**
48
+ * List of all possibles sizes
49
+ */
50
+ export const sizes = ['regular', 'large', 'extra-large'];
51
+ /**
52
+ * List of all possibles variants
53
+ */
54
+ export const variants = ['success', 'warning', 'danger', 'info'];
@@ -0,0 +1,57 @@
1
+ .mg-icon[size=regular], .mg-icon.mg-icon--size-regular {
2
+ width: var(--mg-icon-regular-size);
3
+ height: var(--mg-icon-regular-size);
4
+ }
5
+ .mg-icon[size=large], .mg-icon.mg-icon--size-large {
6
+ width: var(--mg-icon-large-size);
7
+ height: var(--mg-icon-large-size);
8
+ }
9
+ .mg-icon[size=extra-large], .mg-icon.mg-icon--size-extra-large {
10
+ width: var(--mg-icon-extra-large-size);
11
+ height: var(--mg-icon-extra-large-size);
12
+ }
13
+ .mg-icon[class*=mg-icon--variant-] {
14
+ border-radius: var(--mg-message-border-radius);
15
+ padding: 0.3rem;
16
+ }
17
+ .mg-icon.mg-icon--variant-success {
18
+ background-color: hsl(var(--color-success-h), var(--color-success-s), calc(var(--color-success-l) + 20%));
19
+ }
20
+ .mg-icon.mg-icon--variant-warning {
21
+ background-color: hsl(var(--color-warning-h), var(--color-warning-s), calc(var(--color-warning-l) + 20%));
22
+ }
23
+ .mg-icon.mg-icon--variant-danger {
24
+ background-color: hsl(var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) + 20%));
25
+ }
26
+ .mg-icon.mg-icon--variant-info {
27
+ background-color: hsl(var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) + 20%));
28
+ }
29
+
30
+ mg-icon,
31
+ .mg-icon {
32
+ display: inline-block;
33
+ vertical-align: middle;
34
+ line-height: 1;
35
+ }
36
+
37
+ /**
38
+ * Loader icon
39
+ **/
40
+ .loader__full-circle {
41
+ opacity: 0.2;
42
+ }
43
+
44
+ /**
45
+ * Animations
46
+ **/
47
+ .mg-icon--spin {
48
+ animation-name: rotate;
49
+ animation-duration: 0.75s;
50
+ animation-iteration-count: infinite;
51
+ }
52
+
53
+ @keyframes rotate {
54
+ to {
55
+ transform: rotate(360deg);
56
+ }
57
+ }
@@ -0,0 +1,155 @@
1
+ import { Component, h, Prop, Watch, State } from '@stencil/core';
2
+ import { icons, sizes, variants } from './mg-icon.conf';
3
+ import { ClassList } from '../../../utils/components.utils';
4
+ export class MgIcon {
5
+ constructor() {
6
+ /**
7
+ * Define icon size
8
+ */
9
+ this.size = 'regular';
10
+ /**
11
+ * Make the icon spin
12
+ */
13
+ this.spin = false;
14
+ /**
15
+ * Component classes
16
+ */
17
+ this.classList = new ClassList(['mg-icon']);
18
+ }
19
+ validateIcon(newValue) {
20
+ if (!Object.keys(icons).includes(newValue)) {
21
+ throw new Error(`<mg-icon> prop "icon" must be one of : ${Object.keys(icons).join(', ')}`);
22
+ }
23
+ this.classList.add(`mg-icon--${this.icon}`);
24
+ }
25
+ validateSize(newValue) {
26
+ if (!sizes.includes(newValue)) {
27
+ throw new Error(`<mg-icon> prop "size" must be one of : ${sizes.join(', ')}`);
28
+ }
29
+ this.classList.add(`mg-icon--size-${this.size}`);
30
+ }
31
+ validateVariant(newValue) {
32
+ if (newValue !== undefined && !variants.includes(newValue)) {
33
+ throw new Error(`<mg-icon> prop "variant" must be one of : ${variants.join(', ')}`);
34
+ }
35
+ else if (newValue !== undefined) {
36
+ this.classList.add(`mg-icon--variant-${this.variant}`);
37
+ }
38
+ }
39
+ handleSpin(newValue) {
40
+ if (newValue) {
41
+ this.classList.add('mg-icon--spin');
42
+ }
43
+ }
44
+ /**
45
+ * Check if props are well configured on init
46
+ */
47
+ componentWillLoad() {
48
+ this.validateIcon(this.icon);
49
+ this.validateSize(this.size);
50
+ this.validateVariant(this.variant);
51
+ this.handleSpin(this.spin);
52
+ }
53
+ /**
54
+ * Render component
55
+ */
56
+ render() {
57
+ return (h("svg", { class: this.classList.join(), "aria-hidden": "true", focusable: "false", viewBox: "0 0 16 16" }, icons[this.icon]()));
58
+ }
59
+ static get is() { return "mg-icon"; }
60
+ static get encapsulation() { return "shadow"; }
61
+ static get originalStyleUrls() { return {
62
+ "$": ["mg-icon.scss"]
63
+ }; }
64
+ static get styleUrls() { return {
65
+ "$": ["mg-icon.css"]
66
+ }; }
67
+ static get properties() { return {
68
+ "icon": {
69
+ "type": "string",
70
+ "mutable": false,
71
+ "complexType": {
72
+ "original": "string",
73
+ "resolved": "string",
74
+ "references": {}
75
+ },
76
+ "required": false,
77
+ "optional": false,
78
+ "docs": {
79
+ "tags": [],
80
+ "text": "Icon to display"
81
+ },
82
+ "attribute": "icon",
83
+ "reflect": false
84
+ },
85
+ "size": {
86
+ "type": "string",
87
+ "mutable": false,
88
+ "complexType": {
89
+ "original": "string",
90
+ "resolved": "string",
91
+ "references": {}
92
+ },
93
+ "required": false,
94
+ "optional": false,
95
+ "docs": {
96
+ "tags": [],
97
+ "text": "Define icon size"
98
+ },
99
+ "attribute": "size",
100
+ "reflect": false,
101
+ "defaultValue": "'regular'"
102
+ },
103
+ "variant": {
104
+ "type": "string",
105
+ "mutable": false,
106
+ "complexType": {
107
+ "original": "string",
108
+ "resolved": "string",
109
+ "references": {}
110
+ },
111
+ "required": false,
112
+ "optional": false,
113
+ "docs": {
114
+ "tags": [],
115
+ "text": "Define icon variant\nAdd a background to the icon based on variant color"
116
+ },
117
+ "attribute": "variant",
118
+ "reflect": false
119
+ },
120
+ "spin": {
121
+ "type": "boolean",
122
+ "mutable": false,
123
+ "complexType": {
124
+ "original": "boolean",
125
+ "resolved": "boolean",
126
+ "references": {}
127
+ },
128
+ "required": false,
129
+ "optional": false,
130
+ "docs": {
131
+ "tags": [],
132
+ "text": "Make the icon spin"
133
+ },
134
+ "attribute": "spin",
135
+ "reflect": false,
136
+ "defaultValue": "false"
137
+ }
138
+ }; }
139
+ static get states() { return {
140
+ "classList": {}
141
+ }; }
142
+ static get watchers() { return [{
143
+ "propName": "icon",
144
+ "methodName": "validateIcon"
145
+ }, {
146
+ "propName": "size",
147
+ "methodName": "validateSize"
148
+ }, {
149
+ "propName": "variant",
150
+ "methodName": "validateVariant"
151
+ }, {
152
+ "propName": "spin",
153
+ "methodName": "handleSpin"
154
+ }]; }
155
+ }
@@ -0,0 +1,34 @@
1
+ import { h } from '@stencil/core';
2
+ import { icons, sizes, variants } from './mg-icon.conf';
3
+ export default {
4
+ component: 'mg-icon',
5
+ title: 'Atoms/mg-icon',
6
+ argTypes: {
7
+ icon: {
8
+ options: Object.keys(icons),
9
+ control: { type: 'select' },
10
+ },
11
+ size: {
12
+ options: sizes,
13
+ control: { type: 'select' },
14
+ },
15
+ variant: {
16
+ options: [undefined, ...variants],
17
+ control: { type: 'select' },
18
+ },
19
+ },
20
+ };
21
+ const Template = args => {
22
+ const color = args.color;
23
+ delete args.color;
24
+ // return element
25
+ return (h("div", { style: { color } },
26
+ h("mg-icon", Object.assign({}, args))));
27
+ };
28
+ export const MgIcon = Template.bind({});
29
+ MgIcon.args = {
30
+ color: '',
31
+ icon: Object.keys(icons)[0],
32
+ size: sizes[0],
33
+ spin: false,
34
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Not scoped into `mg-input-title` because it could be used outside of an input
3
+ * (ex: All input with a * are required)
4
+ */
5
+ .is-asterisk {
6
+ color: hsl(var(--color-danger));
7
+ }
8
+
9
+ legend.mg-input-title {
10
+ padding-left: 0;
11
+ padding-right: 0;
12
+ }
@@ -0,0 +1,95 @@
1
+ import { Component, h, Prop, State } from '@stencil/core';
2
+ export class MgInputTitle {
3
+ constructor() {
4
+ /**
5
+ * Switch from label to fieldset sementic
6
+ */
7
+ this.isLegend = false;
8
+ /**
9
+ * Component parent tagname
10
+ */
11
+ this.tagName = 'label';
12
+ this.getTagName = () => {
13
+ this.tagName = this.isLegend ? 'legend' : 'label';
14
+ };
15
+ }
16
+ /*************
17
+ * Lifecycle *
18
+ *************/
19
+ componentWillLoad() {
20
+ // Init tag name
21
+ this.getTagName();
22
+ }
23
+ // \u00A0 represent a &nbsp;
24
+ render() {
25
+ const TagName = this.tagName;
26
+ return (h(TagName, { class: "mg-input-title", htmlFor: this.isLegend ? undefined : this.identifier },
27
+ h("slot", null),
28
+ this.required && [`\u00A0`, h("span", { class: "is-asterisk" }, "*")]));
29
+ }
30
+ static get is() { return "mg-input-title"; }
31
+ static get encapsulation() { return "scoped"; }
32
+ static get originalStyleUrls() { return {
33
+ "$": ["mg-input-title.scss"]
34
+ }; }
35
+ static get styleUrls() { return {
36
+ "$": ["mg-input-title.css"]
37
+ }; }
38
+ static get properties() { return {
39
+ "identifier": {
40
+ "type": "string",
41
+ "mutable": false,
42
+ "complexType": {
43
+ "original": "string",
44
+ "resolved": "string",
45
+ "references": {}
46
+ },
47
+ "required": true,
48
+ "optional": false,
49
+ "docs": {
50
+ "tags": [],
51
+ "text": "Label input id"
52
+ },
53
+ "attribute": "identifier",
54
+ "reflect": false
55
+ },
56
+ "required": {
57
+ "type": "boolean",
58
+ "mutable": false,
59
+ "complexType": {
60
+ "original": "boolean",
61
+ "resolved": "boolean",
62
+ "references": {}
63
+ },
64
+ "required": false,
65
+ "optional": false,
66
+ "docs": {
67
+ "tags": [],
68
+ "text": "If input is required an asterisk is added at the end of the label"
69
+ },
70
+ "attribute": "required",
71
+ "reflect": false
72
+ },
73
+ "isLegend": {
74
+ "type": "boolean",
75
+ "mutable": false,
76
+ "complexType": {
77
+ "original": "boolean",
78
+ "resolved": "boolean",
79
+ "references": {}
80
+ },
81
+ "required": false,
82
+ "optional": false,
83
+ "docs": {
84
+ "tags": [],
85
+ "text": "Switch from label to fieldset sementic"
86
+ },
87
+ "attribute": "is-legend",
88
+ "reflect": false,
89
+ "defaultValue": "false"
90
+ }
91
+ }; }
92
+ static get states() { return {
93
+ "tagName": {}
94
+ }; }
95
+ }
@@ -0,0 +1,21 @@
1
+ import { h } from '@stencil/core';
2
+ export default {
3
+ component: 'mg-input-title',
4
+ title: 'Atoms/mg-input-title',
5
+ };
6
+ const Template = args => {
7
+ // Extract slot so it won't be render as an attribute
8
+ const slot = args.slot;
9
+ delete args.slot;
10
+ const isLegend = args.isLegend;
11
+ delete args.isLegend;
12
+ // return element
13
+ return (h("mg-input-title", Object.assign({}, args, { "is-legend": isLegend }), slot));
14
+ };
15
+ export const MgInputTitle = Template.bind({});
16
+ MgInputTitle.args = {
17
+ slot: 'Label',
18
+ identifier: 'identifier',
19
+ required: true,
20
+ isLegend: false,
21
+ };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * List of all possibles variants
3
+ */
4
+ export const variants = ['primary', 'secondary', 'success', 'warning', 'danger', 'info'];
@@ -0,0 +1,73 @@
1
+ /* Variables */
2
+ /* Mixins */
3
+ /* Styles */
4
+ .mg-tag {
5
+ padding: calc((var(--mg-tag-height) - 0.2rem - var(--mg-tag-font-size) * var(--line-height)) / 2) 0.6rem;
6
+ min-height: var(--mg-tag-height);
7
+ box-sizing: border-box;
8
+ border-radius: var(--mg-tag-border-radius);
9
+ border: 0.1rem solid;
10
+ font-size: var(--mg-tag-font-size);
11
+ font-weight: 600;
12
+ text-align: center;
13
+ }
14
+ .mg-tag.mg-tag--primary {
15
+ background-color: hsl(var(--color-dark));
16
+ border-color: hsl(var(--color-dark));
17
+ color: hsl(var(--color-light));
18
+ }
19
+ .mg-tag.mg-tag--primary.mg-tag--outline {
20
+ background-color: transparent;
21
+ color: hsl(var(--color-dark));
22
+ }
23
+ .mg-tag.mg-tag--secondary {
24
+ background-color: hsl(var(--color-light));
25
+ border-color: hsl(var(--color-light));
26
+ color: hsl(var(--color-dark));
27
+ }
28
+ .mg-tag.mg-tag--secondary.mg-tag--outline {
29
+ background-color: transparent;
30
+ color: hsl(var(--color-light));
31
+ }
32
+ .mg-tag.mg-tag--success {
33
+ background-color: hsl(var(--color-success));
34
+ border-color: hsl(var(--color-success));
35
+ color: hsl(var(--color-dark));
36
+ }
37
+ .mg-tag.mg-tag--success.mg-tag--outline {
38
+ background-color: transparent;
39
+ color: hsl(var(--color-success));
40
+ }
41
+ .mg-tag.mg-tag--warning {
42
+ background-color: hsl(var(--color-warning));
43
+ border-color: hsl(var(--color-warning));
44
+ color: hsl(var(--color-dark));
45
+ }
46
+ .mg-tag.mg-tag--warning.mg-tag--outline {
47
+ background-color: transparent;
48
+ color: hsl(var(--color-warning));
49
+ }
50
+ .mg-tag.mg-tag--danger {
51
+ background-color: hsl(var(--color-danger));
52
+ border-color: hsl(var(--color-danger));
53
+ color: hsl(var(--color-light));
54
+ }
55
+ .mg-tag.mg-tag--danger.mg-tag--outline {
56
+ background-color: transparent;
57
+ color: hsl(var(--color-danger));
58
+ }
59
+ .mg-tag.mg-tag--info {
60
+ background-color: hsl(var(--color-info));
61
+ border-color: hsl(var(--color-info));
62
+ color: hsl(var(--color-light));
63
+ }
64
+ .mg-tag.mg-tag--info.mg-tag--outline {
65
+ background-color: transparent;
66
+ color: hsl(var(--color-info));
67
+ }
68
+
69
+ .mg-tag,
70
+ mg-tag {
71
+ display: inline-block;
72
+ vertical-align: middle;
73
+ }