@mgdis/mg-components 6.16.0 → 6.18.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-T3-qWqFE.js → index-DCZEYvlH.js} +51 -28
- package/dist/cjs/{index-YM1EJx9X.js → index-TUElr4Wv.js} +10 -10
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_37.cjs.entry.js +443 -228
- package/dist/cjs/mg-alert.cjs.entry.js +3 -3
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/cjs/mg-fieldset.cjs.entry.js +141 -0
- package/dist/cjs/mg-input-combobox.cjs.entry.js +73 -57
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +36 -23
- package/dist/cjs/{mg-input.conf-WTsvDfpC.js → mg-input.conf-HYIzRsy7.js} +5 -0
- package/dist/cjs/mg-loader.cjs.entry.js +3 -3
- package/dist/cjs/mg-progress.cjs.entry.js +2 -2
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/atoms/internals/mg-character-left/mg-character-left.js +5 -5
- package/dist/collection/components/atoms/internals/mg-input-title/mg-input-title.js +7 -7
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +6 -6
- package/dist/collection/components/atoms/mg-button/mg-button.js +13 -13
- package/dist/collection/components/atoms/mg-card/mg-card.js +2 -2
- package/dist/collection/components/atoms/mg-divider/mg-divider.js +1 -1
- package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +1 -1
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +32 -26
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +3 -3
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +2 -2
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +6 -6
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +4 -0
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +193 -33
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +7 -9
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +65 -46
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +106 -86
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +67 -65
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +71 -66
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +56 -38
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +53 -35
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +66 -47
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +58 -40
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +77 -59
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +63 -45
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +54 -30
- package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +2 -4
- package/dist/collection/components/molecules/menus/mg-menu/mg-menu.js +9 -6
- package/dist/collection/components/molecules/menus/mg-menu-item/mg-menu-item.js +7 -7
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +2 -5
- package/dist/collection/components/molecules/mg-alert/mg-alert.js +5 -5
- package/dist/collection/components/molecules/mg-details/mg-details.js +7 -7
- package/dist/collection/components/molecules/mg-fieldset/mg-fieldset.js +404 -0
- package/dist/collection/components/molecules/mg-form/mg-form.js +26 -17
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +3 -3
- package/dist/collection/components/molecules/mg-loader/mg-loader.js +4 -4
- package/dist/collection/components/molecules/mg-message/mg-message.js +4 -4
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +8 -8
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +7 -8
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +53 -22
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +2 -2
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +7 -7
- package/dist/collection/components/molecules/mg-progress/mg-progress.js +7 -7
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -2
- package/dist/collection/components/molecules/mg-table/mg-table.js +2 -3
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +7 -8
- package/dist/collection/locales/en/messages.json +5 -5
- package/dist/collection/locales/fr/messages.json +5 -5
- package/dist/components/index3.js +10 -10
- package/dist/components/mg-action-more.js +5 -3
- package/dist/components/mg-alert.js +5 -3
- package/dist/components/mg-badge2.js +4 -2
- package/dist/components/mg-button2.js +4 -2
- package/dist/components/mg-card2.js +4 -2
- package/dist/components/mg-character-left2.js +4 -2
- package/dist/components/mg-details.js +5 -3
- package/dist/components/mg-divider2.js +4 -2
- package/dist/components/mg-fieldset.d.ts +11 -0
- package/dist/components/mg-fieldset.js +209 -0
- package/dist/components/mg-form.js +8 -5
- package/dist/components/mg-icon2.js +29 -21
- package/dist/components/mg-illustrated-message.js +5 -3
- package/dist/components/mg-input-checkbox-paginated2.js +6 -6
- package/dist/components/mg-input-checkbox.js +32 -17
- package/dist/components/mg-input-combobox.js +75 -57
- package/dist/components/mg-input-date.js +39 -42
- package/dist/components/mg-input-numeric.js +30 -30
- package/dist/components/mg-input-password.js +26 -13
- package/dist/components/mg-input-radio.js +27 -13
- package/dist/components/mg-input-rich-text-editor.js +37 -22
- package/dist/components/mg-input-select2.js +28 -14
- package/dist/components/mg-input-text2.js +40 -26
- package/dist/components/mg-input-textarea.js +27 -14
- package/dist/components/mg-input-title2.js +4 -2
- package/dist/components/mg-input-toggle.js +39 -12
- package/dist/components/mg-input2.js +121 -20
- package/dist/components/mg-item-more2.js +13 -5
- package/dist/components/mg-loader2.js +5 -3
- package/dist/components/mg-menu-item2.js +4 -2
- package/dist/components/mg-message2.js +6 -4
- package/dist/components/mg-modal.js +6 -4
- package/dist/components/mg-pagination.js +4 -2
- package/dist/components/mg-panel.js +40 -9
- package/dist/components/mg-popover-content2.js +5 -3
- package/dist/components/mg-popover2.js +5 -3
- package/dist/components/mg-progress.js +5 -3
- package/dist/components/mg-skip-links.js +5 -3
- package/dist/components/mg-table.js +4 -2
- package/dist/components/mg-tabs2.js +5 -3
- package/dist/components/mg-tag.js +4 -2
- package/dist/components/mg-tooltip-content2.js +4 -2
- package/dist/components/mg-tooltip2.js +4 -2
- package/dist/esm/{index-WtiuOkLj.js → index-C7xjtdiw.js} +1 -1
- package/dist/esm/{index-Bab8_u8S.js → index-CNX6lq0x.js} +10 -10
- package/dist/esm/{index-JHj_9FSs.js → index-T6kOJXP1.js} +51 -28
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_37.entry.js +444 -229
- package/dist/esm/mg-alert.entry.js +4 -4
- package/dist/esm/mg-components.js +4 -4
- package/dist/esm/mg-fieldset.entry.js +139 -0
- package/dist/esm/mg-input-combobox.entry.js +74 -58
- package/dist/esm/mg-input-rich-text-editor.entry.js +37 -24
- package/dist/esm/{mg-input.conf-CNgv8hc5.js → mg-input.conf-D9V2v4n2.js} +5 -1
- package/dist/esm/mg-loader.entry.js +4 -4
- package/dist/esm/mg-progress.entry.js +3 -3
- package/dist/mg-components/locales/en/messages.json +5 -5
- package/dist/mg-components/locales/fr/messages.json +5 -5
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/p-2bab89c2.entry.js +1 -0
- package/dist/mg-components/{p-658f828c.entry.js → p-5abc77cd.entry.js} +1 -1
- package/dist/mg-components/p-7d2e43b2.entry.js +1 -0
- package/dist/mg-components/{p-c85b5d10.entry.js → p-92e5e5a6.entry.js} +1 -1
- package/dist/mg-components/{p-42a90251.entry.js → p-952288bd.entry.js} +1 -1
- package/dist/mg-components/{p-WtiuOkLj.js → p-C7xjtdiw.js} +1 -1
- package/dist/mg-components/p-CNX6lq0x.js +1 -0
- package/dist/mg-components/p-D9V2v4n2.js +1 -0
- package/dist/mg-components/p-T6kOJXP1.js +2 -0
- package/dist/mg-components/p-f2cddd52.entry.js +1 -0
- package/dist/mg-components/{p-82455ac7.entry.js → p-f6afaeb8.entry.js} +1 -1
- package/dist/types/components/atoms/mg-icon/mg-icon.conf.d.ts +1 -1
- package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +0 -5
- package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +5 -0
- package/dist/types/components/molecules/inputs/mg-input/mg-input.d.ts +32 -1
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +4 -3
- package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +4 -2
- package/dist/types/components/molecules/mg-fieldset/mg-fieldset.d.ts +105 -0
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -1
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +8 -1
- package/dist/types/components.d.ts +168 -18
- package/dist/types/stencil-public-runtime.d.ts +39 -2
- package/dist/types/types/index.d.ts +1 -1
- package/ide/intellij/web-types.json +289 -181
- package/ide/vscode/html-custom-data.json +259 -18
- package/package.json +23 -23
- package/dist/mg-components/p-54156253.entry.js +0 -1
- package/dist/mg-components/p-Bab8_u8S.js +0 -1
- package/dist/mg-components/p-CNgv8hc5.js +0 -1
- package/dist/mg-components/p-JHj_9FSs.js +0 -2
- package/dist/mg-components/p-abbd151c.entry.js +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-DCZEYvlH.js');
|
|
4
4
|
var index$1 = require('./index-CpENFzEo.js');
|
|
5
|
-
var mgInput_conf = require('./mg-input.conf-
|
|
6
|
-
var index$2 = require('./index-
|
|
5
|
+
var mgInput_conf = require('./mg-input.conf-HYIzRsy7.js');
|
|
6
|
+
var index$2 = require('./index-TUElr4Wv.js');
|
|
7
7
|
var events_utils = require('./events.utils-D5SAtkpQ.js');
|
|
8
8
|
|
|
9
9
|
const mgInputComboboxCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left>mg-icon:first-of-type,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container>mg-icon:first-of-type{position:absolute;top:50%;left:var(--mg-b-size-8);color:var(--mg-c-input-color-icon);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left .mg-c-input__box,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container .mg-c-input__box{padding-left:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2)}.mg-c-input__popover-info{padding:var(--mg-b-size-8);margin:0;color:var(--mg-b-color-neutral-90);text-align:center}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);overflow-wrap:anywhere}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}a{color:inherit;text-decoration:underline}a:hover,a:focus,a:active{text-decoration:none}.mg-c-input.mg-c-input--combobox mg-popover{--mg-c-card-overflow:hidden;--mg-c-popover-padding-vertical:0;--mg-c-popover-padding-horizontal:0}.mg-c-input.mg-c-input--combobox .mg-c-input__input-group-container{position:relative}.mg-c-input.mg-c-input--combobox .mg-c-input__box{cursor:pointer}.mg-c-input.mg-c-input--combobox .mg-c-input__popover-container{display:flex;min-width:var(--mg-c-input-list-width);max-height:calc(50*var(--mg-b-size-8) - var(--mg-b-size-32));flex-direction:column;gap:var(--mg-b-size-4);overflow-y:scroll}.mg-c-input.mg-c-input--combobox .mg-c-input__load-more{padding:0 var(--mg-b-size-8) var(--mg-b-size-4)}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list{padding:0;margin:0;cursor:pointer;list-style:none}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item{display:flex;padding:var(--mg-b-size-8)}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item:hover,.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item.mg-c-input__input-list-item--focus-visible{background-color:var(--mg-b-color-neutral-20)}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item.mg-c-input__input-list-item--selected{font-weight:700}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item.mg-c-input__input-list-item--selected mg-icon{margin-left:auto}.mg-c-input.mg-c-input--combobox.mg-c-input--width-2 .mg-c-input__box{width:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2 + var(--mg-b-size-24) + var(--mg-b-size-min-height) + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-4 .mg-c-input__box{width:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2 + var(--mg-b-size-48) + var(--mg-b-size-min-height) + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-16 .mg-c-input__box{width:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2 + calc(23 * var(--mg-b-size-8)) + var(--mg-b-size-min-height) + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-full mg-popover{--mg-c-popover-max-width:var(--mg-c-input-list-width, var(--mg-c-popover-max-width))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-full .mg-c-input__input-group-container{display:flex;width:100%}.mg-c-input.mg-c-input--combobox.mg-c-input--width-full .mg-c-input__box{flex:1}.mg-c-input.mg-c-input--combobox.mg-c-input--input-append .mg-c-input__box{padding-right:calc(var(--mg-b-size-min-height) + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--input-append .mg-c-input__box-append{position:absolute;top:0;right:0}";
|
|
@@ -59,6 +59,7 @@ const MgInputCombobox = class {
|
|
|
59
59
|
this.classFocus = 'mg-u-is-focused';
|
|
60
60
|
// hasDisplayedError (triggered by blur event)
|
|
61
61
|
this.hasDisplayedError = false;
|
|
62
|
+
this.customErrorMessage = { lock: false };
|
|
62
63
|
/**
|
|
63
64
|
* Input name
|
|
64
65
|
* If not set the value equals the identifier
|
|
@@ -193,7 +194,7 @@ const MgInputCombobox = class {
|
|
|
193
194
|
// override keys actions
|
|
194
195
|
switch (event.key) {
|
|
195
196
|
case events_utils.Keys.TAB:
|
|
196
|
-
case events_utils.Keys.ENTER:
|
|
197
|
+
case events_utils.Keys.ENTER: {
|
|
197
198
|
guard = event.key === events_utils.Keys.ENTER;
|
|
198
199
|
const option = (_a = this.option) !== null && _a !== void 0 ? _a : this.options.items.find(this.isCurrentOption);
|
|
199
200
|
// Sets the value to the content of the focused option in the listbox.
|
|
@@ -203,12 +204,13 @@ const MgInputCombobox = class {
|
|
|
203
204
|
// Closes the popover.
|
|
204
205
|
this.popoverDisplay = false;
|
|
205
206
|
break;
|
|
207
|
+
}
|
|
206
208
|
case events_utils.Keys.DOWN:
|
|
207
209
|
case events_utils.Keys.ARROWDOWN:
|
|
208
210
|
case events_utils.Keys.UP:
|
|
209
|
-
case events_utils.Keys.ARROWUP:
|
|
211
|
+
case events_utils.Keys.ARROWUP: {
|
|
210
212
|
guard = true;
|
|
211
|
-
if (this.isLoading ||
|
|
213
|
+
if (this.isLoading || this.page.total === 0) {
|
|
212
214
|
this.popoverDisplay = true;
|
|
213
215
|
break;
|
|
214
216
|
}
|
|
@@ -239,12 +241,13 @@ const MgInputCombobox = class {
|
|
|
239
241
|
// open popover
|
|
240
242
|
this.popoverDisplay = true;
|
|
241
243
|
break;
|
|
244
|
+
}
|
|
242
245
|
case events_utils.Keys.LEFT:
|
|
243
246
|
case events_utils.Keys.ARROWLEFT:
|
|
244
247
|
case events_utils.Keys.HOME:
|
|
245
248
|
case events_utils.Keys.RIGHT:
|
|
246
249
|
case events_utils.Keys.ARROWRIGHT:
|
|
247
|
-
case events_utils.Keys.END:
|
|
250
|
+
case events_utils.Keys.END: {
|
|
248
251
|
// skip process if visual focus is not in popover
|
|
249
252
|
if (!isItem(this.option))
|
|
250
253
|
break;
|
|
@@ -264,8 +267,9 @@ const MgInputCombobox = class {
|
|
|
264
267
|
this.input.setSelectionRange(index, index);
|
|
265
268
|
}
|
|
266
269
|
break;
|
|
270
|
+
}
|
|
267
271
|
case events_utils.Keys.ESC:
|
|
268
|
-
case events_utils.Keys.ESCAPE:
|
|
272
|
+
case events_utils.Keys.ESCAPE: {
|
|
269
273
|
guard = true;
|
|
270
274
|
if (this.popoverDisplay) {
|
|
271
275
|
// If the popover is displayed, closes it.
|
|
@@ -279,10 +283,12 @@ const MgInputCombobox = class {
|
|
|
279
283
|
this.option = null;
|
|
280
284
|
}
|
|
281
285
|
break;
|
|
282
|
-
|
|
286
|
+
}
|
|
287
|
+
default: {
|
|
283
288
|
// Remove visual focus from popover options
|
|
284
289
|
this.option = null;
|
|
285
290
|
break;
|
|
291
|
+
}
|
|
286
292
|
}
|
|
287
293
|
if (guard) {
|
|
288
294
|
event.stopPropagation();
|
|
@@ -328,18 +334,20 @@ const MgInputCombobox = class {
|
|
|
328
334
|
};
|
|
329
335
|
/**
|
|
330
336
|
* Set input error message
|
|
331
|
-
* @param
|
|
337
|
+
* @param fromSetErrorContext - context come from `setError` method
|
|
332
338
|
*/
|
|
333
|
-
this.setErrorMessage = (
|
|
339
|
+
this.setErrorMessage = (fromSetErrorContext = false) => {
|
|
334
340
|
// Set error message
|
|
335
341
|
this.errorMessage = undefined;
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
this.
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
342
|
+
if (!this.valid) {
|
|
343
|
+
// Does have a new custom error message OR does have a custom error message locked
|
|
344
|
+
if (fromSetErrorContext || (this.customErrorMessage.lock && this.customErrorMessage.message !== undefined)) {
|
|
345
|
+
this.errorMessage = this.customErrorMessage.message;
|
|
346
|
+
}
|
|
347
|
+
// required
|
|
348
|
+
else if (this.input.validity.valueMissing) {
|
|
349
|
+
this.errorMessage = this.messages.errors.required;
|
|
350
|
+
}
|
|
343
351
|
}
|
|
344
352
|
};
|
|
345
353
|
/**
|
|
@@ -353,15 +361,14 @@ const MgInputCombobox = class {
|
|
|
353
361
|
* @returns promisified action
|
|
354
362
|
*/
|
|
355
363
|
this.loadingWrapper = (action) => {
|
|
364
|
+
var _a;
|
|
356
365
|
let promise;
|
|
357
366
|
let index;
|
|
358
367
|
// cache initial loading action if not defined
|
|
359
|
-
|
|
360
|
-
this.loadingAction = action.name;
|
|
361
|
-
}
|
|
368
|
+
(_a = this.loadingAction) !== null && _a !== void 0 ? _a : (this.loadingAction = action.name);
|
|
362
369
|
// update index
|
|
363
370
|
if (Boolean(this.option) && this.loadingAction !== 'load-more') {
|
|
364
|
-
index = this.page.items.findIndex(option => option.value
|
|
371
|
+
index = this.page.items.findIndex(option => index$1.toString(option.value) === index$1.toString(this.option.value));
|
|
365
372
|
}
|
|
366
373
|
else if (this.loadingAction === 'load-more') {
|
|
367
374
|
index = this.page.items.length - this.page.baseIndex;
|
|
@@ -414,14 +421,14 @@ const MgInputCombobox = class {
|
|
|
414
421
|
*/
|
|
415
422
|
this.goToNextPage = () => {
|
|
416
423
|
this.showMore.emit();
|
|
417
|
-
if (
|
|
424
|
+
if (this.fetchurl !== undefined) {
|
|
418
425
|
return this.getOptions(typeof this.page.next === 'string' ? this.page.next : undefined).then(nextPage => {
|
|
419
|
-
if (
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
426
|
+
if (nextPage !== undefined) {
|
|
427
|
+
// merge items from current page and next page
|
|
428
|
+
const items = [...this.page.items, ...nextPage.items];
|
|
429
|
+
// create new options pagination withe merged items
|
|
430
|
+
this.options = new index$1.Paginate(items, { total: nextPage.total, next: nextPage.next, top: items.length });
|
|
431
|
+
}
|
|
425
432
|
});
|
|
426
433
|
}
|
|
427
434
|
else {
|
|
@@ -438,12 +445,12 @@ const MgInputCombobox = class {
|
|
|
438
445
|
* @returns promise
|
|
439
446
|
*/
|
|
440
447
|
this.updatePage = async () => {
|
|
441
|
-
if (
|
|
448
|
+
if (this.fetchurl !== undefined) {
|
|
442
449
|
return this.getOptions().then(page => {
|
|
443
|
-
if (
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
450
|
+
if (page !== undefined) {
|
|
451
|
+
// reset current options pagination from API response
|
|
452
|
+
this.options = new index$1.Paginate(page.items, { total: page.total, next: page.next, top: page.top });
|
|
453
|
+
}
|
|
447
454
|
});
|
|
448
455
|
}
|
|
449
456
|
else {
|
|
@@ -489,11 +496,11 @@ const MgInputCombobox = class {
|
|
|
489
496
|
this.valueChange.emit(newValue);
|
|
490
497
|
}
|
|
491
498
|
watchItems(newValue) {
|
|
492
|
-
if (
|
|
499
|
+
if (this.fetchurl !== undefined && newValue === undefined) {
|
|
493
500
|
// skip newValue check
|
|
494
501
|
return;
|
|
495
502
|
}
|
|
496
|
-
else if (
|
|
503
|
+
else if (this.fetchurl !== undefined && newValue !== undefined) {
|
|
497
504
|
throw new Error(`<mg-input-combobox> prop "items" values cannot be use with "fetchurl" prop defined. Passed value: ${index$1.toString(newValue)}.`);
|
|
498
505
|
}
|
|
499
506
|
// Empty options
|
|
@@ -513,7 +520,7 @@ const MgInputCombobox = class {
|
|
|
513
520
|
}
|
|
514
521
|
}
|
|
515
522
|
watchIdentifier(newValue) {
|
|
516
|
-
if (
|
|
523
|
+
if (index$1.isValidString(newValue)) {
|
|
517
524
|
this.popoverId = `${newValue}-popover`;
|
|
518
525
|
this.element.dataset.mgPopoverGuard = this.popoverId;
|
|
519
526
|
}
|
|
@@ -553,7 +560,7 @@ const MgInputCombobox = class {
|
|
|
553
560
|
this.classCollection = new index$1.ClassList(this.classCollection.classes);
|
|
554
561
|
}
|
|
555
562
|
watchFetchUrl(newValue) {
|
|
556
|
-
if (
|
|
563
|
+
if (newValue !== undefined) {
|
|
557
564
|
this.loadingWrapper({ name: 'load-data' });
|
|
558
565
|
}
|
|
559
566
|
}
|
|
@@ -561,20 +568,17 @@ const MgInputCombobox = class {
|
|
|
561
568
|
if (this.fetchurl && newValue && !index$1.isObject(newValue)) {
|
|
562
569
|
throw new Error(`<mg-input-combobox> prop "fetchoptions" value must be a valid RequestInit. Passed value: ${index$1.toString(newValue)}.`);
|
|
563
570
|
}
|
|
564
|
-
else {
|
|
565
|
-
new Request(this.fetchurl, newValue);
|
|
566
|
-
}
|
|
567
571
|
}
|
|
568
572
|
watchFetchMappings(newValue) {
|
|
569
|
-
if (
|
|
573
|
+
if (this.fetchurl !== undefined && !index$1.isObject(newValue)) {
|
|
570
574
|
throw new Error(`<mg-input-combobox> prop "fetchmappings" is required with "fetchurl" prop.`);
|
|
571
575
|
}
|
|
572
|
-
else if (
|
|
576
|
+
else if (newValue !== undefined && !isFetchmappings(newValue)) {
|
|
573
577
|
throw new Error(`<mg-input-combobox> prop "fetchmappings" value must be { request: RequestMappingType, response: ResponseMappingType }. Passed value: ${index$1.toString(newValue)}.`);
|
|
574
578
|
}
|
|
575
579
|
}
|
|
576
580
|
watchOptions(newValue) {
|
|
577
|
-
this.page = newValue.getPage(0,
|
|
581
|
+
this.page = newValue.getPage(0, this.filter.length > 0 ? this.optionsFilter : undefined);
|
|
578
582
|
}
|
|
579
583
|
watchFilter(newValue) {
|
|
580
584
|
this.loadingWrapper({ name: 'load-data' });
|
|
@@ -631,17 +635,22 @@ const MgInputCombobox = class {
|
|
|
631
635
|
* When used to set validity to `false`, you should use this method again to reset the validity to `true`.
|
|
632
636
|
* @param valid - value indicating the validity
|
|
633
637
|
* @param errorMessage - the error message to display
|
|
638
|
+
* @param errorMessageLock - lock the error message and validity state
|
|
634
639
|
*/
|
|
635
|
-
async setError(valid, errorMessage) {
|
|
640
|
+
async setError(valid, errorMessage, errorMessageLock = false) {
|
|
636
641
|
if (typeof valid !== 'boolean') {
|
|
637
642
|
throw new Error('<mg-input-combobox> method "setError()" param "valid" must be a boolean.');
|
|
638
643
|
}
|
|
639
|
-
else if (!index$1.isValidString(errorMessage)) {
|
|
644
|
+
else if (errorMessage !== undefined && !index$1.isValidString(errorMessage)) {
|
|
640
645
|
throw new Error('<mg-input-combobox> method "setError()" param "errorMessage" must be a string.');
|
|
641
646
|
}
|
|
642
647
|
else {
|
|
648
|
+
this.customErrorMessage = {
|
|
649
|
+
lock: valid ? false : errorMessageLock,
|
|
650
|
+
message: valid ? undefined : errorMessage,
|
|
651
|
+
};
|
|
643
652
|
this.setValidity(valid);
|
|
644
|
-
this.setErrorMessage(
|
|
653
|
+
this.setErrorMessage(true);
|
|
645
654
|
this.hasDisplayedError = this.invalid;
|
|
646
655
|
}
|
|
647
656
|
}
|
|
@@ -661,6 +670,8 @@ const MgInputCombobox = class {
|
|
|
661
670
|
// - Keep everything in sync both inside and outside the component
|
|
662
671
|
return new Promise(resolve => {
|
|
663
672
|
requestAnimationFrame(() => {
|
|
673
|
+
// unlock validity check by reseting customErrorMessage
|
|
674
|
+
this.customErrorMessage = { lock: false };
|
|
664
675
|
this.checkValidity();
|
|
665
676
|
this.errorMessage = undefined;
|
|
666
677
|
this.hasDisplayedError = false;
|
|
@@ -689,11 +700,13 @@ const MgInputCombobox = class {
|
|
|
689
700
|
* @param newValue - valid new value
|
|
690
701
|
*/
|
|
691
702
|
setValidity(newValue) {
|
|
692
|
-
const
|
|
693
|
-
this.
|
|
703
|
+
const oldValue = this.valid;
|
|
704
|
+
if (!this.customErrorMessage.lock || (this.customErrorMessage.message !== undefined && !newValue)) {
|
|
705
|
+
this.valid = newValue;
|
|
706
|
+
}
|
|
694
707
|
this.invalid = !this.valid;
|
|
695
708
|
// We need to send valid event even if it is the same value
|
|
696
|
-
if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !==
|
|
709
|
+
if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValue))
|
|
697
710
|
this.inputValid.emit(this.valid);
|
|
698
711
|
}
|
|
699
712
|
/*************
|
|
@@ -709,7 +722,7 @@ const MgInputCombobox = class {
|
|
|
709
722
|
// Validate
|
|
710
723
|
this.watchIdentifier(this.identifier);
|
|
711
724
|
this.watchItems(this.items);
|
|
712
|
-
if (
|
|
725
|
+
if (this.fetchurl !== undefined) {
|
|
713
726
|
this.watchFetchOptions(this.fetchoptions);
|
|
714
727
|
this.watchFetchMappings(this.fetchmappings);
|
|
715
728
|
this.loadingWrapper({ name: 'load-data' });
|
|
@@ -736,14 +749,17 @@ const MgInputCombobox = class {
|
|
|
736
749
|
const readonlyValue = this.getValueTitle();
|
|
737
750
|
const withResetButton = this.value && !this.disabled;
|
|
738
751
|
let popoverContent;
|
|
739
|
-
if (((_a = this.page) === null || _a === void 0 ? void 0 : _a.items.length) > 0)
|
|
752
|
+
if (((_a = this.page) === null || _a === void 0 ? void 0 : _a.items.length) > 0) {
|
|
740
753
|
popoverContent = 'list';
|
|
741
|
-
|
|
754
|
+
}
|
|
755
|
+
else if (((_b = this.page) === null || _b === void 0 ? void 0 : _b.items.length) === 0 && this.filter.length > 0) {
|
|
742
756
|
popoverContent = 'notfound';
|
|
743
|
-
|
|
757
|
+
}
|
|
758
|
+
else if (((_c = this.page) === null || _c === void 0 ? void 0 : _c.items.length) === 0) {
|
|
744
759
|
popoverContent = 'notavailable';
|
|
760
|
+
}
|
|
745
761
|
let activeDescendant;
|
|
746
|
-
if (
|
|
762
|
+
if (((_d = this.option) === null || _d === void 0 ? void 0 : _d.value) !== undefined) {
|
|
747
763
|
activeDescendant = this.option.value;
|
|
748
764
|
}
|
|
749
765
|
else if (typeof this.value === 'string') {
|
|
@@ -752,8 +768,8 @@ const MgInputCombobox = class {
|
|
|
752
768
|
else {
|
|
753
769
|
activeDescendant = (_e = this.value) === null || _e === void 0 ? void 0 : _e.value;
|
|
754
770
|
}
|
|
755
|
-
return (index.h("mg-input", { key: '
|
|
756
|
-
'--mg-c-input-list-width':
|
|
771
|
+
return (index.h("mg-input", { key: 'bebf380dbdea1a9f9e0257a9425dcb6cd94a7a52', label: this.label, identifier: this.identifier, class: this.classCollection.classes.join(' '), ariaDescribedbyIDs: popoverContent && popoverContent !== 'list' ? popoverContent : undefined, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (readonlyValue && index.h("b", { class: "mg-c-input__readonly-value" }, readonlyValue)) : (index.h("mg-popover", { identifier: this.popoverId, placement: "bottom-start", display: this.popoverDisplay, "arrow-hide": true, style: {
|
|
772
|
+
'--mg-c-input-list-width': ((_f = this.input) === null || _f === void 0 ? void 0 : _f.offsetWidth) > 0 ? `${this.input.offsetWidth}px` : undefined,
|
|
757
773
|
}, "data-fallback-placement": "bottom-end", "onDisplay-change": this.handlePopoverDisplay }, index.h("div", { class: "mg-c-input__input-group-container" }, index.h("mg-icon", { icon: "magnifying-glass" }), index.h("input", { type: "text", role: "combobox", class: "mg-c-input__box mg-c-input__box--width", value: this.filter, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, autocomplete: "off", "aria-autocomplete": "list", "aria-expanded": this.popoverDisplay.toString(), "aria-controls": listId, "aria-invalid": (this.invalid === true).toString(), "aria-activedescendant": index$1.formatID(activeDescendant), onInput: this.handleFilterInput, onBlur: this.handleFilterBlur, onFocus: this.handleFilterFocus, onKeyDown: this.handleFilterKeydown, ref: (el) => {
|
|
758
774
|
if (el !== null)
|
|
759
775
|
this.input = el;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index$1 = require('./index-
|
|
3
|
+
var index$1 = require('./index-DCZEYvlH.js');
|
|
4
4
|
var index = require('./index-CpENFzEo.js');
|
|
5
|
-
var mgInput_conf = require('./mg-input.conf-
|
|
6
|
-
var index$2 = require('./index-
|
|
5
|
+
var mgInput_conf = require('./mg-input.conf-HYIzRsy7.js');
|
|
6
|
+
var index$2 = require('./index-TUElr4Wv.js');
|
|
7
7
|
|
|
8
8
|
/** Detect free variable `global` from Node.js. */
|
|
9
9
|
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
|
@@ -16380,7 +16380,7 @@ const quillSnowCss = "/*!\n * Quill Editor v2.0.3\n * https://quilljs.com\n * Co
|
|
|
16380
16380
|
|
|
16381
16381
|
const editorScss = quillSnowCss + "";
|
|
16382
16382
|
|
|
16383
|
-
const mgInputRichTextEditorCss = ".mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);overflow-wrap:anywhere}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}a{color:inherit;text-decoration:underline}a:hover,a:focus,a:active{text-decoration:none}.mg-c-input__wrapper{display:flex;width:100%;flex-direction:column;border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light)}.mg-c-input__wrapper:focus-within{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus);outline:Highlight auto .1rem;outline:-webkit-focus-ring-color auto .1rem}.mg-c-input--has-error .mg-c-input__wrapper{border-color:var(--mg-b-color-danger)}.mg-c-input--disabled .mg-c-input__wrapper{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input--rich-text-editor .mg-c-input__readonly-value p{margin:0}.mg-c-input--rich-text-editor .mg-c-input__readonly-value p:not(:first-child){margin-top:1em}.mg-c-input--rich-text-editor .ql-toolbar{display:flex;flex-wrap:wrap;padding:var(--mg-b-size-8);border:0;border-radius:var(--mg-c-input-border-radius) var(--mg-c-input-border-radius) 0 0;background:var(--mg-b-color-neutral-0);border-block-end-width:var(--mg-c-input-border-width);border-block-end-color:var(--mg-c-input-color-border);border-block-end-style:solid}.mg-c-input--rich-text-editor .ql-toolbar .ql-formats{display:inline-flex;margin:inherit;gap:.2rem}.mg-c-input--rich-text-editor .ql-toolbar .ql-formats:not(:last-child)::after{width:.1rem;height:var(--mg-b-size-16);background:var(--mg-c-input-color-border);content:\"\";margin-block:var(--mg-b-size-8);margin-inline:var(--mg-b-size-8)}.mg-c-input--rich-text-editor .ql-toolbar button
|
|
16383
|
+
const mgInputRichTextEditorCss = ".mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);overflow-wrap:anywhere}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}a{color:inherit;text-decoration:underline}a:hover,a:focus,a:active{text-decoration:none}.mg-c-input__wrapper{display:flex;width:100%;flex-direction:column;border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light)}.mg-c-input__wrapper:focus-within{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus);outline:Highlight auto .1rem;outline:-webkit-focus-ring-color auto .1rem}.mg-c-input--has-error .mg-c-input__wrapper{border-color:var(--mg-b-color-danger)}.mg-c-input--disabled .mg-c-input__wrapper{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input--rich-text-editor .mg-c-input__readonly-value p{margin:0}.mg-c-input--rich-text-editor .mg-c-input__readonly-value p:not(:first-child){margin-top:1em}.mg-c-input--rich-text-editor .ql-toolbar{display:flex;flex-wrap:wrap;padding:var(--mg-b-size-8);border:0;border-radius:var(--mg-c-input-border-radius) var(--mg-c-input-border-radius) 0 0;background:var(--mg-b-color-neutral-0);border-block-end-width:var(--mg-c-input-border-width);border-block-end-color:var(--mg-c-input-color-border);border-block-end-style:solid}.mg-c-input--rich-text-editor .ql-toolbar .ql-formats{display:inline-flex;margin:inherit;gap:.2rem}.mg-c-input--rich-text-editor .ql-toolbar .ql-formats:not(:last-child)::after{width:.1rem;height:var(--mg-b-size-16);background:var(--mg-c-input-color-border);content:\"\";margin-block:var(--mg-b-size-8);margin-inline:var(--mg-b-size-8)}.mg-c-input--rich-text-editor .ql-toolbar button .ql-fill,.mg-c-input--rich-text-editor .ql-toolbar button:hover .ql-fill,.mg-c-input--rich-text-editor .ql-toolbar button:focus .ql-fill,.mg-c-input--rich-text-editor .ql-toolbar button.ql-active .ql-fill{fill:currentcolor}.mg-c-input--rich-text-editor .ql-toolbar button:hover .ql-stroke,.mg-c-input--rich-text-editor .ql-toolbar button:focus .ql-stroke,.mg-c-input--rich-text-editor .ql-toolbar button.ql-active .ql-stroke,.mg-c-input--rich-text-editor .ql-toolbar button .ql-stroke{stroke:currentcolor}.mg-c-input--rich-text-editor .ql-toolbar button{display:flex;min-width:var(--mg-b-size-32);height:var(--mg-b-size-32);align-items:center;justify-content:center;padding:var(--mg-b-size-4);border:.1rem solid rgba(0,0,0,0);border-radius:var(--mg-b-size-radius);color:var(--mg-b-color-dark);float:inherit;transition-duration:.2s;transition-property:background-color,border-color;transition-timing-function:ease-in-out}.mg-c-input--rich-text-editor .ql-toolbar button svg{width:var(--mg-b-size-20);height:var(--mg-b-size-20)}.mg-c-input--rich-text-editor .ql-toolbar button:focus{color:var(--mg-b-color-dark)}.mg-c-input--rich-text-editor .ql-toolbar button:focus-visible,.mg-c-input--rich-text-editor .ql-toolbar button:hover,.mg-c-input--rich-text-editor .ql-toolbar button.ql-active{border-color:var(--mg-b-color-neutral-70);background:var(--mg-b-color-neutral-20);color:var(--mg-b-color-dark)}.mg-c-input--rich-text-editor .ql-toolbar button .ql-stroke{stroke-width:.12rem}.mg-c-input--rich-text-editor .ql-toolbar button .ql-stroke.ql-thin{stroke-width:.1rem}.mg-c-input--rich-text-editor .ql-toolbar button.ql-bold .ql-stroke{stroke-width:.2rem}.mg-c-input--rich-text-editor .ql-container{border:0;border-radius:0 0 var(--mg-c-input-border-radius) var(--mg-c-input-border-radius);margin:0 .1rem .1rem;background:var(--mg-b-color-neutral-0)}.mg-c-input--rich-text-editor .ql-editor{min-height:calc(calc(var(--mg-b-font-size) * var(--mg-b-line-height) * var(--mg-c-input-rich-text-editor-rows, 3)) + calc((var(--mg-b-size-min-height) - var(--mg-b-font-size) * var(--mg-b-line-height)) / 2));padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);color:var(--mg-b-color-dark);font-size:var(--mg-b-font-size)}.mg-c-input--rich-text-editor .ql-editor.ql-blank::before{right:var(--mg-b-size-8);left:var(--mg-b-size-8)}.mg-c-input--rich-text-editor .ql-editor p:not(:first-child){margin-top:1em}.mg-c-input--rich-text-editor.mg-c-input--disabled .ql-toolbar{pointer-events:none}.mg-c-input--rich-text-editor.mg-c-input--has-error .ql-toolbar{border-color:var(--mg-b-color-danger)}";
|
|
16384
16384
|
|
|
16385
16385
|
const MgInputRichTextEditor = class {
|
|
16386
16386
|
constructor(hostRef) {
|
|
@@ -16389,6 +16389,7 @@ const MgInputRichTextEditor = class {
|
|
|
16389
16389
|
this.valueChange = index$1.createEvent(this, "value-change", 7);
|
|
16390
16390
|
// hasDisplayedError (triggered by blur event)
|
|
16391
16391
|
this.hasDisplayedError = false;
|
|
16392
|
+
this.customErrorMessage = { lock: false };
|
|
16392
16393
|
// Classes
|
|
16393
16394
|
this.classFocus = 'mg-u-is-focused';
|
|
16394
16395
|
/**
|
|
@@ -16454,20 +16455,23 @@ const MgInputRichTextEditor = class {
|
|
|
16454
16455
|
};
|
|
16455
16456
|
/**
|
|
16456
16457
|
* Set input error message
|
|
16457
|
-
* @param
|
|
16458
|
+
* @param fromSetErrorContext - context come from `setError` method
|
|
16458
16459
|
*/
|
|
16459
|
-
this.setErrorMessage = (
|
|
16460
|
+
this.setErrorMessage = (fromSetErrorContext = false) => {
|
|
16461
|
+
// Set error message
|
|
16460
16462
|
this.errorMessage = undefined;
|
|
16461
|
-
|
|
16462
|
-
|
|
16463
|
-
|
|
16464
|
-
this.
|
|
16465
|
-
|
|
16466
|
-
|
|
16467
|
-
this.
|
|
16468
|
-
|
|
16469
|
-
|
|
16470
|
-
|
|
16463
|
+
// Does have a new custom error message
|
|
16464
|
+
if (!this.valid) {
|
|
16465
|
+
// Does have a new custom error message OR does have a custom error message locked
|
|
16466
|
+
if (fromSetErrorContext || (this.customErrorMessage.lock && this.customErrorMessage.message !== undefined)) {
|
|
16467
|
+
this.errorMessage = this.customErrorMessage.message;
|
|
16468
|
+
}
|
|
16469
|
+
else if (this.required && this.isEmpty()) {
|
|
16470
|
+
this.errorMessage = this.messages.errors.required;
|
|
16471
|
+
}
|
|
16472
|
+
else if (!this.getPatternValidity()) {
|
|
16473
|
+
this.errorMessage = this.patternErrorMessage;
|
|
16474
|
+
}
|
|
16471
16475
|
}
|
|
16472
16476
|
};
|
|
16473
16477
|
/**
|
|
@@ -16595,17 +16599,22 @@ const MgInputRichTextEditor = class {
|
|
|
16595
16599
|
* When used to set validity to `false`, you should use this method again to reset the validity to `true`.
|
|
16596
16600
|
* @param valid - value indicating the validity
|
|
16597
16601
|
* @param errorMessage - the error message to display
|
|
16602
|
+
* @param errorMessageLock - lock the error message and validity state
|
|
16598
16603
|
*/
|
|
16599
|
-
async setError(valid, errorMessage) {
|
|
16604
|
+
async setError(valid, errorMessage, errorMessageLock = false) {
|
|
16600
16605
|
if (typeof valid !== 'boolean') {
|
|
16601
16606
|
throw new Error('<mg-input-rich-text-editor> method "setError()" param "valid" must be a boolean.');
|
|
16602
16607
|
}
|
|
16603
|
-
else if (!index.isValidString(errorMessage)) {
|
|
16608
|
+
else if (errorMessage !== undefined && !index.isValidString(errorMessage)) {
|
|
16604
16609
|
throw new Error('<mg-input-rich-text-editor> method "setError()" param "errorMessage" must be a string.');
|
|
16605
16610
|
}
|
|
16606
16611
|
else {
|
|
16612
|
+
this.customErrorMessage = {
|
|
16613
|
+
lock: valid ? false : errorMessageLock,
|
|
16614
|
+
message: valid ? undefined : errorMessage,
|
|
16615
|
+
};
|
|
16607
16616
|
this.setValidity(valid);
|
|
16608
|
-
this.setErrorMessage(
|
|
16617
|
+
this.setErrorMessage(true);
|
|
16609
16618
|
this.hasDisplayedError = this.invalid;
|
|
16610
16619
|
}
|
|
16611
16620
|
}
|
|
@@ -16624,6 +16633,8 @@ const MgInputRichTextEditor = class {
|
|
|
16624
16633
|
// - Keep everything in sync both inside and outside the component
|
|
16625
16634
|
return new Promise(resolve => {
|
|
16626
16635
|
requestAnimationFrame(() => {
|
|
16636
|
+
// unlock validity check by reseting customErrorMessage
|
|
16637
|
+
this.customErrorMessage = { lock: false };
|
|
16627
16638
|
this.checkValidity();
|
|
16628
16639
|
this.errorMessage = undefined;
|
|
16629
16640
|
this.hasDisplayedError = false;
|
|
@@ -16637,10 +16648,12 @@ const MgInputRichTextEditor = class {
|
|
|
16637
16648
|
* @param newValue - valid new value
|
|
16638
16649
|
*/
|
|
16639
16650
|
setValidity(newValue) {
|
|
16640
|
-
const
|
|
16641
|
-
this.
|
|
16651
|
+
const oldValue = this.valid;
|
|
16652
|
+
if (!this.customErrorMessage.lock || (this.customErrorMessage.message !== undefined && !newValue)) {
|
|
16653
|
+
this.valid = newValue;
|
|
16654
|
+
}
|
|
16642
16655
|
this.invalid = !this.valid;
|
|
16643
|
-
if (this.valid !==
|
|
16656
|
+
if (this.valid !== oldValue) {
|
|
16644
16657
|
this.inputValid.emit(this.valid);
|
|
16645
16658
|
}
|
|
16646
16659
|
}
|
|
@@ -16689,7 +16702,7 @@ const MgInputRichTextEditor = class {
|
|
|
16689
16702
|
* @returns HTML mg-input Element
|
|
16690
16703
|
*/
|
|
16691
16704
|
render() {
|
|
16692
|
-
return (index$1.h("mg-input", { key: '
|
|
16705
|
+
return (index$1.h("mg-input", { key: '2f8f244cb60996c9cbe891b04168b5aea420d3a0', identifier: this.identifier, class: this.classCollection.join(), label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.helpText, errorMessage: this.hasDisplayedError ? this.errorMessage : undefined }, this.readonly ? (index$1.h("div", { class: "mg-c-input__readonly-value", innerHTML: this.value })) : (index$1.h("div", { ref: el => {
|
|
16693
16706
|
this.wrapperElement = el;
|
|
16694
16707
|
}, id: this.identifier, class: "mg-c-input__wrapper" }, index$1.h("div", null)))));
|
|
16695
16708
|
}
|
|
@@ -8,6 +8,10 @@ const widths = [2, 4, 16, 'full'];
|
|
|
8
8
|
* Possible tootltip postions
|
|
9
9
|
*/
|
|
10
10
|
const tooltipPositions = ['input', 'label'];
|
|
11
|
+
/**
|
|
12
|
+
* Possible label headings
|
|
13
|
+
*/
|
|
14
|
+
const labelHeadings = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
11
15
|
const classFieldset = 'mg-c-input--fieldset';
|
|
12
16
|
const classDisabled = 'mg-c-input--disabled';
|
|
13
17
|
const classReadonly = 'mg-c-input--readonly';
|
|
@@ -17,5 +21,6 @@ exports.classDisabled = classDisabled;
|
|
|
17
21
|
exports.classFieldset = classFieldset;
|
|
18
22
|
exports.classReadonly = classReadonly;
|
|
19
23
|
exports.classVerticalList = classVerticalList;
|
|
24
|
+
exports.labelHeadings = labelHeadings;
|
|
20
25
|
exports.tooltipPositions = tooltipPositions;
|
|
21
26
|
exports.widths = widths;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var index$2 = require('./index-
|
|
3
|
+
var index = require('./index-DCZEYvlH.js');
|
|
4
|
+
var index$2 = require('./index-TUElr4Wv.js');
|
|
5
5
|
var index$1 = require('./index-CpENFzEo.js');
|
|
6
6
|
|
|
7
7
|
const mgLoaderCss = ".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}:host{display:block}.mg-c-loader{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:var(--mg-b-size-4);text-align:center}";
|
|
@@ -35,7 +35,7 @@ const MgLoader = class {
|
|
|
35
35
|
* @returns HTML Element
|
|
36
36
|
*/
|
|
37
37
|
render() {
|
|
38
|
-
return (index.h("div", { key: '
|
|
38
|
+
return (index.h("div", { key: '739b4cbacd8a8da056dbb1445c40fac2cf26766a', class: "mg-c-loader", "aria-live": "polite" }, index.h("mg-icon", { key: '95d3cbf26fcd6dbf0dad4853bf55aa66385f1aba', icon: "loader", spin: true }), index.h("span", { key: 'f6322cd3054d8976bd2ec24f86a2d6bb60ca7ae1', class: { 'mg-u-visually-hidden': this.messageHide } }, this.message || this.messages.loader.inProgress)));
|
|
39
39
|
}
|
|
40
40
|
get element() { return index.getElement(this); }
|
|
41
41
|
static get watchers() { return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-DCZEYvlH.js');
|
|
4
4
|
var index$1 = require('./index-CpENFzEo.js');
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -75,7 +75,7 @@ const MgProgress = class {
|
|
|
75
75
|
* @returns HTML Element
|
|
76
76
|
*/
|
|
77
77
|
render() {
|
|
78
|
-
return (index.h(index.Host, { key: '
|
|
78
|
+
return (index.h(index.Host, { key: '8e6c727e9416fa777fd94b32d618a9137e8e08f7', role: this.ariaRole, "aria-label": this.label, "aria-valuenow": this.value, "aria-valuemin": this.min, "aria-valuemax": this.max }, index.h("div", { key: 'ac42ee9c5dda55d70aad7391895e4a013aaa27f9', class: "mg-c-progress" }, index.h("div", { key: '34c77bc6c133bc59b9daa68d7d6c8534f13f7d37', class: { 'mg-c-progress__bar': true, 'mg-c-progress__bar--active': this.value > this.min } }, index.h("div", { key: '7ea03a3f0c54ca0c81616c7c070d178a510dd7e1', class: "mg-c-progress__fill", style: {
|
|
79
79
|
width: `${Math.round(((this.value - this.min) / (this.max - this.min)) * 100)}%`,
|
|
80
80
|
} })))));
|
|
81
81
|
}
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"components/molecules/mg-action-more/mg-action-more.js",
|
|
30
30
|
"components/molecules/mg-alert/mg-alert.js",
|
|
31
31
|
"components/molecules/mg-details/mg-details.js",
|
|
32
|
+
"components/molecules/mg-fieldset/mg-fieldset.js",
|
|
32
33
|
"components/molecules/mg-form/mg-form.js",
|
|
33
34
|
"components/molecules/mg-illustrated-message/mg-illustrated-message.js",
|
|
34
35
|
"components/molecules/mg-loader/mg-loader.js",
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
],
|
|
46
47
|
"compiler": {
|
|
47
48
|
"name": "@stencil/core",
|
|
48
|
-
"version": "4.
|
|
49
|
+
"version": "4.38.0",
|
|
49
50
|
"typescriptVersion": "5.5.4"
|
|
50
51
|
},
|
|
51
52
|
"collections": [],
|
|
@@ -55,7 +55,6 @@ export class MgCharacterLeft {
|
|
|
55
55
|
return {
|
|
56
56
|
"identifier": {
|
|
57
57
|
"type": "string",
|
|
58
|
-
"attribute": "identifier",
|
|
59
58
|
"mutable": false,
|
|
60
59
|
"complexType": {
|
|
61
60
|
"original": "string",
|
|
@@ -70,11 +69,11 @@ export class MgCharacterLeft {
|
|
|
70
69
|
},
|
|
71
70
|
"getter": false,
|
|
72
71
|
"setter": false,
|
|
73
|
-
"reflect": false
|
|
72
|
+
"reflect": false,
|
|
73
|
+
"attribute": "identifier"
|
|
74
74
|
},
|
|
75
75
|
"characters": {
|
|
76
76
|
"type": "string",
|
|
77
|
-
"attribute": "characters",
|
|
78
77
|
"mutable": false,
|
|
79
78
|
"complexType": {
|
|
80
79
|
"original": "string",
|
|
@@ -90,11 +89,11 @@ export class MgCharacterLeft {
|
|
|
90
89
|
"getter": false,
|
|
91
90
|
"setter": false,
|
|
92
91
|
"reflect": false,
|
|
92
|
+
"attribute": "characters",
|
|
93
93
|
"defaultValue": "''"
|
|
94
94
|
},
|
|
95
95
|
"maxlength": {
|
|
96
96
|
"type": "number",
|
|
97
|
-
"attribute": "maxlength",
|
|
98
97
|
"mutable": false,
|
|
99
98
|
"complexType": {
|
|
100
99
|
"original": "number",
|
|
@@ -109,7 +108,8 @@ export class MgCharacterLeft {
|
|
|
109
108
|
},
|
|
110
109
|
"getter": false,
|
|
111
110
|
"setter": false,
|
|
112
|
-
"reflect": false
|
|
111
|
+
"reflect": false,
|
|
112
|
+
"attribute": "maxlength"
|
|
113
113
|
}
|
|
114
114
|
};
|
|
115
115
|
}
|