@mgdis/mg-components 5.19.0 → 5.19.2

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 (157) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/mg-action-more_34.cjs.entry.js +84 -40
  3. package/dist/cjs/mg-action-more_34.cjs.entry.js.map +1 -1
  4. package/dist/cjs/mg-components.cjs.js +1 -1
  5. package/dist/cjs/mg-item-more.cjs.entry.js +2 -1
  6. package/dist/cjs/mg-item-more.cjs.entry.js.map +1 -1
  7. package/dist/collection/components/atoms/mg-badge/mg-badge.js +1 -1
  8. package/dist/collection/components/atoms/mg-badge/mg-badge.js.map +1 -1
  9. package/dist/collection/components/atoms/mg-button/mg-button.js +2 -1
  10. package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
  11. package/dist/collection/components/atoms/mg-card/mg-card.js +4 -4
  12. package/dist/collection/components/atoms/mg-card/mg-card.js.map +1 -1
  13. package/dist/collection/components/atoms/mg-icon/mg-icon.js +2 -2
  14. package/dist/collection/components/atoms/mg-icon/mg-icon.js.map +1 -1
  15. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +19 -1
  16. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js.map +1 -1
  17. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.e2e.playwright.js +12 -0
  18. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.e2e.playwright.js.map +1 -0
  19. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.spec.js +1 -5
  20. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.spec.js.map +1 -1
  21. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +1 -1
  22. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
  23. package/dist/collection/components/molecules/inputs/MgInput.js +3 -3
  24. package/dist/collection/components/molecules/inputs/MgInput.js.map +1 -1
  25. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +4 -1
  26. package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js.map +1 -1
  27. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +19 -1
  28. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -1
  29. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js.map +1 -1
  30. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +6 -5
  31. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
  32. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js +5 -2
  33. package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js.map +1 -1
  34. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +1 -1
  35. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
  36. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +5 -4
  37. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
  38. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +1 -1
  39. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
  40. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +3 -3
  41. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
  42. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.conf.js +3 -2
  43. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.conf.js.map +1 -1
  44. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +4 -10
  45. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
  46. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js +1 -1
  47. package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js.map +1 -1
  48. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -1
  49. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
  50. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +78 -2
  51. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
  52. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.playwright.js +108 -0
  53. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.playwright.js.map +1 -0
  54. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js +44 -0
  55. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js.map +1 -1
  56. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +1 -1
  57. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js.map +1 -1
  58. package/dist/collection/components/molecules/menu/mg-menu/test/{mg-menu.e2e.js → mg-menu.e2e.playwright.js} +67 -96
  59. package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.e2e.playwright.js.map +1 -0
  60. package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.playwright.js +100 -0
  61. package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.playwright.js.map +1 -0
  62. package/dist/collection/components/molecules/mg-action-more/mg-action-more.conf.js.map +1 -1
  63. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +1 -1
  64. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
  65. package/dist/collection/components/molecules/mg-form/mg-form.js +2 -1
  66. package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
  67. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +1 -1
  68. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js.map +1 -1
  69. package/dist/collection/components/molecules/mg-panel/mg-panel.js +1 -1
  70. package/dist/collection/components/molecules/mg-panel/mg-panel.js.map +1 -1
  71. package/dist/collection/utils/behaviors.utils.js +2 -1
  72. package/dist/collection/utils/behaviors.utils.js.map +1 -1
  73. package/dist/collection/utils/playwright.e2e.test.utils.js +3 -3
  74. package/dist/collection/utils/playwright.e2e.test.utils.js.map +1 -1
  75. package/dist/collection/utils/unit.test.utils.js +0 -3
  76. package/dist/collection/utils/unit.test.utils.js.map +1 -1
  77. package/dist/components/MgInput.js +3 -3
  78. package/dist/components/MgInput.js.map +1 -1
  79. package/dist/components/mg-action-more.js +1 -1
  80. package/dist/components/mg-action-more.js.map +1 -1
  81. package/dist/components/mg-badge2.js +1 -1
  82. package/dist/components/mg-badge2.js.map +1 -1
  83. package/dist/components/mg-button2.js +2 -1
  84. package/dist/components/mg-button2.js.map +1 -1
  85. package/dist/components/mg-card2.js +4 -4
  86. package/dist/components/mg-card2.js.map +1 -1
  87. package/dist/components/mg-form.js +2 -1
  88. package/dist/components/mg-form.js.map +1 -1
  89. package/dist/components/mg-icon2.js +2 -2
  90. package/dist/components/mg-icon2.js.map +1 -1
  91. package/dist/components/mg-input-checkbox-paginated2.js +9 -4
  92. package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
  93. package/dist/components/mg-input-checkbox.js +6 -5
  94. package/dist/components/mg-input-checkbox.js.map +1 -1
  95. package/dist/components/mg-input-date.js +1 -1
  96. package/dist/components/mg-input-date.js.map +1 -1
  97. package/dist/components/mg-input-numeric.js +5 -4
  98. package/dist/components/mg-input-numeric.js.map +1 -1
  99. package/dist/components/mg-input-password.js +1 -1
  100. package/dist/components/mg-input-password.js.map +1 -1
  101. package/dist/components/mg-input-select2.js +3 -3
  102. package/dist/components/mg-input-select2.js.map +1 -1
  103. package/dist/components/mg-input-text2.js +2 -2
  104. package/dist/components/mg-input-text2.js.map +1 -1
  105. package/dist/components/mg-input-textarea.js +1 -1
  106. package/dist/components/mg-input-textarea.js.map +1 -1
  107. package/dist/components/mg-input-title2.js +3 -1
  108. package/dist/components/mg-input-title2.js.map +1 -1
  109. package/dist/components/mg-input-toggle.js +41 -3
  110. package/dist/components/mg-input-toggle.js.map +1 -1
  111. package/dist/components/mg-item-more.js +2 -1
  112. package/dist/components/mg-item-more.js.map +1 -1
  113. package/dist/components/mg-menu2.js +1 -1
  114. package/dist/components/mg-menu2.js.map +1 -1
  115. package/dist/components/mg-pagination2.js +1 -1
  116. package/dist/components/mg-pagination2.js.map +1 -1
  117. package/dist/components/mg-panel.js +1 -1
  118. package/dist/components/mg-panel.js.map +1 -1
  119. package/dist/components/mg-tooltip2.js +1 -1
  120. package/dist/components/mg-tooltip2.js.map +1 -1
  121. package/dist/esm/loader.js +1 -1
  122. package/dist/esm/mg-action-more_34.entry.js +84 -40
  123. package/dist/esm/mg-action-more_34.entry.js.map +1 -1
  124. package/dist/esm/mg-components.js +1 -1
  125. package/dist/esm/mg-item-more.entry.js +2 -1
  126. package/dist/esm/mg-item-more.entry.js.map +1 -1
  127. package/dist/mg-components/mg-components.esm.js +1 -1
  128. package/dist/mg-components/mg-components.esm.js.map +1 -1
  129. package/dist/mg-components/p-01ebc95a.entry.js +2 -0
  130. package/dist/mg-components/p-01ebc95a.entry.js.map +1 -0
  131. package/dist/mg-components/p-71a5a848.entry.js +2 -0
  132. package/dist/mg-components/p-71a5a848.entry.js.map +1 -0
  133. package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +4 -0
  134. package/dist/types/components/atoms/mg-input-title/test/mg-input-title.e2e.playwright.d.ts +1 -0
  135. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.d.ts +4 -0
  136. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +1 -4
  137. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +2 -2
  138. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.conf.d.ts +3 -6
  139. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +2 -2
  140. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +22 -0
  141. package/dist/types/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.playwright.d.ts +1 -0
  142. package/dist/types/components/molecules/menu/mg-menu/test/mg-menu.e2e.playwright.d.ts +1 -0
  143. package/dist/types/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.playwright.d.ts +1 -0
  144. package/dist/types/components/molecules/mg-action-more/mg-action-more.conf.d.ts +1 -3
  145. package/dist/types/components.d.ts +26 -4
  146. package/package.json +6 -6
  147. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.e2e.js +0 -18
  148. package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.e2e.js.map +0 -1
  149. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.js +0 -125
  150. package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.js.map +0 -1
  151. package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.e2e.js.map +0 -1
  152. package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.js +0 -119
  153. package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.js.map +0 -1
  154. package/dist/mg-components/p-768fc594.entry.js +0 -2
  155. package/dist/mg-components/p-768fc594.entry.js.map +0 -1
  156. package/dist/mg-components/p-d2d6afec.entry.js +0 -2
  157. package/dist/mg-components/p-d2d6afec.entry.js.map +0 -1
