@mgdis/mg-components 5.13.0 → 5.14.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.
- package/dist/cjs/{index-03d2557d.js → index-fede8ee2.js} +8 -33
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_32.cjs.entry.js +289 -97
- package/dist/cjs/mg-components.cjs.js +2 -2
- 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/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +4 -4
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +2 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +1 -1
- package/dist/collection/components/molecules/mg-details/mg-details.css +3 -0
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
- package/dist/collection/components/molecules/mg-form/mg-form.js +1 -1
- package/dist/collection/components/molecules/mg-message/mg-message.css +4 -0
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +64 -36
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +2 -2
- package/dist/collection/components/molecules/mg-panel/mg-panel.css +3 -0
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +1 -1
- package/dist/collection/locales/fr/messages.json +12 -6
- package/dist/collection/styles/global.scss +0 -7
- package/dist/collection/utils/unit.test.utils.js +27 -0
- package/dist/components/index2.js +12 -6
- package/dist/components/mg-details.js +2 -2
- package/dist/components/mg-form.js +1 -1
- package/dist/components/mg-icon2.js +207 -44
- package/dist/components/mg-input-checkbox-paginated2.js +4 -4
- package/dist/components/mg-input-select2.js +2 -2
- package/dist/components/mg-input-title2.js +6 -5
- package/dist/components/mg-message.js +1 -1
- package/dist/components/mg-modal.js +64 -36
- package/dist/components/mg-pagination2.js +2 -2
- package/dist/components/mg-panel.js +2 -2
- package/dist/esm/{index-407d5211.js → index-1d40b052.js} +8 -33
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_32.entry.js +289 -97
- package/dist/esm/mg-components.js +3 -3
- 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.css +1 -1
- 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-aa298e17.entry.js +1 -0
- package/dist/mg-components/styles/global.scss +0 -7
- 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/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.d.ts +1 -1
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +19 -1
- 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 +6 -5
- package/readme.md +20 -25
- package/dist/collection/styles/components.scss +0 -3
- package/dist/mg-components/p-3bf533f7.js +0 -2
- package/dist/mg-components/p-bda0b795.entry.js +0 -1
- package/dist/mg-components/styles/components.scss +0 -3
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-fede8ee2.js');
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
8
|
Stencil Client Patch Browser v2.22.1 | MIT Licensed | https://stenciljs.com
|
|
@@ -17,7 +17,7 @@ const patchBrowser = () => {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
patchBrowser().then(options => {
|
|
20
|
-
return index.bootstrapLazy([["mg-action-more_32.cjs",[[1,"mg-input-checkbox",{"value":[1040],"type":[1025],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"inputVerticalList":[4,"input-vertical-list"],"required":[4],"readonly":[4],"displaySelectedValues":[4,"display-selected-values"],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classCollection":[32],"errorMessage":[32],"checkboxItems":[32],"displaySearchInput":[32],"searchValue":[32],"searchResults":[32],"displayError":[64]}],[1,"mg-action-more",{"icon":[16],"button":[16],"items":[16],"displayChevron":[4,"display-chevron"],"expanded":[32]}],[1,"mg-panel",{"identifier":[1],"panelTitle":[1025,"panel-title"],"titlePattern":[1,"title-pattern"],"titlePatternErrorMessage":[1,"title-pattern-error-message"],"titleEditable":[1028,"title-editable"],"titlePosition":[1,"title-position"],"expanded":[1028],"expandToggleDisplay":[1,"expand-toggle-display"],"expandToggleDisabled":[4,"expand-toggle-disabled"],"classCollection":[32],"isEditing":[32],"updatedPanelTitle":[32]}],[1,"mg-input-textarea",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"maxlength":[2],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"pattern":[1],"patternErrorMessage":[1,"pattern-error-message"],"rows":[2],"tooltip":[1],"displayCharacterLeft":[4,"display-character-left"],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"resizable":[1],"classCollection":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-date",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"required":[4],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"min":[1],"max":[1],"classCollection":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-numeric",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"tooltip":[1],"helpText":[1,"help-text"],"type":[1],"currency":[1],"max":[2],"min":[2],"integerLength":[2,"integer-length"],"decimalLength":[2,"decimal-length"],"valid":[1028],"invalid":[1028],"classCollection":[32],"errorMessage":[32],"hasFocus":[32],"displayError":[64]}],[1,"mg-input-password",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classCollection":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-radio",{"value":[1032],"items":[16],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"inputVerticalList":[4,"input-vertical-list"],"required":[4],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classCollection":[32],"errorMessage":[32],"options":[32],"displayError":[64]}],[1,"mg-input-toggle",{"value":[1032],"items":[16],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"isOnOff":[4,"is-on-off"],"isIcon":[4,"is-icon"],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"classCollection":[32],"options":[32],"checked":[32]}],[1,"mg-message",{"identifier":[1],"delay":[2],"variant":[1],"closeButton":[1028,"close-button"],"hide":[1028],"classCollection":[32],"hasActions":[32]}],[1,"mg-modal",{"identifier":[1],"modalTitle":[1,"modal-title"],"closeButton":[4,"close-button"],"hide":[1028],"hasActions":[32],"hasContent":[32],"classCollection":[32]},[[8,"keydown","handleKeyDown"]]],[1,"mg-tabs",{"identifier":[1],"label":[1],"size":[1],"items":[16],"activeTab":[1538,"active-tab"],"tabs":[32],"classCollection":[32]}],[1,"mg-details",{"toggleClosed":[1,"toggle-closed"],"toggleOpened":[1,"toggle-opened"],"hideSummary":[4,"hide-summary"],"expanded":[1028]}],[1,"mg-divider",{"size":[1]}],[1,"mg-form",{"identifier":[1],"name":[1],"readonly":[4],"disabled":[4],"valid":[1028],"invalid":[1028],"classCollection":[32],"requiredMessage":[32],"displayError":[64]}],[1,"mg-illustrated-message",{"size":[1],"direction":[1]}],[1,"mg-skip-links",{"links":[16]}],[1,"mg-tag",{"variant":[1],"outline":[4],"soft":[4],"classCollection":[32]}],[2,"mg-input-checkbox-paginated",{"readonly":[4],"disabled":[4],"name":[1],"checkboxes":[16],"sectionKind":[1,"section-kind"],"messages":[16],"titleKind":[32],"currentPage":[32],"
|
|
20
|
+
return index.bootstrapLazy([["mg-action-more_32.cjs",[[1,"mg-input-checkbox",{"value":[1040],"type":[1025],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"inputVerticalList":[4,"input-vertical-list"],"required":[4],"readonly":[4],"displaySelectedValues":[4,"display-selected-values"],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classCollection":[32],"errorMessage":[32],"checkboxItems":[32],"displaySearchInput":[32],"searchValue":[32],"searchResults":[32],"displayError":[64]}],[1,"mg-action-more",{"icon":[16],"button":[16],"items":[16],"displayChevron":[4,"display-chevron"],"expanded":[32]}],[1,"mg-panel",{"identifier":[1],"panelTitle":[1025,"panel-title"],"titlePattern":[1,"title-pattern"],"titlePatternErrorMessage":[1,"title-pattern-error-message"],"titleEditable":[1028,"title-editable"],"titlePosition":[1,"title-position"],"expanded":[1028],"expandToggleDisplay":[1,"expand-toggle-display"],"expandToggleDisabled":[4,"expand-toggle-disabled"],"classCollection":[32],"isEditing":[32],"updatedPanelTitle":[32]}],[1,"mg-input-textarea",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"maxlength":[2],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"pattern":[1],"patternErrorMessage":[1,"pattern-error-message"],"rows":[2],"tooltip":[1],"displayCharacterLeft":[4,"display-character-left"],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"resizable":[1],"classCollection":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-date",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"required":[4],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"min":[1],"max":[1],"classCollection":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-numeric",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"tooltip":[1],"helpText":[1,"help-text"],"type":[1],"currency":[1],"max":[2],"min":[2],"integerLength":[2,"integer-length"],"decimalLength":[2,"decimal-length"],"valid":[1028],"invalid":[1028],"classCollection":[32],"errorMessage":[32],"hasFocus":[32],"displayError":[64]}],[1,"mg-input-password",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classCollection":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-radio",{"value":[1032],"items":[16],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"inputVerticalList":[4,"input-vertical-list"],"required":[4],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classCollection":[32],"errorMessage":[32],"options":[32],"displayError":[64]}],[1,"mg-input-toggle",{"value":[1032],"items":[16],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"isOnOff":[4,"is-on-off"],"isIcon":[4,"is-icon"],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"classCollection":[32],"options":[32],"checked":[32]}],[1,"mg-message",{"identifier":[1],"delay":[2],"variant":[1],"closeButton":[1028,"close-button"],"hide":[1028],"classCollection":[32],"hasActions":[32]}],[1,"mg-modal",{"identifier":[1],"modalTitle":[1,"modal-title"],"closeButton":[4,"close-button"],"hide":[1028],"hasActions":[32],"hasContent":[32],"classCollection":[32]},[[8,"keydown","handleKeyDown"]]],[1,"mg-tabs",{"identifier":[1],"label":[1],"size":[1],"items":[16],"activeTab":[1538,"active-tab"],"tabs":[32],"classCollection":[32]}],[1,"mg-details",{"toggleClosed":[1,"toggle-closed"],"toggleOpened":[1,"toggle-opened"],"hideSummary":[4,"hide-summary"],"expanded":[1028]}],[1,"mg-divider",{"size":[1]}],[1,"mg-form",{"identifier":[1],"name":[1],"readonly":[4],"disabled":[4],"valid":[1028],"invalid":[1028],"classCollection":[32],"requiredMessage":[32],"displayError":[64]}],[1,"mg-illustrated-message",{"size":[1],"direction":[1]}],[1,"mg-skip-links",{"links":[16]}],[1,"mg-tag",{"variant":[1],"outline":[4],"soft":[4],"classCollection":[32]}],[2,"mg-input-checkbox-paginated",{"readonly":[4],"disabled":[4],"name":[1],"checkboxes":[16],"sectionKind":[1,"section-kind"],"messages":[16],"titleKind":[32],"currentPage":[32],"expanded":[32]}],[1,"mg-menu-item",{"identifier":[1],"href":[1],"status":[1537],"expanded":[1028],"size":[32],"navigationButtonClassList":[32],"direction":[32],"isInMainMenu":[32],"isItemMore":[32],"hasChildren":[32],"displayNotificationBadge":[32]}],[1,"mg-pagination",{"identifier":[1],"label":[1025],"hideNavigationLabels":[4,"hide-navigation-labels"],"hidePageCount":[4,"hide-page-count"],"totalPages":[2,"total-pages"],"currentPage":[1538,"current-page"]}],[1,"mg-input-text",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"type":[1],"icon":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"maxlength":[2],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"pattern":[1],"patternErrorMessage":[1,"pattern-error-message"],"tooltip":[1],"displayCharacterLeft":[4,"display-character-left"],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classCollection":[32],"errorMessage":[32],"setFocus":[64],"displayError":[64]}],[1,"mg-menu",{"label":[1],"direction":[513],"itemmore":[16],"size":[1],"isChildMenu":[32]}],[1,"mg-input-select",{"value":[1032],"items":[16],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1025],"placeholderHide":[4,"placeholder-hide"],"placeholderDisabled":[4,"placeholder-disabled"],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[520,"mg-width"],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classCollection":[32],"errorMessage":[32],"options":[32],"valueExist":[32],"readonlyValue":[32],"displayError":[64]}],[1,"mg-popover",{"identifier":[1],"placement":[1],"arrowHide":[4,"arrow-hide"],"closeButton":[4,"close-button"],"display":[1028],"disabled":[4],"classCollection":[32]}],[1,"mg-badge",{"value":[8],"label":[1],"variant":[1],"outline":[4],"classCollection":[32]}],[2,"mg-character-left",{"identifier":[1],"characters":[1],"maxlength":[2]}],[1,"mg-card",{"variant":[1],"variantStyle":[1025,"variant-style"],"classCollection":[32]}],[1,"mg-button",{"variant":[1],"identifier":[1],"label":[1],"type":[1],"fullWidth":[4,"full-width"],"form":[1],"disabled":[1028],"isIcon":[4,"is-icon"],"disableOnClick":[4,"disable-on-click"],"loading":[32],"classCollection":[32]}],[6,"mg-input-title",{"identifier":[1],"required":[4],"isLegend":[4,"is-legend"],"tagName":[32]}],[1,"mg-tooltip",{"identifier":[1],"message":[1],"placement":[1],"display":[1028],"disabled":[4]}],[1,"mg-icon",{"icon":[1],"size":[1],"variant":[1],"variantStyle":[1025,"variant-style"],"spin":[4],"classCollection":[32]}]]],["mg-item-more.cjs",[[1,"mg-item-more",{"icon":[16],"slotlabel":[16],"size":[1],"parentMenu":[32]}]]]], options);
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
exports.setNonce = index.setNonce;
|
|
@@ -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
|
}
|
|
@@ -23,7 +23,7 @@ export class MgInputCheckboxPaginated {
|
|
|
23
23
|
* Toogle items button handler
|
|
24
24
|
*/
|
|
25
25
|
this.handleToggleClick = () => {
|
|
26
|
-
this.
|
|
26
|
+
this.expanded = !this.expanded;
|
|
27
27
|
};
|
|
28
28
|
/**
|
|
29
29
|
* Method to get a array range
|
|
@@ -53,7 +53,7 @@ export class MgInputCheckboxPaginated {
|
|
|
53
53
|
this.messages = undefined;
|
|
54
54
|
this.titleKind = undefined;
|
|
55
55
|
this.currentPage = 1;
|
|
56
|
-
this.
|
|
56
|
+
this.expanded = true;
|
|
57
57
|
}
|
|
58
58
|
validateCheckboxes(newValue, oldValue) {
|
|
59
59
|
// after each array.length update we reset pagination
|
|
@@ -97,7 +97,7 @@ export class MgInputCheckboxPaginated {
|
|
|
97
97
|
const [checkboxItemsFromIndex, checkboxItemsToIndex] = this.getFromToIndexes();
|
|
98
98
|
const itemsContainerId = `items-${this.sectionKind}-container`;
|
|
99
99
|
const getText = (checkboxes) => h("em", null, `${this.messages[checkboxes.length > 1 ? 'titlePlurial' : 'title']} (${checkboxes.length})`);
|
|
100
|
-
return (h(Host, { hidden: this.checkboxes.length < 1 }, h("div", { class: "mg-input__input-checkbox-multi-section-header" }, this.titleKind === SectionTitleKind.BUTTON ? (h("mg-button", { variant: "flat", onClick: this.handleToggleClick, "aria-controls": itemsContainerId, "aria-expanded": this.
|
|
100
|
+
return (h(Host, { hidden: this.checkboxes.length < 1 }, h("div", { class: "mg-input__input-checkbox-multi-section-header" }, this.titleKind === SectionTitleKind.BUTTON ? (h("mg-button", { variant: "flat", onClick: this.handleToggleClick, "aria-controls": itemsContainerId, "aria-expanded": this.expanded.toString() }, h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down', size: "small" }), h("span", { class: "mg-input__input-checkbox-multi-text" }, getText(this.checkboxes)))) : (h("p", { class: "mg-input__input-checkbox-multi-title" }, getText(this.checkboxes))), ((this.sectionKind === SectionKind.SELECTED && this.expanded) || this.sectionKind === SectionKind.NOT_SELECTED) && (h("mg-button", { variant: "link", onClick: this.massActionHandler }, this.messages.action)), this.expanded && this.getPageCount(this.checkboxes) > 1 && (h("mg-pagination", { key: "search-pagination", totalPages: this.getPageCount(this.checkboxes), currentPage: this.currentPage > 1 ? this.currentPage : 1, "onCurrent-page-change": this.handleCurrentPageChange, hideNavigationLabels: true, hidePageCount: true, identifier: `input-checkbox-pagination-${this.sectionKind}` }))), h("div", { hidden: !this.expanded, id: itemsContainerId, class: "mg-input__input-checkbox-multi-section-content" }, h(MgInputCheckboxList, { checkboxes: this.getArrayRange(this.checkboxes, checkboxItemsFromIndex, checkboxItemsToIndex), inputVerticalList: true, type: 'multi', displaySearchInput: true, messages: this.messages, id: `items-${this.sectionKind}`, readonly: this.readonly, disabled: this.disabled, name: this.name }))));
|
|
101
101
|
}
|
|
102
102
|
static get is() { return "mg-input-checkbox-paginated"; }
|
|
103
103
|
static get encapsulation() { return "scoped"; }
|
|
@@ -222,7 +222,7 @@ export class MgInputCheckboxPaginated {
|
|
|
222
222
|
return {
|
|
223
223
|
"titleKind": {},
|
|
224
224
|
"currentPage": {},
|
|
225
|
-
"
|
|
225
|
+
"expanded": {}
|
|
226
226
|
};
|
|
227
227
|
}
|
|
228
228
|
static get events() {
|
|
@@ -258,6 +258,7 @@
|
|
|
258
258
|
padding-bottom: 0;
|
|
259
259
|
padding-right: 1rem;
|
|
260
260
|
}
|
|
261
|
-
|
|
261
|
+
|
|
262
|
+
:host(:not([mg-width])) .mg-input--select:not(.mg-input--label-on-top) .mg-input__box {
|
|
262
263
|
max-width: unset;
|
|
263
264
|
}
|
|
@@ -35,7 +35,7 @@ export class MgDetails {
|
|
|
35
35
|
* @returns HTML Element
|
|
36
36
|
*/
|
|
37
37
|
render() {
|
|
38
|
-
return (h("details", { class: "mg-details", onToggle: this.handleToggle, open: this.expanded, ref: el => (this.details = el) }, h("summary", null, h("slot", { name: "summary" }), h("span", { class: "mg-details__toggle" }, h("mg-icon", { icon:
|
|
38
|
+
return (h("details", { class: "mg-details", onToggle: this.handleToggle, open: this.expanded, ref: el => (this.details = el) }, h("summary", null, h("slot", { name: "summary" }), h("span", { class: "mg-details__toggle" }, h("mg-icon", { icon: "chevron-up", size: "small", class: { 'mg-details__toggle-icon': true, 'mg-details__toggle-icon--reverse': !this.expanded } }), h("span", { class: { 'sr-only': this.hideSummary } }, this.expanded ? this.toggleOpened : this.toggleClosed))), h("div", { class: "mg-details__details" }, h("slot", { name: "details" }))));
|
|
39
39
|
}
|
|
40
40
|
static get is() { return "mg-details"; }
|
|
41
41
|
static get encapsulation() { return "shadow"; }
|
|
@@ -126,7 +126,7 @@ export class MgForm {
|
|
|
126
126
|
// submit buttons should trigger form submition;
|
|
127
127
|
if (['submit', null].includes(mgButton.getAttribute('type'))) {
|
|
128
128
|
mgButton.addEventListener('click', () => {
|
|
129
|
-
this.form.dispatchEvent(new SubmitEvent('submit', { bubbles: true }));
|
|
129
|
+
this.form.dispatchEvent(new SubmitEvent('submit', { bubbles: true, cancelable: true }));
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
});
|
|
@@ -3,40 +3,60 @@ import { createID, ClassList, focusableElements } from '../../../utils/component
|
|
|
3
3
|
import { initLocales } from '../../../locales';
|
|
4
4
|
export class MgModal {
|
|
5
5
|
constructor() {
|
|
6
|
+
/************
|
|
7
|
+
* Internal *
|
|
8
|
+
************/
|
|
9
|
+
// Modal focusable elements
|
|
10
|
+
this.modalFocusableElements = [];
|
|
6
11
|
// Classes
|
|
7
12
|
this.classHide = 'mg-modal--hide';
|
|
8
13
|
// IDs
|
|
9
|
-
this.closeButtonId = '';
|
|
10
14
|
this.titleId = '';
|
|
15
|
+
/**
|
|
16
|
+
* Handle last focusable element
|
|
17
|
+
* @param event - keyboard event
|
|
18
|
+
*/
|
|
19
|
+
this.handleLastFocusableElement = (event) => {
|
|
20
|
+
if (event.key === 'Tab' && !event.shiftKey) {
|
|
21
|
+
event.preventDefault();
|
|
22
|
+
this.modalFocusableElements[0].focus();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Handle first focusable element
|
|
27
|
+
* @param event - keyboard event
|
|
28
|
+
*/
|
|
29
|
+
this.handleFirstFocusableElement = (event) => {
|
|
30
|
+
if (event.key === 'Tab' && event.shiftKey) {
|
|
31
|
+
event.preventDefault();
|
|
32
|
+
this.getLastFocusableElement().focus();
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Get last focusablmeElement
|
|
37
|
+
* @returns last modal focusable element
|
|
38
|
+
*/
|
|
39
|
+
this.getLastFocusableElement = () => (this.modalFocusableElements.length > 0 ? this.modalFocusableElements[this.modalFocusableElements.length - 1] : null);
|
|
40
|
+
/**
|
|
41
|
+
* Method to manage focus on modal focusable elements
|
|
42
|
+
*/
|
|
11
43
|
this.setFocus = () => {
|
|
12
44
|
// Get all focusable elements
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this.modalFocusableElements[0].focus();
|
|
45
|
+
const allFocusableElements = Array.from(this.element.querySelectorAll(focusableElements));
|
|
46
|
+
// If at least one
|
|
47
|
+
if (allFocusableElements.length > 0) {
|
|
48
|
+
this.modalFocusableElements = allFocusableElements.reduce((acc, focusableElement) => {
|
|
49
|
+
acc.push(focusableElement.shadowRoot !== null ? focusableElement.shadowRoot.querySelector(focusableElements) || focusableElement : focusableElement);
|
|
50
|
+
return acc;
|
|
51
|
+
}, []);
|
|
52
|
+
// When close button is enabled it's the first focusable element.
|
|
53
|
+
if (this.closeButton && this.closeButtonElement !== undefined) {
|
|
54
|
+
this.modalFocusableElements.unshift(this.closeButtonElement);
|
|
55
|
+
}
|
|
25
56
|
// Add event listener on last element
|
|
26
|
-
|
|
27
|
-
lastFocusableElement.addEventListener('keydown', event => {
|
|
28
|
-
if (event.key === 'Tab' && !event.shiftKey) {
|
|
29
|
-
event.preventDefault();
|
|
30
|
-
this.modalFocusableElements[0].focus();
|
|
31
|
-
}
|
|
32
|
-
});
|
|
57
|
+
this.getLastFocusableElement().addEventListener('keydown', this.handleLastFocusableElement);
|
|
33
58
|
// Add event listener on first element (case shift + tab)
|
|
34
|
-
this.modalFocusableElements[0].addEventListener('keydown',
|
|
35
|
-
if (event.key === 'Tab' && event.shiftKey) {
|
|
36
|
-
event.preventDefault();
|
|
37
|
-
lastFocusableElement.focus();
|
|
38
|
-
}
|
|
39
|
-
});
|
|
59
|
+
this.modalFocusableElements[0].addEventListener('keydown', this.handleFirstFocusableElement);
|
|
40
60
|
}
|
|
41
61
|
};
|
|
42
62
|
/*************
|
|
@@ -62,15 +82,21 @@ export class MgModal {
|
|
|
62
82
|
}
|
|
63
83
|
}
|
|
64
84
|
validateHide(newValue) {
|
|
85
|
+
var _a;
|
|
65
86
|
if (newValue) {
|
|
66
87
|
this.componentHide.emit();
|
|
67
88
|
this.classCollection.add(this.classHide);
|
|
68
89
|
document.body.style.overflow = this.bodyOverflow;
|
|
90
|
+
// reset focus handlers
|
|
91
|
+
(_a = this.getLastFocusableElement()) === null || _a === void 0 ? void 0 : _a.removeEventListener('keydown', this.handleLastFocusableElement);
|
|
92
|
+
if (this.modalFocusableElements.length > 0)
|
|
93
|
+
this.modalFocusableElements[0].removeEventListener('keydown', this.handleFirstFocusableElement);
|
|
69
94
|
}
|
|
70
95
|
else {
|
|
71
96
|
this.componentShow.emit();
|
|
72
97
|
this.classCollection.delete(this.classHide);
|
|
73
98
|
document.body.style.overflow = 'hidden';
|
|
99
|
+
this.setFocus();
|
|
74
100
|
}
|
|
75
101
|
}
|
|
76
102
|
/**
|
|
@@ -97,9 +123,6 @@ export class MgModal {
|
|
|
97
123
|
// Validate
|
|
98
124
|
this.hasActions = this.element.querySelector('[slot="actions"]') !== null;
|
|
99
125
|
this.hasContent = this.element.querySelector('[slot="content"]') !== null;
|
|
100
|
-
if (this.closeButton) {
|
|
101
|
-
this.closeButtonId = `${this.identifier}-close-button`;
|
|
102
|
-
}
|
|
103
126
|
this.titleId = `${this.identifier}-title`;
|
|
104
127
|
this.validateModalTitle(this.modalTitle);
|
|
105
128
|
this.validateHide(this.hide);
|
|
@@ -109,21 +132,26 @@ export class MgModal {
|
|
|
109
132
|
*/
|
|
110
133
|
componentDidLoad() {
|
|
111
134
|
new MutationObserver(mutationList => {
|
|
112
|
-
|
|
113
|
-
|
|
135
|
+
// as mutation.target is null on chrome and '' or undefined on firefox we test both with the 'aria-hidden' attribute mutation
|
|
136
|
+
if (mutationList.some(mutation => mutation.attributeName === 'aria-hidden' && ['', null, undefined].includes(mutation.target.ariaHidden))) {
|
|
137
|
+
// Set focus on first element
|
|
138
|
+
this.modalFocusableElements[0].focus();
|
|
114
139
|
}
|
|
115
140
|
}).observe(this.element.shadowRoot.getElementById(this.identifier), { attributes: true });
|
|
116
|
-
// Set focus if display on load
|
|
117
|
-
if (!this.hide) {
|
|
118
|
-
this.setFocus();
|
|
119
|
-
}
|
|
120
141
|
}
|
|
121
142
|
/**
|
|
122
143
|
* Render
|
|
123
144
|
* @returns HTML Element
|
|
124
145
|
*/
|
|
125
146
|
render() {
|
|
126
|
-
return (h("div", { role: "alertdialog", id: this.identifier, class: this.classCollection.join(), tabindex: "-1", "aria-labelledby": this.titleId, "aria-modal": "true", "aria-hidden": this.hide }, h("mg-card", null, h("div", { class: "mg-modal__dialog" }, h("header", { class: "mg-modal__header" }, this.closeButton && (h("span", { class: "mg-modal__close-button" }, h("mg-button", { identifier: this.
|
|
147
|
+
return (h("div", { role: "alertdialog", id: this.identifier, class: this.classCollection.join(), tabindex: "-1", "aria-labelledby": this.titleId, "aria-modal": "true", "aria-hidden": this.hide }, h("mg-card", null, h("div", { class: "mg-modal__dialog" }, h("header", { class: "mg-modal__header" }, this.closeButton && (h("span", { class: "mg-modal__close-button" }, h("mg-button", { identifier: `${this.identifier}-close-button`, "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose, ref: el => {
|
|
148
|
+
if (el !== null) {
|
|
149
|
+
// store closeButton Element
|
|
150
|
+
this.closeButtonElement = el;
|
|
151
|
+
// add close button element to modalFocusableElements when it is render
|
|
152
|
+
this.modalFocusableElements.unshift(this.closeButtonElement);
|
|
153
|
+
}
|
|
154
|
+
} }, h("mg-icon", { icon: "cross" })))), h("h1", { class: "mg-modal__title", id: this.titleId }, this.modalTitle)), this.hasContent && (h("article", { class: "mg-modal__content" }, h("slot", { name: "content" }))), this.hasActions && (h("footer", { class: "mg-modal__footer" }, h("slot", { name: "actions" })))))));
|
|
127
155
|
}
|
|
128
156
|
static get is() { return "mg-modal"; }
|
|
129
157
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h } from '@stencil/core';
|
|
1
|
+
import { h, Host } from '@stencil/core';
|
|
2
2
|
import { createID } from '../../../utils/components.utils';
|
|
3
3
|
import { NavigationAction } from './mg-pagination.conf';
|
|
4
4
|
import { initLocales } from './../../../locales';
|
|
@@ -98,7 +98,7 @@ export class MgPagination {
|
|
|
98
98
|
const navigationActionButton = (disabled, action) => (h("mg-button", { identifier: `${this.identifier}-button-${action}`, label: this.messages.pagination[`${action}Page`],
|
|
99
99
|
// eslint-disable-next-line react/jsx-no-bind
|
|
100
100
|
onClick: () => this.handleGoToPage(action, disabled), disabled: disabled, variant: "flat", isIcon: this.hideNavigationLabels }, action === NavigationAction.PREVIOUS && h("mg-icon", { icon: "chevron-left" }), !this.hideNavigationLabels && this.messages.general[action], action === NavigationAction.NEXT && h("mg-icon", { icon: "chevron-right" })));
|
|
101
|
-
return (h("nav", { "aria-label": this.label, id: this.identifier, class: { 'mg-pagination': true, 'mg-pagination--hide-page-count': this.hidePageCount } }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), !this.hidePageCount && (h("mg-input-select", { identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: this.messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true })), h("span", { class: "sr-only" }, this.messages.pagination.page, " ", this.currentPage), h("span", { class: { 'sr-only': this.hidePageCount } }, "/ ", this.totalPages, " ", this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT)));
|
|
101
|
+
return (h(Host, { hidden: this.totalPages < 2 }, h("nav", { "aria-label": this.label, id: this.identifier, class: { 'mg-pagination': true, 'mg-pagination--hide-page-count': this.hidePageCount } }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), !this.hidePageCount && (h("mg-input-select", { identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: this.messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true })), h("span", { class: "sr-only" }, this.messages.pagination.page, " ", this.currentPage), h("span", { class: { 'sr-only': this.hidePageCount } }, "/ ", this.totalPages, " ", this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT))));
|
|
102
102
|
}
|
|
103
103
|
static get is() { return "mg-pagination"; }
|
|
104
104
|
static get encapsulation() { return "shadow"; }
|
|
@@ -60,7 +60,7 @@ export class MgPanel {
|
|
|
60
60
|
* Render collapse button
|
|
61
61
|
* @returns collpase button
|
|
62
62
|
*/
|
|
63
|
-
this.renderCollapseButton = () => (h("mg-button", { onClick: this.handleCollapseButton, variant: "flat", identifier: `${this.identifier}-collapse-button`, "aria-expanded": this.expanded !== undefined && this.expanded.toString(), "aria-controls": `${this.identifier}-content`, disabled: this.expandToggleDisabled, isIcon: this.expandToggleDisplay === 'icon', label: this.panelTitle }, h("span", { class: "mg-panel__collapse-button-content" }, h("mg-icon", { icon:
|
|
63
|
+
this.renderCollapseButton = () => (h("mg-button", { onClick: this.handleCollapseButton, variant: "flat", identifier: `${this.identifier}-collapse-button`, "aria-expanded": this.expanded !== undefined && this.expanded.toString(), "aria-controls": `${this.identifier}-content`, disabled: this.expandToggleDisabled, isIcon: this.expandToggleDisplay === 'icon', label: this.panelTitle }, h("span", { class: "mg-panel__collapse-button-content" }, h("mg-icon", { icon: "chevron-up", class: { 'mg-panel__collapse-button-icon': true, 'mg-panel__collapse-button-icon--reverse': !this.expanded } }), !this.isEditing && this.expandToggleDisplay !== 'icon' && this.panelTitle)));
|
|
64
64
|
/**
|
|
65
65
|
* Render edit button
|
|
66
66
|
* @returns edit Button
|
|
@@ -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 = {
|