@mgdis/mg-components 4.0.1 → 4.1.1

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 (124) hide show
  1. package/dist/.storybook/utils.js +24 -0
  2. package/dist/cjs/{index-a39c5567.js → index-179621c8.js} +11 -0
  3. package/dist/cjs/{index-88560a66.js → index-dd2c7f7b.js} +47 -0
  4. package/dist/cjs/loader.cjs.js +3 -3
  5. package/dist/cjs/{mg-badge_21.cjs.entry.js → mg-badge_24.cjs.entry.js} +2363 -214
  6. package/dist/cjs/mg-components.cjs.js +26 -3
  7. package/dist/cjs/mg-modal.cjs.entry.js +2 -2
  8. package/dist/collection/collection-manifest.json +3 -1
  9. package/dist/collection/components/atoms/mg-badge/doc/mg-badge.stories.js +9 -5
  10. package/dist/collection/components/atoms/mg-button/doc/mg-button.stories.js +15 -12
  11. package/dist/collection/components/atoms/mg-button/mg-button.conf.js +4 -0
  12. package/dist/collection/components/atoms/mg-button/mg-button.js +46 -20
  13. package/dist/collection/components/atoms/mg-character-left/doc/mg-character-left.stories.js +9 -12
  14. package/dist/collection/components/atoms/mg-icon/doc/mg-icon.stories.js +11 -3
  15. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +13 -0
  16. package/dist/collection/components/atoms/mg-input-title/doc/mg-input-title.stories.js +9 -9
  17. package/dist/collection/components/atoms/mg-tag/doc/mg-tag.stories.js +9 -7
  18. package/dist/collection/components/atoms/mg-tooltip/doc/mg-tooltip.stories.js +27 -8
  19. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +6 -0
  20. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +64 -11
  21. package/dist/collection/components/molecules/inputs/mg-input-checkbox/doc/mg-input-checkbox.stories.js +3 -15
  22. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +4 -3
  23. package/dist/collection/components/molecules/inputs/mg-input-date/doc/mg-input-date.stories.js +3 -12
  24. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +4 -3
  25. package/dist/collection/components/molecules/inputs/mg-input-numeric/doc/mg-input-numeric.stories.js +3 -14
  26. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +4 -3
  27. package/dist/collection/components/molecules/inputs/mg-input-password/doc/mg-input-password.stories.js +3 -14
  28. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +4 -3
  29. package/dist/collection/components/molecules/inputs/mg-input-radio/doc/mg-input-radio.stories.js +3 -14
  30. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +4 -3
  31. package/dist/collection/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.js +3 -16
  32. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +4 -3
  33. package/dist/collection/components/molecules/inputs/mg-input-text/doc/mg-input-text.stories.js +11 -22
  34. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +4 -3
  35. package/dist/collection/components/molecules/inputs/mg-input-textarea/doc/mg-input-textarea.stories.js +4 -13
  36. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +4 -3
  37. package/dist/collection/components/molecules/inputs/mg-input-toggle/doc/mg-input-toggle.stories.js +17 -38
  38. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +4 -3
  39. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +16 -7
  40. package/dist/collection/components/molecules/mg-details/doc/mg-details.stories.js +25 -0
  41. package/dist/collection/components/molecules/mg-details/mg-details.css +14 -0
  42. package/dist/collection/components/molecules/mg-details/mg-details.js +141 -0
  43. package/dist/collection/components/molecules/mg-form/doc/mg-form.stories.js +9 -6
  44. package/dist/collection/components/molecules/mg-form/mg-form.css +1 -1
  45. package/dist/collection/components/molecules/mg-form/mg-form.js +48 -4
  46. package/dist/collection/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.js +22 -0
  47. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.css +37 -0
  48. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +74 -0
  49. package/dist/collection/components/molecules/mg-message/doc/mg-message.stories.js +9 -15
  50. package/dist/collection/components/molecules/mg-modal/doc/mg-modal.stories.js +23 -31
  51. package/dist/collection/components/molecules/mg-pagination/doc/mg-pagination.stories.js +7 -11
  52. package/dist/collection/components/molecules/mg-panel/doc/mg-panel.stories.js +16 -26
  53. package/dist/collection/components/molecules/mg-panel/mg-panel.js +1 -6
  54. package/dist/collection/components/molecules/mg-popover/doc/mg-popover.stories.js +13 -17
  55. package/dist/collection/components/molecules/mg-popover/mg-popover.css +1 -1
  56. package/dist/collection/components/molecules/mg-popover/mg-popover.js +24 -8
  57. package/dist/collection/components/molecules/mg-tabs/doc/mg-tabs.stories.js +11 -12
  58. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +14 -14
  59. package/dist/collection/stories/helpers.stories.js +11 -3
  60. package/dist/collection/stories/icons.stories.js +10 -2
  61. package/dist/collection/stories/typography.stories.js +8 -1
  62. package/dist/collection/utils/components.utils.js +10 -0
  63. package/dist/components/components.utils.js +11 -1
  64. package/dist/components/index.d.ts +25 -23
  65. package/dist/components/index.js +2 -0
  66. package/dist/components/mg-button2.js +6 -14
  67. package/dist/components/mg-details.d.ts +11 -0
  68. package/dist/components/mg-details.js +87 -0
  69. package/dist/components/mg-form.js +35 -5
  70. package/dist/components/mg-icon2.js +13 -0
  71. package/dist/components/mg-illustrated-message.d.ts +11 -0
  72. package/dist/components/mg-illustrated-message.js +68 -0
  73. package/dist/components/mg-input-checkbox.js +1 -1
  74. package/dist/components/mg-input-date.js +1 -1
  75. package/dist/components/mg-input-numeric.js +1 -1
  76. package/dist/components/mg-input-password.js +1 -1
  77. package/dist/components/mg-input-radio.js +1 -1
  78. package/dist/components/mg-input-select2.js +1 -1
  79. package/dist/components/mg-input-text2.js +1 -1
  80. package/dist/components/mg-input-textarea.js +1 -1
  81. package/dist/components/mg-input-toggle.js +17 -8
  82. package/dist/components/mg-panel.js +0 -4
  83. package/dist/components/mg-popover.js +10 -9
  84. package/dist/components/mg-tabs.js +5 -4
  85. package/dist/components/mg-tooltip2.js +73 -11
  86. package/dist/esm/{index-e51ae032.js → index-7efedd97.js} +11 -1
  87. package/dist/esm/{index-bca81100.js → index-f58b769f.js} +47 -1
  88. package/dist/esm/loader.js +3 -3
  89. package/dist/esm/{mg-badge_21.entry.js → mg-badge_24.entry.js} +2360 -214
  90. package/dist/esm/mg-components.js +26 -3
  91. package/dist/esm/mg-modal.entry.js +2 -2
  92. package/dist/mg-components/mg-components.css +1 -1
  93. package/dist/mg-components/mg-components.esm.js +1 -1
  94. package/dist/mg-components/{p-462d648a.entry.js → p-2a3d8f60.entry.js} +1 -1
  95. package/dist/mg-components/p-5f89600c.js +1 -0
  96. package/dist/mg-components/p-b6df1cac.js +2 -0
  97. package/dist/mg-components/p-c8779533.entry.js +1 -0
  98. package/dist/types/components/atoms/mg-button/doc/mg-button.stories.d.ts +6 -0
  99. package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +8 -0
  100. package/dist/types/components/atoms/mg-button/mg-button.d.ts +11 -0
  101. package/dist/types/components/atoms/mg-character-left/doc/mg-character-left.stories.d.ts +0 -10
  102. package/dist/types/components/atoms/mg-tooltip/doc/mg-tooltip.stories.d.ts +1 -6
  103. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +5 -0
  104. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +25 -1
  105. package/dist/types/components/molecules/mg-details/doc/mg-details.stories.d.ts +11 -0
  106. package/dist/types/components/molecules/mg-details/mg-details.d.ts +49 -0
  107. package/dist/types/components/molecules/mg-form/mg-form.d.ts +13 -0
  108. package/dist/types/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.d.ts +6 -0
  109. package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +28 -0
  110. package/dist/types/components/molecules/mg-popover/doc/mg-popover.stories.d.ts +4 -1
  111. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +6 -1
  112. package/dist/types/components.d.ts +95 -0
  113. package/dist/types/home/runner/work/mg-components/mg-components/.stencil/.storybook/utils.d.ts +1 -0
  114. package/dist/types/utils/components.utils.d.ts +8 -0
  115. package/package.json +11 -11
  116. package/dist/cjs/mg-popover.cjs.entry.js +0 -170
  117. package/dist/cjs/popper-71bf3058.js +0 -1790
  118. package/dist/esm/mg-popover.entry.js +0 -166
  119. package/dist/esm/popper-93ecb064.js +0 -1788
  120. package/dist/mg-components/p-4c66f794.js +0 -1
  121. package/dist/mg-components/p-5126ab10.entry.js +0 -1
  122. package/dist/mg-components/p-766c918b.entry.js +0 -1
  123. package/dist/mg-components/p-780bd52d.js +0 -1
  124. package/dist/mg-components/p-b14a3443.js +0 -2
