@mgdis/mg-components 5.13.0 → 5.13.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.
- package/dist/cjs/{index-03d2557d.js → index-fede8ee2.js} +8 -33
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mg-action-more_32.cjs.entry.js +217 -50
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/cjs/mg-item-more.cjs.entry.js +2 -2
- package/dist/cjs/{mg-menu.conf-857748e1.js → mg-menu.conf-f9d0ddec.js} +12 -6
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +20 -6
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +7 -4
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +3 -0
- package/dist/collection/locales/fr/messages.json +12 -6
- package/dist/collection/utils/unit.test.utils.js +27 -0
- package/dist/components/index2.js +12 -6
- package/dist/components/mg-icon2.js +207 -44
- package/dist/components/mg-input-title2.js +6 -5
- package/dist/components/mg-modal.js +3 -0
- package/dist/esm/{index-407d5211.js → index-1d40b052.js} +8 -33
- package/dist/esm/loader.js +2 -2
- package/dist/esm/mg-action-more_32.entry.js +217 -50
- package/dist/esm/mg-components.js +2 -2
- package/dist/esm/mg-item-more.entry.js +2 -2
- package/dist/esm/{mg-menu.conf-c31828ca.js → mg-menu.conf-2cc079ae.js} +12 -6
- package/dist/mg-components/locales/fr/messages.json +12 -6
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/{p-622e2323.js → p-067080e4.js} +1 -1
- package/dist/mg-components/p-3bf1e2f0.js +2 -0
- package/dist/mg-components/{p-d37b29bb.entry.js → p-4ae1130f.entry.js} +1 -1
- package/dist/mg-components/p-b790596f.entry.js +1 -0
- package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +12 -3
- package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +1 -1
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +3 -0
- package/dist/types/locales/index.d.ts +12 -6
- package/dist/types/utils/components.utils.d.ts +3 -0
- package/dist/types/utils/unit.test.utils.d.ts +4 -4
- package/package.json +7 -6
- package/dist/mg-components/p-3bf533f7.js +0 -2
- package/dist/mg-components/p-bda0b795.entry.js +0 -1
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const mgMenu_conf = require('./mg-menu.conf-
|
|
5
|
+
const index = require('./index-fede8ee2.js');
|
|
6
|
+
const mgMenu_conf = require('./mg-menu.conf-f9d0ddec.js');
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* MgItemMore type guard
|
|
@@ -129,12 +129,18 @@ const input = {
|
|
|
129
129
|
results: "resultats",
|
|
130
130
|
searchResults: "List de resultat(s) de la recherche.",
|
|
131
131
|
noResult: "Aucun resultat.",
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
132
|
+
sections: {
|
|
133
|
+
selected: {
|
|
134
|
+
title: "Sélectionné",
|
|
135
|
+
titlePlurial: "Sélectionnés",
|
|
136
|
+
action: "Tout désélectionner"
|
|
137
|
+
},
|
|
138
|
+
notSelected: {
|
|
139
|
+
title: "Non sélectionné",
|
|
140
|
+
titlePlurial: "Non sélectionnés",
|
|
141
|
+
action: "Tout sélectionner"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
138
144
|
}
|
|
139
145
|
};
|
|
140
146
|
const form = {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { h } from '@stencil/core';
|
|
2
1
|
import { sizes, variants, variantStyles } from './mg-icon.conf';
|
|
3
2
|
import { ClassList } from '../../../utils/components.utils';
|
|
4
3
|
import iconList from '@mgdis/img/dist/icons/index.json';
|
|
5
|
-
import
|
|
4
|
+
import { icons } from '../../../../assets/icons';
|
|
6
5
|
export class MgIcon {
|
|
7
6
|
constructor() {
|
|
8
7
|
/**
|
|
@@ -13,6 +12,18 @@ export class MgIcon {
|
|
|
13
12
|
if (this.variantStyle === undefined)
|
|
14
13
|
this.variantStyle = 'background';
|
|
15
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Render icon in shadowroot
|
|
17
|
+
* @param icon - icon to render
|
|
18
|
+
*/
|
|
19
|
+
this.renderIcon = icon => {
|
|
20
|
+
this.element.shadowRoot.innerHTML = icons[icon];
|
|
21
|
+
this.svg = this.element.shadowRoot.querySelector('svg');
|
|
22
|
+
// update svg attributes
|
|
23
|
+
this.svg.setAttribute('aria-hidden', 'true');
|
|
24
|
+
this.svg.setAttribute('focusable', 'false');
|
|
25
|
+
this.svg.setAttribute('class', this.classCollection.join());
|
|
26
|
+
};
|
|
16
27
|
this.icon = undefined;
|
|
17
28
|
this.size = 'regular';
|
|
18
29
|
this.variant = undefined;
|
|
@@ -27,6 +38,7 @@ export class MgIcon {
|
|
|
27
38
|
if (oldValue !== undefined)
|
|
28
39
|
this.classCollection.delete(`mg-icon--${oldValue}`);
|
|
29
40
|
this.classCollection.add(`mg-icon--${newValue}`);
|
|
41
|
+
this.renderIcon(newValue);
|
|
30
42
|
}
|
|
31
43
|
}
|
|
32
44
|
validateSize(newValue, oldValue) {
|
|
@@ -80,13 +92,14 @@ export class MgIcon {
|
|
|
80
92
|
this.validateVariant(this.variant);
|
|
81
93
|
this.validateVariantStyle(this.variantStyle);
|
|
82
94
|
this.handleSpin(this.spin);
|
|
95
|
+
// render icon
|
|
96
|
+
this.renderIcon(this.icon);
|
|
83
97
|
}
|
|
84
98
|
/**
|
|
85
|
-
*
|
|
86
|
-
* @returns HTML Element
|
|
99
|
+
* update html when component trigger changes
|
|
87
100
|
*/
|
|
88
|
-
|
|
89
|
-
|
|
101
|
+
componentWillUpdate() {
|
|
102
|
+
this.svg.setAttribute('class', this.classCollection.join());
|
|
90
103
|
}
|
|
91
104
|
static get is() { return "mg-icon"; }
|
|
92
105
|
static get encapsulation() { return "shadow"; }
|
|
@@ -211,6 +224,7 @@ export class MgIcon {
|
|
|
211
224
|
"classCollection": {}
|
|
212
225
|
};
|
|
213
226
|
}
|
|
227
|
+
static get elementRef() { return "element"; }
|
|
214
228
|
static get watchers() {
|
|
215
229
|
return [{
|
|
216
230
|
"propName": "icon",
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
2
|
export class MgInputTitle {
|
|
3
3
|
constructor() {
|
|
4
|
-
this.getTagName = () => {
|
|
5
|
-
this.tagName = this.isLegend ? 'legend' : 'label';
|
|
6
|
-
};
|
|
7
4
|
this.identifier = undefined;
|
|
8
5
|
this.required = undefined;
|
|
9
6
|
this.isLegend = false;
|
|
@@ -14,6 +11,9 @@ export class MgInputTitle {
|
|
|
14
11
|
throw new Error('<mg-input-title> prop "identifier" is required.');
|
|
15
12
|
}
|
|
16
13
|
}
|
|
14
|
+
validateIsLegend(newValue) {
|
|
15
|
+
this.tagName = newValue ? 'legend' : 'label';
|
|
16
|
+
}
|
|
17
17
|
/*************
|
|
18
18
|
* Lifecycle *
|
|
19
19
|
*************/
|
|
@@ -22,7 +22,7 @@ export class MgInputTitle {
|
|
|
22
22
|
*/
|
|
23
23
|
componentWillLoad() {
|
|
24
24
|
this.validateIdentifier(this.identifier);
|
|
25
|
-
this.
|
|
25
|
+
this.validateIsLegend(this.isLegend);
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* Render
|
|
@@ -110,6 +110,9 @@ export class MgInputTitle {
|
|
|
110
110
|
return [{
|
|
111
111
|
"propName": "identifier",
|
|
112
112
|
"methodName": "validateIdentifier"
|
|
113
|
+
}, {
|
|
114
|
+
"propName": "isLegend",
|
|
115
|
+
"methodName": "validateIsLegend"
|
|
113
116
|
}];
|
|
114
117
|
}
|
|
115
118
|
}
|
|
@@ -8,6 +8,9 @@ export class MgModal {
|
|
|
8
8
|
// IDs
|
|
9
9
|
this.closeButtonId = '';
|
|
10
10
|
this.titleId = '';
|
|
11
|
+
/**
|
|
12
|
+
* Method to manage focus on modal focusable elements
|
|
13
|
+
*/
|
|
11
14
|
this.setFocus = () => {
|
|
12
15
|
// Get all focusable elements
|
|
13
16
|
this.modalFocusableElements = Array.from(this.element.querySelectorAll(focusableElements)).reduce((acc, focusableElement) => {
|
|
@@ -29,12 +29,18 @@
|
|
|
29
29
|
"results": "resultats",
|
|
30
30
|
"searchResults": "List de resultat(s) de la recherche.",
|
|
31
31
|
"noResult": "Aucun resultat.",
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
"sections": {
|
|
33
|
+
"selected": {
|
|
34
|
+
"title": "Sélectionné",
|
|
35
|
+
"titlePlurial": "Sélectionnés",
|
|
36
|
+
"action": "Tout désélectionner"
|
|
37
|
+
},
|
|
38
|
+
"notSelected": {
|
|
39
|
+
"title": "Non sélectionné",
|
|
40
|
+
"titlePlurial": "Non sélectionnés",
|
|
41
|
+
"action": "Tout sélectionner"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
38
44
|
}
|
|
39
45
|
},
|
|
40
46
|
"form": {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
|
1
2
|
import { MockCustomEvent } from '@stencil/core/mock-doc';
|
|
2
3
|
/**
|
|
3
4
|
* Clone Deep function
|
|
@@ -23,6 +24,32 @@ export const setupMutationObserverMock = ({ disconnect, observe, takeRecords })
|
|
|
23
24
|
});
|
|
24
25
|
return MockMutationObserver;
|
|
25
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Utility function that mocks the `ResizeObserver` API. Recommended to execute inside `beforeEach`.
|
|
29
|
+
* @param resizeObserverMock - Parameter that is sent to the `Object.defineProperty`
|
|
30
|
+
* overwrite method. `jest.fn()` mock functions can be passed here if the goal is to not only
|
|
31
|
+
* mock the resize observer, but its methods.
|
|
32
|
+
* You can manually fire an intersection entry:
|
|
33
|
+
* @param resizeObserverMock - configuration object
|
|
34
|
+
* @returns Mocked ResizeObserver
|
|
35
|
+
* @example
|
|
36
|
+
* ```
|
|
37
|
+
* let fireRo;
|
|
38
|
+
* setupResizeObserverMock({
|
|
39
|
+
* observe: function () {
|
|
40
|
+
* fireRo = this.cb;
|
|
41
|
+
* },
|
|
42
|
+
* });
|
|
43
|
+
* ...
|
|
44
|
+
* fireRo([{
|
|
45
|
+
* borderBoxSize: ResizeObserverSize[],
|
|
46
|
+
* contentBoxSize: ResizeObserverSize[],
|
|
47
|
+
* contentRect: DOMRectReadOnly,
|
|
48
|
+
* devicePixelContentBoxSize: ResizeObserverSize[],
|
|
49
|
+
* target: yourMockElemenet
|
|
50
|
+
* }]);;
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
26
53
|
export const setupResizeObserverMock = ({ disconnect, observe }) => {
|
|
27
54
|
class MockResizeObserver {
|
|
28
55
|
constructor(fn) {
|
|
@@ -127,12 +127,18 @@ const input = {
|
|
|
127
127
|
results: "resultats",
|
|
128
128
|
searchResults: "List de resultat(s) de la recherche.",
|
|
129
129
|
noResult: "Aucun resultat.",
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
130
|
+
sections: {
|
|
131
|
+
selected: {
|
|
132
|
+
title: "Sélectionné",
|
|
133
|
+
titlePlurial: "Sélectionnés",
|
|
134
|
+
action: "Tout désélectionner"
|
|
135
|
+
},
|
|
136
|
+
notSelected: {
|
|
137
|
+
title: "Non sélectionné",
|
|
138
|
+
titlePlurial: "Non sélectionnés",
|
|
139
|
+
action: "Tout sélectionner"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
136
142
|
}
|
|
137
143
|
};
|
|
138
144
|
const form = {
|