@mgdis/mg-components 6.10.0 → 6.11.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-CfIlskRh.js → index-B_WwxtkQ.js} +4 -4
- package/dist/cjs/{index-CfIlskRh.js.map → index-B_WwxtkQ.js.map} +1 -1
- package/dist/cjs/{index.es-BCLy9yYb.js → index.es-C-3Gv8Eu.js} +85 -81
- package/dist/cjs/index.es-C-3Gv8Eu.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mg-action-more_37.cjs.entry.js +1915 -1909
- package/dist/cjs/mg-action-more_37.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-alert.cjs.entry.js +6 -6
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/cjs/mg-input-combobox.cjs.entry.js +75 -72
- package/dist/cjs/mg-input-combobox.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-input-combobox.entry.cjs.js.map +1 -1
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +12 -12
- package/dist/cjs/mg-loader.cjs.entry.js +4 -4
- package/dist/cjs/mg-progress.cjs.entry.js +10 -10
- package/dist/collection/components/atoms/mg-button/mg-button.js +1 -1
- package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +0 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js.map +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +43 -63
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +67 -45
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +25 -30
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
- package/dist/collection/components/molecules/mg-details/mg-details.js +5 -1
- package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +47 -97
- package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
- package/dist/components/index.es.js +71 -68
- package/dist/components/index.es.js.map +1 -1
- package/dist/components/index2.js +2 -2
- package/dist/components/mg-action-more.js +6 -6
- package/dist/components/mg-alert.js +5 -5
- package/dist/components/mg-badge2.js +6 -6
- package/dist/components/mg-button2.js +7 -7
- package/dist/components/mg-button2.js.map +1 -1
- package/dist/components/mg-character-left2.js +4 -4
- package/dist/components/mg-details.js +8 -4
- package/dist/components/mg-details.js.map +1 -1
- package/dist/components/mg-form.js +7 -7
- package/dist/components/mg-icon2.js +6 -6
- package/dist/components/mg-illustrated-message.js +5 -5
- package/dist/components/mg-input-checkbox.js +9 -9
- package/dist/components/mg-input-combobox.js +74 -71
- package/dist/components/mg-input-combobox.js.map +1 -1
- package/dist/components/mg-input-date.js +17 -17
- package/dist/components/mg-input-numeric.js +13 -13
- package/dist/components/mg-input-password.js +3 -3
- package/dist/components/mg-input-radio.js +7 -7
- package/dist/components/mg-input-rich-text-editor.js +11 -11
- package/dist/components/mg-input-select2.js +32 -37
- package/dist/components/mg-input-select2.js.map +1 -1
- package/dist/components/mg-input-text2.js +9 -9
- package/dist/components/mg-input-textarea.js +7 -7
- package/dist/components/mg-input-title2.js +4 -4
- package/dist/components/mg-input-toggle.js +6 -6
- package/dist/components/mg-input2.js +8 -8
- package/dist/components/mg-item-more2.js +7 -7
- package/dist/components/mg-loader2.js +3 -3
- package/dist/components/mg-menu-item2.js +11 -11
- package/dist/components/mg-message2.js +4 -4
- package/dist/components/mg-modal.js +8 -8
- package/dist/components/mg-pagination2.js +6 -6
- package/dist/components/mg-panel.js +9 -9
- package/dist/components/mg-popover-content2.js +4 -4
- package/dist/components/mg-popover-content2.js.map +1 -1
- package/dist/components/mg-popover2.js +48 -96
- package/dist/components/mg-popover2.js.map +1 -1
- package/dist/components/mg-progress.js +10 -10
- package/dist/components/mg-skip-links.js +2 -2
- package/dist/components/mg-table.js +6 -6
- package/dist/components/mg-tabs.js +12 -12
- package/dist/components/mg-tag.js +4 -4
- package/dist/components/mg-tooltip-content2.js +1 -1
- package/dist/components/mg-tooltip-content2.js.map +1 -1
- package/dist/components/mg-tooltip2.js +47 -66
- package/dist/components/mg-tooltip2.js.map +1 -1
- package/dist/components/popper.js +1793 -0
- package/dist/components/popper.js.map +1 -0
- package/dist/esm/{index-DmsGewMC.js → index-DHpyFawS.js} +4 -4
- package/dist/esm/{index-DmsGewMC.js.map → index-DHpyFawS.js.map} +1 -1
- package/dist/esm/{index.es-rLV3KFPd.js → index.es-lyrZ9KRh.js} +73 -70
- package/dist/esm/index.es-lyrZ9KRh.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mg-action-more_37.entry.js +1915 -1909
- package/dist/esm/mg-action-more_37.entry.js.map +1 -1
- package/dist/esm/mg-alert.entry.js +6 -6
- package/dist/esm/mg-components.js +1 -1
- package/dist/esm/mg-input-combobox.entry.js +75 -72
- package/dist/esm/mg-input-combobox.entry.js.map +1 -1
- package/dist/esm/mg-input-rich-text-editor.entry.js +12 -12
- package/dist/esm/mg-loader.entry.js +4 -4
- package/dist/esm/mg-progress.entry.js +10 -10
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/mg-input-combobox.entry.esm.js.map +1 -1
- package/dist/mg-components/{p-ad66e7b3.entry.js → p-596c0e08.entry.js} +2 -2
- package/dist/mg-components/p-8a3bd8ad.entry.js +2 -0
- package/dist/mg-components/p-8a3bd8ad.entry.js.map +1 -0
- package/dist/mg-components/p-98a74b62.entry.js +2 -0
- package/dist/mg-components/{p-cdbe689e.entry.js.map → p-98a74b62.entry.js.map} +1 -1
- package/dist/mg-components/{p-DK9teKTo.js → p-C-vIqOyI.js} +2 -2
- package/dist/mg-components/{p-DK9teKTo.js.map → p-C-vIqOyI.js.map} +1 -1
- package/dist/mg-components/{p-73099ed7.entry.js → p-d4ed3aad.entry.js} +2 -2
- package/dist/mg-components/p-e822bd96.entry.js +2 -0
- package/dist/mg-components/{p-88f77de2.entry.js.map → p-e822bd96.entry.js.map} +1 -1
- package/dist/mg-components/p-fc7b96e6.entry.js +2 -0
- package/dist/mg-components/p-fc7b96e6.entry.js.map +1 -0
- package/dist/mg-components/p-lyrZ9KRh.js +2 -0
- package/dist/mg-components/p-lyrZ9KRh.js.map +1 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +0 -6
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +6 -8
- package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.conf.d.ts +1 -1
- package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +5 -0
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +0 -9
- package/dist/types/components/molecules/mg-details/mg-details.d.ts +1 -0
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +8 -22
- package/dist/types/components.d.ts +11 -8
- package/ide/intellij/web-types.json +6 -2
- package/ide/vscode/html-custom-data.json +1 -1
- package/package.json +12 -12
- package/dist/cjs/index.es-BCLy9yYb.js.map +0 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js +0 -2
- package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js.map +0 -1
- package/dist/collection/utils/floating-ui.utils.js +0 -74
- package/dist/collection/utils/floating-ui.utils.js.map +0 -1
- package/dist/components/floating-ui.utils.js +0 -1721
- package/dist/components/floating-ui.utils.js.map +0 -1
- package/dist/esm/index.es-rLV3KFPd.js.map +0 -1
- package/dist/mg-components/p-0f761c6c.entry.js +0 -2
- package/dist/mg-components/p-0f761c6c.entry.js.map +0 -1
- package/dist/mg-components/p-88f77de2.entry.js +0 -2
- package/dist/mg-components/p-cdbe689e.entry.js +0 -2
- package/dist/mg-components/p-d3a868f0.entry.js +0 -2
- package/dist/mg-components/p-d3a868f0.entry.js.map +0 -1
- package/dist/mg-components/p-rLV3KFPd.js +0 -2
- package/dist/mg-components/p-rLV3KFPd.js.map +0 -1
- package/dist/types/components/molecules/mg-popover/mg-popover.conf.d.ts +0 -6
- package/dist/types/utils/floating-ui.utils.d.ts +0 -28
- /package/dist/mg-components/{p-ad66e7b3.entry.js.map → p-596c0e08.entry.js.map} +0 -0
- /package/dist/mg-components/{p-73099ed7.entry.js.map → p-d4ed3aad.entry.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mg-input-combobox.entry.cjs.js","sources":["../styles/dist/components/mg-input-combobox.css?tag=mg-input-combobox&encapsulation=shadow","src/components/molecules/inputs/mg-input-combobox/mg-input-combobox.tsx"],"sourcesContent":[".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left: 0;--mg-c-button-border-radius-bottom-left: 0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right: 0;--mg-c-button-border-radius-bottom-right: 0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width: 0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right: var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right: var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left>mg-icon:first-of-type,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container>mg-icon:first-of-type{position:absolute;top:50%;left:var(--mg-b-size-8);color:var(--mg-c-input-color-icon);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left .mg-c-input__box,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container .mg-c-input__box{padding-left:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2)}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.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-input.mg-c-input--combobox mg-popover{--mg-c-popover-padding-vertical: 0;--mg-c-popover-padding-horizontal: 0}.mg-c-input.mg-c-input--combobox .mg-c-input__input-group-container{position:relative}.mg-c-input.mg-c-input--combobox .mg-c-input__box{cursor:pointer}.mg-c-input.mg-c-input--combobox .mg-c-input__popover-container{display:flex;min-width:var(--mg-c-input-list-width);max-height:calc(50*var(--mg-b-size-8) - var(--mg-b-size-32));flex-direction:column;gap:var(--mg-b-size-4);overflow-y:scroll}.mg-c-input.mg-c-input--combobox .mg-c-input__popover-info{padding:var(--mg-b-size-8);margin:0;text-align:center}.mg-c-input.mg-c-input--combobox .mg-c-input__load-more{padding:0 var(--mg-b-size-8) var(--mg-b-size-4)}.mg-c-input.mg-c-input--combobox .mg-c-input__reset{padding-right:var(--mg-b-size-min-height)}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list{padding:0;margin:0;cursor:pointer;list-style:none}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item{display:flex;padding:var(--mg-b-size-8)}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item:hover,.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item.mg-c-input__input-list-item--focus-visible{background-color:var(--mg-b-color-neutral-20)}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item.mg-c-input__input-list-item--selected{font-weight:700}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item.mg-c-input__input-list-item--selected mg-icon{margin-left:auto}.mg-c-input.mg-c-input--combobox.mg-c-input--width-2 .mg-c-input__box{width:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2 + var(--mg-b-size-24) + var(--mg-b-size-min-height)*2 + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-4 .mg-c-input__box{width:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2 + var(--mg-b-size-48) + var(--mg-b-size-min-height)*2 + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-16 .mg-c-input__box{width:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2 + calc(23 * var(--mg-b-size-8)) + var(--mg-b-size-min-height)*2 + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-full mg-popover{--mg-c-popover-max-width: var(--mg-c-input-list-width, var(--mg-c-popover-max-width))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-full .mg-c-input__input-group-container{display:flex;width:100%}.mg-c-input.mg-c-input--combobox.mg-c-input--width-full .mg-c-input__box{flex:1}.mg-c-input.mg-c-input--combobox.mg-c-input--input-append .mg-c-input__box{padding-right:calc(var(--mg-b-size-min-height)*var(--mg-c-input-append-x) + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--input-append .mg-c-input__box-append{position:absolute;top:0;right:0}/*# sourceMappingURL=mg-input-combobox.css.map */\n","import { Component, Event, h, Prop, EventEmitter, State, Element, Method, Watch } from '@stencil/core';\nimport { allItemsAreString, ClassList, getObjectValueFromKey, isValidString, nextTick, Page, Paginate, Cursor, type CursorType, toString, isObject } from '@mgdis/stencil-helpers';\nimport { type ActionType, type RequestMappingType, type ResponseMappingType } from './mg-input-combobox.conf';\nimport { type TooltipPosition, type Width, type EventType, widths, classReadonly, classDisabled } from '../mg-input/mg-input.conf';\nimport type { Option } from '../../../../types';\nimport { initLocales } from '../../../../locales';\nimport { Keys } from '../../../../utils/events.utils';\n\n/**\n * Check if object is an item\n * @param item - object to check\n * @returns True if object is an item\n */\nconst isItem = (item: unknown): item is Option => item && typeof item === 'object' && typeof (item as Option).title === 'string' && (item as Option).value !== undefined;\n\n/**\n * Check if objects are items\n * @param items - items to check\n * @returns True if objects are items\n */\nconst isItems = (items: unknown[]): items is Option[] => Array.isArray(items) && items.every(isItem);\n\n/**\n * Check if object is valid combobox fetchmappings\n * @param value - to validate\n * @returns truthy if mapping is valid\n */\nconst isFetchmappings = (value: unknown): value is MgInputCombobox['fetchmappings'] => {\n const isValidRoot = isObject<Record<string, unknown>>(value) && Object.hasOwn(value, 'request') && Object.hasOwn(value, 'response');\n if (isValidRoot) {\n const { request, response } = value as MgInputCombobox['fetchmappings'];\n if ([request, response].some(property => !isObject(property))) return false;\n const isValidRequest = typeof request.filter === 'string';\n const isValidResponse =\n typeof response === 'object' &&\n typeof response.total === 'string' &&\n typeof response.items === 'string' &&\n typeof response.next === 'string' &&\n typeof response.itemTitle === 'string' &&\n typeof response.itemValue === 'string';\n return isValidRequest && isValidResponse;\n } else {\n return isValidRoot;\n }\n};\n\n/**\n * Map new URL from old url\n * @param newValue - new URL value\n * @param oldValue - previous URL value\n * @returns updated url\n */\nconst mapUrl = (newValue: string, oldValue: string): string => {\n if (!Boolean(newValue)) return;\n else if (URL.canParse(newValue)) {\n return newValue;\n }\n\n // build new URL\n const params = newValue.includes('?') && newValue.split('?').pop();\n if (Boolean(params)) {\n const { origin, pathname } = new URL(oldValue);\n return `${origin}${pathname}?${params}`;\n } else {\n return newValue;\n }\n};\n\n@Component({\n tag: 'mg-input-combobox',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-input-combobox.css',\n shadow: true,\n})\nexport class MgInputCombobox {\n /************\n * Internal *\n ************/\n\n // Classes\n private readonly classFocus = 'mg-u-is-focused';\n\n // HTML selector\n private input: HTMLInputElement;\n private loadMoreElement: HTMLMgButtonElement;\n private popoverId: string;\n\n // Locales\n private messages;\n\n // hasDisplayedError (triggered by blur event)\n private hasDisplayedError = false;\n\n private handlerInProgress: EventType;\n private loadingAction: ActionType['name'];\n\n private page: Page<Option>;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgInputComboboxElement;\n\n /**\n * Define component value\n */\n @Prop({ mutable: true, reflect: true }) value: string | Option;\n @Watch('value')\n watchValue(newValue: MgInputCombobox['value']): void {\n this.filter = this.getValueTitle();\n this.valueChange.emit(newValue);\n }\n\n /**\n * Define components items\n */\n @Prop() items: (string | Option)[];\n @Watch('items')\n watchItems(newValue: MgInputCombobox['items']) {\n if (Boolean(this.fetchurl) && !Boolean(newValue)) {\n // skip newValue check\n return;\n } else if (Boolean(this.fetchurl) && Boolean(newValue)) {\n throw new Error(`<mg-input-combobox> prop \"items\" values cannot be use with \"fetchurl\" prop defined. Passed value: ${toString(newValue)}.`);\n }\n // Empty options\n else if (Array.isArray(newValue) && newValue.length === 0) {\n this.options = new Paginate([]);\n }\n // String array\n else if (allItemsAreString(newValue)) {\n this.options = new Paginate(\n newValue.map(item => ({ title: item, value: item })),\n { total: newValue.length },\n );\n }\n // Object array\n else if (isItems(newValue)) {\n this.options = new Paginate(newValue, { total: newValue.length });\n } else {\n throw new Error(`<mg-input-combobox> prop \"items\" values must be the same type, string or Option. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Define items label\n * Include short description. Required for accessibility.\n * @example\n * ```\n * Countries\n * ```\n */\n @Prop() itemsLabel!: string;\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n */\n @Prop() identifier!: string;\n @Watch('identifier')\n watchIdentifier(newValue: MgInputCombobox['identifier']): void {\n if (Boolean(newValue)) {\n this.popoverId = `${newValue}-popover`;\n this.element.dataset.mgPopoverGuard = this.popoverId;\n }\n }\n\n /**\n * Input name\n * If not set the value equals the identifier\n */\n @Prop() name: string = this.identifier;\n\n /**\n * Input label\n */\n @Prop() label!: string;\n\n /**\n * Define if label is displayed on top\n */\n @Prop() labelOnTop = false;\n\n /**\n * Define if label is visible\n */\n @Prop() labelHide = false;\n\n /**\n * Define input placeholder.\n * It should be a word or short phrase that demonstrates the expected type of data, not a replacement for labels or help combobox.\n */\n @Prop() placeholder?: string;\n\n /**\n * Define if input is required\n */\n @Prop() required = false;\n\n /**\n * Define if input is readonly\n */\n @Prop() readonly = false;\n @Watch('readonly')\n watchReadonly(newValue: MgInputCombobox['readonly']): void {\n if (newValue) this.classCollection.add(classReadonly);\n else this.classCollection.delete(classReadonly);\n }\n\n /**\n * Define if input is disabled\n */\n @Prop() disabled = false;\n @Watch('required')\n @Watch('readonly')\n @Watch('disabled')\n watchValidityChange(newValue: boolean, _oldValue: boolean, prop: string): void {\n if (this.input === undefined) return;\n this.input[prop] = newValue;\n this.checkValidity();\n if (this.hasDisplayedError) {\n this.setErrorMessage();\n this.hasDisplayedError = false;\n }\n }\n\n @Watch('disabled')\n watchDisabled(newValue: MgInputCombobox['disabled']): void {\n if (newValue) {\n this.classCollection.add(classDisabled);\n } else {\n this.classCollection.delete(classDisabled);\n }\n }\n\n /**\n * Define input width\n */\n @Prop() mgWidth: Width = 'full';\n @Watch('mgWidth')\n watchMgWidth(newValue: MgInputCombobox['mgWidth']): void {\n // reset width class\n widths.forEach(width => {\n this.classCollection.delete(`mg-c-input--width-${width}`);\n });\n\n // apply new width\n if (newValue !== undefined) this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);\n this.classCollection = new ClassList(this.classCollection.classes);\n }\n\n /**\n * Add a tooltip message next to the input\n */\n @Prop() tooltip?: string;\n\n /**\n * Define tooltip position\n */\n @Prop() tooltipPosition: TooltipPosition = 'input';\n\n /**\n * Add a help text under the input, usually expected data format and example\n */\n @Prop() helpText?: string;\n\n /**\n * Define API url to fetch\n * @example\n * ```\n * {\n * url: \"http://myapi.com?$select='href,name'&my-custom-param='my-custom-value'\", // url to fetch\n * }\n * ```\n */\n @Prop() fetchurl?: string | URL;\n @Watch('fetchurl')\n watchFetchUrl(newValue: MgInputCombobox['fetchurl']): void {\n if (newValue && !URL.canParse(newValue)) {\n throw new Error(`<mg-input-combobox> prop \"fetchurl\" value must be URL or string. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Define fetch options object\n * Require `fetchurl` prop to be defined otherwith it will be ignored if defined\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/RequestInit}\n * @example JSON headers:\n * ```json\n * {\n * \"headers\": {\n * \"authorization\": \"my-token\"\n * }\n * }\n * ```\n */\n @Prop() fetchoptions?: RequestInit;\n @Watch('fetchoptions')\n watchFetchOptions(newValue: MgInputCombobox['fetchoptions']): void {\n if (this.fetchurl && newValue && !isObject(newValue)) {\n throw new Error(`<mg-input-combobox> prop \"fetchoptions\" value must be a valid RequestInit. Passed value: ${toString(newValue)}.`);\n } else {\n new Request(this.fetchurl, newValue);\n }\n }\n\n /**\n * Define fetch request mappings.\n * Required with `fetchurl`\n * @example\n * ```\n * {\n * request: {\n * filter: 'name', // `filter` key\n * },\n * response: {\n * total: 'body.data.total', // response object mapping to get `total` value\n * items: 'body.data.results' // response object mapping to get `items` value\n * next: 'body.next' // response object mapping to get `next` items\n * itemTitle: 'name', // item property to map on item['title']\n * itemValue: 'href', // item property to map on item['value']\n * }\n * }\n * ```\n */\n @Prop() fetchmappings?: { request: RequestMappingType; response: ResponseMappingType };\n @Watch('fetchmappings')\n watchFetchMappings(newValue: MgInputCombobox['fetchmappings']): void {\n if (Boolean(this.fetchurl) && !Boolean(newValue)) {\n throw new Error(`<mg-input-combobox> prop \"fetchmappings\" is required with \"fetchurl\" prop.`);\n } else if (Boolean(newValue) && !isFetchmappings(newValue)) {\n throw new Error(\n `<mg-input-combobox> prop \"fetchmappings\" value must be { request: RequestMappingType, response: ResponseMappingType }. Passed value: ${toString(newValue)}.`,\n );\n }\n }\n\n /**\n * Define input valid state\n */\n @Prop({ mutable: true }) valid: boolean;\n\n /**\n * Define input invalid state\n */\n @Prop({ mutable: true }) invalid: boolean;\n\n /**\n * Define if items are loading\n */\n @State() isLoading: boolean;\n\n /**\n * Formated items for display\n */\n @State() options: Paginate<Option> = new Paginate([]);\n @Watch('options')\n watchOptions(newValue: Paginate<Option>): void {\n this.page = newValue.getPage(0, Boolean(this.filter) ? this.optionsFilter : undefined);\n }\n\n /**\n * Active option\n */\n @State() option: Option;\n\n /**\n * Option filter\n */\n @State() filter: string = '';\n @Watch('filter')\n watchFilter(newValue: MgInputCombobox['filter']): void {\n this.loadingWrapper({ name: 'load-data' });\n this.filterChange.emit(newValue);\n }\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-c-input--combobox', 'mg-c-input--has-icon', 'mg-c-input--input-append']);\n\n /**\n * Error message to display\n */\n @State() errorMessage: string;\n\n /**\n * Popover display state\n */\n @State() popoverDisplay = false;\n @Watch('popoverDisplay')\n watchPopoverDisplay(newValue: MgInputCombobox['popoverDisplay']): void {\n if (newValue) {\n this.classCollection.add(this.classFocus);\n this.input.focus();\n this.scrollToIndex(0);\n } else {\n // remove visual focus\n this.option = null;\n // reset filter with value\n this.filter = this.getValueTitle();\n this.classCollection.delete(this.classFocus);\n this.handlerInProgress = 'blur';\n this.displayError().finally(() => {\n // reset guard\n this.handlerInProgress = undefined;\n });\n }\n }\n\n /**\n * Emited event when value change\n */\n @Event({ eventName: 'value-change' }) valueChange: EventEmitter<HTMLMgInputComboboxElement['value']>;\n\n /**\n * Emited event when filter change\n */\n @Event({ eventName: 'filter-change' }) filterChange: EventEmitter<string>;\n\n /**\n * Emited event when `load-more` is called\n */\n @Event({ eventName: 'load-more' }) loadMore: EventEmitter<void>;\n\n /**\n * Emited event when checking validity\n */\n @Event({ eventName: 'input-valid' }) inputValid: EventEmitter<HTMLMgInputComboboxElement['valid']>;\n\n /**\n * Public method to play input focus\n */\n @Method()\n async setFocus(): Promise<void> {\n this.input.focus();\n }\n\n /**\n * Display input error if it exists.\n */\n @Method()\n displayError(): Promise<void> {\n // Use `Promise` as requested for stencil method\n // Use `requestAnimationFrame` to ensure:\n // - DOM is fully updated before validation\n // - Async operations are completed\n // - No timing issues with Stencil's render cycle\n // - Keep everything in sync both inside and outside the component\n return new Promise(resolve => {\n requestAnimationFrame(() => {\n this.checkValidity();\n this.setErrorMessage();\n this.hasDisplayedError = this.invalid;\n resolve();\n });\n });\n }\n\n /**\n * Set an error and display a custom error message.\n * This method can be used to set the component's error state from its concombobox by passing a boolean value to the `valid` parameter.\n * It must be paired with an error message to display for the given concombobox.\n * When used to set validity to `false`, you should use this method again to reset the validity to `true`.\n * @param valid - value indicating the validity\n * @param errorMessage - the error message to display\n */\n @Method()\n async setError(valid: MgInputCombobox['valid'], errorMessage: string): Promise<void> {\n if (typeof valid !== 'boolean') {\n throw new Error('<mg-input-combobox> method \"setError()\" param \"valid\" must be a boolean.');\n } else if (!isValidString(errorMessage)) {\n throw new Error('<mg-input-combobox> method \"setError()\" param \"errorMessage\" must be a string.');\n } else {\n this.setValidity(valid);\n this.setErrorMessage(valid ? undefined : errorMessage);\n this.hasDisplayedError = this.invalid;\n }\n }\n\n /**\n * Reset value, validity and error state\n */\n @Method()\n async reset(): Promise<void> {\n if (this.readonly) return;\n this.setValue(null);\n this.option = null;\n this.filter = '';\n this.checkValidity();\n this.errorMessage = undefined;\n this.hasDisplayedError = false;\n }\n\n /**\n * Handle `click` event on option\n * @param event - option element click event\n */\n private handleOptionClick = (event: MouseEvent & { target: HTMLLIElement }) => {\n this.setValue(this.options.items.find(option => option.value === event.target.id));\n this.popoverDisplay = false;\n };\n\n /**\n * Handle `click` event on reset button\n * @param event - click event\n */\n private handleResetButton = (event: MouseEvent): void => {\n event.stopPropagation();\n this.reset().then(() => {\n this.input.focus();\n });\n };\n\n /**\n * Handle `display-change` event on mg-popover\n */\n private handlePopoverDisplay = (event: CustomEvent): void => {\n this.popoverDisplay = event.detail;\n };\n\n /**\n * Handle input event\n */\n private handleFilterInput = (): void => {\n this.checkValidity();\n if (this.hasDisplayedError) this.setErrorMessage();\n if (!this.popoverDisplay) this.popoverDisplay = true;\n this.filter = this.input.value;\n };\n\n /**\n * Handle `blur` event\n */\n private handleFilterBlur = (): void => {\n // skip process if popover is displayed\n if (this.popoverDisplay) return;\n\n // Display Error\n this.handlerInProgress = 'blur';\n this.displayError().finally(() => {\n // reset guard\n this.handlerInProgress = undefined;\n });\n };\n\n /**\n * Handle `focus` event\n */\n private handleFilterFocus = (): void => {\n // ensure visual focus is always clear on focus when component isn't in loading state\n if (!this.isLoading) {\n this.option = null;\n }\n };\n\n /**\n * Handle load-more <mg-button> `click`\n */\n private handleLoadMoreButton = (): void => {\n this.loadingWrapper({ name: 'load-more', cursor: Cursor.NEXT }).then(() => {\n this.input.focus();\n });\n };\n\n /**\n * Handle `keypress` event\n * @param event - keyboard event\n */\n private handleFilterKeydown = (event: KeyboardEvent): void => {\n if (this.disabled || event.ctrlKey || event.shiftKey) return;\n\n let guard = false;\n\n // override keys actions\n switch (event.key) {\n case Keys.TAB:\n case Keys.ENTER:\n guard = event.key === Keys.ENTER;\n const option = this.option || this.options.items.find(this.isCurrentOption);\n // Sets the value to the content of the focused option in the listbox.\n if (this.popoverDisplay) this.setValue(this.page.total > 0 ? option : null);\n // Closes the popover.\n this.popoverDisplay = false;\n break;\n\n case Keys.DOWN:\n case Keys.ARROWDOWN:\n case Keys.UP:\n case Keys.ARROWUP:\n guard = true;\n if (this.isLoading || !(this.page.total > 0)) {\n this.popoverDisplay = true;\n break;\n }\n\n if (Boolean(event.altKey) && [Keys.DOWN, Keys.ARROWDOWN].includes(event.key)) {\n // Opens the popover without moving focus or changing selection.\n this.popoverDisplay = true;\n break;\n }\n\n // define cursor\n let cursor: CursorType;\n const isNavigationStart = this.popoverDisplay && isItem(this.option);\n if ([Keys.DOWN, Keys.ARROWDOWN].includes(event.key)) {\n // If the filter is not empty and the popover is displayed, moves visual focus to the first suggested value.\n // If the filter is empty and the popover is not displayed, opens the popover and moves visual focus to the first option.\n // Moves visual focus to the next option.\n // If visual focus is on the last option, moves visual focus to the first option.\n cursor = isNavigationStart ? Cursor.NEXT : Cursor.FIRST;\n } else if ([Keys.UP, Keys.ARROWUP].includes(event.key)) {\n // If the filter is not empty and the popover is displayed, moves visual focus to the last suggested value.\n // If the filter is empty, first opens the popover if it is not already displayed and then moves visual focus to the last option.\n // Moves visual focus to the previous option.\n // If visual focus is on the first option, moves visual focus to the last option.\n cursor = isNavigationStart ? Cursor.PREVIOUS : Cursor.LAST;\n }\n\n // update scroll and visual focused option in wrapper\n this.loadingWrapper({ name: 'scroll', cursor });\n\n // open popover\n this.popoverDisplay = true;\n break;\n\n case Keys.LEFT:\n case Keys.ARROWLEFT:\n case Keys.HOME:\n case Keys.RIGHT:\n case Keys.ARROWRIGHT:\n case Keys.END:\n // skip process if visual focus is not in popover\n if (!isItem(this.option)) break;\n guard = true;\n\n // Remove visual focus from popover options\n this.option = null;\n\n let index;\n if (Keys.HOME === event.key) {\n // Moves visual focus to the textbox and places the editing cursor at the beginning of the field.\n index = 0;\n } else if (Keys.END === event.key) {\n // Moves visual focus to the textbox and places the editing cursor at the end of the field.\n index = this.filter.length;\n }\n if (typeof index === 'number') {\n this.input.setSelectionRange(index, index);\n }\n break;\n\n case Keys.ESC:\n case Keys.ESCAPE:\n guard = true;\n\n if (this.popoverDisplay) {\n // If the popover is displayed, closes it.\n this.popoverDisplay = false;\n } else {\n // If the popover is not displayed, clears the filter.\n this.setValue(null);\n this.filter = '';\n // Sets visual focus on the textbox.\n this.option = null;\n }\n break;\n\n default:\n // Remove visual focus from popover options\n this.option = null;\n break;\n }\n\n if (guard) {\n event.stopPropagation();\n event.preventDefault();\n }\n };\n\n /**\n * Scroll to next option from cursor\n * @param index - targeted option index to scroll into\n */\n private scrollToIndex = (index: number): void => {\n this.element.shadowRoot.querySelector(`li:nth-of-type(${(index || 0) + this.page.baseIndex})`)?.scrollIntoView();\n };\n\n /**\n * Is option the current value\n * @param option - option to match with\n * @returns true if option is the current value\n */\n private isCurrentOption = (option: Option) => (isItem(this.value) ? this.value.value : this.value) === option.value;\n\n /**\n * Set value prop\n * @param newValue - slected option item\n */\n private setValue(newValue: MgInputCombobox['option'] | null): void {\n if (!isItem(newValue)) {\n this.value = '';\n } else {\n this.value = allItemsAreString(this.items || this.options.items) ? newValue.title : { ...newValue };\n }\n }\n\n /**\n * get value prop title\n * @returns value title\n */\n private getValueTitle = (): Option['title'] => {\n if (this.value && isItem(this.value)) return this.value.title;\n else if (typeof this.value === 'string') return this.value;\n else return '';\n };\n\n /**\n * Method to set validity values\n * @param newValue - valid new value\n */\n private setValidity(newValue: MgInputCombobox['valid']) {\n const oldValidValue = this.valid;\n this.valid = newValue;\n this.invalid = !this.valid;\n // We need to send valid event even if it is the same value\n if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValidValue)) this.inputValid.emit(this.valid);\n }\n\n /**\n * Check if input is valid\n */\n private checkValidity = (): void => {\n this.setValidity(this.readonly || this.disabled || this.input.checkValidity());\n };\n\n /**\n * Set input error message\n * @param errorMessage - errorMessage override\n */\n private setErrorMessage = (errorMessage?: string): void => {\n // Set error message\n this.errorMessage = undefined;\n // Does have a custom error message\n if (!this.valid && errorMessage !== undefined) {\n this.errorMessage = errorMessage;\n }\n // required\n else if (!this.valid && this.input.validity.valueMissing) {\n this.errorMessage = this.messages.errors.required;\n }\n };\n\n /**\n * Get filtered options from `filter` input value\n * @returns filtered options\n */\n private optionsFilter = (option): boolean => (this.filter === '' ? true : option.title.toLocaleLowerCase().includes(this.filter.toLocaleLowerCase()));\n\n /**\n * Loading wrapper with a given action\n * @param action - wrapped loading action\n * @returns promisified action\n */\n private loadingWrapper = (action: ActionType): Promise<void> => {\n let promise;\n let index: number;\n\n // cache initial loading action if not defined\n if (!Boolean(this.loadingAction)) {\n this.loadingAction = action.name;\n }\n\n // update index\n if (Boolean(this.option) && this.loadingAction !== 'load-more') {\n index = this.page.items.findIndex(option => option.value.toString() === this.option.value.toString());\n } else if (this.loadingAction === 'load-more') {\n index = this.page.items.length - this.page.baseIndex;\n }\n // when action require a loadMore we fetch the API else we report action to next tick\n // Set \"load more\" if action match OR if next item not available in the current page\n if (action.name === 'load-more') {\n // wait for new element render and update scroll position\n // set component loading\n this.isLoading = true;\n promise = this.goToNextPage;\n } else if (\n action.cursor === Cursor.NEXT &&\n this.page.items.length <= this.page.total &&\n index + this.page.baseIndex === this.page.items.length &&\n index + this.page.baseIndex < this.page.total\n ) {\n // trigger load-more from button to benefit from `disabled-on-click`\n this.loadMoreElement.click();\n return;\n } else if (action.name === 'scroll') {\n promise = nextTick;\n } else {\n promise = this.updatePage;\n }\n\n return promise()\n .then(() => {\n // parse full items list from options\n const options = this.options.items.filter(this.optionsFilter);\n\n // update visual focus\n if (action.name !== 'load-data') {\n index = this.page.getIndexFromCursor(action.cursor, this.loadingAction === 'load-more' && index >= 0 ? options[index] : this.option);\n }\n this.option = options[index];\n\n // update scroll position\n this.scrollToIndex(index);\n })\n .finally(() => {\n // reset loading after next render\n requestAnimationFrame(() => {\n this.isLoading = false;\n this.loadingAction = undefined;\n });\n });\n };\n\n /**\n * Go to next page\n * @returns promise\n */\n private goToNextPage = (): Promise<void> => {\n this.loadMore.emit();\n if (Boolean(this.fetchurl)) {\n return this.getOptions(typeof this.page.next === 'string' ? this.page.next : undefined).then(nextPage => {\n if (!Boolean(nextPage)) return;\n // merge items from current page and next page\n const items = [...this.page.items, ...nextPage.items];\n // create new options pagination withe merged items\n this.options = new Paginate(items, { total: nextPage.total, next: nextPage.next, top: items.length });\n });\n } else {\n return nextTick(() => {\n if (typeof this.page.next === 'function') {\n const nextPage = this.page.next();\n this.page = new Page({\n ...nextPage,\n items: [...this.page.items, ...nextPage.items],\n });\n }\n });\n }\n };\n\n /**\n * Go to next page\n * @returns promise\n */\n private updatePage = async (): Promise<void> => {\n if (Boolean(this.fetchurl)) {\n return this.getOptions().then(page => {\n if (!Boolean(page)) return;\n // reset current options pagination from API response\n this.options = new Paginate(page.items, { total: page.total, next: page.next, top: page.top });\n });\n } else {\n this.page = this.options.getPage(0, this.optionsFilter);\n }\n };\n\n /**\n * Fetch request\n * @param url - to fetch\n * @returns new page from url\n */\n private getOptions = async (url = this.fetchurl): Promise<Pick<Page<Option>, 'items' | 'top'> & Partial<Page<Option>>> => {\n // add text filter\n const updateUrl = (typeof url === 'string' ? url : url.toString()).replaceAll(this.fetchmappings.request.filter, encodeURIComponent(this.filter));\n\n try {\n const response = await fetch(updateUrl, this.fetchoptions).then(response => response.json());\n if (!response) return null;\n const items = getObjectValueFromKey<Response, Option[]>(response, this.fetchmappings.response.items).map(\n (item): Option => ({\n title: getObjectValueFromKey<unknown, Option['title']>(item, this.fetchmappings.response.itemTitle),\n value: getObjectValueFromKey<unknown, Option['value']>(item, this.fetchmappings.response.itemValue),\n }),\n );\n const total = Number(getObjectValueFromKey<Response, number>(response, this.fetchmappings.response.total, 0));\n const next = mapUrl(getObjectValueFromKey<Response, string>(response, this.fetchmappings.response.next), this.fetchurl.toString());\n return { items, total, next, top: items.length };\n } catch {}\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if component props are well configured on init\n * @returns timeout\n */\n componentWillLoad(): ReturnType<typeof setTimeout> {\n // Get locales\n this.messages = initLocales(this.element).messages;\n // Validate\n this.watchIdentifier(this.identifier);\n this.watchItems(this.items);\n if (Boolean(this.fetchurl)) {\n this.watchFetchUrl(this.fetchurl);\n this.watchFetchOptions(this.fetchoptions);\n this.watchFetchMappings(this.fetchmappings);\n this.loadingWrapper({ name: 'load-data' });\n }\n this.watchValue(this.value);\n this.watchOptions(this.options);\n this.watchMgWidth(this.mgWidth);\n this.watchReadonly(this.readonly);\n this.watchDisabled(this.disabled);\n // Check validity when component is ready\n // return a promise to process action only in the FIRST render().\n // https://stenciljs.com/docs/component-lifecycle#componentwillload\n return setTimeout(() => {\n this.checkValidity();\n }, 0);\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n const listId = `${this.identifier}-list`;\n const readonlyValue = this.getValueTitle();\n const withResetButton = this.value && !this.disabled;\n\n let popoverContent: 'list' | 'notfound' | 'notavailable';\n if (this.page?.items.length > 0) popoverContent = 'list';\n else if (this.page?.items.length === 0 && Boolean(this.filter)) popoverContent = 'notfound';\n else if (this.page?.items.length === 0) popoverContent = 'notavailable';\n\n return (\n <mg-input\n label={this.label}\n identifier={this.identifier}\n class={this.classCollection.classes.join(' ')}\n ariaDescribedbyIDs={popoverContent && popoverContent !== 'list' ? [popoverContent] : []}\n labelOnTop={this.labelOnTop}\n labelHide={this.labelHide}\n required={this.required}\n tooltip={this.tooltip}\n tooltipPosition={this.readonly && this.value === undefined ? 'label' : this.tooltipPosition}\n helpText={this.helpText}\n errorMessage={this.errorMessage}\n >\n {this.readonly ? (\n readonlyValue && <b class=\"mg-c-input__readonly-value\">{readonlyValue}</b>\n ) : (\n <mg-popover\n identifier={this.popoverId}\n placement=\"bottom-start\"\n display={this.popoverDisplay}\n arrow-hide\n style={{\n '--mg-c-input-list-width': Boolean(this.input?.offsetWidth) ? `${this.input.offsetWidth}px` : undefined,\n '--mg-c-input-append-x': withResetButton ? '2' : '1',\n }}\n data-fallback-placement=\"bottom-end\"\n onDisplay-change={this.handlePopoverDisplay}\n >\n <div class=\"mg-c-input__input-group-container\">\n <mg-icon icon=\"magnifying-glass\"></mg-icon>\n <input\n type=\"text\"\n role=\"combobox\"\n class=\"mg-c-input__box mg-c-input__box--width\"\n value={this.filter}\n id={this.identifier}\n name={this.name}\n placeholder={this.placeholder}\n title={this.placeholder}\n disabled={this.disabled}\n required={this.required}\n autocomplete=\"off\"\n aria-autocomplete=\"list\"\n aria-expanded={this.popoverDisplay.toString()}\n aria-controls={listId}\n aria-invalid={(this.invalid === true).toString()}\n aria-activedescendant={Boolean(this.option?.value) ? this.option.value : typeof this.value === 'string' ? this.value : this.value?.value}\n onInput={this.handleFilterInput}\n onBlur={this.handleFilterBlur}\n onFocus={this.handleFilterFocus}\n onKeyDown={this.handleFilterKeydown}\n ref={(el: HTMLInputElement) => {\n if (el !== null) this.input = el;\n }}\n />\n {withResetButton && (\n <mg-button\n class=\"mg-c-input__box-append mg-c-input__reset\"\n variant=\"flat\"\n is-icon\n label={this.messages.general.reset}\n aria-controls={this.identifier}\n tabindex=\"-1\"\n onClick={this.handleResetButton}\n >\n <mg-icon icon=\"cross\"></mg-icon>\n </mg-button>\n )}\n <mg-button class=\"mg-c-input__box-append\" variant=\"flat\" is-icon label={this.itemsLabel} tabindex=\"-1\" disabled={this.disabled}>\n <mg-icon icon={`chevron-${this.popoverDisplay ? 'up' : 'down'}`}></mg-icon>\n </mg-button>\n </div>\n <div slot=\"content\" class=\"mg-c-input__popover-container\">\n {popoverContent === 'list' && [\n // eslint-disable-next-line jsx-a11y/role-supports-aria-props\n <ul key=\"list\" class=\"mg-c-input__input-list\" role=\"listbox\" id={listId} aria-label={this.itemsLabel} aria-setsize={this.page.total}>\n {this.page.items.map(option => {\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <li\n role=\"option\"\n class={{\n 'mg-c-input__input-list-item': true,\n 'mg-c-input__input-list-item--focus-visible': this.option === option,\n 'mg-c-input__input-list-item--selected': this.isCurrentOption(option),\n }}\n key={option.title}\n id={option.value.toString()}\n aria-selected={this.isCurrentOption(option).toString()}\n onClick={this.handleOptionClick}\n >\n {option.title}\n {this.isCurrentOption(option) && <mg-icon icon=\"check\"></mg-icon>}\n </li>\n );\n })}\n </ul>,\n this.isLoading && <mg-loader key=\"loader\" message={this.messages.input.combobox.search} class={{ 'mg-u-visually-hidden': Boolean(this.page.next) }}></mg-loader>,\n this.page.next && (\n <mg-button\n key=\"load-more\"\n variant=\"flat\"\n class=\"mg-c-input__load-more\"\n tabIndex={-1}\n disabled={this.isLoading}\n full-width\n disable-on-click\n onClick={this.handleLoadMoreButton}\n aria-controls={listId}\n ref={(el: HTMLMgButtonElement) => {\n if (el !== null) this.loadMoreElement = el;\n }}\n >\n <mg-icon icon=\"chevron-down\"></mg-icon>\n {this.messages.input.combobox.loadMore}\n </mg-button>\n ),\n ]}\n {popoverContent === 'notfound' && (\n <p id={popoverContent} class=\"mg-c-input__popover-info\">\n {this.messages.input.combobox.notFound}\n </p>\n )}\n {popoverContent === 'notavailable' && (\n <p id={popoverContent} class=\"mg-c-input__popover-info\">\n {this.messages.input.combobox.notAvailable}\n </p>\n )}\n </div>\n </mg-popover>\n )}\n </mg-input>\n );\n }\n}\n"],"names":["isObject","Paginate","ClassList","Cursor","Keys","nextTick","Page","getObjectValueFromKey","toString","allItemsAreString","classReadonly","classDisabled","widths","isValidString","initLocales","h"],"mappings":";;;;;;;;AAAA,MAAM,kBAAkB,GAAG,wgPAAwgP;;ACQniP;;;;AAIG;AACH,MAAM,MAAM,GAAG,CAAC,IAAa,KAAqB,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAQ,IAAe,CAAC,KAAK,KAAK,QAAQ,IAAK,IAAe,CAAC,KAAK,KAAK,SAAS;AAExK;;;;AAIG;AAC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C,EAAuB,KAAI;oBAC/B,IAAI,EAAE,KAAK,IAAI;AAAE,wBAAA,IAAI,CAAC,eAAe,GAAG,EAAE;iBAC3C,EAAA,EAEDA,OAAS,CAAA,SAAA,EAAA,EAAA,IAAI,EAAC,cAAc,EAAW,CAAA,EACtC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAC5B,CACb;AACF,SAAA,EACA,cAAc,KAAK,UAAU,KAC5BA,eAAG,EAAE,EAAE,cAAc,EAAE,KAAK,EAAC,0BAA0B,EACpD,EAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CACpC,CACL,EACA,cAAc,KAAK,cAAc,KAChCA,OAAG,CAAA,GAAA,EAAA,EAAA,EAAE,EAAE,cAAc,EAAE,KAAK,EAAC,0BAA0B,EACpD,EAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CACxC,CACL,CACG,CACK,CACd,CACQ;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"mg-input-combobox.entry.cjs.js","sources":["../styles/dist/components/mg-input-combobox.css?tag=mg-input-combobox&encapsulation=shadow","src/components/molecules/inputs/mg-input-combobox/mg-input-combobox.tsx"],"sourcesContent":[".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left: 0;--mg-c-button-border-radius-bottom-left: 0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right: 0;--mg-c-button-border-radius-bottom-right: 0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width: 0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right: var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right: var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left>mg-icon:first-of-type,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container>mg-icon:first-of-type{position:absolute;top:50%;left:var(--mg-b-size-8);color:var(--mg-c-input-color-icon);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left .mg-c-input__box,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container .mg-c-input__box{padding-left:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2)}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.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-input.mg-c-input--combobox mg-popover{--mg-c-popover-padding-vertical: 0;--mg-c-popover-padding-horizontal: 0}.mg-c-input.mg-c-input--combobox .mg-c-input__input-group-container{position:relative}.mg-c-input.mg-c-input--combobox .mg-c-input__box{cursor:pointer}.mg-c-input.mg-c-input--combobox .mg-c-input__popover-container{display:flex;min-width:var(--mg-c-input-list-width);max-height:calc(50*var(--mg-b-size-8) - var(--mg-b-size-32));flex-direction:column;gap:var(--mg-b-size-4);overflow-y:scroll}.mg-c-input.mg-c-input--combobox .mg-c-input__popover-info{padding:var(--mg-b-size-8);margin:0;text-align:center}.mg-c-input.mg-c-input--combobox .mg-c-input__load-more{padding:0 var(--mg-b-size-8) var(--mg-b-size-4)}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list{padding:0;margin:0;cursor:pointer;list-style:none}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item{display:flex;padding:var(--mg-b-size-8)}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item:hover,.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item.mg-c-input__input-list-item--focus-visible{background-color:var(--mg-b-color-neutral-20)}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item.mg-c-input__input-list-item--selected{font-weight:700}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item.mg-c-input__input-list-item--selected mg-icon{margin-left:auto}.mg-c-input.mg-c-input--combobox.mg-c-input--width-2 .mg-c-input__box{width:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2 + var(--mg-b-size-24) + var(--mg-b-size-min-height) + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-4 .mg-c-input__box{width:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2 + var(--mg-b-size-48) + var(--mg-b-size-min-height) + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-16 .mg-c-input__box{width:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2 + calc(23 * var(--mg-b-size-8)) + var(--mg-b-size-min-height) + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-full mg-popover{--mg-c-popover-max-width: var(--mg-c-input-list-width, var(--mg-c-popover-max-width))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-full .mg-c-input__input-group-container{display:flex;width:100%}.mg-c-input.mg-c-input--combobox.mg-c-input--width-full .mg-c-input__box{flex:1}.mg-c-input.mg-c-input--combobox.mg-c-input--input-append .mg-c-input__box{padding-right:calc(var(--mg-b-size-min-height) + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--input-append .mg-c-input__box-append{position:absolute;top:0;right:0}/*# sourceMappingURL=mg-input-combobox.css.map */\n","import { Component, Event, h, Prop, EventEmitter, State, Element, Method, Watch } from '@stencil/core';\nimport {\n allItemsAreString,\n ClassList,\n getObjectValueFromKey,\n isValidString,\n nextTick,\n Page,\n Paginate,\n Cursor,\n type CursorType,\n toString,\n isObject,\n formatID,\n} from '@mgdis/stencil-helpers';\nimport { type ActionType, type RequestMappingType, type ResponseMappingType } from './mg-input-combobox.conf';\nimport { type TooltipPosition, type Width, type EventType, widths, classReadonly, classDisabled } from '../mg-input/mg-input.conf';\nimport type { Option } from '../../../../types';\nimport { initLocales } from '../../../../locales';\nimport { Keys } from '../../../../utils/events.utils';\n\n/**\n * Check if object is an item\n * @param item - object to check\n * @returns True if object is an item\n */\nconst isItem = (item: unknown): item is Option => item && typeof item === 'object' && typeof (item as Option).title === 'string' && (item as Option).value !== undefined;\n\n/**\n * Check if objects are items\n * @param items - items to check\n * @returns True if objects are items\n */\nconst isItems = (items: unknown[]): items is Option[] => Array.isArray(items) && items.every(isItem);\n\n/**\n * Check if object is valid combobox fetchmappings\n * @param value - to validate\n * @returns truthy if mapping is valid\n */\nconst isFetchmappings = (value: unknown): value is MgInputCombobox['fetchmappings'] => {\n const isValidRoot = isObject<Record<string, unknown>>(value) && Object.hasOwn(value, 'request') && Object.hasOwn(value, 'response');\n if (isValidRoot) {\n const { request, response } = value as MgInputCombobox['fetchmappings'];\n if ([request, response].some(property => !isObject(property))) return false;\n const isValidRequest = typeof request.filter === 'string';\n const isValidResponse =\n typeof response === 'object' &&\n typeof response.total === 'string' &&\n typeof response.items === 'string' &&\n typeof response.next === 'string' &&\n typeof response.itemTitle === 'string' &&\n (typeof response.itemValue === 'string' || response.itemValue === undefined);\n return isValidRequest && isValidResponse;\n } else {\n return isValidRoot;\n }\n};\n\n@Component({\n tag: 'mg-input-combobox',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-input-combobox.css',\n shadow: true,\n})\nexport class MgInputCombobox {\n /************\n * Internal *\n ************/\n\n // Classes\n private readonly classFocus = 'mg-u-is-focused';\n\n // HTML selector\n private input: HTMLInputElement;\n private loadMoreElement: HTMLMgButtonElement;\n private popoverId: string;\n\n // Locales\n private messages;\n\n // hasDisplayedError (triggered by blur event)\n private hasDisplayedError = false;\n\n private handlerInProgress: EventType;\n private loadingAction: ActionType['name'];\n private debounce: boolean;\n\n private page: Page<Option>;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgInputComboboxElement;\n\n /**\n * Define component value\n */\n @Prop({ mutable: true, reflect: true }) value: string | Option;\n @Watch('value')\n watchValue(newValue: MgInputCombobox['value']): void {\n this.filter = this.getValueTitle();\n this.valueChange.emit(newValue);\n }\n\n /**\n * Define components items\n */\n @Prop() items: (string | Option)[];\n @Watch('items')\n watchItems(newValue: MgInputCombobox['items']) {\n if (Boolean(this.fetchurl) && !Boolean(newValue)) {\n // skip newValue check\n return;\n } else if (Boolean(this.fetchurl) && Boolean(newValue)) {\n throw new Error(`<mg-input-combobox> prop \"items\" values cannot be use with \"fetchurl\" prop defined. Passed value: ${toString(newValue)}.`);\n }\n // Empty options\n else if (Array.isArray(newValue) && newValue.length === 0) {\n this.options = new Paginate([]);\n }\n // String array\n else if (allItemsAreString(newValue)) {\n this.options = new Paginate(\n newValue.map(item => ({ title: item, value: item })),\n { total: newValue.length },\n );\n }\n // Object array\n else if (isItems(newValue)) {\n this.options = new Paginate(newValue, { total: newValue.length });\n } else {\n throw new Error(`<mg-input-combobox> prop \"items\" values must be the same type, string or Option. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Define items label\n * Include short description. Required for accessibility.\n * @example\n * ```\n * Countries\n * ```\n */\n @Prop() itemsLabel!: string;\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n */\n @Prop() identifier!: string;\n @Watch('identifier')\n watchIdentifier(newValue: MgInputCombobox['identifier']): void {\n if (Boolean(newValue)) {\n this.popoverId = `${newValue}-popover`;\n this.element.dataset.mgPopoverGuard = this.popoverId;\n }\n }\n\n /**\n * Input name\n * If not set the value equals the identifier\n */\n @Prop() name: string = this.identifier;\n\n /**\n * Input label\n */\n @Prop() label!: string;\n\n /**\n * Define if label is displayed on top\n */\n @Prop() labelOnTop = false;\n\n /**\n * Define if label is visible\n */\n @Prop() labelHide = false;\n\n /**\n * Define input placeholder.\n * It should be a word or short phrase that demonstrates the expected type of data, not a replacement for labels or help combobox.\n */\n @Prop() placeholder?: string;\n\n /**\n * Define if input is required\n */\n @Prop() required = false;\n\n /**\n * Define if input is readonly\n */\n @Prop() readonly = false;\n @Watch('readonly')\n watchReadonly(newValue: MgInputCombobox['readonly']): void {\n if (newValue) this.classCollection.add(classReadonly);\n else this.classCollection.delete(classReadonly);\n }\n\n /**\n * Define if input is disabled\n */\n @Prop() disabled = false;\n @Watch('required')\n @Watch('readonly')\n @Watch('disabled')\n watchValidityChange(newValue: boolean, _oldValue: boolean, prop: string): void {\n if (this.input === undefined) return;\n this.input[prop] = newValue;\n this.checkValidity();\n if (this.hasDisplayedError) {\n this.setErrorMessage();\n this.hasDisplayedError = false;\n }\n }\n\n @Watch('disabled')\n watchDisabled(newValue: MgInputCombobox['disabled']): void {\n if (newValue) {\n this.classCollection.add(classDisabled);\n } else {\n this.classCollection.delete(classDisabled);\n }\n }\n\n /**\n * Define input width\n */\n @Prop() mgWidth: Width = 'full';\n @Watch('mgWidth')\n watchMgWidth(newValue: MgInputCombobox['mgWidth']): void {\n // reset width class\n widths.forEach(width => {\n this.classCollection.delete(`mg-c-input--width-${width}`);\n });\n\n // apply new width\n if (newValue !== undefined) this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);\n this.classCollection = new ClassList(this.classCollection.classes);\n }\n\n /**\n * Add a tooltip message next to the input\n */\n @Prop() tooltip?: string;\n\n /**\n * Define tooltip position\n */\n @Prop() tooltipPosition: TooltipPosition = 'input';\n\n /**\n * Add a help text under the input, usually expected data format and example\n */\n @Prop() helpText?: string;\n\n /**\n * Define API url to fetch\n * @example\n * ```\n * {\n * url: \"http://myapi.com?$select='href,name'&my-custom-param='my-custom-value'\", // url to fetch\n * }\n * ```\n */\n @Prop() fetchurl?: string | URL;\n @Watch('fetchurl')\n watchFetchUrl(newValue: MgInputCombobox['fetchurl']): void {\n if (Boolean(newValue)) {\n this.loadingWrapper({ name: 'load-data' });\n }\n }\n\n /**\n * Define fetch options object\n * Require `fetchurl` prop to be defined otherwith it will be ignored if defined\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/RequestInit}\n * @example JSON headers:\n * ```json\n * {\n * \"headers\": {\n * \"authorization\": \"my-token\"\n * }\n * }\n * ```\n */\n @Prop() fetchoptions?: RequestInit;\n @Watch('fetchoptions')\n watchFetchOptions(newValue: MgInputCombobox['fetchoptions']): void {\n if (this.fetchurl && newValue && !isObject(newValue)) {\n throw new Error(`<mg-input-combobox> prop \"fetchoptions\" value must be a valid RequestInit. Passed value: ${toString(newValue)}.`);\n } else {\n new Request(this.fetchurl, newValue);\n }\n }\n\n /**\n * Define fetch request mappings.\n * Required with `fetchurl`\n * @example\n * ```\n * {\n * request: {\n * filter: 'name', // `filter` key\n * },\n * response: {\n * total: 'body.data.total', // response object mapping to get `total` value\n * items: 'body.data.results' // response object mapping to get `items` value\n * next: 'body.next' // response object mapping to get `next` items\n * itemTitle: 'name', // item property to map on item['title']\n * itemValue: 'href', // item property to map on item['value']\n * }\n * }\n * ```\n */\n @Prop() fetchmappings?: { request: RequestMappingType; response: ResponseMappingType };\n @Watch('fetchmappings')\n watchFetchMappings(newValue: MgInputCombobox['fetchmappings']): void {\n if (Boolean(this.fetchurl) && !Boolean(newValue)) {\n throw new Error(`<mg-input-combobox> prop \"fetchmappings\" is required with \"fetchurl\" prop.`);\n } else if (Boolean(newValue) && !isFetchmappings(newValue)) {\n throw new Error(\n `<mg-input-combobox> prop \"fetchmappings\" value must be { request: RequestMappingType, response: ResponseMappingType }. Passed value: ${toString(newValue)}.`,\n );\n }\n }\n\n /**\n * Define input valid state\n */\n @Prop({ mutable: true }) valid: boolean;\n\n /**\n * Define input invalid state\n */\n @Prop({ mutable: true }) invalid: boolean;\n\n /**\n * Define if items are loading\n */\n @State() isLoading: boolean;\n\n /**\n * Formated items for display\n */\n @State() options: Paginate<Option> = new Paginate([]);\n @Watch('options')\n watchOptions(newValue: Paginate<Option>): void {\n this.page = newValue.getPage(0, Boolean(this.filter) ? this.optionsFilter : undefined);\n }\n\n /**\n * Active option\n */\n @State() option: Option;\n\n /**\n * Option filter\n */\n @State() filter: string = '';\n @Watch('filter')\n watchFilter(newValue: MgInputCombobox['filter']): void {\n this.loadingWrapper({ name: 'load-data' });\n this.filterChange.emit(newValue);\n }\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-c-input--combobox', 'mg-c-input--has-icon', 'mg-c-input--input-append']);\n\n /**\n * Error message to display\n */\n @State() errorMessage: string;\n\n /**\n * Popover display state\n */\n @State() popoverDisplay = false;\n @Watch('popoverDisplay')\n watchPopoverDisplay(newValue: MgInputCombobox['popoverDisplay']): void {\n if (newValue) {\n this.classCollection.add(this.classFocus);\n this.input.focus();\n this.scrollToIndex(0);\n } else {\n // remove visual focus\n this.option = null;\n // reset filter with value\n this.filter = this.getValueTitle();\n this.classCollection.delete(this.classFocus);\n this.handlerInProgress = 'blur';\n this.displayError().finally(() => {\n // reset guard\n this.handlerInProgress = undefined;\n });\n }\n }\n\n /**\n * Emited event when value change\n */\n @Event({ eventName: 'value-change' }) valueChange: EventEmitter<HTMLMgInputComboboxElement['value']>;\n\n /**\n * Emited event when filter change\n */\n @Event({ eventName: 'filter-change' }) filterChange: EventEmitter<string>;\n\n /**\n * Emited event when `load-more` is called\n */\n @Event({ eventName: 'load-more' }) loadMore: EventEmitter<void>;\n\n /**\n * Emited event when checking validity\n */\n @Event({ eventName: 'input-valid' }) inputValid: EventEmitter<HTMLMgInputComboboxElement['valid']>;\n\n /**\n * Emited event when fetch API throw an error\n */\n @Event({ eventName: 'fetch-error' }) fetchError: EventEmitter<Error>;\n\n /**\n * Public method to play input focus\n */\n @Method()\n async setFocus(): Promise<void> {\n this.input.focus();\n }\n\n /**\n * Display input error if it exists.\n */\n @Method()\n displayError(): Promise<void> {\n // Use `Promise` as requested for stencil method\n // Use `requestAnimationFrame` to ensure:\n // - DOM is fully updated before validation\n // - Async operations are completed\n // - No timing issues with Stencil's render cycle\n // - Keep everything in sync both inside and outside the component\n return new Promise(resolve => {\n requestAnimationFrame(() => {\n this.checkValidity();\n this.setErrorMessage();\n this.hasDisplayedError = this.invalid;\n resolve();\n });\n });\n }\n\n /**\n * Set an error and display a custom error message.\n * This method can be used to set the component's error state from its concombobox by passing a boolean value to the `valid` parameter.\n * It must be paired with an error message to display for the given concombobox.\n * When used to set validity to `false`, you should use this method again to reset the validity to `true`.\n * @param valid - value indicating the validity\n * @param errorMessage - the error message to display\n */\n @Method()\n async setError(valid: MgInputCombobox['valid'], errorMessage: string): Promise<void> {\n if (typeof valid !== 'boolean') {\n throw new Error('<mg-input-combobox> method \"setError()\" param \"valid\" must be a boolean.');\n } else if (!isValidString(errorMessage)) {\n throw new Error('<mg-input-combobox> method \"setError()\" param \"errorMessage\" must be a string.');\n } else {\n this.setValidity(valid);\n this.setErrorMessage(valid ? undefined : errorMessage);\n this.hasDisplayedError = this.invalid;\n }\n }\n\n /**\n * Reset value, validity and error state\n */\n @Method()\n async reset(): Promise<void> {\n if (this.readonly) return;\n this.setValue(null);\n this.option = null;\n this.filter = '';\n this.checkValidity();\n this.errorMessage = undefined;\n this.hasDisplayedError = false;\n }\n\n /**\n * Handle `click` event on option\n * @param event - option element click event\n */\n private handleOptionClick = (event: MouseEvent & { target: HTMLLIElement }) => {\n this.setValue(this.options.items.find(option => formatID(option.value) === event.target.id));\n this.popoverDisplay = false;\n };\n\n /**\n * Handle `click` event on reset button\n * @param event - click event\n */\n private handleResetButton = (event: MouseEvent): void => {\n event.stopPropagation();\n this.reset().then(() => {\n this.input.focus();\n });\n };\n\n /**\n * Handle `display-change` event on mg-popover\n */\n private handlePopoverDisplay = (event: CustomEvent): void => {\n this.popoverDisplay = event.detail;\n };\n\n /**\n * Handle input event\n */\n private handleFilterInput = (): void => {\n this.checkValidity();\n if (this.hasDisplayedError) this.setErrorMessage();\n if (!this.popoverDisplay) this.popoverDisplay = true;\n\n // update filter with debounce to prevent filter update overload\n if (!this.debounce) {\n this.debounce = true;\n setTimeout(() => {\n this.filter = this.input.value;\n this.debounce = false;\n }, 250);\n }\n };\n\n /**\n * Handle `blur` event\n */\n private handleFilterBlur = (): void => {\n // skip process if popover is displayed\n if (this.popoverDisplay) return;\n\n // Display Error\n this.handlerInProgress = 'blur';\n this.displayError().finally(() => {\n // reset guard\n this.handlerInProgress = undefined;\n });\n };\n\n /**\n * Handle `focus` event\n */\n private handleFilterFocus = (): void => {\n // ensure visual focus is always clear on focus when component isn't in loading state\n if (!this.isLoading) {\n this.option = null;\n }\n };\n\n /**\n * Handle load-more <mg-button> `click`\n */\n private handleLoadMoreButton = (): void => {\n this.loadingWrapper({ name: 'load-more', cursor: Cursor.NEXT }).then(() => {\n this.input.focus();\n });\n };\n\n /**\n * Handle `keypress` event\n * @param event - keyboard event\n */\n private handleFilterKeydown = (event: KeyboardEvent): void => {\n if (this.disabled || event.ctrlKey || event.shiftKey) return;\n\n let guard = false;\n\n // override keys actions\n switch (event.key) {\n case Keys.TAB:\n case Keys.ENTER:\n guard = event.key === Keys.ENTER;\n const option = this.option || this.options.items.find(this.isCurrentOption);\n // Sets the value to the content of the focused option in the listbox.\n if (this.popoverDisplay) this.setValue(this.page.total > 0 ? option : null);\n // Closes the popover.\n this.popoverDisplay = false;\n break;\n\n case Keys.DOWN:\n case Keys.ARROWDOWN:\n case Keys.UP:\n case Keys.ARROWUP:\n guard = true;\n if (this.isLoading || !(this.page.total > 0)) {\n this.popoverDisplay = true;\n break;\n }\n\n if (Boolean(event.altKey) && [Keys.DOWN, Keys.ARROWDOWN].includes(event.key)) {\n // Opens the popover without moving focus or changing selection.\n this.popoverDisplay = true;\n break;\n }\n\n // define cursor\n let cursor: CursorType;\n const isNavigationStart = this.popoverDisplay && isItem(this.option);\n if ([Keys.DOWN, Keys.ARROWDOWN].includes(event.key)) {\n // If the filter is not empty and the popover is displayed, moves visual focus to the first suggested value.\n // If the filter is empty and the popover is not displayed, opens the popover and moves visual focus to the first option.\n // Moves visual focus to the next option.\n // If visual focus is on the last option, moves visual focus to the first option.\n cursor = isNavigationStart ? Cursor.NEXT : Cursor.FIRST;\n } else if ([Keys.UP, Keys.ARROWUP].includes(event.key)) {\n // If the filter is not empty and the popover is displayed, moves visual focus to the last suggested value.\n // If the filter is empty, first opens the popover if it is not already displayed and then moves visual focus to the last option.\n // Moves visual focus to the previous option.\n // If visual focus is on the first option, moves visual focus to the last option.\n cursor = isNavigationStart ? Cursor.PREVIOUS : Cursor.LAST;\n }\n\n // update scroll and visual focused option in wrapper\n this.loadingWrapper({ name: 'scroll', cursor });\n\n // open popover\n this.popoverDisplay = true;\n break;\n\n case Keys.LEFT:\n case Keys.ARROWLEFT:\n case Keys.HOME:\n case Keys.RIGHT:\n case Keys.ARROWRIGHT:\n case Keys.END:\n // skip process if visual focus is not in popover\n if (!isItem(this.option)) break;\n guard = true;\n\n // Remove visual focus from popover options\n this.option = null;\n\n let index;\n if (Keys.HOME === event.key) {\n // Moves visual focus to the textbox and places the editing cursor at the beginning of the field.\n index = 0;\n } else if (Keys.END === event.key) {\n // Moves visual focus to the textbox and places the editing cursor at the end of the field.\n index = this.filter.length;\n }\n if (typeof index === 'number') {\n this.input.setSelectionRange(index, index);\n }\n break;\n\n case Keys.ESC:\n case Keys.ESCAPE:\n guard = true;\n\n if (this.popoverDisplay) {\n // If the popover is displayed, closes it.\n this.popoverDisplay = false;\n } else {\n // If the popover is not displayed, clears the filter.\n this.setValue(null);\n this.filter = '';\n // Sets visual focus on the textbox.\n this.option = null;\n }\n break;\n\n default:\n // Remove visual focus from popover options\n this.option = null;\n break;\n }\n\n if (guard) {\n event.stopPropagation();\n event.preventDefault();\n }\n };\n\n /**\n * Scroll to next option from cursor\n * @param index - targeted option index to scroll into\n */\n private scrollToIndex = (index: number): void => {\n this.element.shadowRoot.querySelector(`li:nth-of-type(${(index || 0) + this.page.baseIndex})`)?.scrollIntoView();\n };\n\n /**\n * Is option the current value\n * @param option - option to match with\n * @returns true if option is the current value\n */\n private isCurrentOption = (option: Option) => (isItem(this.value) ? this.value.value : this.value) === option.value;\n\n /**\n * Set value prop\n * @param newValue - slected option item\n */\n private setValue(newValue: MgInputCombobox['option'] | null): void {\n if (!isItem(newValue)) {\n this.value = '';\n } else if (allItemsAreString(this.items || this.options.items)) {\n this.value = newValue.title;\n } else {\n this.value = { ...newValue };\n }\n }\n\n /**\n * get value prop title\n * @returns value title\n */\n private getValueTitle = (): Option['title'] => {\n if (this.value && isItem(this.value)) return this.value.title;\n else if (typeof this.value === 'string') return this.value;\n else return '';\n };\n\n /**\n * Method to set validity values\n * @param newValue - valid new value\n */\n private setValidity(newValue: MgInputCombobox['valid']) {\n const oldValidValue = this.valid;\n this.valid = newValue;\n this.invalid = !this.valid;\n // We need to send valid event even if it is the same value\n if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValidValue)) this.inputValid.emit(this.valid);\n }\n\n /**\n * Check if input is valid\n */\n private checkValidity = (): void => {\n this.setValidity(this.readonly || this.disabled || this.input.checkValidity());\n };\n\n /**\n * Set input error message\n * @param errorMessage - errorMessage override\n */\n private setErrorMessage = (errorMessage?: string): void => {\n // Set error message\n this.errorMessage = undefined;\n // Does have a custom error message\n if (!this.valid && errorMessage !== undefined) {\n this.errorMessage = errorMessage;\n }\n // required\n else if (!this.valid && this.input.validity.valueMissing) {\n this.errorMessage = this.messages.errors.required;\n }\n };\n\n /**\n * Get filtered options from `filter` input value\n * @returns filtered options\n */\n private optionsFilter = (option): boolean => (this.filter === '' ? true : option.title.toLocaleLowerCase().includes(this.filter.toLocaleLowerCase()));\n\n /**\n * Loading wrapper with a given action\n * @param action - wrapped loading action\n * @returns promisified action\n */\n private loadingWrapper = (action: ActionType): Promise<void> => {\n let promise;\n let index: number;\n\n // cache initial loading action if not defined\n if (!Boolean(this.loadingAction)) {\n this.loadingAction = action.name;\n }\n\n // update index\n if (Boolean(this.option) && this.loadingAction !== 'load-more') {\n index = this.page.items.findIndex(option => option.value.toString() === this.option.value.toString());\n } else if (this.loadingAction === 'load-more') {\n index = this.page.items.length - this.page.baseIndex;\n }\n // when action require a loadMore we fetch the API else we report action to next tick\n // Set \"load more\" if action match OR if next item not available in the current page\n if (action.name === 'load-more') {\n // wait for new element render and update scroll position\n // set component loading\n this.isLoading = true;\n promise = this.goToNextPage;\n } else if (\n action.cursor === Cursor.NEXT &&\n this.page.items.length <= this.page.total &&\n index + this.page.baseIndex === this.page.items.length &&\n index + this.page.baseIndex < this.page.total\n ) {\n // trigger load-more from button to benefit from `disabled-on-click`\n this.loadMoreElement.click();\n return;\n } else if (action.name === 'scroll') {\n promise = nextTick;\n } else {\n promise = this.updatePage;\n }\n\n return promise()\n .then(() => {\n // parse full items list from options\n const options = this.options.items.filter(this.optionsFilter);\n\n // update visual focus\n if (action.name !== 'load-data') {\n index = this.page.getIndexFromCursor(action.cursor, this.loadingAction === 'load-more' && index >= 0 ? options[index] : this.option);\n }\n this.option = options[index];\n\n // update scroll position\n this.scrollToIndex(index);\n })\n .finally(() => {\n // reset loading after next render\n requestAnimationFrame(() => {\n this.isLoading = false;\n this.loadingAction = undefined;\n });\n });\n };\n\n /**\n * Go to next page\n * @returns promise\n */\n private goToNextPage = (): Promise<void> => {\n this.loadMore.emit();\n if (Boolean(this.fetchurl)) {\n return this.getOptions(typeof this.page.next === 'string' ? this.page.next : undefined).then(nextPage => {\n if (!Boolean(nextPage)) return;\n // merge items from current page and next page\n const items = [...this.page.items, ...nextPage.items];\n // create new options pagination withe merged items\n this.options = new Paginate(items, { total: nextPage.total, next: nextPage.next, top: items.length });\n });\n } else {\n return nextTick(() => {\n if (typeof this.page.next === 'function') {\n const nextPage = this.page.next();\n this.page = new Page({\n ...nextPage,\n items: [...this.page.items, ...nextPage.items],\n });\n }\n });\n }\n };\n\n /**\n * Go to next page\n * @returns promise\n */\n private updatePage = async (): Promise<void> => {\n if (Boolean(this.fetchurl)) {\n return this.getOptions().then(page => {\n if (!Boolean(page)) return;\n // reset current options pagination from API response\n this.options = new Paginate(page.items, { total: page.total, next: page.next, top: page.top });\n });\n } else {\n this.page = this.options.getPage(0, this.optionsFilter);\n }\n };\n\n /**\n * Fetch request\n * @param url - to fetch\n * @returns new page from url\n */\n private getOptions = async (url = this.fetchurl): Promise<Pick<Page<Option>, 'items' | 'top'> & Partial<Page<Option>>> => {\n // add text filter\n const updateUrl = (typeof url === 'string' ? url : url.toString()).replaceAll(this.fetchmappings.request.filter, encodeURIComponent(this.filter));\n\n try {\n const response = await fetch(updateUrl, this.fetchoptions);\n if (!response.ok) {\n this.fetchError.emit(new Error(`${response.status} - ${response.statusText}`));\n return;\n }\n const json = await response.json();\n const items = getObjectValueFromKey<Response, Option[]>(json, this.fetchmappings.response.items).map(\n (item): Option => ({\n title: getObjectValueFromKey<unknown, Option['title']>(item, this.fetchmappings.response.itemTitle),\n value: this.fetchmappings.response.itemValue ? getObjectValueFromKey<unknown, Option['value']>(item, this.fetchmappings.response.itemValue) : item,\n }),\n );\n const total = Number(getObjectValueFromKey<Response, number>(json, this.fetchmappings.response.total, 0));\n const next = getObjectValueFromKey<Response, string>(json, this.fetchmappings.response.next);\n return { items, total, next, top: items.length };\n } catch (error) {\n this.fetchError.emit(error);\n }\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if component props are well configured on init\n * @returns timeout\n */\n componentWillLoad(): ReturnType<typeof setTimeout> {\n // Get locales\n this.messages = initLocales(this.element).messages;\n // Validate\n this.watchIdentifier(this.identifier);\n this.watchItems(this.items);\n if (Boolean(this.fetchurl)) {\n this.watchFetchOptions(this.fetchoptions);\n this.watchFetchMappings(this.fetchmappings);\n this.loadingWrapper({ name: 'load-data' });\n }\n this.watchValue(this.value);\n this.watchOptions(this.options);\n this.watchMgWidth(this.mgWidth);\n this.watchReadonly(this.readonly);\n this.watchDisabled(this.disabled);\n // Check validity when component is ready\n // return a promise to process action only in the FIRST render().\n // https://stenciljs.com/docs/component-lifecycle#componentwillload\n return setTimeout(() => {\n this.checkValidity();\n }, 0);\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n const listId = `${this.identifier}-list`;\n const readonlyValue = this.getValueTitle();\n const withResetButton = this.value && !this.disabled;\n\n let popoverContent: 'list' | 'notfound' | 'notavailable';\n if (this.page?.items.length > 0) popoverContent = 'list';\n else if (this.page?.items.length === 0 && Boolean(this.filter)) popoverContent = 'notfound';\n else if (this.page?.items.length === 0) popoverContent = 'notavailable';\n\n let activeDescendant;\n if (Boolean(this.option?.value)) {\n activeDescendant = this.option.value;\n } else if (typeof this.value === 'string') {\n activeDescendant = this.value;\n } else {\n activeDescendant = this.value?.value;\n }\n\n return (\n <mg-input\n label={this.label}\n identifier={this.identifier}\n class={this.classCollection.classes.join(' ')}\n ariaDescribedbyIDs={popoverContent && popoverContent !== 'list' ? [popoverContent] : []}\n labelOnTop={this.labelOnTop}\n labelHide={this.labelHide}\n required={this.required}\n tooltip={this.tooltip}\n tooltipPosition={this.readonly && this.value === undefined ? 'label' : this.tooltipPosition}\n helpText={this.helpText}\n errorMessage={this.errorMessage}\n >\n {this.readonly ? (\n readonlyValue && <b class=\"mg-c-input__readonly-value\">{readonlyValue}</b>\n ) : (\n <mg-popover\n identifier={this.popoverId}\n placement=\"bottom-start\"\n display={this.popoverDisplay}\n arrow-hide\n style={{\n '--mg-c-input-list-width': Boolean(this.input?.offsetWidth) ? `${this.input.offsetWidth}px` : undefined,\n }}\n data-fallback-placement=\"bottom-end\"\n onDisplay-change={this.handlePopoverDisplay}\n >\n <div class=\"mg-c-input__input-group-container\">\n <mg-icon icon=\"magnifying-glass\"></mg-icon>\n <input\n type=\"text\"\n role=\"combobox\"\n class=\"mg-c-input__box mg-c-input__box--width\"\n value={this.filter}\n id={this.identifier}\n name={this.name}\n placeholder={this.placeholder}\n title={this.placeholder}\n disabled={this.disabled}\n required={this.required}\n autocomplete=\"off\"\n aria-autocomplete=\"list\"\n aria-expanded={this.popoverDisplay.toString()}\n aria-controls={listId}\n aria-invalid={(this.invalid === true).toString()}\n aria-activedescendant={formatID(activeDescendant)}\n onInput={this.handleFilterInput}\n onBlur={this.handleFilterBlur}\n onFocus={this.handleFilterFocus}\n onKeyDown={this.handleFilterKeydown}\n ref={(el: HTMLInputElement) => {\n if (el !== null) this.input = el;\n }}\n />\n {withResetButton ? (\n <mg-button\n class=\"mg-c-input__box-append mg-c-input__reset\"\n variant=\"flat\"\n is-icon\n label={this.messages.general.reset}\n aria-controls={this.identifier}\n tabindex=\"-1\"\n onClick={this.handleResetButton}\n >\n <mg-icon icon=\"cross\"></mg-icon>\n </mg-button>\n ) : (\n <mg-button class=\"mg-c-input__box-append\" variant=\"flat\" is-icon label={this.itemsLabel} tabindex=\"-1\" disabled={this.disabled}>\n <mg-icon icon={`chevron-${this.popoverDisplay ? 'up' : 'down'}`}></mg-icon>\n </mg-button>\n )}\n </div>\n <div slot=\"content\" class=\"mg-c-input__popover-container\">\n {popoverContent === 'list' && [\n // eslint-disable-next-line jsx-a11y/role-supports-aria-props\n <ul key=\"list\" class=\"mg-c-input__input-list\" role=\"listbox\" id={listId} aria-label={this.itemsLabel} aria-setsize={this.page.total}>\n {this.page.items.map(option => {\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <li\n role=\"option\"\n class={{\n 'mg-c-input__input-list-item': true,\n 'mg-c-input__input-list-item--focus-visible': JSON.stringify(this.option?.value) === JSON.stringify(option.value),\n 'mg-c-input__input-list-item--selected': this.isCurrentOption(option),\n }}\n key={option.title}\n id={formatID(option.value)}\n aria-selected={this.isCurrentOption(option).toString()}\n onClick={this.handleOptionClick}\n >\n {option.title}\n {this.isCurrentOption(option) && <mg-icon icon=\"check\"></mg-icon>}\n </li>\n );\n })}\n </ul>,\n this.isLoading && <mg-loader key=\"loader\" message={this.messages.input.combobox.search} class={{ 'mg-u-visually-hidden': Boolean(this.page.next) }}></mg-loader>,\n this.page.next && (\n <mg-button\n key=\"load-more\"\n variant=\"flat\"\n class=\"mg-c-input__load-more\"\n tabIndex={-1}\n disabled={this.isLoading}\n full-width\n disable-on-click\n onClick={this.handleLoadMoreButton}\n aria-controls={listId}\n ref={(el: HTMLMgButtonElement) => {\n if (el !== null) this.loadMoreElement = el;\n }}\n >\n <mg-icon icon=\"chevron-down\"></mg-icon>\n {this.messages.input.combobox.loadMore}\n </mg-button>\n ),\n ]}\n {popoverContent === 'notfound' && (\n <p id={popoverContent} class=\"mg-c-input__popover-info\">\n {this.messages.input.combobox.notFound}\n </p>\n )}\n {popoverContent === 'notavailable' && (\n <p id={popoverContent} class=\"mg-c-input__popover-info\">\n {this.messages.input.combobox.notAvailable}\n </p>\n )}\n </div>\n </mg-popover>\n )}\n </mg-input>\n );\n }\n}\n"],"names":["isObject","Paginate","ClassList","formatID","Cursor","Keys","nextTick","Page","getObjectValueFromKey","toString","allItemsAreString","classReadonly","classDisabled","widths","isValidString","initLocales","h"],"mappings":";;;;;;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IAAI,CAAC,EAAE,EAAc,CAAA;YAChK,IAAI,CAAC,IAAI,CAAC,IAAI,KACZA,uBACE,GAAG,EAAC,WAAW,EACf,OAAO,EAAC,MAAM,EACd,KAAK,EAAC,uBAAuB,EAC7B,QAAQ,EAAE,EAAE,EACZ,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAA,YAAA,EAAA,IAAA,EAAA,kBAAA,EAAA,IAAA,EAGxB,OAAO,EAAE,IAAI,CAAC,oBAAoB,EAAA,eAAA,EACnB,MAAM,EACrB,GAAG,EAAE,CAAC,EAAuB,KAAI;oBAC/B,IAAI,EAAE,KAAK,IAAI;AAAE,wBAAA,IAAI,CAAC,eAAe,GAAG,EAAE;iBAC3C,EAAA,EAEDA,OAAS,CAAA,SAAA,EAAA,EAAA,IAAI,EAAC,cAAc,EAAW,CAAA,EACtC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAC5B,CACb;AACF,SAAA,EACA,cAAc,KAAK,UAAU,KAC5BA,eAAG,EAAE,EAAE,cAAc,EAAE,KAAK,EAAC,0BAA0B,EACpD,EAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CACpC,CACL,EACA,cAAc,KAAK,cAAc,KAChCA,OAAG,CAAA,GAAA,EAAA,EAAA,EAAE,EAAE,cAAc,EAAE,KAAK,EAAC,0BAA0B,EACpD,EAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CACxC,CACL,CACG,CACK,CACd,CACQ;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-CATFkm3O.js');
|
|
4
|
-
var index_es = require('./index.es-
|
|
4
|
+
var index_es = require('./index.es-C-3Gv8Eu.js');
|
|
5
5
|
var mgInput_conf = require('./mg-input.conf-WTsvDfpC.js');
|
|
6
|
-
var index$1 = require('./index-
|
|
6
|
+
var index$1 = require('./index-B_WwxtkQ.js');
|
|
7
7
|
|
|
8
8
|
/** Detect free variable `global` from Node.js. */
|
|
9
9
|
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
|
@@ -31117,10 +31117,10 @@ const defineEditor = (wrapperElement, { value, modules, readOnly, placeholder, h
|
|
|
31117
31117
|
readOnly,
|
|
31118
31118
|
placeholder,
|
|
31119
31119
|
});
|
|
31120
|
-
if (index_es.
|
|
31120
|
+
if (index_es.qe(value) && /<[a-z][\s\S]*>/i.test(value)) {
|
|
31121
31121
|
editor.clipboard.dangerouslyPasteHTML(value);
|
|
31122
31122
|
}
|
|
31123
|
-
else if (index_es.
|
|
31123
|
+
else if (index_es.qe(value)) {
|
|
31124
31124
|
editor.setText(value);
|
|
31125
31125
|
}
|
|
31126
31126
|
const editorContent = wrapperElement.querySelector('.ql-editor');
|
|
@@ -31183,14 +31183,14 @@ const MgInputRichTextEditor = class {
|
|
|
31183
31183
|
/**
|
|
31184
31184
|
* Component classes
|
|
31185
31185
|
*/
|
|
31186
|
-
this.classCollection = new index_es.
|
|
31186
|
+
this.classCollection = new index_es.qt(['mg-c-input--rich-text-editor']);
|
|
31187
31187
|
/**
|
|
31188
31188
|
* Check if the field is empty taking into account the value format
|
|
31189
31189
|
* @returns truthy is value is invalid
|
|
31190
31190
|
*/
|
|
31191
31191
|
this.isEmpty = () => {
|
|
31192
31192
|
const textContent = this.getTextContent();
|
|
31193
|
-
return !(index_es.
|
|
31193
|
+
return !(index_es.qe(textContent) && textContent !== '\n');
|
|
31194
31194
|
};
|
|
31195
31195
|
/**
|
|
31196
31196
|
* Extract the text without HTML tags from value
|
|
@@ -31216,7 +31216,7 @@ const MgInputRichTextEditor = class {
|
|
|
31216
31216
|
this.errorMessage = undefined;
|
|
31217
31217
|
if (this.valid)
|
|
31218
31218
|
return;
|
|
31219
|
-
else if (index_es.
|
|
31219
|
+
else if (index_es.qe(errorMessage)) {
|
|
31220
31220
|
this.errorMessage = errorMessage;
|
|
31221
31221
|
}
|
|
31222
31222
|
else if (this.required && this.isEmpty()) {
|
|
@@ -31231,7 +31231,7 @@ const MgInputRichTextEditor = class {
|
|
|
31231
31231
|
*/
|
|
31232
31232
|
this.handleFocus = () => {
|
|
31233
31233
|
this.classCollection.add(this.classFocus);
|
|
31234
|
-
this.classCollection = new index_es.
|
|
31234
|
+
this.classCollection = new index_es.qt(this.classCollection.classes);
|
|
31235
31235
|
};
|
|
31236
31236
|
/**
|
|
31237
31237
|
* Handles the blur event on the editor
|
|
@@ -31240,7 +31240,7 @@ const MgInputRichTextEditor = class {
|
|
|
31240
31240
|
this.handleBlur = () => {
|
|
31241
31241
|
// Manage focus
|
|
31242
31242
|
this.classCollection.delete(this.classFocus);
|
|
31243
|
-
this.classCollection = new index_es.
|
|
31243
|
+
this.classCollection = new index_es.qt(this.classCollection.classes);
|
|
31244
31244
|
if (!this.readonly) {
|
|
31245
31245
|
this.checkValidity();
|
|
31246
31246
|
this.setErrorMessage();
|
|
@@ -31292,8 +31292,8 @@ const MgInputRichTextEditor = class {
|
|
|
31292
31292
|
}
|
|
31293
31293
|
}
|
|
31294
31294
|
validatePattern(newValue) {
|
|
31295
|
-
if (newValue !== undefined && !(index_es.
|
|
31296
|
-
throw new Error(`<mg-input-rich-text-editor> props "pattern" and "patternErrorMessage" must be non-empty string and paired. Passed value: "pattern='${index_es.
|
|
31295
|
+
if (newValue !== undefined && !(index_es.qe(this.pattern) && index_es.qe(this.patternErrorMessage))) {
|
|
31296
|
+
throw new Error(`<mg-input-rich-text-editor> props "pattern" and "patternErrorMessage" must be non-empty string and paired. Passed value: "pattern='${index_es.Yt(this.pattern)}'" and "patternErrorMessage='${index_es.Yt(this.patternErrorMessage)}'".`);
|
|
31297
31297
|
}
|
|
31298
31298
|
}
|
|
31299
31299
|
/**
|
|
@@ -31349,7 +31349,7 @@ const MgInputRichTextEditor = class {
|
|
|
31349
31349
|
if (typeof valid !== 'boolean') {
|
|
31350
31350
|
throw new Error('<mg-input-rich-text-editor> method "setError()" param "valid" must be a boolean.');
|
|
31351
31351
|
}
|
|
31352
|
-
else if (!index_es.
|
|
31352
|
+
else if (!index_es.qe(errorMessage)) {
|
|
31353
31353
|
throw new Error('<mg-input-rich-text-editor> method "setError()" param "errorMessage" must be a string.');
|
|
31354
31354
|
}
|
|
31355
31355
|
else {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-CATFkm3O.js');
|
|
4
|
-
var index$1 = require('./index-
|
|
5
|
-
var index_es = require('./index.es-
|
|
4
|
+
var index$1 = require('./index-B_WwxtkQ.js');
|
|
5
|
+
var index_es = require('./index.es-C-3Gv8Eu.js');
|
|
6
6
|
|
|
7
7
|
const mgLoaderCss = ".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}:host{display:block}.mg-c-loader{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:var(--mg-b-size-4);text-align:center}";
|
|
8
8
|
|
|
@@ -15,8 +15,8 @@ const MgLoader = class {
|
|
|
15
15
|
this.messageHide = false;
|
|
16
16
|
}
|
|
17
17
|
watchMessage(newValue) {
|
|
18
|
-
if (newValue && !index_es.
|
|
19
|
-
throw new Error(`<mg-loader> prop "message" must be a valid string. Passed value: ${index_es.
|
|
18
|
+
if (newValue && !index_es.qe(newValue))
|
|
19
|
+
throw new Error(`<mg-loader> prop "message" must be a valid string. Passed value: ${index_es.Yt(newValue)}.`);
|
|
20
20
|
}
|
|
21
21
|
/*************
|
|
22
22
|
* Lifecycle *
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-CATFkm3O.js');
|
|
4
|
-
var index_es = require('./index.es-
|
|
4
|
+
var index_es = require('./index.es-C-3Gv8Eu.js');
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* List of all possibles roles
|
|
@@ -35,26 +35,26 @@ const MgProgress = class {
|
|
|
35
35
|
this.max = 100;
|
|
36
36
|
}
|
|
37
37
|
watchLabel(newValue) {
|
|
38
|
-
if (!index_es.
|
|
39
|
-
throw new Error(`<mg-progress> prop "label" must be a valid string. Passed value: ${index_es.
|
|
38
|
+
if (!index_es.qe(newValue)) {
|
|
39
|
+
throw new Error(`<mg-progress> prop "label" must be a valid string. Passed value: ${index_es.Yt(newValue)}.`);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
watchAriaRole(newValue) {
|
|
43
43
|
if (newValue && !roles.includes(newValue)) {
|
|
44
|
-
throw new Error(`<mg-progress> prop "ariaRole" must be one of: ${roles.join(', ')}. Passed value: ${index_es.
|
|
44
|
+
throw new Error(`<mg-progress> prop "ariaRole" must be one of: ${roles.join(', ')}. Passed value: ${index_es.Yt(newValue)}.`);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
watchValue(newValue) {
|
|
48
|
-
if (newValue !== undefined && (!index_es.
|
|
49
|
-
throw new Error(`<mg-progress> prop “value” must be a number within the range ${this.min} to ${this.max}. Passed value: ${index_es.
|
|
48
|
+
if (newValue !== undefined && (!index_es.Qt(newValue) || !(newValue >= this.min && newValue <= this.max)))
|
|
49
|
+
throw new Error(`<mg-progress> prop “value” must be a number within the range ${this.min} to ${this.max}. Passed value: ${index_es.Yt(newValue)}.`);
|
|
50
50
|
}
|
|
51
51
|
watchMin(newValue) {
|
|
52
|
-
if (newValue !== 0 && newValue !== undefined && (!index_es.
|
|
53
|
-
throw new Error(`<mg-progress> prop “min” must be a number lower than: ${this.max}. Passed value: ${index_es.
|
|
52
|
+
if (newValue !== 0 && newValue !== undefined && (!index_es.Qt(newValue) || newValue >= this.max))
|
|
53
|
+
throw new Error(`<mg-progress> prop “min” must be a number lower than: ${this.max}. Passed value: ${index_es.Yt(newValue)}.`);
|
|
54
54
|
}
|
|
55
55
|
watchMax(newValue) {
|
|
56
|
-
if (newValue !== 100 && newValue !== undefined && (!index_es.
|
|
57
|
-
throw new Error(`<mg-progress> prop “max” must be a number greater than: ${this.min}. Passed value: ${index_es.
|
|
56
|
+
if (newValue !== 100 && newValue !== undefined && (!index_es.Qt(newValue) || newValue <= this.min))
|
|
57
|
+
throw new Error(`<mg-progress> prop “max” must be a number greater than: ${this.min}. Passed value: ${index_es.Yt(newValue)}.`);
|
|
58
58
|
}
|
|
59
59
|
/*************
|
|
60
60
|
* Lifecycle *
|
|
@@ -205,7 +205,7 @@ export class MgButton {
|
|
|
205
205
|
*/
|
|
206
206
|
render() {
|
|
207
207
|
var _a;
|
|
208
|
-
return (h(Host, { key: '
|
|
208
|
+
return (h(Host, { key: '75cfc1c3626cb040323feaccc4d6926a142a1cec', role: "button", tabIndex: this.element.getAttribute('tabindex') || 0, type: this.type, form: this.form, "full-width": this.fullWidth, "aria-label": this.label, "aria-disabled": (_a = this.disabled) === null || _a === void 0 ? void 0 : _a.toString(), onClick: this.handleClick, onKeyup: this.handleKeyup, onKeydown: this.handleKeydown }, h("div", { key: 'cf20f508a4ee0e9674fde4bc5307f2e16cf2894e', class: this.classCollection.join() }, this.loading && h("mg-icon", { key: 'b378739392aa99ed04299c702aed4d87a2e81a72', icon: "loader", spin: true }), h("div", { key: '02dcdb164ca3963c0f1740fd3742d178c2b951b5', class: "mg-c-button__content" }, h("slot", { key: 'fb29ea2b9a9a9bf3d22b283227fe60b7a0ce697e' })))));
|
|
209
209
|
}
|
|
210
210
|
static get is() { return "mg-button"; }
|
|
211
211
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mg-button.js","sourceRoot":"","sources":["../../../../src/components/atoms/mg-button/mg-button.tsx"],"names":[],"mappings":"AAAA,OA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Q,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;gBAC5F,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,MAAM;;QACJ,OAAO,CACL,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;YAE7B,4DAAK,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE;gBACpC,IAAI,CAAC,OAAO,IAAI,gEAAS,IAAI,EAAC,QAAQ,EAAC,IAAI,SAAW;gBACvD,4DAAK,KAAK,EAAC,sBAAsB;oBAC/B,8DAAa,CACT,CACF,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Prop, State, Watch, Host, EventEmitter, Event } from '@stencil/core';\nimport { variants, VariantType, ButtonType, SizeType, sizes } from './mg-button.conf';\nimport { ClassList, isValidString, nextTick, toString } from '@mgdis/stencil-helpers';\nimport { Keys } from '../../../utils/events.utils';\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({ mutable: true }) variant: VariantType = 'primary';\n @Watch('variant')\n validateVariant(newValue: VariantType, oldValue?: VariantType): void {\n // validate new value\n if (!variants.includes(newValue)) {\n if ((newValue as string) === '') {\n // Reactive framework like VUE render with `\"\"` when prop is update to undefined\n this.variant = variants[0];\n return;\n }\n throw new Error(`<mg-button> prop \"variant\" must be one of: ${variants.join(', ')}. Passed value: ${toString(newValue)}.`);\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 * 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 * Define button size\n */\n @Prop() size: SizeType = 'medium';\n @Watch('size')\n validateSize(newValue: MgButton['size'], oldValue?: MgButton['size']): void {\n // validate new value\n if (!sizes.includes(newValue)) {\n throw new Error(`<mg-button> prop \"size\" must be one of: ${sizes.join(', ')}. Passed value: ${toString(newValue)}.`);\n } else {\n if (oldValue !== undefined) {\n this.classCollection.delete(`mg-c-button--${oldValue}`);\n }\n this.classCollection.add(`mg-c-button--${newValue}`);\n this.setIconSize();\n }\n }\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 @Watch('isIcon')\n watchIsIcon(newValue: boolean): void {\n if (newValue) {\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 this.setIconSize();\n }\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 && [Keys.ENTER, Keys.NUMPADENTER, Keys.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 * Set child `<mg-icon>` element `size` prop to follow the current `size` prop\n */\n private setIconSize = (): void => {\n if (this.size === 'medium') {\n this.element.querySelector('mg-icon[size]')?.removeAttribute('size');\n } else if (this.isIcon) {\n this.element.querySelector('mg-icon')?.setAttribute('size', this.size);\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 this.validateSize(this.size);\n this.watchIsIcon(this.isIcon);\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()}>\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"]}
|
|
1
|
+
{"version":3,"file":"mg-button.js","sourceRoot":"","sources":["../../../../src/components/atoms/mg-button/mg-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAgB,KAAK,EAAE,MAAM,eAAe,CAAC;AACrG,OAAO,EAAE,QAAQ,EAAqC,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAEnD;;GAEG;AAMH,MAAM,OAAO,QAAQ;IALrB;QAME;;sBAEc;QAEN,qBAAgB,GAAG,IAAI,CAAC;QACf,kBAAa,GAAG,uBAAuB,CAAC;QACxC,iBAAY,GAAG,sBAAsB,CAAC;QACtC,mBAAc,GAAG,yBAAyB,CAAC;QAW5D;;WAEG;QACsB,YAAO,GAAgB,SAAS,CAAC;QA8B1D;;WAEG;QACK,SAAI,GAAa,QAAQ,CAAC;QAelC;;WAEG;QACK,cAAS,GAAG,KAAK,CAAC;QA0C1B;;;WAGG;QACK,WAAM,GAAG,KAAK,CAAC;QAYvB;;;WAGG;QACK,mBAAc,GAAG,KAAK,CAAC;QAE/B;;;;WAIG;QACM,YAAO,GAAG,KAAK,CAAC;QAWzB;;WAEG;QACM,oBAAe,GAAc,IAAI,SAAS,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC;QAOrE;;;WAGG;QACK,gBA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Prop, State, Watch, Host, EventEmitter, Event } from '@stencil/core';\nimport { variants, VariantType, ButtonType, SizeType, sizes } from './mg-button.conf';\nimport { ClassList, isValidString, nextTick, toString } from '@mgdis/stencil-helpers';\nimport { Keys } from '../../../utils/events.utils';\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({ mutable: true }) variant: VariantType = 'primary';\n @Watch('variant')\n validateVariant(newValue: VariantType, oldValue?: VariantType): void {\n // validate new value\n if (!variants.includes(newValue)) {\n if ((newValue as string) === '') {\n // Reactive framework like VUE render with `\"\"` when prop is update to undefined\n this.variant = variants[0];\n return;\n }\n throw new Error(`<mg-button> prop \"variant\" must be one of: ${variants.join(', ')}. Passed value: ${toString(newValue)}.`);\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 * 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 * Define button size\n */\n @Prop() size: SizeType = 'medium';\n @Watch('size')\n validateSize(newValue: MgButton['size'], oldValue?: MgButton['size']): void {\n // validate new value\n if (!sizes.includes(newValue)) {\n throw new Error(`<mg-button> prop \"size\" must be one of: ${sizes.join(', ')}. Passed value: ${toString(newValue)}.`);\n } else {\n if (oldValue !== undefined) {\n this.classCollection.delete(`mg-c-button--${oldValue}`);\n }\n this.classCollection.add(`mg-c-button--${newValue}`);\n this.setIconSize();\n }\n }\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 @Watch('isIcon')\n watchIsIcon(newValue: boolean): void {\n if (newValue) {\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 this.setIconSize();\n }\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 && [Keys.ENTER, Keys.NUMPADENTER, Keys.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 * Set child `<mg-icon>` element `size` prop to follow the current `size` prop\n */\n private setIconSize = (): void => {\n if (this.size === 'medium') {\n this.element.querySelector('mg-icon[size]')?.removeAttribute('size');\n } else if (this.isIcon) {\n this.element.querySelector('mg-icon')?.setAttribute('size', this.size);\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 this.validateSize(this.size);\n this.watchIsIcon(this.isIcon);\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={this.element.getAttribute('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()}>\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mg-tooltip.conf.js","sourceRoot":"","sources":["../../../../src/components/atoms/mg-tooltip/mg-tooltip.conf.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mg-tooltip.conf.js","sourceRoot":"","sources":["../../../../src/components/atoms/mg-tooltip/mg-tooltip.conf.tsx"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,KAAK,GAA8B;IAC9C,KAAK,EAAE,OAAO;IACd,qBAAqB,EAAE,cAAc;IACrC,uBAAuB,EAAE,gBAAgB;IACzC,gBAAgB,EAAE,gBAAgB;CACnC,CAAC","sourcesContent":["export type GuardType = 'focus' | 'hoverTooltip' | 'hoverTooltiped' | 'disableOnClick';\n\nexport const Guard: Record<string, GuardType> = {\n FOCUS: 'focus',\n HOVER_TOOLTIP_ELEMENT: 'hoverTooltip',\n HOVER_TOOLTIPED_ELEMENT: 'hoverTooltiped',\n DISABLE_ON_CLICK: 'disableOnClick',\n};\n"]}
|