@@ -1,44 +1,36 @@
1
1
  /* eslint-disable react/jsx-no-bind */
2
2
  import { h } from '@stencil/core';
3
+ import { filterArgs } from '../../../../../.storybook/utils';
3
4
  export default {
4
5
  component: 'mg-modal',
5
6
  title: 'Molecules/mg-modal',
6
7
  parameters: { actions: { handles: ['component-show', 'component-hide'] } },
7
8
  };
8
9
  /**
9
- * 1. camelCase arguments must be written in the template, for exemple labelOnTop must be placed in the template as label-on-top={args.labelOnTop}
10
- * 2. boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
10
+ * Template
11
+ *
12
+ * @param {any} args component arguments
13
+ * @returns {HTMLElement} HTMLElement
11
14
  */
12
- const Template = args => {
13
- // Extract slot so it won't be render as an attribute
14
- const slotContent = args.slotContent;
15
- delete args.slotContent;
16
- const slotActions = args.slotActions;
17
- delete args.slotActions;
18
- const closeButton = args.closeButton;
19
- delete args.closeButton;
20
- const modalTitle = args.modalTitle;
21
- delete args.modalTitle;
22
- // return element
23
- return (h("div", null,
24
- h("mg-button", { controls: "identifier", haspopup: "dialog", onClick: () => {
25
- const mgModal = document.querySelector('mg-modal');
26
- const isHide = mgModal.hide === true;
27
- if (isHide) {
28
- mgModal.removeAttribute('hide'); // storybook first render is an attribute then we use property
29
- mgModal.hide = false;
30
- }
31
- else {
32
- mgModal.hide = true;
33
- }
34
- } }, "Open modal"),
35
- h("mg-modal", Object.assign({}, args, { "close-button": closeButton, "modal-title": modalTitle }),
36
- slotContent && h("span", { slot: "content", innerHTML: slotContent }),
37
- slotActions && h("span", { slot: "actions", innerHTML: slotActions }))));
38
- };
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
+ const Template = (args) => (h("div", null,
17
+ h("mg-button", { controls: "identifier", haspopup: "dialog", onClick: () => {
18
+ const mgModal = document.querySelector('mg-modal');
19
+ const isHide = mgModal.hide === true;
20
+ if (isHide) {
21
+ mgModal.removeAttribute('hide'); // storybook first render is an attribute then we use property
22
+ mgModal.hide = false;
23
+ }
24
+ else {
25
+ mgModal.hide = true;
26
+ }
27
+ } }, "Open modal"),
28
+ h("mg-modal", Object.assign({}, filterArgs(args)),
29
+ args.slotContent && h("div", { slot: "content", innerHTML: args.slotContent }),
30
+ args.slotActions && h("div", { slot: "actions", innerHTML: args.slotActions }))));
39
31
  export const MgModal = Template.bind({});
