@mgdis/mg-components 5.17.0 → 5.19.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/{mg-menu.conf-43aacf30.js → components.utils-dc9c8a53.js} +160 -7
- package/dist/cjs/components.utils-dc9c8a53.js.map +1 -0
- package/dist/cjs/index-c042e24b.js +18 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mg-action-more_34.cjs.entry.js +761 -582
- package/dist/cjs/mg-action-more_34.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/cjs/mg-item-more.cjs.entry.js +5 -5
- package/dist/cjs/mg-item-more.cjs.entry.js.map +1 -1
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +9 -9
- package/dist/collection/components/atoms/mg-badge/mg-badge.js.map +1 -1
- package/dist/collection/components/atoms/mg-badge/test/mg-badge.spec.js +5 -5
- package/dist/collection/components/atoms/mg-badge/test/mg-badge.spec.js.map +1 -1
- package/dist/collection/components/atoms/mg-button/mg-button.js +12 -12
- package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
- package/dist/collection/components/atoms/mg-button/test/mg-button.e2e.js +4 -4
- package/dist/collection/components/atoms/mg-button/test/mg-button.e2e.js.map +1 -1
- package/dist/collection/components/atoms/mg-button/test/mg-button.spec.js +3 -3
- package/dist/collection/components/atoms/mg-button/test/mg-button.spec.js.map +1 -1
- package/dist/collection/components/atoms/mg-card/mg-card.js +9 -9
- package/dist/collection/components/atoms/mg-card/mg-card.js.map +1 -1
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +3 -3
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js.map +1 -1
- package/dist/collection/components/atoms/mg-divider/mg-divider.js +4 -4
- package/dist/collection/components/atoms/mg-divider/mg-divider.js.map +1 -1
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +13 -15
- package/dist/collection/components/atoms/mg-icon/mg-icon.js.map +1 -1
- package/dist/collection/components/atoms/mg-icon/test/mg-icon.spec.js +4 -4
- package/dist/collection/components/atoms/mg-icon/test/mg-icon.spec.js.map +1 -1
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +5 -4
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js.map +1 -1
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +9 -9
- package/dist/collection/components/atoms/mg-tag/mg-tag.js.map +1 -1
- package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.playwright.js +23 -0
- package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.playwright.js.map +1 -0
- package/dist/collection/components/atoms/mg-tag/test/mg-tag.spec.js +5 -5
- package/dist/collection/components/atoms/mg-tag/test/mg-tag.spec.js.map +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +2 -2
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js.map +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +37 -17
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
- package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js +7 -1
- package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js.map +1 -1
- package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js +9 -1
- package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/MgInput.js +12 -11
- package/dist/collection/components/molecules/inputs/MgInput.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +4 -4
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +2 -2
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +111 -38
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.js +21 -27
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js +62 -6
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +84 -13
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js +55 -0
- package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +115 -44
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js +55 -0
- package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +88 -15
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js +55 -0
- package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +87 -14
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.e2e.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.e2e.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js +60 -0
- package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +87 -14
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js +55 -0
- package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.conf.js +5 -0
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.conf.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +151 -34
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.js +147 -0
- package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js +80 -7
- package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +110 -36
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js +69 -6
- package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +9 -9
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js +2 -2
- package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js.map +1 -1
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +2 -2
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js.map +1 -1
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +8 -9
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -1
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +6 -6
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
- package/dist/collection/components/molecules/mg-details/mg-details.js +5 -4
- package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -1
- package/dist/collection/components/molecules/mg-details/test/mg-details.spec.js +1 -1
- package/dist/collection/components/molecules/mg-details/test/mg-details.spec.js.map +1 -1
- package/dist/collection/components/molecules/mg-form/mg-form.js +6 -6
- package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
- package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js +4 -4
- package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js.map +1 -1
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +7 -7
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js.map +1 -1
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +5 -4
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.js.map +1 -1
- package/dist/collection/components/molecules/mg-message/mg-message.js +8 -8
- package/dist/collection/components/molecules/mg-message/mg-message.js.map +1 -1
- package/dist/collection/components/molecules/mg-message/test/mg-message.spec.js +11 -11
- package/dist/collection/components/molecules/mg-message/test/mg-message.spec.js.map +1 -1
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +8 -8
- package/dist/collection/components/molecules/mg-modal/mg-modal.js.map +1 -1
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js +7 -7
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js.map +1 -1
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.js +3 -3
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.js.map +1 -1
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.spec.js +1 -1
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.spec.js.map +1 -1
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +3 -3
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js.map +1 -1
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +17 -15
- package/dist/collection/components/molecules/mg-panel/mg-panel.js.map +1 -1
- package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js +3 -3
- package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js.map +1 -1
- package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js +11 -21
- package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js.map +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +4 -4
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js.map +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +36 -16
- package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
- package/dist/collection/components/molecules/mg-popover/test/{mg-popover.e2e.js → mg-popover.e2e.playwright.js} +54 -62
- package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.playwright.js.map +1 -0
- package/dist/collection/components/molecules/mg-popover/test/mg-popover.spec.js +12 -0
- package/dist/collection/components/molecules/mg-popover/test/mg-popover.spec.js.map +1 -1
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +5 -6
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js.map +1 -1
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +34 -34
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js.map +1 -1
- package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.spec.js +13 -13
- package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.spec.js.map +1 -1
- package/dist/collection/locales/en/messages.json +3 -3
- package/dist/collection/locales/fr/messages.json +3 -3
- package/dist/collection/utils/components.utils.js +16 -0
- package/dist/collection/utils/components.utils.js.map +1 -1
- package/dist/collection/utils/components.utils.spec.js +22 -1
- package/dist/collection/utils/components.utils.spec.js.map +1 -1
- package/dist/collection/variables.css +1 -275
- package/dist/components/MgInput.js +17 -16
- package/dist/components/MgInput.js.map +1 -1
- package/dist/components/components.utils.js +17 -1
- package/dist/components/components.utils.js.map +1 -1
- package/dist/components/index2.js +6 -6
- package/dist/components/mg-action-more.js +5 -5
- package/dist/components/mg-action-more.js.map +1 -1
- package/dist/components/mg-badge2.js +8 -8
- package/dist/components/mg-badge2.js.map +1 -1
- package/dist/components/mg-button2.js +11 -11
- package/dist/components/mg-button2.js.map +1 -1
- package/dist/components/mg-card2.js +8 -8
- package/dist/components/mg-card2.js.map +1 -1
- package/dist/components/mg-character-left2.js +1 -1
- package/dist/components/mg-character-left2.js.map +1 -1
- package/dist/components/mg-details.js +4 -3
- package/dist/components/mg-details.js.map +1 -1
- package/dist/components/mg-divider.js +3 -3
- package/dist/components/mg-divider.js.map +1 -1
- package/dist/components/mg-form.js +4 -4
- package/dist/components/mg-form.js.map +1 -1
- package/dist/components/mg-icon2.js +12 -14
- package/dist/components/mg-icon2.js.map +1 -1
- package/dist/components/mg-illustrated-message.js +7 -7
- package/dist/components/mg-illustrated-message.js.map +1 -1
- package/dist/components/mg-input-checkbox-paginated2.js +8 -8
- package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
- package/dist/components/mg-input-checkbox.js +70 -34
- package/dist/components/mg-input-checkbox.js.map +1 -1
- package/dist/components/mg-input-date.js +45 -12
- package/dist/components/mg-input-date.js.map +1 -1
- package/dist/components/mg-input-numeric.js +76 -43
- package/dist/components/mg-input-numeric.js.map +1 -1
- package/dist/components/mg-input-password.js +49 -14
- package/dist/components/mg-input-password.js.map +1 -1
- package/dist/components/mg-input-radio.js +48 -13
- package/dist/components/mg-input-radio.js.map +1 -1
- package/dist/components/mg-input-select2.js +48 -13
- package/dist/components/mg-input-select2.js.map +1 -1
- package/dist/components/mg-input-text2.js +83 -33
- package/dist/components/mg-input-text2.js.map +1 -1
- package/dist/components/mg-input-textarea.js +69 -35
- package/dist/components/mg-input-textarea.js.map +1 -1
- package/dist/components/mg-input-title2.js +4 -3
- package/dist/components/mg-input-title2.js.map +1 -1
- package/dist/components/mg-input-toggle.js +9 -9
- package/dist/components/mg-input-toggle.js.map +1 -1
- package/dist/components/mg-item-more.js +4 -3
- package/dist/components/mg-item-more.js.map +1 -1
- package/dist/components/mg-menu-item2.js +7 -8
- package/dist/components/mg-menu-item2.js.map +1 -1
- package/dist/components/mg-menu2.js +1 -1
- package/dist/components/mg-menu2.js.map +1 -1
- package/dist/components/mg-message.js +7 -7
- package/dist/components/mg-message.js.map +1 -1
- package/dist/components/mg-modal.js +7 -7
- package/dist/components/mg-modal.js.map +1 -1
- package/dist/components/mg-pagination2.js +2 -2
- package/dist/components/mg-pagination2.js.map +1 -1
- package/dist/components/mg-panel.js +16 -15
- package/dist/components/mg-panel.js.map +1 -1
- 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 +33 -14
- package/dist/components/mg-popover2.js.map +1 -1
- package/dist/components/mg-skip-links.js +4 -5
- package/dist/components/mg-skip-links.js.map +1 -1
- package/dist/components/mg-tabs.js +33 -33
- package/dist/components/mg-tabs.js.map +1 -1
- package/dist/components/mg-tag.js +8 -8
- package/dist/components/mg-tag.js.map +1 -1
- 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 +34 -15
- package/dist/components/mg-tooltip2.js.map +1 -1
- package/dist/esm/{mg-menu.conf-012fc9b4.js → components.utils-0f76010d.js} +153 -8
- package/dist/esm/components.utils-0f76010d.js.map +1 -0
- package/dist/esm/index-ce01e63b.js +18 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mg-action-more_34.entry.js +697 -518
- package/dist/esm/mg-action-more_34.entry.js.map +1 -1
- package/dist/esm/mg-components.js +1 -1
- package/dist/esm/mg-item-more.entry.js +4 -4
- package/dist/esm/mg-item-more.entry.js.map +1 -1
- package/dist/mg-components/locales/en/messages.json +3 -3
- package/dist/mg-components/locales/fr/messages.json +3 -3
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/mg-components.esm.js.map +1 -1
- package/dist/mg-components/p-768fc594.entry.js +2 -0
- package/dist/mg-components/p-768fc594.entry.js.map +1 -0
- package/dist/mg-components/p-c9e2c669.js +2 -0
- package/dist/mg-components/p-c9e2c669.js.map +1 -0
- package/dist/mg-components/p-d2d6afec.entry.js +2 -0
- package/dist/mg-components/p-d2d6afec.entry.js.map +1 -0
- package/dist/mg-components/variables.css +1 -275
- package/dist/types/components/atoms/mg-card/mg-card.d.ts +1 -1
- package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +1 -1
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +4 -3
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.d.ts +1 -1
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +4 -4
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +22 -1
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +17 -2
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +35 -20
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +16 -1
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +16 -1
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +16 -1
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.conf.d.ts +12 -0
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +30 -6
- package/dist/types/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.d.ts +1 -0
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +17 -5
- package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +2 -1
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -1
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +3 -3
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +2 -1
- package/dist/types/components/molecules/mg-popover/test/mg-popover.e2e.playwright.d.ts +1 -0
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +6 -5
- package/dist/types/components.d.ts +71 -13
- package/dist/types/utils/components.utils.d.ts +12 -0
- package/package.json +17 -18
- package/readme.md +0 -31
- package/dist/cjs/mg-menu.conf-43aacf30.js.map +0 -1
- package/dist/collection/components/atoms/mg-badge/mg-badge.css +0 -116
- package/dist/collection/components/atoms/mg-button/mg-button.css +0 -182
- package/dist/collection/components/atoms/mg-card/mg-card.css +0 -75
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.css +0 -3
- package/dist/collection/components/atoms/mg-divider/mg-divider.css +0 -9
- package/dist/collection/components/atoms/mg-icon/mg-icon.css +0 -138
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.css +0 -12
- package/dist/collection/components/atoms/mg-tag/mg-tag.css +0 -131
- package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.js +0 -37
- package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.js.map +0 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.css +0 -43
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.css +0 -3
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +0 -268
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +0 -211
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +0 -257
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +0 -254
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +0 -179
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +0 -264
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +0 -304
- package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.js +0 -171
- package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.js.map +0 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +0 -303
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +0 -233
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.css +0 -37
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +0 -377
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.css +0 -39
- package/dist/collection/components/molecules/mg-details/mg-details.css +0 -64
- package/dist/collection/components/molecules/mg-form/mg-form.css +0 -19
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.css +0 -45
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.css +0 -30
- package/dist/collection/components/molecules/mg-message/mg-message.css +0 -82
- package/dist/collection/components/molecules/mg-modal/mg-modal.css +0 -67
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.css +0 -47
- package/dist/collection/components/molecules/mg-panel/mg-panel.css +0 -64
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.css +0 -135
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +0 -11
- package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.js.map +0 -1
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.css +0 -28
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +0 -99
- package/dist/collection/styles/a11y.scss +0 -36
- package/dist/collection/styles/fonts.scss +0 -21
- package/dist/collection/styles/form.scss +0 -3
- package/dist/collection/styles/global.scss +0 -80
- package/dist/collection/styles/layout.scss +0 -29
- package/dist/collection/styles/main.scss +0 -23
- package/dist/collection/styles/mg-icon-animation.scss +0 -6
- package/dist/collection/styles/navigation-button.scss +0 -77
- package/dist/collection/styles/reset-mg-card-slotted-variables.scss +0 -11
- package/dist/collection/styles/typography.scss +0 -82
- package/dist/collection/styles/utilities.scss +0 -21
- package/dist/collection/test/typography.e2e.playwright.js +0 -12
- package/dist/collection/test/typography.e2e.playwright.js.map +0 -1
- package/dist/esm/mg-menu.conf-012fc9b4.js.map +0 -1
- package/dist/mg-components/p-1d7d6fa0.js +0 -2
- package/dist/mg-components/p-1d7d6fa0.js.map +0 -1
- package/dist/mg-components/p-9257e8f1.entry.js +0 -2
- package/dist/mg-components/p-9257e8f1.entry.js.map +0 -1
- package/dist/mg-components/p-caafc9cf.entry.js +0 -2
- package/dist/mg-components/p-caafc9cf.entry.js.map +0 -1
- package/dist/mg-components/styles/a11y.scss +0 -36
- package/dist/mg-components/styles/fonts.scss +0 -21
- package/dist/mg-components/styles/form.scss +0 -3
- package/dist/mg-components/styles/global.scss +0 -80
- package/dist/mg-components/styles/layout.scss +0 -29
- package/dist/mg-components/styles/main.scss +0 -23
- package/dist/mg-components/styles/mg-icon-animation.scss +0 -6
- package/dist/mg-components/styles/navigation-button.scss +0 -77
- package/dist/mg-components/styles/reset-mg-card-slotted-variables.scss +0 -11
- package/dist/mg-components/styles/typography.scss +0 -82
- package/dist/mg-components/styles/utilities.scss +0 -21
- /package/dist/types/{test/typography.e2e.playwright.d.ts → components/atoms/mg-tag/test/mg-tag.e2e.playwright.d.ts} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
-
import { C as ClassList } from './components.utils.js';
|
|
2
|
+
import { C as ClassList, i as isValidString } from './components.utils.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* List of all possibles variants
|
|
6
6
|
*/
|
|
7
7
|
const variants = ['primary', 'secondary', 'success', 'warning', 'danger', 'info'];
|
|
8
8
|
|
|
9
|
-
const mgTagCss = ".mg-tag{padding:calc((var(--mg-tag-height) -
|
|
9
|
+
const mgTagCss = ":host{display:inline-block}.mg-c-tag{display:inline-flex;min-height:var(--mg-tag-height);box-sizing:border-box;align-items:center;padding:calc((var(--mg-tag-height) - .2rem - var(--mg-tag-font-size)*var(--line-height))/2) .6rem;border:.1rem solid;border-radius:var(--mg-tag-border-radius);font-size:var(--mg-tag-font-size);font-weight:600;text-align:center;vertical-align:middle}.mg-c-tag.mg-c-tag--primary{border-color:hsl(var(--color-dark));background-color:hsl(var(--color-dark));color:hsl(var(--color-light))}.mg-c-tag.mg-c-tag--primary.mg-c-tag--outline{background-color:rgba(0,0,0,0);color:hsl(var(--color-dark))}.mg-c-tag.mg-c-tag--primary.mg-c-tag--soft{border-color:hsl(var(--color-dark-h), var(--color-dark-s), var(--mg-color-soft-l));background-color:hsl(var(--color-dark-h), var(--color-dark-s), var(--mg-color-soft-l));color:hsl(var(--color-dark));font-weight:400}.mg-c-tag.mg-c-tag--primary.mg-c-tag--soft ::slotted(mg-icon){color:hsl(var(--color-dark))}.mg-c-tag.mg-c-tag--secondary{border-color:hsl(var(--color-light));background-color:hsl(var(--color-light));color:hsl(var(--color-dark))}.mg-c-tag.mg-c-tag--secondary.mg-c-tag--outline{background-color:rgba(0,0,0,0);color:hsl(var(--color-light))}.mg-c-tag.mg-c-tag--secondary.mg-c-tag--soft{border-color:hsl(var(--color-light-h), var(--color-light-s), var(--mg-color-soft-l));background-color:hsl(var(--color-light-h), var(--color-light-s), var(--mg-color-soft-l));color:hsl(var(--color-dark));font-weight:400}.mg-c-tag.mg-c-tag--secondary.mg-c-tag--soft ::slotted(mg-icon){color:hsl(var(--color-dark))}.mg-c-tag.mg-c-tag--success{border-color:hsl(var(--color-success));background-color:hsl(var(--color-success));color:hsl(var(--color-dark))}.mg-c-tag.mg-c-tag--success.mg-c-tag--outline{background-color:rgba(0,0,0,0);color:hsl(var(--color-success))}.mg-c-tag.mg-c-tag--success.mg-c-tag--soft{border-color:hsl(var(--color-success-h), var(--color-success-s), var(--mg-color-soft-l));background-color:hsl(var(--color-success-h), var(--color-success-s), var(--mg-color-soft-l));color:hsl(var(--color-dark));font-weight:400}.mg-c-tag.mg-c-tag--success.mg-c-tag--soft ::slotted(mg-icon){color:hsl(var(--color-success))}.mg-c-tag.mg-c-tag--warning{border-color:hsl(var(--color-warning));background-color:hsl(var(--color-warning));color:hsl(var(--color-dark))}.mg-c-tag.mg-c-tag--warning.mg-c-tag--outline{background-color:rgba(0,0,0,0);color:hsl(var(--color-warning))}.mg-c-tag.mg-c-tag--warning.mg-c-tag--soft{border-color:hsl(var(--color-warning-h), var(--color-warning-s), var(--mg-color-soft-l));background-color:hsl(var(--color-warning-h), var(--color-warning-s), var(--mg-color-soft-l));color:hsl(var(--color-dark));font-weight:400}.mg-c-tag.mg-c-tag--warning.mg-c-tag--soft ::slotted(mg-icon){color:hsl(var(--color-warning))}.mg-c-tag.mg-c-tag--danger{border-color:hsl(var(--color-danger));background-color:hsl(var(--color-danger));color:hsl(var(--color-light))}.mg-c-tag.mg-c-tag--danger.mg-c-tag--outline{background-color:rgba(0,0,0,0);color:hsl(var(--color-danger))}.mg-c-tag.mg-c-tag--danger.mg-c-tag--soft{border-color:hsl(var(--color-danger-h), var(--color-danger-s), var(--mg-color-soft-l));background-color:hsl(var(--color-danger-h), var(--color-danger-s), var(--mg-color-soft-l));color:hsl(var(--color-dark));font-weight:400}.mg-c-tag.mg-c-tag--danger.mg-c-tag--soft ::slotted(mg-icon){color:hsl(var(--color-danger))}.mg-c-tag.mg-c-tag--info{border-color:hsl(var(--color-info));background-color:hsl(var(--color-info));color:hsl(var(--color-light))}.mg-c-tag.mg-c-tag--info.mg-c-tag--outline{background-color:rgba(0,0,0,0);color:hsl(var(--color-info))}.mg-c-tag.mg-c-tag--info.mg-c-tag--soft{border-color:hsl(var(--color-info-h), var(--color-info-s), var(--mg-color-soft-l));background-color:hsl(var(--color-info-h), var(--color-info-s), var(--mg-color-soft-l));color:hsl(var(--color-dark));font-weight:400}.mg-c-tag.mg-c-tag--info.mg-c-tag--soft ::slotted(mg-icon){color:hsl(var(--color-info))}::slotted(mg-icon){margin-right:.4rem}slot{display:inline-flex;align-items:center}";
|
|
10
10
|
|
|
11
11
|
const MgTag$1 = /*@__PURE__*/ proxyCustomElement(class MgTag extends HTMLElement {
|
|
12
12
|
constructor() {
|
|
@@ -17,12 +17,12 @@ const MgTag$1 = /*@__PURE__*/ proxyCustomElement(class MgTag extends HTMLElement
|
|
|
17
17
|
* Internal *
|
|
18
18
|
************/
|
|
19
19
|
// Classes
|
|
20
|
-
this.classOutline = 'mg-tag--outline';
|
|
21
|
-
this.classSoft = 'mg-tag--soft';
|
|
20
|
+
this.classOutline = 'mg-c-tag--outline';
|
|
21
|
+
this.classSoft = 'mg-c-tag--soft';
|
|
22
22
|
this.variant = variants[0];
|
|
23
23
|
this.outline = undefined;
|
|
24
24
|
this.soft = undefined;
|
|
25
|
-
this.classCollection = new ClassList(['mg-tag']);
|
|
25
|
+
this.classCollection = new ClassList(['mg-c-tag']);
|
|
26
26
|
}
|
|
27
27
|
validateVariant(newValue, oldValue) {
|
|
28
28
|
if (!variants.includes(newValue)) {
|
|
@@ -30,9 +30,9 @@ const MgTag$1 = /*@__PURE__*/ proxyCustomElement(class MgTag extends HTMLElement
|
|
|
30
30
|
}
|
|
31
31
|
else {
|
|
32
32
|
if (oldValue !== undefined) {
|
|
33
|
-
this.classCollection.delete(`mg-tag--${oldValue}`);
|
|
33
|
+
this.classCollection.delete(`mg-c-tag--${oldValue}`);
|
|
34
34
|
}
|
|
35
|
-
this.classCollection.add(`mg-tag--${newValue}`);
|
|
35
|
+
this.classCollection.add(`mg-c-tag--${newValue}`);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
validateOutline(newValue) {
|
|
@@ -59,7 +59,7 @@ const MgTag$1 = /*@__PURE__*/ proxyCustomElement(class MgTag extends HTMLElement
|
|
|
59
59
|
* @param textContent - html element textContent property
|
|
60
60
|
*/
|
|
61
61
|
validateTextContent(textContent) {
|
|
62
|
-
if (
|
|
62
|
+
if (!isValidString(textContent))
|
|
63
63
|
throw new Error('<mg-tag> slot must contain a text content.');
|
|
64
64
|
}
|
|
65
65
|
/*************
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"mg-tag.js","mappings":";;;AAAA;;;AAGO,MAAM,QAAQ,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,CAAU;;ACHjG,MAAM,QAAQ,GAAG,
|
|
1
|
+
{"file":"mg-tag.js","mappings":";;;AAAA;;;AAGO,MAAM,QAAQ,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,CAAU;;ACHjG,MAAM,QAAQ,GAAG,y9HAAy9H;;MCQ79HA,OAAK;;;;;;;;;IAMC,iBAAY,GAAG,mBAAmB,CAAC;IACnC,cAAS,GAAG,gBAAgB,CAAC;mBAcZ,QAAQ,CAAC,CAAC,CAAC;;;2BAwCP,IAAI,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC;;EAtCjE,eAAe,CAAC,QAA0B,EAAE,QAA2B;IACrE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;MAChC,MAAM,IAAI,KAAK,CAAC,2CAA2C,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACpF;SAAM;MACL,IAAI,QAAQ,KAAK,SAAS,EAAE;QAC1B,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,aAAa,QAAQ,EAAE,CAAC,CAAC;OACtD;MACD,IAAI,CAAC,eAAe,CA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ag.tsx"],"sourcesContent":["/**\n * List of all possibles variants\n */\nexport const variants = ['primary', 'secondary', 'success', 'warning', 'danger', 'info'] as const;\n\n/**\n * TagVariantType type from tag variants\n */\nexport type TagVariantType = (typeof variants)[number];\n",":host{display:inline-block}.mg-c-tag{display:inline-flex;min-height:var(--mg-tag-height);box-sizing:border-box;align-items:center;padding:calc((var(--mg-tag-height) - .2rem - var(--mg-tag-font-size)*var(--line-height))/2) .6rem;border:.1rem solid;border-radius:var(--mg-tag-border-radius);font-size:var(--mg-tag-font-size);font-weight:600;text-align:center;vertical-align:middle}.mg-c-tag.mg-c-tag--primary{border-color:hsl(var(--color-dark));background-color:hsl(var(--color-dark));color:hsl(var(--color-light))}.mg-c-tag.mg-c-tag--primary.mg-c-tag--outline{background-color:rgba(0,0,0,0);color:hsl(var(--color-dark))}.mg-c-tag.mg-c-tag--primary.mg-c-tag--soft{border-color:hsl(var(--color-dark-h), var(--color-dark-s), var(--mg-color-soft-l));background-color:hsl(var(--color-dark-h), var(--color-dark-s), var(--mg-color-soft-l));color:hsl(var(--color-dark));font-weight:400}.mg-c-tag.mg-c-tag--primary.mg-c-tag--soft ::slotted(mg-icon){color:hsl(var(--color-dark))}.mg-c-tag.mg-c-tag--secondary{border-color:hsl(var(--color-light));background-color:hsl(var(--color-light));color:hsl(var(--color-dark))}.mg-c-tag.mg-c-tag--secondary.mg-c-tag--outline{background-color:rgba(0,0,0,0);color:hsl(var(--color-light))}.mg-c-tag.mg-c-tag--secondary.mg-c-tag--soft{border-color:hsl(var(--color-light-h), var(--color-light-s), var(--mg-color-soft-l));background-color:hsl(var(--color-light-h), var(--color-light-s), var(--mg-color-soft-l));color:hsl(var(--color-dark));font-weight:400}.mg-c-tag.mg-c-tag--secondary.mg-c-tag--soft ::slotted(mg-icon){color:hsl(var(--color-dark))}.mg-c-tag.mg-c-tag--success{border-color:hsl(var(--color-success));background-color:hsl(var(--color-success));color:hsl(var(--color-dark))}.mg-c-tag.mg-c-tag--success.mg-c-tag--outline{background-color:rgba(0,0,0,0);color:hsl(var(--color-success))}.mg-c-tag.mg-c-tag--success.mg-c-tag--soft{border-color:hsl(var(--color-success-h), var(--color-success-s), var(--mg-color-soft-l));background-color:hsl(var(--color-success-h), var(--color-success-s), var(--mg-color-soft-l));color:hsl(var(--color-dark));font-weight:400}.mg-c-tag.mg-c-tag--success.mg-c-tag--soft ::slotted(mg-icon){color:hsl(var(--color-success))}.mg-c-tag.mg-c-tag--warning{border-color:hsl(var(--color-warning));background-color:hsl(var(--color-warning));color:hsl(var(--color-dark))}.mg-c-tag.mg-c-tag--warning.mg-c-tag--outline{background-color:rgba(0,0,0,0);color:hsl(var(--color-warning))}.mg-c-tag.mg-c-tag--warning.mg-c-tag--soft{border-color:hsl(var(--color-warning-h), var(--color-warning-s), var(--mg-color-soft-l));background-color:hsl(var(--color-warning-h), var(--color-warning-s), var(--mg-color-soft-l));color:hsl(var(--color-dark));font-weight:400}.mg-c-tag.mg-c-tag--warning.mg-c-tag--soft ::slotted(mg-icon){color:hsl(var(--color-warning))}.mg-c-tag.mg-c-tag--danger{border-color:hsl(var(--color-danger));background-color:hsl(var(--color-danger));color:hsl(var(--color-light))}.mg-c-tag.mg-c-tag--danger.mg-c-tag--outline{background-color:rgba(0,0,0,0);color:hsl(var(--color-danger))}.mg-c-tag.mg-c-tag--danger.mg-c-tag--soft{border-color:hsl(var(--color-danger-h), var(--color-danger-s), var(--mg-color-soft-l));background-color:hsl(var(--color-danger-h), var(--color-danger-s), var(--mg-color-soft-l));color:hsl(var(--color-dark));font-weight:400}.mg-c-tag.mg-c-tag--danger.mg-c-tag--soft ::slotted(mg-icon){color:hsl(var(--color-danger))}.mg-c-tag.mg-c-tag--info{border-color:hsl(var(--color-info));background-color:hsl(var(--color-info));color:hsl(var(--color-light))}.mg-c-tag.mg-c-tag--info.mg-c-tag--outline{background-color:rgba(0,0,0,0);color:hsl(var(--color-info))}.mg-c-tag.mg-c-tag--info.mg-c-tag--soft{border-color:hsl(var(--color-info-h), var(--color-info-s), var(--mg-color-soft-l));background-color:hsl(var(--color-info-h), var(--color-info-s), var(--mg-color-soft-l));color:hsl(var(--color-dark));font-weight:400}.mg-c-tag.mg-c-tag--info.mg-c-tag--soft ::slotted(mg-icon){color:hsl(var(--color-info))}::slotted(mg-icon){margin-right:.4rem}slot{display:inline-flex;align-items:center}/*# sourceMappingURL=mg-tag.css.map */\n","import { Component, h, Prop, State, Watch, Element } from '@stencil/core';\nimport { TagVariantType, variants } from './mg-tag.conf';\nimport { ClassList, isValidString } from '../../../utils/components.utils';\n@Component({\n tag: 'mg-tag',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-tag.css',\n shadow: true,\n})\nexport class MgTag {\n /************\n * Internal *\n ************/\n\n // Classes\n private readonly classOutline = 'mg-c-tag--outline';\n private readonly classSoft = 'mg-c-tag--soft';\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgTagElement;\n\n /**\n * Define tag variant\n */\n @Prop() variant: TagVariantType = variants[0]; // primary\n @Watch('variant')\n validateVariant(newValue: MgTag['variant'], oldValue?: MgTag['variant']): void {\n if (!variants.includes(newValue)) {\n throw new Error(`<mg-tag> prop \"variant\" must be one of: ${variants.join(', ')}.`);\n } else {\n if (oldValue !== undefined) {\n this.classCollection.delete(`mg-c-tag--${oldValue}`);\n }\n this.classCollection.add(`mg-c-tag--${newValue}`);\n }\n }\n\n /**\n * Define if tag is using outline style\n */\n @Prop() outline: boolean;\n @Watch('outline')\n validateOutline(newValue: MgTag['outline']): void {\n if (newValue) this.classCollection.add(this.classOutline);\n else this.classCollection.delete(this.classOutline);\n }\n\n /**\n * Define if tag is using soft style\n */\n @Prop() soft: boolean;\n @Watch('soft')\n validateSoft(newValue: MgTag['soft']): void {\n // usage validation\n if (newValue && this.outline) throw new Error('<mg-tag> prop \"soft\" can NOT be used with prop \"outline\".');\n\n // apply class\n if (newValue) this.classCollection.add(this.classSoft);\n else this.classCollection.delete(this.classSoft);\n }\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-c-tag']);\n\n /*************\n * Methods *\n *************/\n\n /**\n * Validate the given textContent\n * @param textContent - html element textContent property\n */\n private validateTextContent(textContent: string): void {\n if (!isValidString(textContent)) throw new Error('<mg-tag> slot must contain a text content.');\n }\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if props are well configured on init\n */\n componentWillLoad(): void {\n this.validateVariant(this.variant);\n this.validateOutline(this.outline);\n this.validateSoft(this.soft);\n this.validateTextContent(this.element.textContent);\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <span class={this.classCollection.join()}>\n <slot></slot>\n </span>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
|
|
3
|
-
const mgTooltipContentCss = ":host{display:none;padding
|
|
3
|
+
const mgTooltipContentCss = ":host{z-index:1000;display:none;max-width:40rem;box-sizing:border-box;padding:.5rem .8rem;border-radius:var(--mg-tooltip-border-radius);background-color:hsl(var(--mg-tooltip-background-color));color:hsl(var(--mg-tooltip-font-color));text-align:start}:host([data-show]){display:block}::slotted([slot=arrow]){visibility:hidden}::slotted([slot=arrow])::before{content:\"\";transform:rotate(45deg);visibility:visible}::slotted([slot=arrow]),::slotted([slot=arrow])::before{position:absolute;z-index:9999;width:.8rem;height:.8rem;background-color:hsl(var(--mg-tooltip-background-color))}:host([data-popper-placement^=top])>::slotted([slot=arrow]){bottom:-0.4rem}:host([data-popper-placement^=bottom])>::slotted([slot=arrow]){top:-0.4rem}:host([data-popper-placement^=left])>::slotted([slot=arrow]){right:-0.4rem}:host([data-popper-placement^=right])>::slotted([slot=arrow]){left:-0.4rem}";
|
|
4
4
|
|
|
5
5
|
const MgTooltipContent = /*@__PURE__*/ proxyCustomElement(class MgTooltipContent extends HTMLElement {
|
|
6
6
|
constructor() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"mg-tooltip-content2.js","mappings":";;AAAA,MAAM,mBAAmB,GAAG,
|
|
1
|
+
{"file":"mg-tooltip-content2.js","mappings":";;AAAA,MAAM,mBAAmB,GAAG,o3BAAo3B;;MCOn4B,gBAAgB;;;;;;;;;;;;;;EAc3B,MAAM;IACJ,QACE,EAAC,IAAI,IAAC,IAAI,EAAC,SAAS,IAClB,YAAM,SAAS,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,EAAC,6BAA6B,GAAQ,EAC1E,YAAM,IAAI,EAAC,OAAO,GAAQ,CACrB,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["../styles/dist/components/mg-tooltip-content.css?tag=mg-tooltip-content&encapsulation=shadow","src/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.tsx"],"sourcesContent":[":host{z-index:1000;display:none;max-width:40rem;box-sizing:border-box;padding:.5rem .8rem;border-radius:var(--mg-tooltip-border-radius);background-color:hsl(var(--mg-tooltip-background-color));color:hsl(var(--mg-tooltip-font-color));text-align:start}:host([data-show]){display:block}::slotted([slot=arrow]){visibility:hidden}::slotted([slot=arrow])::before{content:\"\";transform:rotate(45deg);visibility:visible}::slotted([slot=arrow]),::slotted([slot=arrow])::before{position:absolute;z-index:9999;width:.8rem;height:.8rem;background-color:hsl(var(--mg-tooltip-background-color))}:host([data-popper-placement^=top])>::slotted([slot=arrow]){bottom:-0.4rem}:host([data-popper-placement^=bottom])>::slotted([slot=arrow]){top:-0.4rem}:host([data-popper-placement^=left])>::slotted([slot=arrow]){right:-0.4rem}:host([data-popper-placement^=right])>::slotted([slot=arrow]){left:-0.4rem}/*# sourceMappingURL=mg-tooltip-content.css.map */\n","import { Component, h, Host, Prop } from '@stencil/core';\n\n@Component({\n tag: 'mg-tooltip-content',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-tooltip-content.css',\n shadow: true,\n})\nexport class MgTooltipContent {\n /**\n * Displayed message in the tooltip\n */\n @Prop() message!: string;\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <Host role=\"tooltip\">\n <span innerHTML={this.message} class=\"mg-tooltip-content__message\"></span>\n <slot name=\"arrow\"></slot>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
-
import { c as createID, g as getWindows, f as focusableElements } from './components.utils.js';
|
|
2
|
+
import { c as createID, i as isValidString, g as getWindows, f as focusableElements } from './components.utils.js';
|
|
3
3
|
import { d as defineCustomElement$1 } from './mg-tooltip-content2.js';
|
|
4
4
|
import { c as createPopper } from './popper.js';
|
|
5
5
|
|
|
@@ -115,12 +115,12 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
|
|
|
115
115
|
this.setMgButtonWrapper = (mgButton) => {
|
|
116
116
|
if (mgButton.disabled) {
|
|
117
117
|
const div = document.createElement('div');
|
|
118
|
-
div.classList.add('mg-tooltip__mg-button-wrapper');
|
|
118
|
+
div.classList.add('mg-c-tooltip__mg-button-wrapper');
|
|
119
119
|
mgButton.parentNode.insertBefore(div, mgButton);
|
|
120
120
|
div.appendChild(mgButton);
|
|
121
121
|
this.tooltipedElement = div;
|
|
122
122
|
}
|
|
123
|
-
else if (mgButton.parentElement.classList.contains('mg-tooltip__mg-button-wrapper')) {
|
|
123
|
+
else if (mgButton.parentElement.classList.contains('mg-c-tooltip__mg-button-wrapper')) {
|
|
124
124
|
this.element.firstElementChild.replaceWith(mgButton);
|
|
125
125
|
this.tooltipedElement = mgButton;
|
|
126
126
|
}
|
|
@@ -158,6 +158,12 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
|
|
|
158
158
|
offset: [0, 8],
|
|
159
159
|
},
|
|
160
160
|
},
|
|
161
|
+
{
|
|
162
|
+
name: 'flip',
|
|
163
|
+
options: {
|
|
164
|
+
fallbackPlacements: ['auto'],
|
|
165
|
+
},
|
|
166
|
+
},
|
|
161
167
|
],
|
|
162
168
|
});
|
|
163
169
|
// Manage tooltipedElement focus/blur events
|
|
@@ -195,8 +201,12 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
|
|
|
195
201
|
this.display = false;
|
|
196
202
|
this.disabled = false;
|
|
197
203
|
}
|
|
204
|
+
validateIdentifier() {
|
|
205
|
+
// use renderTooltipContent to update tooltip-content id
|
|
206
|
+
this.renderTooltipContent();
|
|
207
|
+
}
|
|
198
208
|
validateMessage(newValue) {
|
|
199
|
-
if (
|
|
209
|
+
if (!isValidString(newValue)) {
|
|
200
210
|
throw new Error('<mg-tooltip> prop "message" is required.');
|
|
201
211
|
}
|
|
202
212
|
this.mgTooltipContent.message = newValue;
|
|
@@ -220,16 +230,22 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
|
|
|
220
230
|
/**
|
|
221
231
|
* Render tooltip content element
|
|
222
232
|
*/
|
|
223
|
-
|
|
224
|
-
const mgTooltipContent =
|
|
225
|
-
mgTooltipContent
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
+
renderTooltipContent() {
|
|
234
|
+
const mgTooltipContent = this.element.querySelector('mg-tooltip-content');
|
|
235
|
+
if (mgTooltipContent === null) {
|
|
236
|
+
const mgTooltipContent = document.createElement('mg-tooltip-content');
|
|
237
|
+
mgTooltipContent.setAttribute('slot', 'content');
|
|
238
|
+
mgTooltipContent.setAttribute('id', this.identifier);
|
|
239
|
+
const arrow = document.createElement('div');
|
|
240
|
+
arrow.setAttribute('slot', 'arrow');
|
|
241
|
+
arrow.dataset.popperArrow = '';
|
|
242
|
+
mgTooltipContent.appendChild(arrow);
|
|
243
|
+
// append tooltip element to component
|
|
244
|
+
this.element.appendChild(mgTooltipContent);
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
mgTooltipContent.setAttribute('id', this.identifier);
|
|
248
|
+
}
|
|
233
249
|
}
|
|
234
250
|
/*************
|
|
235
251
|
* Lifecycle *
|
|
@@ -241,11 +257,12 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
|
|
|
241
257
|
// Get windows to attach events
|
|
242
258
|
this.windows = getWindows(window);
|
|
243
259
|
// Get tooltip element
|
|
244
|
-
this.
|
|
260
|
+
this.renderTooltipContent();
|
|
245
261
|
this.mgTooltipContent = this.element.querySelector(`#${this.identifier}`);
|
|
246
262
|
//validate properties
|
|
247
263
|
this.validateDisabled(this.disabled);
|
|
248
264
|
this.validateMessage(this.message);
|
|
265
|
+
this.validateIdentifier();
|
|
249
266
|
}
|
|
250
267
|
/**
|
|
251
268
|
* Get slotted element
|
|
@@ -293,6 +310,7 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
|
|
|
293
310
|
}
|
|
294
311
|
get element() { return this; }
|
|
295
312
|
static get watchers() { return {
|
|
313
|
+
"identifier": ["validateIdentifier"],
|
|
296
314
|
"message": ["validateMessage"],
|
|
297
315
|
"display": ["handleDisplay"],
|
|
298
316
|
"disabled": ["validateDisabled"]
|
|
@@ -305,6 +323,7 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
|
|
|
305
323
|
"display": [1028],
|
|
306
324
|
"disabled": [4]
|
|
307
325
|
}, undefined, {
|
|
326
|
+
"identifier": ["validateIdentifier"],
|
|
308
327
|
"message": ["validateMessage"],
|
|
309
328
|
"display": ["handleDisplay"],
|
|
310
329
|
"disabled": ["validateDisabled"]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"mg-tooltip2.js","mappings":";;;;;AAAA,IAAY,KAIX;AAJD,WAAY,KAAK;EACf,wBAAe,CAAA;EACf,oDAA2C,CAAA;EAC3C,w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AI,QAAQ,CAAC,WAAW,CAAC,EAAE;MACzB,IAAI,gBAAgB,CAAC,YAAY;QAC/B,IAAI,YAAY,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,EAAE;UACjG,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;;;UAGrC,IAAI,CAAC,UAAU,EAAE,CAAC;UAClB,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;SACnD;OACF,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;MAC9C,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;KACtC;;IAGD,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;IAElD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;GAClC;;;;EAKD,kBAAkB;IAChB,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;GACtB;;;;;EAMD,MAAM;IACJ,QACE,EAAC,IAAI,QACH,eAAa,EACb,YAAM,IAAI,EAAC,SAAS,GAAQ,CACvB,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/atoms/mg-tooltip/mg-tooltip.conf.tsx","src/components/atoms/mg-tooltip/mg-tooltip.scss?tag=mg-tooltip&encapsulation=shadow","src/components/atoms/mg-tooltip/mg-tooltip.tsx"],"sourcesContent":["export enum Guard {\n FOCUS = 'focus',\n HOVER_TOOLTIP_ELEMENT = 'hoverTooltipGuard',\n HOVER_TOOLTIPED_ELEMENT = 'hoverTooltipedGuard',\n}\n",":host {\n display: inline-block;\n}\n","import { Component, Element, h, Host, Prop, Watch } from '@stencil/core';\nimport { createID, focusableElements, getWindows } from '../../../utils/components.utils';\nimport { Instance as PopperInstance, createPopper, Placement } from '@popperjs/core';\nimport { Guard } from './mg-tooltip.conf';\n\n/**\n * HTMLMgButtonElement type guard\n * @param element - element to check\n * @returns return true if type is HTMLMgButtonElement\n */\nconst isButton = (element: unknown): element is HTMLMgButtonElement => typeof element === 'object' && ['MG-BUTTON', 'BUTTON'].includes((element as Element).tagName);\n\n@Component({\n tag: 'mg-tooltip',\n styleUrl: 'mg-tooltip.scss',\n shadow: true,\n})\nexport class MgTooltip {\n /************\n * Internal *\n ************/\n\n private popper: PopperInstance;\n private mgTooltipContent: HTMLMgTooltipContentElement;\n private tooltipedElement: HTMLElement;\n private windows: Window[];\n private hasCustomTabIndex: boolean;\n\n // tooltip actions guards\n private guard: Guard;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgTooltipElement;\n\n /**\n * Sets an `id` attribute.\n * Needed by the input for accessibility `aria-decribedby`.\n */\n @Prop() identifier: string = createID('mg-tooltip');\n\n /**\n * Displayed message in the tooltip\n */\n @Prop() message!: string;\n @Watch('message')\n validateMessage(newValue: string): void {\n if (typeof newValue !== 'string' || newValue.trim() === '') {\n throw new Error('<mg-tooltip> prop \"message\" is required.');\n }\n this.mgTooltipContent.message = newValue;\n }\n\n /**\n * Tooltip placement\n */\n @Prop() placement: Placement = 'bottom';\n\n /**\n * Display tooltip\n */\n @Prop({ mutable: true }) display = false;\n @Watch('display')\n handleDisplay(newValue: boolean): void {\n if (newValue) {\n this.show();\n } else {\n this.hide();\n }\n }\n\n /**\n * Disable tooltip\n */\n @Prop() disabled = false;\n @Watch('disabled')\n validateDisabled(newValue: MgTooltip['disabled']): void {\n if (this.hasCustomTabIndex) {\n if (newValue) this.tooltipedElement.removeAttribute('tabindex');\n else if (this.tooltipedElement.getAttribute('tabindex') === null) this.tooltipedElement.setAttribute('tabindex', '0');\n }\n }\n\n /**\n * Show tooltip\n */\n private show = (): void => {\n // Make the tooltip visible\n this.mgTooltipContent.dataset.show = '';\n // Enable the event listeners\n this.popper.setOptions(options => ({\n ...options,\n modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }],\n }));\n // hide when click outside\n // setTimeout is used to prevent event to trigger after creation\n setTimeout(() => {\n this.windows.forEach((localWindow: Window) => {\n localWindow.addEventListener('click', this.clickOutside, false);\n localWindow.addEventListener('keydown', this.pressEscape, false);\n });\n }, 0);\n };\n\n /**\n * Hide tooltip\n */\n private hide = (): void => {\n // Hide the tooltip\n this.mgTooltipContent.removeAttribute('data-show');\n // Disable the event listeners\n this.popper.setOptions(options => ({\n ...options,\n modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }],\n }));\n // Remove event listener\n this.windows.forEach((localWindow: Window) => {\n localWindow.removeEventListener('click', this.clickOutside, false);\n localWindow.removeEventListener('keyboard', this.pressEscape, false);\n });\n };\n\n /**\n * Check if clicked outside of component and hidde tooltip\n * @param event - mouse event\n */\n private clickOutside = (event: MouseEvent & { target: HTMLElement }): void => {\n if (event.target.closest('mg-tooltip') !== this.element) this.setDisplay(false);\n };\n\n /**\n * Check if 'Escape' key is pressed of component and hidde tooltip\n * @param event - keyboard event\n */\n private pressEscape = (event: KeyboardEvent): void => {\n if (event.code === 'Escape') {\n this.setDisplay(false);\n this.resetGuard();\n }\n };\n\n /**\n * Method to set display prop\n * @param newValue - display prop new value\n * @param condition - additionnal condition to apply display prop newValue\n */\n private setDisplay = (newValue: boolean, condition = true): void => {\n if (!this.disabled && condition) this.display = newValue;\n };\n\n /**\n * Action for tooltip element and tooltiped element mouse listener\n * @param elementGuard - tooltip element guard\n * @param isMouseenter - mouseenter validation\n * @param conditionalGuard - guard condition\n */\n private tooltipMouseListenerAction = (elementGuard: Guard, isMouseenter: boolean, conditionalGuard: Guard): void => {\n // we mutate elementGuard\n if (this.guard !== Guard.FOCUS) {\n this.guard = elementGuard;\n if (!isMouseenter) {\n setTimeout(() => {\n this.setDisplay(isMouseenter, this.guard !== conditionalGuard);\n this.resetGuard();\n }, 100);\n } else if (this.guard === Guard.HOVER_TOOLTIPED_ELEMENT) {\n this.setDisplay(isMouseenter);\n }\n }\n };\n\n /**\n * Method to reset guard value\n */\n private resetGuard = (): void => {\n this.guard = undefined;\n };\n\n /**\n * Update slot content when it is a mg-button\n * @param mgButton - slotted mg-button\n */\n private setMgButtonWrapper = (mgButton: HTMLMgButtonElement): void => {\n if (mgButton.disabled) {\n const div = document.createElement('div');\n div.classList.add('mg-tooltip__mg-button-wrapper');\n mgButton.parentNode.insertBefore(div, mgButton);\n div.appendChild(mgButton);\n this.tooltipedElement = div;\n } else if (mgButton.parentElement.classList.contains('mg-tooltip__mg-button-wrapper')) {\n this.element.firstElementChild.replaceWith(mgButton);\n this.tooltipedElement = mgButton;\n }\n };\n\n /**\n * Init tooltip\n * @param slotElement - slotted element\n * @param interactiveElement - interactive element\n */\n private initTooltip = (slotElement: HTMLElement, interactiveElement: HTMLElement): void => {\n // Add tabindex to slotted element if we can't find any interactive element\n if (!this.disabled && !Boolean(interactiveElement)) {\n this.hasCustomTabIndex = true;\n slotElement.tabIndex = 0;\n // Add role on non-interactive element to work with \"aria-describedby\" for screen readers\n slotElement.setAttribute('role', 'button');\n }\n // Set aria-describedby\n const ariaDescribedby = slotElement.getAttribute('aria-describedby');\n\n if (ariaDescribedby === null) {\n this.tooltipedElement.setAttribute('aria-describedby', this.identifier);\n } else {\n // We ensure to have uniq ids\n slotElement.setAttribute('aria-describedby', `${[...new Set([...ariaDescribedby.split(' '), this.identifier])].join(' ')}`);\n }\n\n // Create popperjs tooltip\n this.popper = createPopper(this.tooltipedElement, this.mgTooltipContent, {\n placement: this.placement,\n strategy: 'fixed',\n modifiers: [\n {\n name: 'offset',\n options: {\n offset: [0, 8],\n },\n },\n ],\n });\n\n // Manage tooltipedElement focus/blur events\n this.tooltipedElement.addEventListener('focus', () => {\n this.guard = Guard.FOCUS;\n this.setDisplay(true);\n });\n\n // as `click` event is the composition of `mousedown` and `mouseup` event,\n // and `click` event trigger `focus` event after a success `mousedown` wich set the `guard` to `Guard.FOCUS`\n // we reset the guard on `mouseup` event to unlock tooltip\n this.tooltipedElement.addEventListener('mouseup', () => {\n this.resetGuard();\n });\n\n this.tooltipedElement.addEventListener('blur', () => {\n this.resetGuard();\n this.setDisplay(false);\n });\n\n document.addEventListener('keydown', this.pressEscape);\n\n // manage tooltipElement & tooltipedElement mouseenter/mouseleave events\n ['mouseenter', 'mouseleave'].forEach(eventType => {\n const isMouseenter = eventType === 'mouseenter';\n [\n { element: this.mgTooltipContent, action: () => this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIP_ELEMENT, isMouseenter, Guard.HOVER_TOOLTIPED_ELEMENT) },\n { element: this.tooltipedElement, action: () => this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIPED_ELEMENT, isMouseenter, Guard.HOVER_TOOLTIP_ELEMENT) },\n ].forEach(({ element, action }) => {\n element.addEventListener(eventType, () => {\n action();\n });\n });\n });\n };\n\n /**\n * Render tooltip content element\n */\n private renderTooltip(): void {\n const mgTooltipContent = document.createElement('mg-tooltip-content');\n mgTooltipContent.setAttribute('slot', 'content');\n mgTooltipContent.setAttribute('id', this.identifier);\n\n const arrow = document.createElement('div');\n arrow.setAttribute('slot', 'arrow');\n arrow.dataset.popperArrow = '';\n mgTooltipContent.appendChild(arrow);\n\n // append tooltip element to component\n this.element.appendChild(mgTooltipContent);\n }\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * set variables\n */\n componentWillLoad(): void {\n // Get windows to attach events\n this.windows = getWindows(window);\n\n // Get tooltip element\n this.renderTooltip();\n this.mgTooltipContent = this.element.querySelector(`#${this.identifier}`);\n\n //validate properties\n this.validateDisabled(this.disabled);\n this.validateMessage(this.message);\n }\n\n /**\n * Get slotted element\n * Check if it already contain an interactive element, if not we need to add a tabIndex attribute\n * We need to attach the focused element to the tooltip (aria-describedby)\n */\n componentDidLoad(): void {\n // get slotted element wich is not the tooltip\n const slotElement: HTMLElement = this.element.querySelector(`*:not(#${this.identifier})`);\n\n // Get interactive element\n const interactiveElement: HTMLElement = slotElement.matches(focusableElements) ? slotElement : slotElement.shadowRoot?.querySelector(focusableElements);\n\n // define selected element to become tooltip selector\n this.tooltipedElement = interactiveElement || slotElement;\n\n // Check if slotted element is a disabled mg-button\n // In this case we wrap the mg-button into a div to enable the tooltip\n if (isButton(slotElement)) {\n new MutationObserver(mutationList => {\n if (mutationList.some(mutation => ['aria-disabled', 'disabled'].includes(mutation.attributeName))) {\n this.setMgButtonWrapper(slotElement);\n // Since Firefox doesn't trigger a \"blur\" event when the \"disabled\" attribute is added or removed from a button\n // we have to manually unlock the guard because the \"blur\" handler of the tooltipedElement won't do it.\n this.resetGuard();\n this.initTooltip(slotElement, interactiveElement);\n }\n }).observe(slotElement, { attributes: true });\n this.setMgButtonWrapper(slotElement);\n }\n\n // Init Tooltip\n this.initTooltip(slotElement, interactiveElement);\n\n this.handleDisplay(this.display);\n }\n\n /**\n * update popper position after props change on component did update hook to benefit from render ended\n */\n componentDidUpdate(): void {\n this.popper.update();\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <Host>\n <slot></slot>\n <slot name=\"content\"></slot>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"mg-tooltip2.js","mappings":";;;;;AAAA,IAAY,KAIX;AAJD,WAAY,KAAK;EACf,wBAAe,CAAA;EACf,oDAA2C,CAAA;EAC3C,wDAA+C,CAAA;AACjD,CAAC,EAJW,KAAK,KAAL,KAAK;;ACAjB,MAAM,YAAY,GAAG,6BAA6B;;ACKlD;;;;;AAKA,MAAM,QAAQ,GAAG,CAAC,OAAgB,KAAqC,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAE,OAAmB,CAAC,OAAO,CAAC,CAAC;MAOxJ,SAAS;;;;;;;;IA+EZ,SAAI,GAAG;;MAEb,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,IAAI,GAAG,EAAE,CAAC;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;IAI1D,IAAI,QAAQ,CAAC,WAAW,CAAC,EAAE;MACzB,IAAI,gBAAgB,CAAC,YAAY;QAC/B,IAAI,YAAY,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,EAAE;UACjG,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;;;UAGrC,IAAI,CAAC,UAAU,EAAE,CAAC;UAClB,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;SACnD;OACF,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;MAC9C,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;KACtC;;IAGD,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;IAElD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;GAClC;;;;EAKD,kBAAkB;IAChB,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;GACtB;;;;;EAMD,MAAM;IACJ,QACE,EAAC,IAAI,QACH,eAAa,EACb,YAAM,IAAI,EAAC,SAAS,GAAQ,CACvB,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/atoms/mg-tooltip/mg-tooltip.conf.tsx","../styles/dist/components/mg-tooltip.css?tag=mg-tooltip&encapsulation=shadow","src/components/atoms/mg-tooltip/mg-tooltip.tsx"],"sourcesContent":["export enum Guard {\n FOCUS = 'focus',\n HOVER_TOOLTIP_ELEMENT = 'hoverTooltipGuard',\n HOVER_TOOLTIPED_ELEMENT = 'hoverTooltipedGuard',\n}\n",":host{display:inline-block}/*# sourceMappingURL=mg-tooltip.css.map */\n","import { Component, Element, h, Host, Prop, Watch } from '@stencil/core';\nimport { createID, focusableElements, getWindows, isValidString } from '../../../utils/components.utils';\nimport { Instance as PopperInstance, createPopper, Placement } from '@popperjs/core';\nimport { Guard } from './mg-tooltip.conf';\n\n/**\n * HTMLMgButtonElement type guard\n * @param element - element to check\n * @returns return true if type is HTMLMgButtonElement\n */\nconst isButton = (element: unknown): element is HTMLMgButtonElement => typeof element === 'object' && ['MG-BUTTON', 'BUTTON'].includes((element as Element).tagName);\n\n@Component({\n tag: 'mg-tooltip',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-tooltip.css',\n shadow: true,\n})\nexport class MgTooltip {\n /************\n * Internal *\n ************/\n\n private popper: PopperInstance;\n private mgTooltipContent: HTMLMgTooltipContentElement;\n private tooltipedElement: HTMLElement;\n private windows: Window[];\n private hasCustomTabIndex: boolean;\n\n // tooltip actions guards\n private guard: Guard;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgTooltipElement;\n\n /**\n * Sets an `id` attribute.\n * Needed by the input for accessibility `aria-decribedby`.\n */\n @Prop() identifier: string = createID('mg-tooltip');\n @Watch('identifier')\n validateIdentifier(): void {\n // use renderTooltipContent to update tooltip-content id\n this.renderTooltipContent();\n }\n\n /**\n * Displayed message in the tooltip\n */\n @Prop() message!: string;\n @Watch('message')\n validateMessage(newValue: MgTooltip['message']): void {\n if (!isValidString(newValue)) {\n throw new Error('<mg-tooltip> prop \"message\" is required.');\n }\n this.mgTooltipContent.message = newValue;\n }\n\n /**\n * Tooltip placement\n */\n @Prop() placement: Placement = 'bottom';\n\n /**\n * Display tooltip\n */\n @Prop({ mutable: true }) display = false;\n @Watch('display')\n handleDisplay(newValue: MgTooltip['display']): void {\n if (newValue) {\n this.show();\n } else {\n this.hide();\n }\n }\n\n /**\n * Disable tooltip\n */\n @Prop() disabled = false;\n @Watch('disabled')\n validateDisabled(newValue: MgTooltip['disabled']): void {\n if (this.hasCustomTabIndex) {\n if (newValue) this.tooltipedElement.removeAttribute('tabindex');\n else if (this.tooltipedElement.getAttribute('tabindex') === null) this.tooltipedElement.setAttribute('tabindex', '0');\n }\n }\n\n /**\n * Show tooltip\n */\n private show = (): void => {\n // Make the tooltip visible\n this.mgTooltipContent.dataset.show = '';\n // Enable the event listeners\n this.popper.setOptions(options => ({\n ...options,\n modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }],\n }));\n // hide when click outside\n // setTimeout is used to prevent event to trigger after creation\n setTimeout(() => {\n this.windows.forEach((localWindow: Window) => {\n localWindow.addEventListener('click', this.clickOutside, false);\n localWindow.addEventListener('keydown', this.pressEscape, false);\n });\n }, 0);\n };\n\n /**\n * Hide tooltip\n */\n private hide = (): void => {\n // Hide the tooltip\n this.mgTooltipContent.removeAttribute('data-show');\n // Disable the event listeners\n this.popper.setOptions(options => ({\n ...options,\n modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }],\n }));\n // Remove event listener\n this.windows.forEach((localWindow: Window) => {\n localWindow.removeEventListener('click', this.clickOutside, false);\n localWindow.removeEventListener('keyboard', this.pressEscape, false);\n });\n };\n\n /**\n * Check if clicked outside of component and hidde tooltip\n * @param event - mouse event\n */\n private clickOutside = (event: MouseEvent & { target: HTMLElement }): void => {\n if (event.target.closest('mg-tooltip') !== this.element) this.setDisplay(false);\n };\n\n /**\n * Check if 'Escape' key is pressed of component and hidde tooltip\n * @param event - keyboard event\n */\n private pressEscape = (event: KeyboardEvent): void => {\n if (event.code === 'Escape') {\n this.setDisplay(false);\n this.resetGuard();\n }\n };\n\n /**\n * Method to set display prop\n * @param newValue - display prop new value\n * @param condition - additionnal condition to apply display prop newValue\n */\n private setDisplay = (newValue: MgTooltip['display'], condition = true): void => {\n if (!this.disabled && condition) this.display = newValue;\n };\n\n /**\n * Action for tooltip element and tooltiped element mouse listener\n * @param elementGuard - tooltip element guard\n * @param isMouseenter - mouseenter validation\n * @param conditionalGuard - guard condition\n */\n private tooltipMouseListenerAction = (elementGuard: Guard, isMouseenter: boolean, conditionalGuard: Guard): void => {\n // we mutate elementGuard\n if (this.guard !== Guard.FOCUS) {\n this.guard = elementGuard;\n if (!isMouseenter) {\n setTimeout(() => {\n this.setDisplay(isMouseenter, this.guard !== conditionalGuard);\n this.resetGuard();\n }, 100);\n } else if (this.guard === Guard.HOVER_TOOLTIPED_ELEMENT) {\n this.setDisplay(isMouseenter);\n }\n }\n };\n\n /**\n * Method to reset guard value\n */\n private resetGuard = (): void => {\n this.guard = undefined;\n };\n\n /**\n * Update slot content when it is a mg-button\n * @param mgButton - slotted mg-button\n */\n private setMgButtonWrapper = (mgButton: HTMLMgButtonElement): void => {\n if (mgButton.disabled) {\n const div = document.createElement('div');\n div.classList.add('mg-c-tooltip__mg-button-wrapper');\n mgButton.parentNode.insertBefore(div, mgButton);\n div.appendChild(mgButton);\n this.tooltipedElement = div;\n } else if (mgButton.parentElement.classList.contains('mg-c-tooltip__mg-button-wrapper')) {\n this.element.firstElementChild.replaceWith(mgButton);\n this.tooltipedElement = mgButton;\n }\n };\n\n /**\n * Init tooltip\n * @param slotElement - slotted element\n * @param interactiveElement - interactive element\n */\n private initTooltip = (slotElement: HTMLElement, interactiveElement: HTMLElement): void => {\n // Add tabindex to slotted element if we can't find any interactive element\n if (!this.disabled && !Boolean(interactiveElement)) {\n this.hasCustomTabIndex = true;\n slotElement.tabIndex = 0;\n // Add role on non-interactive element to work with \"aria-describedby\" for screen readers\n slotElement.setAttribute('role', 'button');\n }\n // Set aria-describedby\n const ariaDescribedby = slotElement.getAttribute('aria-describedby');\n\n if (ariaDescribedby === null) {\n this.tooltipedElement.setAttribute('aria-describedby', this.identifier);\n } else {\n // We ensure to have uniq ids\n slotElement.setAttribute('aria-describedby', `${[...new Set([...ariaDescribedby.split(' '), this.identifier])].join(' ')}`);\n }\n\n // Create popperjs tooltip\n this.popper = createPopper(this.tooltipedElement, this.mgTooltipContent, {\n placement: this.placement,\n strategy: 'fixed',\n modifiers: [\n {\n name: 'offset',\n options: {\n offset: [0, 8],\n },\n },\n {\n name: 'flip',\n options: {\n fallbackPlacements: ['auto'],\n },\n },\n ],\n });\n\n // Manage tooltipedElement focus/blur events\n this.tooltipedElement.addEventListener('focus', () => {\n this.guard = Guard.FOCUS;\n this.setDisplay(true);\n });\n\n // as `click` event is the composition of `mousedown` and `mouseup` event,\n // and `click` event trigger `focus` event after a success `mousedown` wich set the `guard` to `Guard.FOCUS`\n // we reset the guard on `mouseup` event to unlock tooltip\n this.tooltipedElement.addEventListener('mouseup', () => {\n this.resetGuard();\n });\n\n this.tooltipedElement.addEventListener('blur', () => {\n this.resetGuard();\n this.setDisplay(false);\n });\n\n document.addEventListener('keydown', this.pressEscape);\n\n // manage tooltipElement & tooltipedElement mouseenter/mouseleave events\n ['mouseenter', 'mouseleave'].forEach(eventType => {\n const isMouseenter = eventType === 'mouseenter';\n [\n { element: this.mgTooltipContent, action: () => this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIP_ELEMENT, isMouseenter, Guard.HOVER_TOOLTIPED_ELEMENT) },\n { element: this.tooltipedElement, action: () => this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIPED_ELEMENT, isMouseenter, Guard.HOVER_TOOLTIP_ELEMENT) },\n ].forEach(({ element, action }) => {\n element.addEventListener(eventType, () => {\n action();\n });\n });\n });\n };\n\n /**\n * Render tooltip content element\n */\n private renderTooltipContent(): void {\n const mgTooltipContent = this.element.querySelector('mg-tooltip-content');\n if (mgTooltipContent === null) {\n const mgTooltipContent = document.createElement('mg-tooltip-content');\n mgTooltipContent.setAttribute('slot', 'content');\n mgTooltipContent.setAttribute('id', this.identifier);\n\n const arrow = document.createElement('div');\n arrow.setAttribute('slot', 'arrow');\n arrow.dataset.popperArrow = '';\n mgTooltipContent.appendChild(arrow);\n\n // append tooltip element to component\n this.element.appendChild(mgTooltipContent);\n } else {\n mgTooltipContent.setAttribute('id', this.identifier);\n }\n }\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * set variables\n */\n componentWillLoad(): void {\n // Get windows to attach events\n this.windows = getWindows(window);\n\n // Get tooltip element\n this.renderTooltipContent();\n this.mgTooltipContent = this.element.querySelector(`#${this.identifier}`);\n\n //validate properties\n this.validateDisabled(this.disabled);\n this.validateMessage(this.message);\n this.validateIdentifier();\n }\n\n /**\n * Get slotted element\n * Check if it already contain an interactive element, if not we need to add a tabIndex attribute\n * We need to attach the focused element to the tooltip (aria-describedby)\n */\n componentDidLoad(): void {\n // get slotted element wich is not the tooltip\n const slotElement: HTMLElement = this.element.querySelector(`*:not(#${this.identifier})`);\n\n // Get interactive element\n const interactiveElement: HTMLElement = slotElement.matches(focusableElements) ? slotElement : slotElement.shadowRoot?.querySelector(focusableElements);\n\n // define selected element to become tooltip selector\n this.tooltipedElement = interactiveElement || slotElement;\n\n // Check if slotted element is a disabled mg-button\n // In this case we wrap the mg-button into a div to enable the tooltip\n if (isButton(slotElement)) {\n new MutationObserver(mutationList => {\n if (mutationList.some(mutation => ['aria-disabled', 'disabled'].includes(mutation.attributeName))) {\n this.setMgButtonWrapper(slotElement);\n // Since Firefox doesn't trigger a \"blur\" event when the \"disabled\" attribute is added or removed from a button\n // we have to manually unlock the guard because the \"blur\" handler of the tooltipedElement won't do it.\n this.resetGuard();\n this.initTooltip(slotElement, interactiveElement);\n }\n }).observe(slotElement, { attributes: true });\n this.setMgButtonWrapper(slotElement);\n }\n\n // Init Tooltip\n this.initTooltip(slotElement, interactiveElement);\n\n this.handleDisplay(this.display);\n }\n\n /**\n * update popper position after props change on component did update hook to benefit from render ended\n */\n componentDidUpdate(): void {\n this.popper.update();\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <Host>\n <slot></slot>\n <slot name=\"content\"></slot>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const errors$1 = {
|
|
2
2
|
required: "This field is required.",
|
|
3
3
|
date: {
|
|
4
|
-
badInput: "The date format must be <span aria-hidden=\"true\">mm/dd/yyyy</span><span class=\"
|
|
4
|
+
badInput: "The date format must be <span aria-hidden=\"true\">mm/dd/yyyy</span><span class=\"mg-u-visually-hidden\">m m / d d / y y y y</span> and the date must be greater than {min}",
|
|
5
5
|
min: "The date cannot be earlier than {min}",
|
|
6
6
|
max: "The date cannot be later than {max}",
|
|
7
7
|
minMax: "The date must be between {min} and {max}"
|
|
@@ -43,8 +43,8 @@ const input$1 = {
|
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
const form$1 = {
|
|
46
|
-
required: "Fields with a <strong class=\"is-asterisk\">*</strong> are required",
|
|
47
|
-
requiredSingle: "Field with a <strong class=\"is-asterisk\">*</strong> is required",
|
|
46
|
+
required: "Fields with a <strong class=\"mg-u-is-asterisk\">*</strong> are required",
|
|
47
|
+
requiredSingle: "Field with a <strong class=\"mg-u-is-asterisk\">*</strong> is required",
|
|
48
48
|
allRequired: "All fields are required",
|
|
49
49
|
allRequiredSingle: "The field is required"
|
|
50
50
|
};
|
|
@@ -100,7 +100,7 @@ const en = {
|
|
|
100
100
|
const errors = {
|
|
101
101
|
required: "Ce champ est obligatoire.",
|
|
102
102
|
date: {
|
|
103
|
-
badInput: "Le format de la date doit être du type <span aria-hidden=\"true\">jj/mm/aaaa</span><span class=\"
|
|
103
|
+
badInput: "Le format de la date doit être du type <span aria-hidden=\"true\">jj/mm/aaaa</span><span class=\"mg-u-visually-hidden\">j j / m m / a a a a</span> et la date supérieure au {min}",
|
|
104
104
|
min: "La date ne peut pas être antérieure au {min}",
|
|
105
105
|
max: "La date ne peut pas être postérieure au {max}",
|
|
106
106
|
minMax: "La date doit être comprise entre le {min} et le {max}"
|
|
@@ -142,8 +142,8 @@ const input = {
|
|
|
142
142
|
}
|
|
143
143
|
};
|
|
144
144
|
const form = {
|
|
145
|
-
required: "Les champs marqués d'un <strong class=\"is-asterisk\">*</strong> sont obligatoires",
|
|
146
|
-
requiredSingle: "Le champ marqué d'un <strong class=\"is-asterisk\">*</strong> est obligatoire",
|
|
145
|
+
required: "Les champs marqués d'un <strong class=\"mg-u-is-asterisk\">*</strong> sont obligatoires",
|
|
146
|
+
requiredSingle: "Le champ marqué d'un <strong class=\"mg-u-is-asterisk\">*</strong> est obligatoire",
|
|
147
147
|
allRequired: "Tous les champs sont obligatoires",
|
|
148
148
|
allRequiredSingle: "Le champ est obligatoire"
|
|
149
149
|
};
|
|
@@ -275,6 +275,151 @@ var Direction;
|
|
|
275
275
|
*/
|
|
276
276
|
const sizes = ['regular', 'medium', 'large'];
|
|
277
277
|
|
|
278
|
-
|
|
278
|
+
/**
|
|
279
|
+
* Create random ID
|
|
280
|
+
* @param prefix - add prefix to created ID
|
|
281
|
+
* @param length - ID length
|
|
282
|
+
* @returns ID
|
|
283
|
+
*/
|
|
284
|
+
const createID = (prefix = '', length = 10) => {
|
|
285
|
+
const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
|
286
|
+
const charsLength = chars.length;
|
|
287
|
+
let ID = '';
|
|
288
|
+
let now = Date.now();
|
|
289
|
+
while (length > 0) {
|
|
290
|
+
now += Math.pow(10, 6); // Add 1 millisecond to the timestamp
|
|
291
|
+
const index = now % charsLength;
|
|
292
|
+
ID += chars.charAt(index);
|
|
293
|
+
length--;
|
|
294
|
+
}
|
|
295
|
+
return (prefix !== '' ? `${prefix}-` : '') + ID;
|
|
296
|
+
};
|
|
297
|
+
/**
|
|
298
|
+
* Class to manage component classlist
|
|
299
|
+
* Set() are not working when imported in project
|
|
300
|
+
*/
|
|
301
|
+
class ClassList {
|
|
302
|
+
constructor(classlist = []) {
|
|
303
|
+
/**
|
|
304
|
+
* Add class
|
|
305
|
+
* @param className - class name to add
|
|
306
|
+
*/
|
|
307
|
+
this.add = (className) => {
|
|
308
|
+
if (!this.has(className)) {
|
|
309
|
+
this.classes.push(className);
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
/**
|
|
313
|
+
* Delete class
|
|
314
|
+
* @param className - class name to delete
|
|
315
|
+
*/
|
|
316
|
+
this.delete = (className) => {
|
|
317
|
+
const index = this.classes.indexOf(className);
|
|
318
|
+
if (index > -1) {
|
|
319
|
+
this.classes.splice(index, 1);
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
/**
|
|
323
|
+
* Check if class exist in list
|
|
324
|
+
* @param className - class name to check
|
|
325
|
+
* @returns class name is in the list
|
|
326
|
+
*/
|
|
327
|
+
this.has = (className) => {
|
|
328
|
+
return this.classes.includes(className);
|
|
329
|
+
};
|
|
330
|
+
/**
|
|
331
|
+
* Join classes seperated by spaces
|
|
332
|
+
* @returns joined values
|
|
333
|
+
*/
|
|
334
|
+
this.join = () => {
|
|
335
|
+
return this.classes.join(' ');
|
|
336
|
+
};
|
|
337
|
+
this.classes = classlist;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Check if all items are string
|
|
342
|
+
* @param items - items to check
|
|
343
|
+
* @returns all items are string
|
|
344
|
+
*/
|
|
345
|
+
const allItemsAreString = (items) => Array.isArray(items) && items.every(item => typeof item === 'string');
|
|
346
|
+
/**
|
|
347
|
+
* Check if element is a heading
|
|
348
|
+
* @param element - slotted element
|
|
349
|
+
* @param tagNames - allowed tag names list
|
|
350
|
+
* @returns element is a heading
|
|
351
|
+
*/
|
|
352
|
+
const isTagName = (element, tagNames) => {
|
|
353
|
+
return tagNames.includes(element === null || element === void 0 ? void 0 : element.tagName.toLowerCase());
|
|
354
|
+
};
|
|
355
|
+
/**
|
|
356
|
+
* Focusable elements query selector
|
|
357
|
+
*/
|
|
358
|
+
const focusableElements = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), [identifier]';
|
|
359
|
+
/**
|
|
360
|
+
* Get windows
|
|
361
|
+
* @param localWindow - the window we are lookink for other windows
|
|
362
|
+
* @returns The list of windows found
|
|
363
|
+
*/
|
|
364
|
+
const getWindows = (localWindow) => {
|
|
365
|
+
const parentWindows = getParentWindows(localWindow);
|
|
366
|
+
const childWindows = getChildWindows(localWindow);
|
|
367
|
+
return [localWindow, ...parentWindows, ...childWindows];
|
|
368
|
+
};
|
|
369
|
+
/**
|
|
370
|
+
* Get parent windows
|
|
371
|
+
* @param localWindow - the window we are lookink for parents
|
|
372
|
+
* @param windows - The list of allready found windows
|
|
373
|
+
* @returns The list of windows found
|
|
374
|
+
*/
|
|
375
|
+
const getParentWindows = (localWindow, windows = []) => {
|
|
376
|
+
// Check if is in iframe
|
|
377
|
+
if (localWindow.self !== localWindow.top) {
|
|
378
|
+
// Check if we have permission to access parent
|
|
379
|
+
try {
|
|
380
|
+
const parentWindow = localWindow.parent;
|
|
381
|
+
windows.push(parentWindow);
|
|
382
|
+
return getParentWindows(parentWindow, windows);
|
|
383
|
+
}
|
|
384
|
+
catch (err) {
|
|
385
|
+
console.error('Different hosts between iframes:', err);
|
|
386
|
+
return windows;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
return windows;
|
|
390
|
+
};
|
|
391
|
+
/**
|
|
392
|
+
* Get child windows
|
|
393
|
+
* @param localWindow - the window we are lookink for children
|
|
394
|
+
* @param windows - The list of allready found windows
|
|
395
|
+
* @returns The list of windows found
|
|
396
|
+
*/
|
|
397
|
+
const getChildWindows = (localWindow, windows = []) => {
|
|
398
|
+
if (localWindow.frames.length > 0) {
|
|
399
|
+
for (const childWindow of Array.from(localWindow.frames)) {
|
|
400
|
+
windows.push(childWindow);
|
|
401
|
+
getChildWindows(childWindow, windows);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
return windows;
|
|
405
|
+
};
|
|
406
|
+
/**
|
|
407
|
+
* Validate string
|
|
408
|
+
* @param value - value to check
|
|
409
|
+
* @returns if string is valid
|
|
410
|
+
*/
|
|
411
|
+
const isValidString = (value) => typeof value === 'string' && value.trim() !== '';
|
|
412
|
+
/**
|
|
413
|
+
* Clean string caraters
|
|
414
|
+
* @param text - text to cliean
|
|
415
|
+
* @returns cleanded string
|
|
416
|
+
*/
|
|
417
|
+
const cleanString = (text) => typeof text === 'string' &&
|
|
418
|
+
text
|
|
419
|
+
.toLocaleLowerCase()
|
|
420
|
+
.normalize('NFD')
|
|
421
|
+
.replaceAll(/[\u0300-\u036f]/g, '');
|
|
422
|
+
|
|
423
|
+
export { ClassList as C, Direction as D, isValidString as a, isTagName as b, createID as c, cleanString as d, dateRegExp as e, localeCurrency as f, localeNumber as g, allItemsAreString as h, initLocales as i, focusableElements as j, getWindows as k, localeDate as l, sizes as s };
|
|
279
424
|
|
|
280
|
-
//# sourceMappingURL=
|
|
425
|
+
//# sourceMappingURL=components.utils-0f76010d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"components.utils-0f76010d.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;MAOa,cAAc,GAAG,CAAC,MAAc,EAAE,MAAc,EAAE,QAAgB;EAC7E,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACvF,EAAE;AAEF;;;;;;MAMa,YAAY,GAAG,CAAC,MAAc,EAAE,MAAc;EACzD,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACtD,EAAE;AAEF;;;MAGa,UAAU,GAAG,gDAAgD;AAE1E;;;;;;MAMa,UAAU,GAAG,CAAC,IAAY,EAAE,MAAc;EACrD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;IACrE,OAAO,EAAE,CAAC;GACX;EACD,OAAO,I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AK,MAAM,WAAW,IAAI,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE;MACxD,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;MAC1B,eAAe,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;KACvC;GACF;EACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF;;;;;MAKa,aAAa,GAAG,CAAC,KAAc,KAAc,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,GAAG;AAE3G;;;;;MAKa,WAAW,GAAG,CAAC,IAAY,KACtC,OAAO,IAAI,KAAK,QAAQ;EACxB,IAAI;KACD,iBAAiB,EAAE;KACnB,SAAS,CAAC,KAAK,CAAC;KAChB,UAAU,CAAC,kBAAkB,EAAE,EAAE;;;;","names":[],"sources":["src/utils/locale.utils.ts","src/locales/index.ts","src/components/molecules/menu/mg-menu/mg-menu.conf.ts","src/utils/components.utils.ts"],"sourcesContent":["/**\n * Format number to the locale currency\n * @param number - number to format\n * @param locale - locale to apply\n * @param currency - currency to apply\n * @returns formatted currency\n */\nexport const localeCurrency = (number: number, locale: string, currency: string): string => {\n return new Intl.NumberFormat(locale, { style: 'currency', currency }).format(number);\n};\n\n/**\n * Format number to locale\n * @param number - number to format\n * @param locale - locale to apply\n * @returns formatted number\n */\nexport const localeNumber = (number: number, locale: string): string => {\n return new Intl.NumberFormat(locale).format(number);\n};\n\n/**\n * Date RegExp\n */\nexport const dateRegExp = /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$/;\n\n/**\n * Locale date format\n * @param date - date to format\n * @param locale - locale to apply\n * @returns formatted date\n */\nexport const localeDate = (date: string, locale: string): string => {\n if (typeof date !== 'string' || date === '' || !dateRegExp.test(date)) {\n return '';\n }\n return new Intl.DateTimeFormat(locale).format(new Date(date));\n};\n\n/**\n * Get locale and messages\n * We load the defined locale but for now we only support the first subtag for messages\n * @param element - element we need to get the language\n * @param messages - messages to use\n * @param defaultLocale - default messages locale\n * @returns messages object\n */\nexport const getLocaleMessages = (element: HTMLElement, messages: unknown, defaultLocale: string): { locale: string; messages: Record<string, unknown> } => {\n // Get local\n const closestLangAttribute: HTMLElement = element.closest('[lang]');\n const closestLang: string[] = Intl.NumberFormat.supportedLocalesOf(closestLangAttribute?.lang);\n const locale = closestLang.length > 0 ? closestLang[0] : navigator.language || defaultLocale;\n // Only keep first subtag\n const localeSubtag = locale.split('-').shift();\n // Return\n return {\n locale,\n messages: messages[localeSubtag] || messages[defaultLocale],\n };\n};\n","import en from './en/messages.json';\nimport fr from './fr/messages.json';\nimport { getLocaleMessages } from '../utils/locale.utils';\n\nconst defaultLocale = 'en';\nconst messages = { en, fr };\n\n/**\n * Get Intl object\n * @param element - element we need to get the language\n * @returns messages object\n */\nexport const initLocales = (element: HTMLElement): { locale: string; messages: Record<string, unknown> } => getLocaleMessages(element, messages, defaultLocale);\n","import { MgItemMore } from '../../mg-item-more/mg-item-more';\n\n/**\n * Menu direction type\n */\nexport enum Direction {\n VERTICAL = 'vertical',\n HORIZONTAL = 'horizontal',\n}\n\n/**\n * ItemMore prop type\n */\nexport type ItemMoreType = Pick<MgItemMore, 'icon' | 'slotlabel' | 'size'>;\n\n/**\n * List of all possibles sizes\n */\nexport const sizes = ['regular', 'medium', 'large'] as const;\n\n/**\n * item Size from sizes\n */\nexport type MenuSizeType = (typeof sizes)[number];\n","/**\n * Create random ID\n * @param prefix - add prefix to created ID\n * @param length - ID length\n * @returns ID\n */\nexport const createID = (prefix = '', length = 10): string => {\n const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';\n const charsLength = chars.length;\n\n let ID = '';\n let now = Date.now();\n while (length > 0) {\n now += Math.pow(10, 6); // Add 1 millisecond to the timestamp\n const index = now % charsLength;\n ID += chars.charAt(index);\n length--;\n }\n return (prefix !== '' ? `${prefix}-` : '') + ID;\n};\n\n/**\n * Class to manage component classlist\n * Set() are not working when imported in project\n */\nexport class ClassList {\n /**\n * Available classes\n */\n classes: string[];\n\n constructor(classlist: string[] = []) {\n this.classes = classlist;\n }\n\n /**\n * Add class\n * @param className - class name to add\n */\n add = (className: string): void => {\n if (!this.has(className)) {\n this.classes.push(className);\n }\n };\n\n /**\n * Delete class\n * @param className - class name to delete\n */\n delete = (className: string): void => {\n const index = this.classes.indexOf(className);\n if (index > -1) {\n this.classes.splice(index, 1);\n }\n };\n\n /**\n * Check if class exist in list\n * @param className - class name to check\n * @returns class name is in the list\n */\n has = (className: string): boolean => {\n return this.classes.includes(className);\n };\n\n /**\n * Join classes seperated by spaces\n * @returns joined values\n */\n join = (): string => {\n return this.classes.join(' ');\n };\n}\n\n/**\n * Check if all items are string\n * @param items - items to check\n * @returns all items are string\n */\nexport const allItemsAreString = (items: unknown): items is string[] => Array.isArray(items) && items.every(item => typeof item === 'string');\n\n/**\n * Check if element is a heading\n * @param element - slotted element\n * @param tagNames - allowed tag names list\n * @returns element is a heading\n */\nexport const isTagName = (element: Element, tagNames: string[]): boolean => {\n return tagNames.includes(element?.tagName.toLowerCase());\n};\n\n/**\n * Focusable elements query selector\n */\nexport const focusableElements = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex=\"-1\"]), [identifier]';\n\n/**\n * Get windows\n * @param localWindow - the window we are lookink for other windows\n * @returns The list of windows found\n */\nexport const getWindows = (localWindow: Window): Window[] => {\n const parentWindows = getParentWindows(localWindow);\n const childWindows = getChildWindows(localWindow);\n return [localWindow, ...parentWindows, ...childWindows];\n};\n\n/**\n * Get parent windows\n * @param localWindow - the window we are lookink for parents\n * @param windows - The list of allready found windows\n * @returns The list of windows found\n */\nexport const getParentWindows = (localWindow: Window, windows: Window[] = []): Window[] => {\n // Check if is in iframe\n if (localWindow.self !== localWindow.top) {\n // Check if we have permission to access parent\n try {\n const parentWindow: Window = localWindow.parent;\n windows.push(parentWindow);\n return getParentWindows(parentWindow, windows);\n } catch (err) {\n console.error('Different hosts between iframes:', err);\n return windows;\n }\n }\n return windows;\n};\n\n/**\n * Get child windows\n * @param localWindow - the window we are lookink for children\n * @param windows - The list of allready found windows\n * @returns The list of windows found\n */\nconst getChildWindows = (localWindow: Window, windows: Window[] = []): Window[] => {\n if (localWindow.frames.length > 0) {\n for (const childWindow of Array.from(localWindow.frames)) {\n windows.push(childWindow);\n getChildWindows(childWindow, windows);\n }\n }\n return windows;\n};\n\n/**\n * Validate string\n * @param value - value to check\n * @returns if string is valid\n */\nexport const isValidString = (value: unknown): boolean => typeof value === 'string' && value.trim() !== '';\n\n/**\n * Clean string caraters\n * @param text - text to cliean\n * @returns cleanded string\n */\nexport const cleanString = (text: string): string =>\n typeof text === 'string' &&\n text\n .toLocaleLowerCase()\n .normalize('NFD')\n .replaceAll(/[\\u0300-\\u036f]/g, '');\n"],"version":3}
|
|
@@ -2169,7 +2169,24 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
2169
2169
|
if (module) {
|
|
2170
2170
|
return module[exportName];
|
|
2171
2171
|
}
|
|
2172
|
-
|
|
2172
|
+
|
|
2173
|
+
if (!hmrVersionId || !BUILD.hotModuleReplacement) {
|
|
2174
|
+
const processMod = importedModule => {
|
|
2175
|
+
cmpModules.set(bundleId, importedModule);
|
|
2176
|
+
return importedModule[exportName];
|
|
2177
|
+
}
|
|
2178
|
+
switch(bundleId) {
|
|
2179
|
+
|
|
2180
|
+
case 'mg-action-more_34':
|
|
2181
|
+
return import(
|
|
2182
|
+
/* webpackMode: "lazy" */
|
|
2183
|
+
'./mg-action-more_34.entry.js').then(processMod, consoleError);
|
|
2184
|
+
case 'mg-item-more':
|
|
2185
|
+
return import(
|
|
2186
|
+
/* webpackMode: "lazy" */
|
|
2187
|
+
'./mg-item-more.entry.js').then(processMod, consoleError);
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2173
2190
|
return import(
|
|
2174
2191
|
/* @vite-ignore */
|
|
2175
2192
|
/* webpackInclude: /\.entry\.js$/ */
|