@mgdis/mg-components 5.8.2 → 5.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/mg-action-more_31.cjs.entry.js +196 -63
  3. package/dist/cjs/mg-components.cjs.js +1 -1
  4. package/dist/collection/components/atoms/mg-card/mg-card.conf.js +8 -0
  5. package/dist/collection/components/atoms/mg-card/mg-card.css +54 -0
  6. package/dist/collection/components/atoms/mg-card/mg-card.js +106 -4
  7. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +38 -7
  8. package/dist/collection/components/atoms/mg-icon/mg-icon.css +70 -11
  9. package/dist/collection/components/atoms/mg-icon/mg-icon.js +57 -21
  10. package/dist/collection/components/atoms/mg-tag/mg-tag.css +12 -12
  11. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +44 -5
  12. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +12 -9
  13. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +1 -1
  14. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +1 -0
  15. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +1 -1
  16. package/dist/collection/components/molecules/mg-action-more/mg-action-more.css +1 -0
  17. package/dist/collection/components/molecules/mg-details/mg-details.css +0 -3
  18. package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
  19. package/dist/collection/components/molecules/mg-message/mg-message.css +1 -19
  20. package/dist/collection/components/molecules/mg-message/mg-message.js +9 -4
  21. package/dist/collection/components/molecules/mg-modal/mg-modal.css +1 -0
  22. package/dist/collection/components/molecules/mg-panel/mg-panel.css +1 -0
  23. package/dist/collection/components/molecules/mg-popover/mg-popover.css +2 -0
  24. package/dist/collection/styles/reset-mg-card-slotted-variables.scss +1 -0
  25. package/dist/collection/variables.css +7 -1
  26. package/dist/components/mg-action-more.js +1 -1
  27. package/dist/components/mg-card2.js +60 -6
  28. package/dist/components/mg-details.js +2 -2
  29. package/dist/components/mg-icon2.js +66 -22
  30. package/dist/components/mg-input-numeric.js +12 -9
  31. package/dist/components/mg-menu-item2.js +2 -2
  32. package/dist/components/mg-message.js +2 -2
  33. package/dist/components/mg-modal.js +1 -1
  34. package/dist/components/mg-panel.js +1 -1
  35. package/dist/components/mg-popover2.js +1 -1
  36. package/dist/components/mg-tag.js +1 -1
  37. package/dist/components/mg-tooltip2.js +44 -5
  38. package/dist/components/popper.js +3 -4
  39. package/dist/esm/loader.js +1 -1
  40. package/dist/esm/mg-action-more_31.entry.js +196 -63
  41. package/dist/esm/mg-components.js +1 -1
  42. package/dist/mg-components/mg-components.css +1 -1
  43. package/dist/mg-components/mg-components.esm.js +1 -1
  44. package/dist/mg-components/p-9a93b7af.entry.js +1 -0
  45. package/dist/mg-components/styles/reset-mg-card-slotted-variables.scss +1 -0
  46. package/dist/mg-components/variables.css +7 -1
  47. package/dist/types/components/atoms/mg-card/mg-card.conf.d.ts +16 -0
  48. package/dist/types/components/atoms/mg-card/mg-card.d.ts +29 -0
  49. package/dist/types/components/atoms/mg-icon/mg-icon.conf.d.ts +10 -2
  50. package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +13 -5
  51. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +21 -0
  52. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +5 -5
  53. package/dist/types/components/molecules/mg-message/mg-message.conf.d.ts +5 -1
  54. package/dist/types/components/molecules/mg-message/mg-message.d.ts +6 -5
  55. package/dist/types/components.d.ts +35 -9
  56. package/package.json +5 -5
  57. package/dist/mg-components/p-0b68c4b4.entry.js +0 -1
@@ -5,5 +5,6 @@
5
5
  --mg-card-border-radius: var(--mg-card-border-radius-default);
6
6
  --mg-card-background: var(--mg-card-background-default);
7
7
  --mg-card-box-shadow: var(--mg-card-box-shadow-default);
8
+ --mg-card-max-width: unset;
8
9
  }
9
10
  }
@@ -98,6 +98,9 @@
98
98
  /* Shadow */
99
99
  --box-shadow: 0 0.3rem 0.8rem 0 hsl(var(--color-dark), 0.15);
100
100
 
101
+ /* Soft style */
102
+ --mg-color-soft-l: 90%;
103
+
101
104
  /*
102
105
  Global
103
106
  */
