@mgdis/mg-components 6.20.0 → 6.22.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 (205) hide show
  1. package/dist/cjs/{index-TUElr4Wv.js → index-BxB20_Vw.js} +54 -0
  2. package/dist/cjs/{index-Bp6wZzau.js → index-C2viYwrR.js} +1761 -80
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/mg-action-more_37.cjs.entry.js +761 -371
  5. package/dist/cjs/mg-alert.cjs.entry.js +17 -9
  6. package/dist/cjs/mg-breadcrumb.cjs.entry.js +63 -0
  7. package/dist/cjs/mg-components.cjs.js +3 -3
  8. package/dist/cjs/mg-fieldset.cjs.entry.js +24 -7
  9. package/dist/cjs/mg-input-combobox.cjs.entry.js +49 -19
  10. package/dist/cjs/mg-input-file.cjs.entry.js +384 -0
  11. package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +40096 -15821
  12. package/dist/cjs/{mg-input.conf-D7jmj_lh.js → mg-input.conf-BNpeATnq.js} +7 -0
  13. package/dist/cjs/mg-loader.cjs.entry.js +8 -6
  14. package/dist/cjs/mg-progress.cjs.entry.js +19 -9
  15. package/dist/collection/assets/icons/index.js +1 -1
  16. package/dist/collection/collection-manifest.json +5 -3
  17. package/dist/collection/components/atoms/internals/mg-character-left/mg-character-left.js +1 -1
  18. package/dist/collection/components/atoms/internals/mg-input-title/mg-input-title.js +1 -1
  19. package/dist/collection/components/atoms/mg-card/mg-card.js +1 -1
  20. package/dist/collection/components/atoms/mg-divider/mg-divider.js +1 -1
  21. package/dist/collection/components/atoms/mg-icon/mg-icon.js +2 -2
  22. package/dist/collection/components/atoms/mg-tag/mg-tag.js +1 -1
  23. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +1 -1
  24. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +1 -1
  25. package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +6 -0
  26. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +1 -1
  27. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +2 -2
  28. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +2 -2
  29. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +1 -1
  30. package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +1 -1
  31. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +1 -1
  32. package/dist/collection/components/molecules/inputs/mg-input-file/mg-input-file.js +877 -0
  33. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +1 -1
  34. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +2 -2
  35. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +1 -1
  36. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/custom-properties.scss +212 -0
  37. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/editor.conf.js +1 -0
  38. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/index.js +300 -94
  39. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.conf.js +29 -0
  40. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +163 -53
  41. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +1 -1
  42. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +2 -2
  43. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -1
  44. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +1 -1
  45. package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +3 -36
  46. package/dist/collection/components/molecules/menus/mg-menu/mg-menu.conf.js +0 -4
  47. package/dist/collection/components/molecules/menus/mg-menu/mg-menu.js +21 -43
  48. package/dist/collection/components/molecules/menus/mg-menu-item/mg-menu-item.js +65 -38
  49. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +2 -2
  50. package/dist/collection/components/molecules/mg-alert/mg-alert.js +1 -1
  51. package/dist/collection/components/molecules/mg-breadcrumb/mg-breadcrumb.conf.js +1 -0
  52. package/dist/collection/components/molecules/mg-breadcrumb/mg-breadcrumb.js +92 -0
  53. package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
  54. package/dist/collection/components/molecules/mg-fieldset/mg-fieldset.js +12 -3
  55. package/dist/collection/components/molecules/mg-form/mg-form.js +12 -2
  56. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -1
  57. package/dist/collection/components/molecules/mg-loader/mg-loader.js +1 -1
  58. package/dist/collection/components/molecules/mg-message/mg-message.js +2 -2
  59. package/dist/collection/components/molecules/mg-modal/mg-modal.js +2 -2
  60. package/dist/collection/components/molecules/mg-panel/mg-panel.js +1 -1
  61. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +1 -1
  62. package/dist/collection/components/molecules/mg-popover/mg-popover.js +1 -1
  63. package/dist/collection/components/molecules/mg-progress/mg-progress.js +1 -1
  64. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
  65. package/dist/collection/components/molecules/mg-table/mg-table.js +37 -0
  66. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +0 -4
  67. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +13 -33
  68. package/dist/collection/locales/en/messages.json +14 -0
  69. package/dist/collection/locales/fr/messages.json +14 -0
  70. package/dist/components/events.utils.js +1 -23
  71. package/dist/components/index.d.ts +2 -0
  72. package/dist/components/index.js +1 -1
  73. package/dist/components/index2.js +1 -408
  74. package/dist/components/index3.js +1 -476
  75. package/dist/components/mg-action-more.js +1 -254
  76. package/dist/components/mg-alert.js +1 -224
  77. package/dist/components/mg-badge.js +1 -6
  78. package/dist/components/mg-badge2.js +1 -113
  79. package/dist/components/mg-breadcrumb.d.ts +11 -0
  80. package/dist/components/mg-breadcrumb.js +1 -0
  81. package/dist/components/mg-button.js +1 -6
  82. package/dist/components/mg-button2.js +1 -275
  83. package/dist/components/mg-card.js +1 -6
  84. package/dist/components/mg-card2.js +1 -92
  85. package/dist/components/mg-character-left.js +1 -6
  86. package/dist/components/mg-character-left2.js +1 -75
  87. package/dist/components/mg-details.js +1 -104
  88. package/dist/components/mg-divider.js +1 -6
  89. package/dist/components/mg-divider2.js +1 -49
  90. package/dist/components/mg-fieldset.js +1 -209
  91. package/dist/components/mg-form.js +1 -302
  92. package/dist/components/mg-icon.js +1 -6
  93. package/dist/components/mg-icon2.js +1 -188
  94. package/dist/components/mg-illustrated-message.js +1 -129
  95. package/dist/components/mg-input-checkbox-paginated.js +1 -6
  96. package/dist/components/mg-input-checkbox-paginated2.js +1 -135
  97. package/dist/components/mg-input-checkbox.js +1 -762
  98. package/dist/components/mg-input-combobox.js +1 -940
  99. package/dist/components/mg-input-date.js +1 -463
  100. package/dist/components/mg-input-file.d.ts +11 -0
  101. package/dist/components/mg-input-file.js +1 -0
  102. package/dist/components/mg-input-numeric.js +1 -592
  103. package/dist/components/mg-input-password.js +1 -360
  104. package/dist/components/mg-input-radio.js +1 -392
  105. package/dist/components/mg-input-rich-text-editor.js +1663 -16797
  106. package/dist/components/mg-input-select.js +1 -6
  107. package/dist/components/mg-input-select2.js +1 -481
  108. package/dist/components/mg-input-text.js +1 -6
  109. package/dist/components/mg-input-text2.js +1 -514
  110. package/dist/components/mg-input-textarea.js +1 -412
  111. package/dist/components/mg-input-title.js +1 -6
  112. package/dist/components/mg-input-title2.js +1 -81
  113. package/dist/components/mg-input-toggle.js +1 -371
  114. package/dist/components/mg-input.conf.js +1 -0
  115. package/dist/components/mg-input.js +1 -6
  116. package/dist/components/mg-input2.js +1 -459
  117. package/dist/components/mg-item-more.js +1 -6
  118. package/dist/components/mg-item-more2.js +1 -505
  119. package/dist/components/mg-loader.js +1 -6
  120. package/dist/components/mg-loader2.js +1 -74
  121. package/dist/components/mg-menu-item.js +1 -6
  122. package/dist/components/mg-menu-item2.js +1 -485
  123. package/dist/components/mg-menu.js +1 -6
  124. package/dist/components/mg-message.js +1 -6
  125. package/dist/components/mg-message2.js +1 -146
  126. package/dist/components/mg-modal.js +1 -184
  127. package/dist/components/mg-pagination.js +1 -234
  128. package/dist/components/mg-panel.js +1 -350
  129. package/dist/components/mg-popover-content.js +1 -6
  130. package/dist/components/mg-popover-content2.js +1 -96
  131. package/dist/components/mg-popover.js +1 -6
  132. package/dist/components/mg-popover2.js +1 -312
  133. package/dist/components/mg-progress.js +1 -123
  134. package/dist/components/mg-skip-links.js +1 -78
  135. package/dist/components/mg-table.js +1 -319
  136. package/dist/components/mg-tabs.js +1 -6
  137. package/dist/components/mg-tabs2.js +1 -315
  138. package/dist/components/mg-tag.js +1 -133
  139. package/dist/components/mg-tooltip-content.js +1 -6
  140. package/dist/components/mg-tooltip-content2.js +1 -42
  141. package/dist/components/mg-tooltip.js +1 -6
  142. package/dist/components/mg-tooltip2.js +1 -421
  143. package/dist/components/popper.js +1 -1790
  144. package/dist/esm/{index-BluNKQ3L.js → index-DFwaH2hS.js} +1761 -80
  145. package/dist/esm/{index-CNX6lq0x.js → index-DSEloqPn.js} +54 -1
  146. package/dist/esm/loader.js +3 -3
  147. package/dist/esm/mg-action-more_37.entry.js +761 -371
  148. package/dist/esm/mg-alert.entry.js +17 -9
  149. package/dist/esm/mg-breadcrumb.entry.js +61 -0
  150. package/dist/esm/mg-components.js +4 -4
  151. package/dist/esm/mg-fieldset.entry.js +24 -7
  152. package/dist/esm/mg-input-combobox.entry.js +49 -19
  153. package/dist/esm/mg-input-file.entry.js +382 -0
  154. package/dist/esm/mg-input-rich-text-editor.entry.js +40083 -15808
  155. package/dist/esm/{mg-input.conf-DDnrE1hD.js → mg-input.conf-C9rmNQIL.js} +7 -1
  156. package/dist/esm/mg-loader.entry.js +8 -6
  157. package/dist/esm/mg-progress.entry.js +19 -9
  158. package/dist/mg-components/locales/en/messages.json +14 -0
  159. package/dist/mg-components/locales/fr/messages.json +14 -0
  160. package/dist/mg-components/mg-components.esm.js +1 -1
  161. package/dist/mg-components/p-0482eb9f.entry.js +1 -0
  162. package/dist/mg-components/{p-7132bca1.entry.js → p-2ee92f38.entry.js} +1 -1
  163. package/dist/mg-components/{p-916dfb6d.entry.js → p-3b653226.entry.js} +1 -1
  164. package/dist/mg-components/p-5745fbea.entry.js +1 -0
  165. package/dist/mg-components/p-C9rmNQIL.js +1 -0
  166. package/dist/mg-components/p-DFwaH2hS.js +2 -0
  167. package/dist/mg-components/p-DSEloqPn.js +1 -0
  168. package/dist/mg-components/p-adec7fcc.entry.js +1 -0
  169. package/dist/mg-components/p-c63f97f0.entry.js +1658 -0
  170. package/dist/mg-components/p-c8c8cfc1.entry.js +1 -0
  171. package/dist/mg-components/p-cc793586.entry.js +1 -0
  172. package/dist/mg-components/p-d5e69c95.entry.js +1 -0
  173. package/dist/types/assets/icons/index.d.ts +2 -0
  174. package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +7 -1
  175. package/dist/types/components/molecules/inputs/mg-input-file/mg-input-file.d.ts +210 -0
  176. package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/editor/editor.conf.d.ts +17 -0
  177. package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/editor/index.d.ts +27 -19
  178. package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.conf.d.ts +3 -0
  179. package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.d.ts +50 -16
  180. package/dist/types/components/molecules/internals/mg-item-more/mg-item-more.conf.d.ts +0 -5
  181. package/dist/types/components/molecules/internals/mg-item-more/mg-item-more.d.ts +1 -6
  182. package/dist/types/components/molecules/menus/mg-menu/mg-menu.conf.d.ts +2 -10
  183. package/dist/types/components/molecules/menus/mg-menu/mg-menu.d.ts +7 -7
  184. package/dist/types/components/molecules/menus/mg-menu-item/mg-menu-item.d.ts +12 -8
  185. package/dist/types/components/molecules/mg-breadcrumb/mg-breadcrumb.conf.d.ts +18 -0
  186. package/dist/types/components/molecules/mg-breadcrumb/mg-breadcrumb.d.ts +34 -0
  187. package/dist/types/components/molecules/mg-table/mg-table.d.ts +6 -0
  188. package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +1 -9
  189. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +4 -4
  190. package/dist/types/components.d.ts +302 -46
  191. package/dist/types/stencil-public-runtime.d.ts +76 -12
  192. package/ide/intellij/web-types.json +483 -51
  193. package/ide/vscode/css-custom-data.json +10 -2
  194. package/ide/vscode/html-custom-data.json +445 -104
  195. package/package.json +24 -23
  196. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/editor.scss +0 -1
  197. package/dist/mg-components/p-016bd291.entry.js +0 -1
  198. package/dist/mg-components/p-186a6139.entry.js +0 -1
  199. package/dist/mg-components/p-BluNKQ3L.js +0 -2
  200. package/dist/mg-components/p-CNX6lq0x.js +0 -1
  201. package/dist/mg-components/p-DDnrE1hD.js +0 -1
  202. package/dist/mg-components/p-cd061b38.entry.js +0 -1
  203. package/dist/mg-components/p-d2c72f09.entry.js +0 -1
  204. package/dist/mg-components/p-d5a276eb.entry.js +0 -1
  205. package/ide/vscode/custom.css-data.json +0 -425
