@mgdis/mg-components 3.1.0 → 4.0.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 (241) hide show
  1. package/dist/cjs/{index-85a4a0b6.js → index-88560a66.js} +123 -48
  2. package/dist/cjs/index-a39c5567.js +233 -0
  3. package/dist/cjs/loader.cjs.js +3 -17
  4. package/dist/cjs/mg-badge_21.cjs.entry.js +3538 -0
  5. package/dist/cjs/mg-components.cjs.js +3 -7
  6. package/dist/cjs/mg-modal.cjs.entry.js +117 -0
  7. package/dist/cjs/mg-popover.cjs.entry.js +170 -0
  8. package/dist/cjs/popper-71bf3058.js +1790 -0
  9. package/dist/collection/collection-manifest.json +4 -1
  10. package/dist/collection/components/atoms/mg-badge/{mg-badge.stories.js → doc/mg-badge.stories.js} +4 -1
  11. package/dist/collection/components/atoms/mg-badge/mg-badge.conf.js +1 -1
  12. package/dist/collection/components/atoms/mg-badge/mg-badge.css +0 -2
  13. package/dist/collection/components/atoms/mg-badge/mg-badge.js +26 -10
  14. package/dist/collection/components/atoms/mg-button/{mg-button.stories.js → doc/mg-button.stories.js} +7 -2
  15. package/dist/collection/components/atoms/mg-button/mg-button.conf.js +1 -1
  16. package/dist/collection/components/atoms/mg-button/mg-button.css +46 -49
  17. package/dist/collection/components/atoms/mg-button/mg-button.js +78 -4
  18. package/dist/collection/components/atoms/mg-character-left/{mg-character-left.stories.js → doc/mg-character-left.stories.js} +8 -0
  19. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +20 -46
  20. package/dist/collection/components/atoms/mg-icon/{mg-icon.stories.js → doc/mg-icon.stories.js} +1 -1
  21. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +104 -9
  22. package/dist/collection/components/atoms/mg-icon/mg-icon.css +9 -7
  23. package/dist/collection/components/atoms/mg-icon/mg-icon.js +33 -7
  24. package/dist/collection/components/atoms/mg-input-title/{mg-input-title.stories.js → doc/mg-input-title.stories.js} +0 -0
  25. package/dist/collection/components/atoms/mg-input-title/mg-input-title.css +4 -4
  26. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +14 -3
  27. package/dist/collection/components/atoms/mg-tag/{mg-tag.stories.js → doc/mg-tag.stories.js} +4 -1
  28. package/dist/collection/components/atoms/mg-tag/mg-tag.js +28 -6
  29. package/dist/collection/components/atoms/mg-tooltip/{mg-tooltip.stories.js → doc/mg-tooltip.stories.js} +14 -1
  30. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +20 -0
  31. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +16 -2
  32. package/dist/collection/components/molecules/inputs/MgInput.conf.js +1 -7
  33. package/dist/collection/components/molecules/inputs/MgInput.js +25 -29
  34. package/dist/collection/components/molecules/inputs/mg-input-checkbox/{mg-input-checkbox.stories.js → doc/mg-input-checkbox.stories.js} +6 -1
  35. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +25 -11
  36. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +102 -52
  37. package/dist/collection/components/molecules/inputs/mg-input-date/{mg-input-date.stories.js → doc/mg-input-date.stories.js} +6 -1
  38. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +37 -9
  39. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +136 -66
  40. package/dist/collection/components/molecules/inputs/mg-input-numeric/{mg-input-numeric.stories.js → doc/mg-input-numeric.stories.js} +15 -3
  41. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +38 -10
  42. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +180 -80
  43. package/dist/collection/components/molecules/inputs/mg-input-password/{mg-input-password.stories.js → doc/mg-input-password.stories.js} +16 -2
  44. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +37 -9
  45. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +108 -47
  46. package/dist/collection/components/molecules/inputs/mg-input-radio/{mg-input-radio.stories.js → doc/mg-input-radio.stories.js} +6 -1
  47. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +25 -11
  48. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +113 -42
  49. package/dist/collection/components/molecules/inputs/mg-input-select/{mg-input-select.stories.js → doc/mg-input-select.stories.js} +22 -2
  50. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +39 -10
  51. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +145 -71
  52. package/dist/collection/components/molecules/inputs/mg-input-text/{mg-input-text.stories.js → doc/mg-input-text.stories.js} +17 -8
  53. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +69 -19
  54. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +184 -83
  55. package/dist/collection/components/molecules/inputs/mg-input-textarea/{mg-input-textarea.stories.js → doc/mg-input-textarea.stories.js} +16 -5
  56. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +69 -13
  57. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +163 -70
  58. package/dist/collection/components/molecules/inputs/mg-input-toggle/{mg-input-toggle.stories.js → doc/mg-input-toggle.stories.js} +6 -1
  59. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +22 -10
  60. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +68 -33
  61. package/dist/collection/components/molecules/mg-form/doc/mg-form.stories.js +58 -0
  62. package/dist/collection/components/molecules/mg-form/mg-form.css +19 -0
  63. package/dist/collection/components/molecules/mg-form/mg-form.js +271 -0
  64. package/dist/collection/components/molecules/mg-message/{mg-message.stories.js → doc/mg-message.stories.js} +6 -2
  65. package/dist/collection/components/molecules/mg-message/mg-message.css +1 -1
  66. package/dist/collection/components/molecules/mg-message/mg-message.js +26 -11
  67. package/dist/collection/components/molecules/mg-modal/doc/mg-modal.stories.js +51 -0
  68. package/dist/collection/components/molecules/mg-modal/mg-modal.css +52 -0
  69. package/dist/collection/components/molecules/mg-modal/mg-modal.js +240 -0
  70. package/dist/collection/components/molecules/mg-pagination/{mg-pagination.stories.js → doc/mg-pagination.stories.js} +1 -0
  71. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +47 -28
  72. package/dist/collection/components/molecules/mg-panel/doc/mg-panel.stories.js +39 -0
  73. package/dist/collection/components/molecules/mg-panel/mg-panel.css +53 -0
  74. package/dist/collection/components/molecules/mg-panel/mg-panel.js +356 -0
  75. package/dist/collection/components/molecules/mg-popover/{mg-popover.stories.js → doc/mg-popover.stories.js} +10 -0
  76. package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js +20 -0
  77. package/dist/collection/components/molecules/mg-popover/mg-popover.css +2 -2
  78. package/dist/collection/components/molecules/mg-popover/mg-popover.js +37 -12
  79. package/dist/collection/components/molecules/mg-tabs/{mg-tabs.stories.js → doc/mg-tabs.stories.js} +20 -4
  80. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +11 -1
  81. package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +17 -3
  82. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +139 -26
  83. package/dist/collection/locales/index.js +33 -4
  84. package/dist/collection/stories/helpers.stories.js +33 -0
  85. package/dist/collection/utils/components.utils.js +16 -9
  86. package/dist/collection/utils/locale.utils.js +13 -7
  87. package/dist/collection/utils/test.utils.js +27 -15
  88. package/dist/collection/variables.css +39 -5
  89. package/dist/collection/variables.scss +39 -5
  90. package/dist/components/MgInput.js +26 -37
  91. package/dist/components/components.utils.js +16 -9
  92. package/dist/components/index.d.ts +24 -6
  93. package/dist/components/index.js +23 -0
  94. package/dist/components/index2.js +116 -17
  95. package/dist/components/locale.utils.js +13 -8
  96. package/dist/components/mg-badge2.js +25 -9
  97. package/dist/components/mg-button2.js +29 -5
  98. package/dist/components/mg-character-left2.js +14 -26
  99. package/dist/components/mg-form.d.ts +11 -0
  100. package/dist/components/mg-form.js +148 -0
  101. package/dist/components/mg-icon2.js +138 -17
  102. package/dist/components/mg-input-checkbox.js +66 -53
  103. package/dist/components/mg-input-date.js +100 -69
  104. package/dist/components/mg-input-numeric.js +125 -81
  105. package/dist/components/mg-input-password.js +69 -48
  106. package/dist/components/mg-input-radio.js +74 -46
  107. package/dist/components/mg-input-select2.js +103 -71
  108. package/dist/components/mg-input-text.js +1 -237
  109. package/dist/components/mg-input-text2.js +300 -0
  110. package/dist/components/mg-input-textarea.js +100 -46
  111. package/dist/components/mg-input-title2.js +13 -4
  112. package/dist/components/mg-input-toggle.js +39 -31
  113. package/dist/components/mg-message.js +25 -10
  114. package/dist/components/mg-modal.d.ts +11 -0
  115. package/dist/components/mg-modal.js +153 -0
  116. package/dist/components/mg-pagination.js +45 -31
  117. package/dist/components/mg-panel.d.ts +11 -0
  118. package/dist/components/mg-panel.js +244 -0
  119. package/dist/components/mg-popover.js +31 -11
  120. package/dist/components/mg-tabs.js +113 -23
  121. package/dist/components/mg-tag.js +27 -5
  122. package/dist/components/mg-tooltip2.js +10 -1
  123. package/dist/components/popper.js +6 -2
  124. package/dist/esm/{index-e3e84606.js → index-bca81100.js} +124 -46
  125. package/dist/esm/index-e51ae032.js +228 -0
  126. package/dist/esm/loader.js +3 -17
  127. package/dist/esm/mg-badge_21.entry.js +3514 -0
  128. package/dist/esm/mg-components.js +3 -7
  129. package/dist/esm/mg-modal.entry.js +113 -0
  130. package/dist/esm/mg-popover.entry.js +166 -0
  131. package/dist/esm/polyfills/css-shim.js +1 -1
  132. package/dist/esm/popper-93ecb064.js +1788 -0
  133. package/dist/index.js +1 -1
  134. package/dist/mg-components/mg-components.css +1 -1
  135. package/dist/mg-components/mg-components.esm.js +1 -1
  136. package/dist/mg-components/p-003a1344.entry.js +1 -0
  137. package/dist/mg-components/p-462d648a.entry.js +1 -0
  138. package/dist/mg-components/p-4c66f794.js +1 -0
  139. package/dist/mg-components/p-5126ab10.entry.js +1 -0
  140. package/dist/mg-components/p-780bd52d.js +1 -0
  141. package/dist/mg-components/p-b14a3443.js +2 -0
  142. package/dist/mg-components/variables.css +39 -5
  143. package/dist/mg-components/variables.scss +39 -5
  144. package/dist/types/components/atoms/mg-badge/{mg-badge.stories.d.ts → doc/mg-badge.stories.d.ts} +5 -0
  145. package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +16 -5
  146. package/dist/types/components/atoms/mg-button/{mg-button.stories.d.ts → doc/mg-button.stories.d.ts} +5 -0
  147. package/dist/types/components/atoms/mg-button/mg-button.d.ts +23 -3
  148. package/dist/types/components/atoms/mg-character-left/{mg-character-left.stories.d.ts → doc/mg-character-left.stories.d.ts} +9 -0
  149. package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +16 -13
  150. package/dist/types/components/atoms/mg-icon/{mg-icon.stories.d.ts → doc/mg-icon.stories.d.ts} +0 -0
  151. package/dist/types/components/atoms/mg-icon/mg-icon.conf.d.ts +1 -1
  152. package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +14 -4
  153. package/dist/types/components/atoms/mg-input-title/{mg-input-title.stories.d.ts → doc/mg-input-title.stories.d.ts} +0 -0
  154. package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +11 -1
  155. package/dist/types/components/atoms/mg-tag/{mg-tag.stories.d.ts → doc/mg-tag.stories.d.ts} +5 -0
  156. package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +18 -4
  157. package/dist/types/components/atoms/mg-tooltip/doc/mg-tooltip.stories.d.ts +29 -0
  158. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +8 -0
  159. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +13 -3
  160. package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +6 -4
  161. package/dist/types/components/molecules/inputs/MgInput.d.ts +7 -8
  162. package/dist/types/components/molecules/inputs/mg-input-checkbox/{mg-input-checkbox.stories.d.ts → doc/mg-input-checkbox.stories.d.ts} +5 -0
  163. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +36 -13
  164. package/dist/types/components/molecules/inputs/mg-input-date/{mg-input-date.stories.d.ts → doc/mg-input-date.stories.d.ts} +5 -0
  165. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +46 -15
  166. package/dist/types/components/molecules/inputs/mg-input-numeric/{mg-input-numeric.stories.d.ts → doc/mg-input-numeric.stories.d.ts} +11 -0
  167. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +61 -16
  168. package/dist/types/components/molecules/inputs/mg-input-password/doc/mg-input-password.stories.d.ts +22 -0
  169. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +35 -11
  170. package/dist/types/components/molecules/inputs/mg-input-radio/{mg-input-radio.stories.d.ts → doc/mg-input-radio.stories.d.ts} +5 -0
  171. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.conf.d.ts +1 -1
  172. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +42 -9
  173. package/dist/types/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.d.ts +34 -0
  174. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.conf.d.ts +1 -1
  175. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +37 -9
  176. package/dist/types/components/molecules/inputs/mg-input-text/{mg-input-text.stories.d.ts → doc/mg-input-text.stories.d.ts} +13 -0
  177. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +52 -16
  178. package/dist/types/components/molecules/inputs/mg-input-textarea/doc/mg-input-textarea.stories.d.ts +19 -0
  179. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +45 -17
  180. package/dist/types/components/molecules/inputs/mg-input-toggle/{mg-input-toggle.stories.d.ts → doc/mg-input-toggle.stories.d.ts} +5 -0
  181. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.d.ts +1 -1
  182. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +29 -12
  183. package/dist/types/components/molecules/{mg-popover/mg-popover.stories.d.ts → mg-form/doc/mg-form.stories.d.ts} +3 -4
  184. package/dist/types/components/molecules/mg-form/mg-form.d.ts +83 -0
  185. package/dist/types/components/molecules/mg-message/{mg-message.stories.d.ts → doc/mg-message.stories.d.ts} +10 -0
  186. package/dist/types/components/molecules/mg-message/mg-message.d.ts +13 -4
  187. package/dist/types/components/molecules/mg-modal/doc/mg-modal.stories.d.ts +13 -0
  188. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +85 -0
  189. package/dist/types/components/molecules/mg-pagination/{mg-pagination.stories.d.ts → doc/mg-pagination.stories.d.ts} +5 -0
  190. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +31 -7
  191. package/dist/types/components/molecules/mg-panel/doc/mg-panel.stories.d.ts +11 -0
  192. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +139 -0
  193. package/dist/types/components/molecules/mg-popover/doc/mg-popover.stories.d.ts +25 -0
  194. package/dist/types/components/molecules/mg-popover/mg-popover.conf.d.ts +8 -0
  195. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +27 -4
  196. package/dist/types/components/molecules/mg-tabs/doc/mg-tabs.stories.d.ts +20 -0
  197. package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +11 -0
  198. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +70 -6
  199. package/dist/types/components.d.ts +528 -211
  200. package/dist/types/locales/index.d.ts +108 -38
  201. package/dist/types/stories/{buttons.stories.d.ts → helpers.stories.d.ts} +1 -1
  202. package/dist/types/utils/components.utils.d.ts +16 -9
  203. package/dist/types/utils/locale.utils.d.ts +13 -6
  204. package/dist/types/utils/test.utils.d.ts +13 -1
  205. package/loader/index.js +1 -1
  206. package/package.json +45 -14
  207. package/readme.md +9 -35
  208. package/dist/cjs/css-shim-a22512c4.js +0 -6
  209. package/dist/cjs/mg-badge_20.cjs.entry.js +0 -4661
  210. package/dist/cjs/shadow-css-8940f82d.js +0 -390
  211. package/dist/collection/stories/buttons.stories.js +0 -43
  212. package/dist/collection/stories/messages.stories.js +0 -44
  213. package/dist/collection/stories/tags.stories.js +0 -13
  214. package/dist/esm/css-shim-7c240feb.js +0 -4
  215. package/dist/esm/mg-badge_20.entry.js +0 -4638
  216. package/dist/esm/shadow-css-5d2d01ce.js +0 -388
  217. package/dist/esm-es5/css-shim-7c240feb.js +0 -1
  218. package/dist/esm-es5/index-e3e84606.js +0 -1
  219. package/dist/esm-es5/index.js +0 -0
  220. package/dist/esm-es5/loader.js +0 -1
  221. package/dist/esm-es5/mg-badge_20.entry.js +0 -2
  222. package/dist/esm-es5/mg-components.js +0 -1
  223. package/dist/esm-es5/shadow-css-5d2d01ce.js +0 -12
  224. package/dist/mg-components/mg-components.js +0 -132
  225. package/dist/mg-components/p-1cd24462.system.js +0 -1
  226. package/dist/mg-components/p-2e2f6b27.system.entry.js +0 -2
  227. package/dist/mg-components/p-366a224e.js +0 -1
  228. package/dist/mg-components/p-422c429b.system.js +0 -1
  229. package/dist/mg-components/p-50ea2036.system.js +0 -1
  230. package/dist/mg-components/p-62fa3797.js +0 -1
  231. package/dist/mg-components/p-71d57b8b.system.js +0 -13
  232. package/dist/mg-components/p-9a215712.system.js +0 -1
  233. package/dist/mg-components/p-cbf0464b.entry.js +0 -1
  234. package/dist/mg-components/p-f6455ab3.js +0 -12
  235. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.stories.d.ts +0 -11
  236. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.stories.d.ts +0 -9
  237. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.stories.d.ts +0 -14
  238. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.stories.d.ts +0 -6
  239. package/dist/types/components/molecules/mg-tabs/mg-tabs.stories.d.ts +0 -7
  240. package/dist/types/stories/messages.stories.d.ts +0 -13
  241. package/dist/types/stories/tags.stories.d.ts +0 -5
