@mgdis/mg-components 5.1.0 → 5.2.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.
Files changed (67) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/mg-badge_27.cjs.entry.js +354 -236
  3. package/dist/cjs/mg-components.cjs.js +1 -1
  4. package/dist/collection/components/atoms/mg-badge/mg-badge.js +1 -1
  5. package/dist/collection/components/atoms/mg-button/mg-button.js +3 -3
  6. package/dist/collection/components/atoms/mg-tag/mg-tag.js +1 -1
  7. package/dist/collection/components/molecules/inputs/MgInput.js +3 -11
  8. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +41 -20
  9. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +50 -39
  10. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +25 -6
  11. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +42 -33
  12. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +25 -6
  13. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +36 -17
  14. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +35 -14
  15. package/dist/collection/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.js +2 -3
  16. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +28 -6
  17. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +36 -17
  18. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +25 -6
  19. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +38 -19
  20. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +25 -6
  21. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +37 -18
  22. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +1 -1
  23. package/dist/collection/components/molecules/mg-form/mg-form.js +73 -27
  24. package/dist/collection/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.js +6 -6
  25. package/dist/collection/components/molecules/mg-message/mg-message.js +1 -1
  26. package/dist/collection/components/molecules/mg-modal/mg-modal.js +0 -4
  27. package/dist/collection/utils/unit.test.utils.js +51 -0
  28. package/dist/collection/variables.css +6 -6
  29. package/dist/components/MgInput.js +4 -12
  30. package/dist/components/mg-badge2.js +1 -1
  31. package/dist/components/mg-button2.js +3 -3
  32. package/dist/components/mg-form.js +67 -26
  33. package/dist/components/mg-input-checkbox.js +36 -21
  34. package/dist/components/mg-input-date.js +44 -39
  35. package/dist/components/mg-input-numeric.js +37 -34
  36. package/dist/components/mg-input-password.js +32 -19
  37. package/dist/components/mg-input-radio.js +30 -15
  38. package/dist/components/mg-input-select2.js +32 -19
  39. package/dist/components/mg-input-text2.js +34 -21
  40. package/dist/components/mg-input-textarea.js +32 -19
  41. package/dist/components/mg-input-toggle.js +1 -1
  42. package/dist/components/mg-message.js +1 -1
  43. package/dist/components/mg-modal.js +0 -4
  44. package/dist/components/mg-tag.js +1 -1
  45. package/dist/esm/loader.js +1 -1
  46. package/dist/esm/mg-badge_27.entry.js +354 -236
  47. package/dist/esm/mg-components.js +1 -1
  48. package/dist/mg-components/mg-components.css +1 -1
  49. package/dist/mg-components/mg-components.esm.js +1 -1
  50. package/dist/mg-components/p-b2b07c3f.entry.js +1 -0
  51. package/dist/mg-components/variables.css +6 -6
  52. package/dist/types/components/atoms/mg-button/mg-button.d.ts +2 -2
  53. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +10 -8
  54. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +3 -8
  55. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +3 -8
  56. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +4 -3
  57. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +4 -2
  58. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +4 -3
  59. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +5 -4
  60. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -3
  61. package/dist/types/components/molecules/mg-form/mg-form.d.ts +21 -1
  62. package/dist/types/components/molecules/mg-message/mg-message.d.ts +3 -0
  63. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +3 -0
  64. package/package.json +7 -8
  65. package/dist/collection/utils/test.utils.js +0 -38
  66. package/dist/mg-components/p-e131701a.entry.js +0 -1
  67. package/dist/types/utils/test.utils.d.ts +0 -17
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["mg-badge_27.cjs",[[1,"mg-panel",{"identifier":[1],"panelTitle":[1025,"panel-title"],"titlePattern":[1025,"title-pattern"],"titlePatternErrorMessage":[1025,"title-pattern-error-message"],"expanded":[1028],"expandToggleDisabled":[1028,"expand-toggle-disabled"],"titleEditable":[4,"title-editable"],"classList":[32],"isEditing":[32],"updatedPanelTitle":[32]}],[1,"mg-pagination",{"identifier":[1],"label":[1025],"totalPages":[2,"total-pages"],"currentPage":[1538,"current-page"]}],[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],"classList":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-checkbox",{"value":[1040],"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],"classList":[32],"errorMessage":[32],"checkboxItems":[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],"classList":[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],"classList":[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],"classList":[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],"classList":[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"],"classList":[32],"options":[32],"checked":[32]}],[1,"mg-message",{"identifier":[1],"delay":[2],"variant":[1],"closeButton":[1028,"close-button"],"hide":[1028],"classList":[32],"hasActions":[32]}],[1,"mg-modal",{"identifier":[1],"modalTitle":[1,"modal-title"],"closeButton":[1028,"close-button"],"hide":[1028],"hasActions":[32],"hasContent":[32],"classList":[32]},[[8,"keydown","handleKeyDown"]]],[1,"mg-popover",{"identifier":[1],"placement":[1],"closeButton":[4,"close-button"],"display":[1028],"disabled":[1028]}],[1,"mg-tabs",{"identifier":[1],"label":[1],"size":[1],"items":[16],"activeTab":[1538,"active-tab"],"tabs":[32],"classList":[32]}],[1,"mg-details",{"toggleClosed":[1,"toggle-closed"],"toggleOpened":[1,"toggle-opened"],"hideSummary":[4,"hide-summary"],"expanded":[1028]}],[1,"mg-card"],[1,"mg-divider",{"size":[1]}],[1,"mg-form",{"identifier":[1],"name":[1],"readonly":[4],"disabled":[4],"valid":[1028],"invalid":[1028],"classList":[32],"displayError":[64]}],[1,"mg-illustrated-message",{"size":[1],"direction":[1]}],[1,"mg-tag",{"variant":[1],"outline":[4],"classList":[32]}],[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],"classList":[32],"errorMessage":[32],"setFocus":[64],"displayError":[64]}],[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":[8,"mg-width"],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"options":[32],"valueExist":[32],"readonlyValue":[32],"displayError":[64]}],[1,"mg-badge",{"value":[1032],"label":[1],"variant":[1],"outline":[4],"classList":[32]}],[2,"mg-character-left",{"identifier":[1],"characters":[1],"maxlength":[2]}],[1,"mg-button",{"variant":[1],"identifier":[1],"label":[1],"type":[1],"fullWidth":[1028,"full-width"],"form":[1025],"disabled":[1028],"isIcon":[4,"is-icon"],"disableOnClick":[4,"disable-on-click"],"loading":[32],"classList":[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":[1028]}],[1,"mg-icon",{"icon":[1],"size":[1],"variant":[1],"spin":[4],"classList":[32]}]]]], options);
18
+ return index.bootstrapLazy([["mg-badge_27.cjs",[[1,"mg-panel",{"identifier":[1],"panelTitle":[1025,"panel-title"],"titlePattern":[1025,"title-pattern"],"titlePatternErrorMessage":[1025,"title-pattern-error-message"],"expanded":[1028],"expandToggleDisabled":[1028,"expand-toggle-disabled"],"titleEditable":[4,"title-editable"],"classList":[32],"isEditing":[32],"updatedPanelTitle":[32]}],[1,"mg-pagination",{"identifier":[1],"label":[1025],"totalPages":[2,"total-pages"],"currentPage":[1538,"current-page"]}],[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],"classList":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-checkbox",{"value":[1040],"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],"classList":[32],"errorMessage":[32],"checkboxItems":[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],"classList":[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],"classList":[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],"classList":[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],"classList":[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"],"classList":[32],"options":[32],"checked":[32]}],[1,"mg-message",{"identifier":[1],"delay":[2],"variant":[1],"closeButton":[1028,"close-button"],"hide":[1028],"classList":[32],"hasActions":[32]}],[1,"mg-modal",{"identifier":[1],"modalTitle":[1,"modal-title"],"closeButton":[1028,"close-button"],"hide":[1028],"hasActions":[32],"hasContent":[32],"classList":[32]},[[8,"keydown","handleKeyDown"]]],[1,"mg-popover",{"identifier":[1],"placement":[1],"closeButton":[4,"close-button"],"display":[1028],"disabled":[1028]}],[1,"mg-tabs",{"identifier":[1],"label":[1],"size":[1],"items":[16],"activeTab":[1538,"active-tab"],"tabs":[32],"classList":[32]}],[1,"mg-details",{"toggleClosed":[1,"toggle-closed"],"toggleOpened":[1,"toggle-opened"],"hideSummary":[4,"hide-summary"],"expanded":[1028]}],[1,"mg-card"],[1,"mg-divider",{"size":[1]}],[1,"mg-form",{"identifier":[1],"name":[1],"readonly":[4],"disabled":[4],"valid":[1028],"invalid":[1028],"classList":[32],"requiredMessage":[32],"displayError":[64]}],[1,"mg-illustrated-message",{"size":[1],"direction":[1]}],[1,"mg-tag",{"variant":[1],"outline":[4],"classList":[32]}],[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],"classList":[32],"errorMessage":[32],"setFocus":[64],"displayError":[64]}],[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":[8,"mg-width"],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"options":[32],"valueExist":[32],"readonlyValue":[32],"displayError":[64]}],[1,"mg-badge",{"value":[1032],"label":[1],"variant":[1],"outline":[4],"classList":[32]}],[2,"mg-character-left",{"identifier":[1],"characters":[1],"maxlength":[2]}],[1,"mg-button",{"variant":[1],"identifier":[1],"label":[1],"type":[1],"fullWidth":[1028,"full-width"],"form":[1025],"disabled":[1028],"isIcon":[4,"is-icon"],"disableOnClick":[4,"disable-on-click"],"loading":[32],"classList":[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":[1028]}],[1,"mg-icon",{"icon":[1],"size":[1],"variant":[1],"spin":[4],"classList":[32]}]]]], options);
19
19
  });
@@ -6,7 +6,7 @@ export class MgBadge {
6
6
  /************
7
7
  * Internal *
8
8
  ************/
9
- // classes
9
+ // Classes
10
10
  this.classOutline = `mg-badge--outline`;
11
11
  /**
12
12
  * Define button variant
@@ -54,7 +54,7 @@ export class MgButton {
54
54
  }
55
55
  };
56
56
  /**
57
- * Handle onKeyDown event
57
+ * Handle onKeydown event
58
58
  *
59
59
  * @param {KeyboardEvent} event keyboard event
60
60
  * @returns {void}
@@ -69,7 +69,7 @@ export class MgButton {
69
69
  }
70
70
  };
71
71
  /**
72
- * Handle onKeyUp event
72
+ * Handle onKeyup event
73
73
  *
74
74
  * @param {KeyboardEvent} event keyboard event
75
75
  * @returns {void}
@@ -152,7 +152,7 @@ export class MgButton {
152
152
  * @returns {HTMLElement} html element
153
153
  */
154
154
  render() {
155
- return (h(Host, { role: "button", tabIndex: this.disabled ? -1 : 0, type: this.type, form: this.form, "full-width": this.fullWidth, "aria-label": this.label, "aria-disabled": this.disabled !== undefined && this.disabled.toString(), onClick: this.handleClick, onKeyUp: this.handleKeyup, onKeyDown: this.handleKeydown }, h("div", { class: this.classList.join(), id: this.identifier }, this.loading && h("mg-icon", { icon: "loader", spin: true }), h("div", { class: "mg-button__content" }, h("slot", null)))));
155
+ return (h(Host, { role: "button", tabIndex: this.disabled ? -1 : 0, type: this.type, form: this.form, "full-width": this.fullWidth, "aria-label": this.label, "aria-disabled": this.disabled !== undefined && this.disabled.toString(), onClick: this.handleClick, onKeyup: this.handleKeyup, onKeydown: this.handleKeydown }, h("div", { class: this.classList.join(), id: this.identifier }, this.loading && h("mg-icon", { icon: "loader", spin: true }), h("div", { class: "mg-button__content" }, h("slot", null)))));
156
156
  }
157
157
  static get is() { return "mg-button"; }
158
158
  static get encapsulation() { return "shadow"; }
@@ -6,7 +6,7 @@ export class MgTag {
6
6
  /************
7
7
  * Internal *
8
8
  ************/
9
- // classes
9
+ // Classes
10
10
  this.classOutline = `mg-tag--outline`;
11
11
  /**************
12
12
  * Decorators *
@@ -76,15 +76,6 @@ export const MgInput = (props, children, utils) => {
76
76
  if (typeof props.errorMessage === 'string' && props.errorMessage !== '') {
77
77
  ariaDescribedbyIDs.add(helpTextErrorId);
78
78
  }
79
- /**
80
- * Update input(s) in children
81
- */
82
- if (props.readonly) {
83
- children = children.filter(child => child.$name$ === 'append-input');
84
- }
85
- else {
86
- children = applyAriadescribedBy(children, ariaDescribedbyIDs, utils);
87
- }
88
79
  /**
89
80
  * Return template
90
81
  *
@@ -109,9 +100,10 @@ export const MgInput = (props, children, utils) => {
109
100
  const getTooltip = () => (h("mg-tooltip", { identifier: `${props.identifier}-tooltip`, message: props.tooltip }, h("mg-icon", { icon: "info-circle" })));
110
101
  /**
111
102
  * Get input title (label) node
103
+ * Display asterisk only if not disabled and not readonly
112
104
  *
113
105
  * @returns {VNode[]} mg-input-title
114
106
  */
115
- const getInputTitle = () => (h("mg-input-title", { identifier: props.identifier, class: props.labelHide ? 'sr-only' : undefined, required: props.required && !props.disabled, "is-legend": props.isFieldset }, props.label));
116
- return (h(TagName, { class: props.classList.join() }, props.labelOnTop ? (h("div", { class: "mg-input__title" }, getInputTitle(), !props.readonly && props.tooltip && getTooltip())) : (getInputTitle()), props.readonly ? (h("div", { class: "mg-input__input-container" }, h("strong", null, props.readonlyValue || props.value), children)) : (h("div", { class: "mg-input__input-container" }, h("div", { class: { 'mg-input__input': true, 'mg-input__input--has-error': props.errorMessage !== undefined } }, children, !props.labelOnTop && props.tooltip && getTooltip()), props.helpText && h("div", { id: helpTextId, class: "mg-input__help-text", innerHTML: props.helpText }), props.errorMessage && !props.readonly && !props.disabled && (h("div", { id: helpTextErrorId, class: "mg-input__error", innerHTML: props.errorMessage, "aria-live": "assertive" }))))));
107
+ const getInputTitle = () => (h("mg-input-title", { identifier: props.identifier, class: props.labelHide ? 'sr-only' : undefined, required: props.required && !props.disabled && !props.readonly, "is-legend": props.isFieldset }, props.label));
108
+ return (h(TagName, { class: props.classList.join() }, props.labelOnTop ? (h("div", { class: "mg-input__title" }, getInputTitle(), !props.readonly && props.tooltip && getTooltip())) : (getInputTitle()), props.readonly ? (h("div", { class: "mg-input__input-container" }, h("strong", null, props.readonlyValue || props.value), children.filter(child => child.$name$ === 'append-input'))) : (h("div", { class: "mg-input__input-container" }, h("div", { class: { 'mg-input__input': true, 'mg-input__input--has-error': props.errorMessage !== undefined } }, applyAriadescribedBy(children, ariaDescribedbyIDs, utils), !props.labelOnTop && props.tooltip && getTooltip()), props.helpText && h("div", { id: helpTextId, class: "mg-input__help-text", innerHTML: props.helpText }), props.errorMessage && !props.readonly && !props.disabled && (h("div", { id: helpTextErrorId, class: "mg-input__error", innerHTML: props.errorMessage, "aria-live": "assertive" }))))));
117
109
  };
@@ -16,6 +16,8 @@ export class MgInputCheckbox {
16
16
  ************/
17
17
  // HTML selector
18
18
  this.inputs = [];
19
+ // hasDisplayedError (triggered by blur event)
20
+ this.hasDisplayedError = false;
19
21
  /**
20
22
  * Input name
21
23
  * If not set the value equals the identifier
@@ -70,25 +72,27 @@ export class MgInputCheckbox {
70
72
  this.handleBlur = () => {
71
73
  // Check validity
72
74
  this.checkValidity();
73
- this.checkError();
75
+ this.setErrorMessage();
74
76
  };
77
+ /**
78
+ * get invalid element
79
+ *
80
+ * @returns {HTMLInputElement} element
81
+ */
82
+ this.getInvalidElement = () => this.inputs.find((input) => input !== null && !input.disabled && !input.checkValidity());
75
83
  /**
76
84
  * Check if input is valid
77
85
  */
78
86
  this.checkValidity = () => {
79
- if (!this.readonly) {
80
- const validity = this.getInvalidElement() === undefined;
81
- // Set validity
82
- this.valid = validity;
83
- this.invalid = !validity;
84
- //Send event
85
- this.inputValid.emit(validity);
86
- }
87
+ this.valid = this.readonly || this.disabled || this.getInvalidElement() === undefined;
88
+ this.invalid = !this.valid;
89
+ // We need to send valid event even if it is the same value
90
+ this.inputValid.emit(this.valid);
87
91
  };
88
92
  /**
89
- * Check input errors
93
+ * Set input error message
90
94
  */
91
- this.checkError = () => {
95
+ this.setErrorMessage = () => {
92
96
  const invalidElement = this.getInvalidElement();
93
97
  // Set error message
94
98
  this.errorMessage = undefined;
@@ -96,12 +100,6 @@ export class MgInputCheckbox {
96
100
  this.errorMessage = this.messages.errors.required;
97
101
  }
98
102
  };
99
- /**
100
- * get invalid element
101
- *
102
- * @returns {HTMLInputElement} element
103
- */
104
- this.getInvalidElement = () => this.inputs.find((element) => !element.disabled && !element.checkValidity());
105
103
  }
106
104
  validateValue(newValue) {
107
105
  if (newValue && newValue.every(item => isCheckboxItem(item))) {
@@ -117,6 +115,16 @@ export class MgInputCheckbox {
117
115
  throw new Error('<mg-input-checkbox> prop "value" is required and all values must be the same type, CheckboxItem.');
118
116
  }
119
117
  }
118
+ handleValidityChange(newValue, _oldValue, prop) {
119
+ this.inputs.forEach(input => {
120
+ input[prop] = newValue;
121
+ });
122
+ this.checkValidity();
123
+ if (this.hasDisplayedError) {
124
+ this.setErrorMessage();
125
+ this.hasDisplayedError = false;
126
+ }
127
+ }
120
128
  /**
121
129
  * Public method to display errors
122
130
  *
@@ -124,7 +132,8 @@ export class MgInputCheckbox {
124
132
  */
125
133
  async displayError() {
126
134
  this.checkValidity();
127
- this.checkError();
135
+ this.setErrorMessage();
136
+ this.hasDisplayedError = this.invalid;
128
137
  }
129
138
  /*************
130
139
  * Lifecycle *
@@ -152,11 +161,14 @@ export class MgInputCheckbox {
152
161
  * @returns {HTMLElement} HTML Element
153
162
  */
154
163
  render() {
155
- return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: undefined, mgWidth: undefined, disabled: this.disabled, value: this.value && this.value.toString(), readonlyValue: undefined, tooltip: !this.readonly && 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.checkboxItems
164
+ return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: !this.readonly ? this.required : undefined, readonly: undefined, mgWidth: undefined, disabled: this.disabled, value: this.value && this.value.toString(), readonlyValue: undefined, tooltip: !this.readonly ? this.tooltip : undefined, helpText: !this.readonly ? this.helpText : undefined, errorMessage: !this.readonly ? this.errorMessage : undefined, isFieldset: true }, h("ul", { class: { 'mg-input__input-group-container': true, 'mg-input__input-group-container--vertical': this.inputVerticalList } }, this.checkboxItems
156
165
  .filter(item => {
157
166
  return !this.readonly || item.value;
158
167
  })
159
- .map(input => (h("li", { class: { 'mg-input__input-group': true, 'mg-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "checkbox", id: input.id, name: this.identifier, value: input.value && input.value.toString(), checked: Boolean(input.value), disabled: this.readonly || this.disabled || input.disabled, required: this.required, indeterminate: input.value === null, onInput: this.handleInput, onBlur: this.handleBlur, ref: el => this.inputs.push(el) }), h("label", { htmlFor: input.id }, input.title)))))));
168
+ .map((input, index) => (h("li", { class: { 'mg-input__input-group': true, 'mg-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "checkbox", id: input.id, name: this.identifier, value: input.value && input.value.toString(), checked: Boolean(input.value), disabled: this.readonly || this.disabled || input.disabled, required: this.required, indeterminate: input.value === null, onInput: this.handleInput, onBlur: this.handleBlur, ref: el => {
169
+ if (el !== null)
170
+ this.inputs[index] = el;
171
+ } }), h("label", { htmlFor: input.id }, input.title)))))));
160
172
  }
161
173
  static get is() { return "mg-input-checkbox"; }
162
174
  static get encapsulation() { return "shadow"; }
@@ -494,6 +506,15 @@ export class MgInputCheckbox {
494
506
  return [{
495
507
  "propName": "value",
496
508
  "methodName": "validateValue"
509
+ }, {
510
+ "propName": "required",
511
+ "methodName": "handleValidityChange"
512
+ }, {
513
+ "propName": "readonly",
514
+ "methodName": "handleValidityChange"
515
+ }, {
516
+ "propName": "disabled",
517
+ "methodName": "handleValidityChange"
497
518
  }];
498
519
  }
499
520
  }
@@ -6,8 +6,8 @@ import { localeDate, dateRegExp } from '../../../../utils/locale.utils';
6
6
  import { initLocales } from '../../../../locales';
7
7
  export class MgInputDate {
8
8
  constructor() {
9
- // hasError (triggered by blur event)
10
- this.hasError = false;
9
+ // hasDisplayedError (triggered by blur event)
10
+ this.hasDisplayedError = false;
11
11
  /**
12
12
  * Input name
13
13
  * If not set the value equals the identifier
@@ -38,8 +38,8 @@ export class MgInputDate {
38
38
  */
39
39
  this.handleInput = () => {
40
40
  this.checkValidity();
41
- if (this.hasError) {
42
- this.checkError();
41
+ if (this.hasDisplayedError) {
42
+ this.setErrorMessage();
43
43
  }
44
44
  this.value = this.input.value;
45
45
  };
@@ -53,14 +53,11 @@ export class MgInputDate {
53
53
  * Check if input is valid
54
54
  */
55
55
  this.checkValidity = () => {
56
- if (!this.readonly && this.input !== undefined) {
57
- const validity = this.input.checkValidity();
58
- // Set validity
59
- this.valid = validity;
60
- this.invalid = !validity;
61
- //Send event
62
- this.inputValid.emit(validity);
63
- }
56
+ var _a;
57
+ this.valid = this.readonly || this.disabled || (((_a = this.input) === null || _a === void 0 ? void 0 : _a.checkValidity) !== undefined ? this.input.checkValidity() : true);
58
+ this.invalid = !this.valid;
59
+ // We need to send valid event even if it is the same value
60
+ this.inputValid.emit(this.valid);
64
61
  };
65
62
  /**
66
63
  * get input error code
@@ -89,48 +86,50 @@ export class MgInputDate {
89
86
  return inputError;
90
87
  };
91
88
  /**
92
- * Set error message
89
+ * Check input errors
93
90
  *
94
91
  * @returns {void}
95
92
  */
96
93
  this.setErrorMessage = () => {
97
94
  var _a;
98
- const inputError = this.getInputError();
99
- // required
100
- if (inputError === InputError.REQUIRED) {
101
- this.errorMessage = this.messages.errors[inputError];
102
- }
103
- // min, max & minMax
104
- else if ([InputError.MIN, InputError.MAX, InputError.MINMAX].includes(inputError)) {
105
- this.errorMessage = this.messages.errors.date[inputError].replace('{min}', localeDate(this.min, this.locale)).replace('{max}', localeDate(this.max, this.locale));
106
- }
107
- // wrong date format
108
- // element.validity.badInput is default error message
109
- else {
110
- this.errorMessage = this.messages.errors.date.badInput.replace('{min}', ((_a = this.min) === null || _a === void 0 ? void 0 : _a.length) > 0 ? localeDate(this.min, this.locale) : localeDate('1900-01-01', this.locale));
111
- }
112
- };
113
- /**
114
- * Check input errors
115
- *
116
- * @returns {void}
117
- */
118
- this.checkError = () => {
119
95
  // Set error message
120
96
  this.errorMessage = undefined;
121
97
  if (!this.valid) {
122
- this.setErrorMessage();
98
+ const inputError = this.getInputError();
99
+ // required
100
+ if (inputError === InputError.REQUIRED) {
101
+ this.errorMessage = this.messages.errors[inputError];
102
+ }
103
+ // min, max & minMax
104
+ else if ([InputError.MIN, InputError.MAX, InputError.MINMAX].includes(inputError)) {
105
+ this.errorMessage = this.messages.errors.date[inputError].replace('{min}', localeDate(this.min, this.locale)).replace('{max}', localeDate(this.max, this.locale));
106
+ }
107
+ // wrong date format
108
+ // element.validity.badInput is default error message
109
+ else {
110
+ this.errorMessage = this.messages.errors.date.badInput.replace('{min}', ((_a = this.min) === null || _a === void 0 ? void 0 : _a.length) > 0 ? localeDate(this.min, this.locale) : localeDate('1900-01-01', this.locale));
111
+ }
123
112
  }
124
113
  };
125
114
  }
126
115
  validateValue(newValue) {
127
- if (newValue !== undefined && (typeof newValue !== 'string' || !dateRegExp.test(newValue))) {
116
+ if (newValue !== undefined && newValue !== null && (typeof newValue !== 'string' || !dateRegExp.test(newValue))) {
128
117
  throw new Error("<mg-input-date> props 'value' doesn't match pattern: yyyy-mm-dd");
129
118
  }
130
119
  else {
131
120
  this.valueChange.emit(this.value);
132
121
  }
133
122
  }
123
+ handleValidityChange(newValue, _oldValue, prop) {
124
+ if (this.input !== undefined) {
125
+ this.input[prop] = newValue;
126
+ this.checkValidity();
127
+ if (this.hasDisplayedError) {
128
+ this.setErrorMessage();
129
+ this.hasDisplayedError = false;
130
+ }
131
+ }
132
+ }
134
133
  validateMinMax(newValue) {
135
134
  if ((newValue === null || newValue === void 0 ? void 0 : newValue.length) === 0 || ((newValue === null || newValue === void 0 ? void 0 : newValue.length) > 0 && !(typeof newValue === 'string' && dateRegExp.test(newValue)))) {
136
135
  throw new Error("<mg-input-date> props 'min/max' doesn't match pattern: yyyy-mm-dd");
@@ -143,8 +142,8 @@ export class MgInputDate {
143
142
  */
144
143
  async displayError() {
145
144
  this.checkValidity();
146
- this.checkError();
147
- this.hasError = this.invalid;
145
+ this.setErrorMessage();
146
+ this.hasDisplayedError = this.invalid;
148
147
  }
149
148
  /*************
150
149
  * Lifecycle *
@@ -176,7 +175,10 @@ export class MgInputDate {
176
175
  * @returns {HTMLElement} HTML Element
177
176
  */
178
177
  render() {
179
- return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: undefined, disabled: this.disabled, value: this.value, readonlyValue: localeDate(this.value, this.locale), tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("input", { type: "date", class: "mg-input__box", min: this.min, max: this.max, value: this.value, id: this.identifier, name: this.name, disabled: this.disabled, required: this.required, onInput: this.handleInput, onBlur: this.handleBlur, pattern: "[0-9]{4}-[0-9]{2}-[0-9]{2}", ref: el => (this.input = el) })));
178
+ return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: undefined, disabled: this.disabled, value: this.value, readonlyValue: localeDate(this.value, this.locale), tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("input", { type: "date", class: "mg-input__box", min: this.min, max: this.max, value: this.value, id: this.identifier, name: this.name, disabled: this.disabled, required: this.required, onInput: this.handleInput, onBlur: this.handleBlur, pattern: "[0-9]{4}-[0-9]{2}-[0-9]{2}", ref: el => {
179
+ if (el !== null)
180
+ this.input = el;
181
+ } })));
180
182
  }
181
183
  static get is() { return "mg-input-date"; }
182
184
  static get encapsulation() { return "shadow"; }
@@ -521,6 +523,15 @@ export class MgInputDate {
521
523
  return [{
522
524
  "propName": "value",
523
525
  "methodName": "validateValue"
526
+ }, {
527
+ "propName": "required",
528
+ "methodName": "handleValidityChange"
529
+ }, {
530
+ "propName": "readonly",
531
+ "methodName": "handleValidityChange"
532
+ }, {
533
+ "propName": "disabled",
534
+ "methodName": "handleValidityChange"
524
535
  }, {
525
536
  "propName": "min",
526
537
  "methodName": "validateMinMax"
@@ -185,21 +185,40 @@
185
185
  .mg-input.mg-input--width-full:not(.mg-input--label-on-top) {
186
186
  justify-content: space-between;
187
187
  }
188
+ .mg-input.mg-input--width-full.mg-input--label-on-top .mg-input__box {
189
+ width: 100%;
190
+ }
188
191
  .mg-input.mg-input--width-full .mg-input__input-container {
189
192
  flex: auto;
190
193
  width: 100%;
191
194
  }
192
195
  .mg-input.mg-input--width-full .mg-input__input-container .mg-input__box {
196
+ max-width: 100%;
197
+ }
198
+ .mg-input:not(.mg-input--label-on-top) .mg-input__box {
199
+ width: 100%;
200
+ max-width: calc(17.7rem + var(--mg-inputs-spacer) * 2);
201
+ min-width: 5rem;
202
+ }
203
+ .mg-input.mg-input--width-16 .mg-input__input-container {
204
+ width: 100%;
205
+ }
206
+ .mg-input.mg-input--width-16 .mg-input__input-container .mg-input__input {
207
+ width: 100%;
208
+ max-width: 21rem;
209
+ }
210
+ .mg-input.mg-input--width-16 .mg-input__input-container .mg-input__with-character-left {
193
211
  width: 100%;
194
212
  }
195
- .mg-input.mg-input--width-16 .mg-input__box {
196
- width: 21rem;
213
+ .mg-input.mg-input--width-16 .mg-input__input-container .mg-input__box {
214
+ max-width: 21rem;
215
+ min-width: 100%;
197
216
  }
198
- .mg-input.mg-input--width-4 .mg-input__box {
199
- width: 7rem;
217
+ .mg-input.mg-input--width-4 .mg-input__input-container .mg-input__box {
218
+ max-width: 7rem;
200
219
  }
201
- .mg-input.mg-input--width-2 .mg-input__box {
202
- width: 5rem;
220
+ .mg-input.mg-input--width-2 .mg-input__input-container .mg-input__box {
221
+ max-width: 5rem;
203
222
  }
204
223
 
205
224
  /**
@@ -6,8 +6,8 @@ import { initLocales } from '../../../../locales/';
6
6
  import { localeCurrency, localeNumber } from '../../../../utils/locale.utils';
7
7
  export class MgInputNumeric {
8
8
  constructor() {
9
- // hasError (triggered by blur event)
10
- this.hasError = false;
9
+ // hasDisplayedError (triggered by blur event)
10
+ this.hasDisplayedError = false;
11
11
  /**
12
12
  * Input name
13
13
  * If not set the value equals the identifier
@@ -63,8 +63,8 @@ export class MgInputNumeric {
63
63
  this.handleInput = () => {
64
64
  // Check validity
65
65
  this.checkValidity();
66
- if (this.hasError) {
67
- this.checkError();
66
+ if (this.hasDisplayedError) {
67
+ this.setErrorMessage();
68
68
  }
69
69
  this.value = this.input.value;
70
70
  };
@@ -92,40 +92,27 @@ export class MgInputNumeric {
92
92
  * @returns {void}
93
93
  */
94
94
  this.checkValidity = () => {
95
- if (!this.readonly) {
96
- const validity = this.getInputError() === null;
97
- // Set validity
98
- this.valid = validity;
99
- this.invalid = !validity;
100
- //Send event
101
- this.inputValid.emit(validity);
102
- }
95
+ this.valid = this.readonly || this.disabled || this.getInputError() === null;
96
+ this.invalid = !this.valid;
97
+ // We need to send valid event even if it is the same value
98
+ this.inputValid.emit(this.valid);
103
99
  };
104
100
  /**
105
- * Set error message
101
+ * Set input error message
106
102
  *
107
103
  * @returns {void}
108
104
  */
109
105
  this.setErrorMessage = () => {
110
- const inputError = this.getInputError();
111
- if (inputError === InputError.REQUIRED) {
112
- this.errorMessage = this.messages.errors[inputError];
113
- }
114
- else {
115
- this.errorMessage = this.messages.errors.numeric[inputError].replace('{min}', `${this.formatValue(this.min)}`).replace('{max}', `${this.formatValue(this.max)}`);
116
- }
117
- };
118
- /**
119
- * Check input errors
120
- *
121
- * @returns {void}
122
- */
123
- this.checkError = () => {
124
106
  // Set error message
125
107
  this.errorMessage = undefined;
126
- // Update class
127
108
  if (!this.valid) {
128
- this.setErrorMessage();
109
+ const inputError = this.getInputError();
110
+ if (inputError === InputError.REQUIRED) {
111
+ this.errorMessage = this.messages.errors[inputError];
112
+ }
113
+ else {
114
+ this.errorMessage = this.messages.errors.numeric[inputError].replace('{min}', `${this.formatValue(this.min)}`).replace('{max}', `${this.formatValue(this.max)}`);
115
+ }
129
116
  }
130
117
  };
131
118
  /**
@@ -135,7 +122,7 @@ export class MgInputNumeric {
135
122
  */
136
123
  this.getInputError = () => {
137
124
  let inputError = null;
138
- if (this.input === undefined)
125
+ if (this.input === undefined || this.input === null)
139
126
  return inputError;
140
127
  // required
141
128
  if (!this.input.checkValidity() && this.input.validity.valueMissing) {
@@ -202,6 +189,16 @@ export class MgInputNumeric {
202
189
  this.readonlyValue = this.numericValue !== null ? this.formatValue(this.numericValue) : '';
203
190
  }
204
191
  }
192
+ handleValidityChange(newValue, _oldValue, prop) {
193
+ if (this.input !== undefined) {
194
+ this.input[prop] = newValue;
195
+ this.checkValidity();
196
+ if (this.hasDisplayedError) {
197
+ this.setErrorMessage();
198
+ this.hasDisplayedError = false;
199
+ }
200
+ }
201
+ }
205
202
  validateType(newValue) {
206
203
  if (!types.includes(newValue)) {
207
204
  throw new Error(`<mg-input-numeric> prop "type" must be one of : ${types.join(', ')}`);
@@ -224,8 +221,8 @@ export class MgInputNumeric {
224
221
  */
225
222
  async displayError() {
226
223
  this.checkValidity();
227
- this.checkError();
228
- this.hasError = this.invalid;
224
+ this.setErrorMessage();
225
+ this.hasDisplayedError = this.invalid;
229
226
  }
230
227
  /**
231
228
  * Displayed value in input
@@ -268,7 +265,10 @@ export class MgInputNumeric {
268
265
  * @returns {HTMLElement} HTML Element
269
266
  */
270
267
  render() {
271
- return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: this.value, readonlyValue: this.readonlyValue, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("input", { type: "text", class: "mg-input__box", value: this.displayValue(), id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: el => (this.input = el) }), h("slot", { name: "append-input" })));
268
+ return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: this.value, readonlyValue: this.readonlyValue, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("input", { type: "text", class: "mg-input__box", value: this.displayValue(), id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: el => {
269
+ if (el !== null)
270
+ this.input = el;
271
+ } }), h("slot", { name: "append-input" })));
272
272
  }
273
273
  static get is() { return "mg-input-numeric"; }
274
274
  static get encapsulation() { return "shadow"; }
@@ -725,6 +725,15 @@ export class MgInputNumeric {
725
725
  return [{
726
726
  "propName": "value",
727
727
  "methodName": "validateValue"
728
+ }, {
729
+ "propName": "required",
730
+ "methodName": "handleValidityChange"
731
+ }, {
732
+ "propName": "readonly",
733
+ "methodName": "handleValidityChange"
734
+ }, {
735
+ "propName": "disabled",
736
+ "methodName": "handleValidityChange"
728
737
  }, {
729
738
  "propName": "type",
730
739
  "methodName": "validateType"
@@ -185,21 +185,40 @@
185
185
  .mg-input.mg-input--width-full:not(.mg-input--label-on-top) {
186
186
  justify-content: space-between;
187
187
  }
188
+ .mg-input.mg-input--width-full.mg-input--label-on-top .mg-input__box {
189
+ width: 100%;
190
+ }
188
191
  .mg-input.mg-input--width-full .mg-input__input-container {
189
192
  flex: auto;
190
193
  width: 100%;
191
194
  }
192
195
  .mg-input.mg-input--width-full .mg-input__input-container .mg-input__box {
196
+ max-width: 100%;
197
+ }
198
+ .mg-input:not(.mg-input--label-on-top) .mg-input__box {
199
+ width: 100%;
200
+ max-width: calc(17.7rem + var(--mg-inputs-spacer) * 2);
201
+ min-width: 5rem;
202
+ }
203
+ .mg-input.mg-input--width-16 .mg-input__input-container {
204
+ width: 100%;
205
+ }
206
+ .mg-input.mg-input--width-16 .mg-input__input-container .mg-input__input {
207
+ width: 100%;
208
+ max-width: 21rem;
209
+ }
210
+ .mg-input.mg-input--width-16 .mg-input__input-container .mg-input__with-character-left {
193
211
  width: 100%;
194
212
  }
195
- .mg-input.mg-input--width-16 .mg-input__box {
196
- width: 21rem;
213
+ .mg-input.mg-input--width-16 .mg-input__input-container .mg-input__box {
214
+ max-width: 21rem;
215
+ min-width: 100%;
197
216
  }
198
- .mg-input.mg-input--width-4 .mg-input__box {
199
- width: 7rem;
217
+ .mg-input.mg-input--width-4 .mg-input__input-container .mg-input__box {
218
+ max-width: 7rem;
200
219
  }
201
- .mg-input.mg-input--width-2 .mg-input__box {
202
- width: 5rem;
220
+ .mg-input.mg-input--width-2 .mg-input__input-container .mg-input__box {
221
+ max-width: 5rem;
203
222
  }
204
223
 
205
224
  /**