@@ -1,6 +1 @@
1
- import { M as MgButton$1, d as defineCustomElement$1 } from './mg-button2.js';
2
-
3
- const MgButton = MgButton$1;
4
- const defineCustomElement = defineCustomElement$1;
5
-
6
- export { MgButton, defineCustomElement };
1
+ import{M as o,d as t}from"./mg-button2.js";const s=o,m=t;export{s as MgButton,m as defineCustomElement}
@@ -1,275 +1 @@
1
- import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
- import { C as ClassList, t as toString, i as isValidString, n as nextTick } from './index2.js';
3
- import { K as Keys } from './events.utils.js';
4
- import { d as defineCustomElement$1 } from './mg-icon2.js';
5
-
6
- /**
7
- * List of all possibles sizes
8
- */
9
- const sizes = ['medium', 'large'];
10
- /**
11
- * List of all possibles variants
12
- */
13
- const variants = ['primary', 'secondary', 'danger', 'danger-alt', 'info', 'flat', 'success', 'link'];
14
-
15
- const mgButtonCss = "/*!\n * @prop --mg-c-button-border-radius: Defines the border radius of the button. The default value is `--mg-b-size-radius`.\n * @prop --mg-c-button-border-top-width: Defines the top border width of the button. Unset by default, fallback on `--mg-b-size-border`.\n * @prop --mg-c-button-border-right-width: Defines the right border width of the button. Unset by default, fallback on `--mg-b-size-border`.\n * @prop --mg-c-button-border-bottom-width: Defines the bottom border width of the button. Unset by default, fallback on `--mg-b-size-border`.\n * @prop --mg-c-button-border-left-width: Defines the left border width of the button. Unset by default, fallback on `--mg-b-size-border`.\n * @prop --mg-c-button-border-radius-top-left: Defines the top left border radius of the button. Unset by default, fallback on `--mg-c-button-border-radius`.\n * @prop --mg-c-button-border-radius-top-right: Defines the top right border radius of the button. Unset by default, fallback on `--mg-c-button-border-radius`.\n * @prop --mg-c-button-border-radius-bottom-right: Defines the bottom right border radius of the button. Unset by default, fallback on `--mg-c-button-border-radius`.\n * @prop --mg-c-button-border-radius-bottom-left: Defines the bottom left border radius of the button. Unset by default, fallback on `--mg-c-button-border-radius`.\n * @prop --mg-c-button-font-weight: Defines the font weight of the button. Unset by default, fallback on `normal`.\n * @prop --mg-c-button-icon-border-radius: Defines the border radius of the button in icon mode. The default value is `--mg-b-size-min-height`.\n */:host{display:inline-block;max-width:100%;vertical-align:middle}:host(:hover) .mg-c-button--flat:not(.mg-c-button--disabled){background:color-mix(in srgb, var(--mg-b-color-dark), transparent 90%)}:host([full-width]){display:block}:host([disabled]),:host([aria-disabled=true]){pointer-events:none}.mg-c-button.mg-c-button--primary{/*!\n * @prop --mg-c-button-color-background-primary: Defines the background color for the primary variant button.\n * @prop --mg-c-button-color-border-primary: Defines the border color for the primary variant button.\n * @prop --mg-c-button-color-gradient-primary: Defines the gradient color for the primary variant button.\n * @prop --mg-c-button-color-text-primary: Defines the font color for the primary variant button.\n */border-color:var(--mg-c-button-color-border-primary);background:linear-gradient(to bottom, var(--mg-c-button-color-background-primary), var(--mg-c-button-color-gradient-primary));color:var(--mg-c-button-color-text-primary)}:host(:hover) .mg-c-button.mg-c-button--primary:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-primary)}.mg-c-button.mg-c-button--secondary{/*!\n * @prop --mg-c-button-color-background-secondary: Defines the background color for the secondary variant button.\n * @prop --mg-c-button-color-border-secondary: Defines the border color for the secondary variant button.\n * @prop --mg-c-button-color-gradient-secondary: Defines the gradient color for the secondary variant button.\n * @prop --mg-c-button-color-text-secondary: Defines the font color for the secondary variant button.\n */border-color:var(--mg-c-button-color-border-secondary);background:linear-gradient(to bottom, var(--mg-c-button-color-background-secondary), var(--mg-c-button-color-gradient-secondary));color:var(--mg-c-button-color-text-secondary)}:host(:hover) .mg-c-button.mg-c-button--secondary:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-secondary)}.mg-c-button.mg-c-button--danger{/*!\n * @prop --mg-c-button-color-background-danger: Defines the background color for the danger variant button.\n * @prop --mg-c-button-color-border-danger: Defines the border color for the danger variant button.\n * @prop --mg-c-button-color-gradient-danger: Defines the gradient color for the danger variant button.\n * @prop --mg-c-button-color-text-danger: Defines the font color for the danger variant button.\n */border-color:var(--mg-c-button-color-border-danger);background:linear-gradient(to bottom, var(--mg-c-button-color-background-danger), var(--mg-c-button-color-gradient-danger));color:var(--mg-c-button-color-text-danger)}:host(:hover) .mg-c-button.mg-c-button--danger:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-danger)}.mg-c-button.mg-c-button--info{/*!\n * @prop --mg-c-button-color-background-info: Defines the background color for the info variant button.\n * @prop --mg-c-button-color-border-info: Defines the border color for the info variant button.\n * @prop --mg-c-button-color-gradient-info: Defines the gradient color for the info variant button.\n * @prop --mg-c-button-color-text-info: Defines the font color for the info variant button.\n */border-color:var(--mg-c-button-color-border-info);background:linear-gradient(to bottom, var(--mg-c-button-color-background-info), var(--mg-c-button-color-gradient-info));color:var(--mg-c-button-color-text-info)}:host(:hover) .mg-c-button.mg-c-button--info:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-info)}.mg-c-button.mg-c-button--success{/*!\n * @prop --mg-c-button-color-background-success: Defines the background color for the success variant button.\n * @prop --mg-c-button-color-border-success: Defines the border color for the success variant button.\n * @prop --mg-c-button-color-gradient-success: Defines the gradient color for the success variant button.\n * @prop --mg-c-button-color-text-success: Defines the font color for the success variant button.\n */border-color:var(--mg-c-button-color-border-success);background:linear-gradient(to bottom, var(--mg-c-button-color-background-success), var(--mg-c-button-color-gradient-success));color:var(--mg-c-button-color-text-success)}:host(:hover) .mg-c-button.mg-c-button--success:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-success)}.mg-c-button.mg-c-button--warning{/*!\n * @prop --mg-c-button-color-background-warning: Defines the background color for the warning variant button.\n * @prop --mg-c-button-color-border-warning: Defines the border color for the warning variant button.\n * @prop --mg-c-button-color-gradient-warning: Defines the gradient color for the warning variant button.\n * @prop --mg-c-button-color-text-warning: Defines the font color for the warning variant button.\n */border-color:var(--mg-c-button-color-border-warning);background:linear-gradient(to bottom, var(--mg-c-button-color-background-warning), var(--mg-c-button-color-gradient-warning));color:var(--mg-c-button-color-text-warning)}:host(:hover) .mg-c-button.mg-c-button--warning:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-warning)}.mg-c-button.mg-c-button--danger-alt{/*!\n * @prop --mg-c-button-color-background-danger-alt: Defines the background color for the danger-alt variant button.\n * @prop --mg-c-button-color-border-danger-alt: Defines the border color for the danger-alt variant button.\n * @prop --mg-c-button-color-gradient-danger-alt: Defines the gradient color for the danger-alt variant button.\n * @prop --mg-c-button-color-text-danger-alt: Defines the font color for the danger-alt variant button.\n */border-color:var(--mg-c-button-color-border-danger-alt);background:linear-gradient(to bottom, var(--mg-c-button-color-background-danger-alt), var(--mg-c-button-color-gradient-danger-alt));color:var(--mg-c-button-color-text-danger-alt)}:host(:hover) .mg-c-button.mg-c-button--danger-alt:not(.mg-c-button--disabled){background:var(--mg-c-button-color-background-danger-alt)}.mg-c-button{position:relative;display:inline-flex;min-height:var(--mg-b-size-min-height);box-sizing:border-box;align-items:center;padding:calc((var(--mg-b-size-min-height) - 2*var(--mg-b-size-border) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-12);border-width:var(--mg-c-button-border-top-width, var(--mg-b-size-border)) var(--mg-c-button-border-right-width, var(--mg-b-size-border)) var(--mg-c-button-border-bottom-width, var(--mg-b-size-border)) var(--mg-c-button-border-left-width, var(--mg-b-size-border));border-style:solid;border-radius:var(--mg-c-button-border-radius-top-left, var(--mg-c-button-border-radius)) var(--mg-c-button-border-radius-top-right, var(--mg-c-button-border-radius)) var(--mg-c-button-border-radius-bottom-right, var(--mg-c-button-border-radius)) var(--mg-c-button-border-radius-bottom-left, var(--mg-c-button-border-radius));background-image:none;column-gap:var(--mg-b-size-8);cursor:pointer;touch-action:manipulation;font-family:inherit;font-size:var(--mg-b-font-size);font-weight:var(--mg-c-button-font-weight, normal);text-align:left;text-decoration:none}.mg-c-button slot,.mg-c-button ::slotted(*:not(mg-icon)){font-family:inherit;font-size:var(--mg-b-font-size);font-weight:var(--mg-c-button-font-weight, normal);text-align:left;text-decoration:none;display:flex;align-items:center;column-gap:var(--mg-b-size-8)}.mg-c-button mg-icon:only-child,.mg-c-button ::slotted(mg-icon){display:inline-flex;flex-shrink:0;margin:auto 0;line-height:1}.mg-c-button.mg-c-button--disabled{cursor:default;opacity:var(--mg-b-opacity-element-disabled)}.mg-c-button.mg-c-button--flat{border:none;background:none}.mg-c-button.mg-c-button--link{min-height:unset;padding:unset;border:unset;border-radius:unset;background:unset;text-decoration:underline}.mg-c-button.mg-c-button--link slot{font-weight:600}.mg-c-button.mg-c-button--link:hover{text-decoration:none}.mg-c-button.mg-c-button--large{padding:calc(var(--mg-b-size-12) - var(--mg-b-size-border)) calc(var(--mg-b-size-24) - var(--mg-b-size-border))}.mg-c-button.mg-c-button--large:not(.mg-c-button--icon){line-height:var(--mg-b-size-24)}.mg-c-button.mg-c-button--large:not(.mg-c-button--icon) slot,.mg-c-button.mg-c-button--large:not(.mg-c-button--icon) ::slotted(*){font-size:var(--mg-b-size-16)}.mg-c-button.mg-c-button--icon{width:var(--mg-b-size-min-height);height:var(--mg-b-size-min-height);justify-content:center;padding:0;border-radius:var(--mg-c-button-border-radius-top-left, var(--mg-c-button-icon-border-radius)) var(--mg-c-button-border-radius-top-right, var(--mg-c-button-icon-border-radius)) var(--mg-c-button-border-radius-bottom-right, var(--mg-c-button-icon-border-radius)) var(--mg-c-button-border-radius-bottom-left, var(--mg-c-button-icon-border-radius));font-size:var(--mg-b-font-size);line-height:var(--mg-b-font-size)}.mg-c-button.mg-c-button--icon.mg-c-button--large{width:unset;height:unset;padding:calc(var(--mg-b-size-12) - var(--mg-b-size-border))}.mg-c-button.mg-c-button--icon.mg-c-button--large ::slotted(*){min-width:var(--mg-b-size-24);min-height:var(--mg-b-size-24);align-items:center;justify-content:center}.mg-c-button.mg-c-button--full-width{display:flex;justify-content:center}.mg-c-button.mg-c-button--loading>mg-icon:first-of-type{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.mg-c-button.mg-c-button--loading .mg-c-button__content{opacity:0}:host(:focus-visible){outline:0}:host(:focus-visible) .mg-c-button{outline-color:-webkit-focus-ring-color;outline-style:auto;outline-width:.2rem}";
16
-
17
- const MgButton = /*@__PURE__*/ proxyCustomElement(class MgButton extends HTMLElement {
18
- constructor(registerHost) {
19
- super();
20
- if (registerHost !== false) {
21
- this.__registerHost();
22
- }
23
- this.__attachShadow();
24
- this.disabledChange = createEvent(this, "disabled-change", 7);
25
- /************
26
- * Internal *
27
- ************/
28
- this.onClickElementFn = null;
29
- this.classDisabled = 'mg-c-button--disabled';
30
- this.classLoading = 'mg-c-button--loading';
31
- this.classFullWidth = 'mg-c-button--full-width';
32
- /**
33
- * Define button variant
34
- */
35
- this.variant = 'primary';
36
- /**
37
- * Define button size
38
- */
39
- this.size = 'medium';
40
- /**
41
- * Set button to full-width
42
- */
43
- this.fullWidth = false;
44
- /**
45
- * Define if button is round.
46
- * Used for icon button.
47
- */
48
- this.isIcon = false;
49
- /**
50
- * Option to set input disable on click, in order to prevent multi-click.
51
- * Parent component have to remove the attribute 'disabled' when the process ends.
52
- */
53
- this.disableOnClick = false;
54
- /**
55
- * Define if button is loading, default to false.
56
- * Trigger when button is clicked or key-up ['enter', 'space], then value change to true.
57
- * It's required to reset to false when action/promise in parent is done to stop the loading state
58
- */
59
- this.loading = false;
60
- /**
61
- * Component classes
62
- */
63
- this.classCollection = new ClassList(['mg-c-button']);
64
- /**
65
- * Trigger actions onClick event
66
- * @param event - click event
67
- */
68
- this.handleClick = (event) => {
69
- if (this.disabled)
70
- event.stopPropagation();
71
- // Used to prevent multi-click.
72
- else if (this.disableOnClick) {
73
- this.loading = true;
74
- this.disabled = true;
75
- }
76
- };
77
- /**
78
- * Handle onKeydown event
79
- * @param event - keyboard event
80
- */
81
- this.handleKeydown = (event) => {
82
- if (!this.disabled && event.key === ' ') {
83
- event.preventDefault();
84
- }
85
- else if (!this.disabled && [Keys.ENTER, Keys.NUMPADENTER, Keys.SPACE].includes(event.key)) {
86
- event.preventDefault();
87
- this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));
88
- }
89
- };
90
- /**
91
- * Handle onKeyup event
92
- * @param event - keyboard event
93
- */
94
- this.handleKeyup = (event) => {
95
- if (!this.disabled && event.key === ' ') {
96
- event.preventDefault();
97
- this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));
98
- }
99
- };
100
- /**
101
- * Set child `<mg-icon>` element `size` prop to follow the current `size` prop
102
- */
103
- this.setIconSize = () => {
104
- var _a, _b;
105
- if (this.size === 'medium') {
106
- (_a = this.element.querySelector('mg-icon[size]')) === null || _a === void 0 ? void 0 : _a.removeAttribute('size');
107
- }
108
- else if (this.isIcon) {
109
- (_b = this.element.querySelector('mg-icon')) === null || _b === void 0 ? void 0 : _b.setAttribute('size', this.size);
110
- }
111
- };
112
- }
113
- validateVariant(newValue, oldValue) {
114
- // validate new value
115
- if (!variants.includes(newValue)) {
116
- if (newValue === '') {
117
- // Reactive framework like VUE render with `""` when prop is update to undefined
118
- this.variant = variants[0];
119
- return;
120
- }
121
- throw new Error(`<mg-button> prop "variant" must be one of: ${variants.join(', ')}. Passed value: ${toString(newValue)}.`);
122
- }
123
- else {
124
- if (oldValue !== undefined) {
125
- this.classCollection.delete(`mg-c-button--${oldValue}`);
126
- }
127
- this.classCollection.add(`mg-c-button--${newValue}`);
128
- }
129
- }
130
- validateSize(newValue, oldValue) {
131
- // validate new value
132
- if (!sizes.includes(newValue)) {
133
- throw new Error(`<mg-button> prop "size" must be one of: ${sizes.join(', ')}. Passed value: ${toString(newValue)}.`);
134
- }
135
- else {
136
- if (oldValue !== undefined) {
137
- this.classCollection.delete(`mg-c-button--${oldValue}`);
138
- }
139
- this.classCollection.add(`mg-c-button--${newValue}`);
140
- this.setIconSize();
141
- }
142
- }
143
- validateFullWidth(newValue) {
144
- if (newValue && this.isIcon) {
145
- throw new Error('<mg-button> prop "fullWidth" cannot be used with prop "isIcon".');
146
- }
147
- else if (newValue) {
148
- this.classCollection.add(this.classFullWidth);
149
- }
150
- else {
151
- this.classCollection.delete(this.classFullWidth);
152
- }
153
- }
154
- disabledHandler(isDisabled) {
155
- // Remove loading when enable
156
- // Will be set back onclick
157
- if (!isDisabled && this.disableOnClick) {
158
- this.loading = false;
159
- }
160
- // Manage if onclick
161
- this.element.onclick = isDisabled ? undefined : this.onClickElementFn;
162
- // apply style
163
- if (isDisabled) {
164
- this.classCollection.add(this.classDisabled);
165
- }
166
- else {
167
- this.classCollection.delete(this.classDisabled);
168
- }
169
- // emit value update
170
- this.disabledChange.emit(isDisabled);
171
- }
172
- watchIsIcon(newValue) {
173
- if (newValue) {
174
- this.classCollection.add(`mg-c-button--icon`);
175
- if (!isValidString(this.label)) {
176
- throw new Error(`<mg-button> prop "label" is mandatory when prop "isIcon" is set to true.`);
177
- }
178
- }
179
- this.setIconSize();
180
- }
181
- loadingHandler(newValue) {
182
- // we add loading style if it newvalue is true else we remove it
183
- if (newValue) {
184
- this.classCollection.add(this.classLoading);
185
- }
186
- else {
187
- this.classCollection.delete(this.classLoading);
188
- }
189
- }
190
- /**
191
- * Check if props are well configured on init
192
- */
193
- componentWillLoad() {
194
- this.validateVariant(this.variant);
195
- this.validateFullWidth(this.fullWidth);
196
- this.validateSize(this.size);
197
- this.watchIsIcon(this.isIcon);
198
- // Store the onclick fn
199
- this.onClickElementFn = this.element.onclick;
200
- this.disabledHandler(this.disabled);
201
- }
202
- /**
203
- * Add listners
204
- */
205
- componentDidLoad() {
206
- nextTick(() => {
207
- var _a;
208
- const closestForm = this.element.closest('form') || ((_a = this.element.closest('mg-form')) === null || _a === void 0 ? void 0 : _a.shadowRoot.querySelector('form'));
209
- // submit buttons should trigger form submition;
210
- if (closestForm && ['submit', undefined].includes(this.type)) {
211
- this.element.addEventListener('click', () => {
212
- closestForm.dispatchEvent(new SubmitEvent('submit', { bubbles: true, cancelable: true }));
213
- });
214
- }
215
- });
216
- }
217
- /**
218
- * Render component
219
- * @returns html element
220
- */
221
- render() {
222
- var _a;
223
- return (h(Host, { key: '82e03b7b699a821125d066a5ca1d435a87a75675', role: "button", tabIndex: this.element.getAttribute('tabindex') || 0, type: this.type, form: this.form, "full-width": this.fullWidth, "aria-label": this.label, "aria-disabled": (_a = this.disabled) === null || _a === void 0 ? void 0 : _a.toString(), onClick: this.handleClick, onKeyup: this.handleKeyup, onKeydown: this.handleKeydown }, h("div", { key: '92a0a1fbcf320f8afc10106418a992fffd748646', class: this.classCollection.join() }, this.loading && h("mg-icon", { key: 'f5d0bf31534c2dc8dbd7f9e2fc63bd8af055a9a3', icon: "loader", spin: true }), h("div", { key: '7557988a9a70881f25c86b78a3ea28d9842c439b', class: "mg-c-button__content" }, h("slot", { key: '98b64ef7efc4d761fdda8c593b05ec6959b0ea22' })))));
224
- }
225
- get element() { return this; }
226
- static get watchers() { return {
227
- "variant": ["validateVariant"],
228
- "size": ["validateSize"],
229
- "fullWidth": ["validateFullWidth"],
230
- "disabled": ["disabledHandler"],
231
- "isIcon": ["watchIsIcon"],
232
- "loading": ["loadingHandler"]
233
- }; }
234
- static get style() { return mgButtonCss; }
235
- }, [257, "mg-button", {
236
- "variant": [1025],
237
- "label": [1],
238
- "type": [1],
239
- "size": [1],
240
- "fullWidth": [4, "full-width"],
241
- "form": [1],
242
- "disabled": [1028],
243
- "isIcon": [4, "is-icon"],
244
- "disableOnClick": [4, "disable-on-click"],
245
- "loading": [32],
246
- "classCollection": [32]
247
- }, undefined, {
248
- "variant": ["validateVariant"],
249
- "size": ["validateSize"],
250
- "fullWidth": ["validateFullWidth"],
251
- "disabled": ["disabledHandler"],
252
- "isIcon": ["watchIsIcon"],
253
- "loading": ["loadingHandler"]
254
- }]);
255
- function defineCustomElement() {
256
- if (typeof customElements === "undefined") {
257
- return;
258
- }
259
- const components = ["mg-button", "mg-icon"];
260
- components.forEach(tagName => { switch (tagName) {
261
- case "mg-button":
262
- if (!customElements.get(tagName)) {
263
- customElements.define(tagName, MgButton);
264
- }
265
- break;
266
- case "mg-icon":
267
- if (!customElements.get(tagName)) {
268
- defineCustomElement$1();
269
- }
270
- break;
271
- } });
272
- }
273
- defineCustomElement();
274
-
275
- export { MgButton as M, defineCustomElement as d };
1
+ import{transformTag as t,proxyCustomElement as o,HTMLElement as n,createEvent as r,h as i,Host as e}from"@stencil/core/internal/client";import{C as a,t as c,i as b,n as s}from"./index2.js";import{K as d}from"./events.utils.js";import{d as g}from"./mg-icon2.js";const u=["medium","large"],m=["primary","secondary","danger","danger-alt","info","flat","success","link"],l=o(class extends n{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.disabledChange=r(this,"disabled-change",7),this.onClickElementFn=null,this.classDisabled="mg-c-button--disabled",this.classLoading="mg-c-button--loading",this.classFullWidth="mg-c-button--full-width",this.variant="primary",this.size="medium",this.fullWidth=!1,this.isIcon=!1,this.disableOnClick=!1,this.loading=!1,this.classCollection=new a(["mg-c-button"]),this.handleClick=t=>{this.disabled?t.stopPropagation():this.disableOnClick&&(this.loading=!0,this.disabled=!0)},this.handleKeydown=t=>{this.disabled||" "!==t.key?!this.disabled&&[d.ENTER,d.NUMPADENTER,d.SPACE].includes(t.key)&&(t.preventDefault(),this.element.dispatchEvent(new MouseEvent("click",{bubbles:!0}))):t.preventDefault()},this.handleKeyup=t=>{this.disabled||" "!==t.key||(t.preventDefault(),this.element.dispatchEvent(new MouseEvent("click",{bubbles:!0})))},this.setIconSize=()=>{var t,o;"medium"===this.size?null===(t=this.element.querySelector("mg-icon[size]"))||void 0===t||t.removeAttribute("size"):this.isIcon&&(null===(o=this.element.querySelector("mg-icon"))||void 0===o||o.setAttribute("size",this.size))}}validateVariant(t,o){if(!m.includes(t)){if(""===t)return void(this.variant=m[0]);throw new Error(`<mg-button> prop "variant" must be one of: ${m.join(", ")}. Passed value: ${c(t)}.`)}void 0!==o&&this.classCollection.delete(`mg-c-button--${o}`),this.classCollection.add(`mg-c-button--${t}`)}validateSize(t,o){if(!u.includes(t))throw new Error(`<mg-button> prop "size" must be one of: ${u.join(", ")}. Passed value: ${c(t)}.`);void 0!==o&&this.classCollection.delete(`mg-c-button--${o}`),this.classCollection.add(`mg-c-button--${t}`),this.setIconSize()}validateFullWidth(t){if(t&&this.isIcon)throw new Error('<mg-button> prop "fullWidth" cannot be used with prop "isIcon".');t?this.classCollection.add(this.classFullWidth):this.classCollection.delete(this.classFullWidth)}disabledHandler(t){!t&&this.disableOnClick&&(this.loading=!1),this.element.onclick=t?void 0:this.onClickElementFn,t?this.classCollection.add(this.classDisabled):this.classCollection.delete(this.classDisabled),this.disabledChange.emit(t)}watchIsIcon(t){if(t&&(this.classCollection.add("mg-c-button--icon"),!b(this.label)))throw new Error('<mg-button> prop "label" is mandatory when prop "isIcon" is set to true.');this.setIconSize()}loadingHandler(t){t?this.classCollection.add(this.classLoading):this.classCollection.delete(this.classLoading)}componentWillLoad(){this.validateVariant(this.variant),this.validateFullWidth(this.fullWidth),this.validateSize(this.size),this.watchIsIcon(this.isIcon),this.onClickElementFn=this.element.onclick,this.disabledHandler(this.disabled)}componentDidLoad(){s((()=>{var t;const o=this.element.closest("form")||(null===(t=this.element.closest("mg-form"))||void 0===t?void 0:t.shadowRoot.querySelector("form"));o&&["submit",void 0].includes(this.type)&&this.element.addEventListener("click",(()=>{o.dispatchEvent(new SubmitEvent("submit",{bubbles:!0,cancelable:!0}))}))}))}render(){var t;return i(e,{key:"82e03b7b699a821125d066a5ca1d435a87a75675",role:"button",tabIndex:this.element.getAttribute("tabindex")||0,type:this.type,form:this.form,"full-width":this.fullWidth,"aria-label":this.label,"aria-disabled":null===(t=this.disabled)||void 0===t?void 0:t.toString(),onClick:this.handleClick,onKeyup:this.handleKeyup,onKeydown:this.handleKeydown},i("div",{key:"92a0a1fbcf320f8afc10106418a992fffd748646",class:this.classCollection.join()},this.loading&&i("mg-icon",{key:"f5d0bf31534c2dc8dbd7f9e2fc63bd8af055a9a3",icon:"loader",spin:!0}),i("div",{key:"7557988a9a70881f25c86b78a3ea28d9842c439b",class:"mg-c-button__content"},i("slot",{key:"98b64ef7efc4d761fdda8c593b05ec6959b0ea22"}))))}get element(){return this}static get watchers(){return{variant:[{validateVariant:0}],size:[{validateSize:0}],fullWidth:[{validateFullWidth:0}],disabled:[{disabledHandler:0}],isIcon:[{watchIsIcon:0}],loading:[{loadingHandler:0}]}}static get style(){return":host{display:inline-block;max-width:100%;vertical-align:middle}:host(:hover) .mg-c-button--flat:not(.mg-c-button--disabled){background:color-mix(in srgb, var(--mg-b-color-dark), transparent 90%)}:host([full-width]){display:block}:host([disabled]),:host([aria-disabled=true]){pointer-events:none}.mg-c-button.mg-c-button--primary{border-color:var(--mg-c-button-color-border-primary);background:linear-gradient(to bottom, var(--mg-c-button-color-background-primary), var(--mg-c-button-color-gradient-primary));color:var(--mg-c-button-color-text-primary)}:host(:hover) .mg-c-button.mg-c-button--primary:not(.mg-c-button--disabled),.mg-c-button.mg-c-button--primary:hover:not(.mg-c-button--disabled,:disabled,[aria-disabled=true]){background:var(--mg-c-button-color-background-primary)}.mg-c-button.mg-c-button--secondary{border-color:var(--mg-c-button-color-border-secondary);background:linear-gradient(to bottom, var(--mg-c-button-color-background-secondary), var(--mg-c-button-color-gradient-secondary));color:var(--mg-c-button-color-text-secondary)}:host(:hover) .mg-c-button.mg-c-button--secondary:not(.mg-c-button--disabled),.mg-c-button.mg-c-button--secondary:hover:not(.mg-c-button--disabled,:disabled,[aria-disabled=true]){background:var(--mg-c-button-color-background-secondary)}.mg-c-button.mg-c-button--danger{border-color:var(--mg-c-button-color-border-danger);background:linear-gradient(to bottom, var(--mg-c-button-color-background-danger), var(--mg-c-button-color-gradient-danger));color:var(--mg-c-button-color-text-danger)}:host(:hover) .mg-c-button.mg-c-button--danger:not(.mg-c-button--disabled),.mg-c-button.mg-c-button--danger:hover:not(.mg-c-button--disabled,:disabled,[aria-disabled=true]){background:var(--mg-c-button-color-background-danger)}.mg-c-button.mg-c-button--info{border-color:var(--mg-c-button-color-border-info);background:linear-gradient(to bottom, var(--mg-c-button-color-background-info), var(--mg-c-button-color-gradient-info));color:var(--mg-c-button-color-text-info)}:host(:hover) .mg-c-button.mg-c-button--info:not(.mg-c-button--disabled),.mg-c-button.mg-c-button--info:hover:not(.mg-c-button--disabled,:disabled,[aria-disabled=true]){background:var(--mg-c-button-color-background-info)}.mg-c-button.mg-c-button--success{border-color:var(--mg-c-button-color-border-success);background:linear-gradient(to bottom, var(--mg-c-button-color-background-success), var(--mg-c-button-color-gradient-success));color:var(--mg-c-button-color-text-success)}:host(:hover) .mg-c-button.mg-c-button--success:not(.mg-c-button--disabled),.mg-c-button.mg-c-button--success:hover:not(.mg-c-button--disabled,:disabled,[aria-disabled=true]){background:var(--mg-c-button-color-background-success)}.mg-c-button.mg-c-button--warning{border-color:var(--mg-c-button-color-border-warning);background:linear-gradient(to bottom, var(--mg-c-button-color-background-warning), var(--mg-c-button-color-gradient-warning));color:var(--mg-c-button-color-text-warning)}:host(:hover) .mg-c-button.mg-c-button--warning:not(.mg-c-button--disabled),.mg-c-button.mg-c-button--warning:hover:not(.mg-c-button--disabled,:disabled,[aria-disabled=true]){background:var(--mg-c-button-color-background-warning)}.mg-c-button.mg-c-button--danger-alt{border-color:var(--mg-c-button-color-border-danger-alt);background:linear-gradient(to bottom, var(--mg-c-button-color-background-danger-alt), var(--mg-c-button-color-gradient-danger-alt));color:var(--mg-c-button-color-text-danger-alt)}:host(:hover) .mg-c-button.mg-c-button--danger-alt:not(.mg-c-button--disabled),.mg-c-button.mg-c-button--danger-alt:hover:not(.mg-c-button--disabled,:disabled,[aria-disabled=true]){background:var(--mg-c-button-color-background-danger-alt)}.mg-c-button{position:relative;display:inline-flex;min-height:var(--mg-b-size-min-height);box-sizing:border-box;align-items:center;padding:calc((var(--mg-b-size-min-height) - 2*var(--mg-b-size-border) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-12);border-width:var(--mg-c-button-border-top-width, var(--mg-b-size-border)) var(--mg-c-button-border-right-width, var(--mg-b-size-border)) var(--mg-c-button-border-bottom-width, var(--mg-b-size-border)) var(--mg-c-button-border-left-width, var(--mg-b-size-border));border-style:solid;border-radius:var(--mg-c-button-border-radius-top-left, var(--mg-c-button-border-radius)) var(--mg-c-button-border-radius-top-right, var(--mg-c-button-border-radius)) var(--mg-c-button-border-radius-bottom-right, var(--mg-c-button-border-radius)) var(--mg-c-button-border-radius-bottom-left, var(--mg-c-button-border-radius));background-image:none;column-gap:var(--mg-b-size-8);cursor:pointer;touch-action:manipulation;font-family:inherit;font-size:var(--mg-b-font-size);font-weight:var(--mg-c-button-font-weight, normal);text-align:left;text-decoration:none}.mg-c-button slot,.mg-c-button ::slotted(*:not(mg-icon)){font-family:inherit;font-size:var(--mg-b-font-size);font-weight:var(--mg-c-button-font-weight, normal);text-align:left;text-decoration:none;display:flex;align-items:center;column-gap:var(--mg-b-size-8)}.mg-c-button mg-icon:only-child,.mg-c-button ::slotted(mg-icon){display:inline-flex;flex-shrink:0;margin:auto 0;line-height:1}.mg-c-button.mg-c-button--disabled,.mg-c-button[aria-disabled=true],.mg-c-button:disabled{cursor:default;opacity:var(--mg-b-opacity-element-disabled)}.mg-c-button.mg-c-button--flat{border:none;background:none}.mg-c-button.mg-c-button--link{min-height:unset;padding:unset;border:unset;border-radius:unset;background:unset;text-decoration:underline}.mg-c-button.mg-c-button--link slot{font-weight:600}.mg-c-button.mg-c-button--link:hover{text-decoration:none}.mg-c-button.mg-c-button--large{padding:calc(var(--mg-b-size-12) - var(--mg-b-size-border)) calc(var(--mg-b-size-24) - var(--mg-b-size-border))}.mg-c-button.mg-c-button--large:not(.mg-c-button--icon){line-height:var(--mg-b-size-24)}.mg-c-button.mg-c-button--large:not(.mg-c-button--icon) slot,.mg-c-button.mg-c-button--large:not(.mg-c-button--icon) ::slotted(*){font-size:var(--mg-b-size-16)}.mg-c-button.mg-c-button--icon{width:var(--mg-b-size-min-height);height:var(--mg-b-size-min-height);justify-content:center;padding:0;border-radius:var(--mg-c-button-border-radius-top-left, var(--mg-c-button-icon-border-radius)) var(--mg-c-button-border-radius-top-right, var(--mg-c-button-icon-border-radius)) var(--mg-c-button-border-radius-bottom-right, var(--mg-c-button-icon-border-radius)) var(--mg-c-button-border-radius-bottom-left, var(--mg-c-button-icon-border-radius));font-size:var(--mg-b-font-size);line-height:var(--mg-b-font-size)}.mg-c-button.mg-c-button--icon.mg-c-button--large{width:unset;height:unset;padding:calc(var(--mg-b-size-12) - var(--mg-b-size-border))}.mg-c-button.mg-c-button--icon.mg-c-button--large ::slotted(*){min-width:var(--mg-b-size-24);min-height:var(--mg-b-size-24);align-items:center;justify-content:center}.mg-c-button.mg-c-button--full-width{display:flex;width:100%;justify-content:center}.mg-c-button.mg-c-button--loading>mg-icon:first-of-type{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.mg-c-button.mg-c-button--loading .mg-c-button__content{opacity:0}:host(:focus-visible),:host([data-focus-visible]){outline:0}:host(:focus-visible) .mg-c-button,:host([data-focus-visible]) .mg-c-button{outline-color:-webkit-focus-ring-color;outline-style:auto;outline-width:.2rem}"}},[257,"mg-button",{variant:[1025],label:[1],type:[1],size:[1],fullWidth:[4,"full-width"],form:[1],disabled:[1028],isIcon:[4,"is-icon"],disableOnClick:[4,"disable-on-click"],loading:[32],classCollection:[32]},void 0,{variant:[{validateVariant:0}],size:[{validateSize:0}],fullWidth:[{validateFullWidth:0}],disabled:[{disabledHandler:0}],isIcon:[{watchIsIcon:0}],loading:[{loadingHandler:0}]}]);function h(){"undefined"!=typeof customElements&&["mg-button","mg-icon"].forEach((o=>{switch(o){case"mg-button":customElements.get(t(o))||customElements.define(t(o),l);break;case"mg-icon":customElements.get(t(o))||g()}}))}h();export{l as M,h as d}
@@ -1,6 +1 @@
1
- import { M as MgCard$1, d as defineCustomElement$1 } from './mg-card2.js';
2
-
3
- const MgCard = MgCard$1;
4
- const defineCustomElement = defineCustomElement$1;
5
-
6
- export { MgCard, defineCustomElement };
1
+ import{M as o,d as r}from"./mg-card2.js";const s=o,a=r;export{s as MgCard,a as defineCustomElement}
@@ -1,92 +1 @@
1
- import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
- import { C as ClassList } from './index2.js';
3
-
4
- /**
5
- * List of all possibles radius size
6
- */
7
- const radiusSizes = ['xsmall', 'small', 'medium'];
8
-
9
- const mgCardCss = "/*!\n * @prop --mg-c-card-overflow: Defines the overflow property for the card. Unset by default, fallback on `--mg-c-card-overflow-default`.\n * @prop --mg-c-card-overflow-default: Defines the default overflow property for the card. Unset by default.\n * @prop --mg-c-card-min-width: Defines the min-width property for the card. Unset by default.\n * @prop --mg-c-card-max-width: Defines the max-width property for the card. Unset by default.\n * @prop --mg-c-card-max-height: Defines the max-height property for the card. Unset by default.\n * @prop --mg-c-card-spacing: Defines the padding property for the card. Unset by default, fallback on `--mg-c-card-spacing-default`.\n * @prop --mg-c-card-spacing-default: Defines the default padding property for the card. Default value: `--mg-b-size-16`.\n * @prop --mg-c-card-border: Defines the border property for the card. Unset by default, fallback on `--mg-c-card-border-default`.\n * @prop --mg-c-card-border-default: Defines the default border property for the card. Default value: `var(--mg-b-size-border) solid var(--mg-b-color-neutral-30)`.\n * @prop --mg-c-card-border-radius: Defines the border radius property for the card. Unset by default, fallback on `--mg-c-card-border-radius-default`.\n * @prop --mg-c-card-border-radius-default: Defines the default border radius property for the card. Default value: `--mg-b-size-12`.\n * @prop --mg-c-card-color-background: Defines the background property for the card. Unset by default, fallback on `--mg-c-card-color-background-default`.\n * @prop --mg-c-card-color-background-default: Defines the default background property for the card. Default value: `--mg-b-color-light`.\n * @prop --mg-c-card-box-shadow: Defines the box shadow property for the card. Unset by default, fallback on `--mg-c-card-box-shadow-default`.\n * @prop --mg-c-card-box-shadow-default: Defines the default box shadow property for the card. Default value: `--mg-b-box-shadow`.\n */.mg-c-card{position:relative;z-index:inherit;overflow:var(--mg-c-card-overflow, var(--mg-c-card-overflow-default));width:100%;min-width:var(--mg-c-card-min-width);max-width:var(--mg-c-card-max-width);max-height:var(--mg-c-card-max-height);box-sizing:border-box;padding:var(--mg-c-card-spacing, var(--mg-c-card-spacing-default));border:var(--mg-c-card-border, var(--mg-c-card-border-default));border-radius:var(--mg-c-card-border-radius, var(--mg-c-card-border-radius-default));background:var(--mg-c-card-color-background, var(--mg-c-card-color-background-default))}.mg-c-card ::slotted(*:not(mg-panel,mg-message,mg-modal)){--mg-c-card-border:var(--mg-c-card-border-default);--mg-c-card-spacing:var(--mg-c-card-spacing-default);--mg-c-card-border-radius:var(--mg-c-card-border-radius-default);--mg-c-card-color-background:var(--mg-c-card-color-background-default);--mg-c-card-box-shadow:var(--mg-c-card-box-shadow-default);--mg-c-card-max-width:unset;--mg-c-card-min-width:unset;--mg-c-card-max-height:unset;--mg-c-card-overflow:var(--mg-c-card-overflow-default)}.mg-c-card.mg-c-card--shadow{--mg-c-card-border:var(--mg-b-color-neutral-20);box-shadow:var(--mg-c-card-box-shadow, var(--mg-c-card-box-shadow-default))}.mg-c-card.mg-c-card--radius-xsmall{--mg-c-card-border-radius:var(--mg-b-size-4)}.mg-c-card.mg-c-card--radius-small{--mg-c-card-border-radius:var(--mg-b-size-8)}";
10
-
11
- const MgCard = /*@__PURE__*/ proxyCustomElement(class MgCard extends HTMLElement {
12
- constructor(registerHost) {
13
- super();
14
- if (registerHost !== false) {
15
- this.__registerHost();
16
- }
17
- this.__attachShadow();
18
- /**
19
- * Add box-shadow style
20
- */
21
- this.shadow = false;
22
- /**
23
- * Define the border radius size
24
- */
25
- this.radiusSize = 'medium';
26
- /**
27
- * Component classes
28
- */
29
- this.classCollection = new ClassList(['mg-c-card']);
30
- }
31
- watchShadow(newValue) {
32
- if (newValue) {
33
- this.classCollection.add('mg-c-card--shadow');
34
- }
35
- else {
36
- this.classCollection.delete('mg-c-card--shadow');
37
- }
38
- }
39
- watchRadiusSize(newValue, oldValue) {
40
- if (oldValue !== undefined && radiusSizes.includes(oldValue)) {
41
- this.classCollection.delete(`mg-c-card--radius-${oldValue}`);
42
- }
43
- if (radiusSizes.includes(newValue)) {
44
- this.classCollection.add(`mg-c-card--radius-${newValue}`);
45
- }
46
- }
47
- /*************
48
- * Lifecycle *
49
- *************/
50
- /**
51
- * Check if component props are well configured on init
52
- */
53
- componentWillLoad() {
54
- this.watchShadow(this.shadow);
55
- this.watchRadiusSize(this.radiusSize);
56
- }
57
- /**
58
- * Render
59
- * @returns HTML Element
60
- */
61
- render() {
62
- return (h("div", { key: '6f83c5f7f9e0aacf502e407450cfdf039635a1f1', class: this.classCollection.join() }, h("slot", { key: '6bf8c02d3c3c9d0719e45af96b41f54289e31961' })));
63
- }
64
- static get watchers() { return {
65
- "shadow": ["watchShadow"],
66
- "radiusSize": ["watchRadiusSize"]
67
- }; }
68
- static get style() { return mgCardCss; }
69
- }, [257, "mg-card", {
70
- "shadow": [4],
71
- "radiusSize": [1, "radius-size"],
72
- "classCollection": [32]
73
- }, undefined, {
74
- "shadow": ["watchShadow"],
75
- "radiusSize": ["watchRadiusSize"]
76
- }]);
77
- function defineCustomElement() {
78
- if (typeof customElements === "undefined") {
79
- return;
80
- }
81
- const components = ["mg-card"];
82
- components.forEach(tagName => { switch (tagName) {
83
- case "mg-card":
84
- if (!customElements.get(tagName)) {
85
- customElements.define(tagName, MgCard);
86
- }
87
- break;
88
- } });
89
- }
90
- defineCustomElement();
91
-
92
- export { MgCard as M, defineCustomElement as d };
1
+ import{transformTag as a,proxyCustomElement as r,HTMLElement as d,h as c}from"@stencil/core/internal/client";import{C as e}from"./index2.js";const s=["xsmall","small","medium"],o=r(class extends d{constructor(a){super(),!1!==a&&this.__registerHost(),this.__attachShadow(),this.shadow=!1,this.radiusSize="medium",this.classCollection=new e(["mg-c-card"])}watchShadow(a){a?this.classCollection.add("mg-c-card--shadow"):this.classCollection.delete("mg-c-card--shadow")}watchRadiusSize(a,r){void 0!==r&&s.includes(r)&&this.classCollection.delete(`mg-c-card--radius-${r}`),s.includes(a)&&this.classCollection.add(`mg-c-card--radius-${a}`)}componentWillLoad(){this.watchShadow(this.shadow),this.watchRadiusSize(this.radiusSize)}render(){return c("div",{key:"fe5eff1e1d7c533cd533e27d3fb070a4e57194a8",class:this.classCollection.join()},c("slot",{key:"ca27dc4039d7bcaa21284714b7820de257625009"}))}static get watchers(){return{shadow:[{watchShadow:0}],radiusSize:[{watchRadiusSize:0}]}}static get style(){return".mg-c-card{position:relative;z-index:inherit;overflow:var(--mg-c-card-overflow, var(--mg-c-card-overflow-default));width:100%;min-width:var(--mg-c-card-min-width);max-width:var(--mg-c-card-max-width);max-height:var(--mg-c-card-max-height);box-sizing:border-box;padding:var(--mg-c-card-spacing, var(--mg-c-card-spacing-default));border:var(--mg-c-card-border, var(--mg-c-card-border-default));border-radius:var(--mg-c-card-border-radius, var(--mg-c-card-border-radius-default));background:var(--mg-c-card-color-background, var(--mg-c-card-color-background-default))}.mg-c-card ::slotted(*:not(mg-panel,mg-message,mg-modal)){--mg-c-card-border:var(--mg-c-card-border-default);--mg-c-card-spacing:var(--mg-c-card-spacing-default);--mg-c-card-border-radius:var(--mg-c-card-border-radius-default);--mg-c-card-color-background:var(--mg-c-card-color-background-default);--mg-c-card-box-shadow:var(--mg-c-card-box-shadow-default);--mg-c-card-max-width:unset;--mg-c-card-min-width:unset;--mg-c-card-max-height:unset;--mg-c-card-overflow:var(--mg-c-card-overflow-default)}.mg-c-card.mg-c-card--shadow{--mg-c-card-border:var(--mg-b-color-neutral-20);box-shadow:var(--mg-c-card-box-shadow, var(--mg-c-card-box-shadow-default))}.mg-c-card.mg-c-card--radius-xsmall{--mg-c-card-border-radius:var(--mg-b-size-4)}.mg-c-card.mg-c-card--radius-small{--mg-c-card-border-radius:var(--mg-b-size-8)}"}},[257,"mg-card",{shadow:[4],radiusSize:[1,"radius-size"],classCollection:[32]},void 0,{shadow:[{watchShadow:0}],radiusSize:[{watchRadiusSize:0}]}]);function m(){"undefined"!=typeof customElements&&["mg-card"].forEach((r=>{"mg-card"===r&&(customElements.get(a(r))||customElements.define(a(r),o))}))}m();export{o as M,m as d}
@@ -1,6 +1 @@
1
- import { M as MgCharacterLeft$1, d as defineCustomElement$1 } from './mg-character-left2.js';
2
-
3
- const MgCharacterLeft = MgCharacterLeft$1;
4
- const defineCustomElement = defineCustomElement$1;
5
-
6
- export { MgCharacterLeft, defineCustomElement };
1
+ import{M as r,d as t}from"./mg-character-left2.js";const a=r,o=t;export{a as MgCharacterLeft,o as defineCustomElement}
@@ -1,75 +1 @@
1
- import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
- import { i as initLocales } from './index3.js';
3
- import { a as isValideID, t as toString } from './index2.js';
4
-
5
- const mgCharacterLeftCss = ".mg-u-visually-hidden.sc-mg-character-left{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*.sc-mg-character-left:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*.sc-mg-character-left{animation:none !important;transition:none !important}}mg-character-left.sc-mg-character-left{display:block}";
6
-
7
- const MgCharacterLeft = /*@__PURE__*/ proxyCustomElement(class MgCharacterLeft extends HTMLElement {
8
- constructor(registerHost) {
9
- super();
10
- if (registerHost !== false) {
11
- this.__registerHost();
12
- }
13
- /**
14
- * Sets the characters to count
15
- */
16
- this.characters = '';
17
- }
18
- watchIdentifier(newValue) {
19
- if (newValue !== undefined && !isValideID(newValue)) {
20
- console.error(`<mg-character-left> prop "identifier" value is invalid. Passed value: ${toString(newValue)}.`);
21
- }
22
- }
23
- validateMaxlength(newValue) {
24
- if (typeof newValue !== 'number') {
25
- throw new Error(`<mg-character-left> prop "maxlength" is required and must be a number. Passed value: ${toString(newValue)}.`);
26
- }
27
- }
28
- /*************
29
- * Lifecycle *
30
- *************/
31
- /**
32
- * Check if props are well configured on init
33
- */
34
- componentWillLoad() {
35
- this.watchIdentifier(this.identifier);
36
- this.validateMaxlength(this.maxlength);
37
- this.messages = initLocales(this.element).messages;
38
- }
39
- /**
40
- * Render component
41
- * @returns HTML Element
42
- */
43
- render() {
44
- return (h("span", { key: '22f23b636aaebc8857e4efa2fdb87a85977c59bf', id: this.identifier, "aria-live": "polite" }, h("span", { key: '55addb97bc00800b1ec644b0eff68e779a03528a', "aria-hidden": "true" }, this.maxlength - this.characters.length, "/", this.maxlength), h("span", { key: 'd5bd60b48b6a02cdaff4166f14e4ea6cf921f749', class: "mg-u-visually-hidden" }, this.messages.nbCharLeft.replace('{counter}', this.maxlength - this.characters.length))));
45
- }
46
- get element() { return this; }
47
- static get watchers() { return {
48
- "identifier": ["watchIdentifier"],
49
- "maxlength": ["validateMaxlength"]
50
- }; }
51
- static get style() { return mgCharacterLeftCss; }
52
- }, [258, "mg-character-left", {
53
- "identifier": [1],
54
- "characters": [1],
55
- "maxlength": [2]
56
- }, undefined, {
57
- "identifier": ["watchIdentifier"],
58
- "maxlength": ["validateMaxlength"]
59
- }]);
60
- function defineCustomElement() {
61
- if (typeof customElements === "undefined") {
62
- return;
63
- }
64
- const components = ["mg-character-left"];
65
- components.forEach(tagName => { switch (tagName) {
66
- case "mg-character-left":
67
- if (!customElements.get(tagName)) {
68
- customElements.define(tagName, MgCharacterLeft);
69
- }
70
- break;
71
- } });
72
- }
73
- defineCustomElement();
74
-
75
- export { MgCharacterLeft as M, defineCustomElement as d };
1
+ import{transformTag as e,proxyCustomElement as t,HTMLElement as i,h as a}from"@stencil/core/internal/client";import{i as r}from"./index3.js";import{a as n,t as s}from"./index2.js";const c=t(class extends i{constructor(e){super(),!1!==e&&this.__registerHost(),this.characters=""}watchIdentifier(e){void 0===e||n(e)||console.error(`<mg-character-left> prop "identifier" value is invalid. Passed value: ${s(e)}.`)}validateMaxlength(e){if("number"!=typeof e)throw new Error(`<mg-character-left> prop "maxlength" is required and must be a number. Passed value: ${s(e)}.`)}componentWillLoad(){this.watchIdentifier(this.identifier),this.validateMaxlength(this.maxlength),this.messages=r(this.element).messages}render(){return a("span",{key:"41b489eafc25e9fe2e32b54a72542090d79e1052",id:this.identifier,"aria-live":"polite"},a("span",{key:"c9dd3eb15ebc866333d4e911e1a560cac1c07ef7","aria-hidden":"true"},this.maxlength-this.characters.length,"/",this.maxlength),a("span",{key:"0e4664f577b8db68f0355fc92f9df251f945dedd",class:"mg-u-visually-hidden"},this.messages.nbCharLeft.replace("{counter}",this.maxlength-this.characters.length)))}get element(){return this}static get watchers(){return{identifier:[{watchIdentifier:0}],maxlength:[{validateMaxlength:0}]}}static get style(){return".mg-u-visually-hidden.sc-mg-character-left{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*.sc-mg-character-left:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*.sc-mg-character-left{animation:none !important;transition:none !important}}mg-character-left.sc-mg-character-left{display:block}"}},[2,"mg-character-left",{identifier:[1],characters:[1],maxlength:[2]},void 0,{identifier:[{watchIdentifier:0}],maxlength:[{validateMaxlength:0}]}]);function o(){"undefined"!=typeof customElements&&["mg-character-left"].forEach((t=>{"mg-character-left"===t&&(customElements.get(e(t))||customElements.define(e(t),c))}))}o();export{c as M,o as d}
@@ -1,104 +1 @@
1
- import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { i as isValidString } from './index2.js';
3
- import { d as defineCustomElement$2 } from './mg-icon2.js';
4
-
5
- const mgDetailsCss = ".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}/*!\n * @prop --mg-c-details-spacing: Defines the spacing between the summary and the details. Default value: `--mg-b-size-8`.\n */.mg-c-details summary{display:inline-flex;align-items:baseline;cursor:pointer;gap:var(--mg-b-size-16)}.mg-c-details summary::-webkit-details-marker{display:none}.mg-c-details.mg-c-details--empty-summary summary{gap:unset}.mg-c-details__toggle{display:flex;min-height:calc(var(--mg-b-font-size)*var(--mg-b-line-height));flex-shrink:0;align-items:center;align-self:flex-start;gap:var(--mg-b-size-4)}.mg-c-details__toggle-icon.mg-c-details__toggle-icon--reverse{transform:rotate(180deg)}.mg-c-details__details{margin-top:var(--mg-c-details-spacing)}@media (width < 43.75rem){.mg-c-details:not(.mg-c-details--empty-summary) .mg-c-details__toggle>span{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}}";
6
-
7
- const MgDetails$1 = /*@__PURE__*/ proxyCustomElement(class MgDetails extends HTMLElement {
8
- constructor(registerHost) {
9
- super();
10
- if (registerHost !== false) {
11
- this.__registerHost();
12
- }
13
- this.__attachShadow();
14
- this.expandedChange = createEvent(this, "expanded-change", 7);
15
- /**
16
- * Hide summary element
17
- */
18
- this.hideSummary = false;
19
- /**
20
- * Define if details are diplayed
21
- */
22
- this.expanded = false;
23
- /**
24
- * Handle details toggle
25
- */
26
- this.handleToggle = () => {
27
- this.expanded = this.details.open;
28
- };
29
- }
30
- validateTitles(newValue) {
31
- if (!isValidString(newValue)) {
32
- throw new Error(`<mg-details> prop "toggleClosed" and "toggleOpened" is required and must be a valid string. Passed value: "toggleClosed='${this.toggleClosed}'" and "toggleOpened='${this.toggleOpened}'".`);
33
- }
34
- }
35
- handleExpanded(newValue) {
36
- this.expandedChange.emit(newValue);
37
- }
38
- /*************
39
- * Lifecycle *
40
- *************/
41
- /**
42
- * Check if component props are well configured on init
43
- */
44
- componentWillLoad() {
45
- this.validateTitles(this.toggleClosed);
46
- this.validateTitles(this.toggleOpened);
47
- // Check if summary slot is empty
48
- const summarySlot = this.element.querySelector('[slot="summary"]');
49
- this.isEmptySummary = summarySlot === null || !isValidString(summarySlot.textContent);
50
- // Add event listener to prevent default action on summary click
51
- this.element.addEventListener('click', (event) => {
52
- if (event.target.closest('[slot="summary"] mg-button, mg-button[slot="summary"]') !== null) {
53
- event.preventDefault();
54
- }
55
- });
56
- }
57
- /**
58
- * Render
59
- * @returns HTML Element
60
- */
61
- render() {
62
- return (h("details", { key: 'bbaac6909fa5f3fbd3236b2a8ace0f7c80b2580b', class: { 'mg-c-details': true, 'mg-c-details--empty-summary': this.isEmptySummary }, onToggle: this.handleToggle, open: this.expanded, ref: (el) => (this.details = el) }, h("summary", { key: '2ed8228b63403dd9b386bf3fa70c9094516b6f0e' }, h("slot", { key: '5461d77d2b2869b14737a5c7cfc40a1f9584ee03', name: "summary" }), h("span", { key: 'bb089365bdeaa7b934b97cff6f5f7c67587048e1', class: "mg-c-details__toggle" }, h("mg-icon", { key: 'dc1a30338703ad4182d50f9953a903ae0f68ecb1', icon: "chevron-up", class: { 'mg-c-details__toggle-icon': true, 'mg-c-details__toggle-icon--reverse': !this.expanded } }), h("span", { key: 'a32cbaf9e38b71540deeaa8980895c34a7288ecb', class: { 'mg-u-visually-hidden': this.hideSummary } }, this.expanded ? this.toggleOpened : this.toggleClosed))), h("div", { key: 'b9c2bc7d681da8ac8b4dec5ff25287bc68975fb6', class: "mg-c-details__details" }, h("slot", { key: '069f05b4c133ff13055681e0b05bb98744303137', name: "details" }))));
63
- }
64
- get element() { return this; }
65
- static get watchers() { return {
66
- "toggleClosed": ["validateTitles"],
67
- "toggleOpened": ["validateTitles"],
68
- "expanded": ["handleExpanded"]
69
- }; }
70
- static get style() { return mgDetailsCss; }
71
- }, [257, "mg-details", {
72
- "toggleClosed": [1, "toggle-closed"],
73
- "toggleOpened": [1, "toggle-opened"],
74
- "hideSummary": [4, "hide-summary"],
75
- "expanded": [1028]
76
- }, undefined, {
77
- "toggleClosed": ["validateTitles"],
78
- "toggleOpened": ["validateTitles"],
79
- "expanded": ["handleExpanded"]
80
- }]);
81
- function defineCustomElement$1() {
82
- if (typeof customElements === "undefined") {
83
- return;
84
- }
85
- const components = ["mg-details", "mg-icon"];
86
- components.forEach(tagName => { switch (tagName) {
87
- case "mg-details":
88
- if (!customElements.get(tagName)) {
89
- customElements.define(tagName, MgDetails$1);
90
- }
91
- break;
92
- case "mg-icon":
93
- if (!customElements.get(tagName)) {
94
- defineCustomElement$2();
95
- }
96
- break;
97
- } });
98
- }
99
- defineCustomElement$1();
100
-
101
- const MgDetails = MgDetails$1;
102
- const defineCustomElement = defineCustomElement$1;
103
-
104
- export { MgDetails, defineCustomElement };
1
+ import{transformTag as e,proxyCustomElement as t,HTMLElement as i,createEvent as a,h as s}from"@stencil/core/internal/client";import{i as n}from"./index2.js";import{d as m}from"./mg-icon2.js";const o=t(class extends i{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.expandedChange=a(this,"expanded-change",7),this.hideSummary=!1,this.expanded=!1,this.handleToggle=()=>{this.expanded=this.details.open}}validateTitles(e){if(!n(e))throw Error(`<mg-details> prop "toggleClosed" and "toggleOpened" is required and must be a valid string. Passed value: "toggleClosed='${this.toggleClosed}'" and "toggleOpened='${this.toggleOpened}'".`)}handleExpanded(e){this.expandedChange.emit(e)}componentWillLoad(){this.validateTitles(this.toggleClosed),this.validateTitles(this.toggleOpened);const e=this.element.querySelector('[slot="summary"]');this.isEmptySummary=null===e||!n(e.textContent),this.element.addEventListener("click",(e=>{null!==e.target.closest('[slot="summary"] mg-button, mg-button[slot="summary"]')&&e.preventDefault()}))}render(){return s("details",{key:"4da17afd7a964a14b5b101bcfadc241be569d55a",class:{"mg-c-details":!0,"mg-c-details--empty-summary":this.isEmptySummary},onToggle:this.handleToggle,open:this.expanded,ref:e=>this.details=e},s("summary",{key:"515d6c4e117b547fe80a310fb90e114900f645e8"},s("slot",{key:"0c9c0dcc47dd418e34e541d878bfc03ca137c68d",name:"summary"}),s("span",{key:"c94f52994843b10c1161c0d85f38f8cb917ea806",class:"mg-c-details__toggle"},s("mg-icon",{key:"9421452572af3deb03146a8dfd189369b249ba2d",icon:"chevron-up",class:{"mg-c-details__toggle-icon":!0,"mg-c-details__toggle-icon--reverse":!this.expanded}}),s("span",{key:"dbfb0b34da00e37f55ec07236611c2babdd6b7c5",class:{"mg-u-visually-hidden":this.hideSummary}},this.expanded?this.toggleOpened:this.toggleClosed))),s("div",{key:"1b18b65a98e39a8663fa5d7e51eef5fbe2b92f76",class:"mg-c-details__details"},s("slot",{key:"81c213594b1b67747db439624090784eaa5e6fcd",name:"details"})))}get element(){return this}static get watchers(){return{toggleClosed:[{validateTitles:0}],toggleOpened:[{validateTitles:0}],expanded:[{handleExpanded:0}]}}static get style(){return".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-details summary{display:inline-flex;align-items:baseline;cursor:pointer;gap:var(--mg-b-size-16)}.mg-c-details summary::-webkit-details-marker{display:none}.mg-c-details.mg-c-details--empty-summary summary{gap:unset}.mg-c-details__toggle{display:flex;min-height:calc(var(--mg-b-font-size)*var(--mg-b-line-height));flex-shrink:0;align-items:center;align-self:flex-start;gap:var(--mg-b-size-4)}.mg-c-details__toggle-icon.mg-c-details__toggle-icon--reverse{transform:rotate(180deg)}.mg-c-details__details{margin-top:var(--mg-c-details-spacing)}@media (width < 43.75rem){.mg-c-details:not(.mg-c-details--empty-summary) .mg-c-details__toggle>span{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}}"}},[257,"mg-details",{toggleClosed:[1,"toggle-closed"],toggleOpened:[1,"toggle-opened"],hideSummary:[4,"hide-summary"],expanded:[1028]},void 0,{toggleClosed:[{validateTitles:0}],toggleOpened:[{validateTitles:0}],expanded:[{handleExpanded:0}]}]);function d(){"undefined"!=typeof customElements&&["mg-details","mg-icon"].forEach((t=>{switch(t){case"mg-details":customElements.get(e(t))||customElements.define(e(t),o);break;case"mg-icon":customElements.get(e(t))||m()}}))}d();const l=o,r=d;export{l as MgDetails,r as defineCustomElement}