@@ -1,17 +1,17 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
2
  import { M as MgInput } from './MgInput.js';
3
3
  import { c as createID, C as ClassList, a as allItemsAreString } from './components.utils.js';
4
- import { d as defineCustomElement$5 } from './mg-character-left2.js';
5
4
  import { d as defineCustomElement$4 } from './mg-icon2.js';
6
5
  import { d as defineCustomElement$3 } from './mg-input-title2.js';
7
6
  import { d as defineCustomElement$2 } from './mg-tooltip2.js';
8
7
 
9
- const mgInputToggleCss = ":host{display:block}.mg-input{display:-ms-flexbox;display:flex;-ms-flex-align:start;align-items:flex-start;min-height:var(--default-size);max-width:100%;}.mg-input.is-not-valid{color:hsl(var(--color-danger))}.mg-input.is-not-valid .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input mg-input-title{-ms-flex-negative:var(--mg-inputs-shrink, 1);flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{-ms-flex-direction:column;flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:-ms-flexbox;display:flex;-ms-flex-align:baseline;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{-ms-flex-negative:1;flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:-ms-inline-flexbox;display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:-ms-inline-flexbox;display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container mg-icon{display:-ms-flexbox;display:flex}.mg-input__input{display:-ms-flexbox;display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input+*{text-align:start;margin-top:0.5rem}.sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}.mg-input.mg-input.mg-input--toggle .mg-input__input-container{-ms-flex:auto;flex:auto;min-width:0}.mg-input__button-toggle{display:-ms-flexbox;display:flex;padding:0.2rem;min-width:0;background-color:hsl(var(--color-light));border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:calc((var(--font-size) * var(--line-height) + 2 * (0.7rem + var(--mg-inputs-border-width))) / var(--mg-input-toggle-border-radius-ratio));font-size:inherit;line-height:inherit;cursor:pointer}.mg-input__toggle-item-container{padding:0.5rem 0.9rem;border:0;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:calc((var(--font-size) * var(--line-height) + 1rem) / var(--mg-input-toggle-border-radius-ratio));background-color:unset;font-weight:unset;color:hsl(var(--color-dark));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mg-input__toggle-item-container:first-of-type{font-weight:600;color:hsl(var(--color-info));background-color:hsl(var(--color-info-h), calc(var(--color-info-s) - 64%), calc(var(--color-info-l) + 55%))}.mg-input.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{background-color:unset;font-weight:unset;color:hsl(var(--color-dark))}.mg-input.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{font-weight:600;color:hsl(var(--color-info));background-color:hsl(var(--color-info-h), calc(var(--color-info-s) - 64%), calc(var(--color-info-l) + 55%))}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;width:calc(var(--font-size) * var(--line-height) + 1rem);height:calc(var(--font-size) * var(--line-height) + 1rem);padding:0;visibility:hidden}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container:first-of-type{visibility:visible}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container ::slotted(mg-icon){display:-ms-flexbox;display:flex}.mg-input.mg-input--toggle-icon.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{visibility:hidden}.mg-input.mg-input--toggle-icon.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{visibility:visible}.mg-input.mg-input--toggle-on-off .mg-input__toggle-item-container:first-of-type{font-weight:600;color:hsl(var(--color-dark));background-color:hsl(var(--color-dark-h), calc(var(--color-dark-s) - 30%), calc(var(--color-dark-l) + 75%))}.mg-input.mg-input--toggle-on-off.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{background-color:unset;font-weight:unset;color:hsl(var(--color-dark))}.mg-input.mg-input--toggle-readonly .mg-input__button-toggle{border-color:transparent;background-color:transparent;cursor:initial}.mg-input.mg-input--toggle-readonly .mg-input__toggle-item-container:last-of-type{display:none}.mg-input.mg-input--toggle-readonly.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{display:none}.mg-input.mg-input--toggle-readonly.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{display:-ms-flexbox;display:flex}.mg-input.mg-input--toggle-disabled .mg-input__button-toggle{opacity:0.3;cursor:not-allowed}";
8
+ const mgInputToggleCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container mg-icon{display:flex}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}.mg-input.mg-input.mg-input--toggle .mg-input__input-container{flex:auto;min-width:0}.mg-input__button-toggle{display:flex;padding:0.2rem;min-width:0;background-color:hsl(var(--color-light));border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:calc((var(--font-size) * var(--line-height) + 2 * (0.7rem + var(--mg-inputs-border-width))) / var(--mg-input-toggle-border-radius-ratio));font-size:inherit;line-height:inherit;cursor:pointer}.mg-input__button-toggle:disabled{cursor:default}.mg-input__toggle-item-container{padding:0.5rem 0.9rem;border:0;box-sizing:border-box;border-radius:calc((var(--font-size) * var(--line-height) + 1rem) / var(--mg-input-toggle-border-radius-ratio));background-color:unset;font-weight:unset;color:hsl(var(--color-dark));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mg-input__toggle-item-container:first-of-type{font-weight:600;color:hsl(var(--color-info));background-color:hsl(var(--color-info-h), calc(var(--color-info-s) - 64%), calc(var(--color-info-l) + 55%))}.mg-input.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{background-color:unset;font-weight:unset;color:hsl(var(--color-dark))}.mg-input.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{font-weight:600;color:hsl(var(--color-info));background-color:hsl(var(--color-info-h), calc(var(--color-info-s) - 64%), calc(var(--color-info-l) + 55%))}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container{display:flex;justify-content:center;align-items:center;width:calc(var(--font-size) * var(--line-height) + 1rem);height:calc(var(--font-size) * var(--line-height) + 1rem);padding:0;visibility:hidden}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container:first-of-type{visibility:visible}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container ::slotted(mg-icon){display:flex}.mg-input.mg-input--toggle-icon.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{visibility:hidden}.mg-input.mg-input--toggle-icon.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{visibility:visible}.mg-input.mg-input--toggle-on-off .mg-input__toggle-item-container:first-of-type{font-weight:600;color:hsl(var(--color-dark));background-color:hsl(var(--color-dark-h), calc(var(--color-dark-s) - 30%), calc(var(--color-dark-l) + 75%))}.mg-input.mg-input--toggle-on-off.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{background-color:unset;font-weight:unset;color:hsl(var(--color-dark))}.mg-input.mg-input--toggle-readonly .mg-input__button-toggle{border-color:transparent;background-color:transparent;cursor:initial}.mg-input.mg-input--toggle-readonly .mg-input__toggle-item-container:last-of-type{display:none}.mg-input.mg-input--toggle-readonly.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{display:none}.mg-input.mg-input--toggle-readonly.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{display:flex}.mg-input.mg-input--toggle-disabled .mg-input__button-toggle{opacity:0.3}";
10
9
 
11
10
  /**
12
11
  * type Option validation function
13
- * @param option
14
- * @returns {boolean}
12
+ *
13
+ * @param {ToggleValue} option radio option
14
+ * @returns {boolean} toggle option type is valid
15
15
  */
16
16
  const isOption = (option) => typeof option === 'object' && typeof option.title === 'string' && option.value !== undefined;
17
17
  const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
@@ -20,6 +20,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
20
20
  this.__registerHost();
21
21
  this.__attachShadow();
22
22
  this.valueChange = createEvent(this, "value-change", 7);
23
+ this.inputValid = createEvent(this, "input-valid", 7);
23
24
  /************
24
25
  * Internal *
25
26
  ************/
@@ -27,6 +28,8 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
27
28
  this.classReadonly = 'mg-input--toggle-readonly';
28
29
  this.classDisabled = 'mg-input--toggle-disabled';
29
30
  this.classIsActive = 'mg-input--toggle-is-active';
31
+ this.classOnOff = 'mg-input--toggle-on-off';
32
+ this.classIcon = 'mg-input--toggle-icon';
30
33
  /**
31
34
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
32
35
  * If not set, it will be created.
@@ -67,12 +70,16 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
67
70
  this.checked = false;
68
71
  /**
69
72
  * Change checked value
73
+ *
74
+ * @returns {void}
70
75
  */
71
76
  this.toggleChecked = () => {
72
- this.setChecked(!this.checked);
77
+ this.checked = !this.checked;
73
78
  };
74
79
  /**
75
80
  * Slots validation
81
+ *
82
+ * @returns {void}
76
83
  */
77
84
  this.validateSlots = () => {
78
85
  const slots = Array.from(this.element.children);
@@ -86,6 +93,12 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
86
93
  }
87
94
  };
