@mgdis/mg-components 6.20.0 → 6.22.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-TUElr4Wv.js → index-BxB20_Vw.js} +54 -0
- package/dist/cjs/{index-Bp6wZzau.js → index-C2viYwrR.js} +1761 -80
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_37.cjs.entry.js +761 -371
- package/dist/cjs/mg-alert.cjs.entry.js +17 -9
- package/dist/cjs/mg-breadcrumb.cjs.entry.js +63 -0
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/cjs/mg-fieldset.cjs.entry.js +24 -7
- package/dist/cjs/mg-input-combobox.cjs.entry.js +49 -19
- package/dist/cjs/mg-input-file.cjs.entry.js +384 -0
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +40096 -15821
- package/dist/cjs/{mg-input.conf-D7jmj_lh.js → mg-input.conf-BNpeATnq.js} +7 -0
- package/dist/cjs/mg-loader.cjs.entry.js +8 -6
- package/dist/cjs/mg-progress.cjs.entry.js +19 -9
- package/dist/collection/assets/icons/index.js +1 -1
- package/dist/collection/collection-manifest.json +5 -3
- package/dist/collection/components/atoms/internals/mg-character-left/mg-character-left.js +1 -1
- package/dist/collection/components/atoms/internals/mg-input-title/mg-input-title.js +1 -1
- package/dist/collection/components/atoms/mg-card/mg-card.js +1 -1
- package/dist/collection/components/atoms/mg-divider/mg-divider.js +1 -1
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +2 -2
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +6 -0
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +2 -2
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +2 -2
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-file/mg-input-file.js +877 -0
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +2 -2
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/custom-properties.scss +212 -0
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/editor.conf.js +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/index.js +300 -94
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.conf.js +29 -0
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +163 -53
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +2 -2
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +1 -1
- package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +3 -36
- package/dist/collection/components/molecules/menus/mg-menu/mg-menu.conf.js +0 -4
- package/dist/collection/components/molecules/menus/mg-menu/mg-menu.js +21 -43
- package/dist/collection/components/molecules/menus/mg-menu-item/mg-menu-item.js +65 -38
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +2 -2
- package/dist/collection/components/molecules/mg-alert/mg-alert.js +1 -1
- package/dist/collection/components/molecules/mg-breadcrumb/mg-breadcrumb.conf.js +1 -0
- package/dist/collection/components/molecules/mg-breadcrumb/mg-breadcrumb.js +92 -0
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
- package/dist/collection/components/molecules/mg-fieldset/mg-fieldset.js +12 -3
- package/dist/collection/components/molecules/mg-form/mg-form.js +12 -2
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -1
- package/dist/collection/components/molecules/mg-loader/mg-loader.js +1 -1
- package/dist/collection/components/molecules/mg-message/mg-message.js +2 -2
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +2 -2
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +1 -1
- package/dist/collection/components/molecules/mg-progress/mg-progress.js +1 -1
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
- package/dist/collection/components/molecules/mg-table/mg-table.js +37 -0
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +0 -4
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +13 -33
- package/dist/collection/locales/en/messages.json +14 -0
- package/dist/collection/locales/fr/messages.json +14 -0
- package/dist/components/events.utils.js +1 -23
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +1 -1
- package/dist/components/index2.js +1 -408
- package/dist/components/index3.js +1 -476
- package/dist/components/mg-action-more.js +1 -254
- package/dist/components/mg-alert.js +1 -224
- package/dist/components/mg-badge.js +1 -6
- package/dist/components/mg-badge2.js +1 -113
- package/dist/components/mg-breadcrumb.d.ts +11 -0
- package/dist/components/mg-breadcrumb.js +1 -0
- package/dist/components/mg-button.js +1 -6
- package/dist/components/mg-button2.js +1 -275
- package/dist/components/mg-card.js +1 -6
- package/dist/components/mg-card2.js +1 -92
- package/dist/components/mg-character-left.js +1 -6
- package/dist/components/mg-character-left2.js +1 -75
- package/dist/components/mg-details.js +1 -104
- package/dist/components/mg-divider.js +1 -6
- package/dist/components/mg-divider2.js +1 -49
- package/dist/components/mg-fieldset.js +1 -209
- package/dist/components/mg-form.js +1 -302
- package/dist/components/mg-icon.js +1 -6
- package/dist/components/mg-icon2.js +1 -188
- package/dist/components/mg-illustrated-message.js +1 -129
- package/dist/components/mg-input-checkbox-paginated.js +1 -6
- package/dist/components/mg-input-checkbox-paginated2.js +1 -135
- package/dist/components/mg-input-checkbox.js +1 -762
- package/dist/components/mg-input-combobox.js +1 -940
- package/dist/components/mg-input-date.js +1 -463
- package/dist/components/mg-input-file.d.ts +11 -0
- package/dist/components/mg-input-file.js +1 -0
- package/dist/components/mg-input-numeric.js +1 -592
- package/dist/components/mg-input-password.js +1 -360
- package/dist/components/mg-input-radio.js +1 -392
- package/dist/components/mg-input-rich-text-editor.js +1663 -16797
- package/dist/components/mg-input-select.js +1 -6
- package/dist/components/mg-input-select2.js +1 -481
- package/dist/components/mg-input-text.js +1 -6
- package/dist/components/mg-input-text2.js +1 -514
- package/dist/components/mg-input-textarea.js +1 -412
- package/dist/components/mg-input-title.js +1 -6
- package/dist/components/mg-input-title2.js +1 -81
- package/dist/components/mg-input-toggle.js +1 -371
- package/dist/components/mg-input.conf.js +1 -0
- package/dist/components/mg-input.js +1 -6
- package/dist/components/mg-input2.js +1 -459
- package/dist/components/mg-item-more.js +1 -6
- package/dist/components/mg-item-more2.js +1 -505
- package/dist/components/mg-loader.js +1 -6
- package/dist/components/mg-loader2.js +1 -74
- package/dist/components/mg-menu-item.js +1 -6
- package/dist/components/mg-menu-item2.js +1 -485
- package/dist/components/mg-menu.js +1 -6
- package/dist/components/mg-message.js +1 -6
- package/dist/components/mg-message2.js +1 -146
- package/dist/components/mg-modal.js +1 -184
- package/dist/components/mg-pagination.js +1 -234
- package/dist/components/mg-panel.js +1 -350
- package/dist/components/mg-popover-content.js +1 -6
- package/dist/components/mg-popover-content2.js +1 -96
- package/dist/components/mg-popover.js +1 -6
- package/dist/components/mg-popover2.js +1 -312
- package/dist/components/mg-progress.js +1 -123
- package/dist/components/mg-skip-links.js +1 -78
- package/dist/components/mg-table.js +1 -319
- package/dist/components/mg-tabs.js +1 -6
- package/dist/components/mg-tabs2.js +1 -315
- package/dist/components/mg-tag.js +1 -133
- package/dist/components/mg-tooltip-content.js +1 -6
- package/dist/components/mg-tooltip-content2.js +1 -42
- package/dist/components/mg-tooltip.js +1 -6
- package/dist/components/mg-tooltip2.js +1 -421
- package/dist/components/popper.js +1 -1790
- package/dist/esm/{index-BluNKQ3L.js → index-DFwaH2hS.js} +1761 -80
- package/dist/esm/{index-CNX6lq0x.js → index-DSEloqPn.js} +54 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_37.entry.js +761 -371
- package/dist/esm/mg-alert.entry.js +17 -9
- package/dist/esm/mg-breadcrumb.entry.js +61 -0
- package/dist/esm/mg-components.js +4 -4
- package/dist/esm/mg-fieldset.entry.js +24 -7
- package/dist/esm/mg-input-combobox.entry.js +49 -19
- package/dist/esm/mg-input-file.entry.js +382 -0
- package/dist/esm/mg-input-rich-text-editor.entry.js +40083 -15808
- package/dist/esm/{mg-input.conf-DDnrE1hD.js → mg-input.conf-C9rmNQIL.js} +7 -1
- package/dist/esm/mg-loader.entry.js +8 -6
- package/dist/esm/mg-progress.entry.js +19 -9
- package/dist/mg-components/locales/en/messages.json +14 -0
- package/dist/mg-components/locales/fr/messages.json +14 -0
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/p-0482eb9f.entry.js +1 -0
- package/dist/mg-components/{p-7132bca1.entry.js → p-2ee92f38.entry.js} +1 -1
- package/dist/mg-components/{p-916dfb6d.entry.js → p-3b653226.entry.js} +1 -1
- package/dist/mg-components/p-5745fbea.entry.js +1 -0
- package/dist/mg-components/p-C9rmNQIL.js +1 -0
- package/dist/mg-components/p-DFwaH2hS.js +2 -0
- package/dist/mg-components/p-DSEloqPn.js +1 -0
- package/dist/mg-components/p-adec7fcc.entry.js +1 -0
- package/dist/mg-components/p-c63f97f0.entry.js +1658 -0
- package/dist/mg-components/p-c8c8cfc1.entry.js +1 -0
- package/dist/mg-components/p-cc793586.entry.js +1 -0
- package/dist/mg-components/p-d5e69c95.entry.js +1 -0
- package/dist/types/assets/icons/index.d.ts +2 -0
- package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +7 -1
- package/dist/types/components/molecules/inputs/mg-input-file/mg-input-file.d.ts +210 -0
- package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/editor/editor.conf.d.ts +17 -0
- package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/editor/index.d.ts +27 -19
- package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.conf.d.ts +3 -0
- package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.d.ts +50 -16
- package/dist/types/components/molecules/internals/mg-item-more/mg-item-more.conf.d.ts +0 -5
- package/dist/types/components/molecules/internals/mg-item-more/mg-item-more.d.ts +1 -6
- package/dist/types/components/molecules/menus/mg-menu/mg-menu.conf.d.ts +2 -10
- package/dist/types/components/molecules/menus/mg-menu/mg-menu.d.ts +7 -7
- package/dist/types/components/molecules/menus/mg-menu-item/mg-menu-item.d.ts +12 -8
- package/dist/types/components/molecules/mg-breadcrumb/mg-breadcrumb.conf.d.ts +18 -0
- package/dist/types/components/molecules/mg-breadcrumb/mg-breadcrumb.d.ts +34 -0
- package/dist/types/components/molecules/mg-table/mg-table.d.ts +6 -0
- package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +1 -9
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +4 -4
- package/dist/types/components.d.ts +302 -46
- package/dist/types/stencil-public-runtime.d.ts +76 -12
- package/ide/intellij/web-types.json +483 -51
- package/ide/vscode/css-custom-data.json +10 -2
- package/ide/vscode/html-custom-data.json +445 -104
- package/package.json +24 -23
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/editor.scss +0 -1
- package/dist/mg-components/p-016bd291.entry.js +0 -1
- package/dist/mg-components/p-186a6139.entry.js +0 -1
- package/dist/mg-components/p-BluNKQ3L.js +0 -2
- package/dist/mg-components/p-CNX6lq0x.js +0 -1
- package/dist/mg-components/p-DDnrE1hD.js +0 -1
- package/dist/mg-components/p-cd061b38.entry.js +0 -1
- package/dist/mg-components/p-d2c72f09.entry.js +0 -1
- package/dist/mg-components/p-d5a276eb.entry.js +0 -1
- package/ide/vscode/custom.css-data.json +0 -425
|
@@ -1,459 +1 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
-
import { i as isValidString, t as toString, a as isValideID } from './index2.js';
|
|
3
|
-
import { d as defineCustomElement$4 } from './mg-icon2.js';
|
|
4
|
-
import { d as defineCustomElement$3 } from './mg-input-title2.js';
|
|
5
|
-
import { d as defineCustomElement$2 } from './mg-tooltip2.js';
|
|
6
|
-
import { d as defineCustomElement$1 } from './mg-tooltip-content2.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Possible input width
|
|
10
|
-
*/
|
|
11
|
-
const widths = [2, 4, 16, 'full'];
|
|
12
|
-
/**
|
|
13
|
-
* Possible tootltip postions
|
|
14
|
-
*/
|
|
15
|
-
const tooltipPositions = ['input', 'label'];
|
|
16
|
-
/**
|
|
17
|
-
* Possible label headings
|
|
18
|
-
*/
|
|
19
|
-
const labelHeadings = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
20
|
-
const classFieldset = 'mg-c-input--fieldset';
|
|
21
|
-
const classDisabled = 'mg-c-input--disabled';
|
|
22
|
-
const classReadonly = 'mg-c-input--readonly';
|
|
23
|
-
const classVerticalList = 'mg-c-input--vertical-list';
|
|
24
|
-
const classDisplayCharacterLeft = 'mg-c-input--display-character-left';
|
|
25
|
-
|
|
26
|
-
const mgInputCss = ".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}}/*!\n * @prop --mg-c-input-border-width: Defines the width of the input border. Default value is `--mg-b-size-border`.\n * @prop --mg-c-input-border-radius: Defines the border radius of the input. Default value is `--mg-b-size-radius`.\n * @prop --mg-c-input-color-border: Defines the color of the input border. Default value is `rgb(181, 194, 201)`.\n * @prop --mg-c-input-placeholder-color-text: Defines the color of the placeholder text. Default value is `rgb(181, 194, 201)`.\n * @prop --mg-c-input-color-box-shadow-focus: Defines the shadow color of the input when focused. Default value is `rgba(0, 221, 255, 0.5)`.\n * @prop --mg-c-input-error-color-background: Defines the background color of the input error message. Default value is `color-mix(in srgb, var(--mg-b-color-danger), white 95%)`.\n * @prop --mg-c-input-toggle-border-radius-ratio: Defines the border radius ratio of the input toggle. Default value is `2`.\n * @prop --mg-c-input-check-size: Defines the size of the input check. Default value is `--mg-b-size-16`.\n */:host{display:block}.mg-c-input__input mg-icon,.mg-c-input__error mg-icon{display:flex}.mg-c-input{display:flex;min-height:var(--mg-b-size-min-height);align-items:flex-start}.mg-c-input__input-container{width:100%;min-height:var(--mg-b-size-min-height)}.mg-c-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-b-size-16);height:var(--mg-b-size-16);margin-left:var(--mg-b-size-8)}@media print{.mg-c-input__input-container mg-tooltip{display:none}}.mg-c-input__input{display:flex;min-height:var(--mg-b-size-min-height);align-items:center;justify-content:start}.mg-c-input__input mg-tooltip{align-self:baseline;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__input ::slotted(.mg-c-input__button-toggle:disabled){opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input__title{display:flex;width:var(--mg-c-input-title-width, auto);flex-shrink:0;align-items:baseline;justify-content:flex-end;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);margin-right:var(--mg-c-input-title-horizontal-space, var(--mg-b-size-8));text-align:right}.mg-c-input__title slot[name=label]+mg-tooltip{margin-left:var(--mg-b-size-4)}.mg-c-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-c-input__error{display:inline-block;padding:var(--mg-b-size-4) var(--mg-b-size-8);border-radius:var(--mg-b-size-radius);background:var(--mg-c-input-error-color-background);color:var(--mg-b-color-danger)}.mg-c-input__error ::slotted(*),.mg-c-input__help-text ::slotted(*){font-size:var(--mg-b-font-size-small);text-align:start}:host .mg-c-input__input+.mg-c-input__error,:host .mg-c-input__input+.mg-c-input__help-text{margin-top:var(--mg-b-size-4)}:host(.mg-c-input.mg-c-input--readonly) .mg-c-input__input mg-tooltip{margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2)}:host(.mg-c-input){display:flex;margin-bottom:var(--mg-c-input-margin-bottom, 0)}:host(.mg-c-input.mg-c-input--checkbox) .mg-c-input__input,:host(.mg-c-input.mg-c-input--toggle) .mg-c-input__input,:host(.mg-c-input.mg-c-input--radio) .mg-c-input__input{min-height:unset;align-items:flex-start}:host(.mg-c-input.mg-c-input--checkbox,.mg-c-input.mg-c-input--radio) .mg-c-input__input{min-height:unset}:host(.mg-c-input.mg-c-input--fieldset:not(.mg-c-input--checkbox-multi,.mg-c-input--readonly)) .mg-c-input__input-container mg-tooltip{margin-left:var(--mg-b-size-32)}:host(.mg-c-input.mg-c-input--toggle) .mg-c-input__input-container{min-width:0;flex:1}:host(.mg-c-input.mg-c-input--label-on-top){flex-direction:column}:host(.mg-c-input.mg-c-input--label-on-top) .mg-c-input__title{width:100%;flex:0;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:var(--mg-b-size-4);text-align:left}:host(.mg-c-input.mg-c-input--label-on-top) .mg-c-input__title ::slotted(mg-input-title){flex-shrink:1}:host(.mg-c-input.mg-c-input--inputs-on-bottom) .mg-c-input__help-text{margin-top:var(--mg-b-size-4);margin-bottom:var(--mg-b-size-12)}:host(.mg-c-input.mg-c-input--inputs-on-bottom) .mg-c-input__error{margin-bottom:var(--mg-b-size-20)}:host(.mg-c-input.mg-c-input--inputs-on-bottom.mg-c-input--fieldset){--mg-c-input-title-width:var(--mg-c-form-inputs-title-width, calc(28 * var(--mg-b-size-8)));--mg-c-input-title-horizontal-space:var(--mg-b-size-32)}:host(.mg-c-input.mg-c-input--inputs-on-bottom.mg-c-input--fieldset) ::slotted(*){--mg-c-input-margin-bottom:var(--mg-b-size-16)}:host(.mg-c-input.mg-c-input--label-border-display) .mg-c-input__title{border-bottom:var(--mg-b-size-border) solid var(--mg-c-divider-color-background)}:host(.mg-c-input.mg-c-input--has-heading) .mg-c-input__title{margin-bottom:0}:host(.mg-c-input.mg-c-input--has-heading) .mg-c-input-title__text{margin-top:var(--mg-b-font-size-8);margin-bottom:var(--mg-b-font-size-8)}:host(.mg-c-input.mg-c-input--has-heading) .mg-c-input__help-text,:host(.mg-c-input.mg-c-input--has-heading) .mg-c-input__error{margin-top:0;margin-bottom:var(--mg-b-size-4)}:host(.mg-c-input.mg-c-input--has-heading) .mg-c-input__help-text+.mg-c-input__input,:host(.mg-c-input.mg-c-input--has-heading) .mg-c-input__error+.mg-c-input__input{margin-top:var(--mg-b-size-12)}:host(.mg-c-input.mg-c-input--has-heading) .mg-c-input__help-text+.mg-c-input__error{margin-top:var(--mg-b-size-4)}:host(.mg-c-input.mg-c-input--has-heading.mg-c-input--label-border-display) .mg-c-input__title{margin-bottom:var(--mg-b-size-16)}:host(.mg-c-input.mg-c-input--has-heading.mg-c-input--label-border-display) .mg-c-input__help-text,:host(.mg-c-input.mg-c-input--has-heading.mg-c-input--label-border-display) .mg-c-input__error{margin-bottom:0}:host(.mg-c-input.mg-c-input--has-heading.mg-c-input--label-border-display) .mg-c-input__help-text+.mg-c-input__input,:host(.mg-c-input.mg-c-input--has-heading.mg-c-input--label-border-display) .mg-c-input__error+.mg-c-input__input{margin-top:var(--mg-b-size-16)}:host(.mg-c-input.mg-c-input--has-heading.mg-c-input--label-border-display) .mg-c-input__help-text+.mg-c-input__error{margin-top:var(--mg-b-size-8)}@media screen and (max-width: 767px){:host(.mg-c-input){flex-direction:column}:host(.mg-c-input) .mg-c-input__title{width:100%;flex:0;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:var(--mg-b-size-4);text-align:left}:host(.mg-c-input) .mg-c-input__title ::slotted(mg-input-title){flex-shrink:1}}";
|
|
27
|
-
|
|
28
|
-
const MgInput = /*@__PURE__*/ proxyCustomElement(class MgInput extends HTMLElement {
|
|
29
|
-
constructor(registerHost) {
|
|
30
|
-
super();
|
|
31
|
-
if (registerHost !== false) {
|
|
32
|
-
this.__registerHost();
|
|
33
|
-
}
|
|
34
|
-
this.__attachShadow();
|
|
35
|
-
this.slotLabel = 'label';
|
|
36
|
-
this.slotError = 'error';
|
|
37
|
-
this.slotHelpText = 'help-text';
|
|
38
|
-
// style
|
|
39
|
-
this.classInput = 'mg-c-input';
|
|
40
|
-
this.classHasError = 'mg-c-input--has-error';
|
|
41
|
-
this.classLabelOnTop = 'mg-c-input--label-on-top';
|
|
42
|
-
this.classHasHeading = 'mg-c-input--has-heading';
|
|
43
|
-
this.classLabelBorderDisplay = 'mg-c-input--label-border-display';
|
|
44
|
-
this.classInputsOnBottom = 'mg-c-input--inputs-on-bottom';
|
|
45
|
-
/**
|
|
46
|
-
* Define if label is displayed on top
|
|
47
|
-
*/
|
|
48
|
-
this.labelOnTop = false;
|
|
49
|
-
/**
|
|
50
|
-
* Define if label is visible
|
|
51
|
-
*/
|
|
52
|
-
this.labelHide = false;
|
|
53
|
-
/**
|
|
54
|
-
* Define if label border is visible
|
|
55
|
-
* You must pair this mode with `labelOnTop`and `fieldset` class
|
|
56
|
-
*/
|
|
57
|
-
this.labelBorderDisplay = false;
|
|
58
|
-
/**
|
|
59
|
-
* Define tooltip position
|
|
60
|
-
*/
|
|
61
|
-
this.tooltipPosition = 'input';
|
|
62
|
-
/**
|
|
63
|
-
* Define if input is required
|
|
64
|
-
*/
|
|
65
|
-
this.required = false;
|
|
66
|
-
/**
|
|
67
|
-
* Display inputs after help-text and error message
|
|
68
|
-
*/
|
|
69
|
-
this.inputsOnBottom = false;
|
|
70
|
-
/**
|
|
71
|
-
* Define aria-describedby ids to link with
|
|
72
|
-
*/
|
|
73
|
-
this.ariaDescribedbyIDs = [];
|
|
74
|
-
/**
|
|
75
|
-
* Element is fieldset
|
|
76
|
-
*/
|
|
77
|
-
this.isFieldset = false;
|
|
78
|
-
/**
|
|
79
|
-
* Element is readonly
|
|
80
|
-
*/
|
|
81
|
-
this.isReadonly = false;
|
|
82
|
-
/**
|
|
83
|
-
* Element is disabled
|
|
84
|
-
*/
|
|
85
|
-
this.isDisabled = false;
|
|
86
|
-
/**
|
|
87
|
-
* Element is disabled
|
|
88
|
-
*/
|
|
89
|
-
this.isVerticalList = false;
|
|
90
|
-
/************
|
|
91
|
-
* Methods *
|
|
92
|
-
************/
|
|
93
|
-
/**
|
|
94
|
-
* Update element aria-describedby
|
|
95
|
-
* @param element - element to update
|
|
96
|
-
* @param ariaDescribedbyIDs - ariaDescribedbyIDs references
|
|
97
|
-
*/
|
|
98
|
-
this.updateElementAriaDescribedby = (element, ariaDescribedbyIDs) => {
|
|
99
|
-
if (ariaDescribedbyIDs.size > 0) {
|
|
100
|
-
element.setAttribute('aria-describedby', Array.from(ariaDescribedbyIDs).join(' '));
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
element.removeAttribute('aria-describedby');
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
/**
|
|
107
|
-
* Get tooltip node
|
|
108
|
-
* @returns mg-tooltip
|
|
109
|
-
*/
|
|
110
|
-
this.renderTooltip = () => (h("mg-tooltip", { identifier: `${this.identifier}-tooltip`, message: this.tooltip }, h("mg-icon", { icon: "info-circle" })));
|
|
111
|
-
/**
|
|
112
|
-
* Get input container element
|
|
113
|
-
* @returns ordered elements
|
|
114
|
-
*/
|
|
115
|
-
this.inputContainerElements = () => {
|
|
116
|
-
const elements = [
|
|
117
|
-
this.helptextMessageSlotElement && (h("div", { class: "mg-c-input__help-text" }, h("slot", { name: this.slotHelpText }))),
|
|
118
|
-
!this.isDisabled && this.errorMessage && (h("div", { class: "mg-c-input__error", "aria-live": "assertive" }, h("slot", { name: this.slotError }))),
|
|
119
|
-
];
|
|
120
|
-
const inputSlot = (h("div", { class: "mg-c-input__input" }, h("slot", null), this.tooltip && !this.labelOnTop && (this.tooltipPosition === 'input' || this.labelHide) && this.renderTooltip()));
|
|
121
|
-
if (this.inputsOnBottom) {
|
|
122
|
-
return [...elements, inputSlot];
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
return [inputSlot, ...elements];
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
watchIdentifier(newValue) {
|
|
130
|
-
if (!isValidString(newValue)) {
|
|
131
|
-
throw new Error(`<mg-input> prop "identifier" is required and must be a string. Passed value: ${toString(newValue)}.`);
|
|
132
|
-
}
|
|
133
|
-
else if (!isValideID(newValue)) {
|
|
134
|
-
console.error(`<mg-input> prop "identifier" value is invalid. Passed value: ${toString(newValue)}.`);
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
this.helpTextId = `${this.identifier}-help-text`;
|
|
138
|
-
this.helpTextErrorId = `${this.identifier}-error`;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
watchLabelOnTop(newValue) {
|
|
142
|
-
if (newValue) {
|
|
143
|
-
this.element.classList.add(this.classLabelOnTop);
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
this.element.classList.remove(this.classLabelOnTop);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
watchLabelConfig() {
|
|
150
|
-
if (this.labelHide && this.labelOnTop) {
|
|
151
|
-
throw new Error('<mg-input> prop "labelOnTop" must not be paired with the prop "labelHide".');
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
watchlabelHeading(newValue) {
|
|
155
|
-
if (this.isFieldset && this.labelOnTop && labelHeadings.includes(newValue)) {
|
|
156
|
-
this.element.classList.add(this.classHasHeading);
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
if ((!this.isFieldset && newValue !== undefined) || typeof newValue === 'string') {
|
|
160
|
-
throw new Error(`<mg-input> prop "labelHeading" must be used with a fieldset and be one of: ${labelHeadings.join(', ')}. Passed value: ${toString(newValue)}.`);
|
|
161
|
-
}
|
|
162
|
-
this.labelHeading = undefined;
|
|
163
|
-
this.element.classList.remove(this.classHasHeading);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
watchLabelBorderDisplay(newValue) {
|
|
167
|
-
if (this.isFieldset && this.labelOnTop && newValue) {
|
|
168
|
-
this.element.classList.add(this.classLabelBorderDisplay);
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
this.element.classList.remove(this.classLabelBorderDisplay);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
watchTooltipPosition(newValue) {
|
|
175
|
-
if (!tooltipPositions.includes(newValue)) {
|
|
176
|
-
throw new Error(`<mg-input> prop "tooltipPosition" must be one of: ${tooltipPositions.join(', ')}. Passed value: ${toString(newValue)}.`);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
watchErrorMessage(newValue) {
|
|
180
|
-
var _a;
|
|
181
|
-
if (newValue !== undefined) {
|
|
182
|
-
this.element.classList.add(this.classHasError);
|
|
183
|
-
this.renderErrorMessage();
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
this.element.classList.remove(this.classHasError);
|
|
187
|
-
(_a = this.errorMessageSlotElement) === null || _a === void 0 ? void 0 : _a.remove();
|
|
188
|
-
this.errorMessageSlotElement = undefined;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
watchHelpText(newValue) {
|
|
192
|
-
var _a;
|
|
193
|
-
if (isValidString(newValue) && !this.isReadonly) {
|
|
194
|
-
this.renderHelpText();
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
(_a = this.helptextMessageSlotElement) === null || _a === void 0 ? void 0 : _a.remove();
|
|
198
|
-
this.helptextMessageSlotElement = undefined;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
watchInputsOnBottom(newValue) {
|
|
202
|
-
if (newValue) {
|
|
203
|
-
this.element.classList.add(this.classInputsOnBottom);
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
this.element.classList.remove(this.classInputsOnBottom);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
watchAriaDescribedbyIDs() {
|
|
210
|
-
if (this.isReadonly) {
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
else if (typeof this.ariaDescribedbyIDs === 'string') {
|
|
214
|
-
this.ariaDescribedbyIDs = this.ariaDescribedbyIDs.split(' ');
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
else if (!(Array.isArray(this.ariaDescribedbyIDs) && this.ariaDescribedbyIDs.every(entry => typeof entry === 'string'))) {
|
|
218
|
-
this.ariaDescribedbyIDs = [];
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
// a11y IDs
|
|
222
|
-
const ariaDescribedbyIDs = new Set(this.ariaDescribedbyIDs);
|
|
223
|
-
// Help text
|
|
224
|
-
if (isValidString(this.helpText)) {
|
|
225
|
-
this.renderHelpText();
|
|
226
|
-
if (!ariaDescribedbyIDs.has(this.helpTextId))
|
|
227
|
-
ariaDescribedbyIDs.add(this.helpTextId);
|
|
228
|
-
}
|
|
229
|
-
// Error Message
|
|
230
|
-
if (isValidString(this.errorMessage)) {
|
|
231
|
-
this.renderErrorMessage();
|
|
232
|
-
if (!ariaDescribedbyIDs.has(this.helpTextErrorId))
|
|
233
|
-
ariaDescribedbyIDs.add(this.helpTextErrorId);
|
|
234
|
-
}
|
|
235
|
-
const inputs = this.element.querySelectorAll('input,select,textarea,[role="switch"]');
|
|
236
|
-
inputs.forEach((element) => {
|
|
237
|
-
this.updateElementAriaDescribedby(element, ariaDescribedbyIDs);
|
|
238
|
-
});
|
|
239
|
-
// use timeout to await for legend render for componentWillLoad hook
|
|
240
|
-
setTimeout(() => {
|
|
241
|
-
const legend = this.element.querySelector('legend');
|
|
242
|
-
if (legend !== null) {
|
|
243
|
-
this.updateElementAriaDescribedby(legend, ariaDescribedbyIDs);
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Component classes
|
|
249
|
-
*/
|
|
250
|
-
// eslint-disable-next-line @stencil-community/no-unused-watch
|
|
251
|
-
watchClass() {
|
|
252
|
-
if (!this.element.classList.contains(this.classInput)) {
|
|
253
|
-
this.element.classList.add(this.classInput);
|
|
254
|
-
}
|
|
255
|
-
this.isFieldset = this.element.classList.contains(classFieldset);
|
|
256
|
-
this.isReadonly = this.element.classList.contains(classReadonly);
|
|
257
|
-
this.isDisabled = this.element.classList.contains(classDisabled);
|
|
258
|
-
this.isVerticalList = this.element.classList.contains(classVerticalList);
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* Trigger label update
|
|
262
|
-
*/
|
|
263
|
-
// eslint-disable-next-line @stencil-community/no-unused-watch
|
|
264
|
-
watchLabel() {
|
|
265
|
-
if (!isValidString(this.label)) {
|
|
266
|
-
throw new Error(`<mg-input> prop "label" is required and must be a string. Passed value: ${toString(this.label)}.`);
|
|
267
|
-
}
|
|
268
|
-
else {
|
|
269
|
-
this.watchAriaDescribedbyIDs();
|
|
270
|
-
this.renderLabel();
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Render input label
|
|
275
|
-
*/
|
|
276
|
-
renderLabel() {
|
|
277
|
-
let labelSlotElement = this.element.querySelector(`[slot=${this.slotLabel}]`);
|
|
278
|
-
// first remove previous labelslot if exist
|
|
279
|
-
labelSlotElement === null || labelSlotElement === void 0 ? void 0 : labelSlotElement.remove();
|
|
280
|
-
// create title element
|
|
281
|
-
labelSlotElement = document.createElement('mg-input-title');
|
|
282
|
-
[
|
|
283
|
-
['slot', this.slotLabel],
|
|
284
|
-
['identifier', this.identifier],
|
|
285
|
-
['readonly', this.isReadonly.toString()],
|
|
286
|
-
['required', ((this.required && !this.isDisabled) || false).toString()],
|
|
287
|
-
['is-legend', this.isFieldset.toString()],
|
|
288
|
-
].forEach(([attr, val]) => {
|
|
289
|
-
labelSlotElement.setAttribute(attr, val);
|
|
290
|
-
});
|
|
291
|
-
// create label element
|
|
292
|
-
if (labelHeadings.includes(this.labelHeading)) {
|
|
293
|
-
let label = this.element.shadowRoot.querySelector(this.labelHeading);
|
|
294
|
-
if (label === null) {
|
|
295
|
-
label = document.createElement(this.labelHeading);
|
|
296
|
-
label.classList.add('mg-c-input-title__text');
|
|
297
|
-
labelSlotElement.appendChild(label);
|
|
298
|
-
}
|
|
299
|
-
label.textContent = this.label;
|
|
300
|
-
}
|
|
301
|
-
else {
|
|
302
|
-
labelSlotElement.textContent = this.label;
|
|
303
|
-
}
|
|
304
|
-
this.element.appendChild(labelSlotElement);
|
|
305
|
-
// update aria-describedby
|
|
306
|
-
this.watchAriaDescribedbyIDs();
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* Render error message
|
|
310
|
-
*/
|
|
311
|
-
renderErrorMessage() {
|
|
312
|
-
this.errorMessageSlotElement = this.element.querySelector(`[slot=${this.slotError}]`);
|
|
313
|
-
if (this.errorMessageSlotElement === null) {
|
|
314
|
-
this.errorMessageSlotElement = document.createElement('div');
|
|
315
|
-
this.errorMessageSlotElement.setAttribute('slot', this.slotError);
|
|
316
|
-
this.element.appendChild(this.errorMessageSlotElement);
|
|
317
|
-
}
|
|
318
|
-
this.errorMessageSlotElement.setAttribute('id', this.helpTextErrorId);
|
|
319
|
-
this.errorMessageSlotElement.innerHTML = this.errorMessage;
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* Render help text message
|
|
323
|
-
*/
|
|
324
|
-
renderHelpText() {
|
|
325
|
-
this.helptextMessageSlotElement = this.element.querySelector(`[slot=${this.slotHelpText}]`);
|
|
326
|
-
if (this.helptextMessageSlotElement === null) {
|
|
327
|
-
this.helptextMessageSlotElement = document.createElement('div');
|
|
328
|
-
this.helptextMessageSlotElement.setAttribute('slot', this.slotHelpText);
|
|
329
|
-
this.element.appendChild(this.helptextMessageSlotElement);
|
|
330
|
-
}
|
|
331
|
-
this.helptextMessageSlotElement.setAttribute('id', this.helpTextId);
|
|
332
|
-
this.helptextMessageSlotElement.innerHTML = this.helpText;
|
|
333
|
-
}
|
|
334
|
-
/*************
|
|
335
|
-
* Lifecycle *
|
|
336
|
-
*************/
|
|
337
|
-
/**
|
|
338
|
-
* Check if component props are well configured on init
|
|
339
|
-
*/
|
|
340
|
-
componentWillLoad() {
|
|
341
|
-
this.watchIdentifier(this.identifier);
|
|
342
|
-
this.watchLabel();
|
|
343
|
-
this.watchClass();
|
|
344
|
-
this.watchLabelOnTop(this.labelOnTop);
|
|
345
|
-
this.watchLabelConfig();
|
|
346
|
-
this.watchTooltipPosition(this.tooltipPosition);
|
|
347
|
-
this.watchHelpText(this.helpText);
|
|
348
|
-
this.watchErrorMessage(this.errorMessage);
|
|
349
|
-
this.watchInputsOnBottom(this.inputsOnBottom);
|
|
350
|
-
this.watchlabelHeading(this.labelHeading);
|
|
351
|
-
this.watchLabelBorderDisplay(this.labelBorderDisplay);
|
|
352
|
-
}
|
|
353
|
-
/**
|
|
354
|
-
* Validate slots
|
|
355
|
-
*/
|
|
356
|
-
componentDidLoad() {
|
|
357
|
-
this.watchAriaDescribedbyIDs();
|
|
358
|
-
if (!this.isReadonly && !this.isFieldset && this.element.querySelector(`#${this.identifier}`) === null) {
|
|
359
|
-
throw new Error(`<mg-input> "identifier" prop has no target for id: ${this.identifier}. Add an id to the targeted input.`);
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
/**
|
|
363
|
-
* Render
|
|
364
|
-
* @returns HTML Element
|
|
365
|
-
*/
|
|
366
|
-
render() {
|
|
367
|
-
const isGroup = this.isFieldset && !this.isReadonly;
|
|
368
|
-
return (h(Host, { key: 'fbab18280a709407c83f324127e8de6cbb05fe7c', class: this.element.classList.toString(), role: isGroup ? 'group' : undefined, "aria-labelledby": isGroup ? `${this.identifier}-title` : undefined }, h("div", { key: 'ac0924c244b9fa87d02e659a5710ee93d12a202f', class: { 'mg-c-input__title': true, 'mg-u-visually-hidden': this.labelHide } }, h("slot", { key: 'c825af33ba0a6c209d02d6487422347f7d8acfed', name: this.slotLabel }), this.tooltip && (this.tooltipPosition === 'label' || this.labelOnTop) && !this.labelHide && this.renderTooltip()), h("div", { key: '805e1eedfdea132f3ea4fd11da761810a3d7c939', class: "mg-c-input__input-container" }, this.inputContainerElements())));
|
|
369
|
-
}
|
|
370
|
-
get element() { return this; }
|
|
371
|
-
static get watchers() { return {
|
|
372
|
-
"identifier": ["watchIdentifier", "watchAriaDescribedbyIDs"],
|
|
373
|
-
"labelOnTop": ["watchLabelOnTop", "watchLabelConfig"],
|
|
374
|
-
"labelHide": ["watchLabelConfig"],
|
|
375
|
-
"labelHeading": ["watchlabelHeading"],
|
|
376
|
-
"labelBorderDisplay": ["watchLabelBorderDisplay"],
|
|
377
|
-
"tooltipPosition": ["watchTooltipPosition"],
|
|
378
|
-
"errorMessage": ["watchErrorMessage", "watchAriaDescribedbyIDs"],
|
|
379
|
-
"helpText": ["watchHelpText", "watchAriaDescribedbyIDs"],
|
|
380
|
-
"inputsOnBottom": ["watchInputsOnBottom"],
|
|
381
|
-
"ariaDescribedbyIDs": ["watchAriaDescribedbyIDs"],
|
|
382
|
-
"class": ["watchClass", "watchLabel"],
|
|
383
|
-
"label": ["watchLabel"],
|
|
384
|
-
"required": ["watchLabel"],
|
|
385
|
-
"isReadonly": ["watchLabel"],
|
|
386
|
-
"isFieldset": ["watchLabel"]
|
|
387
|
-
}; }
|
|
388
|
-
static get style() { return mgInputCss; }
|
|
389
|
-
}, [257, "mg-input", {
|
|
390
|
-
"identifier": [1],
|
|
391
|
-
"label": [1],
|
|
392
|
-
"labelOnTop": [4, "label-on-top"],
|
|
393
|
-
"labelHide": [4, "label-hide"],
|
|
394
|
-
"labelHeading": [1025, "label-heading"],
|
|
395
|
-
"labelBorderDisplay": [4, "label-border-display"],
|
|
396
|
-
"tooltip": [1],
|
|
397
|
-
"tooltipPosition": [1, "tooltip-position"],
|
|
398
|
-
"required": [4],
|
|
399
|
-
"errorMessage": [1, "error-message"],
|
|
400
|
-
"helpText": [1, "help-text"],
|
|
401
|
-
"inputsOnBottom": [4, "inputs-on-bottom"],
|
|
402
|
-
"ariaDescribedbyIDs": [1025, "aria-describedby-i-ds"],
|
|
403
|
-
"isFieldset": [32],
|
|
404
|
-
"isReadonly": [32],
|
|
405
|
-
"isDisabled": [32],
|
|
406
|
-
"isVerticalList": [32]
|
|
407
|
-
}, undefined, {
|
|
408
|
-
"identifier": ["watchIdentifier", "watchAriaDescribedbyIDs"],
|
|
409
|
-
"labelOnTop": ["watchLabelOnTop", "watchLabelConfig"],
|
|
410
|
-
"labelHide": ["watchLabelConfig"],
|
|
411
|
-
"labelHeading": ["watchlabelHeading"],
|
|
412
|
-
"labelBorderDisplay": ["watchLabelBorderDisplay"],
|
|
413
|
-
"tooltipPosition": ["watchTooltipPosition"],
|
|
414
|
-
"errorMessage": ["watchErrorMessage", "watchAriaDescribedbyIDs"],
|
|
415
|
-
"helpText": ["watchHelpText", "watchAriaDescribedbyIDs"],
|
|
416
|
-
"inputsOnBottom": ["watchInputsOnBottom"],
|
|
417
|
-
"ariaDescribedbyIDs": ["watchAriaDescribedbyIDs"],
|
|
418
|
-
"class": ["watchClass", "watchLabel"],
|
|
419
|
-
"label": ["watchLabel"],
|
|
420
|
-
"required": ["watchLabel"],
|
|
421
|
-
"isReadonly": ["watchLabel"],
|
|
422
|
-
"isFieldset": ["watchLabel"]
|
|
423
|
-
}]);
|
|
424
|
-
function defineCustomElement() {
|
|
425
|
-
if (typeof customElements === "undefined") {
|
|
426
|
-
return;
|
|
427
|
-
}
|
|
428
|
-
const components = ["mg-input", "mg-icon", "mg-input-title", "mg-tooltip", "mg-tooltip-content"];
|
|
429
|
-
components.forEach(tagName => { switch (tagName) {
|
|
430
|
-
case "mg-input":
|
|
431
|
-
if (!customElements.get(tagName)) {
|
|
432
|
-
customElements.define(tagName, MgInput);
|
|
433
|
-
}
|
|
434
|
-
break;
|
|
435
|
-
case "mg-icon":
|
|
436
|
-
if (!customElements.get(tagName)) {
|
|
437
|
-
defineCustomElement$4();
|
|
438
|
-
}
|
|
439
|
-
break;
|
|
440
|
-
case "mg-input-title":
|
|
441
|
-
if (!customElements.get(tagName)) {
|
|
442
|
-
defineCustomElement$3();
|
|
443
|
-
}
|
|
444
|
-
break;
|
|
445
|
-
case "mg-tooltip":
|
|
446
|
-
if (!customElements.get(tagName)) {
|
|
447
|
-
defineCustomElement$2();
|
|
448
|
-
}
|
|
449
|
-
break;
|
|
450
|
-
case "mg-tooltip-content":
|
|
451
|
-
if (!customElements.get(tagName)) {
|
|
452
|
-
defineCustomElement$1();
|
|
453
|
-
}
|
|
454
|
-
break;
|
|
455
|
-
} });
|
|
456
|
-
}
|
|
457
|
-
defineCustomElement();
|
|
458
|
-
|
|
459
|
-
export { MgInput as M, classDisabled as a, classFieldset as b, classReadonly as c, defineCustomElement as d, classDisplayCharacterLeft as e, classVerticalList as f, widths as w };
|
|
1
|
+
import{transformTag as t,proxyCustomElement as i,HTMLElement as e,h as s,Host as n}from"@stencil/core/internal/client";import{i as a,t as o,a as r}from"./index2.js";import{l as h,t as m,a as l,c as p,b as g,d as c}from"./mg-input.conf.js";import{d as u}from"./mg-icon2.js";import{d}from"./mg-input-title2.js";import{d as b}from"./mg-tooltip2.js";import{d as _}from"./mg-tooltip-content2.js";const f=i(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.slotLabel="label",this.slotError="error",this.slotHelpText="help-text",this.classInput="mg-c-input",this.classHasError="mg-c-input--has-error",this.classLabelOnTop="mg-c-input--label-on-top",this.classHasHeading="mg-c-input--has-heading",this.classLabelBorderDisplay="mg-c-input--label-border-display",this.classInputsOnBottom="mg-c-input--inputs-on-bottom",this.labelOnTop=!1,this.labelHide=!1,this.labelBorderDisplay=!1,this.tooltipPosition="input",this.required=!1,this.inputsOnBottom=!1,this.ariaDescribedbyIDs=[],this.isFieldset=!1,this.isReadonly=!1,this.isDisabled=!1,this.isVerticalList=!1,this.updateElementAriaDescribedby=(t,i)=>{i.size>0?t.setAttribute("aria-describedby",Array.from(i).join(" ")):t.removeAttribute("aria-describedby")},this.renderTooltip=()=>s("mg-tooltip",{identifier:`${this.identifier}-tooltip`,message:this.tooltip},s("mg-icon",{icon:"info-circle"})),this.inputContainerElements=()=>{const t=[this.helptextMessageSlotElement&&s("div",{class:"mg-c-input__help-text"},s("slot",{name:this.slotHelpText})),!this.isDisabled&&this.errorMessage&&s("div",{class:"mg-c-input__error","aria-live":"assertive"},s("slot",{name:this.slotError}))],i=s("div",{class:"mg-c-input__input"},s("slot",null),this.tooltip&&!this.labelOnTop&&("input"===this.tooltipPosition||this.labelHide)&&this.renderTooltip());return this.inputsOnBottom?[...t,i]:[i,...t]}}watchIdentifier(t){if(!a(t))throw new Error(`<mg-input> prop "identifier" is required and must be a string. Passed value: ${o(t)}.`);r(t)?(this.helpTextId=`${this.identifier}-help-text`,this.helpTextErrorId=`${this.identifier}-error`):console.error(`<mg-input> prop "identifier" value is invalid. Passed value: ${o(t)}.`)}watchLabelOnTop(t){t?this.element.classList.add(this.classLabelOnTop):this.element.classList.remove(this.classLabelOnTop)}watchLabelConfig(){if(this.labelHide&&this.labelOnTop)throw new Error('<mg-input> prop "labelOnTop" must not be paired with the prop "labelHide".')}watchlabelHeading(t){if(this.isFieldset&&this.labelOnTop&&h.includes(t))this.element.classList.add(this.classHasHeading);else{if(!this.isFieldset&&void 0!==t||"string"==typeof t)throw new Error(`<mg-input> prop "labelHeading" must be used with a fieldset and be one of: ${h.join(", ")}. Passed value: ${o(t)}.`);this.labelHeading=void 0,this.element.classList.remove(this.classHasHeading)}}watchLabelBorderDisplay(t){this.isFieldset&&this.labelOnTop&&t?this.element.classList.add(this.classLabelBorderDisplay):this.element.classList.remove(this.classLabelBorderDisplay)}watchTooltipPosition(t){if(!m.includes(t))throw new Error(`<mg-input> prop "tooltipPosition" must be one of: ${m.join(", ")}. Passed value: ${o(t)}.`)}watchErrorMessage(t){var i;void 0!==t?(this.element.classList.add(this.classHasError),this.renderErrorMessage()):(this.element.classList.remove(this.classHasError),null===(i=this.errorMessageSlotElement)||void 0===i||i.remove(),this.errorMessageSlotElement=void 0)}watchHelpText(t){var i;a(t)&&!this.isReadonly?this.renderHelpText():(null===(i=this.helptextMessageSlotElement)||void 0===i||i.remove(),this.helptextMessageSlotElement=void 0)}watchInputsOnBottom(t){t?this.element.classList.add(this.classInputsOnBottom):this.element.classList.remove(this.classInputsOnBottom)}watchAriaDescribedbyIDs(){if(this.isReadonly)return;if("string"==typeof this.ariaDescribedbyIDs)return void(this.ariaDescribedbyIDs=this.ariaDescribedbyIDs.split(" "));if(!Array.isArray(this.ariaDescribedbyIDs)||!this.ariaDescribedbyIDs.every((t=>"string"==typeof t)))return void(this.ariaDescribedbyIDs=[]);const t=new Set(this.ariaDescribedbyIDs);a(this.helpText)&&(this.renderHelpText(),t.has(this.helpTextId)||t.add(this.helpTextId)),a(this.errorMessage)&&(this.renderErrorMessage(),t.has(this.helpTextErrorId)||t.add(this.helpTextErrorId)),this.element.querySelectorAll('input,select,textarea,[role="switch"]').forEach((i=>{this.updateElementAriaDescribedby(i,t)})),setTimeout((()=>{const i=this.element.querySelector("legend");null!==i&&this.updateElementAriaDescribedby(i,t)}))}watchClass(){this.element.classList.contains(this.classInput)||this.element.classList.add(this.classInput),this.isFieldset=this.element.classList.contains(l),this.isReadonly=this.element.classList.contains(p),this.isDisabled=this.element.classList.contains(g),this.isVerticalList=this.element.classList.contains(c)}watchLabel(){if(!a(this.label))throw new Error(`<mg-input> prop "label" is required and must be a string. Passed value: ${o(this.label)}.`);this.watchAriaDescribedbyIDs(),this.renderLabel()}renderLabel(){let t=this.element.querySelector(`[slot=${this.slotLabel}]`);if(null==t||t.remove(),t=document.createElement("mg-input-title"),[["slot",this.slotLabel],["identifier",this.identifier],["readonly",this.isReadonly.toString()],["required",(this.required&&!this.isDisabled||!1).toString()],["is-legend",this.isFieldset.toString()]].forEach((([i,e])=>{t.setAttribute(i,e)})),h.includes(this.labelHeading)){let i=this.element.shadowRoot.querySelector(this.labelHeading);null===i&&(i=document.createElement(this.labelHeading),i.classList.add("mg-c-input-title__text"),t.appendChild(i)),i.textContent=this.label}else t.textContent=this.label;this.element.appendChild(t),this.watchAriaDescribedbyIDs()}renderErrorMessage(){this.errorMessageSlotElement=this.element.querySelector(`[slot=${this.slotError}]`),null===this.errorMessageSlotElement&&(this.errorMessageSlotElement=document.createElement("div"),this.errorMessageSlotElement.setAttribute("slot",this.slotError),this.element.appendChild(this.errorMessageSlotElement)),this.errorMessageSlotElement.setAttribute("id",this.helpTextErrorId),this.errorMessageSlotElement.innerHTML=this.errorMessage}renderHelpText(){this.helptextMessageSlotElement=this.element.querySelector(`[slot=${this.slotHelpText}]`),null===this.helptextMessageSlotElement&&(this.helptextMessageSlotElement=document.createElement("div"),this.helptextMessageSlotElement.setAttribute("slot",this.slotHelpText),this.element.appendChild(this.helptextMessageSlotElement)),this.helptextMessageSlotElement.setAttribute("id",this.helpTextId),this.helptextMessageSlotElement.innerHTML=this.helpText}componentWillLoad(){this.watchIdentifier(this.identifier),this.watchLabel(),this.watchClass(),this.watchLabelOnTop(this.labelOnTop),this.watchLabelConfig(),this.watchTooltipPosition(this.tooltipPosition),this.watchHelpText(this.helpText),this.watchErrorMessage(this.errorMessage),this.watchInputsOnBottom(this.inputsOnBottom),this.watchlabelHeading(this.labelHeading),this.watchLabelBorderDisplay(this.labelBorderDisplay)}componentDidLoad(){if(this.watchAriaDescribedbyIDs(),!this.isReadonly&&!this.isFieldset&&null===this.element.querySelector(`#${this.identifier}`))throw new Error(`<mg-input> "identifier" prop has no target for id: ${this.identifier}. Add an id to the targeted input.`)}render(){const t=this.isFieldset&&!this.isReadonly;return s(n,{key:"a1db280d19eead30e7ae27eb6e395e58b35baa63",class:this.element.classList.toString(),role:t?"group":void 0,"aria-labelledby":t?`${this.identifier}-title`:void 0},s("div",{key:"282f5776a9269272507f3e00f5dce690c9a604f4",class:{"mg-c-input__title":!0,"mg-u-visually-hidden":this.labelHide}},s("slot",{key:"b122979a159912d9c34bb024021257f9f88e6ff4",name:this.slotLabel}),this.tooltip&&("label"===this.tooltipPosition||this.labelOnTop)&&!this.labelHide&&this.renderTooltip()),s("div",{key:"098d3a7329fa0b5f37534fdf2df89e0468dcbe2a",class:"mg-c-input__input-container"},this.inputContainerElements()))}get element(){return this}static get watchers(){return{identifier:[{watchIdentifier:0},{watchAriaDescribedbyIDs:0}],labelOnTop:[{watchLabelOnTop:0},{watchLabelConfig:0}],labelHide:[{watchLabelConfig:0}],labelHeading:[{watchlabelHeading:0}],labelBorderDisplay:[{watchLabelBorderDisplay:0}],tooltipPosition:[{watchTooltipPosition:0}],errorMessage:[{watchErrorMessage:0},{watchAriaDescribedbyIDs:0}],helpText:[{watchHelpText:0},{watchAriaDescribedbyIDs:0}],inputsOnBottom:[{watchInputsOnBottom:0}],ariaDescribedbyIDs:[{watchAriaDescribedbyIDs:0}],class:[{watchClass:0},{watchLabel:0}],label:[{watchLabel:0}],required:[{watchLabel:0}],isReadonly:[{watchLabel:0}],isFieldset:[{watchLabel:0}]}}static get style(){return".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-input__input mg-icon,.mg-c-input__error mg-icon{display:flex}.mg-c-input{display:flex;min-height:var(--mg-b-size-min-height);align-items:flex-start}.mg-c-input__input-container{width:100%;min-height:var(--mg-b-size-min-height)}.mg-c-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-b-size-16);height:var(--mg-b-size-16);margin-left:var(--mg-b-size-8)}@media print{.mg-c-input__input-container mg-tooltip{display:none}}.mg-c-input__input{display:flex;min-height:var(--mg-b-size-min-height);align-items:center;justify-content:start}.mg-c-input__input mg-tooltip{align-self:baseline;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__input ::slotted(.mg-c-input__button-toggle:disabled){opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input__title{display:flex;width:var(--mg-c-input-title-width, auto);flex-shrink:0;align-items:baseline;justify-content:flex-end;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);margin-right:var(--mg-c-input-title-horizontal-space, var(--mg-b-size-8));text-align:right}.mg-c-input__title slot[name=label]+mg-tooltip{margin-left:var(--mg-b-size-4)}.mg-c-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-c-input__error{display:inline-block;padding:var(--mg-b-size-4) var(--mg-b-size-8);border-radius:var(--mg-b-size-radius);background:var(--mg-c-input-error-color-background);color:var(--mg-b-color-danger)}.mg-c-input__error ::slotted(*),.mg-c-input__help-text ::slotted(*){font-size:var(--mg-b-font-size-small);text-align:start}:host .mg-c-input__input+.mg-c-input__error,:host .mg-c-input__input+.mg-c-input__help-text{margin-top:var(--mg-b-size-4)}:host(.mg-c-input.mg-c-input--readonly) .mg-c-input__input mg-tooltip{margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2)}:host(.mg-c-input){display:flex;margin-bottom:var(--mg-c-input-margin-bottom, 0)}:host(.mg-c-input.mg-c-input--checkbox) .mg-c-input__input,:host(.mg-c-input.mg-c-input--toggle) .mg-c-input__input,:host(.mg-c-input.mg-c-input--radio) .mg-c-input__input{min-height:unset;align-items:flex-start}:host(.mg-c-input.mg-c-input--checkbox,.mg-c-input.mg-c-input--radio) .mg-c-input__input{min-height:unset}:host(.mg-c-input.mg-c-input--fieldset:not(.mg-c-input--checkbox-multi,.mg-c-input--readonly)) .mg-c-input__input-container mg-tooltip{margin-left:var(--mg-b-size-32)}:host(.mg-c-input.mg-c-input--toggle) .mg-c-input__input-container{min-width:0;flex:1}:host(.mg-c-input.mg-c-input--label-on-top){flex-direction:column}:host(.mg-c-input.mg-c-input--label-on-top) .mg-c-input__title{width:100%;flex:0;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:var(--mg-b-size-4);text-align:left}:host(.mg-c-input.mg-c-input--label-on-top) .mg-c-input__title ::slotted(mg-input-title){flex-shrink:1}:host(.mg-c-input.mg-c-input--inputs-on-bottom) .mg-c-input__help-text{margin-top:var(--mg-b-size-4);margin-bottom:var(--mg-b-size-12)}:host(.mg-c-input.mg-c-input--inputs-on-bottom) .mg-c-input__error{margin-bottom:var(--mg-b-size-20)}:host(.mg-c-input.mg-c-input--inputs-on-bottom.mg-c-input--fieldset){--mg-c-input-title-width:var(--mg-c-form-inputs-title-width, calc(28 * var(--mg-b-size-8)));--mg-c-input-title-horizontal-space:var(--mg-b-size-32)}:host(.mg-c-input.mg-c-input--inputs-on-bottom.mg-c-input--fieldset) ::slotted(*){--mg-c-input-margin-bottom:var(--mg-b-size-16)}:host(.mg-c-input.mg-c-input--label-border-display) .mg-c-input__title{border-bottom:var(--mg-b-size-border) solid var(--mg-c-divider-color-background)}:host(.mg-c-input.mg-c-input--has-heading) .mg-c-input__title{margin-bottom:0}:host(.mg-c-input.mg-c-input--has-heading) .mg-c-input-title__text{margin-top:var(--mg-b-font-size-8);margin-bottom:var(--mg-b-font-size-8)}:host(.mg-c-input.mg-c-input--has-heading) .mg-c-input__help-text,:host(.mg-c-input.mg-c-input--has-heading) .mg-c-input__error{margin-top:0;margin-bottom:var(--mg-b-size-4)}:host(.mg-c-input.mg-c-input--has-heading) .mg-c-input__help-text+.mg-c-input__input,:host(.mg-c-input.mg-c-input--has-heading) .mg-c-input__error+.mg-c-input__input{margin-top:var(--mg-b-size-12)}:host(.mg-c-input.mg-c-input--has-heading) .mg-c-input__help-text+.mg-c-input__error{margin-top:var(--mg-b-size-4)}:host(.mg-c-input.mg-c-input--has-heading.mg-c-input--label-border-display) .mg-c-input__title{margin-bottom:var(--mg-b-size-16)}:host(.mg-c-input.mg-c-input--has-heading.mg-c-input--label-border-display) .mg-c-input__help-text,:host(.mg-c-input.mg-c-input--has-heading.mg-c-input--label-border-display) .mg-c-input__error{margin-bottom:0}:host(.mg-c-input.mg-c-input--has-heading.mg-c-input--label-border-display) .mg-c-input__help-text+.mg-c-input__input,:host(.mg-c-input.mg-c-input--has-heading.mg-c-input--label-border-display) .mg-c-input__error+.mg-c-input__input{margin-top:var(--mg-b-size-16)}:host(.mg-c-input.mg-c-input--has-heading.mg-c-input--label-border-display) .mg-c-input__help-text+.mg-c-input__error{margin-top:var(--mg-b-size-8)}@media screen and (max-width: 767px){:host(.mg-c-input){flex-direction:column}:host(.mg-c-input) .mg-c-input__title{width:100%;flex:0;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:var(--mg-b-size-4);text-align:left}:host(.mg-c-input) .mg-c-input__title ::slotted(mg-input-title){flex-shrink:1}}"}},[257,"mg-input",{identifier:[1],label:[1],labelOnTop:[4,"label-on-top"],labelHide:[4,"label-hide"],labelHeading:[1025,"label-heading"],labelBorderDisplay:[4,"label-border-display"],tooltip:[1],tooltipPosition:[1,"tooltip-position"],required:[4],errorMessage:[1,"error-message"],helpText:[1,"help-text"],inputsOnBottom:[4,"inputs-on-bottom"],ariaDescribedbyIDs:[1025,"aria-describedby-i-ds"],isFieldset:[32],isReadonly:[32],isDisabled:[32],isVerticalList:[32]},void 0,{identifier:[{watchIdentifier:0},{watchAriaDescribedbyIDs:0}],labelOnTop:[{watchLabelOnTop:0},{watchLabelConfig:0}],labelHide:[{watchLabelConfig:0}],labelHeading:[{watchlabelHeading:0}],labelBorderDisplay:[{watchLabelBorderDisplay:0}],tooltipPosition:[{watchTooltipPosition:0}],errorMessage:[{watchErrorMessage:0},{watchAriaDescribedbyIDs:0}],helpText:[{watchHelpText:0},{watchAriaDescribedbyIDs:0}],inputsOnBottom:[{watchInputsOnBottom:0}],ariaDescribedbyIDs:[{watchAriaDescribedbyIDs:0}],class:[{watchClass:0},{watchLabel:0}],label:[{watchLabel:0}],required:[{watchLabel:0}],isReadonly:[{watchLabel:0}],isFieldset:[{watchLabel:0}]}]);function w(){"undefined"!=typeof customElements&&["mg-input","mg-icon","mg-input-title","mg-tooltip","mg-tooltip-content"].forEach((i=>{switch(i){case"mg-input":customElements.get(t(i))||customElements.define(t(i),f);break;case"mg-icon":customElements.get(t(i))||u();break;case"mg-input-title":customElements.get(t(i))||d();break;case"mg-tooltip":customElements.get(t(i))||b();break;case"mg-tooltip-content":customElements.get(t(i))||_()}}))}w();export{f as M,w as d}
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const MgItemMore = MgItemMore$1;
|
|
4
|
-
const defineCustomElement = defineCustomElement$1;
|
|
5
|
-
|
|
6
|
-
export { MgItemMore, defineCustomElement };
|
|
1
|
+
import{M as m,d as o}from"./mg-item-more2.js";const r=m,s=o;export{r as MgItemMore,s as defineCustomElement}
|