@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,146 +1 @@
1
- import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
- import { C as ClassList, t as toString } from './index2.js';
3
- import { d as defineCustomElement$2 } from './mg-card2.js';
4
- import { d as defineCustomElement$1 } from './mg-icon2.js';
5
-
6
- /**
7
- * List available variants
8
- */
9
- const variants = ['info', 'warning', 'success', 'danger'];
10
- /**
11
- * List available variant styles
12
- */
13
- const variantStyles = ['bar-left', 'background'];
14
-
15
- const mgMessageCss = "/*!\n * @prop --mg-c-message-border-radius: Defines the border radius of the message. Default value: `--mg-b-size-radius`.\n */:host{--mg-c-card-spacing:0;--mg-c-card-border-radius:var(--mg-c-message-border-radius);--mg-c-card-border:none;--mg-c-card-overflow:hidden}.mg-c-message{display:inline-block;min-height:var(--mg-b-size-min-height)}.mg-c-message.mg-c-message--danger .mg-c-message__icon{color:var(--mg-b-color-danger)}.mg-c-message.mg-c-message--danger.mg-c-message--bar-left .mg-c-message__bar{background-color:var(--mg-b-color-danger)}.mg-c-message.mg-c-message--danger.mg-c-message--background{--mg-c-card-color-background:var(--mg-b-color-red-20, color-mix(in srgb, var(--mg-b-color-danger), white 80%))}.mg-c-message.mg-c-message--info .mg-c-message__icon{color:var(--mg-b-color-info)}.mg-c-message.mg-c-message--info.mg-c-message--bar-left .mg-c-message__bar{background-color:var(--mg-b-color-info)}.mg-c-message.mg-c-message--info.mg-c-message--background{--mg-c-card-color-background:var(--mg-b-color-blue-20, color-mix(in srgb, var(--mg-b-color-info), white 80%))}.mg-c-message.mg-c-message--success .mg-c-message__icon{color:var(--mg-b-color-success)}.mg-c-message.mg-c-message--success.mg-c-message--bar-left .mg-c-message__bar{background-color:var(--mg-b-color-success)}.mg-c-message.mg-c-message--success.mg-c-message--background{--mg-c-card-color-background:var(--mg-b-color-green-20, color-mix(in srgb, var(--mg-b-color-success), white 80%))}.mg-c-message.mg-c-message--warning .mg-c-message__icon{color:var(--mg-b-color-warning)}.mg-c-message.mg-c-message--warning.mg-c-message--bar-left .mg-c-message__bar{background-color:var(--mg-b-color-warning)}.mg-c-message.mg-c-message--warning.mg-c-message--background{--mg-c-card-color-background:var(--mg-b-color-yellow-20, color-mix(in srgb, var(--mg-b-color-warning), white 80%))}.mg-c-message ::slotted(*){padding:0;margin:0}.mg-c-message__icon{position:absolute;top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2);left:calc(var(--mg-b-size-4) + var(--mg-b-size-8));line-height:1}.mg-c-message__content{display:flex;flex-wrap:wrap;padding:0 var(--mg-b-size-8) 0 calc(var(--mg-b-size-4) + var(--mg-b-size-8) + var(--mg-b-size-16) + var(--mg-b-size-8));place-content:stretch flex-end}.mg-c-message__content-slot{flex-grow:1;margin:var(--mg-b-size-8) 0}.mg-c-message__content-separator{display:inline-block;width:var(--mg-b-size-40);height:0}.mg-c-message__content-actions-slot{padding:var(--mg-b-size-8) 0;text-align:right}.mg-c-message__bar{position:absolute;top:0;left:0;width:var(--mg-b-size-4);height:100%}.mg-c-message ::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-message,.mg-c-message mg-message{max-width:100%}";
16
-
17
- const MgMessage = /*@__PURE__*/ proxyCustomElement(class MgMessage extends HTMLElement {
18
- constructor(registerHost) {
19
- super();
20
- if (registerHost !== false) {
21
- this.__registerHost();
22
- }
23
- this.__attachShadow();
24
- /************
25
- * Internal *
26
- ************/
27
- this.classBase = 'mg-c-message';
28
- /**
29
- * Define variant
30
- */
31
- this.variant = 'info';
32
- /**
33
- * Define variant style
34
- */
35
- this.variantStyle = 'bar-left';
36
- /**
37
- * Component classes
38
- */
39
- this.classCollection = new ClassList(['mg-c-message']);
40
- /**
41
- * Define if component is using actions slot
42
- */
43
- this.hasActions = false;
44
- /**
45
- * Get icon corresponding to variant
46
- * @returns icon
47
- */
48
- this.getIcon = () => {
49
- switch (this.variant) {
50
- case 'info':
51
- return 'info-circle';
52
- case 'warning':
53
- return 'exclamation-triangle';
54
- case 'success':
55
- return 'check-circle';
56
- case 'danger':
57
- return 'exclamation-circle';
58
- }
59
- };
60
- }
61
- watchVariant(newValue, oldValue) {
62
- if (!variants.includes(newValue)) {
63
- throw new Error(`<mg-message> prop "variant" must be one of: ${variants.join(', ')}. Passed value: ${toString(newValue)}.`);
64
- }
65
- else {
66
- if (newValue !== undefined)
67
- this.classCollection.add(`${this.classBase}--${newValue}`);
68
- if (oldValue !== undefined)
69
- this.classCollection.delete(`${this.classBase}--${oldValue}`);
70
- }
71
- }
72
- watchVariantStyle(newValue, oldValue) {
73
- if (!variantStyles.includes(newValue)) {
74
- throw new Error(`<mg-message> prop "variantStyle" must be one of: ${variantStyles.join(', ')}. Passed value: ${toString(newValue)}.`);
75
- }
76
- else {
77
- if (newValue !== undefined)
78
- this.classCollection.add(`${this.classBase}--${newValue}`);
79
- if (oldValue !== undefined)
80
- this.classCollection.delete(`${this.classBase}--${oldValue}`);
81
- }
82
- }
83
- /*************
84
- * Lifecycle *
85
- *************/
86
- /**
87
- * Check if component props are well configured on init
88
- */
89
- componentWillLoad() {
90
- // Validate
91
- this.watchVariant(this.variant);
92
- this.watchVariantStyle(this.variantStyle);
93
- // Check if component has actions slot
94
- this.hasActions = this.element.querySelector('[slot="actions"]') !== null;
95
- }
96
- /**
97
- * Render
98
- * @returns HTML Element
99
- */
100
- render() {
101
- return (h("div", { key: 'f99bf527eb2c6005eeaec11f89aaa08f8865ea57', class: this.classCollection.join() }, h("mg-card", { key: 'beede3cd97b022d947c216b6bba454a104ba5790', shadow: true }, this.variantStyle === 'bar-left' && h("span", { key: '515828d725a996c9d57b39ad75e9373150a1b78a', class: "mg-c-message__bar" }), h("span", { key: '02ae41c66af25c2611b9b6cb8c87a1ad99346fa3', class: "mg-c-message__icon" }, h("mg-icon", { key: '3eadb40ed0dfa5ec51155608a67769c5fee3d402', icon: this.getIcon() })), h("div", { key: 'b832251e8f330d00b512bcd508ae9bf6e5f511cb', class: "mg-c-message__content" }, h("span", { key: 'c3520fc49bd5c3c187a83823050ceb9ca8c12d46', class: "mg-c-message__content-slot" }, h("slot", { key: 'f4064dff9536cbb76e45c5c4c1a89621da9531b2' })), this.hasActions && [
102
- h("span", { class: "mg-c-message__content-separator", key: "content-separator" }),
103
- h("span", { class: "mg-c-message__content-actions-slot", key: "content-actions-slot" }, h("slot", { key: '5585f7c14c2c3896cfdb5319414cd82f4d4b3a8b', name: "actions" })),
104
- ]))));
105
- }
106
- get element() { return this; }
107
- static get watchers() { return {
108
- "variant": ["watchVariant"],
109
- "variantStyle": ["watchVariantStyle"]
110
- }; }
111
- static get style() { return mgMessageCss; }
112
- }, [257, "mg-message", {
113
- "variant": [1],
114
- "variantStyle": [1, "variant-style"],
115
- "classCollection": [32],
116
- "hasActions": [32]
117
- }, undefined, {
118
- "variant": ["watchVariant"],
119
- "variantStyle": ["watchVariantStyle"]
120
- }]);
121
- function defineCustomElement() {
122
- if (typeof customElements === "undefined") {
123
- return;
124
- }
125
- const components = ["mg-message", "mg-card", "mg-icon"];
126
- components.forEach(tagName => { switch (tagName) {
127
- case "mg-message":
128
- if (!customElements.get(tagName)) {
129
- customElements.define(tagName, MgMessage);
130
- }
131
- break;
132
- case "mg-card":
133
- if (!customElements.get(tagName)) {
134
- defineCustomElement$2();
135
- }
136
- break;
137
- case "mg-icon":
138
- if (!customElements.get(tagName)) {
139
- defineCustomElement$1();
140
- }
141
- break;
142
- } });
143
- }
144
- defineCustomElement();
145
-
146
- export { MgMessage as M, defineCustomElement as d };
1
+ import{transformTag as e,proxyCustomElement as a,HTMLElement as s,h as c}from"@stencil/core/internal/client";import{C as g,t as r}from"./index2.js";import{d as m}from"./mg-card2.js";import{d as o}from"./mg-icon2.js";const t=["info","warning","success","danger"],n=["bar-left","background"],i=a(class extends s{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.classBase="mg-c-message",this.variant="info",this.variantStyle="bar-left",this.classCollection=new g(["mg-c-message"]),this.hasActions=!1,this.getIcon=()=>{switch(this.variant){case"info":return"info-circle";case"warning":return"exclamation-triangle";case"success":return"check-circle";case"danger":return"exclamation-circle"}}}watchVariant(e,a){if(!t.includes(e))throw new Error(`<mg-message> prop "variant" must be one of: ${t.join(", ")}. Passed value: ${r(e)}.`);void 0!==e&&this.classCollection.add(`${this.classBase}--${e}`),void 0!==a&&this.classCollection.delete(`${this.classBase}--${a}`)}watchVariantStyle(e,a){if(!n.includes(e))throw new Error(`<mg-message> prop "variantStyle" must be one of: ${n.join(", ")}. Passed value: ${r(e)}.`);void 0!==e&&this.classCollection.add(`${this.classBase}--${e}`),void 0!==a&&this.classCollection.delete(`${this.classBase}--${a}`)}componentWillLoad(){this.watchVariant(this.variant),this.watchVariantStyle(this.variantStyle),this.hasActions=null!==this.element.querySelector('[slot="actions"]')}render(){return c("div",{key:"516691c613b30edf92d43fb9596169459dd8058a",class:this.classCollection.join()},c("mg-card",{key:"2be929dd6ed5458927b155d2f4c94fa15f9717e9",shadow:!0},"bar-left"===this.variantStyle&&c("span",{key:"604d5a7bd37abc571b40f8be09ac5dadbde69ec1",class:"mg-c-message__bar"}),c("span",{key:"837cce7c506997955de6efb4cffc53e5107fb602",class:"mg-c-message__icon"},c("mg-icon",{key:"3fd70f747cad5605f129bec491aa1bfd5ea42a95",icon:this.getIcon()})),c("div",{key:"bf0b166fee2c94014fc35980b06a45dfc91b8596",class:"mg-c-message__content"},c("span",{key:"305f79545b87055a954831c7355e7685340d1aa6",class:"mg-c-message__content-slot"},c("slot",{key:"d25113f6305d8ceaa39d12672fecc4e4bf6ffb49"})),this.hasActions&&[c("span",{class:"mg-c-message__content-separator",key:"content-separator"}),c("span",{class:"mg-c-message__content-actions-slot",key:"content-actions-slot"},c("slot",{key:"744098ecfdcc8bb5f5e0b913884126498c21d3f0",name:"actions"}))])))}get element(){return this}static get watchers(){return{variant:[{watchVariant:0}],variantStyle:[{watchVariantStyle:0}]}}static get style(){return":host{--mg-c-card-spacing:0;--mg-c-card-border-radius:var(--mg-c-message-border-radius);--mg-c-card-border:none;--mg-c-card-overflow:hidden}.mg-c-message{display:inline-block;min-height:var(--mg-b-size-min-height)}.mg-c-message.mg-c-message--danger .mg-c-message__icon{color:var(--mg-b-color-danger)}.mg-c-message.mg-c-message--danger.mg-c-message--bar-left .mg-c-message__bar{background-color:var(--mg-b-color-danger)}.mg-c-message.mg-c-message--danger.mg-c-message--background{--mg-c-card-color-background:var(--mg-b-color-red-20, color-mix(in srgb, var(--mg-b-color-danger), white 80%))}.mg-c-message.mg-c-message--info .mg-c-message__icon{color:var(--mg-b-color-info)}.mg-c-message.mg-c-message--info.mg-c-message--bar-left .mg-c-message__bar{background-color:var(--mg-b-color-info)}.mg-c-message.mg-c-message--info.mg-c-message--background{--mg-c-card-color-background:var(--mg-b-color-blue-20, color-mix(in srgb, var(--mg-b-color-info), white 80%))}.mg-c-message.mg-c-message--success .mg-c-message__icon{color:var(--mg-b-color-success)}.mg-c-message.mg-c-message--success.mg-c-message--bar-left .mg-c-message__bar{background-color:var(--mg-b-color-success)}.mg-c-message.mg-c-message--success.mg-c-message--background{--mg-c-card-color-background:var(--mg-b-color-green-20, color-mix(in srgb, var(--mg-b-color-success), white 80%))}.mg-c-message.mg-c-message--warning .mg-c-message__icon{color:var(--mg-b-color-warning)}.mg-c-message.mg-c-message--warning.mg-c-message--bar-left .mg-c-message__bar{background-color:var(--mg-b-color-warning)}.mg-c-message.mg-c-message--warning.mg-c-message--background{--mg-c-card-color-background:var(--mg-b-color-yellow-20, color-mix(in srgb, var(--mg-b-color-warning), white 80%))}.mg-c-message ::slotted(*){padding:0;margin:0}.mg-c-message__icon{position:absolute;top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2);left:calc(var(--mg-b-size-4) + var(--mg-b-size-8));line-height:1}.mg-c-message__content{display:flex;flex-wrap:wrap;padding:0 var(--mg-b-size-8) 0 calc(var(--mg-b-size-4) + var(--mg-b-size-8) + var(--mg-b-size-16) + var(--mg-b-size-8));place-content:stretch flex-end}.mg-c-message__content-slot{flex-grow:1;margin:var(--mg-b-size-8) 0}.mg-c-message__content-separator{display:inline-block;width:var(--mg-b-size-40);height:0}.mg-c-message__content-actions-slot{padding:var(--mg-b-size-8) 0;text-align:right}.mg-c-message__bar{position:absolute;top:0;left:0;width:var(--mg-b-size-4);height:100%}.mg-c-message ::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-message,.mg-c-message mg-message{max-width:100%}"}},[257,"mg-message",{variant:[1],variantStyle:[1,"variant-style"],classCollection:[32],hasActions:[32]},void 0,{variant:[{watchVariant:0}],variantStyle:[{watchVariantStyle:0}]}]);function d(){"undefined"!=typeof customElements&&["mg-message","mg-card","mg-icon"].forEach((a=>{switch(a){case"mg-message":customElements.get(e(a))||customElements.define(e(a),i);break;case"mg-card":customElements.get(e(a))||m();break;case"mg-icon":customElements.get(e(a))||o()}}))}d();export{i as M,d}
@@ -1,184 +1 @@
1
- import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { c as createID, C as ClassList, a as isValideID, t as toString, i as isValidString } from './index2.js';
3
- import { i as initLocales } from './index3.js';
4
- import { d as defineCustomElement$4 } from './mg-button2.js';
5
- import { d as defineCustomElement$3 } from './mg-card2.js';
6
- import { d as defineCustomElement$2 } from './mg-icon2.js';
7
-
8
- /**
9
- * List of all possibles dialog roles
10
- */
11
- const dialogRoles = ['dialog', 'alertdialog'];
12
-
13
- const mgModalCss = "/*!\n * @prop --mg-c-modal-border-radius: Defines the border radius of the modal. Default value: `--mg-c-card-border-radius-default`.\n * @prop --mg-c-modal-title-font-size: Defines the font size of the modal title. Default value: `--mg-b-font-size-h3`.\n */:host{--mg-c-card-border-radius:var(--mg-c-modal-border-radius);--mg-c-card-spacing:var(--mg-b-size-16) var(--mg-b-size-24);--mg-c-card-border:none}.mg-c-modal{border:none;background:none;color:inherit}.mg-c-modal[open]{display:flex;padding:var(--mg-b-size-24) var(--mg-b-size-8)}.mg-c-modal::backdrop{background-color:var(--mg-b-color-light);opacity:.85}.mg-c-modal mg-card{display:flex;width:calc(75*var(--mg-b-size-8));max-width:100%;max-height:100%}.mg-c-modal__dialog{position:relative;display:flex;height:fit-content;max-height:100%;flex-direction:column;align-self:center;row-gap:var(--mg-b-size-24)}.mg-c-modal__title{margin:0;font-family:var(--mg-b-font-family-heading);font-size:var(--mg-c-modal-title-font-size);font-weight:600}.mg-c-modal__close-button{height:var(--mg-c-modal-title-font-size);margin-top:calc((var(--mg-b-size-min-height) - var(--mg-c-modal-title-font-size)*var(--mg-b-line-height))/2*-1);margin-right:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2*-1);margin-left:var(--mg-b-size-16);float:right}.mg-c-modal__content{padding:var(--mg-b-size-16);margin:calc(var(--mg-b-size-16)*-1);overflow-y:auto}.mg-c-modal ::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)}";
14
-
15
- const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class MgModal extends HTMLElement {
16
- constructor(registerHost) {
17
- super();
18
- if (registerHost !== false) {
19
- this.__registerHost();
20
- }
21
- this.__attachShadow();
22
- this.componentShow = createEvent(this, "component-show", 7);
23
- this.componentHide = createEvent(this, "component-hide", 7);
24
- this.componentClose = createEvent(this, "component-close", 7);
25
- // IDs
26
- this.titleId = '';
27
- /**
28
- * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
29
- * If not set, it will be created.
30
- */
31
- this.identifier = createID('mg-modal');
32
- /**
33
- * Modal dialog role.
34
- */
35
- this.dialogRole = 'dialog';
36
- /**
37
- * Define if modal has a cross button
38
- */
39
- this.closeButton = false;
40
- /**
41
- * Define if modal is open
42
- */
43
- this.open = false;
44
- /**
45
- * Define if component is using actions slot
46
- */
47
- this.hasActions = false;
48
- /**
49
- * Component classes
50
- */
51
- this.classCollection = new ClassList(['mg-c-modal']);
52
- /***********
53
- * Handles *
54
- ***********/
55
- /**
56
- * Closes the modal.
57
- */
58
- this.handleClose = () => {
59
- this.open = false;
60
- this.componentClose.emit();
61
- };
62
- }
63
- watchIdentifier(newValue) {
64
- if (!isValideID(newValue)) {
65
- throw new Error(`<mg-modal> prop "identifier" value is invalid. Passed value: ${toString(newValue)}.`);
66
- }
67
- }
68
- validateDialogRole(newValue) {
69
- if (!dialogRoles.includes(newValue))
70
- throw new Error(`<mg-modal> prop "dialogRole" must be one of: ${dialogRoles.join(', ')}. Passed value: ${toString(newValue)}.`);
71
- }
72
- validateModalTitle(newValue) {
73
- if (!isValidString(newValue)) {
74
- throw new Error(`<mg-modal> prop "modalTitle" is required. Passed value: ${toString(newValue)}.`);
75
- }
76
- }
77
- watchOpen(newValue) {
78
- if (newValue) {
79
- this.dialog.showModal();
80
- this.componentShow.emit();
81
- document.body.style.overflow = 'hidden';
82
- }
83
- else {
84
- this.dialog.close();
85
- this.componentHide.emit();
86
- document.body.style.overflow = this.bodyOverflow;
87
- }
88
- }
89
- /*************
90
- * Lifecycle *
91
- *************/
92
- /**
93
- * Check if component props are well configured on init
94
- */
95
- componentWillLoad() {
96
- // Store body overflow
97
- this.bodyOverflow = document.body.style.overflow;
98
- // Get locales
99
- this.messages = initLocales(this.element).messages;
100
- // Validate
101
- this.hasActions = this.element.querySelector('[slot="actions"]') !== null;
102
- this.titleId = `${this.identifier}-title`;
103
- this.watchIdentifier(this.identifier);
104
- this.validateModalTitle(this.modalTitle);
105
- this.validateDialogRole(this.dialogRole);
106
- }
107
- /**
108
- * Define open state on component load
109
- */
110
- componentDidLoad() {
111
- this.watchOpen(this.open);
112
- // update open prop when use escape key
113
- this.dialog.addEventListener('close', () => {
114
- this.open = false;
115
- this.componentClose.emit();
116
- });
117
- }
118
- /**
119
- * Render
120
- * @returns HTML Element
121
- */
122
- render() {
123
- return (h("dialog", { key: '2d99322fd3c80b8cbfea70589cf579e0c1c6f06b', role: this.dialogRole, id: this.identifier, class: this.classCollection.join(), "aria-labelledby": this.titleId, ref: (el) => {
124
- if (el !== null) {
125
- this.dialog = el;
126
- }
127
- } }, h("mg-card", { key: '32692a6d41ef30b3d3e61ddcfea47350d374ed09', shadow: true }, h("div", { key: 'c87bb43bb069671b65a9759ee293e77975707597', class: "mg-c-modal__dialog" }, h("header", { key: '1272a946878efcf8c69f3b09852ba6938cbe31b0', class: "mg-c-modal__header" }, this.closeButton && (h("span", { key: '0704656c7c5ac4c8d405f2cd673e91f72763ee8f', class: "mg-c-modal__close-button" }, h("mg-button", { key: '4402971c763ee34145de5bd69d367fde68f9d1a2', "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose }, h("mg-icon", { key: '9e16add6a3e387971507a252671c895b6c94a586', icon: "cross" })))), h("h1", { key: '3e4fc2b4419398528565d382b728b8b752758ddd', class: "mg-c-modal__title", id: this.titleId }, this.modalTitle)), h("article", { key: '170ff6bd9592687baa4c561615f540ad1c7400e4', class: "mg-c-modal__content" }, h("slot", { key: 'cb710e2a57e4c997deac367169b56047af1200b1' })), this.hasActions && (h("footer", { key: '1e08d67caeaaaf75eb97faa11528719ea537c24c', class: "mg-c-modal__footer" }, h("slot", { key: '461ec8e4117477aef08dc6d346ad0bf6007ec12d', name: "actions" })))))));
128
- }
129
- get element() { return this; }
130
- static get watchers() { return {
131
- "identifier": ["watchIdentifier"],
132
- "dialogRole": ["validateDialogRole"],
133
- "modalTitle": ["validateModalTitle"],
134
- "open": ["watchOpen"]
135
- }; }
136
- static get style() { return mgModalCss; }
137
- }, [257, "mg-modal", {
138
- "identifier": [1],
139
- "dialogRole": [1, "dialog-role"],
140
- "modalTitle": [1, "modal-title"],
141
- "closeButton": [4, "close-button"],
142
- "open": [1028],
143
- "hasActions": [32],
144
- "classCollection": [32]
145
- }, undefined, {
146
- "identifier": ["watchIdentifier"],
147
- "dialogRole": ["validateDialogRole"],
148
- "modalTitle": ["validateModalTitle"],
149
- "open": ["watchOpen"]
150
- }]);
151
- function defineCustomElement$1() {
152
- if (typeof customElements === "undefined") {
153
- return;
154
- }
155
- const components = ["mg-modal", "mg-button", "mg-card", "mg-icon"];
156
- components.forEach(tagName => { switch (tagName) {
157
- case "mg-modal":
158
- if (!customElements.get(tagName)) {
159
- customElements.define(tagName, MgModal$1);
160
- }
161
- break;
162
- case "mg-button":
163
- if (!customElements.get(tagName)) {
164
- defineCustomElement$4();
165
- }
166
- break;
167
- case "mg-card":
168
- if (!customElements.get(tagName)) {
169
- defineCustomElement$3();
170
- }
171
- break;
172
- case "mg-icon":
173
- if (!customElements.get(tagName)) {
174
- defineCustomElement$2();
175
- }
176
- break;
177
- } });
178
- }
179
- defineCustomElement$1();
180
-
181
- const MgModal = MgModal$1;
182
- const defineCustomElement = defineCustomElement$1;
183
-
184
- export { MgModal, defineCustomElement };
1
+ import{transformTag as a,proxyCustomElement as e,HTMLElement as t,createEvent as i,h as o}from"@stencil/core/internal/client";import{c as d,C as c,a as s,t as l,i as r}from"./index2.js";import{i as m}from"./index3.js";import{d as n}from"./mg-button2.js";import{d as g}from"./mg-card2.js";import{d as h}from"./mg-icon2.js";const f=["dialog","alertdialog"],b=e(class extends t{constructor(a){super(),!1!==a&&this.__registerHost(),this.__attachShadow(),this.componentShow=i(this,"component-show",7),this.componentHide=i(this,"component-hide",7),this.componentClose=i(this,"component-close",7),this.titleId="",this.identifier=d("mg-modal"),this.dialogRole="dialog",this.closeButton=!1,this.open=!1,this.hasActions=!1,this.classCollection=new c(["mg-c-modal"]),this.handleClose=()=>{this.open=!1,this.componentClose.emit()}}watchIdentifier(a){if(!s(a))throw Error(`<mg-modal> prop "identifier" value is invalid. Passed value: ${l(a)}.`)}validateDialogRole(a){if(!f.includes(a))throw Error(`<mg-modal> prop "dialogRole" must be one of: ${f.join(", ")}. Passed value: ${l(a)}.`)}validateModalTitle(a){if(!r(a))throw Error(`<mg-modal> prop "modalTitle" is required. Passed value: ${l(a)}.`)}watchOpen(a){a?(this.dialog.showModal(),this.componentShow.emit(),document.body.style.overflow="hidden"):(this.dialog.close(),this.componentHide.emit(),document.body.style.overflow=this.bodyOverflow)}componentWillLoad(){this.bodyOverflow=document.body.style.overflow,this.messages=m(this.element).messages,this.hasActions=null!==this.element.querySelector('[slot="actions"]'),this.titleId=this.identifier+"-title",this.watchIdentifier(this.identifier),this.validateModalTitle(this.modalTitle),this.validateDialogRole(this.dialogRole)}componentDidLoad(){this.watchOpen(this.open),this.dialog.addEventListener("close",(()=>{this.open=!1,this.componentClose.emit()}))}render(){return o("dialog",{key:"fe7c7abaf53fbc5c87d2855cc72de2212dfe8642",role:this.dialogRole,id:this.identifier,class:this.classCollection.join(),"aria-labelledby":this.titleId,ref:a=>{null!==a&&(this.dialog=a)}},o("mg-card",{key:"4b361ad45cd0b20253cf82e8f68c574429dd451c",shadow:!0},o("div",{key:"90f5490fb82f2900403f0a7549b338e884eea171",class:"mg-c-modal__dialog"},o("header",{key:"a58be90f41ad4448c387b1d18372aa31522d8d35",class:"mg-c-modal__header"},this.closeButton&&o("span",{key:"d9a0f9c1944b89b4a64f35fc9c1b70bea60f5423",class:"mg-c-modal__close-button"},o("mg-button",{key:"d7ecae6a2c2b2b094fea6b4a6d3c761f0f975b29","is-icon":!0,variant:"flat",label:this.messages.modal.closeButton,onClick:this.handleClose},o("mg-icon",{key:"54b91decfd0deb5e452e03c23f68bac58d97677a",icon:"cross"}))),o("h1",{key:"7dc2519bdf97ebc5cc18505fbbd347c7b1a4c336",class:"mg-c-modal__title",id:this.titleId},this.modalTitle)),o("article",{key:"b6a27c0bb6e5a350e10addbd0325b04626b07239",class:"mg-c-modal__content"},o("slot",{key:"41acebdafae6289d2f03fc3226eb7f3c4334e33f"})),this.hasActions&&o("footer",{key:"04a934a044bfbfa64f65642361e1962d2f599bf9",class:"mg-c-modal__footer"},o("slot",{key:"8d72488a4095c245b638d7d0e5fdbda77fa5ab01",name:"actions"})))))}get element(){return this}static get watchers(){return{identifier:[{watchIdentifier:0}],dialogRole:[{validateDialogRole:0}],modalTitle:[{validateModalTitle:0}],open:[{watchOpen:0}]}}static get style(){return":host{--mg-c-card-border-radius:var(--mg-c-modal-border-radius);--mg-c-card-spacing:var(--mg-b-size-16) var(--mg-b-size-24);--mg-c-card-border:none}.mg-c-modal{border:none;background:none;color:inherit}.mg-c-modal[open]{display:flex;padding:var(--mg-b-size-24) var(--mg-b-size-8)}.mg-c-modal::backdrop{background-color:var(--mg-b-color-dark);opacity:.65}.mg-c-modal mg-card{display:flex;width:calc(75*var(--mg-b-size-8));max-width:100%;max-height:100%}.mg-c-modal__dialog{position:relative;display:flex;height:fit-content;max-height:100%;flex-direction:column;align-self:center;row-gap:var(--mg-b-size-24)}.mg-c-modal__title{margin:0;font-family:var(--mg-b-font-family-heading);font-size:var(--mg-c-modal-title-font-size);font-weight:600}.mg-c-modal__close-button{height:var(--mg-c-modal-title-font-size);margin-top:calc((var(--mg-b-size-min-height) - var(--mg-c-modal-title-font-size)*var(--mg-b-line-height))/2*-1);margin-right:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2*-1);margin-left:var(--mg-b-size-16);float:right}.mg-c-modal__content{padding:var(--mg-b-size-16);margin:calc(var(--mg-b-size-16)*-1);overflow-y:auto}.mg-c-modal ::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)}"}},[257,"mg-modal",{identifier:[1],dialogRole:[1,"dialog-role"],modalTitle:[1,"modal-title"],closeButton:[4,"close-button"],open:[1028],hasActions:[32],classCollection:[32]},void 0,{identifier:[{watchIdentifier:0}],dialogRole:[{validateDialogRole:0}],modalTitle:[{validateModalTitle:0}],open:[{watchOpen:0}]}]);function u(){"undefined"!=typeof customElements&&["mg-modal","mg-button","mg-card","mg-icon"].forEach((e=>{switch(e){case"mg-modal":customElements.get(a(e))||customElements.define(a(e),b);break;case"mg-button":customElements.get(a(e))||n();break;case"mg-card":customElements.get(a(e))||g();break;case"mg-icon":customElements.get(a(e))||h()}}))}u();const v=b,p=u;export{v as MgModal,p as defineCustomElement}
@@ -1,234 +1 @@
1
- import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
- import { c as createID, a as isValideID, t as toString, i as isValidString } from './index2.js';
3
- import { i as initLocales } from './index3.js';
4
- import { d as defineCustomElement$8 } from './mg-button2.js';
5
- import { d as defineCustomElement$7 } from './mg-icon2.js';
6
- import { d as defineCustomElement$6 } from './mg-input2.js';
7
- import { d as defineCustomElement$5 } from './mg-input-select2.js';
8
- import { d as defineCustomElement$4 } from './mg-input-title2.js';
9
- import { d as defineCustomElement$3 } from './mg-tooltip2.js';
10
- import { d as defineCustomElement$2 } from './mg-tooltip-content2.js';
11
-
12
- const NavigationAction = {
13
- NEXT: 'next',
14
- PREVIOUS: 'previous',
15
- };
16
-
17
- const mgPaginationCss = ".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-pagination{display:flex;align-items:center;gap:var(--mg-b-spacing-actions)}.mg-c-pagination__page-count{display:flex;align-items:center;gap:var(--mg-b-size-4)}.mg-c-pagination.mg-c-pagination--hide-page-count{gap:0}";
18
-
19
- /**
20
- * Range generator
21
- *
22
- * ```
23
- * start by get the range length, add "+ 1" to include last value, ex: Math.ceil((3 + 1 - 1) / 1) => 3
24
- * then with Array(Math.ceil...) we get the final array with empty values, ex: Array(Math.ceil(2 + 1 - 1) / 1)) => [empty, empty, empty]
25
- * then with Array(Math.ceil...).keys() we get the Array Iterator from empty values
26
- * then with Array.from(Array(...)) we get the complete array with "index" values instead of "empty" values
27
- * ex: Array.from(Array(Math.ceil((2 + 1 - 1) / 1) || 1).keys()) => [0, 1, 2]
28
- * finaly we map values from "start" range and apply the "step" coefficiant,
29
- * ex: Array.from(Array(Math.ceil((2 + 1 - 1) / 1) || 1).keys()).map(x => 1 + x * 1) => [1, 2, 3]
30
- * ```
31
- *
32
- * range(1, 1) = [1]
33
- * range(1, 5) = [1, 2, 3, 4, 5]
34
- * range(10, 20, 2) = [10, 12, 14, 16, 18, 20]
35
- * @param start - start range
36
- * @param end - start end
37
- * @param step - step size
38
- * @returns range numbers
39
- */
40
- const range = (start, end, step = 1) => Array.from(Array(Math.ceil((end + 1 - start) / step)).keys()).map(x => start + x * step);
41
- const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class MgPagination extends HTMLElement {
42
- constructor(registerHost) {
43
- super();
44
- if (registerHost !== false) {
45
- this.__registerHost();
46
- }
47
- this.__attachShadow();
48
- this.currentPageChange = createEvent(this, "current-page-change", 7);
49
- /**
50
- * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
51
- * If not set, it will be created.
52
- */
53
- this.identifier = createID('mg-pagination');
54
- /**
55
- * Hide navigation label
56
- */
57
- this.hideNavigationLabels = false;
58
- /**
59
- * Hide select input
60
- */
61
- this.hidePageCount = false;
62
- /**
63
- * Component total pages
64
- */
65
- this.totalPages = 1;
66
- /**
67
- * Component current page
68
- */
69
- this.currentPage = 1;
70
- /**
71
- * Change current page from target
72
- * @param target - target page
73
- */
74
- this.goToPage = (target) => {
75
- this.currentPage = target;
76
- };
77
- /************
78
- * Handlers *
79
- ************/
80
- /**
81
- * select handler
82
- * @param event - value change event
83
- */
84
- this.handleSelect = (event) => {
85
- const to = Number(event.target.value);
86
- this.goToPage(to > 0 ? to : 1);
87
- };
88
- /**
89
- * Go to 'previous/next' page button handler
90
- * @param action - navigation action
91
- * @param disabled - button disable state
92
- */
93
- this.handleGoToPage = (action, disabled) => {
94
- !disabled && this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
95
- };
96
- }
97
- watchIdentifier(newValue) {
98
- if (!isValideID(newValue)) {
99
- console.error(`<mg-pagination> prop "identifier" value is invalid. Passed value: ${toString(newValue)}.`);
100
- }
101
- }
102
- validateTotalPages(newValue) {
103
- if (newValue < 1) {
104
- throw new Error(`<mg-pagination> prop "totalPages" must be greater than 0. Passed value: ${toString(newValue)}.`);
105
- }
106
- }
107
- validateCurrentPage(newValue) {
108
- if (newValue < 1) {
109
- throw new Error(`<mg-pagination> prop "currentPage" must be greater than 0. Passed value: ${toString(newValue)}.`);
110
- }
111
- else if (newValue > this.totalPages) {
112
- throw new Error('<mg-pagination> prop "currentPage" can not be greater than total page.');
113
- }
114
- this.currentPageChange.emit(newValue);
115
- }
116
- watchPaginationMessages(newValue) {
117
- if (Boolean(newValue) && (typeof newValue !== 'object' || !['next', 'previous', 'nextLabel', 'previousLabel'].every(key => isValidString(newValue[key])))) {
118
- throw new Error('<mg-pagination> prop "messages" must be a valid "PaginationMessagesType".');
119
- }
120
- }
121
- /*************
122
- * Lifecycle *
123
- *************/
124
- /**
125
- * Check if props are well configured on init
126
- */
127
- componentWillLoad() {
128
- // Get locales
129
- this.localesMessages = initLocales(this.element).messages;
130
- // Validate
131
- this.watchIdentifier(this.identifier);
132
- this.validateTotalPages(this.totalPages);
133
- this.validateCurrentPage(this.currentPage);
134
- this.watchPaginationMessages(this.messages);
135
- // Set default label
136
- if (this.label === undefined || this.label === '') {
137
- this.label = this.localesMessages.pagination.label;
138
- }
139
- }
140
- /**
141
- * Render
142
- * @returns HTML Element
143
- */
144
- render() {
145
- var _a, _b, _c, _d, _e, _f, _g, _h;
146
- const navigationMessages = {
147
- next: (_b = (_a = this.messages) === null || _a === void 0 ? void 0 : _a.next) !== null && _b !== void 0 ? _b : this.localesMessages.general.next,
148
- previous: (_d = (_c = this.messages) === null || _c === void 0 ? void 0 : _c.previous) !== null && _d !== void 0 ? _d : this.localesMessages.general.previous,
149
- nextLabel: (_f = (_e = this.messages) === null || _e === void 0 ? void 0 : _e.nextLabel) !== null && _f !== void 0 ? _f : this.localesMessages.pagination.nextLabel,
150
- previousLabel: (_h = (_g = this.messages) === null || _g === void 0 ? void 0 : _g.previousLabel) !== null && _h !== void 0 ? _h : this.localesMessages.pagination.previousLabel,
151
- };
152
- const navigationActionButton = (disabled, action) => {
153
- return (h("mg-button", { label: navigationMessages[`${action}Label`],
154
- // eslint-disable-next-line react/jsx-no-bind
155
- onClick: () => this.handleGoToPage(action, disabled), disabled: disabled, variant: "flat", isIcon: this.hideNavigationLabels }, action === NavigationAction.PREVIOUS && h("mg-icon", { icon: "chevron-left" }), !this.hideNavigationLabels && navigationMessages[action], action === NavigationAction.NEXT && h("mg-icon", { icon: "chevron-right" })));
156
- };
157
- return (h(Host, { hidden: this.totalPages < 2 }, h("nav", { role: "navigation", "aria-label": this.label, id: this.identifier, class: { 'mg-c-pagination': true, 'mg-c-pagination--hide-page-count': this.hidePageCount } }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), !this.hidePageCount && (h("div", { class: "mg-c-pagination__page-count" }, h("mg-input-select", { identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: this.localesMessages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true }), h("span", { class: "mg-u-visually-hidden" }, this.localesMessages.pagination.page, " ", this.currentPage), "/ ", this.totalPages, " ", this.totalPages > 1 ? this.localesMessages.pagination.pages : this.localesMessages.pagination.page)), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT))));
158
- }
159
- get element() { return this; }
160
- static get watchers() { return {
161
- "identifier": ["watchIdentifier"],
162
- "totalPages": ["validateTotalPages"],
163
- "currentPage": ["validateCurrentPage"],
164
- "messages": ["watchPaginationMessages"]
165
- }; }
166
- static get style() { return mgPaginationCss; }
167
- }, [257, "mg-pagination", {
168
- "identifier": [1],
169
- "label": [1025],
170
- "hideNavigationLabels": [4, "hide-navigation-labels"],
171
- "hidePageCount": [4, "hide-page-count"],
172
- "totalPages": [2, "total-pages"],
173
- "currentPage": [1538, "current-page"],
174
- "messages": [16]
175
- }, undefined, {
176
- "identifier": ["watchIdentifier"],
177
- "totalPages": ["validateTotalPages"],
178
- "currentPage": ["validateCurrentPage"],
179
- "messages": ["watchPaginationMessages"]
180
- }]);
181
- function defineCustomElement$1() {
182
- if (typeof customElements === "undefined") {
183
- return;
184
- }
185
- const components = ["mg-pagination", "mg-button", "mg-icon", "mg-input", "mg-input-select", "mg-input-title", "mg-tooltip", "mg-tooltip-content"];
186
- components.forEach(tagName => { switch (tagName) {
187
- case "mg-pagination":
188
- if (!customElements.get(tagName)) {
189
- customElements.define(tagName, MgPagination$1);
190
- }
191
- break;
192
- case "mg-button":
193
- if (!customElements.get(tagName)) {
194
- defineCustomElement$8();
195
- }
196
- break;
197
- case "mg-icon":
198
- if (!customElements.get(tagName)) {
199
- defineCustomElement$7();
200
- }
201
- break;
202
- case "mg-input":
203
- if (!customElements.get(tagName)) {
204
- defineCustomElement$6();
205
- }
206
- break;
207
- case "mg-input-select":
208
- if (!customElements.get(tagName)) {
209
- defineCustomElement$5();
210
- }
211
- break;
212
- case "mg-input-title":
213
- if (!customElements.get(tagName)) {
214
- defineCustomElement$4();
215
- }
216
- break;
217
- case "mg-tooltip":
218
- if (!customElements.get(tagName)) {
219
- defineCustomElement$3();
220
- }
221
- break;
222
- case "mg-tooltip-content":
223
- if (!customElements.get(tagName)) {
224
- defineCustomElement$2();
225
- }
226
- break;
227
- } });
228
- }
229
- defineCustomElement$1();
230
-
231
- const MgPagination = MgPagination$1;
232
- const defineCustomElement = defineCustomElement$1;
233
-
234
- export { MgPagination, defineCustomElement };
1
+ import{transformTag as t,proxyCustomElement as i,HTMLElement as e,createEvent as a,h as s,Host as n}from"@stencil/core/internal/client";import{c as o,a as r,t as m,i as g}from"./index2.js";import{i as l}from"./index3.js";import{d as h}from"./mg-button2.js";import{d as p}from"./mg-icon2.js";import{d as c}from"./mg-input2.js";import{d as u}from"./mg-input-select2.js";import{d}from"./mg-input-title2.js";import{d as v}from"./mg-tooltip2.js";import{d as b}from"./mg-tooltip-content2.js";const f="next",P="previous",w=(t,i,e=1)=>Array.from(Array(Math.ceil((i+1-t)/e)).keys()).map((i=>t+i*e)),E=i(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.currentPageChange=a(this,"current-page-change",7),this.identifier=o("mg-pagination"),this.hideNavigationLabels=!1,this.hidePageCount=!1,this.totalPages=1,this.currentPage=1,this.goToPage=t=>{this.currentPage=t},this.handleSelect=t=>{const i=Number(t.target.value);this.goToPage(i>0?i:1)},this.handleGoToPage=(t,i)=>{!i&&this.goToPage(t===f?this.currentPage+1:this.currentPage-1)}}watchIdentifier(t){r(t)||console.error(`<mg-pagination> prop "identifier" value is invalid. Passed value: ${m(t)}.`)}validateTotalPages(t){if(t<1)throw Error(`<mg-pagination> prop "totalPages" must be greater than 0. Passed value: ${m(t)}.`)}validateCurrentPage(t){if(t<1)throw Error(`<mg-pagination> prop "currentPage" must be greater than 0. Passed value: ${m(t)}.`);if(t>this.totalPages)throw Error('<mg-pagination> prop "currentPage" can not be greater than total page.');this.currentPageChange.emit(t)}watchPaginationMessages(t){if(t&&("object"!=typeof t||!["next","previous","nextLabel","previousLabel"].every((i=>g(t[i])))))throw Error('<mg-pagination> prop "messages" must be a valid "PaginationMessagesType".')}componentWillLoad(){this.localesMessages=l(this.element).messages,this.watchIdentifier(this.identifier),this.validateTotalPages(this.totalPages),this.validateCurrentPage(this.currentPage),this.watchPaginationMessages(this.messages),void 0!==this.label&&""!==this.label||(this.label=this.localesMessages.pagination.label)}render(){var t,i,e,a,o,r,m,g;const l={next:null!==(i=null===(t=this.messages)||void 0===t?void 0:t.next)&&void 0!==i?i:this.localesMessages.general.next,previous:null!==(a=null===(e=this.messages)||void 0===e?void 0:e.previous)&&void 0!==a?a:this.localesMessages.general.previous,nextLabel:null!==(r=null===(o=this.messages)||void 0===o?void 0:o.nextLabel)&&void 0!==r?r:this.localesMessages.pagination.nextLabel,previousLabel:null!==(g=null===(m=this.messages)||void 0===m?void 0:m.previousLabel)&&void 0!==g?g:this.localesMessages.pagination.previousLabel},h=(t,i)=>s("mg-button",{label:l[i+"Label"],onClick:()=>this.handleGoToPage(i,t),disabled:t,variant:"flat",isIcon:this.hideNavigationLabels},i===P&&s("mg-icon",{icon:"chevron-left"}),!this.hideNavigationLabels&&l[i],i===f&&s("mg-icon",{icon:"chevron-right"}));return s(n,{hidden:this.totalPages<2},s("nav",{role:"navigation","aria-label":this.label,id:this.identifier,class:{"mg-c-pagination":!0,"mg-c-pagination--hide-page-count":this.hidePageCount}},h(this.currentPage<=1,P),!this.hidePageCount&&s("div",{class:"mg-c-pagination__page-count"},s("mg-input-select",{identifier:this.identifier+"-select",items:w(1,this.totalPages).map((t=>""+t)),label:this.localesMessages.pagination.selectPage,"label-hide":!0,"on-value-change":this.handleSelect,value:""+this.currentPage,"placeholder-hide":!0}),s("span",{class:"mg-u-visually-hidden"},this.localesMessages.pagination.page," ",this.currentPage),"/ ",this.totalPages," ",this.totalPages>1?this.localesMessages.pagination.pages:this.localesMessages.pagination.page),h(this.currentPage>=this.totalPages,f)))}get element(){return this}static get watchers(){return{identifier:[{watchIdentifier:0}],totalPages:[{validateTotalPages:0}],currentPage:[{validateCurrentPage:0}],messages:[{watchPaginationMessages: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-pagination{display:flex;align-items:center;gap:var(--mg-b-spacing-actions)}.mg-c-pagination__page-count{display:flex;align-items:center;gap:var(--mg-b-size-4)}.mg-c-pagination.mg-c-pagination--hide-page-count{gap:0}"}},[1,"mg-pagination",{identifier:[1],label:[1025],hideNavigationLabels:[4,"hide-navigation-labels"],hidePageCount:[4,"hide-page-count"],totalPages:[2,"total-pages"],currentPage:[1538,"current-page"],messages:[16]},void 0,{identifier:[{watchIdentifier:0}],totalPages:[{validateTotalPages:0}],currentPage:[{validateCurrentPage:0}],messages:[{watchPaginationMessages:0}]}]);function x(){"undefined"!=typeof customElements&&["mg-pagination","mg-button","mg-icon","mg-input","mg-input-select","mg-input-title","mg-tooltip","mg-tooltip-content"].forEach((i=>{switch(i){case"mg-pagination":customElements.get(t(i))||customElements.define(t(i),E);break;case"mg-button":customElements.get(t(i))||h();break;case"mg-icon":customElements.get(t(i))||p();break;case"mg-input":customElements.get(t(i))||c();break;case"mg-input-select":customElements.get(t(i))||u();break;case"mg-input-title":customElements.get(t(i))||d();break;case"mg-tooltip":customElements.get(t(i))||v();break;case"mg-tooltip-content":customElements.get(t(i))||b()}}))}x();const j=E,y=x;export{j as MgPagination,y as defineCustomElement}