@mgdis/mg-components 5.6.0 → 5.8.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-4dcc1812.js → index-5e7ede97.js} +109 -3
- package/dist/cjs/loader.cjs.js +4 -3
- package/dist/cjs/{mg-badge_30.cjs.entry.js → mg-action-more_31.cjs.entry.js} +490 -661
- package/dist/cjs/mg-components.cjs.js +7 -3
- package/dist/cjs/mg-item-more.cjs.entry.js +273 -0
- package/dist/cjs/mg-menu.conf-9afe6571.js +242 -0
- package/dist/collection/collection-manifest.json +7 -5
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +1 -1
- package/dist/collection/components/atoms/mg-button/mg-button.css +7 -21
- package/dist/collection/components/atoms/mg-button/mg-button.js +25 -1
- package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +35 -27
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +3 -3
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +18 -17
- package/dist/collection/components/molecules/inputs/MgInput.js +6 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +3 -2
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +4 -0
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +4 -0
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +4 -0
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +2 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +4 -0
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +4 -0
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +4 -0
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +4 -4
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js +0 -13
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +41 -70
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +5 -4
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +160 -61
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.conf.js +1 -0
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.css +38 -0
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +252 -0
- package/dist/collection/components/molecules/mg-form/mg-form.js +2 -2
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.conf.js +1 -0
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.css +30 -0
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +200 -0
- package/dist/collection/components/molecules/mg-message/mg-message.js +1 -1
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +19 -1
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +2 -2
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +0 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +17 -4
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +2 -1
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +2 -3
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +9 -8
- package/dist/collection/locales/en/messages.json +6 -1
- package/dist/collection/locales/fr/messages.json +6 -1
- package/dist/collection/locales/index.js +1 -1
- package/dist/collection/styles/mg-icon-animation.scss +6 -0
- package/dist/collection/styles/navigation-button.scss +3 -2
- package/dist/collection/utils/behaviors.utils.js +38 -52
- package/dist/collection/utils/components.utils.js +3 -1
- package/dist/collection/utils/locale.utils.js +9 -9
- package/dist/collection/utils/unit.test.utils.js +32 -4
- package/dist/collection/variables.css +2 -1
- package/dist/components/MgInput.js +6 -1
- package/dist/components/components.utils.js +3 -1
- package/dist/components/index.d.ts +11 -0
- package/dist/components/index.js +3 -1
- package/dist/components/index2.js +26 -14
- package/dist/components/mg-action-more.d.ts +11 -0
- package/dist/components/mg-action-more.js +216 -0
- package/dist/components/mg-badge2.js +1 -1
- package/dist/components/mg-button2.js +6 -3
- package/dist/components/mg-form.js +2 -2
- package/dist/components/mg-icon2.js +38 -30
- package/dist/components/mg-input-checkbox.js +3 -3
- package/dist/components/mg-input-date.js +2 -2
- package/dist/components/mg-input-numeric.js +2 -2
- package/dist/components/mg-input-password.js +1 -1
- package/dist/components/mg-input-radio.js +2 -2
- package/dist/components/mg-input-select2.js +2 -2
- package/dist/components/mg-input-text2.js +1 -1
- package/dist/components/mg-input-textarea.js +2 -2
- package/dist/components/mg-input-toggle.js +1 -1
- package/dist/components/mg-item-more.d.ts +11 -0
- package/dist/components/mg-item-more.js +336 -0
- package/dist/components/mg-menu-item2.js +137 -250
- package/dist/components/mg-menu.conf.js +14 -0
- package/dist/components/mg-menu.js +1 -246
- package/dist/components/mg-menu2.js +180 -0
- package/dist/components/mg-message.js +1 -1
- package/dist/components/mg-pagination.js +3 -1
- package/dist/components/mg-panel.js +2 -2
- package/dist/components/mg-popover2.js +17 -3
- package/dist/components/mg-skip-links.js +1 -1
- package/dist/components/mg-tabs.js +10 -9
- package/dist/components/mg-tag.js +1 -1
- package/dist/components/mg-tooltip2.js +18 -17
- package/dist/esm/{index-dc9a2348.js → index-03cceb11.js} +109 -4
- package/dist/esm/loader.js +4 -3
- package/dist/esm/{mg-badge_30.entry.js → mg-action-more_31.entry.js} +464 -636
- package/dist/esm/mg-components.js +4 -3
- package/dist/esm/mg-item-more.entry.js +269 -0
- package/dist/esm/mg-menu.conf-881fbd82.js +235 -0
- package/dist/mg-components/locales/en/messages.json +6 -1
- package/dist/mg-components/locales/fr/messages.json +6 -1
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/p-1221773c.entry.js +1 -0
- package/dist/mg-components/p-367f92d2.js +1 -0
- package/dist/mg-components/p-6aeded97.entry.js +1 -0
- package/dist/mg-components/p-e126dd84.js +2 -0
- package/dist/mg-components/styles/mg-icon-animation.scss +6 -0
- package/dist/mg-components/styles/navigation-button.scss +3 -2
- package/dist/mg-components/variables.css +2 -1
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +5 -0
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +1 -1
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.conf.d.ts +3 -27
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +9 -27
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.conf.d.ts +5 -0
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +66 -11
- package/dist/types/components/molecules/mg-action-more/mg-action-more.conf.d.ts +42 -0
- package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +81 -0
- package/dist/types/components/molecules/mg-item-more/mg-item-more.conf.d.ts +26 -0
- package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +74 -0
- package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +4 -0
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +2 -1
- package/dist/types/components.d.ts +120 -12
- package/dist/types/locales/index.d.ts +12 -2
- package/dist/types/stencil-public-runtime.d.ts +9 -0
- package/dist/types/utils/behaviors.utils.d.ts +12 -11
- package/dist/types/utils/locale.utils.d.ts +5 -5
- package/dist/types/utils/unit.test.utils.d.ts +20 -2
- package/loader/index.d.ts +9 -0
- package/package.json +17 -16
- package/readme.md +0 -18
- package/dist/.storybook/utils.js +0 -24
- package/dist/collection/components/atoms/mg-badge/doc/mg-badge.stories.js +0 -27
- package/dist/collection/components/atoms/mg-button/doc/mg-button.stories.js +0 -38
- package/dist/collection/components/atoms/mg-card/doc/mg-card.stories.js +0 -18
- package/dist/collection/components/atoms/mg-character-left/doc/mg-character-left.stories.js +0 -20
- package/dist/collection/components/atoms/mg-divider/doc/mg-divider.stories.js +0 -18
- package/dist/collection/components/atoms/mg-icon/doc/mg-icon.stories.js +0 -41
- package/dist/collection/components/atoms/mg-input-title/doc/mg-input-title.stories.js +0 -21
- package/dist/collection/components/atoms/mg-tag/doc/mg-tag.stories.js +0 -22
- package/dist/collection/components/atoms/mg-tooltip/doc/mg-tooltip.stories.js +0 -50
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/doc/mg-input-checkbox.stories.js +0 -50
- package/dist/collection/components/molecules/inputs/mg-input-date/doc/mg-input-date.stories.js +0 -43
- package/dist/collection/components/molecules/inputs/mg-input-numeric/doc/mg-input-numeric.stories.js +0 -68
- package/dist/collection/components/molecules/inputs/mg-input-password/doc/mg-input-password.stories.js +0 -46
- package/dist/collection/components/molecules/inputs/mg-input-radio/doc/mg-input-radio.stories.js +0 -59
- package/dist/collection/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.js +0 -77
- package/dist/collection/components/molecules/inputs/mg-input-text/doc/mg-input-text.stories.js +0 -110
- package/dist/collection/components/molecules/inputs/mg-input-textarea/doc/mg-input-textarea.stories.js +0 -54
- package/dist/collection/components/molecules/inputs/mg-input-toggle/doc/mg-input-toggle.stories.js +0 -51
- package/dist/collection/components/molecules/menu/mg-menu/doc/mg-menu.stories.js +0 -119
- package/dist/collection/components/molecules/menu/mg-menu-item/doc/mg-menu-item.stories.js +0 -34
- package/dist/collection/components/molecules/mg-details/doc/mg-details.stories.js +0 -24
- package/dist/collection/components/molecules/mg-form/doc/mg-form.stories.js +0 -47
- package/dist/collection/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.js +0 -19
- package/dist/collection/components/molecules/mg-message/doc/mg-message.stories.js +0 -39
- package/dist/collection/components/molecules/mg-modal/doc/mg-modal.stories.js +0 -39
- package/dist/collection/components/molecules/mg-pagination/doc/mg-pagination.stories.js +0 -20
- package/dist/collection/components/molecules/mg-panel/doc/mg-panel.stories.js +0 -22
- package/dist/collection/components/molecules/mg-popover/doc/mg-popover.stories.js +0 -34
- package/dist/collection/components/molecules/mg-skip-links/doc/mg-skip-links.stories.js +0 -24
- package/dist/collection/components/molecules/mg-tabs/doc/mg-tabs.stories.js +0 -53
- package/dist/collection/stories/grids.stories.js +0 -7
- package/dist/collection/stories/helpers.stories.js +0 -23
- package/dist/collection/stories/icons.stories.js +0 -25
- package/dist/collection/stories/typography.stories.js +0 -24
- package/dist/mg-components/p-182bd802.js +0 -2
- package/dist/mg-components/p-f7da9dd2.entry.js +0 -1
- package/dist/types/components/atoms/mg-badge/doc/mg-badge.stories.d.ts +0 -13
- package/dist/types/components/atoms/mg-button/doc/mg-button.stories.d.ts +0 -16
- package/dist/types/components/atoms/mg-card/doc/mg-card.stories.d.ts +0 -6
- package/dist/types/components/atoms/mg-character-left/doc/mg-character-left.stories.d.ts +0 -6
- package/dist/types/components/atoms/mg-divider/doc/mg-divider.stories.d.ts +0 -6
- package/dist/types/components/atoms/mg-icon/doc/mg-icon.stories.d.ts +0 -26
- package/dist/types/components/atoms/mg-input-title/doc/mg-input-title.stories.d.ts +0 -6
- package/dist/types/components/atoms/mg-tag/doc/mg-tag.stories.d.ts +0 -6
- package/dist/types/components/atoms/mg-tooltip/doc/mg-tooltip.stories.d.ts +0 -18
- package/dist/types/components/molecules/inputs/mg-input-checkbox/doc/mg-input-checkbox.stories.d.ts +0 -11
- package/dist/types/components/molecules/inputs/mg-input-date/doc/mg-input-date.stories.d.ts +0 -12
- package/dist/types/components/molecules/inputs/mg-input-numeric/doc/mg-input-numeric.stories.d.ts +0 -32
- package/dist/types/components/molecules/inputs/mg-input-password/doc/mg-input-password.stories.d.ts +0 -22
- package/dist/types/components/molecules/inputs/mg-input-radio/doc/mg-input-radio.stories.d.ts +0 -20
- package/dist/types/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.d.ts +0 -34
- package/dist/types/components/molecules/inputs/mg-input-text/doc/mg-input-text.stories.d.ts +0 -39
- package/dist/types/components/molecules/inputs/mg-input-textarea/doc/mg-input-textarea.stories.d.ts +0 -19
- package/dist/types/components/molecules/inputs/mg-input-toggle/doc/mg-input-toggle.stories.d.ts +0 -12
- package/dist/types/components/molecules/menu/mg-menu/doc/mg-menu.stories.d.ts +0 -22
- package/dist/types/components/molecules/menu/mg-menu-item/doc/mg-menu-item.stories.d.ts +0 -12
- package/dist/types/components/molecules/mg-details/doc/mg-details.stories.d.ts +0 -11
- package/dist/types/components/molecules/mg-form/doc/mg-form.stories.d.ts +0 -11
- package/dist/types/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.d.ts +0 -6
- package/dist/types/components/molecules/mg-message/doc/mg-message.stories.d.ts +0 -26
- package/dist/types/components/molecules/mg-modal/doc/mg-modal.stories.d.ts +0 -13
- package/dist/types/components/molecules/mg-pagination/doc/mg-pagination.stories.d.ts +0 -11
- package/dist/types/components/molecules/mg-panel/doc/mg-panel.stories.d.ts +0 -11
- package/dist/types/components/molecules/mg-popover/doc/mg-popover.stories.d.ts +0 -22
- package/dist/types/components/molecules/mg-skip-links/doc/mg-skip-links.stories.d.ts +0 -11
- package/dist/types/components/molecules/mg-tabs/doc/mg-tabs.stories.d.ts +0 -20
- package/dist/types/home/runner/work/mg-components/mg-components/.stencil/.storybook/utils.d.ts +0 -1
- package/dist/types/stories/grids.stories.d.ts +0 -5
- package/dist/types/stories/helpers.stories.d.ts +0 -13
- package/dist/types/stories/icons.stories.d.ts +0 -13
- package/dist/types/stories/typography.stories.d.ts +0 -5
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
.mg-input__input {
|
|
74
74
|
display: flex;
|
|
75
75
|
/* Manage space between input and first message */
|
|
76
|
+
/* Set custom opacity on disabled input */
|
|
76
77
|
}
|
|
77
78
|
.mg-input__input mg-tooltip {
|
|
78
79
|
margin-top: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);
|
|
@@ -83,6 +84,9 @@
|
|
|
83
84
|
.mg-input__input + .mg-input__help-text, .mg-input__input + .mg-input__error {
|
|
84
85
|
margin-top: 0.5rem;
|
|
85
86
|
}
|
|
87
|
+
.mg-input__input .mg-input__box:disabled, .mg-input__input-group--disabled label, .mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle {
|
|
88
|
+
opacity: var(--mg-disabled-opacity);
|
|
89
|
+
}
|
|
86
90
|
|
|
87
91
|
.mg-input__error {
|
|
88
92
|
display: inline-block;
|
|
@@ -145,9 +149,6 @@ fieldset.mg-input.mg-input--label-on-top .mg-input__input-group-container {
|
|
|
145
149
|
display: flex;
|
|
146
150
|
align-items: top;
|
|
147
151
|
}
|
|
148
|
-
.mg-input__input-group.mg-input__input-group--disabled label {
|
|
149
|
-
opacity: 0.3;
|
|
150
|
-
}
|
|
151
152
|
|
|
152
153
|
/**
|
|
153
154
|
* A11Y
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable jsx-a11y/no-redundant-roles */
|
|
1
2
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
2
3
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
4
|
import { h } from '@stencil/core';
|
|
@@ -154,7 +155,7 @@ export class MgInputRadio {
|
|
|
154
155
|
* @returns {HTMLElement} HTML Element
|
|
155
156
|
*/
|
|
156
157
|
render() {
|
|
157
|
-
return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, disabled: this.disabled, readonly: this.readonly, mgWidth: undefined, value: this.value, readonlyValue: this.value, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: true }, h("ul", { class: { 'mg-input__input-group-container': true, 'mg-input__input-group-container--vertical': this.inputVerticalList } }, this.options.map((input, index) => (h("li", { class: { 'mg-input__input-group': true, 'mg-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "radio", id: this.identifier + '_' + index, name: this.identifier, value: index, checked: JSON.stringify(this.value) === JSON.stringify(this.options[index].value), disabled: this.disabled || input.disabled, required: this.required, onBlur: this.handleBlur, onInput: this.handleInput, ref: el => {
|
|
158
|
+
return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, disabled: this.disabled, readonly: this.readonly, mgWidth: undefined, value: this.value, readonlyValue: this.value, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: true }, h("ul", { class: { 'mg-input__input-group-container': true, 'mg-input__input-group-container--vertical': this.inputVerticalList }, role: "list" }, this.options.map((input, index) => (h("li", { key: input.title, class: { 'mg-input__input-group': true, 'mg-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "radio", id: this.identifier + '_' + index, name: this.identifier, value: index, checked: JSON.stringify(this.value) === JSON.stringify(this.options[index].value), disabled: this.disabled || input.disabled, required: this.required, onBlur: this.handleBlur, onInput: this.handleInput, ref: el => {
|
|
158
159
|
if (el !== null)
|
|
159
160
|
this.inputs[index] = el;
|
|
160
161
|
} }), h("label", { htmlFor: this.identifier + '_' + index }, input.title)))))));
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
.mg-input__input {
|
|
74
74
|
display: flex;
|
|
75
75
|
/* Manage space between input and first message */
|
|
76
|
+
/* Set custom opacity on disabled input */
|
|
76
77
|
}
|
|
77
78
|
.mg-input__input mg-tooltip {
|
|
78
79
|
margin-top: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);
|
|
@@ -83,6 +84,9 @@
|
|
|
83
84
|
.mg-input__input + .mg-input__help-text, .mg-input__input + .mg-input__error {
|
|
84
85
|
margin-top: 0.5rem;
|
|
85
86
|
}
|
|
87
|
+
.mg-input__input .mg-input__box:disabled, .mg-input__input-group--disabled label, .mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle {
|
|
88
|
+
opacity: var(--mg-disabled-opacity);
|
|
89
|
+
}
|
|
86
90
|
|
|
87
91
|
.mg-input__error {
|
|
88
92
|
display: inline-block;
|
|
@@ -198,7 +198,7 @@ export class MgInputSelect {
|
|
|
198
198
|
if (el !== null)
|
|
199
199
|
this.input = el;
|
|
200
200
|
} }, (!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder
|
|
201
|
-
h("option", { value: "", disabled: this.placeholderDisabled && this.valueExist }, this.placeholder)), this.options.map(option => option.group !== undefined ? (h("optgroup", { label: option.group }, option.options.map(optgroup => (h("option", { value: optgroup.title, selected: JSON.stringify(this.value) === JSON.stringify(optgroup.value), disabled: optgroup.disabled }, optgroup.title))))) : (h("option", { value: option.title, selected: JSON.stringify(this.value) === JSON.stringify(option.value), disabled: option.disabled }, option.title))))));
|
|
201
|
+
h("option", { value: "", disabled: this.placeholderDisabled && this.valueExist }, this.placeholder)), this.options.map(option => option.group !== undefined ? (h("optgroup", { label: option.group }, option.options.map(optgroup => (h("option", { key: optgroup.title, value: optgroup.title, selected: JSON.stringify(this.value) === JSON.stringify(optgroup.value), disabled: optgroup.disabled }, optgroup.title))))) : (h("option", { value: option.title, selected: JSON.stringify(this.value) === JSON.stringify(option.value), disabled: option.disabled }, option.title))))));
|
|
202
202
|
}
|
|
203
203
|
static get is() { return "mg-input-select"; }
|
|
204
204
|
static get encapsulation() { return "shadow"; }
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
.mg-input__input {
|
|
74
74
|
display: flex;
|
|
75
75
|
/* Manage space between input and first message */
|
|
76
|
+
/* Set custom opacity on disabled input */
|
|
76
77
|
}
|
|
77
78
|
.mg-input__input mg-tooltip {
|
|
78
79
|
margin-top: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);
|
|
@@ -83,6 +84,9 @@
|
|
|
83
84
|
.mg-input__input + .mg-input__help-text, .mg-input__input + .mg-input__error {
|
|
84
85
|
margin-top: 0.5rem;
|
|
85
86
|
}
|
|
87
|
+
.mg-input__input .mg-input__box:disabled, .mg-input__input-group--disabled label, .mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle {
|
|
88
|
+
opacity: var(--mg-disabled-opacity);
|
|
89
|
+
}
|
|
86
90
|
|
|
87
91
|
.mg-input__error {
|
|
88
92
|
display: inline-block;
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
.mg-input__input {
|
|
74
74
|
display: flex;
|
|
75
75
|
/* Manage space between input and first message */
|
|
76
|
+
/* Set custom opacity on disabled input */
|
|
76
77
|
}
|
|
77
78
|
.mg-input__input mg-tooltip {
|
|
78
79
|
margin-top: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);
|
|
@@ -83,6 +84,9 @@
|
|
|
83
84
|
.mg-input__input + .mg-input__help-text, .mg-input__input + .mg-input__error {
|
|
84
85
|
margin-top: 0.5rem;
|
|
85
86
|
}
|
|
87
|
+
.mg-input__input .mg-input__box:disabled, .mg-input__input-group--disabled label, .mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle {
|
|
88
|
+
opacity: var(--mg-disabled-opacity);
|
|
89
|
+
}
|
|
86
90
|
|
|
87
91
|
.mg-input__error {
|
|
88
92
|
display: inline-block;
|
|
@@ -41,7 +41,7 @@ export class MgInputTextarea {
|
|
|
41
41
|
};
|
|
42
42
|
/**
|
|
43
43
|
* Get pattern validity
|
|
44
|
-
* Pattern is not defined on textarea field
|
|
44
|
+
* Pattern is not defined on textarea field: https://developer.mozilla.org/fr/docs/Web/HTML/Element/Textarea
|
|
45
45
|
*
|
|
46
46
|
* @returns {boolean} is pattern valid
|
|
47
47
|
*/
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
.mg-input__input {
|
|
74
74
|
display: flex;
|
|
75
75
|
/* Manage space between input and first message */
|
|
76
|
+
/* Set custom opacity on disabled input */
|
|
76
77
|
}
|
|
77
78
|
.mg-input__input mg-tooltip {
|
|
78
79
|
margin-top: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);
|
|
@@ -83,6 +84,9 @@
|
|
|
83
84
|
.mg-input__input + .mg-input__help-text, .mg-input__input + .mg-input__error {
|
|
84
85
|
margin-top: 0.5rem;
|
|
85
86
|
}
|
|
87
|
+
.mg-input__input .mg-input__box:disabled, .mg-input__input-group--disabled label, .mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle {
|
|
88
|
+
opacity: var(--mg-disabled-opacity);
|
|
89
|
+
}
|
|
86
90
|
|
|
87
91
|
.mg-input__error {
|
|
88
92
|
display: inline-block;
|
|
@@ -226,8 +230,4 @@
|
|
|
226
230
|
}
|
|
227
231
|
.mg-input.mg-input--toggle-readonly.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type {
|
|
228
232
|
display: flex;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
.mg-input.mg-input--toggle-disabled .mg-input__button-toggle {
|
|
232
|
-
opacity: 0.3;
|
|
233
233
|
}
|
|
@@ -6,19 +6,6 @@ export var Direction;
|
|
|
6
6
|
Direction["VERTICAL"] = "vertical";
|
|
7
7
|
Direction["HORIZONTAL"] = "horizontal";
|
|
8
8
|
})(Direction || (Direction = {}));
|
|
9
|
-
/**
|
|
10
|
-
* More item type guard
|
|
11
|
-
*
|
|
12
|
-
* @param {unknown} element element to control
|
|
13
|
-
* @returns {boolean} truthy if element is more-item
|
|
14
|
-
*/
|
|
15
|
-
export const isMoreItem = (element) => {
|
|
16
|
-
var _a, _b, _c;
|
|
17
|
-
const item = element;
|
|
18
|
-
return (item === undefined ||
|
|
19
|
-
(typeof item === 'object' &&
|
|
20
|
-
(typeof item.size === 'string' || typeof ((_a = item.mgIcon) === null || _a === void 0 ? void 0 : _a.icon) === 'string' || typeof ((_b = item.slotLabel) === null || _b === void 0 ? void 0 : _b.label) === 'string' || typeof ((_c = item.slotLabel) === null || _c === void 0 ? void 0 : _c.display) === 'boolean')));
|
|
21
|
-
};
|
|
22
9
|
/**
|
|
23
10
|
* List of all possibles sizes
|
|
24
11
|
*/
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { h, Host } from '@stencil/core';
|
|
2
|
-
import {
|
|
3
|
-
import { Direction, isMoreItem, sizes } from './mg-menu.conf';
|
|
4
|
-
import { initLocales } from '../../../../locales';
|
|
2
|
+
import { Direction, sizes } from './mg-menu.conf';
|
|
5
3
|
export class MgMenu {
|
|
6
4
|
constructor() {
|
|
7
5
|
/************
|
|
@@ -45,46 +43,23 @@ export class MgMenu {
|
|
|
45
43
|
});
|
|
46
44
|
};
|
|
47
45
|
/**
|
|
48
|
-
* render mg-
|
|
46
|
+
* render mg-item-more
|
|
49
47
|
*
|
|
50
|
-
* @returns {
|
|
51
|
-
*/
|
|
52
|
-
this.renderMgMenuMore = () => {
|
|
53
|
-
const moreElement = this.element.shadowRoot.querySelector(`[${OverflowBehaviorElements.MORE}]`);
|
|
54
|
-
this.menuItems.forEach((child) => {
|
|
55
|
-
const proxy = child.cloneNode(true);
|
|
56
|
-
moreElement.querySelector('mg-menu').appendChild(proxy);
|
|
57
|
-
});
|
|
58
|
-
const allMenuItem = Array.from(this.element.querySelectorAll('mg-menu-item:not([data-overflow-more])'));
|
|
59
|
-
Array.from(moreElement.querySelectorAll('mg-menu-item:not([data-overflow-more])')).forEach((proxy, index) => {
|
|
60
|
-
// manage click on proxy to mirror it on initial element
|
|
61
|
-
proxy.addEventListener('click', () => {
|
|
62
|
-
(allMenuItem[index].shadowRoot.querySelector('a') || allMenuItem[index].shadowRoot.querySelector('button')).dispatchEvent(new MouseEvent('click', { bubbles: true }));
|
|
63
|
-
});
|
|
64
|
-
// manage status change miror in proxy
|
|
65
|
-
allMenuItem[index].addEventListener('status-change', (event) => {
|
|
66
|
-
proxy.setAttribute('status', event.detail);
|
|
67
|
-
this.overflowBehavior.updateActiveStatus();
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
this.element.appendChild(moreElement);
|
|
71
|
-
return this.element.querySelector(`[${OverflowBehaviorElements.MORE}]`);
|
|
72
|
-
};
|
|
73
|
-
/**
|
|
74
|
-
* Render mg-menu-item more element for overflow behavior
|
|
75
|
-
*
|
|
76
|
-
* @returns {HTMLElement} rendered mg-menu-item more element
|
|
48
|
+
* @returns {void}
|
|
77
49
|
*/
|
|
78
|
-
this.
|
|
79
|
-
|
|
80
|
-
|
|
50
|
+
this.renderMgItemMore = () => {
|
|
51
|
+
// /!\ externalise item tag name to get a string type and bypass type checking when value is used in next createElement
|
|
52
|
+
// by doing this we prevent stencil to generate a circular dependencies graph at build time with mg-item-more component.
|
|
53
|
+
const item = 'mg-item-more';
|
|
54
|
+
const mgItemMore = document.createElement(item);
|
|
55
|
+
Object.assign(mgItemMore, this.itemMore);
|
|
56
|
+
this.element.appendChild(mgItemMore);
|
|
81
57
|
};
|
|
82
58
|
this.label = undefined;
|
|
83
59
|
this.direction = Direction.HORIZONTAL;
|
|
84
|
-
this.
|
|
60
|
+
this.itemMore = undefined;
|
|
85
61
|
this.size = 'regular';
|
|
86
62
|
this.isChildMenu = undefined;
|
|
87
|
-
this.hasOverflow = false;
|
|
88
63
|
}
|
|
89
64
|
validateLabel(newValue) {
|
|
90
65
|
if (newValue === undefined) {
|
|
@@ -93,20 +68,17 @@ export class MgMenu {
|
|
|
93
68
|
}
|
|
94
69
|
validateDirection(newValue) {
|
|
95
70
|
if (![Direction.VERTICAL, Direction.HORIZONTAL].includes(newValue)) {
|
|
96
|
-
throw new Error(`<${this.name}> prop "direction" must be one of
|
|
71
|
+
throw new Error(`<${this.name}> prop "direction" must be one of: ${Direction.HORIZONTAL}, ${Direction.VERTICAL}.`);
|
|
97
72
|
}
|
|
98
73
|
}
|
|
99
|
-
|
|
74
|
+
validateItemMore(newValue) {
|
|
100
75
|
if (newValue !== undefined && this.direction !== Direction.HORIZONTAL) {
|
|
101
|
-
throw new Error(`<${this.name}> prop "
|
|
102
|
-
}
|
|
103
|
-
else if (newValue !== undefined && !isMoreItem(newValue)) {
|
|
104
|
-
throw new Error(`<${this.name}> prop "moreitem" must match MoreItemType.`);
|
|
76
|
+
throw new Error(`<${this.name}> prop "itemMore" must be paired with direction ${Direction.HORIZONTAL}.`);
|
|
105
77
|
}
|
|
106
78
|
}
|
|
107
79
|
validateSize(newValue) {
|
|
108
80
|
if (!sizes.includes(newValue)) {
|
|
109
|
-
throw new Error(`<${this.name}> prop "size" must be one of
|
|
81
|
+
throw new Error(`<${this.name}> prop "size" must be one of: ${sizes.join(', ')}.`);
|
|
110
82
|
}
|
|
111
83
|
}
|
|
112
84
|
/*************
|
|
@@ -118,11 +90,9 @@ export class MgMenu {
|
|
|
118
90
|
* @returns {void}
|
|
119
91
|
*/
|
|
120
92
|
componentWillLoad() {
|
|
121
|
-
this.messages = initLocales(this.element).messages.plusMenu;
|
|
122
|
-
// validation
|
|
123
93
|
this.validateDirection(this.direction);
|
|
124
94
|
this.validateLabel(this.label);
|
|
125
|
-
this.
|
|
95
|
+
this.validateItemMore(this.itemMore);
|
|
126
96
|
this.validateSize(this.size);
|
|
127
97
|
}
|
|
128
98
|
/**
|
|
@@ -138,36 +108,38 @@ export class MgMenu {
|
|
|
138
108
|
// store all menu-items
|
|
139
109
|
this.menuItems = Array.from(this.element.children).filter(child => child.nodeName === 'MG-MENU-ITEM');
|
|
140
110
|
this.isChildMenu = this.element.closest('mg-menu-item') !== null;
|
|
141
|
-
|
|
142
|
-
if (this.
|
|
143
|
-
this.
|
|
111
|
+
// add mg-item-more to manage OverflowBehavior
|
|
112
|
+
if (this.direction === Direction.HORIZONTAL && !this.isChildMenu)
|
|
113
|
+
this.renderMgItemMore();
|
|
114
|
+
// use mutation observer to improve reactivity
|
|
115
|
+
new MutationObserver(entries => {
|
|
116
|
+
const mgItemMore = this.element.querySelector('mg-item-more');
|
|
117
|
+
// prevent infinit loop by exclude mg-item-more deletion entry
|
|
118
|
+
if (entries.some(entry => entry.type === 'childList' && Array.from(entry.removedNodes).some(node => node.nodeName === 'MG-ITEM-MORE')))
|
|
119
|
+
return;
|
|
120
|
+
else if (mgItemMore !== null) {
|
|
121
|
+
// render a new mg-item-more
|
|
122
|
+
mgItemMore.remove();
|
|
123
|
+
this.renderMgItemMore();
|
|
124
|
+
}
|
|
125
|
+
}).observe(this.element, { childList: true, characterData: true, subtree: true });
|
|
144
126
|
}, 0);
|
|
145
127
|
}
|
|
146
128
|
/**
|
|
147
|
-
*
|
|
129
|
+
* Add listeners to items
|
|
148
130
|
*
|
|
149
131
|
* @returns {void}
|
|
150
132
|
*/
|
|
151
133
|
componentDidRender() {
|
|
152
|
-
// add menu items listeners
|
|
153
134
|
this.initMenuItemsListeners();
|
|
154
135
|
}
|
|
155
|
-
/**
|
|
156
|
-
* Disconnect overflow ResizeObserver
|
|
157
|
-
*
|
|
158
|
-
* @returns {void} run overflow resize obeserver disconnexion
|
|
159
|
-
*/
|
|
160
|
-
disconnectedCallback() {
|
|
161
|
-
if (this.hasOverflow)
|
|
162
|
-
this.overflowBehavior.disconnect();
|
|
163
|
-
}
|
|
164
136
|
/**
|
|
165
137
|
* Render
|
|
166
138
|
*
|
|
167
139
|
* @returns {HTMLElement} HTML Element
|
|
168
140
|
*/
|
|
169
141
|
render() {
|
|
170
|
-
return (h(Host, { role: this.isChildMenu ? 'menu' : 'menubar', "aria-label": this.label }, h("slot", null)
|
|
142
|
+
return (h(Host, { role: this.isChildMenu ? 'menu' : 'menubar', "aria-label": this.label }, h("slot", null)));
|
|
171
143
|
}
|
|
172
144
|
static get is() { return "mg-menu"; }
|
|
173
145
|
static get encapsulation() { return "shadow"; }
|
|
@@ -223,14 +195,14 @@ export class MgMenu {
|
|
|
223
195
|
"reflect": true,
|
|
224
196
|
"defaultValue": "Direction.HORIZONTAL"
|
|
225
197
|
},
|
|
226
|
-
"
|
|
198
|
+
"itemMore": {
|
|
227
199
|
"type": "unknown",
|
|
228
200
|
"mutable": false,
|
|
229
201
|
"complexType": {
|
|
230
|
-
"original": "
|
|
231
|
-
"resolved": "{
|
|
202
|
+
"original": "ItemMoreType",
|
|
203
|
+
"resolved": "{ size: \"regular\" | \"large\" | \"medium\"; icon: IconType; slotlabel: SlotLabelType; }",
|
|
232
204
|
"references": {
|
|
233
|
-
"
|
|
205
|
+
"ItemMoreType": {
|
|
234
206
|
"location": "import",
|
|
235
207
|
"path": "./mg-menu.conf"
|
|
236
208
|
}
|
|
@@ -240,7 +212,7 @@ export class MgMenu {
|
|
|
240
212
|
"optional": false,
|
|
241
213
|
"docs": {
|
|
242
214
|
"tags": [],
|
|
243
|
-
"text": "Customize mg-
|
|
215
|
+
"text": "Customize \"mg-item-more\" element\nUsed with direction: 'vertical' to manage overflow"
|
|
244
216
|
}
|
|
245
217
|
},
|
|
246
218
|
"size": {
|
|
@@ -270,8 +242,7 @@ export class MgMenu {
|
|
|
270
242
|
}
|
|
271
243
|
static get states() {
|
|
272
244
|
return {
|
|
273
|
-
"isChildMenu": {}
|
|
274
|
-
"hasOverflow": {}
|
|
245
|
+
"isChildMenu": {}
|
|
275
246
|
};
|
|
276
247
|
}
|
|
277
248
|
static get elementRef() { return "element"; }
|
|
@@ -283,8 +254,8 @@ export class MgMenu {
|
|
|
283
254
|
"propName": "direction",
|
|
284
255
|
"methodName": "validateDirection"
|
|
285
256
|
}, {
|
|
286
|
-
"propName": "
|
|
287
|
-
"methodName": "
|
|
257
|
+
"propName": "itemMore",
|
|
258
|
+
"methodName": "validateItemMore"
|
|
288
259
|
}, {
|
|
289
260
|
"propName": "size",
|
|
290
261
|
"methodName": "validateSize"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button,
|
|
29
29
|
.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular {
|
|
30
30
|
padding: 1rem 2rem;
|
|
31
|
-
height:
|
|
31
|
+
height: 3.8rem;
|
|
32
32
|
}
|
|
33
33
|
.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button,
|
|
34
34
|
.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button ::slotted([slot=label]),
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button,
|
|
51
51
|
.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium {
|
|
52
52
|
padding: 1rem 3rem;
|
|
53
|
-
height:
|
|
53
|
+
height: 5.1rem;
|
|
54
54
|
}
|
|
55
55
|
.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button,
|
|
56
56
|
.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button ::slotted([slot=label]),
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button,
|
|
73
73
|
.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large {
|
|
74
74
|
padding: 1rem 4rem;
|
|
75
|
-
height:
|
|
75
|
+
height: 7.1rem;
|
|
76
76
|
}
|
|
77
77
|
.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button,
|
|
78
78
|
.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button ::slotted([slot=label]),
|
|
@@ -98,6 +98,7 @@
|
|
|
98
98
|
background-color: unset;
|
|
99
99
|
border: none;
|
|
100
100
|
font-family: var(--font-family);
|
|
101
|
+
font-weight: 400;
|
|
101
102
|
color: hsl(var(--mg-menu-item-color-hsl, var(--color-dark)));
|
|
102
103
|
line-height: var(--line-height);
|
|
103
104
|
text-decoration: none;
|
|
@@ -107,7 +108,7 @@
|
|
|
107
108
|
}
|
|
108
109
|
.mg-menu-item__navigation-button:disabled, .mg-menu-item__navigation-button--disabled {
|
|
109
110
|
cursor: default;
|
|
110
|
-
opacity:
|
|
111
|
+
opacity: var(--mg-disabled-opacity);
|
|
111
112
|
}
|
|
112
113
|
.mg-menu-item__navigation-button:focus-visible {
|
|
113
114
|
z-index: 10;
|