@mgdis/mg-components 5.28.0 → 5.28.2
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-d8721674.js → index-792fd1c1.js} +48 -47
- package/dist/cjs/index-792fd1c1.js.map +1 -0
- package/dist/cjs/mg-action-more_36.cjs.entry.js +91 -91
- package/dist/cjs/mg-action-more_36.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-loader.cjs.entry.js +2 -2
- package/dist/collection/components/atoms/mg-button/mg-button.js +2 -2
- package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
- package/dist/components/index.es.js +41 -40
- package/dist/components/index.es.js.map +1 -1
- package/dist/components/index2.js +2 -2
- package/dist/components/mg-action-more.js +2 -2
- package/dist/components/mg-badge2.js +3 -3
- package/dist/components/mg-button2.js +5 -5
- package/dist/components/mg-button2.js.map +1 -1
- package/dist/components/mg-card2.js +2 -2
- package/dist/components/mg-details.js +2 -2
- package/dist/components/mg-form.js +3 -3
- package/dist/components/mg-icon2.js +2 -2
- package/dist/components/mg-illustrated-message.js +2 -2
- package/dist/components/mg-input-checkbox.js +4 -4
- package/dist/components/mg-input-date.js +11 -11
- package/dist/components/mg-input-numeric.js +5 -5
- package/dist/components/mg-input-password.js +3 -3
- package/dist/components/mg-input-radio.js +4 -4
- package/dist/components/mg-input-select2.js +6 -6
- package/dist/components/mg-input-text2.js +6 -6
- package/dist/components/mg-input-textarea.js +6 -6
- package/dist/components/mg-input-title2.js +2 -2
- package/dist/components/mg-input-toggle.js +4 -4
- package/dist/components/mg-input2.js +3 -3
- package/dist/components/mg-item-more2.js +3 -3
- package/dist/components/mg-loader.js +2 -2
- package/dist/components/mg-menu-item2.js +5 -5
- package/dist/components/mg-message.js +3 -3
- package/dist/components/mg-modal.js +6 -6
- package/dist/components/mg-pagination2.js +2 -2
- package/dist/components/mg-panel.js +4 -4
- package/dist/components/mg-popover-content2.js +3 -3
- package/dist/components/mg-popover2.js +3 -3
- package/dist/components/mg-skip-links.js +2 -2
- package/dist/components/mg-tabs.js +6 -6
- package/dist/components/mg-tag.js +3 -3
- package/dist/components/mg-tooltip2.js +6 -6
- package/dist/esm/{index-817d7645.js → index-2667a5c4.js} +43 -42
- package/dist/esm/index-2667a5c4.js.map +1 -0
- package/dist/esm/mg-action-more_36.entry.js +91 -91
- package/dist/esm/mg-action-more_36.entry.js.map +1 -1
- package/dist/esm/mg-loader.entry.js +2 -2
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/{p-ef541188.entry.js → p-56cce4ec.entry.js} +2 -2
- package/dist/mg-components/p-56cce4ec.entry.js.map +1 -0
- package/dist/mg-components/{p-c4207303.entry.js → p-64eaef9e.entry.js} +2 -2
- package/dist/mg-components/p-7cda52b6.js +2 -0
- package/dist/mg-components/p-7cda52b6.js.map +1 -0
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +1 -1
- package/dist/types/components.d.ts +2 -2
- package/ide/intellij/web-types.json +4 -4
- package/ide/vscode/html-custom-data.json +3 -3
- package/package.json +26 -27
- package/dist/cjs/index-d8721674.js.map +0 -1
- package/dist/esm/index-817d7645.js.map +0 -1
- package/dist/mg-components/p-eb6ec303.js +0 -2
- package/dist/mg-components/p-eb6ec303.js.map +0 -1
- package/dist/mg-components/p-ef541188.entry.js.map +0 -1
- /package/dist/mg-components/{p-c4207303.entry.js.map → p-64eaef9e.entry.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"mg-button2.js","mappings":";;;;AAAA;;;AAGO,MAAM,QAAQ,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAU;;ACHpH,MAAM,WAAW,GAAG,+tNAA+tN,CAAC;AACpvN,uBAAe,WAAW;;MCWb,QAAQ;;;;;;;;;QAKX,qBAAgB,GAAG,IAAI,CAAC;QACf,kBAAa,GAAG,uBAAuB,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AE,IAAI,EAAE,CAAC,CAAC,CAAC;iBAC3F,CAAC,CAAC;aACJ;SACF,CAAC,CAAC;KACJ;;;;;IAMD,MAAM;;QACJ,QACE,EAAC,IAAI,qDACH,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,EACX,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,gBACH,IAAI,CAAC,SAAS,gBACd,IAAI,CAAC,KAAK,mBACP,MAAA,IAAI,CAAC,QAAQ,0CAAE,QAAQ,EAAE,EACxC,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,SAAS,EAAE,IAAI,CAAC,aAAa,IAE7B,4DAAK,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,UAAU,IACzD,IAAI,CAAC,OAAO,IAAI,gEAAS,IAAI,EAAC,QAAQ,EAAC,IAAI,SAAW,EACvD,4DAAK,KAAK,EAAC,sBAAsB,IAC/B,8DAAa,CACT,CACF,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["ClassList","isValidString","nextTick"],"sources":["src/components/atoms/mg-button/mg-button.conf.ts","../styles/dist/components/mg-button.css?tag=mg-button&encapsulation=shadow","src/components/atoms/mg-button/mg-button.tsx"],"sourcesContent":["/**\n * List of all possibles variants\n */\nexport const variants = ['primary', 'secondary', 'danger', 'danger-alt', 'info', 'flat', 'success', 'link'] as const;\n\n/**\n * VariantType type from button variants\n */\nexport type VariantType = (typeof variants)[number];\n\n/**\n * List of all possibles button types\n */\nexport const buttonTypes = ['button', 'submit', 'reset'] as const;\n\n/**\n * ButtonType type from buttonTypes\n */\nexport type ButtonType = (typeof buttonTypes)[number];\n",":host{display:inline-block;max-width:100%;vertical-align:middle}:host(:hover) .mg-c-button--flat:not(.mg-c-button--disabled){background:hsl(var(--color-dark)/10%)}:host([full-width]){display:block}:host([disabled]),:host([aria-disabled=true]){pointer-events:none}.mg-c-button.mg-c-button--primary{border-color:hsl(var(--mg-button-primary-border-color, var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), calc(var(--mg-button-primary-color-l) - var(--mg-button-border-variation) * 10%)));background:linear-gradient(to bottom, hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l)), hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), calc(var(--mg-button-primary-color-l) - var(--mg-button-gradient) * 10%)));color:hsl(var(--mg-button-primary-font-color))}:host(:hover) .mg-c-button--primary:not(.mg-c-button--disabled){background:hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l))}.mg-c-button.mg-c-button--secondary{border-color:hsl(var(--mg-button-secondary-border-color, var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), calc(var(--mg-button-secondary-color-l) - var(--mg-button-border-variation) * 10%)));background:linear-gradient(to bottom, hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l)), hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), calc(var(--mg-button-secondary-color-l) - var(--mg-button-gradient) * 10%)));color:hsl(var(--mg-button-secondary-font-color))}:host(:hover) .mg-c-button--secondary:not(.mg-c-button--disabled){background:hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l))}.mg-c-button.mg-c-button--danger{border-color:hsl(var(--mg-button-danger-border-color, var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) - var(--mg-button-border-variation) * 10%)));background:linear-gradient(to bottom, hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l)), hsl(var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) - var(--mg-button-gradient) * 10%)));color:hsl(var(--color-neutral))}:host(:hover) .mg-c-button--danger:not(.mg-c-button--disabled){background:hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l))}.mg-c-button.mg-c-button--danger-alt{border-color:hsl(var(--mg-button-danger-alt-border-color, var(--color-neutral-h), var(--color-neutral-s), calc(var(--color-neutral-l) - var(--mg-button-border-variation) * 10%)));background:linear-gradient(to bottom, hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l)), hsl(var(--color-neutral-h), var(--color-neutral-s), calc(var(--color-neutral-l) - var(--mg-button-gradient) * 10%)));color:hsl(var(--color-danger))}:host(:hover) .mg-c-button--danger-alt:not(.mg-c-button--disabled){background:hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l))}.mg-c-button.mg-c-button--info{border-color:hsl(var(--mg-button-info-border-color, var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) - var(--mg-button-border-variation) * 10%)));background:linear-gradient(to bottom, hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l)), hsl(var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) - var(--mg-button-gradient) * 10%)));color:hsl(var(--color-neutral))}:host(:hover) .mg-c-button--info:not(.mg-c-button--disabled){background:hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l))}.mg-c-button.mg-c-button--success{border-color:hsl(var(--mg-button-success-border-color, var(--color-success-h), var(--color-success-s), calc(var(--color-success-l) - var(--mg-button-border-variation) * 10%)));background:linear-gradient(to bottom, hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l)), hsl(var(--color-success-h), var(--color-success-s), calc(var(--color-success-l) - var(--mg-button-gradient) * 10%)));color:hsl(var(--color-dark))}:host(:hover) .mg-c-button--success:not(.mg-c-button--disabled){background:hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l))}.mg-c-button{position:relative;display:inline-flex;min-height:var(--default-size);box-sizing:border-box;align-items:center;padding:calc((var(--default-size) - .2rem - var(--font-size)*var(--line-height))/2) 1.1rem;border-width:var(--mg-button-border-top-width, 0.1rem) var(--mg-button-border-right-width, 0.1rem) var(--mg-button-border-bottom-width, 0.1rem) var(--mg-button-border-left-width, 0.1rem);border-style:solid;border-radius:var(--mg-button-border-radius-top-left, var(--mg-button-border-radius)) var(--mg-button-border-radius-top-right, var(--mg-button-border-radius)) var(--mg-button-border-radius-bottom-right, var(--mg-button-border-radius)) var(--mg-button-border-radius-bottom-left, var(--mg-button-border-radius));background-image:none;column-gap:.6rem;cursor:pointer;touch-action:manipulation;font-family:inherit;font-size:var(--font-size);font-weight:var(--mg-button-font-weight, normal);text-align:left;text-decoration:none}.mg-c-button.mg-c-button--disabled{cursor:default;opacity:var(--mg-button-disabled-opacity)}.mg-c-button.mg-c-button--icon{width:var(--default-size);height:var(--default-size);justify-content:center;padding:0;border-radius:var(--mg-button-border-radius-top-left, var(--mg-button-icon-border-radius)) var(--mg-button-border-radius-top-right, var(--mg-button-icon-border-radius)) var(--mg-button-border-radius-bottom-right, var(--mg-button-icon-border-radius)) var(--mg-button-border-radius-bottom-left, var(--mg-button-icon-border-radius));font-size:var(--font-size);line-height:var(--font-size)}.mg-c-button.mg-c-button--flat{border:none;background:none}.mg-c-button slot,.mg-c-button ::slotted(*:not(mg-icon)){font-family:inherit;font-size:var(--font-size);font-weight:var(--mg-button-font-weight, normal);text-align:left;text-decoration:none;display:flex;align-items:center;column-gap:.6rem}.mg-c-button.mg-c-button--link{min-height:unset;padding:unset;border:unset;border-radius:unset;background:unset;text-decoration:underline}.mg-c-button.mg-c-button--link slot{font-weight:600}.mg-c-button.mg-c-button--link:hover{text-decoration:none}.mg-c-button.mg-c-button--full-width{display:flex;justify-content:center}.mg-c-button mg-icon:only-child,.mg-c-button ::slotted(mg-icon){display:inline-flex;flex-shrink:0;margin:auto 0;line-height:1}.mg-c-button.mg-c-button--loading>mg-icon:first-of-type{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.mg-c-button.mg-c-button--loading .mg-c-button__content{opacity:0}:host(:focus-visible){outline:0}:host(:focus-visible) .mg-c-button{outline-color:-webkit-focus-ring-color;outline-style:auto;outline-width:.2rem}/*# sourceMappingURL=mg-button.css.map */\n","import { Component, Element, h, Prop, State, Watch, Host, EventEmitter, Event } from '@stencil/core';\nimport { variants, VariantType, ButtonType } from './mg-button.conf';\nimport { ClassList, isValidString, nextTick } from '@mgdis/stencil-helpers';\n\n/**\n * @slot - Button content\n */\n@Component({\n tag: 'mg-button',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-button.css',\n shadow: true,\n})\nexport class MgButton {\n /************\n * Internal *\n ************/\n\n private onClickElementFn = null;\n private readonly classDisabled = 'mg-c-button--disabled';\n private readonly classLoading = 'mg-c-button--loading';\n private readonly classFullWidth = 'mg-c-button--full-width';\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgButtonElement;\n\n /**\n * Define button variant\n */\n @Prop() variant: VariantType = variants[0]; // Primary\n @Watch('variant')\n validateVariant(newValue: VariantType, oldValue?: VariantType): void {\n if (!variants.includes(newValue)) {\n throw new Error(`<mg-button> prop \"variant\" must be one of: ${variants.join(', ')}`);\n } else {\n if (oldValue !== undefined) {\n this.classCollection.delete(`mg-c-button--${oldValue}`);\n }\n this.classCollection.add(`mg-c-button--${newValue}`);\n }\n }\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n */\n @Prop() identifier?: string;\n\n /**\n * aria-label\n * In case button text is not explicit enough\n */\n @Prop() label?: string;\n\n /**\n * Define button type\n */\n @Prop() type?: ButtonType;\n\n /**\n * Set button to full-width\n */\n @Prop() fullWidth = false;\n @Watch('fullWidth')\n validateFullWidth(newValue: MgButton['fullWidth']): void {\n if (newValue && this.isIcon) {\n throw new Error('<mg-button> prop \"fullWidth\" cannot be used with prop \"isIcon\".');\n } else if (newValue) {\n this.classCollection.add(this.classFullWidth);\n } else {\n this.classCollection.delete(this.classFullWidth);\n }\n }\n\n /**\n * Define form id to attach button with.\n * If this attribute is not set, the <button> is associated with its ancestor <form> element.\n */\n @Prop() form?: string;\n\n /**\n * Disable button\n */\n @Prop({ mutable: true }) disabled?: boolean;\n @Watch('disabled')\n disabledHandler(isDisabled: MgButton['disabled']): void {\n // Remove loading when enable\n // Will be set back onclick\n if (!isDisabled && this.disableOnClick) {\n this.loading = false;\n }\n // Manage if onclick\n this.element.onclick = isDisabled ? undefined : this.onClickElementFn;\n\n // apply style\n if (isDisabled) {\n this.classCollection.add(this.classDisabled);\n } else {\n this.classCollection.delete(this.classDisabled);\n }\n\n // emit value update\n this.disabledChange.emit(isDisabled);\n }\n /**\n * Define if button is round.\n * Used for icon button.\n */\n @Prop() isIcon = false;\n\n /**\n * Option to set input disable on click, in order to prevent multi-click.\n * Parent component have to remove the attribute 'disabled' when the process ends.\n */\n @Prop() disableOnClick = false;\n\n /**\n * Define if button is loading, default to false.\n * Trigger when button is clicked or key-up ['enter', 'space], then value change to true.\n * It's required to reset to false when action/promise in parent is done to stop the loading state\n */\n @State() loading = false;\n @Watch('loading')\n loadingHandler(newValue: MgButton['loading']): void {\n // we add loading style if it newvalue is true else we remove it\n if (newValue) {\n this.classCollection.add(this.classLoading);\n } else {\n this.classCollection.delete(this.classLoading);\n }\n }\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-c-button']);\n\n /**\n * Emmited event when disabled change\n */\n @Event({ eventName: 'disabled-change' }) disabledChange: EventEmitter<HTMLMgButtonElement['disabled']>;\n\n /**\n * Trigger actions onClick event\n * @param event - click event\n */\n private handleClick = (event: MouseEvent): void => {\n if (this.disabled) event.stopPropagation();\n // Used to prevent multi-click.\n else if (this.disableOnClick) {\n this.loading = true;\n this.disabled = true;\n }\n };\n\n /**\n * Handle onKeydown event\n * @param event - keyboard event\n */\n private handleKeydown = (event: KeyboardEvent): void => {\n if (!this.disabled && event.key === ' ') {\n event.preventDefault();\n } else if (!this.disabled && ['Enter', 'NumpadEnter', 'Space'].includes(event.key)) {\n event.preventDefault();\n this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));\n }\n };\n\n /**\n * Handle onKeyup event\n * @param event - keyboard event\n */\n private handleKeyup = (event: KeyboardEvent): void => {\n if (!this.disabled && event.key === ' ') {\n event.preventDefault();\n this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));\n }\n };\n\n /**\n * Check if props are well configured on init\n */\n componentWillLoad(): void {\n this.validateVariant(this.variant);\n this.validateFullWidth(this.fullWidth);\n if (this.isIcon) {\n this.classCollection.add(`mg-c-button--icon`);\n if (!isValidString(this.label)) {\n throw new Error(`<mg-button> prop \"label\" is mandatory when prop \"isIcon\" is set to true.`);\n }\n }\n // Store the onclick fn\n this.onClickElementFn = this.element.onclick;\n this.disabledHandler(this.disabled);\n }\n\n /**\n * Add listners\n */\n componentDidLoad(): void {\n nextTick(() => {\n const closestForm = this.element.closest('form') || this.element.closest('mg-form')?.shadowRoot.querySelector('form');\n // submit buttons should trigger form submition;\n if (!!closestForm && ['submit', undefined].includes(this.type)) {\n this.element.addEventListener('click', () => {\n closestForm.dispatchEvent(new SubmitEvent('submit', { bubbles: true, cancelable: true }));\n });\n }\n });\n }\n\n /**\n * Render component\n * @returns html element\n */\n render(): HTMLElement {\n return (\n <Host\n role=\"button\"\n tabIndex={0}\n type={this.type}\n form={this.form}\n full-width={this.fullWidth}\n aria-label={this.label}\n aria-disabled={this.disabled?.toString()}\n onClick={this.handleClick}\n onKeyup={this.handleKeyup}\n onKeydown={this.handleKeydown}\n >\n <div class={this.classCollection.join()} id={this.identifier}>\n {this.loading && <mg-icon icon=\"loader\" spin></mg-icon>}\n <div class=\"mg-c-button__content\">\n <slot></slot>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"mg-button2.js","mappings":";;;;AAAA;;;AAGO,MAAM,QAAQ,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAU;;ACHpH,MAAM,WAAW,GAAG,+tNAA+tN,CAAC;AACpvN,uBAAe,WAAW;;MCWb,QAAQ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,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;iBAC3F,CAAC,CAAC;aACJ;SACF,CAAC,CAAC;KACJ;;;;;IAMD,MAAM;;QACJ,QACE,EAAC,IAAI,qDACH,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,EACX,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,gBACH,IAAI,CAAC,SAAS,gBACd,IAAI,CAAC,KAAK,mBACP,MAAA,IAAI,CAAC,QAAQ,0CAAE,QAAQ,EAAE,EACxC,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,SAAS,EAAE,IAAI,CAAC,aAAa,IAE7B,4DAAK,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,UAAU,IACzD,IAAI,CAAC,OAAO,IAAI,gEAAS,IAAI,EAAC,QAAQ,EAAC,IAAI,SAAW,EACvD,4DAAK,KAAK,EAAC,sBAAsB,IAC/B,8DAAa,CACT,CACF,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["ClassList","isValidString","nextTick"],"sources":["src/components/atoms/mg-button/mg-button.conf.ts","../styles/dist/components/mg-button.css?tag=mg-button&encapsulation=shadow","src/components/atoms/mg-button/mg-button.tsx"],"sourcesContent":["/**\n * List of all possibles variants\n */\nexport const variants = ['primary', 'secondary', 'danger', 'danger-alt', 'info', 'flat', 'success', 'link'] as const;\n\n/**\n * VariantType type from button variants\n */\nexport type VariantType = (typeof variants)[number];\n\n/**\n * List of all possibles button types\n */\nexport const buttonTypes = ['button', 'submit', 'reset'] as const;\n\n/**\n * ButtonType type from buttonTypes\n */\nexport type ButtonType = (typeof buttonTypes)[number];\n",":host{display:inline-block;max-width:100%;vertical-align:middle}:host(:hover) .mg-c-button--flat:not(.mg-c-button--disabled){background:hsl(var(--color-dark)/10%)}:host([full-width]){display:block}:host([disabled]),:host([aria-disabled=true]){pointer-events:none}.mg-c-button.mg-c-button--primary{border-color:hsl(var(--mg-button-primary-border-color, var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), calc(var(--mg-button-primary-color-l) - var(--mg-button-border-variation) * 10%)));background:linear-gradient(to bottom, hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l)), hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), calc(var(--mg-button-primary-color-l) - var(--mg-button-gradient) * 10%)));color:hsl(var(--mg-button-primary-font-color))}:host(:hover) .mg-c-button--primary:not(.mg-c-button--disabled){background:hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l))}.mg-c-button.mg-c-button--secondary{border-color:hsl(var(--mg-button-secondary-border-color, var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), calc(var(--mg-button-secondary-color-l) - var(--mg-button-border-variation) * 10%)));background:linear-gradient(to bottom, hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l)), hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), calc(var(--mg-button-secondary-color-l) - var(--mg-button-gradient) * 10%)));color:hsl(var(--mg-button-secondary-font-color))}:host(:hover) .mg-c-button--secondary:not(.mg-c-button--disabled){background:hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l))}.mg-c-button.mg-c-button--danger{border-color:hsl(var(--mg-button-danger-border-color, var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) - var(--mg-button-border-variation) * 10%)));background:linear-gradient(to bottom, hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l)), hsl(var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) - var(--mg-button-gradient) * 10%)));color:hsl(var(--color-neutral))}:host(:hover) .mg-c-button--danger:not(.mg-c-button--disabled){background:hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l))}.mg-c-button.mg-c-button--danger-alt{border-color:hsl(var(--mg-button-danger-alt-border-color, var(--color-neutral-h), var(--color-neutral-s), calc(var(--color-neutral-l) - var(--mg-button-border-variation) * 10%)));background:linear-gradient(to bottom, hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l)), hsl(var(--color-neutral-h), var(--color-neutral-s), calc(var(--color-neutral-l) - var(--mg-button-gradient) * 10%)));color:hsl(var(--color-danger))}:host(:hover) .mg-c-button--danger-alt:not(.mg-c-button--disabled){background:hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l))}.mg-c-button.mg-c-button--info{border-color:hsl(var(--mg-button-info-border-color, var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) - var(--mg-button-border-variation) * 10%)));background:linear-gradient(to bottom, hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l)), hsl(var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) - var(--mg-button-gradient) * 10%)));color:hsl(var(--color-neutral))}:host(:hover) .mg-c-button--info:not(.mg-c-button--disabled){background:hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l))}.mg-c-button.mg-c-button--success{border-color:hsl(var(--mg-button-success-border-color, var(--color-success-h), var(--color-success-s), calc(var(--color-success-l) - var(--mg-button-border-variation) * 10%)));background:linear-gradient(to bottom, hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l)), hsl(var(--color-success-h), var(--color-success-s), calc(var(--color-success-l) - var(--mg-button-gradient) * 10%)));color:hsl(var(--color-dark))}:host(:hover) .mg-c-button--success:not(.mg-c-button--disabled){background:hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l))}.mg-c-button{position:relative;display:inline-flex;min-height:var(--default-size);box-sizing:border-box;align-items:center;padding:calc((var(--default-size) - .2rem - var(--font-size)*var(--line-height))/2) 1.1rem;border-width:var(--mg-button-border-top-width, 0.1rem) var(--mg-button-border-right-width, 0.1rem) var(--mg-button-border-bottom-width, 0.1rem) var(--mg-button-border-left-width, 0.1rem);border-style:solid;border-radius:var(--mg-button-border-radius-top-left, var(--mg-button-border-radius)) var(--mg-button-border-radius-top-right, var(--mg-button-border-radius)) var(--mg-button-border-radius-bottom-right, var(--mg-button-border-radius)) var(--mg-button-border-radius-bottom-left, var(--mg-button-border-radius));background-image:none;column-gap:.6rem;cursor:pointer;touch-action:manipulation;font-family:inherit;font-size:var(--font-size);font-weight:var(--mg-button-font-weight, normal);text-align:left;text-decoration:none}.mg-c-button.mg-c-button--disabled{cursor:default;opacity:var(--mg-button-disabled-opacity)}.mg-c-button.mg-c-button--icon{width:var(--default-size);height:var(--default-size);justify-content:center;padding:0;border-radius:var(--mg-button-border-radius-top-left, var(--mg-button-icon-border-radius)) var(--mg-button-border-radius-top-right, var(--mg-button-icon-border-radius)) var(--mg-button-border-radius-bottom-right, var(--mg-button-icon-border-radius)) var(--mg-button-border-radius-bottom-left, var(--mg-button-icon-border-radius));font-size:var(--font-size);line-height:var(--font-size)}.mg-c-button.mg-c-button--flat{border:none;background:none}.mg-c-button slot,.mg-c-button ::slotted(*:not(mg-icon)){font-family:inherit;font-size:var(--font-size);font-weight:var(--mg-button-font-weight, normal);text-align:left;text-decoration:none;display:flex;align-items:center;column-gap:.6rem}.mg-c-button.mg-c-button--link{min-height:unset;padding:unset;border:unset;border-radius:unset;background:unset;text-decoration:underline}.mg-c-button.mg-c-button--link slot{font-weight:600}.mg-c-button.mg-c-button--link:hover{text-decoration:none}.mg-c-button.mg-c-button--full-width{display:flex;justify-content:center}.mg-c-button mg-icon:only-child,.mg-c-button ::slotted(mg-icon){display:inline-flex;flex-shrink:0;margin:auto 0;line-height:1}.mg-c-button.mg-c-button--loading>mg-icon:first-of-type{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.mg-c-button.mg-c-button--loading .mg-c-button__content{opacity:0}:host(:focus-visible){outline:0}:host(:focus-visible) .mg-c-button{outline-color:-webkit-focus-ring-color;outline-style:auto;outline-width:.2rem}/*# sourceMappingURL=mg-button.css.map */\n","import { Component, Element, h, Prop, State, Watch, Host, EventEmitter, Event } from '@stencil/core';\nimport { variants, VariantType, ButtonType } from './mg-button.conf';\nimport { ClassList, isValidString, nextTick } from '@mgdis/stencil-helpers';\n\n/**\n * @slot - Button content\n */\n@Component({\n tag: 'mg-button',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-button.css',\n shadow: true,\n})\nexport class MgButton {\n /************\n * Internal *\n ************/\n\n private onClickElementFn = null;\n private readonly classDisabled = 'mg-c-button--disabled';\n private readonly classLoading = 'mg-c-button--loading';\n private readonly classFullWidth = 'mg-c-button--full-width';\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgButtonElement;\n\n /**\n * Define button variant\n */\n @Prop() variant: VariantType = variants[0]; // Primary\n @Watch('variant')\n validateVariant(newValue: VariantType, oldValue?: VariantType): void {\n if (!variants.includes(newValue)) {\n throw new Error(`<mg-button> prop \"variant\" must be one of: ${variants.join(', ')}`);\n } else {\n if (oldValue !== undefined) {\n this.classCollection.delete(`mg-c-button--${oldValue}`);\n }\n this.classCollection.add(`mg-c-button--${newValue}`);\n }\n }\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n */\n @Prop() identifier?: string;\n\n /**\n * aria-label\n * In case button text is not explicit enough\n */\n @Prop() label?: string;\n\n /**\n * Define button type\n */\n @Prop() type?: ButtonType;\n\n /**\n * Set button to full-width\n */\n @Prop() fullWidth = false;\n @Watch('fullWidth')\n validateFullWidth(newValue: MgButton['fullWidth']): void {\n if (newValue && this.isIcon) {\n throw new Error('<mg-button> prop \"fullWidth\" cannot be used with prop \"isIcon\".');\n } else if (newValue) {\n this.classCollection.add(this.classFullWidth);\n } else {\n this.classCollection.delete(this.classFullWidth);\n }\n }\n\n /**\n * Define form id to attach button with.\n * If this attribute is not set, the `<button>` is associated with its ancestor `<form>` element.\n */\n @Prop() form?: string;\n\n /**\n * Disable button\n */\n @Prop({ mutable: true }) disabled?: boolean;\n @Watch('disabled')\n disabledHandler(isDisabled: MgButton['disabled']): void {\n // Remove loading when enable\n // Will be set back onclick\n if (!isDisabled && this.disableOnClick) {\n this.loading = false;\n }\n // Manage if onclick\n this.element.onclick = isDisabled ? undefined : this.onClickElementFn;\n\n // apply style\n if (isDisabled) {\n this.classCollection.add(this.classDisabled);\n } else {\n this.classCollection.delete(this.classDisabled);\n }\n\n // emit value update\n this.disabledChange.emit(isDisabled);\n }\n /**\n * Define if button is round.\n * Used for icon button.\n */\n @Prop() isIcon = false;\n\n /**\n * Option to set input disable on click, in order to prevent multi-click.\n * Parent component have to remove the attribute 'disabled' when the process ends.\n */\n @Prop() disableOnClick = false;\n\n /**\n * Define if button is loading, default to false.\n * Trigger when button is clicked or key-up ['enter', 'space], then value change to true.\n * It's required to reset to false when action/promise in parent is done to stop the loading state\n */\n @State() loading = false;\n @Watch('loading')\n loadingHandler(newValue: MgButton['loading']): void {\n // we add loading style if it newvalue is true else we remove it\n if (newValue) {\n this.classCollection.add(this.classLoading);\n } else {\n this.classCollection.delete(this.classLoading);\n }\n }\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-c-button']);\n\n /**\n * Emmited event when disabled change\n */\n @Event({ eventName: 'disabled-change' }) disabledChange: EventEmitter<HTMLMgButtonElement['disabled']>;\n\n /**\n * Trigger actions onClick event\n * @param event - click event\n */\n private handleClick = (event: MouseEvent): void => {\n if (this.disabled) event.stopPropagation();\n // Used to prevent multi-click.\n else if (this.disableOnClick) {\n this.loading = true;\n this.disabled = true;\n }\n };\n\n /**\n * Handle onKeydown event\n * @param event - keyboard event\n */\n private handleKeydown = (event: KeyboardEvent): void => {\n if (!this.disabled && event.key === ' ') {\n event.preventDefault();\n } else if (!this.disabled && ['Enter', 'NumpadEnter', 'Space'].includes(event.key)) {\n event.preventDefault();\n this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));\n }\n };\n\n /**\n * Handle onKeyup event\n * @param event - keyboard event\n */\n private handleKeyup = (event: KeyboardEvent): void => {\n if (!this.disabled && event.key === ' ') {\n event.preventDefault();\n this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));\n }\n };\n\n /**\n * Check if props are well configured on init\n */\n componentWillLoad(): void {\n this.validateVariant(this.variant);\n this.validateFullWidth(this.fullWidth);\n if (this.isIcon) {\n this.classCollection.add(`mg-c-button--icon`);\n if (!isValidString(this.label)) {\n throw new Error(`<mg-button> prop \"label\" is mandatory when prop \"isIcon\" is set to true.`);\n }\n }\n // Store the onclick fn\n this.onClickElementFn = this.element.onclick;\n this.disabledHandler(this.disabled);\n }\n\n /**\n * Add listners\n */\n componentDidLoad(): void {\n nextTick(() => {\n const closestForm = this.element.closest('form') || this.element.closest('mg-form')?.shadowRoot.querySelector('form');\n // submit buttons should trigger form submition;\n if (!!closestForm && ['submit', undefined].includes(this.type)) {\n this.element.addEventListener('click', () => {\n closestForm.dispatchEvent(new SubmitEvent('submit', { bubbles: true, cancelable: true }));\n });\n }\n });\n }\n\n /**\n * Render component\n * @returns html element\n */\n render(): HTMLElement {\n return (\n <Host\n role=\"button\"\n tabIndex={0}\n type={this.type}\n form={this.form}\n full-width={this.fullWidth}\n aria-label={this.label}\n aria-disabled={this.disabled?.toString()}\n onClick={this.handleClick}\n onKeyup={this.handleKeyup}\n onKeydown={this.handleKeydown}\n >\n <div class={this.classCollection.join()} id={this.identifier}>\n {this.loading && <mg-icon icon=\"loader\" spin></mg-icon>}\n <div class=\"mg-c-button__content\">\n <slot></slot>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { I as Ie } from './index.es.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* List available variants
|
|
@@ -33,7 +33,7 @@ const MgCard = /*@__PURE__*/ proxyCustomElement(class MgCard extends HTMLElement
|
|
|
33
33
|
};
|
|
34
34
|
this.variant = undefined;
|
|
35
35
|
this.variantStyle = undefined;
|
|
36
|
-
this.classCollection = new
|
|
36
|
+
this.classCollection = new Ie([this.classBase]);
|
|
37
37
|
}
|
|
38
38
|
validateVariant(newValue, oldValue) {
|
|
39
39
|
if (newValue && !variants.includes(newValue))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { Z as Ze } from './index.es.js';
|
|
3
3
|
import { d as defineCustomElement$2 } from './mg-icon2.js';
|
|
4
4
|
|
|
5
5
|
const mgDetailsCss = ".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}}.mg-c-details summary{display:flex;align-items:baseline;cursor:pointer}.mg-c-details__toggle{display:flex;min-height:calc(var(--font-size)*var(--line-height));flex-shrink:0;align-items:center;align-self:flex-start;margin-left:1.5rem;gap:.6rem}.mg-c-details__toggle-icon.mg-c-details__toggle-icon--reverse{transform:rotate(180deg)}.mg-c-details__details{margin-top:var(--mg-details-spacing)}@media (width < 43.75rem){.mg-c-details__toggle>span{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}}";
|
|
@@ -23,7 +23,7 @@ const MgDetails$1 = /*@__PURE__*/ proxyCustomElement(class MgDetails extends HTM
|
|
|
23
23
|
this.expanded = false;
|
|
24
24
|
}
|
|
25
25
|
validateTitles(newValue) {
|
|
26
|
-
if (!
|
|
26
|
+
if (!Ze(newValue)) {
|
|
27
27
|
throw new Error('<mg-details> prop "toggleClosed" and "toggleOpened" must be defined.');
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { z as ze, I as Ie } from './index.es.js';
|
|
3
3
|
import { i as initLocales } from './index2.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -109,7 +109,7 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class MgForm extends HTMLEleme
|
|
|
109
109
|
}
|
|
110
110
|
});
|
|
111
111
|
};
|
|
112
|
-
this.identifier =
|
|
112
|
+
this.identifier = ze('mg-form');
|
|
113
113
|
this.name = this.identifier;
|
|
114
114
|
this.readonly = false;
|
|
115
115
|
this.requiredMessage = undefined;
|
|
@@ -118,7 +118,7 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class MgForm extends HTMLEleme
|
|
|
118
118
|
this.disabled = false;
|
|
119
119
|
this.valid = undefined;
|
|
120
120
|
this.invalid = undefined;
|
|
121
|
-
this.classCollection = new
|
|
121
|
+
this.classCollection = new Ie(['mg-c-form']);
|
|
122
122
|
this.requiredMessageText = undefined;
|
|
123
123
|
}
|
|
124
124
|
validateRequiredMessage(newValue) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { I as Ie } from './index.es.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* List of all possibles sizes
|
|
@@ -49,7 +49,7 @@ const MgIcon = /*@__PURE__*/ proxyCustomElement(class MgIcon extends HTMLElement
|
|
|
49
49
|
this.variant = undefined;
|
|
50
50
|
this.variantStyle = undefined;
|
|
51
51
|
this.spin = false;
|
|
52
|
-
this.classCollection = new
|
|
52
|
+
this.classCollection = new Ie(['mg-c-icon']);
|
|
53
53
|
}
|
|
54
54
|
validateIcon(newValue, oldValue) {
|
|
55
55
|
if (!Object.keys(icons).includes(newValue))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { X as Xe } from './index.es.js';
|
|
3
3
|
|
|
4
4
|
const mgIllustratedMessageCss = ".mg-c-illustrated-message{display:flex;max-width:47.5rem;box-sizing:border-box;flex-direction:column;justify-content:center;padding:var(--mg-illustrated-message-padding-vertical) 1.5rem;margin:auto;gap:3em 7rem;text-align:center}.mg-c-illustrated-message__illustration{max-height:18.4rem}.mg-c-illustrated-message__illustration ::slotted([slot=illustration]){width:auto;max-width:100%;height:auto;max-height:18.4rem}.mg-c-illustrated-message__illustration.mg-c-illustrated-message__illustration--small{max-height:6rem}.mg-c-illustrated-message__illustration.mg-c-illustrated-message__illustration--small ::slotted([slot=illustration]){max-height:6rem}.mg-c-illustrated-message.mg-c-illustrated-message--horizontal{max-width:unset;flex-flow:row wrap;align-items:center}.mg-c-illustrated-message.mg-c-illustrated-message--horizontal .mg-c-illustrated-message__slots,.mg-c-illustrated-message.mg-c-illustrated-message--horizontal .mg-c-illustrated-message__illustration{max-width:47.5rem}.mg-c-illustrated-message__title ::slotted([slot=title]){margin:0;font-family:var(--font-family) !important;font-size:2rem !important;font-weight:400 !important}.mg-c-illustrated-message__details ::slotted([slot=details]){margin:2rem 0 0}";
|
|
5
5
|
const MgIllustratedMessageStyle0 = mgIllustratedMessageCss;
|
|
@@ -21,7 +21,7 @@ const MgIllustratedMessage$1 = /*@__PURE__*/ proxyCustomElement(class MgIllustra
|
|
|
21
21
|
componentDidLoad() {
|
|
22
22
|
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
23
23
|
const slottedIllustrations = this.element.querySelectorAll('[slot="illustration"]');
|
|
24
|
-
if (!
|
|
24
|
+
if (!Xe(this.element.querySelector('[slot="title"]'), headingTags)) {
|
|
25
25
|
throw new Error(`<mg-illustrated-message> Slotted title must be a heading: ${headingTags.join(', ')}`);
|
|
26
26
|
}
|
|
27
27
|
else if (slottedIllustrations.length !== 1) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { J as Je, I as Ie, Z as Ze } from './index.es.js';
|
|
3
3
|
import { d as defineCustomElement$a, S as SelectValuesButtonKey, c as checkboxTypes, a as SectionKind, M as MgInputCheckboxList } from './mg-input-checkbox-paginated2.js';
|
|
4
4
|
import { d as defineCustomElement$b, H as Handler, c as classFieldset, a as classVerticalList, b as classReadonly, e as classDisabled } from './mg-input2.js';
|
|
5
5
|
import { i as initLocales } from './index2.js';
|
|
@@ -168,7 +168,7 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
|
|
|
168
168
|
* Method to update searchResults
|
|
169
169
|
*/
|
|
170
170
|
this.updateSearchResults = () => {
|
|
171
|
-
this.searchResults = this.checkboxItems.filter(item =>
|
|
171
|
+
this.searchResults = this.checkboxItems.filter(item => Je(item.title).includes(Je(this.searchValue)));
|
|
172
172
|
};
|
|
173
173
|
/**
|
|
174
174
|
* Method to validate if one of inputs value is checked id required
|
|
@@ -242,7 +242,7 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
|
|
|
242
242
|
this.helpText = undefined;
|
|
243
243
|
this.valid = undefined;
|
|
244
244
|
this.invalid = undefined;
|
|
245
|
-
this.classCollection = new
|
|
245
|
+
this.classCollection = new Ie([this.baseClassName, classFieldset]);
|
|
246
246
|
this.errorMessage = undefined;
|
|
247
247
|
this.checkboxItems = [];
|
|
248
248
|
this.displaySearchInput = undefined;
|
|
@@ -350,7 +350,7 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
|
|
|
350
350
|
if (typeof valid !== 'boolean') {
|
|
351
351
|
throw new Error('<mg-input-checkbox> method "setError()" param "valid" must be a boolean');
|
|
352
352
|
}
|
|
353
|
-
else if (!
|
|
353
|
+
else if (!Ze(errorMessage)) {
|
|
354
354
|
throw new Error('<mg-input-checkbox> method "setError()" param "errorMessage" must be a string');
|
|
355
355
|
}
|
|
356
356
|
else {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { Z as Ze, H as He, B as Be, l as lt, n as nt, I as Ie } from './index.es.js';
|
|
3
3
|
import { d as defineCustomElement$5, H as Handler, b as classReadonly, e as classDisabled } from './mg-input2.js';
|
|
4
4
|
import { i as initLocales } from './index2.js';
|
|
5
5
|
import { d as defineCustomElement$6 } from './mg-icon2.js';
|
|
@@ -33,7 +33,7 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class MgInputDate extends
|
|
|
33
33
|
* @param value - value to test
|
|
34
34
|
* @returns truthy when value match the pattern
|
|
35
35
|
*/
|
|
36
|
-
this.isValidPattern = (value) =>
|
|
36
|
+
this.isValidPattern = (value) => Ze(value) && He.test(value);
|
|
37
37
|
/**
|
|
38
38
|
* Format help text to display
|
|
39
39
|
* @param helpText - help text format
|
|
@@ -41,10 +41,10 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class MgInputDate extends
|
|
|
41
41
|
*/
|
|
42
42
|
this.formatHelpText = (helpText) => {
|
|
43
43
|
const defaultHelpTextVariable = '{defaultHelpText}';
|
|
44
|
-
let text =
|
|
44
|
+
let text = Ze(helpText) ? helpText : this.messages.input.date.helpText;
|
|
45
45
|
if (text.includes(defaultHelpTextVariable))
|
|
46
46
|
text = text.replace(defaultHelpTextVariable, this.formatHelpText(this.messages.input.date.helpText));
|
|
47
|
-
return text.replace('{pattern}', this.renderPattern()).replace('{date}',
|
|
47
|
+
return text.replace('{pattern}', this.renderPattern()).replace('{date}', Be(lt(new Date('2023-12-24')), this.systemLocale));
|
|
48
48
|
};
|
|
49
49
|
/**
|
|
50
50
|
* Handle input event
|
|
@@ -136,8 +136,8 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class MgInputDate extends
|
|
|
136
136
|
// min, max & minMax
|
|
137
137
|
else if ([InputError.MIN, InputError.MAX, InputError.MINMAX].includes(inputError)) {
|
|
138
138
|
this.errorMessage = this.messages.errors.date[inputError]
|
|
139
|
-
.replace('{min}',
|
|
140
|
-
.replace('{max}',
|
|
139
|
+
.replace('{min}', Be(this.min, this.systemLocale))
|
|
140
|
+
.replace('{max}', Be(this.max, this.systemLocale));
|
|
141
141
|
}
|
|
142
142
|
// wrong date format
|
|
143
143
|
// element.validity.badInput is default error message
|
|
@@ -151,7 +151,7 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class MgInputDate extends
|
|
|
151
151
|
* @returns translated html pattern
|
|
152
152
|
*/
|
|
153
153
|
this.renderPattern = () => {
|
|
154
|
-
let patternLocal =
|
|
154
|
+
let patternLocal = nt(this.systemLocale);
|
|
155
155
|
for (const key in this.messages.input.date.pattern) {
|
|
156
156
|
patternLocal = patternLocal.replace(key, this.messages.input.date.pattern[key]);
|
|
157
157
|
}
|
|
@@ -173,7 +173,7 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class MgInputDate extends
|
|
|
173
173
|
this.helpText = undefined;
|
|
174
174
|
this.valid = undefined;
|
|
175
175
|
this.invalid = undefined;
|
|
176
|
-
this.classCollection = new
|
|
176
|
+
this.classCollection = new Ie(['mg-c-input--date']);
|
|
177
177
|
this.errorMessage = undefined;
|
|
178
178
|
}
|
|
179
179
|
validateValue(newValue) {
|
|
@@ -181,7 +181,7 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class MgInputDate extends
|
|
|
181
181
|
if (newValue === '')
|
|
182
182
|
newValue = null;
|
|
183
183
|
// check value validity
|
|
184
|
-
if (newValue && !
|
|
184
|
+
if (newValue && !Ze(newValue)) {
|
|
185
185
|
throw new Error("<mg-input-date> props 'value' must be a valid string");
|
|
186
186
|
}
|
|
187
187
|
else if (!newValue || (newValue && this.isValidPattern(newValue))) {
|
|
@@ -238,7 +238,7 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class MgInputDate extends
|
|
|
238
238
|
if (typeof valid !== 'boolean') {
|
|
239
239
|
throw new Error('<mg-input-date> method "setError()" param "valid" must be a boolean');
|
|
240
240
|
}
|
|
241
|
-
else if (!
|
|
241
|
+
else if (!Ze(errorMessage)) {
|
|
242
242
|
throw new Error('<mg-input-date> method "setError()" param "errorMessage" must be a string');
|
|
243
243
|
}
|
|
244
244
|
else {
|
|
@@ -292,7 +292,7 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class MgInputDate extends
|
|
|
292
292
|
* @returns HTML Element
|
|
293
293
|
*/
|
|
294
294
|
render() {
|
|
295
|
-
return (h("mg-input", { key: 'f38d79cb71311149b4d15885b65cd8f025dde15d', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonlyValue:
|
|
295
|
+
return (h("mg-input", { key: 'f38d79cb71311149b4d15885b65cd8f025dde15d', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonlyValue: Be(this.value, this.locale), tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.formatHelpText(this.helpText), errorMessage: this.errorMessage }, h("input", { key: '67bf6f0ad58ee1a506ffd0d3d41d5954db68465c', type: "date", class: "mg-c-input__box", min: this.min, max: this.max, value: this.value, id: this.identifier, name: this.name, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, onKeyDown: this.handleKeyDown, ref: (el) => {
|
|
296
296
|
if (el !== null)
|
|
297
297
|
this.input = el;
|
|
298
298
|
} })));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { i as it, a as at, I as Ie, Z as Ze } from './index.es.js';
|
|
3
3
|
import { d as defineCustomElement$5, H as Handler, b as classReadonly, e as classDisabled, w as widths } from './mg-input2.js';
|
|
4
4
|
import { i as initLocales } from './index2.js';
|
|
5
5
|
import { d as defineCustomElement$6 } from './mg-icon2.js';
|
|
@@ -123,9 +123,9 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
|
|
|
123
123
|
this.formatValue = (value) => {
|
|
124
124
|
switch (this.format) {
|
|
125
125
|
case 'number':
|
|
126
|
-
return
|
|
126
|
+
return at(value, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
|
|
127
127
|
case 'currency':
|
|
128
|
-
return
|
|
128
|
+
return it(value, this.locale, this.currency);
|
|
129
129
|
case 'none':
|
|
130
130
|
return value.toString();
|
|
131
131
|
}
|
|
@@ -162,7 +162,7 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
|
|
|
162
162
|
this.decimalLength = 2;
|
|
163
163
|
this.valid = undefined;
|
|
164
164
|
this.invalid = undefined;
|
|
165
|
-
this.classCollection = new
|
|
165
|
+
this.classCollection = new Ie(['mg-c-input--numeric']);
|
|
166
166
|
this.errorMessage = undefined;
|
|
167
167
|
this.hasFocus = undefined;
|
|
168
168
|
}
|
|
@@ -258,7 +258,7 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
|
|
|
258
258
|
if (typeof valid !== 'boolean') {
|
|
259
259
|
throw new Error('<mg-input-numeric> method "setError()" param "valid" must be a boolean');
|
|
260
260
|
}
|
|
261
|
-
else if (!
|
|
261
|
+
else if (!Ze(errorMessage)) {
|
|
262
262
|
throw new Error('<mg-input-numeric> method "setError()" param "errorMessage" must be a string');
|
|
263
263
|
}
|
|
264
264
|
else {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { I as Ie, Z as Ze } from './index.es.js';
|
|
3
3
|
import { d as defineCustomElement$5, H as Handler, b as classReadonly, e as classDisabled, w as widths } from './mg-input2.js';
|
|
4
4
|
import { i as initLocales } from './index2.js';
|
|
5
5
|
import { d as defineCustomElement$7 } from './mg-button2.js';
|
|
@@ -86,7 +86,7 @@ const MgInputPassword$1 = /*@__PURE__*/ proxyCustomElement(class MgInputPassword
|
|
|
86
86
|
this.helpText = undefined;
|
|
87
87
|
this.valid = undefined;
|
|
88
88
|
this.invalid = undefined;
|
|
89
|
-
this.classCollection = new
|
|
89
|
+
this.classCollection = new Ie(['mg-c-input--password']);
|
|
90
90
|
this.errorMessage = undefined;
|
|
91
91
|
this.displayPassword = false;
|
|
92
92
|
}
|
|
@@ -144,7 +144,7 @@ const MgInputPassword$1 = /*@__PURE__*/ proxyCustomElement(class MgInputPassword
|
|
|
144
144
|
if (typeof valid !== 'boolean') {
|
|
145
145
|
throw new Error('<mg-input-password> method "setError()" param "valid" must be a boolean');
|
|
146
146
|
}
|
|
147
|
-
else if (!
|
|
147
|
+
else if (!Ze(errorMessage)) {
|
|
148
148
|
throw new Error('<mg-input-password> method "setError()" param "errorMessage" must be a string');
|
|
149
149
|
}
|
|
150
150
|
else {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { I as Ie, G as Ge, Z as Ze } from './index.es.js';
|
|
3
3
|
import { d as defineCustomElement$5, H as Handler, c as classFieldset, b as classReadonly, e as classDisabled } from './mg-input2.js';
|
|
4
4
|
import { i as initLocales } from './index2.js';
|
|
5
5
|
import { d as defineCustomElement$6 } from './mg-icon2.js';
|
|
@@ -94,7 +94,7 @@ const MgInputRadio$1 = /*@__PURE__*/ proxyCustomElement(class MgInputRadio exten
|
|
|
94
94
|
this.helpText = undefined;
|
|
95
95
|
this.valid = undefined;
|
|
96
96
|
this.invalid = undefined;
|
|
97
|
-
this.classCollection = new
|
|
97
|
+
this.classCollection = new Ie(['mg-c-input--radio', classFieldset]);
|
|
98
98
|
this.errorMessage = undefined;
|
|
99
99
|
this.options = undefined;
|
|
100
100
|
}
|
|
@@ -107,7 +107,7 @@ const MgInputRadio$1 = /*@__PURE__*/ proxyCustomElement(class MgInputRadio exten
|
|
|
107
107
|
throw new Error('<mg-input-radio> prop "items" require at least 2 items.');
|
|
108
108
|
}
|
|
109
109
|
// String array
|
|
110
|
-
else if (
|
|
110
|
+
else if (Ge(newValue)) {
|
|
111
111
|
this.options = newValue.map(item => ({ title: item, value: item, disabled: this.disabled }));
|
|
112
112
|
}
|
|
113
113
|
// Object array
|
|
@@ -166,7 +166,7 @@ const MgInputRadio$1 = /*@__PURE__*/ proxyCustomElement(class MgInputRadio exten
|
|
|
166
166
|
if (typeof valid !== 'boolean') {
|
|
167
167
|
throw new Error('<mg-input-radio> method "setError()" param "valid" must be a boolean');
|
|
168
168
|
}
|
|
169
|
-
else if (!
|
|
169
|
+
else if (!Ze(errorMessage)) {
|
|
170
170
|
throw new Error('<mg-input-radio> method "setError()" param "errorMessage" must be a string');
|
|
171
171
|
}
|
|
172
172
|
else {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { G as Ge, I as Ie, Z as Ze } from './index.es.js';
|
|
3
3
|
import { d as defineCustomElement$4, H as Handler, b as classReadonly, e as classDisabled, w as widths } from './mg-input2.js';
|
|
4
4
|
import { i as initLocales } from './index2.js';
|
|
5
5
|
import { d as defineCustomElement$5 } from './mg-icon2.js';
|
|
@@ -90,7 +90,7 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
|
|
|
90
90
|
if (this.input.value === '') {
|
|
91
91
|
this.setValue(null);
|
|
92
92
|
}
|
|
93
|
-
else if (
|
|
93
|
+
else if (Ge(this.items) && this.items.includes(this.input.value)) {
|
|
94
94
|
this.setValue(this.input.value);
|
|
95
95
|
}
|
|
96
96
|
else if (allItemsAreOptions(this.items) && typeof this.input.value === 'string' && this.items.some(this.isInputValue)) {
|
|
@@ -164,7 +164,7 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
|
|
|
164
164
|
this.helpText = undefined;
|
|
165
165
|
this.valid = undefined;
|
|
166
166
|
this.invalid = undefined;
|
|
167
|
-
this.classCollection = new
|
|
167
|
+
this.classCollection = new Ie(['mg-c-input--select']);
|
|
168
168
|
this.errorMessage = undefined;
|
|
169
169
|
this.options = undefined;
|
|
170
170
|
this.valueExist = undefined;
|
|
@@ -172,7 +172,7 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
|
|
|
172
172
|
}
|
|
173
173
|
validateValue(newValue) {
|
|
174
174
|
var _a, _b;
|
|
175
|
-
if (
|
|
175
|
+
if (Ge(this.items) && typeof newValue === 'string') {
|
|
176
176
|
this.readonlyValue = ((_a = this.input) === null || _a === void 0 ? void 0 : _a.value) ? this.input.value : newValue;
|
|
177
177
|
}
|
|
178
178
|
else if (allItemsAreOptions(this.items)) {
|
|
@@ -189,7 +189,7 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
|
|
|
189
189
|
this.options = [];
|
|
190
190
|
}
|
|
191
191
|
// String array
|
|
192
|
-
else if (
|
|
192
|
+
else if (Ge(newValue)) {
|
|
193
193
|
if (typeof this.value === 'string')
|
|
194
194
|
this.valueExist = newValue.includes(this.value);
|
|
195
195
|
this.options = newValue.map(item => ({ title: item, value: item }));
|
|
@@ -261,7 +261,7 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
|
|
|
261
261
|
if (typeof valid !== 'boolean') {
|
|
262
262
|
throw new Error('<mg-input-select> method "setError()" param "valid" must be a boolean');
|
|
263
263
|
}
|
|
264
|
-
else if (!
|
|
264
|
+
else if (!Ze(errorMessage)) {
|
|
265
265
|
throw new Error('<mg-input-select> method "setError()" param "errorMessage" must be a string');
|
|
266
266
|
}
|
|
267
267
|
else {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { I as Ie, Z as Ze } from './index.es.js';
|
|
3
3
|
import { d as defineCustomElement$4, H as Handler, b as classReadonly, e as classDisabled, w as widths } from './mg-input2.js';
|
|
4
4
|
import { i as initLocales } from './index2.js';
|
|
5
5
|
import { d as defineCustomElement$6 } from './mg-character-left2.js';
|
|
@@ -51,7 +51,7 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class MgInputText extends H
|
|
|
51
51
|
*/
|
|
52
52
|
this.handleFocus = () => {
|
|
53
53
|
this.classCollection.add(this.classFocus);
|
|
54
|
-
this.classCollection = new
|
|
54
|
+
this.classCollection = new Ie(this.classCollection.classes);
|
|
55
55
|
};
|
|
56
56
|
/**
|
|
57
57
|
* Handle blur event
|
|
@@ -59,7 +59,7 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class MgInputText extends H
|
|
|
59
59
|
this.handleBlur = () => {
|
|
60
60
|
// Manage focus
|
|
61
61
|
this.classCollection.delete(this.classFocus);
|
|
62
|
-
this.classCollection = new
|
|
62
|
+
this.classCollection = new Ie(this.classCollection.classes);
|
|
63
63
|
// Display Error
|
|
64
64
|
this.handlerInProgress = Handler.BLUR;
|
|
65
65
|
this.displayError().finally(() => {
|
|
@@ -134,7 +134,7 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class MgInputText extends H
|
|
|
134
134
|
this.helpText = undefined;
|
|
135
135
|
this.valid = undefined;
|
|
136
136
|
this.invalid = undefined;
|
|
137
|
-
this.classCollection = new
|
|
137
|
+
this.classCollection = new Ie(['mg-c-input--text']);
|
|
138
138
|
this.errorMessage = undefined;
|
|
139
139
|
}
|
|
140
140
|
handleValue(newValue) {
|
|
@@ -185,7 +185,7 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class MgInputText extends H
|
|
|
185
185
|
this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);
|
|
186
186
|
}
|
|
187
187
|
validatePattern(newValue) {
|
|
188
|
-
if (newValue !== undefined && !(
|
|
188
|
+
if (newValue !== undefined && !(Ze(this.pattern) && Ze(this.patternErrorMessage))) {
|
|
189
189
|
throw new Error('<mg-input-text> props "pattern" and "patternErrorMessage" must be non-empty string and paired.');
|
|
190
190
|
}
|
|
191
191
|
}
|
|
@@ -215,7 +215,7 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class MgInputText extends H
|
|
|
215
215
|
if (typeof valid !== 'boolean') {
|
|
216
216
|
throw new Error('<mg-input-text> method "setError()" param "valid" must be a boolean');
|
|
217
217
|
}
|
|
218
|
-
else if (!
|
|
218
|
+
else if (!Ze(errorMessage)) {
|
|
219
219
|
throw new Error('<mg-input-text> method "setError()" param "errorMessage" must be a string');
|
|
220
220
|
}
|
|
221
221
|
else {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { I as Ie, Z as Ze } from './index.es.js';
|
|
3
3
|
import { d as defineCustomElement$5, H as Handler, b as classReadonly, e as classDisabled, w as widths } from './mg-input2.js';
|
|
4
4
|
import { i as initLocales } from './index2.js';
|
|
5
5
|
import { d as defineCustomElement$7 } from './mg-character-left2.js';
|
|
@@ -41,7 +41,7 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class MgInputTextarea
|
|
|
41
41
|
*/
|
|
42
42
|
this.handleFocus = () => {
|
|
43
43
|
this.classCollection.add(this.classFocus);
|
|
44
|
-
this.classCollection = new
|
|
44
|
+
this.classCollection = new Ie(this.classCollection.classes);
|
|
45
45
|
};
|
|
46
46
|
/**
|
|
47
47
|
* Handle blur event
|
|
@@ -49,7 +49,7 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class MgInputTextarea
|
|
|
49
49
|
this.handleBlur = () => {
|
|
50
50
|
// Manage focus
|
|
51
51
|
this.classCollection.delete(this.classFocus);
|
|
52
|
-
this.classCollection = new
|
|
52
|
+
this.classCollection = new Ie(this.classCollection.classes);
|
|
53
53
|
// Display Error
|
|
54
54
|
this.handlerInProgress = Handler.BLUR;
|
|
55
55
|
this.displayError().finally(() => {
|
|
@@ -112,7 +112,7 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class MgInputTextarea
|
|
|
112
112
|
this.valid = undefined;
|
|
113
113
|
this.invalid = undefined;
|
|
114
114
|
this.resizable = 'none';
|
|
115
|
-
this.classCollection = new
|
|
115
|
+
this.classCollection = new Ie(['mg-c-input--textarea']);
|
|
116
116
|
this.errorMessage = undefined;
|
|
117
117
|
}
|
|
118
118
|
handleValue(newValue) {
|
|
@@ -151,7 +151,7 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class MgInputTextarea
|
|
|
151
151
|
this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);
|
|
152
152
|
}
|
|
153
153
|
validatePattern(newValue) {
|
|
154
|
-
if (newValue !== undefined && !(
|
|
154
|
+
if (newValue !== undefined && !(Ze(this.pattern) && Ze(this.patternErrorMessage))) {
|
|
155
155
|
throw new Error('<mg-input-textarea> props "pattern" and "patternErrorMessage" must be non-empty string and paired.');
|
|
156
156
|
}
|
|
157
157
|
}
|
|
@@ -183,7 +183,7 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class MgInputTextarea
|
|
|
183
183
|
if (typeof valid !== 'boolean') {
|
|
184
184
|
throw new Error('<mg-input-textarea> method "setError()" param "valid" must be a boolean');
|
|
185
185
|
}
|
|
186
|
-
else if (!
|
|
186
|
+
else if (!Ze(errorMessage)) {
|
|
187
187
|
throw new Error('<mg-input-textarea> method "setError()" param "errorMessage" must be a string');
|
|
188
188
|
}
|
|
189
189
|
else {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { Z as Ze } from './index.es.js';
|
|
3
3
|
|
|
4
4
|
const mgInputTitleCss = ".mg-u-form-legacy.sc-mg-input-title{--mg-form-inputs-title-width:calc(100% / 3 - 20px)}.mg-u-is-asterisk.sc-mg-input-title{color:hsl(var(--color-danger))}legend.mg-c-input-title.sc-mg-input-title{padding-right:0;padding-left:0}.mg-c-input-title__required.sc-mg-input-title{display:var(--mg-input-title-display, unset)}";
|
|
5
5
|
const MgInputTitleStyle0 = mgInputTitleCss;
|
|
@@ -15,7 +15,7 @@ const MgInputTitle = /*@__PURE__*/ proxyCustomElement(class MgInputTitle extends
|
|
|
15
15
|
this.tagName = 'label';
|
|
16
16
|
}
|
|
17
17
|
validateIdentifier(newValue) {
|
|
18
|
-
if (!
|
|
18
|
+
if (!Ze(newValue)) {
|
|
19
19
|
throw new Error('<mg-input-title> prop "identifier" is required.');
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { I as Ie, G as Ge, Z as Ze } from './index.es.js';
|
|
3
3
|
import { d as defineCustomElement$5, b as classReadonly, e as classDisabled } from './mg-input2.js';
|
|
4
4
|
import { d as defineCustomElement$6 } from './mg-icon2.js';
|
|
5
5
|
import { d as defineCustomElement$4 } from './mg-input-title2.js';
|
|
@@ -89,7 +89,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
|
|
|
89
89
|
this.tooltip = undefined;
|
|
90
90
|
this.tooltipPosition = 'input';
|
|
91
91
|
this.helpText = undefined;
|
|
92
|
-
this.classCollection = new
|
|
92
|
+
this.classCollection = new Ie(['mg-c-input--toggle']);
|
|
93
93
|
this.options = undefined;
|
|
94
94
|
this.errorMessage = undefined;
|
|
95
95
|
this.valid = undefined;
|
|
@@ -106,7 +106,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
|
|
|
106
106
|
throw new Error('<mg-input-toggle> prop "items" require 2 items.');
|
|
107
107
|
}
|
|
108
108
|
// String array
|
|
109
|
-
else if (
|
|
109
|
+
else if (Ge(newValue)) {
|
|
110
110
|
this.options = newValue.map(item => ({ title: item, value: item }));
|
|
111
111
|
}
|
|
112
112
|
// Object array
|
|
@@ -162,7 +162,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
|
|
|
162
162
|
if (typeof valid !== 'boolean') {
|
|
163
163
|
throw new Error('<mg-input-toggle> method "setError()" param "valid" must be a boolean');
|
|
164
164
|
}
|
|
165
|
-
else if (!
|
|
165
|
+
else if (!Ze(errorMessage)) {
|
|
166
166
|
throw new Error('<mg-input-toggle> method "setError()" param "errorMessage" must be a string');
|
|
167
167
|
}
|
|
168
168
|
else {
|