88
95
  }
96
+ handleValue(newValue) {
97
+ // Swich to the right option
98
+ this.setChecked();
99
+ // Emit value-change event
100
+ this.valueChange.emit(newValue);
101
+ }
89
102
  validateItems(newValue) {
90
103
  if (typeof newValue === 'object' && this.items.length !== 2) {
91
104
  throw new Error('<mg-input-toggle> prop "items" require 2 items.');
@@ -104,11 +117,15 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
104
117
  }
105
118
  handleIsOnOff(newValue) {
106
119
  if (newValue)
107
- this.classList.add(`mg-input--toggle-on-off`);
120
+ this.classList.add(this.classOnOff);
121
+ else
122
+ this.classList.delete(this.classOnOff);
108
123
  }
109
124
  handleIsIcon(newValue) {
110
125
  if (newValue)
111
- this.classList.add(`mg-input--toggle-icon`);
126
+ this.classList.add(this.classIcon);
127
+ else
128
+ this.classList.delete(this.classIcon);
112
129
  }
113
130
  handleReadonly(newValue) {
114
131
  if (newValue)
@@ -129,14 +146,14 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
129
146
  else
130
147
  this.classList.delete(this.classIsActive);
131
148
  // update value
132
- this.value = this.options[this.checked ? 1 : 0].value;
133
- this.valueChange.emit(this.value);
149
+ this.value = this.options[newValue ? 1 : 0].value;
134
150
  }
135
151
  /**
136
152
  * set checked state
137
- * @param newValue?
153
+ *
154
+ * @returns {void}
138
155
  */
139
- setChecked(newValue) {
156
+ setChecked() {
140
157
  // has "value" props type is not a boolean, it is bind/render as an attributes/props
141
158
  // true props will be represent by "true" string so we convert it has boolean
142
159
  // true attribute will be represent by "" string so we convert it has boolean
@@ -144,15 +161,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
144
161
  if (['', 'true'].includes(this.value) && this.options.find(option => option.value) !== undefined) {
145
162
  this.value = true;
146
163
  }
147
- if (newValue !== undefined) {
148
- this.checked = newValue;
149
- }
150
- else if (this.value === this.options[1].value) {
151
- this.checked = true;
152
- }
153
- else {
154
- this.checked = false;
155
- }
164
+ this.checked = this.value === this.options[1].value;
156
165
  }
157
166
  /*************
158
167
  * Lifecycle *
@@ -163,6 +172,8 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
163
172
  componentWillLoad() {
164
173
  // Check items format
165
174
  this.validateItems(this.items);
175
+ // Check slots
176
+ this.validateSlots();
166
177
  // init checked value
167
178
  this.setChecked();
168
179
  // apply handler
@@ -170,16 +181,18 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
170
181
  this.handleIsIcon(this.isIcon);
171
182
  this.handleReadonly(this.readonly);
172
183
  this.handleDisabled(this.disabled);
173
- this.validateSlots();
174
184
  }
185
+ /**
186
+ * Render
187
+ *
188
+ * @returns {HTMLElement} HTML Element
189
+ */
175
190
  render() {
176
- var _a;
177
- return (h(MgInput, { identifier: this.identifier, classList: this.classList, label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, readonly: undefined, width: undefined, disabled: this.disabled, value: (_a = this.value) === null || _a === void 0 ? void 0 : _a.toString(), readonlyValue: undefined, tooltip: !this.readonly && this.tooltip, displayCharacterLeft: undefined, characterLeftTemplate: undefined, maxlength: undefined, helpText: this.helpText, errorMessage: undefined, isFieldset: false }, h("button", { type: "button", role: "switch", "aria-checked": this.checked, "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-input__button-toggle", disabled: this.disabled || this.readonly,
178
- // eslint-disable-next-line react/jsx-no-bind
179
- onClick: () => this.toggleChecked() }, h("span", { "aria-hidden": "true", class: "mg-input__toggle-item-container" }, h("slot", { name: "item-1" })), h("span", { "aria-hidden": "true", class: "mg-input__toggle-item-container" }, h("slot", { name: "item-2" })))));
191
+ return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, readonly: undefined, mgWidth: undefined, disabled: this.disabled, value: this.value, readonlyValue: undefined, tooltip: !this.readonly && this.tooltip, helpText: this.helpText, errorMessage: undefined, isFieldset: false }, h("button", { type: "button", role: "switch", "aria-checked": this.checked.toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-input__button-toggle", disabled: this.disabled || this.readonly, onClick: this.toggleChecked }, h("span", { "aria-hidden": "true", class: "mg-input__toggle-item-container" }, h("slot", { name: "item-1" })), h("span", { "aria-hidden": "true", class: "mg-input__toggle-item-container" }, h("slot", { name: "item-2" })))));
180
192
  }
181
193
  get element() { return this; }
182
194
  static get watchers() { return {
195
+ "value": ["handleValue"],
183
196
  "items": ["validateItems"],
184
197
  "isOnOff": ["handleIsOnOff"],
185
198
  "isIcon": ["handleIsIcon"],
@@ -210,18 +223,13 @@ function defineCustomElement$1() {
210
223
  if (typeof customElements === "undefined") {
211
224
  return;
212
225
  }
213
- const components = ["mg-input-toggle", "mg-character-left", "mg-icon", "mg-input-title", "mg-tooltip"];
226
+ const components = ["mg-input-toggle", "mg-icon", "mg-input-title", "mg-tooltip"];
214
227
  components.forEach(tagName => { switch (tagName) {
215
228
  case "mg-input-toggle":
216
229
  if (!customElements.get(tagName)) {
217
230
  customElements.define(tagName, MgInputToggle$1);
218
231
  }
219
232
  break;
220
- case "mg-character-left":
221
- if (!customElements.get(tagName)) {
222
- defineCustomElement$5();
223
- }
224
- break;
225
233
  case "mg-icon":
226
234
  if (!customElements.get(tagName)) {
227
235
  defineCustomElement$4();
@@ -1,6 +1,6 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
2
  import { c as createID, C as ClassList } from './components.utils.js';
3
- import { m as messages } from './index2.js';
3
+ import { i as initLocales } from './index2.js';
4
4
  import { d as defineCustomElement$3 } from './mg-button2.js';
5
5
  import { d as defineCustomElement$2 } from './mg-icon2.js';
6
6
 
@@ -9,7 +9,7 @@ import { d as defineCustomElement$2 } from './mg-icon2.js';
9
9
  */
10
10
  const variants = ['info', 'warning', 'success', 'danger'];
11
11
 
12
- const mgMessageCss = ".mg-message{display:inline-block;position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;min-height:var(--default-size);overflow:hidden;background-color:white;border-radius:var(--mg-message-border-radius);-webkit-box-shadow:0 0.3rem 0.8rem 0 hsla(var(--color-dark), 0.1);box-shadow:0 0.3rem 0.8rem 0 hsla(var(--color-dark), 0.1)}.mg-message::before{content:\"\";position:absolute;top:0;left:0;width:0.3rem;height:100%}.mg-message.mg-message--info::before{background-color:hsl(var(--color-info))}.mg-message.mg-message--info .mg-message__icon{color:hsl(var(--color-info))}.mg-message.mg-message--warning::before{background-color:hsl(var(--color-warning))}.mg-message.mg-message--warning .mg-message__icon{color:hsl(var(--color-warning))}.mg-message.mg-message--success::before{background-color:hsl(var(--color-success))}.mg-message.mg-message--success .mg-message__icon{color:hsl(var(--color-success))}.mg-message.mg-message--danger::before{background-color:hsl(var(--color-danger))}.mg-message.mg-message--danger .mg-message__icon{color:hsl(var(--color-danger))}.mg-message.mg-message--close-button{padding-right:3.4rem}.mg-message.mg-message--hide{display:none}.mg-message ::slotted(*){margin:0;padding:0}.mg-message__icon{position:absolute;top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);left:1.3rem;line-height:1}.mg-message__content{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-pack:end;justify-content:flex-end;-ms-flex-line-pack:stretch;align-content:stretch;padding:0 1rem 0 3.8rem}.mg-message__content-slot{-ms-flex-positive:1;flex-grow:1;margin:0.84rem 0}.mg-message__content-separator{display:inline-block;width:4.5rem;height:0}.mg-message__content-actions-slot{padding:1rem 0;text-align:right}.mg-message__close-button{position:absolute;top:0;right:0}.mg-message,mg-message{max-width:100%}";
12
+ const mgMessageCss = ".mg-message{display:inline-block;position:relative;box-sizing:border-box;min-height:var(--default-size);overflow:hidden;background-color:white;border-radius:var(--mg-message-border-radius);box-shadow:var(--box-shadow)}.mg-message::before{content:\"\";position:absolute;top:0;left:0;width:0.3rem;height:100%}.mg-message.mg-message--info::before{background-color:hsl(var(--color-info))}.mg-message.mg-message--info .mg-message__icon{color:hsl(var(--color-info))}.mg-message.mg-message--warning::before{background-color:hsl(var(--color-warning))}.mg-message.mg-message--warning .mg-message__icon{color:hsl(var(--color-warning))}.mg-message.mg-message--success::before{background-color:hsl(var(--color-success))}.mg-message.mg-message--success .mg-message__icon{color:hsl(var(--color-success))}.mg-message.mg-message--danger::before{background-color:hsl(var(--color-danger))}.mg-message.mg-message--danger .mg-message__icon{color:hsl(var(--color-danger))}.mg-message.mg-message--close-button{padding-right:3.4rem}.mg-message.mg-message--hide{display:none}.mg-message ::slotted(*){margin:0;padding:0}.mg-message__icon{position:absolute;top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);left:1.3rem;line-height:1}.mg-message__content{display:flex;flex-wrap:wrap;justify-content:flex-end;align-content:stretch;padding:0 1rem 0 3.8rem}.mg-message__content-slot{flex-grow:1;margin:0.84rem 0}.mg-message__content-separator{display:inline-block;width:4.5rem;height:0}.mg-message__content-actions-slot{padding:1rem 0;text-align:right}.mg-message__close-button{position:absolute;top:0;right:0}.mg-message,mg-message{max-width:100%}";
13
13
 
14
14
  const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
15
15
  constructor() {
@@ -21,6 +21,9 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
21
21
  /************
22
22
  * Internal *
23
23
  ************/
24
+ // classes
25
+ this.classHide = 'mg-message--hide';
26
+ // IDs
24
27
  this.closeButtonId = '';
25
28
  // Stored timer setted when hide action is run from setTimeOut
26
29
  this.storedTimer = null;
@@ -32,7 +35,7 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
32
35
  /**
33
36
  * Message variant
34
37
  */
35
- this.variant = variants[0];
38
+ this.variant = variants[0]; // info
36
39
  /**
37
40
  * Define if message has a cross button
38
41
  * RG 01: https://jira.mgdis.fr/browse/PDA9-140
@@ -69,6 +72,8 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
69
72
  };
70
73
  /**
71
74
  * Get icon corresponding to variant
75
+ *
76
+ * @returns {string} icon
72
77
  */
73
78
  this.getIcon = () => {
74
79
  switch (this.variant) {
@@ -92,10 +97,12 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
92
97
  if (!variants.includes(newValue)) {
93
98
  throw new Error(`<mg-message> prop "variant" must be one of : ${variants.join(', ')}`);
94
99
  }
95
- if (oldValue !== undefined) {
96
- this.classList.delete(`mg-message--${oldValue}`);
100
+ else {
101
+ if (oldValue !== undefined) {
102
+ this.classList.delete(`mg-message--${oldValue}`);
103
+ }
104
+ this.classList.add(`mg-message--${newValue}`);
97
105
  }
98
- this.classList.add(`mg-message--${this.variant}`);
99
106
  }
100
107
  validateCloseButton(newValue) {
101
108
  if (newValue && this.hasActions) {
@@ -106,11 +113,11 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
106
113
  validateHide(newValue) {
107
114
  if (newValue) {
108
115
  this.componentHide.emit();
109
- this.classList.add('mg-message--hide');
116
+ this.classList.add(this.classHide);
110
117
  }
111
118
  else {
112
119
  this.componentShow.emit();
113
- this.classList.delete('mg-message--hide');
120
+ this.classList.delete(this.classHide);
114
121
  }
115
122
  this.hideWithDelay();
116
123
  }
@@ -121,6 +128,9 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
121
128
  * Check if component props are well configured on init
122
129
  */
123
130
  componentWillLoad() {
131
+ // Get locales
132
+ this.messages = initLocales(this.element).messages;
133
+ // Validate
124
134
  this.validateVariant(this.variant);
125
135
  // Check if close button is an can be activated
126
136
  this.hasActions = this.element.querySelector('[slot="actions"]') !== null;
@@ -132,8 +142,13 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
132
142
  this.validateDelay(this.delay);
133
143
  this.validateHide(this.hide);
134
144
  }
145
+ /**
146
+ * Render
147
+ *
148
+ * @returns {HTMLElement} HTML Element
149
+ */
135
150
  render() {
136
- return (h("div", { id: this.identifier, class: this.classList.join(), role: this.variant === 'info' ? 'status' : 'alert' }, h("span", { class: "mg-message__icon" }, h("mg-icon", { icon: this.getIcon() })), h("div", { class: "mg-message__content" }, h("span", { class: "mg-message__content-slot" }, h("slot", null)), this.hasActions && h("span", { class: "mg-message__content-separator" }), this.hasActions && (h("span", { class: "mg-message__content-actions-slot" }, h("slot", { name: "actions" })))), this.closeButton && (h("span", { class: "mg-message__close-button" }, h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: messages.message.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" }))))));
151
+ return (h("div", { id: this.identifier, class: this.classList.join(), role: this.variant === 'info' ? 'status' : 'alert' }, h("span", { class: "mg-message__icon" }, h("mg-icon", { icon: this.getIcon() })), h("div", { class: "mg-message__content" }, h("span", { class: "mg-message__content-slot" }, h("slot", null)), this.hasActions && h("span", { class: "mg-message__content-separator" }), this.hasActions && (h("span", { class: "mg-message__content-actions-slot" }, h("slot", { name: "actions" })))), this.closeButton && (h("span", { class: "mg-message__close-button" }, h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.message.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" }))))));
137
152
  }
138
153
  get element() { return this; }
139
154
  static get watchers() { return {
@@ -147,7 +162,7 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
147
162
  "identifier": [1],
148
163
  "delay": [2],
149
164
  "variant": [1],
150
- "closeButton": [4, "close-button"],
165
+ "closeButton": [1028, "close-button"],
151
166
  "hide": [1028],
152
167
  "classList": [32],
153
168
  "hasActions": [32]
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface MgModal extends Components.MgModal, HTMLElement {}
4
+ export const MgModal: {
5
+ prototype: MgModal;
6
+ new (): MgModal;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,153 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
+ import { c as createID, C as ClassList } from './components.utils.js';
3
+ import { i as initLocales } from './index2.js';
4
+ import { d as defineCustomElement$3 } from './mg-button2.js';
5
+ import { d as defineCustomElement$2 } from './mg-icon2.js';
6
+
7
+ const mgModalCss = ".mg-modal{display:flex;justify-content:center;align-items:center;position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;padding:2rem 0;background-color:hsla(var(--color-light), 85%)}.mg-modal__dialog{display:flex;flex-direction:column;align-self:center;row-gap:3rem;padding:1.5rem 2.5rem;width:60rem;height:fit-content;max-width:100%;max-height:100%;box-sizing:border-box;background-color:hsl(var(--color-light));box-shadow:var(--box-shadow);border-radius:var(--mg-modal-border-radius)}.mg-modal__header{margin-bottom:0.5rem}.mg-modal__title{margin:0;font-family:var(--font-family-heading);font-size:var(--mg-modal-title-font-size);font-weight:600}.mg-modal__close-button{float:right;height:var(--mg-modal-title-font-size);margin-top:calc((var(--default-size) - var(--mg-modal-title-font-size) * var(--line-height)) / 2 * -1);margin-right:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2 * -1)}.mg-modal .mg-modal__content{overflow-y:auto}.mg-modal .mg-modal__content::slotted(*){font-size:var(--mg-modal-content-font-size)}.mg-modal.mg-modal--hide{display:none}";
8
+
9
+ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
10
+ constructor() {
11
+ super();
12
+ this.__registerHost();
13
+ this.__attachShadow();
14
+ this.componentShow = createEvent(this, "component-show", 7);
15
+ this.componentHide = createEvent(this, "component-hide", 7);
16
+ /************
17
+ * Internal *
18
+ ************/
19
+ // Classes
20
+ this.classHide = 'mg-modal--hide';
21
+ // IDs
22
+ this.closeButtonId = '';
23
+ this.titleId = '';
24
+ /**
25
+ * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
26
+ * If not set, it will be created.
27
+ */
28
+ this.identifier = createID('mg-modal');
29
+ /**
30
+ * Define if modal has a cross button
31
+ */
32
+ this.closeButton = false;
33
+ /**
34
+ * Define if modal is hidden
35
+ */
36
+ this.hide = false;
37
+ /**
38
+ * Define if component is using actions slot
39
+ */
40
+ this.hasActions = false;
41
+ /**
42
+ * Define if component is using content slot
43
+ */
44
+ this.hasContent = false;
45
+ /**
46
+ * Component classes
47
+ */
48
+ this.classList = new ClassList(['mg-modal']);
49
+ /*************
50
+ * Handlers *
51
+ *************/
52
+ /**
53
+ * Handle close button
54
+ *
55
+ * @returns {void}
56
+ */
57
+ this.handleClose = () => {
58
+ this.hide = true;
59
+ };
60
+ }
61
+ validateHide(newValue) {
62
+ if (newValue) {
63
+ this.componentHide.emit();
64
+ this.classList.add(this.classHide);
65
+ }
66
+ else {
67
+ this.componentShow.emit();
68
+ this.classList.delete(this.classHide);
69
+ }
70
+ }
71
+ /**
72
+ * Handle 'escape' key down
73
+ *
74
+ * @param {KeyboardEvent} event keydown event
75
+ * @returns {void}
76
+ */
77
+ handleKeyDown(event) {
78
+ // we can use 'Escape button" when this not a blocking modal, induced by closeButton value.
79
+ if (this.closeButton && event.key === 'Escape') {
80
+ this.hide = true;
81
+ }
82
+ }
83
+ /*************
84
+ * Lifecycle *
85
+ *************/
86
+ /**
87
+ * Check if component props are well configured on init
88
+ *
89
+ * @returns {void}
90
+ */
91
+ componentWillLoad() {
92
+ // Get locales
93
+ this.messages = initLocales(this.element).messages;
94
+ // Validate
95
+ this.hasActions = this.element.querySelector('[slot="actions"]') !== null;
96
+ this.hasContent = this.element.querySelector('[slot="content"]') !== null;
97
+ if (this.closeButton) {
98
+ this.closeButtonId = `${this.identifier}-close-button`;
99
+ }
100
+ this.titleId = `${this.identifier}-title`;
101
+ this.validateHide(this.hide);
102
+ }
103
+ /**
104
+ * Render
105
+ *
106
+ * @returns {HTMLElement} HTML Element
107
+ */
108
+ render() {
109
+ return (h("section", { role: "dialog", id: this.identifier, class: this.classList.join(), tabindex: "-1", "aria-labelledby": this.titleId, "aria-modal": "true", "aria-hidden": this.hide }, h("article", { class: "mg-modal__dialog" }, h("header", { class: "mg-modal__header" }, this.closeButton && (h("span", { class: "mg-modal__close-button" }, h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" })))), h("h1", { class: "mg-modal__title", id: this.titleId }, this.modalTitle)), this.hasContent && (h("article", { class: "mg-modal__content" }, h("slot", { name: "content" }))), this.hasActions && (h("footer", { class: "mg-modal__footer" }, h("slot", { name: "actions" }))))));
110
+ }
111
+ get element() { return this; }
112
+ static get watchers() { return {
113
+ "hide": ["validateHide"]
114
+ }; }
115
+ static get style() { return mgModalCss; }
116
+ }, [1, "mg-modal", {
117
+ "identifier": [1],
118
+ "modalTitle": [1, "modal-title"],
119
+ "closeButton": [1028, "close-button"],
120
+ "hide": [1028],
121
+ "hasActions": [32],
122
+ "hasContent": [32],
123
+ "classList": [32]
124
+ }, [[8, "keydown", "handleKeyDown"]]]);
125
+ function defineCustomElement$1() {
126
+ if (typeof customElements === "undefined") {
127
+ return;
128
+ }
129
+ const components = ["mg-modal", "mg-button", "mg-icon"];
130
+ components.forEach(tagName => { switch (tagName) {
131
+ case "mg-modal":
132
+ if (!customElements.get(tagName)) {
133
+ customElements.define(tagName, MgModal$1);
134
+ }
135
+ break;
136
+ case "mg-button":
137
+ if (!customElements.get(tagName)) {
138
+ defineCustomElement$3();
139
+ }
140
+ break;
141
+ case "mg-icon":
142
+ if (!customElements.get(tagName)) {
143
+ defineCustomElement$2();
144
+ }
145
+ break;
146
+ } });
147
+ }
148
+ defineCustomElement$1();
149
+
150
+ const MgModal = MgModal$1;
151
+ const defineCustomElement = defineCustomElement$1;
152
+
153
+ export { MgModal, defineCustomElement };
@@ -1,8 +1,7 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
2
  import { c as createID } from './components.utils.js';
3
- import { m as messages } from './index2.js';
4
- import { d as defineCustomElement$7 } from './mg-button2.js';
5
- import { d as defineCustomElement$6 } from './mg-character-left2.js';
3
+ import { i as initLocales } from './index2.js';
4
+ import { d as defineCustomElement$6 } from './mg-button2.js';
6
5
  import { d as defineCustomElement$5 } from './mg-icon2.js';
7
6
  import { d as defineCustomElement$4 } from './mg-input-select2.js';
8
7
  import { d as defineCustomElement$3 } from './mg-input-title2.js';
@@ -14,7 +13,7 @@ var NavigationAction;
14
13
  NavigationAction["PREVIOUS"] = "previous";
15
14
  })(NavigationAction || (NavigationAction = {}));
16
15
 
17
- const mgPaginationCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}.mg-pagination__nav{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}.mg-pagination__nav mg-input-select{margin-right:0.5rem}.mg-pagination__button{display:-ms-flexbox;display:flex}.mg-pagination__button:first-of-type{margin-right:1rem}.mg-pagination__button:last-of-type{margin-left:1rem}";
16
+ const mgPaginationCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}.mg-pagination__nav{display:flex;align-items:center;flex-direction:row}.mg-pagination__nav mg-input-select{margin-right:0.5rem}.mg-pagination__button{display:flex}.mg-pagination__button:first-of-type{margin-right:1rem}.mg-pagination__button:last-of-type{margin-left:1rem}";
18
17
 
19
18
  /**
20
19
  * Range generator
@@ -31,10 +30,10 @@ const mgPaginationCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1
31
30
  * range(1, 5) = [1, 2, 3, 4, 5]
32
31
  * range(10, 20, 2) = [10, 12, 14, 16, 18, 20]
33
32
  *
34
- * @param start
35
- * @param end
36
- * @param step
37
- * @returns {number[]}
33
+ * @param {number} start start range
34
+ * @param {number} end start end
35
+ * @param {number} step step size
36
+ * @returns {number[]} range numbers
38
37
  */
39
38
  const range = (start, end, step = 1) => Array.from(Array(Math.ceil((end + 1 - start) / step)).keys()).map(x => start + x * step);
40
39
  const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
@@ -43,19 +42,11 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
43
42
  this.__registerHost();
44
43
  this.__attachShadow();
45
44
  this.currentPageChange = createEvent(this, "current-page-change", 7);
46
- /**************
47
- * Decorators *
48
- **************/
49
45
  /**
50
46
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
51
47
  * If not set, it will be created.
52
48
  */
53
49
  this.identifier = createID('mg-pagination');
54
- /**
55
- * Panignation label. Is a short description.
56
- * Customize default value can be usefull to improve accessibility
57
- */
58
- this.label = 'pagination';
59
50
  /**
60
51
  * Component total pages
61
52
  */
@@ -66,15 +57,21 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
66
57
  this.currentPage = 1;
67
58
  /**
68
59
  * Change current page from target
69
- * @param target
60
+ *
61
+ * @param {number} target target page
62
+ * @returns {void}
70
63
  */
71
- this.goToPage = (target) => (this.currentPage = target);
64
+ this.goToPage = (target) => {
65
+ this.currentPage = target;
66
+ };
72
67
  /************
73
68
  * Handlers *
74
69
  ************/
75
70
  /**
76
- * Default click handler
77
- * @param event
71
+ * select handler
72
+ *
73
+ * @param {InputEvent} event value change event
74
+ * @returns {void}
78
75
  */
79
76
  this.handleSelect = (event) => {
80
77
  const to = Number(event.target.value);
@@ -82,9 +79,13 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
82
79
  };
83
80
  /**
84
81
  * Go to 'previous/next' page button handler
82
+ *
83
+ * @param {string} action navigation action
85
84
  * @returns {void}
86
85
  */
87
- this.handleGoToPage = (action) => this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
86
+ this.handleGoToPage = (action) => {
87
+ this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
88
+ };
88
89
  }
89
90
  validateTotalPages(newValue) {
90
91
  if (newValue < 1) {
@@ -103,16 +104,34 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
103
104
  /*************
104
105
  * Lifecycle *
105
106
  *************/
107
+ /**
108
+ * Check if props are well configured on init
109
+ *
110
+ * @returns {void}
111
+ */
106
112
  componentWillLoad() {
113
+ // Get locales
114
+ this.messages = initLocales(this.element).messages;
115
+ // Validate
107
116
  this.validateTotalPages(this.totalPages);
108
117
  this.validateCurrentPage(this.currentPage);
118
+ // Set default label
119
+ if (this.label === undefined || this.label === '') {
120
+ this.label = this.messages.pagination.label;
121
+ }
109
122
  }
123
+ /**
124
+ * Render
125
+ *
126
+ * @returns {HTMLElement} HTML Element
127
+ */
110
128
  render() {
111
- const navigationActionButton = (disabled, action) => (h("mg-button", { identifier: `${this.identifier}-button-${action}`, class: "mg-pagination__button", label: messages.pagination[`${action}Page`],
129
+ const navigationActionButton = (disabled, action) => (h("mg-button", { identifier: `${this.identifier}-button-${action}`, class: "mg-pagination__button", label: this.messages.pagination[`${action}Page`],
112
130
  // eslint-disable-next-line react/jsx-no-bind
113
- onClick: () => this.handleGoToPage(action), disabled: disabled, variant: "flat" }, action === NavigationAction.PREVIOUS && h("mg-icon", { icon: "chevron-left" }), messages.pagination[action], action === NavigationAction.NEXT && h("mg-icon", { icon: "chevron-right" })));
114
- return (h("nav", { "aria-label": this.label, id: this.identifier, class: "mg-pagination__nav" }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), h("mg-input-select", { identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true }), h("span", { class: "sr-only" }, messages.pagination.page, " ", this.currentPage), h("span", null, "/ ", this.totalPages, " ", this.totalPages > 1 ? messages.pagination.pages : messages.pagination.pages), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT)));
131
+ onClick: () => this.handleGoToPage(action), disabled: disabled, variant: "flat" }, action === NavigationAction.PREVIOUS && h("mg-icon", { icon: "chevron-left" }), this.messages.general[action], action === NavigationAction.NEXT && h("mg-icon", { icon: "chevron-right" })));
132
+ return (h("nav", { "aria-label": this.label, id: this.identifier, class: "mg-pagination__nav" }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), h("mg-input-select", { identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: this.messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true }), h("span", { class: "sr-only" }, this.messages.pagination.page, " ", this.currentPage), h("span", null, "/ ", this.totalPages, " ", this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT)));
115
133
  }
134
+ get element() { return this; }
116
135
  static get watchers() { return {
117
136
  "totalPages": ["validateTotalPages"],
118
137
  "currentPage": ["validateCurrentPage"]
@@ -120,7 +139,7 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
120
139
  static get style() { return mgPaginationCss; }
121
140
  }, [1, "mg-pagination", {
122
141
  "identifier": [1],
123
- "label": [1],
142
+ "label": [1025],
124
143
  "totalPages": [2, "total-pages"],
125
144
  "currentPage": [1538, "current-page"]
126
145
  }]);
@@ -128,7 +147,7 @@ function defineCustomElement$1() {
128
147
  if (typeof customElements === "undefined") {
129
148
  return;
130
149
  }
131
- const components = ["mg-pagination", "mg-button", "mg-character-left", "mg-icon", "mg-input-select", "mg-input-title", "mg-tooltip"];
150
+ const components = ["mg-pagination", "mg-button", "mg-icon", "mg-input-select", "mg-input-title", "mg-tooltip"];
132
151
  components.forEach(tagName => { switch (tagName) {
133
152
  case "mg-pagination":
134
153
  if (!customElements.get(tagName)) {
@@ -136,11 +155,6 @@ function defineCustomElement$1() {
136
155
  }
137
156
  break;
138
157
  case "mg-button":
139
- if (!customElements.get(tagName)) {
140
- defineCustomElement$7();
141
- }
142
- break;
143
- case "mg-character-left":
144
158
  if (!customElements.get(tagName)) {
145
159
  defineCustomElement$6();
146
160
  }
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface MgPanel extends Components.MgPanel, HTMLElement {}
4
+ export const MgPanel: {
5
+ prototype: MgPanel;
6
+ new (): MgPanel;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;