40
32
  MgModal.args = {
41
- slotContent: `<p slot="content">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>`,
33
+ slotContent: `<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>`,
42
34
  slotActions: ``,
43
35
  modalTitle: 'Modal title',
44
36
  identifier: 'identifier',
@@ -48,4 +40,4 @@ MgModal.args = {
48
40
  export const WithCloseButton = Template.bind({});
49
41
  WithCloseButton.args = Object.assign(Object.assign({}, MgModal.args), { closeButton: true });
50
42
  export const WithActions = Template.bind({});
51
- WithActions.args = Object.assign(Object.assign({}, MgModal.args), { closeButton: true, slotActions: `<div slot="actions" class="mg-group-elements mg-group-elements--align-right"><mg-button>Primary</mg-button><mg-button variant="secondary">Secondary</mg-button></div>` });
43
+ WithActions.args = Object.assign(Object.assign({}, MgModal.args), { closeButton: true, slotActions: `<div class="mg-group-elements mg-group-elements--align-right"><mg-button>Primary</mg-button><mg-button variant="secondary">Secondary</mg-button></div>` });
@@ -1,22 +1,18 @@
1
1
  import { h } from '@stencil/core';
2
+ import { filterArgs } from '../../../../../.storybook/utils';
2
3
  export default {
3
4
  component: 'mg-pagination',
4
5
  title: 'Molecules/mg-pagination',
5
6
  parameters: { actions: { handles: ['current-page-change'] } },
6
7
  };
7
8
  /**
8
- * 1. camelCase arguments must be written in the template, for exemple labelOnTop must be placed in the template as label-on-top={args.labelOnTop}
9
- * 2. boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
9
+ * Template
10
+ *
11
+ * @param {any} args component arguments
12
+ * @returns {HTMLElement} HTMLElement
10
13
  */
11
- const Template = args => {
12
- // Extract slot so it won't be render as an attribute
13
- const totalPages = args.totalPages;
14
- delete args.totalPages;
15
- const currentPage = args.currentPage;
16
- delete args.currentPage;
17
- // return element
18
- return h("mg-pagination", Object.assign({}, args, { "total-pages": totalPages, "current-page": currentPage }));
19
- };
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
+ const Template = (args) => h("mg-pagination", Object.assign({}, filterArgs(args)));
20
16
  export const MgPagination = Template.bind({});
21
17
  MgPagination.args = {
22
18
  totalPages: 5,
@@ -1,39 +1,29 @@
1
1
  import { h } from '@stencil/core';
2
+ import { filterArgs } from '../../../../../.storybook/utils';
2
3
  export default {
3
4
  component: 'mg-panel',
4
5
  title: 'Molecules/mg-panel',
5
- parameters: { actions: { handles: ['title-change'] } },
6
+ parameters: { actions: { handles: ['title-change', 'expanded-change'] } },
6
7
  };
7
8
  /**
8
- * 1. camelCase arguments must be written in the template, for exemple labelOnTop must be placed in the template as label-on-top={args.labelOnTop}
9
- * 2. boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
9
+ * Template
10
+ *
11
+ * @param {any} args component arguments
12
+ * @returns {HTMLElement} HTMLElement
10
13
  */
11
- const Template = args => {
12
- // Extract slot so it won't be render as an attribute
13
- const panelTitle = args.panelTitle;
14
- delete args.panelTitle;
15
- const titleEditable = args.titleEditable;
16
- delete args.titleEditable;
17
- const expandToggleDisabled = args.expandToggleDisabled;
18
- delete args.expandToggleDisabled;
19
- const titlePattern = args.titlePattern;
20
- delete args.titlePattern;
21
- const titlePatternErrorMessage = args.titlePatternErrorMessage;
22
- delete args.titlePatternErrorMessage;
23
- // return element
24
- return (h("mg-panel", Object.assign({}, args, { "panel-title": panelTitle, "title-editable": titleEditable, "expand-toggle-disabled": expandToggleDisabled, "title-pattern": titlePattern, "title-pattern-error-message": titlePatternErrorMessage }),
25
- h("div", null, "Content"),
26
- h("div", { slot: "header-right" },
27
- h("mg-button", { variant: "secondary" },
28
- h("mg-icon", { icon: "file-upload" }),
29
- " Upload"),
30
- h("mg-button", { "is-icon": true, variant: "secondary", label: "delete" },
31
- h("mg-icon", { icon: "trash" })))));
32
- };
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
+ const Template = (args) => (h("mg-panel", Object.assign({}, filterArgs(args)),
16
+ h("div", null, "Content"),
17
+ h("div", { slot: "header-right" },
18
+ h("mg-button", { variant: "secondary" },
19
+ h("mg-icon", { icon: "file-upload" }),
20
+ " Upload"),
21
+ h("mg-button", Object.assign({}, filterArgs({ isIcon: true }), { variant: "secondary", label: "delete" }),
22
+ h("mg-icon", { icon: "trash" })))));
33
23
  export const MgPanel = Template.bind({});
34
24
  MgPanel.args = {
35
25
  panelTitle: 'title',
36
26
  expanded: false,
37
27
  titleEditable: true,
38
- expandToggleDisabled: true,
28
+ expandToggleDisabled: false,
39
29
  };
@@ -12,10 +12,6 @@ export class MgPanel {
12
12
  * Panel is opened
13
13
  */
14
14
  this.expanded = false;
15
- /**
16
- * Disable possibility to toggle expand
17
- */
18
- this.expandToggleDisabled = false;
19
15
  /**
20
16
  * Panel title is editabled
21
17
  */
@@ -284,8 +280,7 @@ export class MgPanel {
284
280
  "text": "Disable possibility to toggle expand"
285
281
  },
286
282
  "attribute": "expand-toggle-disabled",
287
- "reflect": false,
288
- "defaultValue": "false"
283
+ "reflect": false
289
284
  },
290
285
  "titleEditable": {
291
286
  "type": "boolean",
@@ -1,4 +1,5 @@
1
1
  import { h } from '@stencil/core';
2
+ import { filterArgs } from '../../../../../.storybook/utils';
2
3
  import { placements } from '../mg-popover.conf';
3
4
  export default {
4
5
  component: 'mg-popover',
@@ -6,35 +7,29 @@ export default {
6
7
  parameters: {
7
8
  layout: 'centered',
8
9
  docs: { iframeHeight: 600 },
10
+ actions: { handles: ['display-change'] },
9
11
  },
10
12
  argTypes: {
11
13
  placement: {
12
14
  options: placements,
13
15
  control: { type: 'select' },
14
16
  table: {
15
- defaultValue: { summary: placements[0] },
17
+ defaultValue: { summary: 'bottom' },
16
18
  },
17
19
  },
18
20
  },
19
21
  };
20
22
  /**
21
- * 1. camelCase arguments must be written in the template, for exemple labelOnTop must be placed in the template as label-on-top={args.labelOnTop}
22
- * 2. boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
23
+ * Template
24
+ *
25
+ * @param {any} args component arguments
26
+ * @returns {HTMLElement} HTMLElement
23
27
  */
24
- const Template = args => {
25
- // Extract slot so it won't be render as an attribute
26
- const slotTitle = args.slotTitle;
27
- delete args.slotTitle;
28
- const slotContent = args.slotContent;
29
- delete args.slotContent;
30
- const closeButton = args.closeButton;
31
- delete args.closeButton;
32
- // return element
33
- return (h("mg-popover", Object.assign({}, args, { "close-button": closeButton }),
34
- h("mg-button", null, "Button"),
35
- slotTitle && h("h2", { slot: "title" }, slotTitle),
36
- slotContent && h("p", { slot: "content" }, slotContent)));
37
- };
28
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
+ const Template = (args) => (h("mg-popover", Object.assign({}, filterArgs(args, { placement: 'bottom' })),
30
+ h("mg-button", null, "Button"),
31
+ args.slotTitle && h("h2", { slot: "title" }, args.slotTitle),
32
+ args.slotContent && h("p", { slot: "content" }, args.slotContent)));
38
33
  export const MgPopover = Template.bind({});
39
34
  MgPopover.args = {
40
35
  slotTitle: `Blu bli blo bla`,
@@ -43,4 +38,5 @@ MgPopover.args = {
43
38
  closeButton: false,
44
39
  disabled: false,
45
40
  display: false,
41
+ placement: undefined,
46
42
  };
@@ -52,7 +52,7 @@ mg-popover::slotted(*) {
52
52
  left: -6px;
53
53
  }
54
54
 
55
- .mg-popover__title ::slotted(*) {
55
+ .mg-popover__title ::slotted([slot=title]) {
56
56
  margin: 0 0 1rem;
57
57
  font-size: var(--mg-popover-title-font-size);
58
58
  font-weight: 600;
@@ -1,5 +1,5 @@
1
- import { Component, Element, Host, h, Prop, Watch } from '@stencil/core';
2
- import { createID } from '../../../utils/components.utils';
1
+ import { Component, Element, Host, h, Prop, Watch, Event } from '@stencil/core';
2
+ import { createID, isTagName } from '../../../utils/components.utils';
3
3
  import { createPopper } from '@popperjs/core';
4
4
  import { initLocales } from '../../../locales';
5
5
  export class MgPopover {
@@ -78,13 +78,14 @@ export class MgPopover {
78
78
  this.display = false;
79
79
  };
80
80
  }
81
- handleDisplay(newVal) {
82
- if (newVal) {
81
+ handleDisplay(newValue) {
82
+ if (newValue) {
83
83
  this.show();
84
84
  }
85
85
  else {
86
86
  this.hide();
87
87
  }
88
+ this.displayChange.emit(newValue);
88
89
  }
89
90
  /*************
90
91
  * Lifecycle *
@@ -104,11 +105,10 @@ export class MgPopover {
104
105
  * @returns {void}
105
106
  */
106
107
  componentDidLoad() {
107
- //Check if slotted title is a heading
108
- const headingElements = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
108
+ const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
109
109
  const slotedTitleElement = this.element.querySelector('[slot="title"]');
110
- if (slotedTitleElement !== null && !headingElements.includes(slotedTitleElement.tagName.toLowerCase())) {
111
- throw new Error(`<mg-popover> Slotted title must be a heading: ${headingElements.join(', ')}.`);
110
+ if (slotedTitleElement && !isTagName(slotedTitleElement, headingTags)) {
111
+ throw new Error(`<mg-popover> Slotted title must be a heading: ${headingTags.join(', ')}`);
112
112
  }
113
113
  // Set close button id
114
114
  if (this.closeButton) {
@@ -266,6 +266,22 @@ export class MgPopover {
266
266
  "defaultValue": "false"
267
267
  }
268
268
  }; }
269
+ static get events() { return [{
270
+ "method": "displayChange",
271
+ "name": "display-change",
272
+ "bubbles": true,
273
+ "cancelable": true,
274
+ "composed": true,
275
+ "docs": {
276
+ "tags": [],
277
+ "text": "Emited event when display value change"
278
+ },
279
+ "complexType": {
280
+ "original": "boolean",
281
+ "resolved": "boolean",
282
+ "references": {}
283
+ }
284
+ }]; }
269
285
  static get elementRef() { return "element"; }
270
286
  static get watchers() { return [{
271
287
  "propName": "display",
@@ -1,4 +1,5 @@
1
1
  import { h } from '@stencil/core';
2
+ import { filterArgs } from '../../../../../.storybook/utils';
2
3
  import { sizes, Status } from '../mg-tabs.conf';
3
4
  export default {
4
5
  component: 'mg-tabs',
@@ -12,19 +13,17 @@ export default {
12
13
  parameters: { actions: { handles: ['active-tab-change'] } },
13
14
  };
14
15
  /**
15
- * 1. camelCase arguments must be written in the template, for exemple labelOnTop must be placed in the template as label-on-top={args.labelOnTop}
16
- * 2. boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
16
+ * Template
17
+ *
18
+ * @param {any} args component arguments
19
+ * @returns {HTMLElement} HTMLElement
17
20
  */
18
- const Template = args => {
19
- // return element
20
- const activeTab = args.activeTab;
21
- delete args.activeTab;
22
- return (h("mg-tabs", Object.assign({}, args, { "active-tab": activeTab }),
23
- h("div", { slot: "tab_content-1" }, "Content 1"),
24
- h("div", { slot: "tab_content-2" }, "Content 2"),
25
- h("div", { slot: "tab_content-3" }, "Content 3"),
26
- h("div", { slot: "tab_content-4" }, "Content 4")));
27
- };
21
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
+ const Template = (args) => (h("mg-tabs", Object.assign({}, filterArgs(args, { size: sizes[0], activeTab: 1 })),
23
+ h("div", { slot: "tab_content-1" }, "Content 1"),
24
+ h("div", { slot: "tab_content-2" }, "Content 2"),
25
+ h("div", { slot: "tab_content-3" }, "Content 3"),
26
+ h("div", { slot: "tab_content-4" }, "Content 4")));
28
27
  export const MgTabs = Template.bind({});
29
28
  MgTabs.args = {
30
29
  items: ['Tab 1', 'Tab 2', 'Tab 3', 'Tab 4'],
@@ -1,4 +1,4 @@
1
- import { Component, Event, h, Host, Prop, State, Element, Watch } from '@stencil/core';
1
+ import { Component, Event, h, Prop, State, Element, Watch } from '@stencil/core';
2
2
  import { createID, ClassList, allItemsAreString } from '../../../utils/components.utils';
3
3
  import { sizes, Status } from './mg-tabs.conf';
4
4
  /**
@@ -177,21 +177,21 @@ export class MgTabs {
177
177
  * @returns {HTMLElement} HTML Element
178
178
  */
179
179
  render() {
180
- return (h(Host, null,
181
- h("div", { class: this.classList.join() },
182
- h("header", { role: "tablist", "aria-label": this.label, class: "mg-tabs__header" }, this.tabs.map((tab, index) => (h("button", { role: "tab", id: this.getElementId(this.identifier, index), class: {
183
- [`${this.buttonTabBaseClass}`]: true,
184
- [`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.tabHasGivenStatus(tab, Status.ACTIVE),
185
- [`${this.getNavigationButtonClass(Status.DISABLED)}`]: this.tabHasGivenStatus(tab, Status.DISABLED),
186
- [`${this.getNavigationButtonClass(Status.HIDDEN)}`]: this.tabHasGivenStatus(tab, Status.HIDDEN),
187
- }, tabindex: this.tabHasGivenStatus(tab, Status.ACTIVE) ? 0 : -1, "aria-selected": this.tabHasGivenStatus(tab, Status.ACTIVE).toString(), "aria-controls": this.getElementId(this.tabPanel, index), onClick: this.handleClick, onKeyDown: this.handleKeydown, "data-index": this.getTabIndex(index), disabled: this.tabHasGivenStatus(tab, Status.DISABLED) },
188
- tab.icon !== undefined && h("mg-icon", { icon: tab.icon }),
189
- tab.label,
190
- tab.badge !== undefined && h("mg-badge", { variant: "info", value: tab.badge.value, label: tab.badge.label }))))),
191
- this.tabs.map((tab, index) => (h("article", { role: "tabpanel", id: this.getElementId(this.tabPanel, index), hidden: !this.tabHasGivenStatus(tab, Status.ACTIVE), "aria-labelledby": this.getElementId(this.identifier, index), tabindex: this.tabHasGivenStatus(tab, Status.ACTIVE) ? 0 : -1, class: "mg-tabs__content-container" },
192
- h("slot", { name: this.getElementId('tab_content', index) })))))));
180
+ return (h("div", { class: this.classList.join() },
181
+ h("header", { role: "tablist", "aria-label": this.label, class: "mg-tabs__header" }, this.tabs.map((tab, index) => (h("button", { role: "tab", id: this.getElementId(this.identifier, index), class: {
182
+ [`${this.buttonTabBaseClass}`]: true,
183
+ [`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.tabHasGivenStatus(tab, Status.ACTIVE),
184
+ [`${this.getNavigationButtonClass(Status.DISABLED)}`]: this.tabHasGivenStatus(tab, Status.DISABLED),
185
+ [`${this.getNavigationButtonClass(Status.HIDDEN)}`]: this.tabHasGivenStatus(tab, Status.HIDDEN),
186
+ }, tabindex: this.tabHasGivenStatus(tab, Status.ACTIVE) ? 0 : -1, "aria-selected": this.tabHasGivenStatus(tab, Status.ACTIVE).toString(), "aria-controls": this.getElementId(this.tabPanel, index), onClick: this.handleClick, onKeyDown: this.handleKeydown, "data-index": this.getTabIndex(index), disabled: this.tabHasGivenStatus(tab, Status.DISABLED) },
187
+ tab.icon !== undefined && h("mg-icon", { icon: tab.icon }),
188
+ tab.label,
189
+ tab.badge !== undefined && h("mg-badge", { variant: "info", value: tab.badge.value, label: tab.badge.label }))))),
190
+ this.tabs.map((tab, index) => (h("article", { role: "tabpanel", id: this.getElementId(this.tabPanel, index), hidden: !this.tabHasGivenStatus(tab, Status.ACTIVE), "aria-labelledby": this.getElementId(this.identifier, index), tabindex: this.tabHasGivenStatus(tab, Status.ACTIVE) ? 0 : -1, class: "mg-tabs__content-container" },
191
+ h("slot", { name: this.getElementId('tab_content', index) }))))));
193
192
  }
194
193
  static get is() { return "mg-tabs"; }
194
+ static get encapsulation() { return "shadow"; }
195
195
  static get originalStyleUrls() { return {
196
196
  "$": ["mg-tabs.scss"]
197
197
  }; }
@@ -1,4 +1,5 @@
1
1
  import { h } from '@stencil/core';
2
+ import { filterArgs } from '../../.storybook/utils';
2
3
  export default {
3
4
  title: 'Style/Helpers',
4
5
  argTypes: {
@@ -8,7 +9,14 @@ export default {
8
9
  },
9
10
  },
10
11
  };
11
- const Template = args => (h("div", null,
12
+ /**
13
+ * Template
14
+ *
15
+ * @param {any} args component arguments
16
+ * @returns {HTMLElement} HTMLElement
17
+ */
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
+ const Template = (args) => (h("div", null,
12
20
  h("h1", null, "Helpers"),
13
21
  h("h2", null, ".mg-group-elements"),
14
22
  h("p", null,
@@ -22,10 +30,10 @@ const Template = args => (h("div", null,
22
30
  h("h3", null, "Demo"),
23
31
  h("div", { class: `mg-group-elements${args.align === 'right' ? ' mg-group-elements--align-right' : ''}` },
24
32
  h("mg-button", null, "First Button"),
25
- h("mg-button", { label: "" },
33
+ h("mg-button", null,
26
34
  h("mg-icon", { icon: "info-circle" }),
27
35
  "Second Button"),
28
- h("mg-button", { "is-icon": true, label: "Third button" },
36
+ h("mg-button", Object.assign({}, filterArgs({ isIcon: true }), { label: "Third button" }),
29
37
  h("mg-icon", { icon: "info-circle" })))));
30
38
  export const Helpers = Template.bind({});
31
39
  Helpers.args = {
@@ -1,4 +1,5 @@
1
1
  import { h } from '@stencil/core';
2
+ import { filterArgs } from '../../.storybook/utils';
2
3
  import { icons, sizes } from '../components/atoms/mg-icon/mg-icon.conf';
3
4
  export default {
4
5
  title: 'Style/Icons',
@@ -9,9 +10,16 @@ export default {
9
10
  },
10
11
  },
11
12
  };
12
- const Template = args => (h("ul", { style: { display: 'flex', flexWrap: 'wrap', margin: '0', padding: '0', listStyle: 'none', textAlign: 'center' } }, Object.keys(icons).map((icon) => (h("li", { style: { margin: '1rem', padding: '1rem', width: '100px' } },
13
+ /**
14
+ * Template
15
+ *
16
+ * @param {any} args component arguments
17
+ * @returns {HTMLElement} HTMLElement
18
+ */
19
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
+ const Template = (args) => (h("ul", { style: { display: 'flex', flexWrap: 'wrap', margin: '0', padding: '0', listStyle: 'none', textAlign: 'center' } }, Object.keys(icons).map((icon) => (h("li", { style: { margin: '1rem', padding: '1rem', width: '100px' } },
13
21
  h("div", { style: { color: args.color, margin: '1rem' } },
14
- h("mg-icon", { icon: icon, size: args.size })),
22
+ h("mg-icon", Object.assign({}, filterArgs({ icon, size: args.size }, { size: 'regular' })))),
15
23
  h("div", null, icon))))));
16
24
  export const Icons = Template.bind({});
17
25
  Icons.args = {
@@ -2,7 +2,14 @@ import { h } from '@stencil/core';
2
2
  export default {
3
3
  title: 'Style/Typography',
4
4
  };
5
- const Template = args => (h("div", null,
5
+ /**
6
+ * Template
7
+ *
8
+ * @param {any} args component arguments
9
+ * @returns {HTMLElement} HTMLElement
10
+ */
11
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
+ const Template = (args) => (h("div", null,
6
13
  h("h1", null, args.h1),
7
14
  h("h2", null, args.h2),
8
15
  h("h3", null, args.h3),
@@ -72,3 +72,13 @@ export class ClassList {
72
72
  export function allItemsAreString(items) {
73
73
  return items && items.every(item => typeof item === 'string');
74
74
  }
75
+ /**
76
+ * Check if element is a heading
77
+ *
78
+ * @param {Element} element slotted element
79
+ * @param {string[]} tagNames allowed tag names list
80
+ * @returns {boolean} element is a heading
81
+ */
82
+ export function isTagName(element, tagNames) {
83
+ return tagNames.includes(element === null || element === void 0 ? void 0 : element.tagName.toLowerCase());
84
+ }
@@ -72,5 +72,15 @@ class ClassList {
72
72
  function allItemsAreString(items) {
73
73
  return items && items.every(item => typeof item === 'string');
74
74
  }
75
+ /**
76
+ * Check if element is a heading
77
+ *
78
+ * @param {Element} element slotted element
79
+ * @param {string[]} tagNames allowed tag names list
80
+ * @returns {boolean} element is a heading
81
+ */
82
+ function isTagName(element, tagNames) {
83
+ return tagNames.includes(element === null || element === void 0 ? void 0 : element.tagName.toLowerCase());
84
+ }
75
85
 
76
- export { ClassList as C, allItemsAreString as a, createID as c };
86
+ export { ClassList as C, allItemsAreString as a, createID as c, isTagName as i };
@@ -1,27 +1,29 @@
1
1
  /* MgComponents custom elements */
2
- export { MgBadge as MgBadge } from '../types/components/mg-badge/mg-badge';
3
- export { MgButton as MgButton } from '../types/components/mg-button/mg-button';
4
- export { MgCharacterLeft as MgCharacterLeft } from '../types/components/mg-character-left/mg-character-left';
5
- export { MgForm as MgForm } from '../types/components/mg-form/mg-form';
6
- export { MgIcon as MgIcon } from '../types/components/mg-icon/mg-icon';
7
- export { MgInputCheckbox as MgInputCheckbox } from '../types/components/mg-input-checkbox/mg-input-checkbox';
8
- export { MgInputDate as MgInputDate } from '../types/components/mg-input-date/mg-input-date';
9
- export { MgInputNumeric as MgInputNumeric } from '../types/components/mg-input-numeric/mg-input-numeric';
10
- export { MgInputPassword as MgInputPassword } from '../types/components/mg-input-password/mg-input-password';
11
- export { MgInputRadio as MgInputRadio } from '../types/components/mg-input-radio/mg-input-radio';
12
- export { MgInputSelect as MgInputSelect } from '../types/components/mg-input-select/mg-input-select';
13
- export { MgInputText as MgInputText } from '../types/components/mg-input-text/mg-input-text';
14
- export { MgInputTextarea as MgInputTextarea } from '../types/components/mg-input-textarea/mg-input-textarea';
15
- export { MgInputTitle as MgInputTitle } from '../types/components/mg-input-title/mg-input-title';
16
- export { MgInputToggle as MgInputToggle } from '../types/components/mg-input-toggle/mg-input-toggle';
17
- export { MgMessage as MgMessage } from '../types/components/mg-message/mg-message';
18
- export { MgModal as MgModal } from '../types/components/mg-modal/mg-modal';
19
- export { MgPagination as MgPagination } from '../types/components/mg-pagination/mg-pagination';
20
- export { MgPanel as MgPanel } from '../types/components/mg-panel/mg-panel';
21
- export { MgPopover as MgPopover } from '../types/components/mg-popover/mg-popover';
22
- export { MgTabs as MgTabs } from '../types/components/mg-tabs/mg-tabs';
23
- export { MgTag as MgTag } from '../types/components/mg-tag/mg-tag';
24
- export { MgTooltip as MgTooltip } from '../types/components/mg-tooltip/mg-tooltip';
2
+ export { MgBadge as MgBadge } from '../types/components/atoms/mg-badge/mg-badge';
3
+ export { MgButton as MgButton } from '../types/components/atoms/mg-button/mg-button';
4
+ export { MgCharacterLeft as MgCharacterLeft } from '../types/components/atoms/mg-character-left/mg-character-left';
5
+ export { MgDetails as MgDetails } from '../types/components/molecules/mg-details/mg-details';
6
+ export { MgForm as MgForm } from '../types/components/molecules/mg-form/mg-form';
7
+ export { MgIcon as MgIcon } from '../types/components/atoms/mg-icon/mg-icon';
8
+ export { MgIllustratedMessage as MgIllustratedMessage } from '../types/components/molecules/mg-illustrated-message/mg-illustrated-message';
9
+ export { MgInputCheckbox as MgInputCheckbox } from '../types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox';
10
+ export { MgInputDate as MgInputDate } from '../types/components/molecules/inputs/mg-input-date/mg-input-date';
11
+ export { MgInputNumeric as MgInputNumeric } from '../types/components/molecules/inputs/mg-input-numeric/mg-input-numeric';
12
+ export { MgInputPassword as MgInputPassword } from '../types/components/molecules/inputs/mg-input-password/mg-input-password';
13
+ export { MgInputRadio as MgInputRadio } from '../types/components/molecules/inputs/mg-input-radio/mg-input-radio';
14
+ export { MgInputSelect as MgInputSelect } from '../types/components/molecules/inputs/mg-input-select/mg-input-select';
15
+ export { MgInputText as MgInputText } from '../types/components/molecules/inputs/mg-input-text/mg-input-text';
16
+ export { MgInputTextarea as MgInputTextarea } from '../types/components/molecules/inputs/mg-input-textarea/mg-input-textarea';
17
+ export { MgInputTitle as MgInputTitle } from '../types/components/atoms/mg-input-title/mg-input-title';
18
+ export { MgInputToggle as MgInputToggle } from '../types/components/molecules/inputs/mg-input-toggle/mg-input-toggle';
19
+ export { MgMessage as MgMessage } from '../types/components/molecules/mg-message/mg-message';
20
+ export { MgModal as MgModal } from '../types/components/molecules/mg-modal/mg-modal';
21
+ export { MgPagination as MgPagination } from '../types/components/molecules/mg-pagination/mg-pagination';
22
+ export { MgPanel as MgPanel } from '../types/components/molecules/mg-panel/mg-panel';
23
+ export { MgPopover as MgPopover } from '../types/components/molecules/mg-popover/mg-popover';
24
+ export { MgTabs as MgTabs } from '../types/components/molecules/mg-tabs/mg-tabs';
25
+ export { MgTag as MgTag } from '../types/components/atoms/mg-tag/mg-tag';
26
+ export { MgTooltip as MgTooltip } from '../types/components/atoms/mg-tooltip/mg-tooltip';
25
27
 
26
28
  /**
27
29
  * Used to manually set the base path where assets can be found.
@@ -2,8 +2,10 @@ export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client'
2
2
  export { MgBadge, defineCustomElement as defineCustomElementMgBadge } from './mg-badge.js';
3
3
  export { MgButton, defineCustomElement as defineCustomElementMgButton } from './mg-button.js';
4
4
  export { MgCharacterLeft, defineCustomElement as defineCustomElementMgCharacterLeft } from './mg-character-left.js';
5
+ export { MgDetails, defineCustomElement as defineCustomElementMgDetails } from './mg-details.js';
5
6
  export { MgForm, defineCustomElement as defineCustomElementMgForm } from './mg-form.js';
6
7
  export { MgIcon, defineCustomElement as defineCustomElementMgIcon } from './mg-icon.js';
8
+ export { MgIllustratedMessage, defineCustomElement as defineCustomElementMgIllustratedMessage } from './mg-illustrated-message.js';
7
9
  export { MgInputCheckbox, defineCustomElement as defineCustomElementMgInputCheckbox } from './mg-input-checkbox.js';
8
10
  export { MgInputDate, defineCustomElement as defineCustomElementMgInputDate } from './mg-input-date.js';
9
11
  export { MgInputNumeric, defineCustomElement as defineCustomElementMgInputNumeric } from './mg-input-numeric.js';
@@ -26,10 +26,6 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
26
26
  * If not set, it will be created.
27
27
  */
28
28
  this.identifier = createID('mg-button');
29
- /**
30
- * Disable button
31
- */
32
- this.disabled = false;
33
29
  /**
34
30
  * Define if button is round.
35
31
  * Used for icon button.
@@ -40,15 +36,6 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
40
36
  * Parent component have to remove the attribute 'disabled' when the process ends.
41
37
  */
42
38
  this.disableOnClick = false;
43
- /**
44
- * Prop to set aria-expanded on button element
45
- */
46
- this.expanded = false;
47
- /**
48
- * Option to set aria-haspopup
49
- * The aria-haspopup state informs assistive technology users that there is a popup and the type of popup it is, but provides no interactivity.
50
- */
51
- this.haspopup = false;
52
39
  /**
53
40
  * Define if button is loading, default to false.
54
41
  * Trigger when button is clicked or key-up ['enter', 'space], then value change to true.
@@ -127,7 +114,10 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
127
114
  * @returns {HTMLElement} html element
128
115
  */
129
116
  render() {
130
- return (h("button", { id: this.identifier, class: this.classList.join(), "aria-label": this.label, "aria-disabled": this.disabled.toString(), "aria-expanded": this.expanded, "aria-controls": this.controls, "aria-haspopup": this.haspopup, onClick: this.handleClick }, this.loading && h("mg-icon", { icon: "loader", spin: true }), h("div", { class: "mg-button__content" }, h("slot", null))));
117
+ return (h("button", { id: this.identifier, class: this.classList.join(), type: this.type, "aria-label": this.label, "aria-disabled": this.disabled !== undefined && this.disabled.toString(), "aria-expanded": this.expanded !== undefined && this.expanded.toString(), "aria-controls": this.controls, "aria-haspopup": this.haspopup !== undefined && this.haspopup.toString(), onClick: this.handleClick,
118
+ // has stencil does not support form attribute on button, we set the attribute from the ref
119
+ // https://github.com/ionic-team/stencil/issues/2703#issuecomment-1050943715
120
+ ref: btn => this.form && btn.setAttribute('form', this.form) }, this.loading && h("mg-icon", { icon: "loader", spin: true }), h("div", { class: "mg-button__content" }, h("slot", null))));
131
121
  }
132
122
  get element() { return this; }
133
123
  static get watchers() { return {
@@ -140,6 +130,8 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
140
130
  "variant": [1],
141
131
  "identifier": [1],
142
132
  "label": [1],
133
+ "type": [1],
134
+ "form": [1025],
143
135
  "disabled": [1028],
144
136
  "isIcon": [4, "is-icon"],
145
137
  "disableOnClick": [4, "disable-on-click"],