@@ -8,6 +8,10 @@ export declare class MgInputTitle {
8
8
  * If input is required an asterisk is added at the end of the label
9
9
  */
10
10
  required: boolean;
11
+ /**
12
+ * If input is required an asterisk is added at the end of the label
13
+ */
14
+ readonly: boolean;
11
15
  /**
12
16
  * Switch from label to fieldset sementic
13
17
  */
@@ -23,6 +23,10 @@ export declare class MgInputCheckboxPaginated implements IMgInputCheckboxBase {
23
23
  * Define mg-input-checkbox input name
24
24
  */
25
25
  name: string;
26
+ /**
27
+ * Define mg-input-checkbox input invalid
28
+ */
29
+ invalid: boolean;
26
30
  /**
27
31
  * Define checkboxes to paginate
28
32
  */
@@ -30,10 +30,6 @@ export declare const checkboxTypes: readonly ["checkbox", "multi"];
30
30
  * ChecboxType from checkbox types
31
31
  */
32
32
  export type CheckboxType = (typeof checkboxTypes)[number];
33
- /**
34
- * Search value type
35
- */
36
- export type SearchValueType = string;
37
33
  /**
38
34
  * mg-input-checkbox-paginated section kind
39
35
  */
@@ -55,6 +51,7 @@ export interface IMgInputCheckboxBase {
55
51
  readonly: boolean;
56
52
  disabled: boolean;
57
53
  name: string;
54
+ invalid: boolean;
58
55
  }
59
56
  /**
60
57
  * mg-input-checkbox-list interface
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter } from '../../../../stencil-public-runtime';
2
2
  import { ClassList } from '../../../../utils/components.utils';
3
- import { CheckboxItem, CheckboxType, CheckboxValue, SearchValueType, MgInputCheckboxListProps } from './mg-input-checkbox.conf';
3
+ import { CheckboxItem, CheckboxType, CheckboxValue, MgInputCheckboxListProps } from './mg-input-checkbox.conf';
4
4
  export declare class MgInputCheckbox implements Omit<MgInputCheckboxListProps, 'id' | 'checkboxes' | 'messages'> {
5
5
  /************
6
6
  * Internal *
@@ -116,7 +116,7 @@ export declare class MgInputCheckbox implements Omit<MgInputCheckboxListProps, '
116
116
  /**
117
117
  * Search value query
118
118
  */
119
- searchValue: SearchValueType;
119
+ searchValue: string;
120
120
  validateSearchValue(): void;
121
121
  /**
122
122
  * Search current page
@@ -1,12 +1,9 @@
1
1
  /**
2
- * List of all availables text type
2
+ * List of all available text types
3
3
  */
4
- export declare const textTypes: readonly ["text", "search"];
4
+ declare const textTypes: readonly ["text", "search"];
5
5
  /**
6
6
  * TextType from text types
7
7
  */
8
8
  export type TextType = (typeof textTypes)[number];
9
- /**
10
- * Type for datalist option
11
- */
12
- export type DatalistOption = string;
9
+ export {};
@@ -1,7 +1,7 @@
1
1
  import { EventEmitter } from '../../../../stencil-public-runtime';
2
2
  import { Width } from '../MgInput.conf';
3
3
  import { ClassList } from '../../../../utils/components.utils';
4
- import { DatalistOption, TextType } from './mg-input-text.conf';
4
+ import { TextType } from './mg-input-text.conf';
5
5
  export declare class MgInputText {
6
6
  /************
7
7
  * Internal *
@@ -64,7 +64,7 @@ export declare class MgInputText {
64
64
  /**
65
65
  * Define datalist options
66
66
  */
67
- datalistoptions: DatalistOption[];
67
+ datalistoptions: string[];
68
68
  validateDatalistoptions(newValue: MgInputText['datalistoptions']): void;
69
69
  /**
70
70
  * Input max length
@@ -84,6 +84,14 @@ export declare class MgInputToggle {
84
84
  * Formated items for display
85
85
  */
86
86
  options: ToggleValue[];
87
+ /**
88
+ * Error message to display
89
+ */
90
+ errorMessage: string;
91
+ /**
92
+ * Define input valid state
93
+ */
94
+ valid: boolean;
87
95
  /**
88
96
  * Checked internal value
89
97
  */
@@ -97,6 +105,20 @@ export declare class MgInputToggle {
97
105
  * Emited event when checking validity
98
106
  */
99
107
  inputValid: EventEmitter<boolean>;
108
+ /**
109
+ * Set an error and display a custom error message.
110
+ * This method can be used to set the component's error state from its context by passing a boolean value to the `valid` parameter.
111
+ * It must be paired with an error message to display for the given context.
112
+ * When used to set validity to `false`, you should use this method again to reset the validity to `true`.
113
+ * @param valid - value indicating the validity
114
+ * @param errorMessage - the error message to display
115
+ */
116
+ setError(valid: boolean, errorMessage: string): Promise<void>;
117
+ /**
118
+ * Set input error message
119
+ * @param errorMessage - errorMessage override
120
+ */
121
+ private setErrorMessage;
100
122
  /**
101
123
  * Change checked value
102
124
  */
@@ -36,7 +36,5 @@ export type MgActionMoreItemType = {
36
36
  /**
37
37
  * MouseEvent callback interface
38
38
  */
39
- interface IMouseEventHandler {
40
- (event: MouseEvent): void;
41
- }
39
+ type IMouseEventHandler = (event: MouseEvent) => void;
42
40
  export {};
@@ -14,7 +14,7 @@ import { CheckboxItem, CheckboxType, CheckboxValue, SectionKind } from "./compon
14
14
  import { Width } from "./components/molecules/inputs/MgInput.conf";
15
15
  import { RadioOption } from "./components/molecules/inputs/mg-input-radio/mg-input-radio.conf";
16
16
  import { SelectOption } from "./components/molecules/inputs/mg-input-select/mg-input-select.conf";
17
- import { DatalistOption, TextType } from "./components/molecules/inputs/mg-input-text/mg-input-text.conf";
17
+ import { TextType } from "./components/molecules/inputs/mg-input-text/mg-input-text.conf";
18
18
  import { ToggleValue } from "./components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf";
19
19
  import { IconType, SizeType, SlotLabelType } from "./components/molecules/mg-item-more/mg-item-more.conf";
20
20
  import { Direction, ItemMoreType, MenuSizeType } from "./components/molecules/menu/mg-menu/mg-menu.conf";
@@ -35,7 +35,7 @@ export { CheckboxItem, CheckboxType, CheckboxValue, SectionKind } from "./compon
35
35
  export { Width } from "./components/molecules/inputs/MgInput.conf";
36
36
  export { RadioOption } from "./components/molecules/inputs/mg-input-radio/mg-input-radio.conf";
37
37
  export { SelectOption } from "./components/molecules/inputs/mg-input-select/mg-input-select.conf";
38
- export { DatalistOption, TextType } from "./components/molecules/inputs/mg-input-text/mg-input-text.conf";
38
+ export { TextType } from "./components/molecules/inputs/mg-input-text/mg-input-text.conf";
39
39
  export { ToggleValue } from "./components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf";
40
40
  export { IconType, SizeType, SlotLabelType } from "./components/molecules/mg-item-more/mg-item-more.conf";
41
41
  export { Direction, ItemMoreType, MenuSizeType } from "./components/molecules/menu/mg-menu/mg-menu.conf";
@@ -320,6 +320,10 @@ export namespace Components {
320
320
  * Define if mg-input-checkbox-list is disabled
321
321
  */
322
322
  "disabled": boolean;
323
+ /**
324
+ * Define mg-input-checkbox input invalid
325
+ */
326
+ "invalid": boolean;
323
327
  /**
324
328
  * Define component message
325
329
  */
@@ -737,7 +741,7 @@ export namespace Components {
737
741
  /**
738
742
  * Define datalist options
739
743
  */
740
- "datalistoptions": DatalistOption[];
744
+ "datalistoptions": string[];
741
745
  /**
742
746
  * Define if input is disabled
743
747
  */
@@ -942,6 +946,10 @@ export namespace Components {
942
946
  * Switch from label to fieldset sementic
943
947
  */
944
948
  "isLegend": boolean;
949
+ /**
950
+ * If input is required an asterisk is added at the end of the label
951
+ */
952
+ "readonly": boolean;
945
953
  /**
946
954
  * If input is required an asterisk is added at the end of the label
947
955
  */
@@ -992,6 +1000,12 @@ export namespace Components {
992
1000
  * Define if input is readonly
993
1001
  */
994
1002
  "readonly": boolean;
1003
+ /**
1004
+ * Set an error and display a custom error message. This method can be used to set the component's error state from its context by passing a boolean value to the `valid` parameter. It must be paired with an error message to display for the given context. When used to set validity to `false`, you should use this method again to reset the validity to `true`.
1005
+ * @param valid - value indicating the validity
1006
+ * @param errorMessage - the error message to display
1007
+ */
1008
+ "setError": (valid: boolean, errorMessage: string) => Promise<void>;
995
1009
  /**
996
1010
  * Add a tooltip message next to the input
997
1011
  */
@@ -1885,6 +1899,10 @@ declare namespace LocalJSX {
1885
1899
  * Define if mg-input-checkbox-list is disabled
1886
1900
  */
1887
1901
  "disabled"?: boolean;
1902
+ /**
1903
+ * Define mg-input-checkbox input invalid
1904
+ */
1905
+ "invalid"?: boolean;
1888
1906
  /**
1889
1907
  * Define component message
1890
1908
  */
@@ -2296,7 +2314,7 @@ declare namespace LocalJSX {
2296
2314
  /**
2297
2315
  * Define datalist options
2298
2316
  */
2299
- "datalistoptions"?: DatalistOption[];
2317
+ "datalistoptions"?: string[];
2300
2318
  /**
2301
2319
  * Define if input is disabled
2302
2320
  */
@@ -2493,6 +2511,10 @@ declare namespace LocalJSX {
2493
2511
  * Switch from label to fieldset sementic
2494
2512
  */
2495
2513
  "isLegend"?: boolean;
2514
+ /**
2515
+ * If input is required an asterisk is added at the end of the label
2516
+ */
2517
+ "readonly"?: boolean;
2496
2518
  /**
2497
2519
  * If input is required an asterisk is added at the end of the label
2498
2520
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mgdis/mg-components",
3
- "version": "5.19.0",
3
+ "version": "5.19.2",
4
4
  "description": "MG Components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -72,8 +72,8 @@
72
72
  "style-loader": "^2.0.0",
73
73
  "ts-node": "^10.9.1",
74
74
  "typescript": "^5.0.0",
75
- "eslint-config-stencil": "1.1.1",
76
75
  "@mgdis/linting-stencil": "1.1.0",
76
+ "eslint-config-stencil": "1.1.1",
77
77
  "playwright-config": "1.0.0",
78
78
  "tsconfig": "1.0.0"
79
79
  },
@@ -84,10 +84,10 @@
84
84
  "start": "pnpm prebuild && stencil build --dev --watch --serve",
85
85
  "lint": "pnpm lint:es && pnpm lint:prettier",
86
86
  "lint:fix": "pnpm lint:es:fix && pnpm lint:prettier:fix",
87
- "lint:es": "eslint src/**/*.{ts,tsx}",
88
- "lint:es:fix": "eslint src/**/*.{ts,tsx} --fix",
89
- "lint:prettier": "prettier --check **/*.{ts,tsx,html,mdx,json}",
90
- "lint:prettier:fix": "prettier --write **/*.{ts,tsx,html,mdx,json}",
87
+ "lint:es": "eslint 'src/**/*.{ts,tsx}'",
88
+ "lint:es:fix": "eslint 'src/**/*.{ts,tsx}' --fix",
89
+ "lint:prettier": "prettier --check '**/*.{ts,tsx,html,mdx,json}'",
90
+ "lint:prettier:fix": "prettier --write '**/*.{ts,tsx,html,mdx,json}'",
91
91
  "test": "TZ=UTC stencil test --spec --e2e",
92
92
  "test:unit": "TZ=UTC stencil test --spec --collectCoverage",
93
93
  "test:e2e": "pnpm prebuild && stencil test --e2e --collectCoverage --collectCoverageFrom=\"src/**/*.e2e.ts\" --reporters=\"default\" --reporters=\"jest-junit\"",
@@ -1,18 +0,0 @@
1
- import { createPage } from "../../../../utils/stencil.e2e.test.utils";
2
- describe('mg-input-title', () => {
3
- test('Should render', async () => {
4
- const props = [
5
- { isLegend: false, required: false },
6
- { isLegend: false, required: true },
7
- { isLegend: true, required: false },
8
- { isLegend: true, required: true },
9
- ];
10
- const html = props
11
- .map(({ isLegend, required }) => `<div><mg-input-title identifier="identifier" is-legend="${isLegend}" required=${required}>Label</mg-input-title></div>`)
12
- .join('');
13
- const page = await createPage(html, { width: 50, height: 75 });
14
- const screenshot = await page.screenshot();
15
- expect(screenshot).toMatchImageSnapshot();
16
- });
17
- });
18
- //# sourceMappingURL=mg-input-title.e2e.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mg-input-title.e2e.js","sourceRoot":"","sources":["../../../../../src/components/atoms/mg-input-title/test/mg-input-title.e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;EAC9B,IAAI,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;IAC/B,MAAM,KAAK,GAAG;MACZ,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE;MACpC,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE;MACnC,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE;MACnC,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;KACnC,CAAC;IACF,MAAM,IAAI,GAAG,KAAK;OACf,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,2DAA2D,QAAQ,cAAc,QAAQ,+BAA+B,CAAC;OACzJ,IAAI,CAAC,EAAE,CAAC,CAAC;IACZ,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;IAE/D,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3C,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,EAAE,CAAC;EAC5C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { createPage } from '../../../../utils/stencil.e2e.test.utils';\n\ndescribe('mg-input-title', () => {\n test('Should render', async () => {\n const props = [\n { isLegend: false, required: false },\n { isLegend: false, required: true },\n { isLegend: true, required: false },\n { isLegend: true, required: true },\n ];\n const html = props\n .map(({ isLegend, required }) => `<div><mg-input-title identifier=\"identifier\" is-legend=\"${isLegend}\" required=${required}>Label</mg-input-title></div>`)\n .join('');\n const page = await createPage(html, { width: 50, height: 75 });\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n });\n});\n"]}
@@ -1,125 +0,0 @@
1
- import { createPage } from "../../../../../utils/stencil.e2e.test.utils";
2
- const defaultSlots = '<span slot="item-1">Choix A</span><span slot="item-2">Choix B</span>';
3
- describe('mg-input-toggle', () => {
4
- test.each([
5
- `<mg-input-toggle identifier="identifier" label="label">${defaultSlots}</mg-input-toggle>`,
6
- `<mg-input-toggle identifier="identifier" label="label" is-on-off><span slot="item-1">Non</span><span slot="item-2">Oui</span></mg-input-toggle>`,
7
- `<mg-input-toggle identifier="identifier" label="label" is-icon is-on-off><mg-icon icon="cross" slot="item-1"></mg-icon><mg-icon icon="check" slot="item-2"></mg-icon></mg-input-toggle>`,
8
- `<mg-input-toggle identifier="identifier" label="label" identifier="toggle-long-text"><span slot="item-1">Choix A très long long long long long long long long long long long long long</span><span slot="item-2">Choix B très long long long long long long long long long long long long long</span></mg-input-toggle>`,
9
- ])('Keyboard navigation', async (html) => {
10
- const page = await createPage(`${html}
11
- <script>
12
- const mgInputToggle = document.querySelector('mg-input-toggle');
13
- mgInputToggle.items = [{title: 'batman', value: false}, {title: 'joker', value: true}];
14
- </script>`);
15
- const element = await page.find('mg-input-toggle');
16
- const toggle = await page.find('mg-input-toggle >>> button');
17
- expect(element).toHaveClass('hydrated');
18
- const screenshot = await page.screenshot();
19
- expect(screenshot).toMatchImageSnapshot();
20
- await page.keyboard.down('Tab');
21
- await page.waitForChanges();
22
- const screenshotFocus = await page.screenshot();
23
- expect(screenshotFocus).toMatchImageSnapshot();
24
- await toggle.press('Space');
25
- await page.waitForChanges();
26
- const screenshotSelection = await page.screenshot();
27
- expect(screenshotSelection).toMatchImageSnapshot();
28
- await page.keyboard.down('Tab');
29
- await page.waitForChanges();
30
- const screenshotUnSelect = await page.screenshot();
31
- expect(screenshotUnSelect).toMatchImageSnapshot();
32
- });
33
- test.each([
34
- `<mg-input-toggle identifier="identifier" label="label" label-on-top help-text="HelpText Message">${defaultSlots}</mg-input-toggle>`,
35
- `<mg-input-toggle identifier="identifier" label="label" input-vertical-list help-text="HelpText Message">${defaultSlots}</mg-input-toggle>`,
36
- `<mg-input-toggle identifier="identifier" label="label" label-on-top input-vertical-list help-text="HelpText Message">${defaultSlots}</mg-input-toggle>`,
37
- `<mg-input-toggle identifier="identifier" label="label" identifier="toggle-long-text"><span slot="item-1">Choix A très long long long long long long long long long long long long long</span><span slot="item-2">Choix B très long long long long long long long long long long long long long</span></mg-input-toggle>`,
38
- `<mg-input-toggle identifier="identifier" label="label" identifier="toggle-long-text-readonly" readonly><span slot="item-1">Choix A avec text long long</span><span slot="item-2">Choix B avec text long long</span></mg-input-toggle>`,
39
- `<mg-input-toggle identifier="identifier" label="label" label-hide>${defaultSlots}</mg-input-toggle>`,
40
- `<mg-input-toggle identifier="identifier" label="label" is-on-off readonly><span slot="item-1">Off</span><span slot="item-2">On</span></mg-input-toggle>`,
41
- `<mg-input-toggle identifier="identifier" label="label" placeholder="placeholder" help-text="HelpText Message">${defaultSlots}</mg-input-toggle>`,
42
- `<mg-input-toggle identifier="identifier" label="label" help-text='<mg-icon icon="user" size="small"></mg-icon> Welcome batman'>${defaultSlots}</mg-input-toggle>`,
43
- ])('Render without tooltip', async (html) => {
44
- const page = await createPage(`${html}
45
- <script>
46
- const mgInputToggle = document.querySelector('mg-input-toggle');
47
- mgInputToggle.items = [{title: 'batman', value: false}, {title: 'joker', value: true}];
48
- </script>`);
49
- const element = await page.find('mg-input-toggle');
50
- expect(element).toHaveClass('hydrated');
51
- const screenshot = await page.screenshot();
52
- expect(screenshot).toMatchImageSnapshot();
53
- });
54
- test.each([undefined, false, true])('Render and toggle value whith reverse checked logic', async (value) => {
55
- const page = await createPage(`${`<mg-input-toggle identifier="identifier" label="label">${defaultSlots}</mg-input-toggle>`}
56
- <script>
57
- const mgInputToggle = document.querySelector('mg-input-toggle');
58
- mgInputToggle.items = [{title: 'batman', value: true}, {title: 'joker', value: false}];
59
- mgInputToggle.value = ${value};
60
- </script>`);
61
- const element = await page.find('mg-input-toggle');
62
- const button = await page.find('mg-input-toggle >>> button');
63
- expect(element).toHaveClass('hydrated');
64
- const screenshot = await page.screenshot();
65
- expect(screenshot).toMatchImageSnapshot();
66
- await button.click();
67
- const screenshot2 = await page.screenshot();
68
- expect(screenshot2).toMatchImageSnapshot();
69
- });
70
- test.each([true, false])('render with tooltip, case label-on-top %s', async (labelOnTop) => {
71
- const page = await createPage(`<mg-input-toggle identifier="identifier" label="label" tooltip="Tooltip message" label-on-top="${labelOnTop}">${defaultSlots}</mg-input-toggle>
72
- <script>
73
- const mgInputToggle = document.querySelector('mg-input-toggle');
74
- mgInputToggle.items = [{title: 'batman', value: false}, {title: 'joker', value: true}];
75
- </script>`);
76
- const element = await page.find('mg-input-toggle');
77
- expect(element).toHaveClass('hydrated');
78
- const screenshot = await page.screenshot();
79
- expect(screenshot).toMatchImageSnapshot();
80
- await page.keyboard.down('Tab');
81
- if (!labelOnTop) {
82
- // Ensure to display tooltip
83
- await page.setViewport({ width: 600, height: 65 });
84
- // when label on top tooltip is on fist tab (next to label)
85
- await page.keyboard.down('Tab');
86
- }
87
- const screenshotTooltip = await page.screenshot();
88
- expect(screenshotTooltip).toMatchImageSnapshot();
89
- });
90
- test.each([
91
- `<mg-input-toggle identifier="identifier" label="label" readonly>${defaultSlots}</mg-input-toggle>`,
92
- `<mg-input-toggle identifier="identifier" label="label" value="true">${defaultSlots}</mg-input-toggle>`,
93
- `<mg-input-toggle identifier="identifier" label="label" value="true" readonly>${defaultSlots}</mg-input-toggle>`,
94
- `<mg-input-toggle identifier="identifier" label="label" value="true" readonly label-on-top>${defaultSlots}</mg-input-toggle>`,
95
- `<mg-input-toggle identifier="identifier" label="label" disabled>${defaultSlots}</mg-input-toggle>`,
96
- `<mg-input-toggle identifier="identifier" label="label" value="true" disabled>${defaultSlots}</mg-input-toggle>`,
97
- ])('Should render with template', async (html) => {
98
- const page = await createPage(`${html}
99
- <script>
100
- const mgInputToggle = document.querySelector('mg-input-toggle');
101
- mgInputToggle.items = [{title: 'batman', value: false}, {title: 'joker', value: true}];
102
- </script>`);
103
- const element = await page.find('mg-input-toggle');
104
- expect(element).toHaveClass('hydrated');
105
- const screenshot = await page.screenshot();
106
- expect(screenshot).toMatchImageSnapshot();
107
- });
108
- describe.each([
109
- `<mg-input-toggle identifier="identifier" label="long label long label long label long label long label long label long label long label long label long label long label" tooltip="tooltip message">${defaultSlots}</mg-input-toggle>`,
110
- `<mg-input-toggle identifier="identifier" label="long label long label long label long label long label long label long label long label long label long label long label" tooltip="tooltip message" label-on-top>${defaultSlots}</mg-input-toggle>`,
111
- ])('inside a div.mg-form-group', html => {
112
- test('render', async () => {
113
- const page = await createPage(`<div class="mg-form-group">${html}</div>
114
- <script>
115
- const mgInputToggle = document.querySelector('mg-input-toggle');
116
- mgInputToggle.items = [{title: 'batman', value: false}, {title: 'joker', value: true}];
117
- </script>`);
118
- const element = await page.find('mg-input-toggle');
119
- expect(element).toHaveClass('hydrated');
120
- const screenshot = await page.screenshot();
121
- expect(screenshot).toMatchImageSnapshot();
122
- });
123
- });
124
- });
125
- //# sourceMappingURL=mg-input-toggle.e2e.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mg-input-toggle.e2e.js","sourceRoot":"","sources":["../../../../../../src/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,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AC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { createPage } from '../../../../../utils/stencil.e2e.test.utils';\n\nconst defaultSlots = '<span slot=\"item-1\">Choix A</span><span slot=\"item-2\">Choix B</span>';\n\ndescribe('mg-input-toggle', () => {\n test.each([\n `<mg-input-toggle identifier=\"identifier\" label=\"label\">${defaultSlots}</mg-input-toggle>`,\n `<mg-input-toggle identifier=\"identifier\" label=\"label\" is-on-off><span slot=\"item-1\">Non</span><span slot=\"item-2\">Oui</span></mg-input-toggle>`,\n `<mg-input-toggle identifier=\"identifier\" label=\"label\" is-icon is-on-off><mg-icon icon=\"cross\" slot=\"item-1\"></mg-icon><mg-icon icon=\"check\" slot=\"item-2\"></mg-icon></mg-input-toggle>`,\n `<mg-input-toggle identifier=\"identifier\" label=\"label\" identifier=\"toggle-long-text\"><span slot=\"item-1\">Choix A très long long long long long long long long long long long long long</span><span slot=\"item-2\">Choix B très long long long long long long long long long long long long long</span></mg-input-toggle>`,\n ])('Keyboard navigation', async html => {\n const page = await createPage(`${html}\n <script>\n const mgInputToggle = document.querySelector('mg-input-toggle');\n mgInputToggle.items = [{title: 'batman', value: false}, {title: 'joker', value: true}];\n </script>`);\n\n const element = await page.find('mg-input-toggle');\n const toggle = await page.find('mg-input-toggle >>> button');\n\n expect(element).toHaveClass('hydrated');\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n\n await page.keyboard.down('Tab');\n\n await page.waitForChanges();\n\n const screenshotFocus = await page.screenshot();\n expect(screenshotFocus).toMatchImageSnapshot();\n\n await toggle.press('Space');\n\n await page.waitForChanges();\n\n const screenshotSelection = await page.screenshot();\n expect(screenshotSelection).toMatchImageSnapshot();\n\n await page.keyboard.down('Tab');\n\n await page.waitForChanges();\n\n const screenshotUnSelect = await page.screenshot();\n expect(screenshotUnSelect).toMatchImageSnapshot();\n });\n\n test.each([\n `<mg-input-toggle identifier=\"identifier\" label=\"label\" label-on-top help-text=\"HelpText Message\">${defaultSlots}</mg-input-toggle>`,\n `<mg-input-toggle identifier=\"identifier\" label=\"label\" input-vertical-list help-text=\"HelpText Message\">${defaultSlots}</mg-input-toggle>`,\n `<mg-input-toggle identifier=\"identifier\" label=\"label\" label-on-top input-vertical-list help-text=\"HelpText Message\">${defaultSlots}</mg-input-toggle>`,\n `<mg-input-toggle identifier=\"identifier\" label=\"label\" identifier=\"toggle-long-text\"><span slot=\"item-1\">Choix A très long long long long long long long long long long long long long</span><span slot=\"item-2\">Choix B très long long long long long long long long long long long long long</span></mg-input-toggle>`,\n `<mg-input-toggle identifier=\"identifier\" label=\"label\" identifier=\"toggle-long-text-readonly\" readonly><span slot=\"item-1\">Choix A avec text long long</span><span slot=\"item-2\">Choix B avec text long long</span></mg-input-toggle>`,\n `<mg-input-toggle identifier=\"identifier\" label=\"label\" label-hide>${defaultSlots}</mg-input-toggle>`,\n `<mg-input-toggle identifier=\"identifier\" label=\"label\" is-on-off readonly><span slot=\"item-1\">Off</span><span slot=\"item-2\">On</span></mg-input-toggle>`,\n `<mg-input-toggle identifier=\"identifier\" label=\"label\" placeholder=\"placeholder\" help-text=\"HelpText Message\">${defaultSlots}</mg-input-toggle>`,\n `<mg-input-toggle identifier=\"identifier\" label=\"label\" help-text='<mg-icon icon=\"user\" size=\"small\"></mg-icon> Welcome batman'>${defaultSlots}</mg-input-toggle>`,\n ])('Render without tooltip', async html => {\n const page = await createPage(`${html}\n <script>\n const mgInputToggle = document.querySelector('mg-input-toggle');\n mgInputToggle.items = [{title: 'batman', value: false}, {title: 'joker', value: true}];\n </script>`);\n\n const element = await page.find('mg-input-toggle');\n\n expect(element).toHaveClass('hydrated');\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n });\n\n test.each([undefined, false, true])('Render and toggle value whith reverse checked logic', async value => {\n const page = await createPage(`${`<mg-input-toggle identifier=\"identifier\" label=\"label\">${defaultSlots}</mg-input-toggle>`}\n <script>\n const mgInputToggle = document.querySelector('mg-input-toggle');\n mgInputToggle.items = [{title: 'batman', value: true}, {title: 'joker', value: false}];\n mgInputToggle.value = ${value};\n </script>`);\n\n const element = await page.find('mg-input-toggle');\n const button = await page.find('mg-input-toggle >>> button');\n\n expect(element).toHaveClass('hydrated');\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n\n await button.click();\n\n const screenshot2 = await page.screenshot();\n expect(screenshot2).toMatchImageSnapshot();\n });\n\n test.each([true, false])('render with tooltip, case label-on-top %s', async labelOnTop => {\n const page = await createPage(`<mg-input-toggle identifier=\"identifier\" label=\"label\" tooltip=\"Tooltip message\" label-on-top=\"${labelOnTop}\">${defaultSlots}</mg-input-toggle>\n <script>\n const mgInputToggle = document.querySelector('mg-input-toggle');\n mgInputToggle.items = [{title: 'batman', value: false}, {title: 'joker', value: true}];\n </script>`);\n\n const element = await page.find('mg-input-toggle');\n\n expect(element).toHaveClass('hydrated');\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n\n await page.keyboard.down('Tab');\n if (!labelOnTop) {\n // Ensure to display tooltip\n await page.setViewport({ width: 600, height: 65 });\n // when label on top tooltip is on fist tab (next to label)\n await page.keyboard.down('Tab');\n }\n\n const screenshotTooltip = await page.screenshot();\n expect(screenshotTooltip).toMatchImageSnapshot();\n });\n\n test.each([\n `<mg-input-toggle identifier=\"identifier\" label=\"label\" readonly>${defaultSlots}</mg-input-toggle>`,\n `<mg-input-toggle identifier=\"identifier\" label=\"label\" value=\"true\">${defaultSlots}</mg-input-toggle>`,\n `<mg-input-toggle identifier=\"identifier\" label=\"label\" value=\"true\" readonly>${defaultSlots}</mg-input-toggle>`,\n `<mg-input-toggle identifier=\"identifier\" label=\"label\" value=\"true\" readonly label-on-top>${defaultSlots}</mg-input-toggle>`,\n `<mg-input-toggle identifier=\"identifier\" label=\"label\" disabled>${defaultSlots}</mg-input-toggle>`,\n `<mg-input-toggle identifier=\"identifier\" label=\"label\" value=\"true\" disabled>${defaultSlots}</mg-input-toggle>`,\n ])('Should render with template', async html => {\n const page = await createPage(`${html}\n <script>\n const mgInputToggle = document.querySelector('mg-input-toggle');\n mgInputToggle.items = [{title: 'batman', value: false}, {title: 'joker', value: true}];\n </script>`);\n\n const element = await page.find('mg-input-toggle');\n\n expect(element).toHaveClass('hydrated');\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n });\n\n describe.each([\n `<mg-input-toggle identifier=\"identifier\" label=\"long label long label long label long label long label long label long label long label long label long label long label\" tooltip=\"tooltip message\">${defaultSlots}</mg-input-toggle>`,\n `<mg-input-toggle identifier=\"identifier\" label=\"long label long label long label long label long label long label long label long label long label long label long label\" tooltip=\"tooltip message\" label-on-top>${defaultSlots}</mg-input-toggle>`,\n ])('inside a div.mg-form-group', html => {\n test('render', async () => {\n const page = await createPage(`<div class=\"mg-form-group\">${html}</div>\n <script>\n const mgInputToggle = document.querySelector('mg-input-toggle');\n mgInputToggle.items = [{title: 'batman', value: false}, {title: 'joker', value: true}];\n </script>`);\n\n const element = await page.find('mg-input-toggle');\n\n expect(element).toHaveClass('hydrated');\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n });\n });\n});\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"mg-menu.e2e.js","sourceRoot":"","sources":["../../../../../../src/components/molecules/menu/mg-menu/test/mg-menu.e2e.ts"],"names":[],"mappings":";;;;;;;AACA,OAAO,EAAE,UAAU,EAAuB,MAAM,6CAA6C,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,SAAS,EAAgB,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAEjE,IAAK,QAGJ;AAHD,WAAK,QAAQ;EACX,2BAAe,CAAA;EACf,yBAAa,CAAA;AACf,CAAC,EAHI,QAAQ,KAAR,QAAQ,QAGZ;AAED,IAAK,GAIJ;AAJD,WAAK,GAAG;EACN,kBAAW,CAAA;EACX,sB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C;;QAEF,KAA2B,eAAA,YAAA,cAAA,OAAO,CAAA,aAAA,+EAAE;UAAT,uBAAO;UAAP,WAAO;UAAvB,MAAM,MAAM,KAAA,CAAA;UACrB,IAAI,MAAM,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,EAAE;YAC5B,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACpC,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACnC,MAAM,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;WACnC;eAAM;YACL,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,GAA0B,CAAC,CAAC;WACzE;UACD,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;UAC5B,MAAM,mBAAmB,CAAC,IAAI,CAAC,CAAC;SACjC;;;;;;;;;IACH,CAAC,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { KeyInput } from 'puppeteer';\nimport { createPage, DesignSystemE2EPage } from '../../../../../utils/stencil.e2e.test.utils';\nimport { renderAttributes } from '../../../../../utils/e2e.test.utils';\nimport { Direction, MenuSizeType, sizes } from '../mg-menu.conf';\n\nenum Position {\n PRESS = 'press',\n DOWN = 'down',\n}\n\nenum Key {\n TAB = 'Tab',\n SHIFT = 'Shift',\n ENTER = 'Enter',\n}\n\nconst expectImageSnapshot = async (page: DesignSystemE2EPage) => {\n await page.waitForChanges();\n await page.waitForTimeout(200);\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n};\n\nconst getSubMenuSize = (size: MenuSizeType) => {\n if (size === 'large') return 'medium';\n else if (size === 'medium') return 'regular';\n else return 'regular';\n};\n\nconst getFrameSize = (direction, size?) =>\n direction === Direction.VERTICAL\n ? { width: 400, height: ['medium', 'large'].includes(size) ? 400 : 250 }\n : { width: ['medium', 'large'].includes(size) ? 1100 : 800, height: 200 };\n\nconst createHTML = (args, containerSize?) => `\n <header class=\"menu-container menu-container--${containerSize}\">\n <mg-menu ${renderAttributes({ label: 'menu', ...args })}>\n <mg-menu-item status=\"active\">\n <span slot=\"label\">1 - head-1</span>\n <mg-menu ${renderAttributes({ label: 'sub-menu 1', direction: Direction.VERTICAL, size: getSubMenuSize(args?.size) })}>\n <mg-menu-item><span slot=\"label\">Batman begins</span></mg-menu-item>\n </mg-menu>\n </mg-menu-item>\n <mg-menu-item status=\"disabled\"><span slot=\"label\">1 - head-2 long</span></mg-menu-item>\n <mg-menu-item href=\"#link\">\n <span slot=\"label\">1 - head-3 very long</span>\n <mg-icon icon='user' slot='image'></mg-icon>\n </mg-menu-item>\n <mg-menu-item>\n <span slot=\"label\">1 - head-4</span>\n <mg-icon icon='user' slot='image'></mg-icon>\n ${args?.badge ? \"<mg-badge value='2' label='hello' slot='information'></mg-badge>\" : ''} \n </mg-menu-item>\n <mg-menu-item>\n <span slot=\"label\">1 - head-5</span>\n <mg-icon icon='user' slot='image'></mg-icon>\n ${args?.badge ? \"<mg-badge value='2' label='hello' slot='information'></mg-badge>\" : ''} \n <mg-menu ${renderAttributes({ label: 'sub-menu 2', direction: Direction.VERTICAL, size: getSubMenuSize(args?.size) })}>\n <mg-menu-item><span slot=\"label\">Batman begins with a longer title to go outide screen</span></mg-menu-item>\n </mg-menu>\n </mg-menu-item>\n </mg-menu>\n </header>\n <style>\n .menu-container.menu-container--vertical-small {\n width: 180px;\n }\n </style>\n `;\n\ndescribe('mg-menu', () => {\n describe.each([Direction.HORIZONTAL, Direction.VERTICAL])('direction %s', direction => {\n test.each(sizes)(`should renders, case direction ${direction} size %s with large screen`, async size => {\n const page = await createPage(createHTML({ direction, size, badge: true }), getFrameSize(direction, size));\n\n const element = await page.find('mg-menu');\n expect(element).toHaveClass('hydrated');\n\n await expectImageSnapshot(page);\n });\n });\n\n describe('navigation horizontal', () => {\n test(`should success mouse navigation, case direction ${Direction.HORIZONTAL}`, async () => {\n const page = await createPage(createHTML({ direction: Direction.HORIZONTAL }), getFrameSize(Direction.HORIZONTAL));\n await expectImageSnapshot(page);\n\n const actions = [\n { position: 1, expanded: true },\n { position: 5, expanded: true },\n { position: 5, expanded: false },\n { position: 1, expanded: true },\n ];\n for await (const action of actions) {\n let item = await page.find(`header > mg-menu > mg-menu-item:nth-of-type(${action.position}) >>> button`);\n await item.click();\n await page.waitForChanges();\n\n expect(item.getAttribute('aria-expanded')).toBe(`${action.expanded}`);\n item = await page.find(`header > mg-menu > mg-menu-item:not(:nth-of-type(${action.position})) >>> button[aria-expanded=\"true\"]`);\n expect(item).toBe(null);\n }\n\n // menu-item close\n await page.$eval('body', elm => {\n elm.dispatchEvent(new MouseEvent('click', { bubbles: true }));\n });\n await page.waitForChanges();\n await expectImageSnapshot(page);\n });\n\n test(`should success keyboard navigation, case direction ${Direction.HORIZONTAL}`, async () => {\n const page = await createPage(createHTML({ direction: Direction.HORIZONTAL }), getFrameSize(Direction.HORIZONTAL));\n await expectImageSnapshot(page);\n\n const actions = [\n { position: Position.PRESS, key: Key.TAB, openeItem: null },\n { position: Position.PRESS, key: Key.TAB, openeItem: null },\n { position: Position.PRESS, key: Key.TAB, openeItem: null },\n { position: Position.PRESS, key: Key.TAB, openeItem: null },\n { position: Position.PRESS, key: Key.ENTER, openeItem: 5 },\n { position: Position.PRESS, key: Key.TAB, openeItem: 5 },\n { position: Position.PRESS, key: Key.SHIFT, openeItem: 5 },\n { position: Position.PRESS, key: Key.ENTER, openeItem: null },\n { position: Position.PRESS, key: Key.TAB, openeItem: null },\n ];\n\n for await (const action of actions) {\n if (action.key === Key.SHIFT) {\n await page.keyboard.down(Key.SHIFT);\n await page.keyboard.press(Key.TAB);\n await page.keyboard.up(Key.SHIFT);\n } else {\n await page.keyboard[action.position](action.key as unknown as KeyInput);\n }\n await page.waitForChanges();\n let item;\n if (action.openeItem > 0) {\n item = await page.find(`header > mg-menu > mg-menu-item:nth-of-type(${action.openeItem}) >>> button[aria-expanded=\"true\"]`);\n expect(item).not.toBe(null);\n item = await page.find(`header > mg-menu > mg-menu-item:not(:nth-of-type(${action.openeItem})) >>> button[aria-expanded=\"true\"]`);\n } else {\n item = await page.find(`header > mg-menu > mg-menu-item >>> button[aria-expanded=\"true\"]`);\n }\n expect(item).toBe(null);\n }\n });\n });\n\n describe('navigation vertical', () => {\n test(`should success mouse navigation, case direction ${Direction.VERTICAL}`, async () => {\n const page = await createPage(createHTML({ direction: Direction.VERTICAL }), getFrameSize(Direction.VERTICAL));\n await expectImageSnapshot(page);\n\n const positions = [1, 5, 5, 1];\n for await (const position of positions) {\n const item = await page.find(`header > mg-menu > mg-menu-item:nth-of-type(${position}) >>> button`);\n await item.click();\n await page.waitForChanges();\n await expectImageSnapshot(page);\n }\n\n await page.$eval('body', elm => {\n elm.dispatchEvent(new MouseEvent('click', { bubbles: true }));\n });\n await page.waitForChanges();\n await expectImageSnapshot(page);\n });\n test(`should success keyboard navigation, case direction ${Direction.VERTICAL}`, async () => {\n const page = await createPage(createHTML({ direction: Direction.VERTICAL }), getFrameSize(Direction.VERTICAL));\n await expectImageSnapshot(page);\n\n const actions = [\n { position: Position.PRESS, key: Key.TAB },\n { position: Position.PRESS, key: Key.TAB },\n { position: Position.PRESS, key: Key.TAB },\n { position: Position.PRESS, key: Key.TAB },\n { position: Position.PRESS, key: Key.ENTER },\n { position: Position.PRESS, key: Key.TAB },\n { position: Position.PRESS, key: Key.SHIFT },\n { position: Position.PRESS, key: Key.ENTER },\n { position: Position.PRESS, key: Key.TAB },\n ];\n\n for await (const action of actions) {\n if (action.key === Key.SHIFT) {\n await page.keyboard.down(Key.SHIFT);\n await page.keyboard.press(Key.TAB);\n await page.keyboard.up(Key.SHIFT);\n } else {\n await page.keyboard[action.position](action.key as unknown as KeyInput);\n }\n await page.waitForChanges();\n await expectImageSnapshot(page);\n }\n });\n });\n});\n"]}
@@ -1,119 +0,0 @@
1
- var __asyncValues = (this && this.__asyncValues) || function (o) {
2
- if (!Symbol.asyncIterator)
3
- throw new TypeError("Symbol.asyncIterator is not defined.");
4
- var m = o[Symbol.asyncIterator], i;
5
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
6
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
7
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
8
- };
9
- import { createPage } from "../../../../../utils/stencil.e2e.test.utils";
10
- import { renderAttributes } from "../../../../../utils/e2e.test.utils";
11
- import { Direction, sizes } from "../../mg-menu/mg-menu.conf";
12
- import { Status } from "../mg-menu-item.conf";
13
- const slotContent = '<div><h3>Demo title</h3><p>some content</p></div>';
14
- const slotMenuItem = '<mg-menu label="submenu"><mg-menu-item><span slot="label">Batman begins</span></mg-menu-item></mg-menu>';
15
- const slotImage = '<mg-icon icon="user" slot="image"></mg-icon>';
16
- const slotInformation = '<mg-badge value="2" label="hello" slot="information"></mg-badge>';
17
- const slotMetadata = '<span slot="metadata">is a hero</span>';
18
- const createHTML = (args, slot = '', direction = Direction.HORIZONTAL) => `
19
- <mg-menu ${renderAttributes(Object.assign({ label: 'batmenu', direction }, args))}">
20
- <mg-menu-item ${renderAttributes(args)}>
21
- <span slot="label">${args.href ? 'batman link' : 'batman'}</span>
22
- ${slot}
23
- </mg-menu-item>
24
- </mg-menu>
25
- `;
26
- describe('mg-menu-item', () => {
27
- describe.each([Direction.HORIZONTAL, Direction.VERTICAL])('render', direction => {
28
- test('should render whith status', async () => {
29
- const html = [Status.ACTIVE, Status.VISIBLE, Status.HIDDEN, Status.DISABLED]
30
- .map(status => {
31
- const template = [undefined, '#link']
32
- .map(href => [true, false].map(submenu => (submenu && href !== undefined ? '' : createHTML({ status, href }, submenu && slotMenuItem, direction))).join(''))
33
- .join('');
34
- return `<h2>${status}<h2/><div>${template}<div>`;
35
- })
36
- .join('');
37
- const page = await createPage(`<h1>${direction} mg-menu - Status</h1>${html}`);
38
- const element = await page.find('mg-menu-item');
39
- expect(element).toHaveClass('hydrated');
40
- const screenshot = await page.screenshot();
41
- expect(screenshot).toMatchImageSnapshot();
42
- });
43
- test('should render whith slots', async () => {
44
- const html = [
45
- { label: 'submenu', slot: slotMenuItem },
46
- { label: 'image', slot: slotImage },
47
- { label: 'information', slot: slotInformation },
48
- { label: 'information AND image', slot: slotInformation + slotImage },
49
- ]
50
- .map(({ label, slot }) => {
51
- const template = [true, false]
52
- .map(submenu => [true, false]
53
- .map(metadata => sizes
54
- .map(size => (submenu && label === 'submenu' ? '' : createHTML({ size }, `${metadata ? slotMetadata : ''} ${submenu ? slot + slotMenuItem : slot}`, direction)))
55
- .join(''))
56
- .join(''))
57
- .join('');
58
- return `<h2>${label}<h2/><div>${template}<div>`;
59
- })
60
- .join('');
61
- const page = await createPage(`<h1>${direction} mg-menu - Slots</h1>${html}`);
62
- const element = await page.find('mg-menu-item');
63
- expect(element).toHaveClass('hydrated');
64
- const screenshot = await page.screenshot();
65
- expect(screenshot).toMatchImageSnapshot();
66
- });
67
- test.each([true, false])(`should renders direction=${direction}, props expanded=%s`, async (expanded) => {
68
- const page = await createPage(createHTML({ expanded }, slotMenuItem, direction));
69
- const element = await page.find('mg-menu-item');
70
- expect(element).toHaveClass('hydrated');
71
- await page.setViewport({ width: 300, height: 200 });
72
- const screenshot = await page.screenshot();
73
- expect(screenshot).toMatchImageSnapshot();
74
- });
75
- test('should render content slot', async () => {
76
- const page = await createPage(createHTML({ expanded: true }, slotContent, direction));
77
- const element = await page.find('mg-menu-item');
78
- expect(element).toHaveClass('hydrated');
79
- await page.setViewport({ width: 300, height: 200 });
80
- const screenshot = await page.screenshot();
81
- expect(screenshot).toMatchImageSnapshot();
82
- });
83
- test.each([[Status.ACTIVE, Status.VISIBLE, Status.HIDDEN, Status.DISABLED]])('shoud manage keyboard navigation', async (status) => {
84
- var _a, e_1, _b, _c;
85
- const page = await createPage(createHTML({ status }, slotMenuItem, direction));
86
- let screenshot = await page.screenshot();
87
- expect(screenshot).toMatchImageSnapshot();
88
- const element = await page.find('mg-menu-item');
89
- expect(element).toHaveClass('hydrated');
90
- await page.setViewport({ width: 300, height: 200 });
91
- try {
92
- for (var _d = true, _e = __asyncValues(['Tab', 'Enter']), _f; _f = await _e.next(), _a = _f.done, !_a; _d = true) {
93
- _c = _f.value;
94
- _d = false;
95
- const key = _c;
96
- await page.keyboard.press(key);
97
- await page.waitForChanges();
98
- await page.waitForTimeout(200);
99
- screenshot = await page.screenshot();
100
- expect(screenshot).toMatchImageSnapshot();
101
- }
102
- }
103
- catch (e_1_1) {
104
- e_1 = { error: e_1_1 };
105
- }
106
- finally {
107
- try {
108
- if (!_d && !_a && (_b = _e.return))
109
- await _b.call(_e);
110
- }
111
- finally {
112
- if (e_1)
113
- throw e_1.error;
114
- }
115
- }
116
- });
117
- });
118
- });
119
- //# sourceMappingURL=mg-menu-item.e2e.js.map