@@ -109,8 +112,10 @@
109
112
  */
110
113
  --mg-icon-small-size: 1.2rem;
111
114
  --mg-icon-regular-size: 1.6rem;
115
+ --mg-icon-medium-size: 2rem;
112
116
  --mg-icon-large-size: 2.4rem;
113
- --mg-icon-extra-large-size: 3.6rem;
117
+ --mg-icon-extra-large-size: 3.2rem;
118
+ --mg-icon-border-radius: 50%;
114
119
 
115
120
  /*
116
121
  <mg-button>
@@ -160,6 +165,7 @@
160
165
  --mg-popover-background-color: var(--color-light);
161
166
  --mg-popover-font-color: var(--color-font-dark);
162
167
  --mg-popover-title-font-size: 1.4rem;
168
+ --mg-popover-max-width: 40rem;
163
169
 
164
170
  /*
165
171
  <mg-message>
@@ -0,0 +1,16 @@
1
+ /**
2
+ * List available variants
3
+ */
4
+ export declare const variants: readonly ["info", "warning", "success", "danger", "app"];
5
+ /**
6
+ * Variant type
7
+ */
8
+ export type VariantType = (typeof variants)[number];
9
+ /**
10
+ * List available variant styles
11
+ */
12
+ export declare const variantStyles: readonly ["bar-left", "fill"];
13
+ /**
14
+ * VariantStyle type
15
+ */
16
+ export type VariantStyleType = (typeof variantStyles)[number];
@@ -1,7 +1,36 @@
1
+ import { ClassList } from '../../../utils/components.utils';
2
+ import { type VariantStyleType, type VariantType } from './mg-card.conf';
1
3
  export declare class MgCard {
4
+ /*************
5
+ * Private *
6
+ *************/
7
+ private readonly name;
8
+ private readonly baseClass;
2
9
  /*************
3
10
  * Lifecycle *
4
11
  *************/
12
+ /**
13
+ * Define variant prop
14
+ * Default: undefined
15
+ */
16
+ variant: undefined | VariantType;
17
+ validateVariant(newValue: MgCard['variant'], oldValue?: MgCard['variant']): void;
18
+ /**
19
+ * Define variantStyle prop
20
+ * Default: undefined
21
+ */
22
+ variantStyle: undefined | VariantStyleType;
23
+ validateVariantStyle(newValue: MgCard['variantStyle'], oldValue?: MgCard['variantStyle']): void;
24
+ /**
25
+ * Component classes
26
+ */
27
+ classList: ClassList;
28
+ /**
29
+ * Check if props are well configured on init
30
+ *
31
+ * @returns {void}
32
+ */
33
+ componentWillLoad(): void;
5
34
  /**
6
35
  * Render
7
36
  *
@@ -5,7 +5,7 @@ export declare const icons: unknown;
5
5
  /**
6
6
  * List of all possibles sizes
7
7
  */
8
- export declare const sizes: readonly ["small", "regular", "large", "extra-large"];
8
+ export declare const sizes: readonly ["small", "regular", "medium", "large", "extra-large"];
9
9
  /**
10
10
  * Icon Size from sizes
11
11
  */
@@ -13,8 +13,16 @@ export type IconSizeType = (typeof sizes)[number];
13
13
  /**
14
14
  * List of all possibles variants
15
15
  */
16
- export declare const variants: readonly ["success", "warning", "danger", "info"];
16
+ export declare const variants: readonly ["success", "warning", "danger", "info", "app"];
17
17
  /**
18
18
  * Variant type from variants
19
19
  */
20
20
  export type IconVariantType = (typeof variants)[number];
21
+ /**
22
+ * List of all possibles variants styles
23
+ */
24
+ export declare const variantStyles: readonly ["icon", "background", "full"];
25
+ /**
26
+ * Variant style type from variant style
27
+ */
28
+ export type IconVariantStyleType = (typeof variantStyles)[number];
@@ -1,8 +1,8 @@
1
- import { IconVariantType, IconSizeType } from './mg-icon.conf';
1
+ import { IconVariantType, IconSizeType, IconVariantStyleType } from './mg-icon.conf';
2
2
  import { ClassList } from '../../../utils/components.utils';
3
3
  export declare class MgIcon {
4
4
  /**
5
- * Icon to display
5
+ * Icon to display.
6
6
  */
7
7
  icon: string;
8
8
  validateIcon(newValue: MgIcon['icon'], oldValue?: MgIcon['icon']): void;
@@ -12,11 +12,19 @@ export declare class MgIcon {
12
12
  size: IconSizeType;
13
13
  validateSize(newValue: MgIcon['size'], oldValue?: MgIcon['size']): void;
14
14
  /**
15
- * Define icon variant
16
- * Add a background to the icon based on variant color
15
+ * Define icon variant color
17
16
  */
18
- variant?: IconVariantType;
17
+ variant: IconVariantType;
19
18
  validateVariant(newValue: MgIcon['variant'], oldValue?: MgIcon['variant']): void;
19
+ /**
20
+ * Define icon color variant style
21
+ * Add a color to the icon based on variant color with given style
22
+ * 'full': Used to set a circular background with variant soft color and icon variant color
23
+ * 'background': Used to set a circular background with variant soft color
24
+ * 'icon': Used to set a color only to the icon
25
+ */
26
+ variantStyle: IconVariantStyleType;
27
+ validateVariantStyle(newValue: MgIcon['variantStyle'], oldValue?: MgIcon['variantStyle']): void;
20
28
  /**
21
29
  * Make the icon spin
22
30
  */
@@ -6,6 +6,7 @@ export declare class MgTooltip {
6
6
  private popper;
7
7
  private tooltip;
8
8
  private tooltipedElement;
9
+ private windows;
9
10
  private guard;
10
11
  /**************
11
12
  * Decorators *
@@ -49,6 +50,20 @@ export declare class MgTooltip {
49
50
  * @returns {void}
50
51
  */
51
52
  private hide;
53
+ /**
54
+ * Check if clicked outside of component and hidde tooltip
55
+ *
56
+ * @param {MouseEvent} event mouse event
57
+ * @returns {void}
58
+ */
59
+ private clickOutside;
60
+ /**
61
+ * Check if 'Escape' key is pressed of component and hidde tooltip
62
+ *
63
+ * @param {KeyboardEvent} event keyboard event
64
+ * @returns {void}
65
+ */
66
+ private pressEscape;
52
67
  /**
53
68
  * Method to set display prop
54
69
  *
@@ -89,6 +104,12 @@ export declare class MgTooltip {
89
104
  /*************
90
105
  * Lifecycle *
91
106
  *************/
107
+ /**
108
+ * set variables
109
+ *
110
+ * @returns {void}
111
+ */
112
+ componentWillLoad(): void;
92
113
  /**
93
114
  * Get slotted element
94
115
  * Check if it already contain an interactive element, if not we need to add a tabIndex attribute
@@ -23,7 +23,7 @@ export declare class MgInputNumeric {
23
23
  * Component value
24
24
  */
25
25
  value: string;
26
- validateValue(newValue: string): void;
26
+ validateValue(newValue: MgInputNumeric['value']): void;
27
27
  /**
28
28
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
29
29
  */
@@ -79,7 +79,7 @@ export declare class MgInputNumeric {
79
79
  * Define numeric type
80
80
  */
81
81
  type: string;
82
- validateType(newValue: string): void;
82
+ validateType(newValue: MgInputNumeric['type']): void;
83
83
  /**
84
84
  * Define currency
85
85
  */
@@ -97,13 +97,13 @@ export declare class MgInputNumeric {
97
97
  * integer is the number before the decimal point
98
98
  */
99
99
  integerLength: number;
100
- validateIntegerLength(newValue: number): void;
100
+ validateIntegerLength(newValue: MgInputNumeric['integerLength']): void;
101
101
  /**
102
102
  * Override decimal length
103
103
  * decimal is the number after the decimal point
104
104
  */
105
105
  decimalLength: number;
106
- validateDecimalLength(newValue: number): void;
106
+ validateDecimalLength(newValue: MgInputNumeric['decimalLength']): void;
107
107
  /**
108
108
  * Define input pattern to validate
109
109
  */
@@ -142,7 +142,7 @@ export declare class MgInputNumeric {
142
142
  * Displayed value in input
143
143
  * Change on focus/blur
144
144
  *
145
- * @returns {string} display value
145
+ * @returns {MgInputNumeric['value'] | MgInputNumeric['readonlyValue']} display value
146
146
  */
147
147
  private displayValue;
148
148
  /**
@@ -1,4 +1,8 @@
1
1
  /**
2
2
  * List of all possibles message variants
3
3
  */
4
- export declare const variants: string[];
4
+ export declare const variants: readonly ["info", "warning", "success", "danger"];
5
+ /**
6
+ * Variant type
7
+ */
8
+ export type VariantType = (typeof variants)[number];
@@ -1,5 +1,6 @@
1
1
  import { EventEmitter } from '../../../stencil-public-runtime';
2
2
  import { ClassList } from '../../../utils/components.utils';
3
+ import { VariantType } from './mg-message.conf';
3
4
  export declare class MgMessage {
4
5
  /************
5
6
  * Internal *
@@ -27,23 +28,23 @@ export declare class MgMessage {
27
28
  * Value is defined in seconds and must greater than 2 seconds (PDA9-314 RG-06)
28
29
  */
29
30
  delay: number;
30
- validateDelay(newValue: number): void;
31
+ validateDelay(newValue: MgMessage['delay']): void;
31
32
  /**
32
33
  * Message variant
33
34
  */
34
- variant: string;
35
- validateVariant(newValue: string, oldValue?: string): void;
35
+ variant: VariantType;
36
+ validateVariant(newValue: MgMessage['variant'], oldValue?: MgMessage['variant']): void;
36
37
  /**
37
38
  * Define if message has a cross button
38
39
  * RG 01: https://jira.mgdis.fr/browse/PDA9-140
39
40
  */
40
41
  closeButton: boolean;
41
- validateCloseButton(newValue: boolean): void;
42
+ validateCloseButton(newValue: MgMessage['closeButton']): void;
42
43
  /**
43
44
  * Define if message is hidden
44
45
  */
45
46
  hide: boolean;
46
- validateHide(newValue: boolean): void;
47
+ validateHide(newValue: MgMessage['hide']): void;
47
48
  /**
48
49
  * Component classes
49
50
  */
@@ -8,7 +8,8 @@ import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
8
8
  import { MgActionMoreButtonType, MgActionMoreIconType, MgActionMoreItemType } from "./components/molecules/mg-action-more/mg-action-more.conf";
9
9
  import { BadgeVariantType } from "./components/atoms/mg-badge/mg-badge.conf";
10
10
  import { ButtonType, VariantType } from "./components/atoms/mg-button/mg-button.conf";
11
- import { IconSizeType, IconVariantType } from "./components/atoms/mg-icon/mg-icon.conf";
11
+ import { VariantStyleType, VariantType as VariantType1 } from "./components/atoms/mg-card/mg-card.conf";
12
+ import { IconSizeType, IconVariantStyleType, IconVariantType } from "./components/atoms/mg-icon/mg-icon.conf";
12
13
  import { CheckboxValue } from "./components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf";
13
14
  import { Width } from "./components/molecules/inputs/MgInput.conf";
14
15
  import { RadioOption } from "./components/molecules/inputs/mg-input-radio/mg-input-radio.conf";
@@ -17,6 +18,7 @@ import { ToggleValue } from "./components/molecules/inputs/mg-input-toggle/mg-in
17
18
  import { IconType, SizeType, SlotLabelType } from "./components/molecules/mg-item-more/mg-item-more.conf";
18
19
  import { Direction, ItemMoreType, MenuSizeType } from "./components/molecules/menu/mg-menu/mg-menu.conf";
19
20
  import { Status } from "./components/molecules/menu/mg-menu-item/mg-menu-item.conf";
21
+ import { VariantType as VariantType2 } from "./components/molecules/mg-message/mg-message.conf";
20
22
  import { Placement } from "@popperjs/core";
21
23
  import { SkipLink } from "./components/molecules/mg-skip-links/mg-skip-links.conf";
22
24
  import { SizeType as SizeType1, TabItem } from "./components/molecules/mg-tabs/mg-tabs.conf";
@@ -97,6 +99,14 @@ export namespace Components {
97
99
  "variant": VariantType;
98
100
  }
99
101
  interface MgCard {
102
+ /**
103
+ * Define variant prop Default: undefined
104
+ */
105
+ "variant": undefined | VariantType1;
106
+ /**
107
+ * Define variantStyle prop Default: undefined
108
+ */
109
+ "variantStyle": undefined | VariantStyleType;
100
110
  }
101
111
  interface MgCharacterLeft {
102
112
  /**
@@ -169,7 +179,7 @@ export namespace Components {
169
179
  }
170
180
  interface MgIcon {
171
181
  /**
172
- * Icon to display
182
+ * Icon to display.
173
183
  */
174
184
  "icon": string;
175
185
  /**
@@ -181,9 +191,13 @@ export namespace Components {
181
191
  */
182
192
  "spin": boolean;
183
193
  /**
184
- * Define icon variant Add a background to the icon based on variant color
194
+ * Define icon variant color
185
195
  */
186
- "variant"?: IconVariantType;
196
+ "variant": IconVariantType;
197
+ /**
198
+ * Define icon color variant style Add a color to the icon based on variant color with given style 'full': Used to set a circular background with variant soft color and icon variant color 'background': Used to set a circular background with variant soft color 'icon': Used to set a color only to the icon
199
+ */
200
+ "variantStyle": IconVariantStyleType;
187
201
  }
188
202
  interface MgIllustratedMessage {
189
203
  /**
@@ -955,7 +969,7 @@ export namespace Components {
955
969
  /**
956
970
  * Message variant
957
971
  */
958
- "variant": string;
972
+ "variant": VariantType2;
959
973
  }
960
974
  interface MgModal {
961
975
  /**
@@ -1506,6 +1520,14 @@ declare namespace LocalJSX {
1506
1520
  "variant"?: VariantType;
1507
1521
  }
1508
1522
  interface MgCard {
1523
+ /**
1524
+ * Define variant prop Default: undefined
1525
+ */
1526
+ "variant"?: undefined | VariantType1;
1527
+ /**
1528
+ * Define variantStyle prop Default: undefined
1529
+ */
1530
+ "variantStyle"?: undefined | VariantStyleType;
1509
1531
  }
1510
1532
  interface MgCharacterLeft {
1511
1533
  /**
@@ -1585,9 +1607,9 @@ declare namespace LocalJSX {
1585
1607
  }
1586
1608
  interface MgIcon {
1587
1609
  /**
1588
- * Icon to display
1610
+ * Icon to display.
1589
1611
  */
1590
- "icon"?: string;
1612
+ "icon": string;
1591
1613
  /**
1592
1614
  * Define icon size
1593
1615
  */
@@ -1597,9 +1619,13 @@ declare namespace LocalJSX {
1597
1619
  */
1598
1620
  "spin"?: boolean;
1599
1621
  /**
1600
- * Define icon variant Add a background to the icon based on variant color
1622
+ * Define icon variant color
1601
1623
  */
1602
1624
  "variant"?: IconVariantType;
1625
+ /**
1626
+ * Define icon color variant style Add a color to the icon based on variant color with given style 'full': Used to set a circular background with variant soft color and icon variant color 'background': Used to set a circular background with variant soft color 'icon': Used to set a color only to the icon
1627
+ */
1628
+ "variantStyle"?: IconVariantStyleType;
1603
1629
  }
1604
1630
  interface MgIllustratedMessage {
1605
1631
  /**
@@ -2414,7 +2440,7 @@ declare namespace LocalJSX {
2414
2440
  /**
2415
2441
  * Message variant
2416
2442
  */
2417
- "variant"?: string;
2443
+ "variant"?: VariantType2;
2418
2444
  }
2419
2445
  interface MgModal {
2420
2446
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mgdis/mg-components",
3
- "version": "5.8.2",
3
+ "version": "5.9.1",
4
4
  "description": "MG Components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -40,7 +40,7 @@
40
40
  "@storybook/addon-links": "^6.5.16",
41
41
  "@storybook/html": "^6.5.16",
42
42
  "@storybook/preset-scss": "^1.0.3",
43
- "@types/jest": "^26.0.24",
43
+ "@types/jest": "npm:@types/jest@^26",
44
44
  "@types/jest-image-snapshot": "^4.3.2",
45
45
  "@types/node": "^18.14.0",
46
46
  "@typescript-eslint/eslint-plugin": "^4.33.0",
@@ -54,10 +54,10 @@
54
54
  "eslint-plugin-jsx-a11y": "^6.7.1",
55
55
  "eslint-plugin-react": "^7.32.2",
56
56
  "eslint-plugin-storybook": "^0.6.10",
57
- "jest": "^27.0.3",
58
- "jest-cli": "^26.6.3",
57
+ "jest": "npm:jest@^26",
58
+ "jest-cli": "npm:jest-cli@^26",
59
59
  "jest-image-snapshot": "^4.5.1",
60
- "jest-junit": "^14.0.1",
60
+ "jest-junit": "^15.0.0",
61
61
  "jsx-dom": "^8.0.4",
62
62
  "npm-run-all": "^4.1.5",
63
63
  "prettier": "^2.8.4",