@mgdis/mg-components 5.6.0 → 5.7.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 (184) hide show
  1. package/dist/cjs/{index-4dcc1812.js → index-5e7ede97.js} +109 -3
  2. package/dist/cjs/loader.cjs.js +4 -3
  3. package/dist/cjs/{mg-badge_30.cjs.entry.js → mg-action-more_31.cjs.entry.js} +623 -445
  4. package/dist/cjs/mg-components.cjs.js +7 -3
  5. package/dist/collection/collection-manifest.json +5 -4
  6. package/dist/collection/components/atoms/mg-badge/mg-badge.js +1 -1
  7. package/dist/collection/components/atoms/mg-button/mg-button.css +7 -21
  8. package/dist/collection/components/atoms/mg-button/mg-button.js +1 -1
  9. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +27 -27
  10. package/dist/collection/components/atoms/mg-icon/mg-icon.js +3 -3
  11. package/dist/collection/components/atoms/mg-tag/mg-tag.js +1 -1
  12. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +12 -15
  13. package/dist/collection/components/molecules/inputs/MgInput.js +6 -1
  14. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +4 -3
  15. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +3 -2
  16. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +4 -0
  17. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +1 -1
  18. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +4 -0
  19. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +1 -1
  20. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +4 -0
  21. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +4 -3
  22. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +2 -1
  23. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +4 -0
  24. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +1 -1
  25. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +4 -0
  26. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +4 -0
  27. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -1
  28. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +4 -4
  29. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +2 -3
  30. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +2 -1
  31. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +31 -11
  32. package/dist/collection/components/molecules/mg-action-more/mg-action-more.conf.js +1 -0
  33. package/dist/collection/components/molecules/mg-action-more/mg-action-more.css +38 -0
  34. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +252 -0
  35. package/dist/collection/components/molecules/mg-form/mg-form.js +2 -2
  36. package/dist/collection/components/molecules/mg-message/mg-message.js +1 -1
  37. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +19 -1
  38. package/dist/collection/components/molecules/mg-panel/mg-panel.js +2 -2
  39. package/dist/collection/components/molecules/mg-popover/mg-popover.css +0 -1
  40. package/dist/collection/components/molecules/mg-popover/mg-popover.js +17 -4
  41. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +2 -1
  42. package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +2 -1
  43. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +9 -8
  44. package/dist/collection/locales/en/messages.json +6 -1
  45. package/dist/collection/locales/fr/messages.json +6 -1
  46. package/dist/collection/locales/index.js +1 -1
  47. package/dist/collection/styles/mg-icon-animation.scss +6 -0
  48. package/dist/collection/styles/navigation-button.scss +2 -1
  49. package/dist/collection/utils/behaviors.utils.js +16 -34
  50. package/dist/collection/utils/components.utils.js +3 -1
  51. package/dist/collection/utils/locale.utils.js +9 -9
  52. package/dist/collection/utils/unit.test.utils.js +32 -4
  53. package/dist/collection/variables.css +2 -1
  54. package/dist/components/MgInput.js +6 -1
  55. package/dist/components/components.utils.js +3 -1
  56. package/dist/components/index.d.ts +10 -0
  57. package/dist/components/index.js +2 -1
  58. package/dist/components/index2.js +26 -14
  59. package/dist/components/mg-action-more.d.ts +11 -0
  60. package/dist/components/mg-action-more.js +215 -0
  61. package/dist/components/mg-badge2.js +1 -1
  62. package/dist/components/mg-button2.js +2 -2
  63. package/dist/components/mg-form.js +2 -2
  64. package/dist/components/mg-icon2.js +30 -30
  65. package/dist/components/mg-input-checkbox.js +3 -3
  66. package/dist/components/mg-input-date.js +2 -2
  67. package/dist/components/mg-input-numeric.js +2 -2
  68. package/dist/components/mg-input-password.js +1 -1
  69. package/dist/components/mg-input-radio.js +2 -2
  70. package/dist/components/mg-input-select2.js +2 -2
  71. package/dist/components/mg-input-text2.js +1 -1
  72. package/dist/components/mg-input-textarea.js +2 -2
  73. package/dist/components/mg-input-toggle.js +1 -1
  74. package/dist/components/mg-menu-item2.js +75 -72
  75. package/dist/components/mg-menu.js +1 -246
  76. package/dist/components/mg-menu2.js +247 -0
  77. package/dist/components/mg-message.js +1 -1
  78. package/dist/components/mg-pagination.js +3 -1
  79. package/dist/components/mg-panel.js +2 -2
  80. package/dist/components/mg-popover2.js +17 -3
  81. package/dist/components/mg-skip-links.js +1 -1
  82. package/dist/components/mg-tabs.js +10 -9
  83. package/dist/components/mg-tag.js +1 -1
  84. package/dist/components/mg-tooltip2.js +12 -15
  85. package/dist/esm/{index-dc9a2348.js → index-03cceb11.js} +109 -4
  86. package/dist/esm/loader.js +4 -3
  87. package/dist/esm/{mg-badge_30.entry.js → mg-action-more_31.entry.js} +623 -446
  88. package/dist/esm/mg-components.js +4 -3
  89. package/dist/mg-components/locales/en/messages.json +6 -1
  90. package/dist/mg-components/locales/fr/messages.json +6 -1
  91. package/dist/mg-components/mg-components.css +1 -1
  92. package/dist/mg-components/mg-components.esm.js +1 -1
  93. package/dist/mg-components/p-4cfd5423.entry.js +1 -0
  94. package/dist/mg-components/p-e126dd84.js +2 -0
  95. package/dist/mg-components/styles/mg-icon-animation.scss +6 -0
  96. package/dist/mg-components/styles/navigation-button.scss +2 -1
  97. package/dist/mg-components/variables.css +2 -1
  98. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +1 -1
  99. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +7 -1
  100. package/dist/types/components/molecules/mg-action-more/mg-action-more.conf.d.ts +42 -0
  101. package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +81 -0
  102. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +4 -0
  103. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +2 -1
  104. package/dist/types/components.d.ts +54 -0
  105. package/dist/types/locales/index.d.ts +12 -2
  106. package/dist/types/stencil-public-runtime.d.ts +9 -0
  107. package/dist/types/utils/behaviors.utils.d.ts +1 -7
  108. package/dist/types/utils/locale.utils.d.ts +5 -5
  109. package/dist/types/utils/unit.test.utils.d.ts +20 -2
  110. package/loader/index.d.ts +9 -0
  111. package/package.json +17 -16
  112. package/readme.md +0 -18
  113. package/dist/.storybook/utils.js +0 -24
  114. package/dist/collection/components/atoms/mg-badge/doc/mg-badge.stories.js +0 -27
  115. package/dist/collection/components/atoms/mg-button/doc/mg-button.stories.js +0 -38
  116. package/dist/collection/components/atoms/mg-card/doc/mg-card.stories.js +0 -18
  117. package/dist/collection/components/atoms/mg-character-left/doc/mg-character-left.stories.js +0 -20
  118. package/dist/collection/components/atoms/mg-divider/doc/mg-divider.stories.js +0 -18
  119. package/dist/collection/components/atoms/mg-icon/doc/mg-icon.stories.js +0 -41
  120. package/dist/collection/components/atoms/mg-input-title/doc/mg-input-title.stories.js +0 -21
  121. package/dist/collection/components/atoms/mg-tag/doc/mg-tag.stories.js +0 -22
  122. package/dist/collection/components/atoms/mg-tooltip/doc/mg-tooltip.stories.js +0 -50
  123. package/dist/collection/components/molecules/inputs/mg-input-checkbox/doc/mg-input-checkbox.stories.js +0 -50
  124. package/dist/collection/components/molecules/inputs/mg-input-date/doc/mg-input-date.stories.js +0 -43
  125. package/dist/collection/components/molecules/inputs/mg-input-numeric/doc/mg-input-numeric.stories.js +0 -68
  126. package/dist/collection/components/molecules/inputs/mg-input-password/doc/mg-input-password.stories.js +0 -46
  127. package/dist/collection/components/molecules/inputs/mg-input-radio/doc/mg-input-radio.stories.js +0 -59
  128. package/dist/collection/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.js +0 -77
  129. package/dist/collection/components/molecules/inputs/mg-input-text/doc/mg-input-text.stories.js +0 -110
  130. package/dist/collection/components/molecules/inputs/mg-input-textarea/doc/mg-input-textarea.stories.js +0 -54
  131. package/dist/collection/components/molecules/inputs/mg-input-toggle/doc/mg-input-toggle.stories.js +0 -51
  132. package/dist/collection/components/molecules/menu/mg-menu/doc/mg-menu.stories.js +0 -119
  133. package/dist/collection/components/molecules/menu/mg-menu-item/doc/mg-menu-item.stories.js +0 -34
  134. package/dist/collection/components/molecules/mg-details/doc/mg-details.stories.js +0 -24
  135. package/dist/collection/components/molecules/mg-form/doc/mg-form.stories.js +0 -47
  136. package/dist/collection/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.js +0 -19
  137. package/dist/collection/components/molecules/mg-message/doc/mg-message.stories.js +0 -39
  138. package/dist/collection/components/molecules/mg-modal/doc/mg-modal.stories.js +0 -39
  139. package/dist/collection/components/molecules/mg-pagination/doc/mg-pagination.stories.js +0 -20
  140. package/dist/collection/components/molecules/mg-panel/doc/mg-panel.stories.js +0 -22
  141. package/dist/collection/components/molecules/mg-popover/doc/mg-popover.stories.js +0 -34
  142. package/dist/collection/components/molecules/mg-skip-links/doc/mg-skip-links.stories.js +0 -24
  143. package/dist/collection/components/molecules/mg-tabs/doc/mg-tabs.stories.js +0 -53
  144. package/dist/collection/stories/grids.stories.js +0 -7
  145. package/dist/collection/stories/helpers.stories.js +0 -23
  146. package/dist/collection/stories/icons.stories.js +0 -25
  147. package/dist/collection/stories/typography.stories.js +0 -24
  148. package/dist/mg-components/p-182bd802.js +0 -2
  149. package/dist/mg-components/p-f7da9dd2.entry.js +0 -1
  150. package/dist/types/components/atoms/mg-badge/doc/mg-badge.stories.d.ts +0 -13
  151. package/dist/types/components/atoms/mg-button/doc/mg-button.stories.d.ts +0 -16
  152. package/dist/types/components/atoms/mg-card/doc/mg-card.stories.d.ts +0 -6
  153. package/dist/types/components/atoms/mg-character-left/doc/mg-character-left.stories.d.ts +0 -6
  154. package/dist/types/components/atoms/mg-divider/doc/mg-divider.stories.d.ts +0 -6
  155. package/dist/types/components/atoms/mg-icon/doc/mg-icon.stories.d.ts +0 -26
  156. package/dist/types/components/atoms/mg-input-title/doc/mg-input-title.stories.d.ts +0 -6
  157. package/dist/types/components/atoms/mg-tag/doc/mg-tag.stories.d.ts +0 -6
  158. package/dist/types/components/atoms/mg-tooltip/doc/mg-tooltip.stories.d.ts +0 -18
  159. package/dist/types/components/molecules/inputs/mg-input-checkbox/doc/mg-input-checkbox.stories.d.ts +0 -11
  160. package/dist/types/components/molecules/inputs/mg-input-date/doc/mg-input-date.stories.d.ts +0 -12
  161. package/dist/types/components/molecules/inputs/mg-input-numeric/doc/mg-input-numeric.stories.d.ts +0 -32
  162. package/dist/types/components/molecules/inputs/mg-input-password/doc/mg-input-password.stories.d.ts +0 -22
  163. package/dist/types/components/molecules/inputs/mg-input-radio/doc/mg-input-radio.stories.d.ts +0 -20
  164. package/dist/types/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.d.ts +0 -34
  165. package/dist/types/components/molecules/inputs/mg-input-text/doc/mg-input-text.stories.d.ts +0 -39
  166. package/dist/types/components/molecules/inputs/mg-input-textarea/doc/mg-input-textarea.stories.d.ts +0 -19
  167. package/dist/types/components/molecules/inputs/mg-input-toggle/doc/mg-input-toggle.stories.d.ts +0 -12
  168. package/dist/types/components/molecules/menu/mg-menu/doc/mg-menu.stories.d.ts +0 -22
  169. package/dist/types/components/molecules/menu/mg-menu-item/doc/mg-menu-item.stories.d.ts +0 -12
  170. package/dist/types/components/molecules/mg-details/doc/mg-details.stories.d.ts +0 -11
  171. package/dist/types/components/molecules/mg-form/doc/mg-form.stories.d.ts +0 -11
  172. package/dist/types/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.d.ts +0 -6
  173. package/dist/types/components/molecules/mg-message/doc/mg-message.stories.d.ts +0 -26
  174. package/dist/types/components/molecules/mg-modal/doc/mg-modal.stories.d.ts +0 -13
  175. package/dist/types/components/molecules/mg-pagination/doc/mg-pagination.stories.d.ts +0 -11
  176. package/dist/types/components/molecules/mg-panel/doc/mg-panel.stories.d.ts +0 -11
  177. package/dist/types/components/molecules/mg-popover/doc/mg-popover.stories.d.ts +0 -22
  178. package/dist/types/components/molecules/mg-skip-links/doc/mg-skip-links.stories.d.ts +0 -11
  179. package/dist/types/components/molecules/mg-tabs/doc/mg-tabs.stories.d.ts +0 -20
  180. package/dist/types/home/runner/work/mg-components/mg-components/.stencil/.storybook/utils.d.ts +0 -1
  181. package/dist/types/stories/grids.stories.d.ts +0 -5
  182. package/dist/types/stories/helpers.stories.d.ts +0 -13
  183. package/dist/types/stories/icons.stories.d.ts +0 -13
  184. package/dist/types/stories/typography.stories.d.ts +0 -5
