@mgdis/mg-components 5.6.0 → 5.7.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} +623 -445
- package/dist/cjs/mg-components.cjs.js +7 -3
- package/dist/collection/collection-manifest.json +5 -4
- 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 +1 -1
- package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +27 -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 +12 -15
- 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.js +2 -3
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +2 -1
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +31 -11
- 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-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 -1
- 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 +2 -1
- package/dist/collection/utils/behaviors.utils.js +16 -34
- 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 +10 -0
- package/dist/components/index.js +2 -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 +215 -0
- package/dist/components/mg-badge2.js +1 -1
- package/dist/components/mg-button2.js +2 -2
- package/dist/components/mg-form.js +2 -2
- package/dist/components/mg-icon2.js +30 -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-menu-item2.js +75 -72
- package/dist/components/mg-menu.js +1 -246
- package/dist/components/mg-menu2.js +247 -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 +12 -15
- 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} +623 -446
- package/dist/esm/mg-components.js +4 -3
- 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-4cfd5423.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 +2 -1
- package/dist/mg-components/variables.css +2 -1
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +1 -1
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +7 -1
- 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-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 +54 -0
- 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 +1 -7
- 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
|
}
|
|
@@ -64,7 +64,6 @@ export class MgMenu {
|
|
|
64
64
|
// manage status change miror in proxy
|
|
65
65
|
allMenuItem[index].addEventListener('status-change', (event) => {
|
|
66
66
|
proxy.setAttribute('status', event.detail);
|
|
67
|
-
this.overflowBehavior.updateActiveStatus();
|
|
68
67
|
});
|
|
69
68
|
});
|
|
70
69
|
this.element.appendChild(moreElement);
|
|
@@ -93,7 +92,7 @@ export class MgMenu {
|
|
|
93
92
|
}
|
|
94
93
|
validateDirection(newValue) {
|
|
95
94
|
if (![Direction.VERTICAL, Direction.HORIZONTAL].includes(newValue)) {
|
|
96
|
-
throw new Error(`<${this.name}> prop "direction" must be one of
|
|
95
|
+
throw new Error(`<${this.name}> prop "direction" must be one of: ${Direction.HORIZONTAL}, ${Direction.VERTICAL}.`);
|
|
97
96
|
}
|
|
98
97
|
}
|
|
99
98
|
validateMoreItem(newValue) {
|
|
@@ -106,7 +105,7 @@ export class MgMenu {
|
|
|
106
105
|
}
|
|
107
106
|
validateSize(newValue) {
|
|
108
107
|
if (!sizes.includes(newValue)) {
|
|
109
|
-
throw new Error(`<${this.name}> prop "size" must be one of
|
|
108
|
+
throw new Error(`<${this.name}> prop "size" must be one of: ${sizes.join(', ')}.`);
|
|
110
109
|
}
|
|
111
110
|
}
|
|
112
111
|
/*************
|
|
@@ -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;
|
|
@@ -25,11 +25,11 @@ export class MgMenuItem {
|
|
|
25
25
|
/**
|
|
26
26
|
* Does an Element have given Status
|
|
27
27
|
*
|
|
28
|
-
* @param {
|
|
28
|
+
* @param {HTMLMgMenuItemElement} mgMenuItemElement to parse
|
|
29
29
|
* @param {MgMenuItem['status']} status to check
|
|
30
30
|
* @returns {boolean} true if element with status is found
|
|
31
31
|
*/
|
|
32
|
-
this.hasStatus = (
|
|
32
|
+
this.hasStatus = (mgMenuItemElement, status) => mgMenuItemElement.status === status;
|
|
33
33
|
/**
|
|
34
34
|
* Is component contextual direction match the given direction
|
|
35
35
|
*
|
|
@@ -76,6 +76,17 @@ export class MgMenuItem {
|
|
|
76
76
|
childMenu !== null &&
|
|
77
77
|
Array.from(childMenu.children).some((subItem) => subItem.querySelector('mg-badge') !== null && subItem.getAttribute('hidden') === null);
|
|
78
78
|
};
|
|
79
|
+
/**
|
|
80
|
+
* Method to control if one of component children have active status
|
|
81
|
+
*
|
|
82
|
+
* @returns {boolean} truthy if component has active child
|
|
83
|
+
*/
|
|
84
|
+
this.hasActiveChild = () => {
|
|
85
|
+
var _a;
|
|
86
|
+
return Array.from(((_a = this.element.querySelector('mg-menu')) === null || _a === void 0 ? void 0 : _a.children) || [])
|
|
87
|
+
.filter(element => element.nodeName === 'MG-MENU-ITEM')
|
|
88
|
+
.some((element) => this.hasStatus(element, Status.ACTIVE) && element.getAttribute('hidden') === null);
|
|
89
|
+
};
|
|
79
90
|
/**
|
|
80
91
|
* Render slot
|
|
81
92
|
*
|
|
@@ -111,7 +122,7 @@ export class MgMenuItem {
|
|
|
111
122
|
item.expanded = false;
|
|
112
123
|
});
|
|
113
124
|
}
|
|
114
|
-
else if (this.
|
|
125
|
+
else if (this.element.querySelector(`${this.name}[status="${Status.ACTIVE}"]`) !== null) {
|
|
115
126
|
// - when expanded and contain an active item parents are expended too
|
|
116
127
|
subItems.forEach(item => {
|
|
117
128
|
if (this.hasStatus(item, Status.ACTIVE)) {
|
|
@@ -178,10 +189,10 @@ export class MgMenuItem {
|
|
|
178
189
|
this.isInMainMenu = this.element.parentElement.closest('mg-menu-item') === null;
|
|
179
190
|
// when main menu item contain an active item it will get the active style
|
|
180
191
|
// AND if item is in vertical menu it will be expanded
|
|
181
|
-
|
|
182
|
-
if (this.isInMainMenu && hasActiveChild) {
|
|
192
|
+
if (this.hasActiveChild()) {
|
|
183
193
|
this.status = Status.ACTIVE;
|
|
184
|
-
|
|
194
|
+
if (this.isInMainMenu)
|
|
195
|
+
this.expanded = this.isDirection(Direction.VERTICAL);
|
|
185
196
|
}
|
|
186
197
|
// manage menu items style depending to parent menu horientation
|
|
187
198
|
this.element.setAttribute(`data-style-direction-${this.direction}`, '');
|
|
@@ -190,15 +201,24 @@ export class MgMenuItem {
|
|
|
190
201
|
// manage all sub levels child menu-items level with data-level attribut
|
|
191
202
|
if (this.isDirection(Direction.VERTICAL)) {
|
|
192
203
|
Array.from(this.element.querySelectorAll('mg-menu-item')).forEach(item => {
|
|
193
|
-
|
|
194
|
-
item.setAttribute('data-level', `${itemLevel + 1}`);
|
|
204
|
+
item.dataset.level = `${(Number(item.dataset.level) || 1) + 1}`;
|
|
195
205
|
});
|
|
196
206
|
}
|
|
197
207
|
// manage first sub-level menu-items
|
|
198
208
|
const childItems = Array.from(((_a = this.element.querySelector('mg-menu')) === null || _a === void 0 ? void 0 : _a.children) || []).filter(item => item.nodeName === 'MG-MENU-ITEM');
|
|
199
209
|
childItems.forEach(item => {
|
|
210
|
+
const updateStatus = () => {
|
|
211
|
+
if (![Status.HIDDEN, Status.DISABLED].includes(this.status)) {
|
|
212
|
+
this.status = this.hasActiveChild() ? Status.ACTIVE : Status.VISIBLE;
|
|
213
|
+
}
|
|
214
|
+
};
|
|
200
215
|
// manage child menu listener
|
|
201
|
-
|
|
216
|
+
item.addEventListener('status-change', () => {
|
|
217
|
+
updateStatus();
|
|
218
|
+
});
|
|
219
|
+
new MutationObserver(mutationsList => {
|
|
220
|
+
if (mutationsList.some(mutation => mutation.attributeName === 'hidden'))
|
|
221
|
+
updateStatus();
|
|
202
222
|
this.updateDisplayNotificationBadge();
|
|
203
223
|
}).observe(item, { attributes: true });
|
|
204
224
|
});
|
|
@@ -211,7 +231,7 @@ export class MgMenuItem {
|
|
|
211
231
|
*/
|
|
212
232
|
renderInteractiveElement() {
|
|
213
233
|
const TagName = this.href !== undefined ? 'a' : 'button';
|
|
214
|
-
return (h(TagName, { href: this.href, class: this.navigationButtonClassList.join(), tabindex: [Status.DISABLED, Status.HIDDEN].includes(this.status) ? -1 : 0, disabled: this.status === Status.DISABLED, hidden: this.status === Status.HIDDEN, "aria-expanded": this.hasChildren && this.expanded.toString(), "aria-current": this.status === Status.ACTIVE && 'page', onClick: this.handleElementCLick }, h("slot", { name: "image" }), h("div", { class: `${this.navigationButton}-center` }, h("div", { class: `${this.navigationButton}-text-content` }, h("slot", { name: "label" }), !this.displayNotificationBadge && h("slot", { name: "information" }), this.displayNotificationBadge && (h("span", { class: "mg-menu-item__navigation-button-text-content-notification" }, h("mg-badge", { label: this.badgeLabel, value: "!", variant: "
|
|
234
|
+
return (h(TagName, { href: this.href, class: this.navigationButtonClassList.join(), tabindex: [Status.DISABLED, Status.HIDDEN].includes(this.status) ? -1 : 0, disabled: this.status === Status.DISABLED, hidden: this.status === Status.HIDDEN, "aria-expanded": this.hasChildren && this.expanded.toString(), "aria-current": this.status === Status.ACTIVE && 'page', onClick: this.handleElementCLick }, h("slot", { name: "image" }), h("div", { class: `${this.navigationButton}-center` }, h("div", { class: `${this.navigationButton}-text-content` }, h("slot", { name: "label" }), !this.displayNotificationBadge && h("slot", { name: "information" }), this.displayNotificationBadge && (h("span", { class: "mg-menu-item__navigation-button-text-content-notification" }, h("mg-badge", { label: this.badgeLabel, value: "!", variant: "text-color", slot: "information" })))), this.size !== 'regular' && h("slot", { name: "metadata" })), this.hasChildren && this.href === undefined && (h("span", { class: {
|
|
215
235
|
[`${this.navigationButton}-chevron`]: true,
|
|
216
236
|
[`${this.navigationButton}-chevron--rotate`]: this.expanded === true,
|
|
217
237
|
'mg-a11y-animation': true,
|
|
@@ -229,7 +249,7 @@ export class MgMenuItem {
|
|
|
229
249
|
});
|
|
230
250
|
return (h(Host, { role: "menuitem", "aria-haspopup": this.hasChildren.toString() }, this.isDirection(Direction.HORIZONTAL) && this.hasChildren && this.href === undefined ? (h("mg-popover", { display: this.expanded, placement: "bottom-start", arrowHide: true, "onDisplay-change": this.handlePopoverDisplay }, this.renderInteractiveElement(), h("div", { class: getContainerClasses(), slot: "content" }, this.renderSlot()))) : ([
|
|
231
251
|
this.renderInteractiveElement(),
|
|
232
|
-
h("div", { class: getContainerClasses(), hidden: !this.expanded }, this.renderSlot()),
|
|
252
|
+
h("div", { key: "vertical-container", class: getContainerClasses(), hidden: !this.expanded }, this.renderSlot()),
|
|
233
253
|
])));
|
|
234
254
|
}
|
|
235
255
|
static get is() { return "mg-menu-item"; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A11Y
|
|
3
|
+
*/
|
|
4
|
+
.sr-only {
|
|
5
|
+
border: 0 !important;
|
|
6
|
+
clip: rect(1px, 1px, 1px, 1px) !important;
|
|
7
|
+
-webkit-clip-path: inset(50%) !important;
|
|
8
|
+
clip-path: inset(50%) !important;
|
|
9
|
+
height: 1px !important;
|
|
10
|
+
margin: -1px !important;
|
|
11
|
+
overflow: hidden !important;
|
|
12
|
+
padding: 0 !important;
|
|
13
|
+
position: absolute !important;
|
|
14
|
+
width: 1px !important;
|
|
15
|
+
white-space: nowrap !important;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
*:focus:not(:focus-visible) {
|
|
19
|
+
outline: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@media (prefers-reduced-motion) {
|
|
23
|
+
.mg-a11y-animation {
|
|
24
|
+
animation: none !important;
|
|
25
|
+
transition: none !important;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
:host {
|
|
29
|
+
--mg-popover-padding-vertical: 1rem;
|
|
30
|
+
--mg-popover-padding-horizontal: 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.mg-action-more__chevron {
|
|
34
|
+
transition: 200ms;
|
|
35
|
+
}
|
|
36
|
+
.mg-action-more__chevron--rotate.mg-action-more__chevron {
|
|
37
|
+
transform: rotate(180deg);
|
|
38
|
+
}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { h, Host } from '@stencil/core';
|
|
2
|
+
import { initLocales } from '../../../locales';
|
|
3
|
+
import { Status } from '../menu/mg-menu-item/mg-menu-item.conf';
|
|
4
|
+
import { Direction } from '../menu/mg-menu/mg-menu.conf';
|
|
5
|
+
import { createID } from '../../../utils/components.utils';
|
|
6
|
+
/**
|
|
7
|
+
* MgActionMore['items'] type guard
|
|
8
|
+
*
|
|
9
|
+
* @param {unknown} prop commponent items prop
|
|
10
|
+
* @returns {boolean} return true if type is valid
|
|
11
|
+
*/
|
|
12
|
+
const isMgActionMoreItems = (prop) => {
|
|
13
|
+
const items = prop;
|
|
14
|
+
return typeof items === 'object' && items.every(item => typeof item === 'object' && typeof item.label === 'string' && typeof item.mouseEventHandler === 'function');
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* MgActionMore['button'] type guard
|
|
18
|
+
*
|
|
19
|
+
* @param {unknown} prop commponent button prop
|
|
20
|
+
* @returns {boolean} return true if type is valid
|
|
21
|
+
*/
|
|
22
|
+
const isMgActionMoreButton = (prop) => {
|
|
23
|
+
const button = prop;
|
|
24
|
+
return typeof button === 'object' && typeof button.variant === 'string' && typeof button.isIcon === 'boolean';
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* MgActionMore['icon'] type guard
|
|
28
|
+
*
|
|
29
|
+
* @param {unknown} prop commponent icon prop
|
|
30
|
+
* @returns {boolean} return true if type is valid
|
|
31
|
+
*/
|
|
32
|
+
const isMgActionMoreIcon = (prop) => {
|
|
33
|
+
const icon = prop;
|
|
34
|
+
return typeof icon === 'object' && typeof icon.icon === 'string';
|
|
35
|
+
};
|
|
36
|
+
export class MgActionMore {
|
|
37
|
+
constructor() {
|
|
38
|
+
/************
|
|
39
|
+
* Internal *
|
|
40
|
+
************/
|
|
41
|
+
this.name = 'mg-action-more';
|
|
42
|
+
this.mgPopoverIdentifier = createID(this.name);
|
|
43
|
+
/************
|
|
44
|
+
* Merthods *
|
|
45
|
+
***********/
|
|
46
|
+
/**
|
|
47
|
+
* Toogle expanded props
|
|
48
|
+
*
|
|
49
|
+
* @returns {void}
|
|
50
|
+
*/
|
|
51
|
+
this.toggleExpanded = () => {
|
|
52
|
+
this.expanded = !this.expanded;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Button click handler
|
|
56
|
+
*
|
|
57
|
+
* @returns {void}
|
|
58
|
+
*/
|
|
59
|
+
this.handleButton = () => {
|
|
60
|
+
this.toggleExpanded();
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Item click handler
|
|
64
|
+
*
|
|
65
|
+
* @param {MouseEvent} event click event
|
|
66
|
+
* @param {MgActionMoreItemType['mouseEventHandler']} customHandler item['mouseEventHandler']
|
|
67
|
+
* @returns {void}
|
|
68
|
+
*/
|
|
69
|
+
this.handleItemClick = (event, customHandler) => {
|
|
70
|
+
this.expanded = false;
|
|
71
|
+
customHandler(event);
|
|
72
|
+
};
|
|
73
|
+
this.icon = { icon: 'ellipsis' };
|
|
74
|
+
this.button = { variant: 'flat', isIcon: true };
|
|
75
|
+
this.items = undefined;
|
|
76
|
+
this.displayChevron = undefined;
|
|
77
|
+
this.expanded = false;
|
|
78
|
+
}
|
|
79
|
+
validateIcon(newValue) {
|
|
80
|
+
if (newValue && !isMgActionMoreIcon(newValue)) {
|
|
81
|
+
throw new Error(`<${this.name}> prop icon must match MgActionMoreIconType.`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
validateButton(newValue) {
|
|
85
|
+
if (newValue && !isMgActionMoreButton(newValue)) {
|
|
86
|
+
throw new Error(`<${this.name}> prop button must match MgActionMoreButtonType.`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
validateItems(newValue) {
|
|
90
|
+
if (!isMgActionMoreItems(newValue)) {
|
|
91
|
+
throw new Error(`<${this.name}> prop "items" is required and all values must be the same type, MgActionMoreItemType.`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
validateDisplayChevron(newValue) {
|
|
95
|
+
if (newValue && this.button.isIcon === true) {
|
|
96
|
+
throw new Error(`<${this.name}> prop "displayChevron" can't be used with a 'button" prop "isIcon" attribute.`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/*************
|
|
100
|
+
* Lifecycle *
|
|
101
|
+
*************/
|
|
102
|
+
/**
|
|
103
|
+
* Validate props
|
|
104
|
+
*
|
|
105
|
+
* @returns {void}
|
|
106
|
+
*/
|
|
107
|
+
componentWillLoad() {
|
|
108
|
+
this.messages = initLocales(this.element).messages.actionMore;
|
|
109
|
+
this.validateItems(this.items);
|
|
110
|
+
this.validateButton(this.button);
|
|
111
|
+
this.validateIcon(this.icon);
|
|
112
|
+
this.validateDisplayChevron(this.displayChevron);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Render
|
|
116
|
+
*
|
|
117
|
+
* @returns {HTMLElement} HTML Element
|
|
118
|
+
*/
|
|
119
|
+
render() {
|
|
120
|
+
const buttonLabel = this.button.label || this.messages.label;
|
|
121
|
+
const buttonContent = [buttonLabel];
|
|
122
|
+
if (!this.button.isIcon && this.displayChevron) {
|
|
123
|
+
buttonContent.push(h("span", { class: {
|
|
124
|
+
[`${this.name}__chevron`]: true,
|
|
125
|
+
[`${this.name}__chevron--rotate`]: this.expanded === true,
|
|
126
|
+
'mg-a11y-animation': true,
|
|
127
|
+
} }, h("mg-icon", { icon: "chevron-down", size: "small" })));
|
|
128
|
+
}
|
|
129
|
+
return (h(Host, { "data-mg-popover-guard": this.mgPopoverIdentifier }, h("span", { class: "mg-action-more" }, h("mg-popover", { identifier: this.mgPopoverIdentifier, display: this.expanded }, h("mg-button", { variant: this.button.variant, isIcon: this.button.isIcon, type: "button", label: buttonLabel, onClick: this.handleButton }, h("mg-icon", Object.assign({}, this.icon)), !this.button.isIcon && buttonContent), h("div", { slot: "content" }, h("mg-menu", { direction: Direction.VERTICAL, label: this.messages.label }, this.items.map(item => {
|
|
130
|
+
var _a;
|
|
131
|
+
return (
|
|
132
|
+
// eslint-disable-next-line react/jsx-no-bind
|
|
133
|
+
h("mg-menu-item", { key: item.label, status: item.status || Status.VISIBLE, onClick: e => this.handleItemClick(e, item.mouseEventHandler), href: item.href }, item.icon && h("mg-icon", { icon: item.icon, slot: "image" }), h("span", { slot: "label" }, item.label), ((_a = item.badge) === null || _a === void 0 ? void 0 : _a.label) && h("mg-badge", { label: item.badge.label, value: item.badge.value, slot: "information", variant: "text-color" })));
|
|
134
|
+
})))))));
|
|
135
|
+
}
|
|
136
|
+
static get is() { return "mg-action-more"; }
|
|
137
|
+
static get encapsulation() { return "shadow"; }
|
|
138
|
+
static get originalStyleUrls() {
|
|
139
|
+
return {
|
|
140
|
+
"$": ["mg-action-more.scss"]
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
static get styleUrls() {
|
|
144
|
+
return {
|
|
145
|
+
"$": ["mg-action-more.css"]
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
static get properties() {
|
|
149
|
+
return {
|
|
150
|
+
"icon": {
|
|
151
|
+
"type": "unknown",
|
|
152
|
+
"mutable": false,
|
|
153
|
+
"complexType": {
|
|
154
|
+
"original": "MgActionMoreIconType",
|
|
155
|
+
"resolved": "{ icon: string; }",
|
|
156
|
+
"references": {
|
|
157
|
+
"MgActionMoreIconType": {
|
|
158
|
+
"location": "import",
|
|
159
|
+
"path": "./mg-action-more.conf"
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"required": false,
|
|
164
|
+
"optional": false,
|
|
165
|
+
"docs": {
|
|
166
|
+
"tags": [],
|
|
167
|
+
"text": "Define displaied icon\nDefault: {icon: 'ellipsis'}"
|
|
168
|
+
},
|
|
169
|
+
"defaultValue": "{ icon: 'ellipsis' }"
|
|
170
|
+
},
|
|
171
|
+
"button": {
|
|
172
|
+
"type": "unknown",
|
|
173
|
+
"mutable": false,
|
|
174
|
+
"complexType": {
|
|
175
|
+
"original": "MgActionMoreButtonType",
|
|
176
|
+
"resolved": "{ isIcon: boolean; variant: \"flat\" | \"info\" | \"success\" | \"link\" | \"primary\" | \"secondary\" | \"danger\" | \"danger-alt\"; label?: string; }",
|
|
177
|
+
"references": {
|
|
178
|
+
"MgActionMoreButtonType": {
|
|
179
|
+
"location": "import",
|
|
180
|
+
"path": "./mg-action-more.conf"
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
"required": false,
|
|
185
|
+
"optional": false,
|
|
186
|
+
"docs": {
|
|
187
|
+
"tags": [],
|
|
188
|
+
"text": "Define button properties\nDefault: {variant: 'flat', isIcon: true}."
|
|
189
|
+
},
|
|
190
|
+
"defaultValue": "{ variant: 'flat', isIcon: true }"
|
|
191
|
+
},
|
|
192
|
+
"items": {
|
|
193
|
+
"type": "unknown",
|
|
194
|
+
"mutable": false,
|
|
195
|
+
"complexType": {
|
|
196
|
+
"original": "MgActionMoreItemType[]",
|
|
197
|
+
"resolved": "MgActionMoreItemType[]",
|
|
198
|
+
"references": {
|
|
199
|
+
"MgActionMoreItemType": {
|
|
200
|
+
"location": "import",
|
|
201
|
+
"path": "./mg-action-more.conf"
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
"required": true,
|
|
206
|
+
"optional": false,
|
|
207
|
+
"docs": {
|
|
208
|
+
"tags": [],
|
|
209
|
+
"text": "Define the menu-items elements"
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
"displayChevron": {
|
|
213
|
+
"type": "boolean",
|
|
214
|
+
"mutable": false,
|
|
215
|
+
"complexType": {
|
|
216
|
+
"original": "boolean",
|
|
217
|
+
"resolved": "boolean",
|
|
218
|
+
"references": {}
|
|
219
|
+
},
|
|
220
|
+
"required": false,
|
|
221
|
+
"optional": false,
|
|
222
|
+
"docs": {
|
|
223
|
+
"tags": [],
|
|
224
|
+
"text": "Define if chevron is display"
|
|
225
|
+
},
|
|
226
|
+
"attribute": "display-chevron",
|
|
227
|
+
"reflect": false
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
static get states() {
|
|
232
|
+
return {
|
|
233
|
+
"expanded": {}
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
static get elementRef() { return "element"; }
|
|
237
|
+
static get watchers() {
|
|
238
|
+
return [{
|
|
239
|
+
"propName": "icon",
|
|
240
|
+
"methodName": "validateIcon"
|
|
241
|
+
}, {
|
|
242
|
+
"propName": "button",
|
|
243
|
+
"methodName": "validateButton"
|
|
244
|
+
}, {
|
|
245
|
+
"propName": "items",
|
|
246
|
+
"methodName": "validateItems"
|
|
247
|
+
}, {
|
|
248
|
+
"propName": "displayChevron",
|
|
249
|
+
"methodName": "validateDisplayChevron"
|
|
250
|
+
}];
|
|
251
|
+
}
|
|
252
|
+
}
|
|
@@ -23,12 +23,12 @@ export class MgForm {
|
|
|
23
23
|
// All fields are required
|
|
24
24
|
// mg-input-toggle can not be required
|
|
25
25
|
if (requiredInputs.length > 0 && requiredInputs.length === this.mgInputs.filter(input => input.nodeName !== 'MG-INPUT-TOGGLE').length) {
|
|
26
|
-
this.requiredMessage = this.messages.form.allRequired;
|
|
26
|
+
this.requiredMessage = requiredInputs.length === 1 ? this.messages.form.allRequiredSingle : this.messages.form.allRequired;
|
|
27
27
|
this.classList.add(this.classAllRequired);
|
|
28
28
|
}
|
|
29
29
|
// Some fields are required
|
|
30
30
|
else if (requiredInputs.length > 0) {
|
|
31
|
-
this.requiredMessage = this.messages.form.required;
|
|
31
|
+
this.requiredMessage = requiredInputs.length === 1 ? this.messages.form.requiredSingle : this.messages.form.required;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
};
|
|
@@ -91,7 +91,7 @@ export class MgMessage {
|
|
|
91
91
|
}
|
|
92
92
|
validateVariant(newValue, oldValue) {
|
|
93
93
|
if (!variants.includes(newValue)) {
|
|
94
|
-
throw new Error(`<mg-message> prop "variant" must be one of
|
|
94
|
+
throw new Error(`<mg-message> prop "variant" must be one of: ${variants.join(', ')}`);
|
|
95
95
|
}
|
|
96
96
|
else {
|
|
97
97
|
if (oldValue !== undefined) {
|
|
@@ -59,6 +59,7 @@ export class MgPagination {
|
|
|
59
59
|
};
|
|
60
60
|
this.identifier = createID('mg-pagination');
|
|
61
61
|
this.label = undefined;
|
|
62
|
+
this.hideNavigationLabels = undefined;
|
|
62
63
|
this.totalPages = 1;
|
|
63
64
|
this.currentPage = 1;
|
|
64
65
|
}
|
|
@@ -103,7 +104,7 @@ export class MgPagination {
|
|
|
103
104
|
render() {
|
|
104
105
|
const navigationActionButton = (disabled, action) => (h("mg-button", { identifier: `${this.identifier}-button-${action}`, label: this.messages.pagination[`${action}Page`],
|
|
105
106
|
// eslint-disable-next-line react/jsx-no-bind
|
|
106
|
-
onClick: () => this.handleGoToPage(action, disabled), disabled: disabled, variant: "flat" }, action === NavigationAction.PREVIOUS && h("mg-icon", { icon: "chevron-left" }), this.messages.general[action], action === NavigationAction.NEXT && h("mg-icon", { icon: "chevron-right" })));
|
|
107
|
+
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" })));
|
|
107
108
|
return (h("nav", { "aria-label": this.label, id: this.identifier, class: "mg-pagination" }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), 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", null, "/ ", this.totalPages, " ", this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT)));
|
|
108
109
|
}
|
|
109
110
|
static get is() { return "mg-pagination"; }
|
|
@@ -155,6 +156,23 @@ export class MgPagination {
|
|
|
155
156
|
"attribute": "label",
|
|
156
157
|
"reflect": false
|
|
157
158
|
},
|
|
159
|
+
"hideNavigationLabels": {
|
|
160
|
+
"type": "boolean",
|
|
161
|
+
"mutable": false,
|
|
162
|
+
"complexType": {
|
|
163
|
+
"original": "boolean",
|
|
164
|
+
"resolved": "boolean",
|
|
165
|
+
"references": {}
|
|
166
|
+
},
|
|
167
|
+
"required": false,
|
|
168
|
+
"optional": false,
|
|
169
|
+
"docs": {
|
|
170
|
+
"tags": [],
|
|
171
|
+
"text": "Hide navigation label"
|
|
172
|
+
},
|
|
173
|
+
"attribute": "hide-navigation-labels",
|
|
174
|
+
"reflect": false
|
|
175
|
+
},
|
|
158
176
|
"totalPages": {
|
|
159
177
|
"type": "number",
|
|
160
178
|
"mutable": false,
|