@mgdis/mg-components 3.3.0 → 4.1.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/.storybook/utils.js +24 -0
- package/dist/cjs/{index-369388eb.js → index-179621c8.js} +108 -10
- package/dist/cjs/{index-bead7dbd.js → index-88560a66.js} +47 -48
- package/dist/cjs/loader.cjs.js +3 -17
- package/dist/cjs/mg-badge_24.cjs.entry.js +5687 -0
- package/dist/cjs/mg-components.cjs.js +3 -7
- package/dist/cjs/mg-modal.cjs.entry.js +12 -6
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/components/atoms/mg-badge/{mg-badge.stories.js → doc/mg-badge.stories.js} +10 -6
- package/dist/collection/components/atoms/mg-badge/mg-badge.css +0 -2
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +15 -3
- package/dist/collection/components/atoms/mg-button/{mg-button.stories.js → doc/mg-button.stories.js} +16 -13
- package/dist/collection/components/atoms/mg-button/mg-button.conf.js +4 -0
- package/dist/collection/components/atoms/mg-button/mg-button.css +6 -30
- package/dist/collection/components/atoms/mg-button/mg-button.js +53 -22
- package/dist/collection/components/atoms/mg-character-left/doc/mg-character-left.stories.js +20 -0
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +10 -47
- package/dist/collection/components/atoms/mg-icon/{mg-icon.stories.js → doc/mg-icon.stories.js} +12 -4
- package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +99 -10
- package/dist/collection/components/atoms/mg-icon/mg-icon.css +4 -0
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +22 -6
- package/dist/collection/components/atoms/mg-input-title/doc/mg-input-title.stories.js +21 -0
- package/dist/collection/components/atoms/mg-tag/{mg-tag.stories.js → doc/mg-tag.stories.js} +10 -8
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +19 -4
- package/dist/collection/components/atoms/mg-tooltip/doc/mg-tooltip.stories.js +58 -0
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +26 -0
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +71 -13
- package/dist/collection/components/molecules/inputs/MgInput.conf.js +1 -7
- package/dist/collection/components/molecules/inputs/MgInput.js +5 -15
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/{mg-input-checkbox.stories.js → doc/mg-input-checkbox.stories.js} +3 -15
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +22 -15
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +8 -21
- package/dist/collection/components/molecules/inputs/mg-input-date/{mg-input-date.stories.js → doc/mg-input-date.stories.js} +3 -12
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +22 -20
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +19 -18
- package/dist/collection/components/molecules/inputs/mg-input-numeric/{mg-input-numeric.stories.js → doc/mg-input-numeric.stories.js} +9 -13
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +23 -21
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +43 -19
- package/dist/collection/components/molecules/inputs/mg-input-password/{mg-input-password.stories.js → doc/mg-input-password.stories.js} +10 -12
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +22 -20
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +17 -22
- package/dist/collection/components/molecules/inputs/mg-input-radio/{mg-input-radio.stories.js → doc/mg-input-radio.stories.js} +3 -14
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +22 -15
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +8 -15
- package/dist/collection/components/molecules/inputs/mg-input-select/{mg-input-select.stories.js → doc/mg-input-select.stories.js} +10 -16
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +23 -20
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +24 -31
- package/dist/collection/components/molecules/inputs/mg-input-text/{mg-input-text.stories.js → doc/mg-input-text.stories.js} +18 -25
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +54 -30
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +42 -43
- package/dist/collection/components/molecules/inputs/mg-input-textarea/{mg-input-textarea.stories.js → doc/mg-input-textarea.stories.js} +11 -14
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +54 -24
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +64 -37
- package/dist/collection/components/molecules/inputs/mg-input-toggle/doc/mg-input-toggle.stories.js +57 -0
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +21 -11
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +25 -10
- package/dist/collection/components/molecules/mg-details/doc/mg-details.stories.js +25 -0
- package/dist/collection/components/molecules/mg-details/mg-details.css +14 -0
- package/dist/collection/components/molecules/mg-details/mg-details.js +141 -0
- package/dist/collection/components/molecules/mg-form/{mg-form.stories.js → doc/mg-form.stories.js} +9 -6
- package/dist/collection/components/molecules/mg-form/mg-form.css +5 -1
- package/dist/collection/components/molecules/mg-form/mg-form.js +53 -7
- package/dist/collection/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.js +22 -0
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.css +37 -0
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +74 -0
- package/dist/collection/components/molecules/mg-message/{mg-message.stories.js → doc/mg-message.stories.js} +10 -16
- package/dist/collection/components/molecules/mg-message/mg-message.js +15 -7
- package/dist/collection/components/molecules/mg-modal/doc/mg-modal.stories.js +43 -0
- package/dist/collection/components/molecules/mg-modal/mg-modal.css +5 -7
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +10 -4
- package/dist/collection/components/molecules/mg-pagination/doc/mg-pagination.stories.js +20 -0
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +17 -18
- package/dist/collection/components/molecules/mg-panel/doc/mg-panel.stories.js +29 -0
- package/dist/collection/components/molecules/mg-panel/mg-panel.css +4 -2
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +12 -16
- package/dist/collection/components/molecules/mg-popover/{mg-popover.stories.js → doc/mg-popover.stories.js} +22 -16
- package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js +20 -0
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +43 -13
- package/dist/collection/components/molecules/mg-tabs/{mg-tabs.stories.js → doc/mg-tabs.stories.js} +20 -15
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +7 -0
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +3 -0
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +75 -29
- package/dist/collection/locales/index.js +33 -4
- package/dist/collection/stories/helpers.stories.js +41 -0
- package/dist/collection/stories/icons.stories.js +10 -2
- package/dist/collection/stories/typography.stories.js +8 -1
- package/dist/collection/utils/components.utils.js +10 -0
- package/dist/collection/utils/locale.utils.js +7 -4
- package/dist/collection/variables.css +10 -5
- package/dist/collection/variables.scss +10 -5
- package/dist/components/MgInput.js +6 -23
- package/dist/components/components.utils.js +11 -1
- package/dist/components/index.d.ts +25 -5
- package/dist/components/index.js +25 -0
- package/dist/components/index2.js +97 -8
- package/dist/components/locale.utils.js +7 -5
- package/dist/components/mg-badge2.js +16 -4
- package/dist/components/mg-button2.js +14 -17
- package/dist/components/mg-character-left2.js +4 -27
- package/dist/components/mg-details.d.ts +11 -0
- package/dist/components/mg-details.js +87 -0
- package/dist/components/mg-form.js +40 -8
- package/dist/components/mg-icon2.js +122 -17
- package/dist/components/mg-illustrated-message.d.ts +11 -0
- package/dist/components/mg-illustrated-message.js +68 -0
- package/dist/components/mg-input-checkbox.js +11 -27
- package/dist/components/mg-input-date.js +21 -25
- package/dist/components/mg-input-numeric.js +28 -26
- package/dist/components/mg-input-password.js +18 -28
- package/dist/components/mg-input-radio.js +10 -22
- package/dist/components/mg-input-select2.js +24 -35
- package/dist/components/mg-input-text2.js +38 -26
- package/dist/components/mg-input-textarea.js +43 -20
- package/dist/components/mg-input-toggle.js +27 -18
- package/dist/components/mg-message.js +16 -8
- package/dist/components/mg-modal.js +11 -5
- package/dist/components/mg-pagination.js +16 -22
- package/dist/components/mg-panel.js +9 -12
- package/dist/components/mg-popover.js +22 -12
- package/dist/components/mg-tabs.js +77 -22
- package/dist/components/mg-tag.js +20 -5
- package/dist/components/mg-tooltip2.js +74 -12
- package/dist/components/popper.js +6 -2
- package/dist/esm/{index-c346f52d.js → index-7efedd97.js} +107 -8
- package/dist/esm/{index-9e877561.js → index-bca81100.js} +48 -46
- package/dist/esm/loader.js +3 -17
- package/dist/esm/mg-badge_24.entry.js +5660 -0
- package/dist/esm/mg-components.js +3 -7
- package/dist/esm/mg-modal.entry.js +12 -6
- package/dist/index.js +1 -1
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/p-5f89600c.js +1 -0
- package/dist/mg-components/p-a2883dc7.entry.js +1 -0
- package/dist/mg-components/p-b14a3443.js +2 -0
- package/dist/mg-components/p-cffe0519.entry.js +1 -0
- package/dist/mg-components/variables.css +10 -5
- package/dist/mg-components/variables.scss +10 -5
- package/dist/types/components/atoms/mg-badge/{mg-badge.stories.d.ts → doc/mg-badge.stories.d.ts} +0 -0
- package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +8 -1
- package/dist/types/components/atoms/mg-button/{mg-button.stories.d.ts → doc/mg-button.stories.d.ts} +6 -0
- package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +8 -0
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +12 -1
- package/dist/types/{stories/tags.stories.d.ts → components/atoms/mg-character-left/doc/mg-character-left.stories.d.ts} +2 -1
- package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +5 -13
- package/dist/types/components/atoms/mg-icon/{mg-icon.stories.d.ts → doc/mg-icon.stories.d.ts} +0 -0
- package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +3 -3
- package/dist/types/components/atoms/mg-input-title/{mg-input-title.stories.d.ts → doc/mg-input-title.stories.d.ts} +0 -0
- package/dist/types/components/atoms/mg-tag/{mg-tag.stories.d.ts → doc/mg-tag.stories.d.ts} +0 -0
- package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +8 -1
- package/dist/types/components/atoms/mg-tooltip/doc/mg-tooltip.stories.d.ts +24 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +13 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +27 -2
- package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +0 -6
- package/dist/types/components/molecules/inputs/MgInput.d.ts +2 -4
- package/dist/types/components/molecules/inputs/mg-input-checkbox/{mg-input-checkbox.stories.d.ts → doc/mg-input-checkbox.stories.d.ts} +0 -0
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +5 -2
- package/dist/types/components/molecules/inputs/mg-input-date/{mg-input-date.stories.d.ts → doc/mg-input-date.stories.d.ts} +0 -0
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +7 -1
- package/dist/types/components/molecules/inputs/mg-input-numeric/{mg-input-numeric.stories.d.ts → doc/mg-input-numeric.stories.d.ts} +6 -0
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +8 -2
- package/dist/types/components/molecules/inputs/mg-input-password/{mg-input-password.stories.d.ts → doc/mg-input-password.stories.d.ts} +8 -0
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +7 -2
- package/dist/types/components/molecules/inputs/mg-input-radio/{mg-input-radio.stories.d.ts → doc/mg-input-radio.stories.d.ts} +0 -0
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +5 -1
- package/dist/types/components/molecules/inputs/mg-input-select/{mg-input-select.stories.d.ts → doc/mg-input-select.stories.d.ts} +11 -5
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +7 -2
- package/dist/types/components/molecules/inputs/mg-input-text/{mg-input-text.stories.d.ts → doc/mg-input-text.stories.d.ts} +8 -0
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +7 -7
- package/dist/types/components/molecules/inputs/mg-input-textarea/{mg-input-textarea.stories.d.ts → doc/mg-input-textarea.stories.d.ts} +8 -0
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +14 -6
- package/dist/types/components/molecules/inputs/mg-input-toggle/{mg-input-toggle.stories.d.ts → doc/mg-input-toggle.stories.d.ts} +0 -0
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +2 -0
- package/dist/types/components/molecules/mg-details/doc/mg-details.stories.d.ts +11 -0
- package/dist/types/components/molecules/mg-details/mg-details.d.ts +49 -0
- package/dist/types/components/molecules/mg-form/{mg-form.stories.d.ts → doc/mg-form.stories.d.ts} +0 -0
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +14 -0
- package/dist/types/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.d.ts +6 -0
- package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +28 -0
- package/dist/types/components/molecules/mg-message/{mg-message.stories.d.ts → doc/mg-message.stories.d.ts} +0 -0
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +2 -0
- package/dist/types/components/molecules/mg-modal/{mg-modal.stories.d.ts → doc/mg-modal.stories.d.ts} +0 -0
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +2 -0
- package/dist/types/components/molecules/mg-pagination/{mg-pagination.stories.d.ts → doc/mg-pagination.stories.d.ts} +0 -0
- package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +8 -0
- package/dist/types/components/molecules/mg-panel/{mg-panel.stories.d.ts → doc/mg-panel.stories.d.ts} +0 -0
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +5 -0
- package/dist/types/components/molecules/mg-popover/doc/mg-popover.stories.d.ts +28 -0
- package/dist/types/components/molecules/mg-popover/mg-popover.conf.d.ts +8 -0
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +15 -2
- package/dist/types/components/molecules/mg-tabs/{mg-tabs.stories.d.ts → doc/mg-tabs.stories.d.ts} +0 -0
- package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +7 -1
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +44 -0
- package/dist/types/components.d.ts +240 -147
- package/dist/types/home/runner/work/mg-components/mg-components/.stencil/.storybook/utils.d.ts +1 -0
- package/dist/types/locales/index.d.ts +109 -46
- package/dist/types/stories/{buttons.stories.d.ts → helpers.stories.d.ts} +1 -1
- package/dist/types/utils/components.utils.d.ts +8 -0
- package/dist/types/utils/locale.utils.d.ts +7 -3
- package/loader/index.js +1 -1
- package/package.json +16 -16
- package/readme.md +6 -35
- package/dist/cjs/css-shim-629916b0.js +0 -6
- package/dist/cjs/mg-badge_21.cjs.entry.js +0 -3358
- package/dist/cjs/mg-popover.cjs.entry.js +0 -161
- package/dist/cjs/popper-0c3964e7.js +0 -1786
- package/dist/cjs/shadow-css-546083ef.js +0 -390
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.stories.js +0 -23
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.stories.js +0 -21
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.stories.js +0 -26
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.stories.js +0 -78
- package/dist/collection/components/molecules/mg-modal/mg-modal.stories.js +0 -51
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.stories.js +0 -24
- package/dist/collection/components/molecules/mg-panel/mg-panel.stories.js +0 -39
- package/dist/collection/stories/buttons.stories.js +0 -43
- package/dist/collection/stories/messages.stories.js +0 -44
- package/dist/collection/stories/tags.stories.js +0 -13
- package/dist/esm/css-shim-0993aa3b.js +0 -4
- package/dist/esm/mg-badge_21.entry.js +0 -3334
- package/dist/esm/mg-popover.entry.js +0 -157
- package/dist/esm/popper-8874fd6c.js +0 -1784
- package/dist/esm/shadow-css-dfa0587f.js +0 -388
- package/dist/esm-es5/css-shim-0993aa3b.js +0 -1
- package/dist/esm-es5/index-9e877561.js +0 -1
- package/dist/esm-es5/index-c346f52d.js +0 -1
- package/dist/esm-es5/index.js +0 -0
- package/dist/esm-es5/loader.js +0 -1
- package/dist/esm-es5/mg-badge_21.entry.js +0 -2
- package/dist/esm-es5/mg-components.js +0 -1
- package/dist/esm-es5/mg-modal.entry.js +0 -1
- package/dist/esm-es5/mg-popover.entry.js +0 -1
- package/dist/esm-es5/popper-8874fd6c.js +0 -1
- package/dist/esm-es5/shadow-css-dfa0587f.js +0 -12
- package/dist/mg-components/mg-components.js +0 -132
- package/dist/mg-components/p-136c8d6f.system.entry.js +0 -2
- package/dist/mg-components/p-3c14153d.js +0 -1
- package/dist/mg-components/p-50ea2036.system.js +0 -1
- package/dist/mg-components/p-55a22b35.system.js +0 -1
- package/dist/mg-components/p-5e796581.js +0 -12
- package/dist/mg-components/p-656b5efb.system.js +0 -1
- package/dist/mg-components/p-68d6f104.js +0 -1
- package/dist/mg-components/p-6d49ed95.js +0 -1
- package/dist/mg-components/p-6f173f62.system.entry.js +0 -1
- package/dist/mg-components/p-70177194.entry.js +0 -1
- package/dist/mg-components/p-8b2d8a2a.system.js +0 -13
- package/dist/mg-components/p-8cb61c3f.system.js +0 -1
- package/dist/mg-components/p-ace173b1.js +0 -1
- package/dist/mg-components/p-b7488a4c.entry.js +0 -1
- package/dist/mg-components/p-c1ffb2e1.entry.js +0 -1
- package/dist/mg-components/p-c90cc4bf.system.js +0 -1
- package/dist/mg-components/p-de1164fa.system.entry.js +0 -1
- package/dist/mg-components/p-e4a502b5.system.js +0 -1
- package/dist/types/components/atoms/mg-character-left/mg-character-left.stories.d.ts +0 -16
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.stories.d.ts +0 -11
- package/dist/types/components/molecules/mg-popover/mg-popover.stories.d.ts +0 -12
- package/dist/types/stories/messages.stories.d.ts +0 -13
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { c as createID, C as ClassList } from './components.utils.js';
|
|
3
|
-
import {
|
|
3
|
+
import { i as initLocales } from './index2.js';
|
|
4
4
|
import { d as defineCustomElement$7 } from './mg-button2.js';
|
|
5
5
|
import { d as defineCustomElement$6 } from './mg-character-left2.js';
|
|
6
6
|
import { d as defineCustomElement$5 } from './mg-icon2.js';
|
|
@@ -8,7 +8,7 @@ import { d as defineCustomElement$4 } from './mg-input-text2.js';
|
|
|
8
8
|
import { d as defineCustomElement$3 } from './mg-input-title2.js';
|
|
9
9
|
import { d as defineCustomElement$2 } from './mg-tooltip2.js';
|
|
10
10
|
|
|
11
|
-
const mgPanelCss = ".mg-panel{background-color:hsl(var(--mg-panel-background));border-radius:var(--mg-panel-border-radius)
|
|
11
|
+
const mgPanelCss = ".mg-panel{background-color:hsl(var(--mg-panel-background));border-radius:var(--mg-panel-border-radius);box-shadow:var(--box-shadow)}.mg-panel__header{display:flex;flex-wrap:wrap;justify-content:space-between;padding:0 1rem 0 0.3rem;align-items:flex-start}.mg-panel__header-left,.mg-panel__header-right{display:flex;margin:0.3rem 0}.mg-panel__header-left--full{flex:1 1 auto}.mg-panel__header-right{flex:1 auto}.mg-panel__header-left mg-input-text{flex-grow:1}.mg-panel__header-left mg-button:not([slot=append-input]){margin:0 0.3rem 0 0}.mg-panel__header-left mg-button:not([slot=append-input])>*:first-of-type{font-family:var(--font-family-heading);font-size:1.4rem;font-weight:500}.mg-panel__content{padding:1.5rem}.mg-panel ::slotted([slot=header-right]){display:flex;flex-wrap:wrap;gap:1rem;margin-left:auto}";
|
|
12
12
|
|
|
13
13
|
const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
14
14
|
constructor() {
|
|
@@ -17,9 +17,6 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
17
17
|
this.__attachShadow();
|
|
18
18
|
this.titleChange = createEvent(this, "title-change", 7);
|
|
19
19
|
this.expandedChange = createEvent(this, "expanded-change", 7);
|
|
20
|
-
/**************
|
|
21
|
-
* Decorators *
|
|
22
|
-
**************/
|
|
23
20
|
/**
|
|
24
21
|
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
25
22
|
* If not set, it will be created.
|
|
@@ -29,10 +26,6 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
29
26
|
* Panel is opened
|
|
30
27
|
*/
|
|
31
28
|
this.expanded = false;
|
|
32
|
-
/**
|
|
33
|
-
* Disable possibility to toggle expand
|
|
34
|
-
*/
|
|
35
|
-
this.expandToggleDisabled = false;
|
|
36
29
|
/**
|
|
37
30
|
* Panel title is editabled
|
|
38
31
|
*/
|
|
@@ -114,17 +107,17 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
114
107
|
* @returns {HTMLMgButtonElement | HTMLElement | HTMLElement[]} header left element
|
|
115
108
|
*/
|
|
116
109
|
this.headerLeft = () => {
|
|
117
|
-
const collapseButton = () => (h("mg-button", { onClick: this.handleCollapseButton, variant: "flat",
|
|
110
|
+
const collapseButton = () => (h("mg-button", { onClick: this.handleCollapseButton, variant: "flat", identifier: `${this.identifier}-collapse-button`, expanded: this.expanded, controls: `${this.identifier}-content`, disabled: this.expandToggleDisabled }, h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down' }), !this.isEditing && this.panelTitle));
|
|
118
111
|
if (this.titleEditable && !this.isEditing) {
|
|
119
112
|
return [
|
|
120
113
|
collapseButton(),
|
|
121
|
-
h("mg-button", { "is-icon": true, variant: "flat", label: messages.panel.editLabel, onClick: this.handleEditButton, identifier: `${this.identifier}-edit-button` }, h("mg-icon", { icon: "pen" })),
|
|
114
|
+
h("mg-button", { "is-icon": true, variant: "flat", label: this.messages.panel.editLabel, onClick: this.handleEditButton, identifier: `${this.identifier}-edit-button` }, h("mg-icon", { icon: "pen" })),
|
|
122
115
|
];
|
|
123
116
|
}
|
|
124
117
|
if (this.titleEditable && this.isEditing) {
|
|
125
118
|
return [
|
|
126
119
|
collapseButton(),
|
|
127
|
-
h("mg-input-text", { label: messages.panel.editLabel, "label-hide": true, value: this.panelTitle, "onValue-change": this.handleUpdateTitle, displayCharacterLeft: false, pattern: this.titlePattern, "pattern-error-message": this.titlePatternErrorMessage, identifier: `${this.identifier}-edition-input`, ref: el => (this.editInputElement = el) }, h("mg-button", { slot: "append-input", label: messages.general.cancel, "is-icon": true, variant: "secondary", onClick: this.handleCancelEditButton, identifier: `${this.identifier}-edition-button-cancel` }, h("mg-icon", { icon: "cross" })), h("mg-button", { slot: "append-input", label: messages.general.
|
|
120
|
+
h("mg-input-text", { label: this.messages.panel.editLabel, "label-hide": true, value: this.panelTitle, "onValue-change": this.handleUpdateTitle, displayCharacterLeft: false, pattern: this.titlePattern, "pattern-error-message": this.titlePatternErrorMessage, identifier: `${this.identifier}-edition-input`, ref: el => (this.editInputElement = el) }, h("mg-button", { slot: "append-input", label: this.messages.general.cancel, "is-icon": true, variant: "secondary", onClick: this.handleCancelEditButton, identifier: `${this.identifier}-edition-button-cancel` }, h("mg-icon", { icon: "cross" })), h("mg-button", { slot: "append-input", label: this.messages.general.confirm, "is-icon": true, variant: "secondary", onClick: this.handleValidateEditButton, identifier: `${this.identifier}-edition-button-validate` }, h("mg-icon", { icon: "check" }))),
|
|
128
121
|
];
|
|
129
122
|
}
|
|
130
123
|
return collapseButton();
|
|
@@ -153,6 +146,9 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
153
146
|
* @returns {void}
|
|
154
147
|
*/
|
|
155
148
|
componentWillLoad() {
|
|
149
|
+
// Get locales
|
|
150
|
+
this.messages = initLocales(this.element).messages;
|
|
151
|
+
// Validate
|
|
156
152
|
this.validatetitlePattern(this.titlePattern);
|
|
157
153
|
}
|
|
158
154
|
/**
|
|
@@ -174,6 +170,7 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
174
170
|
render() {
|
|
175
171
|
return (h("section", { class: this.classList.join(), id: this.identifier }, h("header", { class: "mg-panel__header", id: `${this.identifier}-header` }, h("div", { class: `mg-panel__header-left ${this.isEditing ? 'mg-panel__header-left--full' : ''}` }, this.headerLeft()), h("div", { class: "mg-panel__header-right" }, h("slot", { name: "header-right" }))), h("article", { class: "mg-panel__content", id: `${this.identifier}-content`, "aria-labelledby": `${this.identifier}-header`, hidden: !this.expanded }, h("slot", null))));
|
|
176
172
|
}
|
|
173
|
+
get element() { return this; }
|
|
177
174
|
static get watchers() { return {
|
|
178
175
|
"panelTitle": ["handelTileChange"],
|
|
179
176
|
"titlePattern": ["validatetitlePattern"],
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
-
import { c as createID } from './components.utils.js';
|
|
3
|
-
import {
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { c as createID, i as isTagName } from './components.utils.js';
|
|
3
|
+
import { i as initLocales } from './index2.js';
|
|
4
4
|
import { d as defineCustomElement$3 } from './mg-button2.js';
|
|
5
5
|
import { d as defineCustomElement$2 } from './mg-icon2.js';
|
|
6
6
|
import { c as createPopper } from './popper.js';
|
|
7
7
|
|
|
8
|
-
const mgPopoverCss = "mg-popover.sc-mg-popover{display:contents}mg-popover.sc-mg-popover-s>*{display:inline-block}.mg-popover.sc-mg-popover{display:none;padding:1.5rem;z-index:9999;border-radius:0.5rem;background-color:hsl(var(--mg-popover-background-color))
|
|
8
|
+
const mgPopoverCss = "mg-popover.sc-mg-popover{display:contents}mg-popover.sc-mg-popover-s>*{display:inline-block}.mg-popover.sc-mg-popover{display:none;padding:1.5rem;z-index:9999;border-radius:0.5rem;background-color:hsl(var(--mg-popover-background-color));box-shadow:var(--box-shadow);color:hsl(var(--mg-popover-font-color))}.mg-popover[data-show].sc-mg-popover{display:block}.mg-popover.sc-mg-popover mg-button.sc-mg-popover{float:right;margin-right:calc(0rem - (var(--default-size) - var(--mg-icon-regular-size)) / 2);margin-top:calc(0rem - (var(--default-size) - var(--mg-popover-title-font-size) * var(--line-height)) / 2);margin-left:3rem}.mg-popover.sc-mg-popover .mg-popover__arrow.sc-mg-popover,.mg-popover.sc-mg-popover .mg-popover__arrow.sc-mg-popover::before{position:absolute;width:2rem;height:2rem;z-index:-1;background:inherit}.mg-popover.sc-mg-popover .mg-popover__arrow.sc-mg-popover{visibility:hidden}.mg-popover.sc-mg-popover .mg-popover__arrow.sc-mg-popover::before{visibility:visible;content:\"\";transform:rotate(45deg)}.mg-popover[data-popper-placement^=top].sc-mg-popover>.mg-popover__arrow.sc-mg-popover{bottom:-6px}.mg-popover[data-popper-placement^=bottom].sc-mg-popover>.mg-popover__arrow.sc-mg-popover{top:-6px}.mg-popover[data-popper-placement^=left].sc-mg-popover>.mg-popover__arrow.sc-mg-popover{right:-6px}.mg-popover[data-popper-placement^=right].sc-mg-popover>.mg-popover__arrow.sc-mg-popover{left:-6px}.mg-popover__title.sc-mg-popover-s>[slot=title],.mg-popover__title .sc-mg-popover-s>[slot=title]{margin:0 0 1rem;font-size:var(--mg-popover-title-font-size);font-weight:600}";
|
|
9
9
|
|
|
10
10
|
const MgPopover$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
11
11
|
constructor() {
|
|
12
12
|
super();
|
|
13
13
|
this.__registerHost();
|
|
14
|
+
this.displayChange = createEvent(this, "display-change", 7);
|
|
14
15
|
this.closeButtonId = '';
|
|
15
16
|
/**
|
|
16
17
|
* Sets an `id` attribute.
|
|
@@ -73,7 +74,7 @@ const MgPopover$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
73
74
|
this.popover.removeAttribute('data-show');
|
|
74
75
|
// Disable the event listeners
|
|
75
76
|
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }] })));
|
|
76
|
-
// Remove
|
|
77
|
+
// Remove event listener
|
|
77
78
|
document.removeEventListener('click', this.clickOutside, false);
|
|
78
79
|
};
|
|
79
80
|
/**
|
|
@@ -85,28 +86,37 @@ const MgPopover$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
85
86
|
this.display = false;
|
|
86
87
|
};
|
|
87
88
|
}
|
|
88
|
-
handleDisplay(
|
|
89
|
-
if (
|
|
89
|
+
handleDisplay(newValue) {
|
|
90
|
+
if (newValue) {
|
|
90
91
|
this.show();
|
|
91
92
|
}
|
|
92
93
|
else {
|
|
93
94
|
this.hide();
|
|
94
95
|
}
|
|
96
|
+
this.displayChange.emit(newValue);
|
|
95
97
|
}
|
|
96
98
|
/*************
|
|
97
99
|
* Lifecycle *
|
|
98
100
|
*************/
|
|
101
|
+
/**
|
|
102
|
+
* Check if component props are well configured on init
|
|
103
|
+
*
|
|
104
|
+
* @returns {void} timeout
|
|
105
|
+
*/
|
|
106
|
+
componentWillLoad() {
|
|
107
|
+
// Get locales
|
|
108
|
+
this.messages = initLocales(this.element).messages;
|
|
109
|
+
}
|
|
99
110
|
/**
|
|
100
111
|
* Check if component props are well configured on init
|
|
101
112
|
*
|
|
102
113
|
* @returns {void}
|
|
103
114
|
*/
|
|
104
115
|
componentDidLoad() {
|
|
105
|
-
|
|
106
|
-
const headingElements = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
116
|
+
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
107
117
|
const slotedTitleElement = this.element.querySelector('[slot="title"]');
|
|
108
|
-
if (slotedTitleElement
|
|
109
|
-
throw new Error(`<mg-popover> Slotted title must be a heading:
|
|
118
|
+
if (slotedTitleElement && !isTagName(slotedTitleElement, headingTags)) {
|
|
119
|
+
throw new Error(`<mg-popover> Slotted title must be a heading: ${headingTags.join(', ')}`);
|
|
110
120
|
}
|
|
111
121
|
// Set close button id
|
|
112
122
|
if (this.closeButton) {
|
|
@@ -149,7 +159,7 @@ const MgPopover$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
149
159
|
* @returns {HTMLElement} HTML Element
|
|
150
160
|
*/
|
|
151
161
|
render() {
|
|
152
|
-
return (h(Host, null, h("slot", null), h("div", { id: this.identifier, class: "mg-popover" }, !this.disabled && this.closeButton && (h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: messages.general.close, onClick: this.handleCloseButton }, h("mg-icon", { icon: "cross" }))), h("div", { class: "mg-popover__title" }, h("slot", { name: "title" })), h("slot", { name: "content" }), h("div", { class: "mg-popover__arrow", "data-popper-arrow": true }))));
|
|
162
|
+
return (h(Host, null, h("slot", null), h("div", { id: this.identifier, class: "mg-popover" }, !this.disabled && this.closeButton && (h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, h("mg-icon", { icon: "cross" }))), h("div", { class: "mg-popover__title" }, h("slot", { name: "title" })), h("slot", { name: "content" }), h("div", { class: "mg-popover__arrow", "data-popper-arrow": true }))));
|
|
153
163
|
}
|
|
154
164
|
get element() { return this; }
|
|
155
165
|
static get watchers() { return {
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, createEvent, h
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { c as createID, C as ClassList, a as allItemsAreString } from './components.utils.js';
|
|
3
3
|
import { d as defineCustomElement$3 } from './mg-badge2.js';
|
|
4
4
|
import { d as defineCustomElement$2 } from './mg-icon2.js';
|
|
5
5
|
|
|
6
|
+
var Status;
|
|
7
|
+
(function (Status) {
|
|
8
|
+
Status["VISIBLE"] = "visible";
|
|
9
|
+
Status["HIDDEN"] = "hidden";
|
|
10
|
+
Status["DISABLED"] = "disabled";
|
|
11
|
+
Status["ACTIVE"] = "active";
|
|
12
|
+
})(Status || (Status = {}));
|
|
6
13
|
/**
|
|
7
14
|
* List of all possibles sizes
|
|
8
15
|
*/
|
|
9
16
|
const sizes = ['regular', 'large'];
|
|
10
17
|
|
|
11
|
-
const mgTabsCss = ".mg-tabs.mg-tabs--size-regular
|
|
18
|
+
const mgTabsCss = ".mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button{padding:calc(1rem + 0.3rem) calc(1rem * 1.3) 1rem}.mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button{padding:calc(1.8rem + 0.3rem) calc(1.8rem * 1.3) 1.8rem}.mg-tabs__header{display:flex;flex-direction:row;flex-wrap:wrap}.mg-tabs__navigation-button{display:flex;align-items:center;column-gap:0.5rem;background:none;border:none;border-bottom:0.3rem solid transparent;color:hsl(var(--color-dark));line-height:var(--line-height);cursor:pointer}.mg-tabs__navigation-button:disabled,.mg-tabs__navigation-button--disabled{cursor:default;opacity:30%}.mg-tabs__navigation-button:hover:not(:disabled),.mg-tabs__navigation-button:focus:not(:disabled){background-color:hsla(var(--color-info-h), var(--color-info-s), var(--color-info-l), 10%)}.mg-tabs__navigation-button.mg-tabs__navigation-button--active{color:hsl(var(--color-info));border-bottom-color:hsl(var(--color-info));font-weight:700}.mg-tabs__navigation-button.mg-tabs__navigation-button--hidden{display:none}.mg-tabs__content-container:focus-visible{outline:none}";
|
|
12
19
|
|
|
13
20
|
/**
|
|
14
21
|
* type TabItem validation function
|
|
@@ -21,7 +28,14 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
21
28
|
constructor() {
|
|
22
29
|
super();
|
|
23
30
|
this.__registerHost();
|
|
31
|
+
this.__attachShadow();
|
|
24
32
|
this.activeTabChange = createEvent(this, "active-tab-change", 7);
|
|
33
|
+
/************
|
|
34
|
+
* Internal *
|
|
35
|
+
************/
|
|
36
|
+
this.tabPanel = 'panel';
|
|
37
|
+
this.startIndex = 1;
|
|
38
|
+
this.buttonTabBaseClass = 'mg-tabs__navigation-button';
|
|
25
39
|
/**
|
|
26
40
|
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
27
41
|
* If not set, it will be created.
|
|
@@ -44,6 +58,46 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
44
58
|
* Component classes
|
|
45
59
|
*/
|
|
46
60
|
this.classList = new ClassList(['mg-tabs']);
|
|
61
|
+
/**
|
|
62
|
+
* Method to set active tab
|
|
63
|
+
*
|
|
64
|
+
* @param {number} tabKey item tab key to set to ACTIVE status
|
|
65
|
+
* @returns {void}
|
|
66
|
+
*/
|
|
67
|
+
this.setActiveTab = (tabKey) => {
|
|
68
|
+
// reset active tabs
|
|
69
|
+
this.tabs.forEach(tab => {
|
|
70
|
+
if (this.tabHasGivenStatus(tab, Status.ACTIVE))
|
|
71
|
+
tab.status = Status.VISIBLE;
|
|
72
|
+
});
|
|
73
|
+
// set active tab from given tab key
|
|
74
|
+
this.tabs[tabKey - this.startIndex].status = Status.ACTIVE;
|
|
75
|
+
// emit change active tab key event
|
|
76
|
+
this.activeTabChange.emit(tabKey);
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Method to know if given tab has the given status
|
|
80
|
+
*
|
|
81
|
+
* @param {TabItem} tab item tab key to set to ACTIVE status
|
|
82
|
+
* @param {Status} status status to valide
|
|
83
|
+
* @returns {boolean} status comparaison
|
|
84
|
+
*/
|
|
85
|
+
this.tabHasGivenStatus = (tab, status) => tab.status === status;
|
|
86
|
+
/**
|
|
87
|
+
* Method to get element id from index
|
|
88
|
+
*
|
|
89
|
+
* @param {string} element to get id
|
|
90
|
+
* @param {number} index to generate id
|
|
91
|
+
* @returns {string} generated element id
|
|
92
|
+
*/
|
|
93
|
+
this.getElementId = (element, index) => `${element}-${this.getTabIndex(index)}`;
|
|
94
|
+
/**
|
|
95
|
+
* Method to get tab index
|
|
96
|
+
*
|
|
97
|
+
* @param {number} index to get
|
|
98
|
+
* @returns {number} index
|
|
99
|
+
*/
|
|
100
|
+
this.getTabIndex = (index) => index + this.startIndex;
|
|
47
101
|
/**
|
|
48
102
|
* Handle click events on tabs
|
|
49
103
|
*
|
|
@@ -53,6 +107,14 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
53
107
|
const tabId = event.currentTarget.getAttribute('data-index');
|
|
54
108
|
this.activeTab = Number(tabId);
|
|
55
109
|
};
|
|
110
|
+
/**
|
|
111
|
+
* get navigation button class from given status
|
|
112
|
+
*
|
|
113
|
+
* @param {Status} status button tab status
|
|
114
|
+
* @param {boolean} isSelector set if we need a CSS selector with the dot '.' at the begin. default value = false.
|
|
115
|
+
* @returns {string} button class/selector variant
|
|
116
|
+
*/
|
|
117
|
+
this.getNavigationButtonClass = (status, isSelector = false) => `${isSelector ? '.' : ''}${this.buttonTabBaseClass}--${status}`;
|
|
56
118
|
/**
|
|
57
119
|
* Handle keyboard event on tabs
|
|
58
120
|
*
|
|
@@ -63,16 +125,14 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
63
125
|
let tabId = Number(event.target.getAttribute('data-index'));
|
|
64
126
|
const parent = event.target.parentElement;
|
|
65
127
|
// change selected id from key code
|
|
66
|
-
|
|
67
|
-
if (['ArrowRight', 'Right'].includes(event.key)) {
|
|
128
|
+
if (event.key === 'ArrowRight') {
|
|
68
129
|
tabId++;
|
|
69
|
-
// /* IE FIX */ delete 'Left'
|
|
70
130
|
}
|
|
71
|
-
else if (
|
|
131
|
+
else if (event.key === 'ArrowLeft') {
|
|
72
132
|
tabId--;
|
|
73
133
|
}
|
|
74
|
-
// get selected tab
|
|
75
|
-
const selectedTab = parent.querySelector(`[data-index="${tabId}"]`);
|
|
134
|
+
// get selected tab if NOT hidden, disabled
|
|
135
|
+
const selectedTab = parent.querySelector(`[data-index="${tabId}"]:not(${[this.getNavigationButtonClass(Status.HIDDEN, true), this.getNavigationButtonClass(Status.DISABLED, true)].join()})`);
|
|
76
136
|
// apply selected tab if exist
|
|
77
137
|
if (selectedTab !== null) {
|
|
78
138
|
selectedTab.focus();
|
|
@@ -98,7 +158,7 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
98
158
|
validateItems(newValue) {
|
|
99
159
|
// String array
|
|
100
160
|
if (allItemsAreString(newValue)) {
|
|
101
|
-
this.tabs = newValue.map(item => ({ label: item,
|
|
161
|
+
this.tabs = newValue.map(item => ({ label: item, status: Status.VISIBLE }));
|
|
102
162
|
}
|
|
103
163
|
// Object array
|
|
104
164
|
else if (newValue && newValue.every(item => isTabItem(item))) {
|
|
@@ -113,7 +173,7 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
113
173
|
throw new Error('<mg-tabs> prop "activeTab" must be between 1 and tabs length.');
|
|
114
174
|
}
|
|
115
175
|
else {
|
|
116
|
-
this.
|
|
176
|
+
this.setActiveTab(newValue);
|
|
117
177
|
}
|
|
118
178
|
}
|
|
119
179
|
/*************
|
|
@@ -137,17 +197,12 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
137
197
|
* @returns {HTMLElement} HTML Element
|
|
138
198
|
*/
|
|
139
199
|
render() {
|
|
140
|
-
return (h(
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}, tabindex: tabIndex === this.activeTab ? 0 : -1, "aria-selected": (tabIndex === this.activeTab).toString(), "aria-controls": `pannel-${tabIndex}`, onClick: this.handleClick, onKeyDown: this.handleKeydown, "data-index": tabIndex, disabled: tab.disabled }, tab.icon !== undefined && h("mg-icon", { icon: tab.icon }), tab.label, tab.badge !== undefined && h("mg-badge", { variant: "info", value: tab.badge.value, label: tab.badge.label })));
|
|
147
|
-
})), this.tabs.map((_tab, index) => {
|
|
148
|
-
const tabIndex = index + 1;
|
|
149
|
-
return (h("article", { role: "tabpanel", id: `pannel-${tabIndex}`, hidden: tabIndex !== this.activeTab, "aria-labelledby": `${this.identifier}-${this.activeTab}`, tabindex: tabIndex === this.activeTab ? 0 : -1, class: "mg-tabs__content-container" }, h("slot", { name: `tab_content-${tabIndex}` })));
|
|
150
|
-
}))));
|
|
200
|
+
return (h("div", { class: this.classList.join() }, h("header", { role: "tablist", "aria-label": this.label, class: "mg-tabs__header" }, this.tabs.map((tab, index) => (h("button", { role: "tab", id: this.getElementId(this.identifier, index), class: {
|
|
201
|
+
[`${this.buttonTabBaseClass}`]: true,
|
|
202
|
+
[`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.tabHasGivenStatus(tab, Status.ACTIVE),
|
|
203
|
+
[`${this.getNavigationButtonClass(Status.DISABLED)}`]: this.tabHasGivenStatus(tab, Status.DISABLED),
|
|
204
|
+
[`${this.getNavigationButtonClass(Status.HIDDEN)}`]: this.tabHasGivenStatus(tab, Status.HIDDEN),
|
|
205
|
+
}, tabindex: this.tabHasGivenStatus(tab, Status.ACTIVE) ? 0 : -1, "aria-selected": this.tabHasGivenStatus(tab, Status.ACTIVE).toString(), "aria-controls": this.getElementId(this.tabPanel, index), onClick: this.handleClick, onKeyDown: this.handleKeydown, "data-index": this.getTabIndex(index), disabled: this.tabHasGivenStatus(tab, Status.DISABLED) }, tab.icon !== undefined && h("mg-icon", { icon: tab.icon }), tab.label, tab.badge !== undefined && h("mg-badge", { variant: "info", value: tab.badge.value, label: tab.badge.label }))))), this.tabs.map((tab, index) => (h("article", { role: "tabpanel", id: this.getElementId(this.tabPanel, index), hidden: !this.tabHasGivenStatus(tab, Status.ACTIVE), "aria-labelledby": this.getElementId(this.identifier, index), tabindex: this.tabHasGivenStatus(tab, Status.ACTIVE) ? 0 : -1, class: "mg-tabs__content-container" }, h("slot", { name: this.getElementId('tab_content', index) }))))));
|
|
151
206
|
}
|
|
152
207
|
get element() { return this; }
|
|
153
208
|
static get watchers() { return {
|
|
@@ -156,7 +211,7 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
156
211
|
"activeTab": ["validateActiveTab"]
|
|
157
212
|
}; }
|
|
158
213
|
static get style() { return mgTabsCss; }
|
|
159
|
-
}, [
|
|
214
|
+
}, [1, "mg-tabs", {
|
|
160
215
|
"identifier": [1],
|
|
161
216
|
"label": [1],
|
|
162
217
|
"size": [1],
|
|
@@ -6,31 +6,46 @@ import { C as ClassList } from './components.utils.js';
|
|
|
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) - 0.2rem - var(--mg-tag-font-size) * var(--line-height)) / 2) 0.6rem;min-height:var(--mg-tag-height)
|
|
9
|
+
const mgTagCss = ".mg-tag{padding:calc((var(--mg-tag-height) - 0.2rem - var(--mg-tag-font-size) * var(--line-height)) / 2) 0.6rem;min-height:var(--mg-tag-height);box-sizing:border-box;border-radius:var(--mg-tag-border-radius);border:0.1rem solid;font-size:var(--mg-tag-font-size);font-weight:600;text-align:center}.mg-tag.mg-tag--primary{background-color:hsl(var(--color-dark));border-color:hsl(var(--color-dark));color:hsl(var(--color-light))}.mg-tag.mg-tag--primary.mg-tag--outline{background-color:transparent;color:hsl(var(--color-dark))}.mg-tag.mg-tag--secondary{background-color:hsl(var(--color-light));border-color:hsl(var(--color-light));color:hsl(var(--color-dark))}.mg-tag.mg-tag--secondary.mg-tag--outline{background-color:transparent;color:hsl(var(--color-light))}.mg-tag.mg-tag--success{background-color:hsl(var(--color-success));border-color:hsl(var(--color-success));color:hsl(var(--color-dark))}.mg-tag.mg-tag--success.mg-tag--outline{background-color:transparent;color:hsl(var(--color-success))}.mg-tag.mg-tag--warning{background-color:hsl(var(--color-warning));border-color:hsl(var(--color-warning));color:hsl(var(--color-dark))}.mg-tag.mg-tag--warning.mg-tag--outline{background-color:transparent;color:hsl(var(--color-warning))}.mg-tag.mg-tag--danger{background-color:hsl(var(--color-danger));border-color:hsl(var(--color-danger));color:hsl(var(--color-light))}.mg-tag.mg-tag--danger.mg-tag--outline{background-color:transparent;color:hsl(var(--color-danger))}.mg-tag.mg-tag--info{background-color:hsl(var(--color-info));border-color:hsl(var(--color-info));color:hsl(var(--color-light))}.mg-tag.mg-tag--info.mg-tag--outline{background-color:transparent;color:hsl(var(--color-info))}.mg-tag,mg-tag{display:inline-block;vertical-align:middle}";
|
|
10
10
|
|
|
11
11
|
const MgTag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
12
12
|
constructor() {
|
|
13
13
|
super();
|
|
14
14
|
this.__registerHost();
|
|
15
15
|
this.__attachShadow();
|
|
16
|
+
/************
|
|
17
|
+
* Internal *
|
|
18
|
+
************/
|
|
19
|
+
// classes
|
|
20
|
+
this.classOutline = `mg-tag--outline`;
|
|
21
|
+
/**************
|
|
22
|
+
* Decorators *
|
|
23
|
+
**************/
|
|
16
24
|
/**
|
|
17
25
|
* Define button variant
|
|
18
26
|
*/
|
|
19
|
-
this.variant = variants[0]; //
|
|
27
|
+
this.variant = variants[0]; // primary
|
|
20
28
|
/**
|
|
21
29
|
* Component classes
|
|
22
30
|
*/
|
|
23
31
|
this.classList = new ClassList(['mg-tag']);
|
|
24
32
|
}
|
|
25
|
-
validateVariant(newValue) {
|
|
33
|
+
validateVariant(newValue, oldValue) {
|
|
26
34
|
if (!variants.includes(newValue)) {
|
|
27
35
|
throw new Error(`<mg-tag> prop "variant" must be one of : ${variants.join(', ')}.`);
|
|
28
36
|
}
|
|
29
|
-
|
|
37
|
+
else {
|
|
38
|
+
if (oldValue !== undefined) {
|
|
39
|
+
this.classList.delete(`mg-tag--${oldValue}`);
|
|
40
|
+
}
|
|
41
|
+
this.classList.add(`mg-tag--${newValue}`);
|
|
42
|
+
}
|
|
30
43
|
}
|
|
31
44
|
validateOutline(newValue) {
|
|
32
45
|
if (newValue)
|
|
33
|
-
this.classList.add(
|
|
46
|
+
this.classList.add(this.classOutline);
|
|
47
|
+
else
|
|
48
|
+
this.classList.delete(this.classOutline);
|
|
34
49
|
}
|
|
35
50
|
/*************
|
|
36
51
|
* Lifecycle *
|
|
@@ -2,7 +2,17 @@ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal
|
|
|
2
2
|
import { c as createID } from './components.utils.js';
|
|
3
3
|
import { c as createPopper } from './popper.js';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* List of all possibles placements
|
|
7
|
+
*/
|
|
8
|
+
var Guard;
|
|
9
|
+
(function (Guard) {
|
|
10
|
+
Guard["FOCUS"] = "focus";
|
|
11
|
+
Guard["HOVER_TOOLTIP_ELEMENT"] = "hoverTooltipGuard";
|
|
12
|
+
Guard["HOVER_TOOLTIPED_ELEMENT"] = "hoverTooltipedGuard";
|
|
13
|
+
})(Guard || (Guard = {}));
|
|
14
|
+
|
|
15
|
+
const mgTooltipCss = ".sc-mg-tooltip-h{display:inline-block}.mg-tooltip.sc-mg-tooltip{display:none;padding:0.5rem 0.8rem;z-index:9999;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}.mg-tooltip[data-show].sc-mg-tooltip{display:block}.mg-tooltip.sc-mg-tooltip .mg-tooltip__arrow.sc-mg-tooltip,.mg-tooltip.sc-mg-tooltip .mg-tooltip__arrow.sc-mg-tooltip::before{position:absolute;width:0.8rem;height:0.8rem;z-index:9999;background:inherit}.mg-tooltip.sc-mg-tooltip .mg-tooltip__arrow.sc-mg-tooltip{visibility:hidden}.mg-tooltip.sc-mg-tooltip .mg-tooltip__arrow.sc-mg-tooltip::before{visibility:visible;content:\"\";transform:rotate(45deg)}.mg-tooltip[data-popper-placement^=top].sc-mg-tooltip>.mg-tooltip__arrow.sc-mg-tooltip{bottom:-4px}.mg-tooltip[data-popper-placement^=bottom].sc-mg-tooltip>.mg-tooltip__arrow.sc-mg-tooltip{top:-4px}.mg-tooltip[data-popper-placement^=left].sc-mg-tooltip>.mg-tooltip__arrow.sc-mg-tooltip{right:-4px}.mg-tooltip[data-popper-placement^=right].sc-mg-tooltip>.mg-tooltip__arrow.sc-mg-tooltip{left:-4px}";
|
|
6
16
|
|
|
7
17
|
const MgTooltip = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
8
18
|
constructor() {
|
|
@@ -49,9 +59,51 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
49
59
|
// Disable the event listeners
|
|
50
60
|
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }] })));
|
|
51
61
|
};
|
|
62
|
+
/**
|
|
63
|
+
* Method to set display prop
|
|
64
|
+
*
|
|
65
|
+
* @param {boolean} newValue display prop new value
|
|
66
|
+
* @param {boolean} condition additionnal condition to apply display prop newValue
|
|
67
|
+
* @returns {void}
|
|
68
|
+
*/
|
|
69
|
+
this.setDisplay = (newValue, condition = true) => {
|
|
70
|
+
if (!this.disabled && condition)
|
|
71
|
+
this.display = newValue;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Action for tooltip element and tooltiped element mouse listener
|
|
75
|
+
*
|
|
76
|
+
* @param {Guard} elementGuard tooltip element guard
|
|
77
|
+
* @param {boolean} isMouseenter mouseenter validation
|
|
78
|
+
* @param {Guard} conditionalGuard guard condition
|
|
79
|
+
* @returns {void}
|
|
80
|
+
*/
|
|
81
|
+
this.tooltipMouseListenerAction = (elementGuard, isMouseenter, conditionalGuard) => {
|
|
82
|
+
// we mutate elementGuard
|
|
83
|
+
if (this.guard !== Guard.FOCUS) {
|
|
84
|
+
this.guard = elementGuard;
|
|
85
|
+
if (!isMouseenter) {
|
|
86
|
+
setTimeout(() => {
|
|
87
|
+
this.setDisplay(isMouseenter, this.guard !== conditionalGuard);
|
|
88
|
+
this.resetGuard();
|
|
89
|
+
}, 100);
|
|
90
|
+
}
|
|
91
|
+
else if (isMouseenter && elementGuard === Guard.HOVER_TOOLTIPED_ELEMENT) {
|
|
92
|
+
this.setDisplay(isMouseenter);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Method to reset guard value
|
|
98
|
+
*
|
|
99
|
+
* @returns {void}
|
|
100
|
+
*/
|
|
101
|
+
this.resetGuard = () => {
|
|
102
|
+
this.guard = undefined;
|
|
103
|
+
};
|
|
52
104
|
}
|
|
53
|
-
handleDisplay(
|
|
54
|
-
if (
|
|
105
|
+
handleDisplay(newValue) {
|
|
106
|
+
if (newValue) {
|
|
55
107
|
this.show();
|
|
56
108
|
}
|
|
57
109
|
else {
|
|
@@ -102,21 +154,31 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
102
154
|
},
|
|
103
155
|
],
|
|
104
156
|
});
|
|
105
|
-
//
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
this.display = true;
|
|
110
|
-
});
|
|
157
|
+
// Manage tooltipedElement focus/blur events
|
|
158
|
+
tooltipedElement.addEventListener('focus', () => {
|
|
159
|
+
this.guard = Guard.FOCUS;
|
|
160
|
+
this.setDisplay(true);
|
|
111
161
|
});
|
|
112
|
-
['
|
|
162
|
+
['blur', 'keydown'].forEach(event => {
|
|
113
163
|
tooltipedElement.addEventListener(event, (e) => {
|
|
114
164
|
// we continue to process ONLY for KeyboardEvents 'Escape'
|
|
115
165
|
if (e.type === 'keydown' && e.code !== 'Escape') {
|
|
116
166
|
return;
|
|
117
167
|
}
|
|
118
|
-
|
|
119
|
-
|
|
168
|
+
this.resetGuard();
|
|
169
|
+
this.setDisplay(false);
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
// manage tooltipElement & tooltipedElement mouseenter/mouseleave events
|
|
173
|
+
['mouseenter', 'mouseleave'].forEach(event => {
|
|
174
|
+
const isMouseenter = event === 'mouseenter';
|
|
175
|
+
[
|
|
176
|
+
{ element: this.tooltip, action: () => this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIP_ELEMENT, isMouseenter, Guard.HOVER_TOOLTIPED_ELEMENT) },
|
|
177
|
+
{ element: tooltipedElement, action: () => this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIPED_ELEMENT, isMouseenter, Guard.HOVER_TOOLTIP_ELEMENT) },
|
|
178
|
+
].forEach(({ element, action }) => {
|
|
179
|
+
element.addEventListener(event, () => {
|
|
180
|
+
action();
|
|
181
|
+
});
|
|
120
182
|
});
|
|
121
183
|
});
|
|
122
184
|
this.handleDisplay(this.display);
|
|
@@ -298,6 +298,10 @@ function getContainingBlock(element) {
|
|
|
298
298
|
|
|
299
299
|
var currentNode = getParentNode(element);
|
|
300
300
|
|
|
301
|
+
if (isShadowRoot(currentNode)) {
|
|
302
|
+
currentNode = currentNode.host;
|
|
303
|
+
}
|
|
304
|
+
|
|
301
305
|
while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
|
|
302
306
|
var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
|
|
303
307
|
// create a containing block.
|
|
@@ -521,7 +525,7 @@ function mapToStyles(_ref2) {
|
|
|
521
525
|
|
|
522
526
|
if (placement === top || (placement === left || placement === right) && variation === end) {
|
|
523
527
|
sideY = bottom;
|
|
524
|
-
var offsetY = isFixed && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
|
|
528
|
+
var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
|
|
525
529
|
offsetParent[heightProp];
|
|
526
530
|
y -= offsetY - popperRect.height;
|
|
527
531
|
y *= gpuAcceleration ? 1 : -1;
|
|
@@ -529,7 +533,7 @@ function mapToStyles(_ref2) {
|
|
|
529
533
|
|
|
530
534
|
if (placement === left || (placement === top || placement === bottom) && variation === end) {
|
|
531
535
|
sideX = right;
|
|
532
|
-
var offsetX = isFixed && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
|
|
536
|
+
var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
|
|
533
537
|
offsetParent[widthProp];
|
|
534
538
|
x -= offsetX - popperRect.width;
|
|
535
539
|
x *= gpuAcceleration ? 1 : -1;
|