@@ -1,24 +0,0 @@
1
- export const filterArgs = (args, defaultValues) => {
2
- const filteredArgs = {};
3
- for (const k in args) {
4
- if (!k.startsWith('slot')) {
5
- const arg = args[k];
6
- // Change camelCase k to kebab-case
7
- const key = k.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
8
- // Change value to boolean true value, will be replace during render
9
- if (typeof arg === 'boolean' && arg === true) {
10
- filteredArgs[key] = 'mg__storybook__boolean-true';
11
- }
12
- // Do not add args if is default value
13
- else if (!defaultValues || !Object.keys(defaultValues).includes(k) || defaultValues[k] !== arg) {
14
- filteredArgs[key] = arg;
15
- }
16
- }
17
- }
18
- // Add comment when args contain object, will be replace during render
19
- const argsObjects = Object.entries(args).filter(arg => typeof arg[1] === 'object');
20
- if (argsObjects.length > 0) {
21
- filteredArgs['mg__storybook__comment'] = `/!\\ Object props are not rendered in the code example: ${argsObjects.map(([a]) => a).join(', ')}.`;
22
- }
23
- return filteredArgs;
24
- };
@@ -1,27 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { filterArgs } from '../../../../../.storybook/utils';
3
- import { variants } from '../mg-badge.conf';
4
- export default {
5
- component: 'mg-badge',
6
- title: 'Atoms/mg-badge',
7
- argTypes: {
8
- value: {
9
- control: { type: 'text' },
10
- },
11
- },
12
- };
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("mg-badge", Object.assign({}, filterArgs(args, { variant: variants[0] })));
21
- export const MgBadge = Template.bind({});
22
- MgBadge.args = {
23
- value: '99',
24
- label: 'unread messages',
25
- variant: variants[0],
26
- outline: false,
27
- };
@@ -1,38 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { variants, buttonTypes } from '../mg-button.conf';
3
- import { icons } from '../../mg-icon/mg-icon.conf';
4
- import { filterArgs } from '../../../../../.storybook/utils';
5
- export default {
6
- component: 'mg-button',
7
- title: 'Atoms/mg-button',
8
- argTypes: {
9
- type: {
10
- options: [undefined, ...buttonTypes],
11
- control: { type: 'select' },
12
- },
13
- },
14
- };
15
- /**
16
- * Template
17
- *
18
- * @param {any} args component arguments
19
- * @returns {HTMLElement} HTMLElement
20
- */
21
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
- const Template = (args) => h("mg-button", Object.assign({}, filterArgs(args, { variant: variants[0] })), args.slot);
23
- export const MgButton = Template.bind({});
24
- MgButton.args = {
25
- slot: 'Text button',
26
- variant: variants[0],
27
- label: 'Explicit aria label',
28
- identifier: undefined,
29
- disabled: false,
30
- disableOnClick: false,
31
- isIcon: false,
32
- type: undefined,
33
- fullWidth: undefined,
34
- };
35
- export const IsIcon = Template.bind({});
36
- IsIcon.args = Object.assign(Object.assign({}, MgButton.args), { isIcon: true, slot: h("mg-icon", { icon: Object.keys(icons)[0] }) });
37
- export const DisableOnClick = Template.bind({});
38
- DisableOnClick.args = Object.assign(Object.assign({}, MgButton.args), { disableOnClick: true });
@@ -1,18 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { filterArgs } from '../../../../../.storybook/utils';
3
- export default {
4
- component: 'mg-card',
5
- title: 'Atoms/mg-card',
6
- };
7
- /**
8
- * Template
9
- *
10
- * @param {any} args component arguments
11
- * @returns {HTMLElement} HTMLElement
12
- */
13
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
- const Template = (args) => h("mg-card", Object.assign({}, filterArgs(args)), args.slot);
15
- export const MgCard = Template.bind({});
16
- MgCard.args = {
17
- slot: '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.',
18
- };
@@ -1,20 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { filterArgs } from '../../../../../.storybook/utils';
3
- export default {
4
- component: 'mg-character-left',
5
- title: 'Atoms/mg-character-left',
6
- };
7
- /**
8
- * Template
9
- *
10
- * @param {any} args component arguments
11
- * @returns {HTMLElement} HTMLElement
12
- */
13
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
- const Template = (args) => h("mg-character-left", Object.assign({}, filterArgs(args)));
15
- export const MgCharacterLeft = Template.bind({});
16
- MgCharacterLeft.args = {
17
- identifier: 'identifier',
18
- characters: '',
19
- maxlength: 400,
20
- };
@@ -1,18 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { filterArgs } from '../../../../../.storybook/utils';
3
- export default {
4
- component: 'mg-divider',
5
- title: 'Atoms/mg-divider',
6
- };
7
- /**
8
- * Template
9
- *
10
- * @param {any} args component arguments
11
- * @returns {HTMLElement} HTMLElement
12
- */
13
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
- const Template = (args) => h("mg-divider", Object.assign({}, filterArgs(args, { size: 'regular' })));
15
- export const MgDivider = Template.bind({});
16
- MgDivider.args = {
17
- size: 'regular',
18
- };
@@ -1,41 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { filterArgs } from '../../../../../.storybook/utils';
3
- import { icons, sizes, variants } from '../mg-icon.conf';
4
- export default {
5
- component: 'mg-icon',
6
- title: 'Atoms/mg-icon',
7
- argTypes: {
8
- icon: {
9
- options: Object.keys(icons),
10
- control: { type: 'select' },
11
- },
12
- size: {
13
- options: sizes,
14
- control: { type: 'select' },
15
- },
16
- variant: {
17
- options: [undefined, ...variants],
18
- control: { type: 'select' },
19
- },
20
- },
21
- };
22
- /**
23
- * Template
24
- *
25
- * @param {any} args component arguments
26
- * @returns {HTMLElement} HTMLElement
27
- */
28
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
- const Template = (args) => {
30
- const color = args.color;
31
- delete args.color;
32
- // return element
33
- return (h("div", { style: { color } }, h("mg-icon", Object.assign({}, filterArgs(args, { size: sizes[1] })))));
34
- };
35
- export const MgIcon = Template.bind({});
36
- MgIcon.args = {
37
- color: '',
38
- icon: Object.keys(icons)[0],
39
- size: undefined,
40
- spin: false,
41
- };
@@ -1,21 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { filterArgs } from '../../../../../.storybook/utils';
3
- export default {
4
- component: 'mg-input-title',
5
- title: 'Atoms/mg-input-title',
6
- };
7
- /**
8
- * Template
9
- *
10
- * @param {any} args component arguments
11
- * @returns {HTMLElement} HTMLElement
12
- */
13
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
- const Template = (args) => h("mg-input-title", Object.assign({}, filterArgs(args)), args.slot);
15
- export const MgInputTitle = Template.bind({});
16
- MgInputTitle.args = {
17
- slot: 'Label',
18
- identifier: 'identifier',
19
- required: true,
20
- isLegend: false,
21
- };
@@ -1,22 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { filterArgs } from '../../../../../.storybook/utils';
3
- import { variants } from '../mg-tag.conf';
4
- export default {
5
- component: 'mg-tag',
6
- title: 'Atoms/mg-tag',
7
- };
8
- /**
9
- * Template
10
- *
11
- * @param {any} args component arguments
12
- * @returns {HTMLElement} HTMLElement
13
- */
14
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
- const Template = (args) => h("mg-tag", Object.assign({}, filterArgs(args, { variant: variants[0] })), args.slot);
16
- export const MgTag = Template.bind({});
17
- MgTag.args = {
18
- slot: 'Label',
19
- variant: variants[0],
20
- outline: false,
21
- soft: false,
22
- };
@@ -1,50 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { filterArgs } from '../../../../../.storybook/utils';
3
- export default {
4
- component: 'mg-tooltip',
5
- title: 'Atoms/mg-tooltip',
6
- parameters: {
7
- layout: 'centered',
8
- },
9
- argTypes: {
10
- placement: {
11
- control: { type: 'select' },
12
- },
13
- },
14
- };
15
- /**
16
- * Template
17
- *
18
- * @param {any} args component arguments
19
- * @returns {HTMLElement} HTMLElement
20
- */
21
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
- const Template = (args) => (h("mg-tooltip", Object.assign({}, filterArgs(args, { placement: 'bottom' })), h("mg-icon", { icon: "info-circle" })));
23
- export const MgTooltip = Template.bind({});
24
- MgTooltip.args = {
25
- identifier: 'identifier',
26
- message: 'This is a tooltip message',
27
- placement: undefined,
28
- display: false,
29
- disabled: false,
30
- };
31
- /**
32
- * Template
33
- *
34
- * @param {any} args component arguments
35
- * @returns {HTMLElement} HTMLElement
36
- */
37
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
- const TemplateButton = (args) => (h("mg-tooltip", Object.assign({}, filterArgs(args, { placement: 'bottom' })), h("mg-button", null, "Action")));
39
- export const MgTooltipOnButton = TemplateButton.bind({});
40
- MgTooltipOnButton.args = Object.assign({}, MgTooltip.args);
41
- /**
42
- * Template
43
- *
44
- * @param {any} args component arguments
45
- * @returns {HTMLElement} HTMLElement
46
- */
47
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
- const TemplateSpan = (args) => (h("mg-tooltip", Object.assign({}, filterArgs(args, { placement: 'bottom' })), h("span", null, "any text")));
49
- export const MgTooltipOnSpan = TemplateSpan.bind({});
50
- MgTooltipOnSpan.args = Object.assign({}, MgTooltip.args);
@@ -1,50 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { filterArgs } from '../../../../../../.storybook/utils';
3
- export default {
4
- component: 'mg-input-checkbox',
5
- title: 'Molecules/Inputs/mg-input-checkbox',
6
- parameters: { actions: { handles: ['value-change', 'input-valid'] } },
7
- };
8
- /**
9
- * Template
10
- *
11
- * @param {any} args component arguments
12
- * @returns {HTMLElement} HTMLElement
13
- */
14
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
- const Template = (args) => h("mg-input-checkbox", Object.assign({}, filterArgs(args)));
16
- export const MgInputCheckbox = Template.bind({});
17
- MgInputCheckbox.args = {
18
- // Global
19
- value: [
20
- {
21
- title: 'HT',
22
- value: true,
23
- },
24
- {
25
- title: 'TTC',
26
- value: false,
27
- disabled: true,
28
- },
29
- {
30
- title: 'Mixte (HT/TTC)',
31
- value: null,
32
- },
33
- ],
34
- identifier: 'identifier',
35
- name: 'input-name',
36
- // Label
37
- label: 'Option',
38
- labelOnTop: false,
39
- labelHide: false,
40
- // placement
41
- inputVerticalList: false,
42
- // Input
43
- required: false,
44
- disabled: false,
45
- readonly: false,
46
- // Tooltip
47
- tooltip: 'This is a tooltip',
48
- // Help Text
49
- helpText: 'Help text with html <strong>bold</strong>, <em>italic</em>.',
50
- };
@@ -1,43 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { filterArgs } from '../../../../../../.storybook/utils';
3
- export default {
4
- component: 'mg-input-date',
5
- title: 'Molecules/Inputs/mg-input-date',
6
- parameters: { actions: { handles: ['value-change', 'input-valid'] } },
7
- };
8
- /**
9
- * Template
10
- *
11
- * @param {any} args component arguments
12
- * @returns {HTMLElement} HTMLElement
13
- */
14
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
- const Template = (args) => h("mg-input-date", Object.assign({}, filterArgs(args)));
16
- const date = new Date();
17
- const getFormatedNumber = (number) => {
18
- return `${number > 9 ? number : '0' + number}`;
19
- };
20
- export const MgInputDate = Template.bind({});
21
- MgInputDate.args = {
22
- // Global
23
- value: `${date.getFullYear()}-${getFormatedNumber(date.getMonth())}-${getFormatedNumber(date.getDate())}`,
24
- identifier: 'identifier',
25
- name: 'input-name',
26
- // Label
27
- label: 'Label',
28
- labelOnTop: false,
29
- labelHide: false,
30
- // Input
31
- required: true,
32
- readonly: false,
33
- disabled: false,
34
- // Tooltip
35
- tooltip: 'This is a tooltip',
36
- // Help Text
37
- helpText: 'Help text with html <strong>bold</strong>, <em>italic</em>.',
38
- };
39
- export const MgInputDateMinMax = Template.bind({});
40
- MgInputDateMinMax.args = Object.assign(Object.assign({}, MgInputDate.args), {
41
- // date range
42
- min: `${date.getFullYear()}-01-01`, max: `${date.getFullYear() + 1}-12-31`
43
- });
@@ -1,68 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { filterArgs } from '../../../../../../.storybook/utils';
3
- import { types } from '../mg-input-numeric.conf';
4
- export default {
5
- component: 'mg-input-numeric',
6
- title: 'Molecules/Inputs/mg-input-numeric',
7
- argTypes: {
8
- type: {
9
- options: types,
10
- control: { type: 'select' },
11
- },
12
- mgWidth: {
13
- options: [undefined, 2, 4, 16, 'full'],
14
- control: { type: 'select' },
15
- },
16
- },
17
- parameters: { actions: { handles: ['value-change', 'input-valid'] } },
18
- };
19
- /**
20
- * Template
21
- *
22
- * @param {any} args component arguments
23
- * @returns {HTMLElement} HTMLElement
24
- */
25
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
- const Template = (args) => h("mg-input-numeric", Object.assign({}, filterArgs(args)));
27
- /**
28
- * Global use
29
- */
30
- export const MgInputNumeric = Template.bind({});
31
- MgInputNumeric.args = {
32
- // Global
33
- value: '',
34
- identifier: 'identifier',
35
- name: 'input-name',
36
- type: types[0],
37
- // Label
38
- label: 'Label',
39
- labelOnTop: false,
40
- labelHide: false,
41
- // Input
42
- placeholder: 'placeholder',
43
- required: true,
44
- disabled: false,
45
- readonly: false,
46
- max: undefined,
47
- min: undefined,
48
- mgWidth: undefined,
49
- // Tooltip
50
- tooltip: 'This is a tooltip',
51
- // Help Text
52
- helpText: 'Help text with html <strong>bold</strong>, <em>italic</em>.',
53
- };
54
- const TemplateSlot = args => {
55
- const labelOnTop = args.labelOnTop;
56
- delete args.labelOnTop;
57
- const labelHide = args.labelHide;
58
- delete args.labelHide;
59
- const helpText = args.helpText;
60
- delete args.helpText;
61
- // return element
62
- return (h("mg-input-numeric", Object.assign({}, args, { "label-on-top": labelOnTop, "label-hide": labelHide, "help-text": helpText }), h("span", { slot: "append-input" }, "km")));
63
- };
64
- /**
65
- * Global use
66
- */
67
- export const AppendSlot = TemplateSlot.bind({});
68
- AppendSlot.args = Object.assign({}, MgInputNumeric.args);
@@ -1,46 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { filterArgs } from '../../../../../../.storybook/utils';
3
- export default {
4
- component: 'mg-input-password',
5
- title: 'Molecules/Inputs/mg-input-password',
6
- argTypes: {
7
- mgWidth: {
8
- options: [2, 4, 16, 'full'],
9
- control: { type: 'select' },
10
- },
11
- },
12
- parameters: { actions: { handles: ['value-change', 'input-valid'] } },
13
- };
14
- /**
15
- * Template
16
- *
17
- * @param {any} args component arguments
18
- * @returns {HTMLElement} HTMLElement
19
- */
20
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
- const Template = (args) => h("mg-input-password", Object.assign({}, filterArgs(args)));
22
- /**
23
- * Global use
24
- */
25
- export const MgInputPassword = Template.bind({});
26
- MgInputPassword.args = {
27
- // Global
28
- value: '',
29
- identifier: 'identifier',
30
- name: 'input-name',
31
- // Label
32
- label: 'Label',
33
- labelOnTop: false,
34
- labelHide: false,
35
- // Input
36
- placeholder: 'placeholder',
37
- maxlength: 400,
38
- required: true,
39
- disabled: false,
40
- readonly: false,
41
- mgWidth: 'full',
42
- // Tooltip
43
- tooltip: 'This is a tooltip',
44
- // Help Text
45
- helpText: 'Help text with html <strong>bold</strong>, <em>italic</em>.',
46
- };
@@ -1,59 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { filterArgs } from '../../../../../../.storybook/utils';
3
- export default {
4
- component: 'mg-input-radio',
5
- title: 'Molecules/Inputs/mg-input-radio',
6
- argTypes: {
7
- value: {
8
- options: [null, 'ht', 'ttc', 'mixte'],
9
- control: { type: 'radio' },
10
- },
11
- },
12
- parameters: { actions: { handles: ['value-change', 'input-valid'] } },
13
- };
14
- /**
15
- * Template
16
- *
17
- * @param {any} args component arguments
18
- * @returns {HTMLElement} HTMLElement
19
- */
20
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
- const Template = (args) => h("mg-input-radio", Object.assign({}, filterArgs(args)));
22
- export const MgInputRadio = Template.bind({});
23
- MgInputRadio.args = {
24
- // Global
25
- value: null,
26
- items: ['ht', 'ttc', 'mixte'],
27
- identifier: 'identifier',
28
- name: 'input-name',
29
- // Label
30
- label: 'Option',
31
- labelOnTop: false,
32
- labelHide: false,
33
- // placement
34
- inputVerticalList: false,
35
- // Input
36
- required: false,
37
- disabled: false,
38
- readonly: false,
39
- // Tooltip
40
- tooltip: 'This is a tooltip',
41
- // Help Text
42
- helpText: 'Help text with html <strong>bold</strong>, <em>italic</em>.',
43
- };
44
- export const ItemsWithOptions = Template.bind({});
45
- ItemsWithOptions.args = Object.assign(Object.assign({}, MgInputRadio.args), { required: true, items: [
46
- {
47
- title: 'HT',
48
- value: 'ht',
49
- },
50
- {
51
- title: 'TTC',
52
- value: 'ttc',
53
- disabled: true,
54
- },
55
- {
56
- title: 'Mixte (HT/TTC)',
57
- value: 'mixte',
58
- },
59
- ] });
@@ -1,77 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { filterArgs } from '../../../../../../.storybook/utils';
3
- import messages from '../../../../../locales/en/messages.json';
4
- export default {
5
- component: 'mg-input-select',
6
- title: 'Molecules/Inputs/mg-input-select',
7
- argTypes: {
8
- placeholder: {
9
- table: {
10
- defaultValue: { summary: messages.input.select.placeholder },
11
- },
12
- },
13
- mgWidth: {
14
- options: [undefined, 2, 4, 16, 'full'],
15
- control: { type: 'select' },
16
- },
17
- },
18
- parameters: { actions: { handles: ['value-change', 'input-valid'] } },
19
- };
20
- /**
21
- * Template
22
- *
23
- * @param {any} args component arguments
24
- * @returns {HTMLElement} HTMLElement
25
- */
26
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
- const Template = (args) => h("mg-input-select", Object.assign({}, filterArgs(args, { placeholder: messages.input.select.placeholder })));
28
- export const MgInputSelect = Template.bind({});
29
- MgInputSelect.args = {
30
- // Global
31
- value: '',
32
- identifier: 'identifier',
33
- name: 'input-name',
34
- // Label
35
- label: 'Label',
36
- labelOnTop: false,
37
- labelHide: false,
38
- // Input
39
- required: true,
40
- readonly: false,
41
- disabled: false,
42
- items: ['blu', 'bli', 'blo', 'le long libellé qui va faire sortir le champ mg-input-select de sa zone de confort'],
43
- mgWidth: undefined,
44
- // Tooltip
45
- tooltip: 'This is a tooltip',
46
- // Help Text
47
- helpText: 'Help text with html <strong>bold</strong>, <em>italic</em>.',
48
- // Placeholder
49
- placeholder: undefined,
50
- placeholderHide: false,
51
- placeholderDisabled: false,
52
- };
53
- /**
54
- * Using object
55
- */
56
- export const WithObjectItems = Template.bind({});
57
- WithObjectItems.args = Object.assign(Object.assign({}, MgInputSelect.args), {
58
- // remove feature to focus on pattern
59
- tooltip: '', helpText: '', required: false,
60
- //
61
- items: [
62
- { title: 'blu', value: 'blublu' },
63
- { title: 'bli', value: 'blibli' },
64
- { title: 'blo', value: 'bloblo' },
65
- { title: 'bla', value: 'blabla', disabled: true },
66
- ]
67
- });
68
- /**
69
- * Using group object
70
- */
71
- export const WithGroups = Template.bind({});
72
- WithGroups.args = Object.assign(Object.assign({}, WithObjectItems.args), { items: [
73
- { title: 'blu', value: 'blublu', group: '1st group' },
74
- { title: 'bli', value: 'blibli', group: '2nd group' },
75
- { title: 'blo', value: 'bloblo', group: '1st group' },
76
- { title: 'bla', value: 'blabla' },
77
- ] });