@mgdis/mg-components 6.20.0 → 6.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-TUElr4Wv.js → index-BxB20_Vw.js} +54 -0
- package/dist/cjs/{index-Bp6wZzau.js → index-C2viYwrR.js} +1761 -80
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_37.cjs.entry.js +761 -371
- package/dist/cjs/mg-alert.cjs.entry.js +17 -9
- package/dist/cjs/mg-breadcrumb.cjs.entry.js +63 -0
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/cjs/mg-fieldset.cjs.entry.js +24 -7
- package/dist/cjs/mg-input-combobox.cjs.entry.js +49 -19
- package/dist/cjs/mg-input-file.cjs.entry.js +384 -0
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +40096 -15821
- package/dist/cjs/{mg-input.conf-D7jmj_lh.js → mg-input.conf-BNpeATnq.js} +7 -0
- package/dist/cjs/mg-loader.cjs.entry.js +8 -6
- package/dist/cjs/mg-progress.cjs.entry.js +19 -9
- package/dist/collection/assets/icons/index.js +1 -1
- package/dist/collection/collection-manifest.json +5 -3
- package/dist/collection/components/atoms/internals/mg-character-left/mg-character-left.js +1 -1
- package/dist/collection/components/atoms/internals/mg-input-title/mg-input-title.js +1 -1
- package/dist/collection/components/atoms/mg-card/mg-card.js +1 -1
- package/dist/collection/components/atoms/mg-divider/mg-divider.js +1 -1
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +2 -2
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +6 -0
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +2 -2
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +2 -2
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-file/mg-input-file.js +877 -0
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +2 -2
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/custom-properties.scss +212 -0
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/editor.conf.js +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/index.js +300 -94
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.conf.js +29 -0
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +163 -53
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +2 -2
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +1 -1
- package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +3 -36
- package/dist/collection/components/molecules/menus/mg-menu/mg-menu.conf.js +0 -4
- package/dist/collection/components/molecules/menus/mg-menu/mg-menu.js +21 -43
- package/dist/collection/components/molecules/menus/mg-menu-item/mg-menu-item.js +65 -38
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +2 -2
- package/dist/collection/components/molecules/mg-alert/mg-alert.js +1 -1
- package/dist/collection/components/molecules/mg-breadcrumb/mg-breadcrumb.conf.js +1 -0
- package/dist/collection/components/molecules/mg-breadcrumb/mg-breadcrumb.js +92 -0
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
- package/dist/collection/components/molecules/mg-fieldset/mg-fieldset.js +12 -3
- package/dist/collection/components/molecules/mg-form/mg-form.js +12 -2
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -1
- package/dist/collection/components/molecules/mg-loader/mg-loader.js +1 -1
- package/dist/collection/components/molecules/mg-message/mg-message.js +2 -2
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +2 -2
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +1 -1
- package/dist/collection/components/molecules/mg-progress/mg-progress.js +1 -1
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
- package/dist/collection/components/molecules/mg-table/mg-table.js +37 -0
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +0 -4
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +13 -33
- package/dist/collection/locales/en/messages.json +14 -0
- package/dist/collection/locales/fr/messages.json +14 -0
- package/dist/components/events.utils.js +1 -23
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +1 -1
- package/dist/components/index2.js +1 -408
- package/dist/components/index3.js +1 -476
- package/dist/components/mg-action-more.js +1 -254
- package/dist/components/mg-alert.js +1 -224
- package/dist/components/mg-badge.js +1 -6
- package/dist/components/mg-badge2.js +1 -113
- package/dist/components/mg-breadcrumb.d.ts +11 -0
- package/dist/components/mg-breadcrumb.js +1 -0
- package/dist/components/mg-button.js +1 -6
- package/dist/components/mg-button2.js +1 -275
- package/dist/components/mg-card.js +1 -6
- package/dist/components/mg-card2.js +1 -92
- package/dist/components/mg-character-left.js +1 -6
- package/dist/components/mg-character-left2.js +1 -75
- package/dist/components/mg-details.js +1 -104
- package/dist/components/mg-divider.js +1 -6
- package/dist/components/mg-divider2.js +1 -49
- package/dist/components/mg-fieldset.js +1 -209
- package/dist/components/mg-form.js +1 -302
- package/dist/components/mg-icon.js +1 -6
- package/dist/components/mg-icon2.js +1 -188
- package/dist/components/mg-illustrated-message.js +1 -129
- package/dist/components/mg-input-checkbox-paginated.js +1 -6
- package/dist/components/mg-input-checkbox-paginated2.js +1 -135
- package/dist/components/mg-input-checkbox.js +1 -762
- package/dist/components/mg-input-combobox.js +1 -940
- package/dist/components/mg-input-date.js +1 -463
- package/dist/components/mg-input-file.d.ts +11 -0
- package/dist/components/mg-input-file.js +1 -0
- package/dist/components/mg-input-numeric.js +1 -592
- package/dist/components/mg-input-password.js +1 -360
- package/dist/components/mg-input-radio.js +1 -392
- package/dist/components/mg-input-rich-text-editor.js +1663 -16797
- package/dist/components/mg-input-select.js +1 -6
- package/dist/components/mg-input-select2.js +1 -481
- package/dist/components/mg-input-text.js +1 -6
- package/dist/components/mg-input-text2.js +1 -514
- package/dist/components/mg-input-textarea.js +1 -412
- package/dist/components/mg-input-title.js +1 -6
- package/dist/components/mg-input-title2.js +1 -81
- package/dist/components/mg-input-toggle.js +1 -371
- package/dist/components/mg-input.conf.js +1 -0
- package/dist/components/mg-input.js +1 -6
- package/dist/components/mg-input2.js +1 -459
- package/dist/components/mg-item-more.js +1 -6
- package/dist/components/mg-item-more2.js +1 -505
- package/dist/components/mg-loader.js +1 -6
- package/dist/components/mg-loader2.js +1 -74
- package/dist/components/mg-menu-item.js +1 -6
- package/dist/components/mg-menu-item2.js +1 -485
- package/dist/components/mg-menu.js +1 -6
- package/dist/components/mg-message.js +1 -6
- package/dist/components/mg-message2.js +1 -146
- package/dist/components/mg-modal.js +1 -184
- package/dist/components/mg-pagination.js +1 -234
- package/dist/components/mg-panel.js +1 -350
- package/dist/components/mg-popover-content.js +1 -6
- package/dist/components/mg-popover-content2.js +1 -96
- package/dist/components/mg-popover.js +1 -6
- package/dist/components/mg-popover2.js +1 -312
- package/dist/components/mg-progress.js +1 -123
- package/dist/components/mg-skip-links.js +1 -78
- package/dist/components/mg-table.js +1 -319
- package/dist/components/mg-tabs.js +1 -6
- package/dist/components/mg-tabs2.js +1 -315
- package/dist/components/mg-tag.js +1 -133
- package/dist/components/mg-tooltip-content.js +1 -6
- package/dist/components/mg-tooltip-content2.js +1 -42
- package/dist/components/mg-tooltip.js +1 -6
- package/dist/components/mg-tooltip2.js +1 -421
- package/dist/components/popper.js +1 -1790
- package/dist/esm/{index-BluNKQ3L.js → index-DFwaH2hS.js} +1761 -80
- package/dist/esm/{index-CNX6lq0x.js → index-DSEloqPn.js} +54 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_37.entry.js +761 -371
- package/dist/esm/mg-alert.entry.js +17 -9
- package/dist/esm/mg-breadcrumb.entry.js +61 -0
- package/dist/esm/mg-components.js +4 -4
- package/dist/esm/mg-fieldset.entry.js +24 -7
- package/dist/esm/mg-input-combobox.entry.js +49 -19
- package/dist/esm/mg-input-file.entry.js +382 -0
- package/dist/esm/mg-input-rich-text-editor.entry.js +40083 -15808
- package/dist/esm/{mg-input.conf-DDnrE1hD.js → mg-input.conf-C9rmNQIL.js} +7 -1
- package/dist/esm/mg-loader.entry.js +8 -6
- package/dist/esm/mg-progress.entry.js +19 -9
- package/dist/mg-components/locales/en/messages.json +14 -0
- package/dist/mg-components/locales/fr/messages.json +14 -0
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/p-0482eb9f.entry.js +1 -0
- package/dist/mg-components/{p-7132bca1.entry.js → p-2ee92f38.entry.js} +1 -1
- package/dist/mg-components/{p-916dfb6d.entry.js → p-3b653226.entry.js} +1 -1
- package/dist/mg-components/p-5745fbea.entry.js +1 -0
- package/dist/mg-components/p-C9rmNQIL.js +1 -0
- package/dist/mg-components/p-DFwaH2hS.js +2 -0
- package/dist/mg-components/p-DSEloqPn.js +1 -0
- package/dist/mg-components/p-adec7fcc.entry.js +1 -0
- package/dist/mg-components/p-c63f97f0.entry.js +1658 -0
- package/dist/mg-components/p-c8c8cfc1.entry.js +1 -0
- package/dist/mg-components/p-cc793586.entry.js +1 -0
- package/dist/mg-components/p-d5e69c95.entry.js +1 -0
- package/dist/types/assets/icons/index.d.ts +2 -0
- package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +7 -1
- package/dist/types/components/molecules/inputs/mg-input-file/mg-input-file.d.ts +210 -0
- package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/editor/editor.conf.d.ts +17 -0
- package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/editor/index.d.ts +27 -19
- package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.conf.d.ts +3 -0
- package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.d.ts +50 -16
- package/dist/types/components/molecules/internals/mg-item-more/mg-item-more.conf.d.ts +0 -5
- package/dist/types/components/molecules/internals/mg-item-more/mg-item-more.d.ts +1 -6
- package/dist/types/components/molecules/menus/mg-menu/mg-menu.conf.d.ts +2 -10
- package/dist/types/components/molecules/menus/mg-menu/mg-menu.d.ts +7 -7
- package/dist/types/components/molecules/menus/mg-menu-item/mg-menu-item.d.ts +12 -8
- package/dist/types/components/molecules/mg-breadcrumb/mg-breadcrumb.conf.d.ts +18 -0
- package/dist/types/components/molecules/mg-breadcrumb/mg-breadcrumb.d.ts +34 -0
- package/dist/types/components/molecules/mg-table/mg-table.d.ts +6 -0
- package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +1 -9
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +4 -4
- package/dist/types/components.d.ts +302 -46
- package/dist/types/stencil-public-runtime.d.ts +76 -12
- package/ide/intellij/web-types.json +483 -51
- package/ide/vscode/css-custom-data.json +10 -2
- package/ide/vscode/html-custom-data.json +445 -104
- package/package.json +24 -23
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/editor.scss +0 -1
- package/dist/mg-components/p-016bd291.entry.js +0 -1
- package/dist/mg-components/p-186a6139.entry.js +0 -1
- package/dist/mg-components/p-BluNKQ3L.js +0 -2
- package/dist/mg-components/p-CNX6lq0x.js +0 -1
- package/dist/mg-components/p-DDnrE1hD.js +0 -1
- package/dist/mg-components/p-cd061b38.entry.js +0 -1
- package/dist/mg-components/p-d2c72f09.entry.js +0 -1
- package/dist/mg-components/p-d5a276eb.entry.js +0 -1
- package/ide/vscode/custom.css-data.json +0 -425
|
@@ -1,315 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { c as createID, C as ClassList, n as nextTick, a as isValideID, t as toString, i as isValidString, d as allItemsAreString } from './index2.js';
|
|
3
|
-
import { K as Keys } from './events.utils.js';
|
|
4
|
-
import { d as defineCustomElement$2 } from './mg-badge2.js';
|
|
5
|
-
import { d as defineCustomElement$1 } from './mg-icon2.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Available tabs items status
|
|
9
|
-
*/
|
|
10
|
-
const Status = {
|
|
11
|
-
VISIBLE: 'visible',
|
|
12
|
-
HIDDEN: 'hidden',
|
|
13
|
-
DISABLED: 'disabled',
|
|
14
|
-
ACTIVE: 'active',
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* List of all possibles sizes
|
|
18
|
-
*/
|
|
19
|
-
const sizes = ['medium', 'large'];
|
|
20
|
-
|
|
21
|
-
const mgTabsCss = "/*!\n * @prop --mg-c-tabs-color: Defines tabs global color, used for bottom line and active tabs. Default value: `--mg-b-color-app`.\n * @prop --mg-c-tabs-color-text: Defines tabs text color. Unset by default, fallback on `--mg-b-color-dark`.\n */.mg-c-tabs.mg-c-tabs--size-medium .mg-c-tabs__navigation-button,.mg-c-tabs__navigation-button.mg-c-tabs__navigation-button--size-medium{padding:var(--mg-b-size-12) var(--mg-b-size-16)}.mg-c-tabs.mg-c-tabs--size-medium .mg-c-tabs__navigation-button,.mg-c-tabs.mg-c-tabs--size-medium .mg-c-tabs__navigation-button ::slotted([slot=label]),.mg-c-tabs.mg-c-tabs--size-medium .mg-c-tabs__navigation-button ::slotted([slot=metadata]),.mg-c-tabs__navigation-button.mg-c-tabs__navigation-button--size-medium,.mg-c-tabs__navigation-button.mg-c-tabs__navigation-button--size-medium ::slotted([slot=label]),.mg-c-tabs__navigation-button.mg-c-tabs__navigation-button--size-medium ::slotted([slot=metadata]){font-size:var(--mg-b-font-size)}.mg-c-tabs.mg-c-tabs--size-medium .mg-c-tabs__navigation-button.mg-c-tabs__navigation-button--horizontal,.mg-c-tabs__navigation-button.mg-c-tabs__navigation-button--size-medium.mg-c-tabs__navigation-button--horizontal{padding-bottom:var(--mg-b-size-12)}.mg-c-tabs.mg-c-tabs--size-medium .mg-c-tabs__navigation-button.mg-c-tabs__navigation-button--vertical,.mg-c-tabs__navigation-button.mg-c-tabs__navigation-button--size-medium.mg-c-tabs__navigation-button--vertical{padding-left:var(--mg-b-size-16)}.mg-c-tabs.mg-c-tabs--size-large .mg-c-tabs__navigation-button,.mg-c-tabs__navigation-button.mg-c-tabs__navigation-button--size-large{padding:var(--mg-b-size-16) var(--mg-b-size-32)}.mg-c-tabs.mg-c-tabs--size-large .mg-c-tabs__navigation-button,.mg-c-tabs.mg-c-tabs--size-large .mg-c-tabs__navigation-button ::slotted([slot=label]),.mg-c-tabs.mg-c-tabs--size-large .mg-c-tabs__navigation-button ::slotted([slot=metadata]),.mg-c-tabs__navigation-button.mg-c-tabs__navigation-button--size-large,.mg-c-tabs__navigation-button.mg-c-tabs__navigation-button--size-large ::slotted([slot=label]),.mg-c-tabs__navigation-button.mg-c-tabs__navigation-button--size-large ::slotted([slot=metadata]){font-size:var(--mg-b-font-size-h4)}.mg-c-tabs.mg-c-tabs--size-large .mg-c-tabs__navigation-button.mg-c-tabs__navigation-button--horizontal,.mg-c-tabs__navigation-button.mg-c-tabs__navigation-button--size-large.mg-c-tabs__navigation-button--horizontal{padding-bottom:var(--mg-b-size-16)}.mg-c-tabs.mg-c-tabs--size-large .mg-c-tabs__navigation-button.mg-c-tabs__navigation-button--vertical,.mg-c-tabs__navigation-button.mg-c-tabs__navigation-button--size-large.mg-c-tabs__navigation-button--vertical{padding-left:var(--mg-b-size-32)}.mg-c-tabs__navigation-button{display:flex;box-sizing:border-box;align-items:center;border:none;background-color:unset;color:var(--mg-c-tabs-color-text, var(--mg-b-color-dark));column-gap:var(--mg-c-tabs-navigation-button-column-gap, var(--mg-b-size-8));cursor:pointer;font-family:var(--mg-b-font-family);font-weight:400;line-height:var(--mg-b-line-height);text-decoration:none;white-space:nowrap}.mg-c-tabs__navigation-button:disabled,.mg-c-tabs__navigation-button--disabled{cursor:default;opacity:var(--mg-b-opacity-element-disabled)}.mg-c-tabs__navigation-button:focus-visible{z-index:10}.mg-c-tabs__navigation-button:hover:not(.mg-c-tabs__navigation-button--disabled),.mg-c-tabs__navigation-button:focus-visible:not(.mg-c-tabs__navigation-button--disabled){background-color:color-mix(in srgb, var(--mg-c-tabs-color), transparent 90%)}.mg-c-tabs__navigation-button.mg-c-tabs__navigation-button--active{color:var(--mg-c-tabs-color);font-weight:600}.mg-c-tabs__navigation-button.mg-c-tabs__navigation-button--active.mg-c-tabs__navigation-button--horizontal{box-shadow:inset 0 calc(-1*var(--mg-b-size-4)) var(--mg-c-tabs-color)}.mg-c-tabs__navigation-button.mg-c-tabs__navigation-button--active.mg-c-tabs__navigation-button--vertical{box-shadow:inset var(--mg-b-size-4) 0 var(--mg-c-tabs-color)}.mg-c-tabs__navigation-button.mg-c-tabs__navigation-button--hidden{display:none}.mg-c-tabs__header{display:flex;flex-flow:row wrap;border-bottom:var(--mg-b-size-border) solid color-mix(in srgb, var(--mg-c-tabs-color), transparent 90%)}.mg-c-tabs__content-container:focus-visible{outline:none}.mg-c-tabs__navigation-button-text{flex:0 0 content}";
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* type TabItem validation function
|
|
25
|
-
* @param tab - tab item
|
|
26
|
-
* @returns tab item type is valid
|
|
27
|
-
*/
|
|
28
|
-
const isTabItem = (tab) => typeof tab === 'object' && typeof tab.label === 'string';
|
|
29
|
-
const MgTabs = /*@__PURE__*/ proxyCustomElement(class MgTabs extends HTMLElement {
|
|
30
|
-
constructor(registerHost) {
|
|
31
|
-
super();
|
|
32
|
-
if (registerHost !== false) {
|
|
33
|
-
this.__registerHost();
|
|
34
|
-
}
|
|
35
|
-
this.__attachShadow();
|
|
36
|
-
this.activeTabChange = createEvent(this, "active-tab-change", 7);
|
|
37
|
-
/************
|
|
38
|
-
* Internal *
|
|
39
|
-
************/
|
|
40
|
-
// classes
|
|
41
|
-
this.tabPanel = 'panel';
|
|
42
|
-
this.buttonTabBaseClass = 'mg-c-tabs__navigation-button';
|
|
43
|
-
this.startIndex = 1;
|
|
44
|
-
/**
|
|
45
|
-
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
46
|
-
* If not set, it will be created.
|
|
47
|
-
*/
|
|
48
|
-
this.identifier = createID('mg-tabs');
|
|
49
|
-
/**
|
|
50
|
-
* Define tabs size
|
|
51
|
-
*/
|
|
52
|
-
this.size = 'medium';
|
|
53
|
-
/**
|
|
54
|
-
* Component tabs
|
|
55
|
-
*/
|
|
56
|
-
this.tabs = [];
|
|
57
|
-
/**
|
|
58
|
-
* Component classes
|
|
59
|
-
*/
|
|
60
|
-
this.classCollection = new ClassList(['mg-c-tabs']);
|
|
61
|
-
/**
|
|
62
|
-
* Validate that new tab status can be `Status.ACTIVE`
|
|
63
|
-
* @param tab - tab item
|
|
64
|
-
* @returns true when tab match condition to get a `Status.ACTIVE`
|
|
65
|
-
*/
|
|
66
|
-
this.isActivableTab = (tab) => [undefined, Status.ACTIVE, Status.VISIBLE].includes(tab.status);
|
|
67
|
-
/**
|
|
68
|
-
* Method to know if given tab has the given status
|
|
69
|
-
* @param tab - item tab key to set to ACTIVE status
|
|
70
|
-
* @param status - status to valide
|
|
71
|
-
* @returns status comparaison
|
|
72
|
-
*/
|
|
73
|
-
this.tabHasStatus = (tab, status) => tab.status === status;
|
|
74
|
-
/**
|
|
75
|
-
* Method to get element id from index
|
|
76
|
-
* @param element - to get id
|
|
77
|
-
* @param index - to generate id
|
|
78
|
-
* @returns generated element id
|
|
79
|
-
*/
|
|
80
|
-
this.getElementId = (element, index) => `${element}-${this.getTabItemIndex(index)}`;
|
|
81
|
-
/**
|
|
82
|
-
* Method to get tab item index
|
|
83
|
-
* @param index - to get
|
|
84
|
-
* @returns index
|
|
85
|
-
*/
|
|
86
|
-
this.getTabItemIndex = (index) => index + this.startIndex;
|
|
87
|
-
/**
|
|
88
|
-
* Handle click events on tabs
|
|
89
|
-
* @param event - mouse event
|
|
90
|
-
*/
|
|
91
|
-
this.handleClick = (event) => {
|
|
92
|
-
const tabId = event.currentTarget.dataset.index;
|
|
93
|
-
if (!this.isActivableTab(this.tabs[Number(tabId) - this.startIndex])) {
|
|
94
|
-
event.preventDefault();
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
this.activeTab = Number(tabId);
|
|
98
|
-
this.tabFocus = undefined;
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
/**
|
|
102
|
-
* get navigation button class from given status
|
|
103
|
-
* @param status - button tab status
|
|
104
|
-
* @returns button class/selector variant
|
|
105
|
-
*/
|
|
106
|
-
this.getNavigationButtonClass = (status) => `${this.buttonTabBaseClass}--${status}`;
|
|
107
|
-
/**
|
|
108
|
-
* Handle keyboard event on tabs
|
|
109
|
-
* @param event - mouse event
|
|
110
|
-
*/
|
|
111
|
-
this.handleKeydown = (event) => {
|
|
112
|
-
const parent = event.target.parentElement;
|
|
113
|
-
if ([Keys.ARROWLEFT, Keys.ARROWRIGHT].includes(event.key)) {
|
|
114
|
-
this.tabFocus = Number(event.target.dataset.index);
|
|
115
|
-
parent.querySelector(`[data-index="${this.tabFocus}"]`).setAttribute('tabindex', '-1');
|
|
116
|
-
// Move right
|
|
117
|
-
if (event.key === Keys.ARROWRIGHT) {
|
|
118
|
-
this.tabFocus++;
|
|
119
|
-
// If we're at the end, go to the start
|
|
120
|
-
if (this.tabFocus > this.tabs.length)
|
|
121
|
-
this.tabFocus = this.startIndex;
|
|
122
|
-
// Move left
|
|
123
|
-
}
|
|
124
|
-
else if (event.key === Keys.ARROWLEFT) {
|
|
125
|
-
this.tabFocus--;
|
|
126
|
-
// If we're at the start, move to the end
|
|
127
|
-
if (this.tabFocus < this.startIndex)
|
|
128
|
-
this.tabFocus = this.tabs.length;
|
|
129
|
-
}
|
|
130
|
-
const parentButtonElement = parent.querySelector(`[data-index="${this.tabFocus}"]`);
|
|
131
|
-
// if focus item is ['hidden'] we recursively repeat action
|
|
132
|
-
if (this.tabHasStatus(this.tabs[this.tabFocus - 1], Status.HIDDEN)) {
|
|
133
|
-
parentButtonElement.dispatchEvent(new KeyboardEvent('keydown', { key: event.key, bubbles: true }));
|
|
134
|
-
// else run focus methods on tabFocus element
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
parentButtonElement.setAttribute('tabindex', '0');
|
|
138
|
-
parentButtonElement.focus();
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
else if (event.key === Keys.TAB) {
|
|
142
|
-
this.resetFocus();
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
/**
|
|
146
|
-
* Reset focus on document click
|
|
147
|
-
* @param event - mouse event
|
|
148
|
-
*/
|
|
149
|
-
this.handleDocumentClick = (event) => {
|
|
150
|
-
if (event.target.closest('mg-tabs') !== this.element)
|
|
151
|
-
this.resetFocus();
|
|
152
|
-
};
|
|
153
|
-
/**
|
|
154
|
-
* Method to reset focus behavior
|
|
155
|
-
*/
|
|
156
|
-
this.resetFocus = () => {
|
|
157
|
-
// update asynchronously tabindex to prevent get focus on new tabindex at then end of event process
|
|
158
|
-
nextTick(() => {
|
|
159
|
-
this.tabFocus = undefined;
|
|
160
|
-
Array.from(this.element.shadowRoot.querySelectorAll('[data-index]')).forEach((tab, index) => {
|
|
161
|
-
tab.setAttribute('tabindex', this.activeTab - this.startIndex !== index ? '-1' : '0');
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
};
|
|
165
|
-
/**
|
|
166
|
-
* Validate slots setting
|
|
167
|
-
*/
|
|
168
|
-
this.validateSlots = () => {
|
|
169
|
-
const slots = Array.from(this.element.children).filter(slot => { var _a; return (_a = slot.getAttribute('slot')) === null || _a === void 0 ? void 0 : _a.includes('tab_content-'); });
|
|
170
|
-
if (slots.length !== this.tabs.length)
|
|
171
|
-
throw new Error('<mg-tabs> Must have slots counts equal to tabs count.');
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
watchIdentifier(newValue) {
|
|
175
|
-
if (!isValideID(newValue)) {
|
|
176
|
-
console.error(`<mg-tabs> prop "identifier" value is invalid. Passed value: ${toString(newValue)}.`);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
validateLabel(newValue) {
|
|
180
|
-
if (!isValidString(newValue)) {
|
|
181
|
-
throw new Error(`<mg-tabs> prop "label" is required and must be a string. Passed value: ${toString(newValue)}.`);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
validateSize(newValue) {
|
|
185
|
-
if (!sizes.includes(newValue)) {
|
|
186
|
-
throw new Error(`<mg-tabs> prop "size" must be one of: ${sizes.join(', ')}. Passed value: ${toString(newValue)}.`);
|
|
187
|
-
}
|
|
188
|
-
this.classCollection.add(`mg-c-tabs--size-${this.size}`);
|
|
189
|
-
}
|
|
190
|
-
validateItems(newValue) {
|
|
191
|
-
// String array
|
|
192
|
-
if (allItemsAreString(newValue))
|
|
193
|
-
this.tabs = newValue.map(item => ({ label: item, status: Status.VISIBLE }));
|
|
194
|
-
// Object array
|
|
195
|
-
else if (Array.isArray(newValue) && newValue.length > 0 && newValue.every(isTabItem))
|
|
196
|
-
this.tabs = newValue;
|
|
197
|
-
else
|
|
198
|
-
throw new Error(`<mg-tabs> prop "items" is required and all items must be the same type: TabItem. Passed value: ${toString(newValue)}.`);
|
|
199
|
-
}
|
|
200
|
-
validateActiveTab(newValue) {
|
|
201
|
-
// when `active-tab` is undefined we set default value by searching an item with `Status.ACTIVE` or we use the `startIndex` has fallback value
|
|
202
|
-
// after setting new value to `active-tab` the validate will be triggered again with the updated value and process the tab update
|
|
203
|
-
if (newValue === undefined) {
|
|
204
|
-
this.activeTab = this.tabs.some(tab => this.tabHasStatus(tab, Status.ACTIVE))
|
|
205
|
-
? this.getTabItemIndex(this.tabs.findIndex(tab => this.tabHasStatus(tab, Status.ACTIVE)))
|
|
206
|
-
: this.startIndex;
|
|
207
|
-
}
|
|
208
|
-
else if (typeof newValue === 'number' && newValue >= this.startIndex && newValue <= this.tabs.length && this.isActivableTab(this.tabs[newValue - this.startIndex])) {
|
|
209
|
-
// if new 'active-tab' is activable we update tab status to ACTIVE and toggle past ACTIVE to VISIBLE
|
|
210
|
-
this.tabs.forEach((tab, index) => {
|
|
211
|
-
const isNewActiveTab = index === newValue - this.startIndex;
|
|
212
|
-
// reset active tabs
|
|
213
|
-
if (this.tabHasStatus(tab, Status.ACTIVE) && !isNewActiveTab)
|
|
214
|
-
tab.status = Status.VISIBLE;
|
|
215
|
-
// set active tab from given tab key
|
|
216
|
-
else if (this.isActivableTab(tab) && isNewActiveTab)
|
|
217
|
-
tab.status = Status.ACTIVE;
|
|
218
|
-
});
|
|
219
|
-
// emit change active tab key event
|
|
220
|
-
this.activeTabChange.emit(newValue);
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
throw new Error(`<mg-tabs> prop "activeTab" must be a number between ${this.startIndex} and ${this.tabs.length} and new value must be "activable". Passed value: ${toString(newValue)}.`);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
/*************
|
|
227
|
-
* Lifecycle *
|
|
228
|
-
*************/
|
|
229
|
-
/**
|
|
230
|
-
* Check if component props are well configured on init
|
|
231
|
-
*/
|
|
232
|
-
componentWillLoad() {
|
|
233
|
-
// Check tabs format
|
|
234
|
-
this.watchIdentifier(this.identifier);
|
|
235
|
-
this.validateLabel(this.label);
|
|
236
|
-
this.validateItems(this.items);
|
|
237
|
-
this.validateActiveTab(this.activeTab);
|
|
238
|
-
this.validateSize(this.size);
|
|
239
|
-
this.validateSlots();
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* add listners
|
|
243
|
-
*/
|
|
244
|
-
componentDidLoad() {
|
|
245
|
-
document.addEventListener('click', this.handleDocumentClick, false);
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* remove listeners
|
|
249
|
-
*/
|
|
250
|
-
disconnectedCallback() {
|
|
251
|
-
document.removeEventListener('keydown', this.handleDocumentClick);
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Render
|
|
255
|
-
* @returns HTML Element
|
|
256
|
-
*/
|
|
257
|
-
render() {
|
|
258
|
-
return (h("div", { key: 'ae71d21c9ce3acb07b3adf67bbe25f205d382abc', class: this.classCollection.join() }, h("header", { key: 'cf6cdae863602c956aa450a34e91a6d8b950d8f5', role: "tablist", "aria-label": this.label, class: "mg-c-tabs__header" }, this.tabs.map((tab, index) => (h("button", { key: tab.label, role: "tab", id: this.getElementId(this.identifier, index), class: {
|
|
259
|
-
[`${this.buttonTabBaseClass}`]: true,
|
|
260
|
-
[`${this.buttonTabBaseClass}--horizontal`]: true,
|
|
261
|
-
[`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.tabHasStatus(tab, Status.ACTIVE),
|
|
262
|
-
[`${this.getNavigationButtonClass(Status.DISABLED)}`]: this.tabHasStatus(tab, Status.DISABLED),
|
|
263
|
-
[`${this.getNavigationButtonClass(Status.HIDDEN)}`]: this.tabHasStatus(tab, Status.HIDDEN),
|
|
264
|
-
}, tabindex: this.tabHasStatus(tab, Status.ACTIVE) ? 0 : -1, "aria-selected": this.tabHasStatus(tab, Status.ACTIVE).toString(), "aria-controls": this.getElementId(this.tabPanel, index), "aria-disabled": this.tabHasStatus(tab, Status.DISABLED), onClick: this.handleClick, onKeyDown: this.handleKeydown, "data-index": this.getTabItemIndex(index) }, tab.icon !== undefined && h("mg-icon", { icon: tab.icon }), tab.label, tab.badge !== undefined && h("mg-badge", { variant: "text-color", value: tab.badge.value, label: tab.badge.label, outline: tab.badge.role === 'information' }))))), this.tabs.map((tab, index) => (h("article", { key: tab.label, role: "tabpanel", id: this.getElementId(this.tabPanel, index), hidden: !this.tabHasStatus(tab, Status.ACTIVE), "aria-labelledby": this.getElementId(this.identifier, index), tabindex: this.tabHasStatus(tab, Status.ACTIVE) ? 0 : -1, class: "mg-c-tabs__content-container" }, h("slot", { name: this.getElementId('tab_content', index) }))))));
|
|
265
|
-
}
|
|
266
|
-
get element() { return this; }
|
|
267
|
-
static get watchers() { return {
|
|
268
|
-
"identifier": ["watchIdentifier"],
|
|
269
|
-
"label": ["validateLabel"],
|
|
270
|
-
"size": ["validateSize"],
|
|
271
|
-
"items": ["validateItems"],
|
|
272
|
-
"activeTab": ["validateActiveTab"]
|
|
273
|
-
}; }
|
|
274
|
-
static get style() { return mgTabsCss; }
|
|
275
|
-
}, [257, "mg-tabs", {
|
|
276
|
-
"identifier": [1],
|
|
277
|
-
"label": [1],
|
|
278
|
-
"size": [1],
|
|
279
|
-
"items": [16],
|
|
280
|
-
"activeTab": [1538, "active-tab"],
|
|
281
|
-
"tabs": [32],
|
|
282
|
-
"classCollection": [32]
|
|
283
|
-
}, undefined, {
|
|
284
|
-
"identifier": ["watchIdentifier"],
|
|
285
|
-
"label": ["validateLabel"],
|
|
286
|
-
"size": ["validateSize"],
|
|
287
|
-
"items": ["validateItems"],
|
|
288
|
-
"activeTab": ["validateActiveTab"]
|
|
289
|
-
}]);
|
|
290
|
-
function defineCustomElement() {
|
|
291
|
-
if (typeof customElements === "undefined") {
|
|
292
|
-
return;
|
|
293
|
-
}
|
|
294
|
-
const components = ["mg-tabs", "mg-badge", "mg-icon"];
|
|
295
|
-
components.forEach(tagName => { switch (tagName) {
|
|
296
|
-
case "mg-tabs":
|
|
297
|
-
if (!customElements.get(tagName)) {
|
|
298
|
-
customElements.define(tagName, MgTabs);
|
|
299
|
-
}
|
|
300
|
-
break;
|
|
301
|
-
case "mg-badge":
|
|
302
|
-
if (!customElements.get(tagName)) {
|
|
303
|
-
defineCustomElement$2();
|
|
304
|
-
}
|
|
305
|
-
break;
|
|
306
|
-
case "mg-icon":
|
|
307
|
-
if (!customElements.get(tagName)) {
|
|
308
|
-
defineCustomElement$1();
|
|
309
|
-
}
|
|
310
|
-
break;
|
|
311
|
-
} });
|
|
312
|
-
}
|
|
313
|
-
defineCustomElement();
|
|
314
|
-
|
|
315
|
-
export { MgTabs as M, Status as S, defineCustomElement as d };
|
|
1
|
+
import{transformTag as t,proxyCustomElement as a,HTMLElement as i,createEvent as s,h as e}from"@stencil/core/internal/client";import{c as o,C as n,n as r,a as b,t as c,i as g,d as h}from"./index2.js";import{K as l}from"./events.utils.js";import{d as m}from"./mg-badge2.js";import{d}from"./mg-icon2.js";const v={VISIBLE:"visible",HIDDEN:"hidden",DISABLED:"disabled",ACTIVE:"active"},u=t=>"object"==typeof t&&"string"==typeof t.label,_=a(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.activeTabChange=s(this,"active-tab-change",7),this.tabPanel="panel",this.buttonTabBaseClass="mg-c-tabs__navigation-button",this.startIndex=1,this.identifier=o("mg-tabs"),this.tabs=[],this.classCollection=new n(["mg-c-tabs"]),this.isActivableTab=t=>[void 0,v.ACTIVE,v.VISIBLE].includes(t.status),this.tabHasStatus=(t,a)=>t.status===a,this.getElementId=(t,a)=>`${t}-${this.getTabItemIndex(a)}`,this.getTabItemIndex=t=>t+this.startIndex,this.handleClick=t=>{const a=t.currentTarget.dataset.index;this.isActivableTab(this.tabs[Number(a)-this.startIndex])?(this.activeTab=Number(a),this.tabFocus=void 0):t.preventDefault()},this.getNavigationButtonClass=t=>`${this.buttonTabBaseClass}--${t}`,this.handleKeydown=t=>{const a=t.target.parentElement;if([l.ARROWLEFT,l.ARROWRIGHT].includes(t.key)){this.tabFocus=Number(t.target.dataset.index),a.querySelector(`[data-index="${this.tabFocus}"]`).setAttribute("tabindex","-1"),t.key===l.ARROWRIGHT?(this.tabFocus++,this.tabFocus>this.tabs.length&&(this.tabFocus=this.startIndex)):t.key===l.ARROWLEFT&&(this.tabFocus--,this.tabFocus<this.startIndex&&(this.tabFocus=this.tabs.length));const i=a.querySelector(`[data-index="${this.tabFocus}"]`);this.tabHasStatus(this.tabs[this.tabFocus-1],v.HIDDEN)?i.dispatchEvent(new KeyboardEvent("keydown",{key:t.key,bubbles:!0})):(i.setAttribute("tabindex","0"),i.focus())}else t.key===l.TAB&&this.resetFocus()},this.handleDocumentClick=t=>{t.target.closest("mg-tabs")!==this.element&&this.resetFocus()},this.resetFocus=()=>{r((()=>{this.tabFocus=void 0,Array.from(this.element.shadowRoot.querySelectorAll("[data-index]")).forEach(((t,a)=>{t.setAttribute("tabindex",this.activeTab-this.startIndex!==a?"-1":"0")}))}))},this.validateSlots=()=>{if(Array.from(this.element.children).filter((t=>{var a;return null===(a=t.getAttribute("slot"))||void 0===a?void 0:a.includes("tab_content-")})).length!==this.tabs.length)throw new Error("<mg-tabs> Must have slots counts equal to tabs count.")}}watchIdentifier(t){b(t)||console.error(`<mg-tabs> prop "identifier" value is invalid. Passed value: ${c(t)}.`)}validateLabel(t){if(!g(t))throw new Error(`<mg-tabs> prop "label" is required and must be a string. Passed value: ${c(t)}.`)}validateItems(t){if(h(t))this.tabs=t.map((t=>({label:t,status:v.VISIBLE})));else{if(!(Array.isArray(t)&&t.length>0&&t.every(u)))throw new Error(`<mg-tabs> prop "items" is required and all items must be the same type: TabItem. Passed value: ${c(t)}.`);this.tabs=t}}validateActiveTab(t){if(void 0===t)this.activeTab=this.tabs.some((t=>this.tabHasStatus(t,v.ACTIVE)))?this.getTabItemIndex(this.tabs.findIndex((t=>this.tabHasStatus(t,v.ACTIVE)))):this.startIndex;else{if(!("number"==typeof t&&t>=this.startIndex&&t<=this.tabs.length&&this.isActivableTab(this.tabs[t-this.startIndex])))throw new Error(`<mg-tabs> prop "activeTab" must be a number between ${this.startIndex} and ${this.tabs.length} and new value must be "activable". Passed value: ${c(t)}.`);this.tabs.forEach(((a,i)=>{const s=i===t-this.startIndex;this.tabHasStatus(a,v.ACTIVE)&&!s?a.status=v.VISIBLE:this.isActivableTab(a)&&s&&(a.status=v.ACTIVE)})),this.activeTabChange.emit(t)}}componentWillLoad(){this.watchIdentifier(this.identifier),this.validateLabel(this.label),this.validateItems(this.items),this.validateActiveTab(this.activeTab),this.validateSlots()}componentDidLoad(){document.addEventListener("click",this.handleDocumentClick,!1)}disconnectedCallback(){document.removeEventListener("keydown",this.handleDocumentClick)}render(){return e("div",{key:"c971ca94267dd64a173740d9d7a81c0ea00852b9",class:this.classCollection.join()},e("header",{key:"d160fdca50842a310fe2b710f8ffcc6f7cd1bd3d",role:"tablist","aria-label":this.label,class:"mg-c-tabs__header"},this.tabs.map(((t,a)=>e("button",{key:t.label,role:"tab",id:this.getElementId(this.identifier,a),class:{[`${this.buttonTabBaseClass}`]:!0,[`${this.buttonTabBaseClass}--horizontal`]:!0,[`${this.getNavigationButtonClass(v.ACTIVE)}`]:this.tabHasStatus(t,v.ACTIVE),[`${this.getNavigationButtonClass(v.DISABLED)}`]:this.tabHasStatus(t,v.DISABLED),[`${this.getNavigationButtonClass(v.HIDDEN)}`]:this.tabHasStatus(t,v.HIDDEN)},tabindex:this.tabHasStatus(t,v.ACTIVE)?0:-1,"aria-selected":this.tabHasStatus(t,v.ACTIVE).toString(),"aria-controls":this.getElementId(this.tabPanel,a),"aria-disabled":this.tabHasStatus(t,v.DISABLED),onClick:this.handleClick,onKeyDown:this.handleKeydown,"data-index":this.getTabItemIndex(a)},void 0!==t.icon&&e("mg-icon",{icon:t.icon,size:"small"}),t.label,void 0!==t.badge&&e("mg-badge",{variant:"text-color",value:t.badge.value,label:t.badge.label,outline:"information"===t.badge.role}))))),this.tabs.map(((t,a)=>e("article",{key:t.label,role:"tabpanel",id:this.getElementId(this.tabPanel,a),hidden:!this.tabHasStatus(t,v.ACTIVE),"aria-labelledby":this.getElementId(this.identifier,a),tabindex:this.tabHasStatus(t,v.ACTIVE)?0:-1,class:"mg-c-tabs__content-container"},e("slot",{name:this.getElementId("tab_content",a)})))))}get element(){return this}static get watchers(){return{identifier:[{watchIdentifier:0}],label:[{validateLabel:0}],items:[{validateItems:0}],activeTab:[{validateActiveTab:0}]}}static get style(){return'.mg-c-tabs__navigation-button{position:relative;display:flex;height:calc(var(--mg-c-tabs-button-spacing-vertical)*2 + var(--mg-c-tabs-height));box-sizing:border-box;align-items:center;padding:var(--mg-c-tabs-button-spacing-vertical) calc(var(--mg-c-tabs-button-margin-horizontal) + var(--mg-c-tabs-button-padding-horizontal)) var(--mg-c-tabs-button-spacing-vertical) calc(var(--mg-c-tabs-button-margin-horizontal) + var(--mg-c-tabs-button-padding-horizontal));border:none;border-radius:var(--mg-b-size-8);background-color:unset;color:var(--mg-c-tabs-color-text, var(--mg-b-color-dark));column-gap:var(--mg-b-size-8);cursor:pointer;font-family:var(--mg-b-font-family);font-weight:400;line-height:var(--mg-b-line-height);text-decoration:none;white-space:nowrap}.mg-c-tabs__navigation-button::after{position:absolute;background-color:var(--mg-c-tabs-color);content:""}.mg-c-tabs__navigation-button:disabled,.mg-c-tabs__navigation-button--disabled{cursor:default;opacity:var(--mg-b-opacity-element-disabled)}.mg-c-tabs__navigation-button:hover,.mg-c-tabs__navigation-button:focus-visible{z-index:10}.mg-c-tabs__navigation-button:hover:not(.mg-c-tabs__navigation-button--disabled)::before,.mg-c-tabs__navigation-button:focus-visible:not(.mg-c-tabs__navigation-button--disabled)::before{position:absolute;z-index:-1;top:0;left:0;width:stretch;height:var(--mg-c-tabs-height);box-sizing:border-box;border-radius:var(--mg-b-size-8);margin-right:var(--mg-c-tabs-button-margin-horizontal);margin-left:var(--mg-c-tabs-button-margin-horizontal);background-color:color-mix(in srgb, var(--mg-c-tabs-color-text, var(--mg-b-color-dark)), transparent 90%);content:""}.mg-c-tabs__navigation-button,.mg-c-tabs__navigation-button ::slotted([slot=label]),.mg-c-tabs__navigation-button ::slotted([slot=metadata]){font-size:var(--mg-b-font-size)}.mg-c-tabs__navigation-button:not(.mg-c-tabs__navigation-button--disabled).mg-c-tabs__navigation-button--horizontal::before{margin:var(--mg-c-tabs-button-spacing-vertical) var(--mg-c-tabs-button-margin-horizontal)}.mg-c-tabs__navigation-button:not(.mg-c-tabs__navigation-button--disabled).mg-c-tabs__navigation-button--vertical::before{height:100%;margin:0 var(--mg-c-tabs-button-margin-horizontal)}.mg-c-tabs__navigation-button.mg-c-tabs__navigation-button--active{color:var(--mg-c-tabs-color);font-weight:600}.mg-c-tabs__navigation-button.mg-c-tabs__navigation-button--active.mg-c-tabs__navigation-button--horizontal::after{bottom:0;left:50%;width:calc(100% - var(--mg-b-size-12)*2);height:var(--mg-b-size-4);border-top-left-radius:var(--mg-b-size-8);border-top-right-radius:var(--mg-b-size-8);transform:translateX(-50%)}.mg-c-tabs__navigation-button.mg-c-tabs__navigation-button--active.mg-c-tabs__navigation-button--vertical::after{top:50%;left:0;width:var(--mg-b-size-4);height:calc(100% - var(--mg-b-size-8)*2);border-bottom-right-radius:var(--mg-b-size-8);border-top-right-radius:var(--mg-b-size-8);transform:translateY(-50%)}.mg-c-tabs__navigation-button.mg-c-tabs__navigation-button--hidden{display:none}.mg-c-tabs__header{display:flex;flex-flow:row wrap;border-bottom:var(--mg-b-size-border) solid var(--mg-b-color-neutral-30)}.mg-c-tabs__content-container:focus-visible{outline:none}.mg-c-tabs__navigation-button-text{flex:0 0 content}.mg-c-tabs__navigation-button.mg-c-tabs__navigation-button--horizontal{--mg-c-tabs-height:var(--mg-b-size-24);--mg-c-tabs-button-spacing-vertical:var(--mg-b-size-8);--mg-c-tabs-button-margin-horizontal:var(--mg-b-size-4);--mg-c-tabs-button-padding-horizontal:var(--mg-b-size-8)}'}},[257,"mg-tabs",{identifier:[1],label:[1],size:[16],items:[16],activeTab:[1538,"active-tab"],tabs:[32],classCollection:[32]},void 0,{identifier:[{watchIdentifier:0}],label:[{validateLabel:0}],items:[{validateItems:0}],activeTab:[{validateActiveTab:0}]}]);function f(){"undefined"!=typeof customElements&&["mg-tabs","mg-badge","mg-icon"].forEach((a=>{switch(a){case"mg-tabs":customElements.get(t(a))||customElements.define(t(a),_);break;case"mg-badge":customElements.get(t(a))||m();break;case"mg-icon":customElements.get(t(a))||d()}}))}f();export{_ as M,v as S,f as d}
|
|
@@ -1,133 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { C as ClassList, t as toString, i as isValidString } from './index2.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* List of all possibles variants
|
|
6
|
-
*/
|
|
7
|
-
const variants = ['primary', 'secondary', 'success', 'warning', 'danger', 'info'];
|
|
8
|
-
|
|
9
|
-
const mgTagCss = "/*!\n * @prop --mg-c-tag-height: Defines the height of the tag. Default value is `--mg-b-size-24`.\n * @prop --mg-c-tag-border-radius: Defines the border radius of the tag. Default value is `--mg-b-size-radius`.\n * @prop --mg-c-tag-font-size: Defines the font size of the tag. Default value is `--mg-b-font-size-small`.\n */:host{display:inline-block}.mg-c-tag{display:inline-flex;min-height:var(--mg-c-tag-height);box-sizing:border-box;align-items:center;padding:calc((var(--mg-c-tag-height) - 2*var(--mg-b-size-border) - var(--mg-c-tag-font-size)*var(--mg-b-line-height))/2) calc(var(--mg-b-size-8) - var(--mg-b-size-border));border:var(--mg-b-size-border) solid;border-radius:var(--mg-c-tag-border-radius);font-size:var(--mg-c-tag-font-size);font-weight:600;vertical-align:middle}.mg-c-tag.mg-c-tag--primary{border-color:var(--mg-b-color-neutral-110);background-color:var(--mg-b-color-neutral-110);color:var(--mg-b-color-text-on-primary)}.mg-c-tag.mg-c-tag--primary.mg-c-tag--outline{background-color:rgba(0,0,0,0);color:var(--mg-b-color-neutral-110)}.mg-c-tag.mg-c-tag--primary.mg-c-tag--soft{border-color:var(--mg-b-color-neutral-20);background-color:var(--mg-b-color-neutral-20);color:var(--mg-b-color-dark);font-weight:400}.mg-c-tag.mg-c-tag--primary.mg-c-tag--soft ::slotted(mg-icon){color:var(--mg-b-color-neutral-110)}.mg-c-tag.mg-c-tag--secondary{border-color:var(--mg-b-color-neutral-10);background-color:var(--mg-b-color-neutral-10);color:var(--mg-b-color-text-on-secondary)}.mg-c-tag.mg-c-tag--secondary.mg-c-tag--outline{background-color:rgba(0,0,0,0);color:var(--mg-b-color-neutral-10)}.mg-c-tag.mg-c-tag--secondary.mg-c-tag--soft{border-color:var(--mg-b-color-neutral-20);background-color:var(--mg-b-color-neutral-20);color:var(--mg-b-color-dark);font-weight:400}.mg-c-tag.mg-c-tag--secondary.mg-c-tag--soft ::slotted(mg-icon){color:var(--mg-b-color-text-on-secondary)}.mg-c-tag.mg-c-tag--danger{border-color:var(--mg-b-color-danger);background-color:var(--mg-b-color-danger);color:var(--mg-b-color-text-on-danger)}.mg-c-tag.mg-c-tag--danger.mg-c-tag--outline{background-color:rgba(0,0,0,0);color:var(--mg-b-color-danger)}.mg-c-tag.mg-c-tag--danger.mg-c-tag--soft{border-color:var(--mg-b-color-red-20);background-color:var(--mg-b-color-red-20);color:var(--mg-b-color-dark);font-weight:400}.mg-c-tag.mg-c-tag--danger.mg-c-tag--soft ::slotted(mg-icon){color:var(--mg-b-color-danger)}.mg-c-tag.mg-c-tag--info{border-color:var(--mg-b-color-info);background-color:var(--mg-b-color-info);color:var(--mg-b-color-text-on-info)}.mg-c-tag.mg-c-tag--info.mg-c-tag--outline{background-color:rgba(0,0,0,0);color:var(--mg-b-color-info)}.mg-c-tag.mg-c-tag--info.mg-c-tag--soft{border-color:var(--mg-b-color-blue-20);background-color:var(--mg-b-color-blue-20);color:var(--mg-b-color-dark);font-weight:400}.mg-c-tag.mg-c-tag--info.mg-c-tag--soft ::slotted(mg-icon){color:var(--mg-b-color-info)}.mg-c-tag.mg-c-tag--success{border-color:var(--mg-b-color-success);background-color:var(--mg-b-color-success);color:var(--mg-b-color-text-on-success)}.mg-c-tag.mg-c-tag--success.mg-c-tag--outline{background-color:rgba(0,0,0,0);color:var(--mg-b-color-success)}.mg-c-tag.mg-c-tag--success.mg-c-tag--soft{border-color:var(--mg-b-color-green-20);background-color:var(--mg-b-color-green-20);color:var(--mg-b-color-dark);font-weight:400}.mg-c-tag.mg-c-tag--success.mg-c-tag--soft ::slotted(mg-icon){color:var(--mg-b-color-success)}.mg-c-tag.mg-c-tag--warning{border-color:var(--mg-b-color-warning);background-color:var(--mg-b-color-warning);color:var(--mg-b-color-text-on-warning)}.mg-c-tag.mg-c-tag--warning.mg-c-tag--outline{background-color:rgba(0,0,0,0);color:var(--mg-b-color-warning)}.mg-c-tag.mg-c-tag--warning.mg-c-tag--soft{border-color:var(--mg-b-color-yellow-20);background-color:var(--mg-b-color-yellow-20);color:var(--mg-b-color-dark);font-weight:400}.mg-c-tag.mg-c-tag--warning.mg-c-tag--soft ::slotted(mg-icon){color:var(--mg-b-color-warning)}::slotted(mg-icon){align-self:start;margin-right:var(--mg-b-size-4)}::slotted(mg-icon[size=small]){margin-top:calc(var(--mg-b-line-height)*1rem - var(--mg-b-size-12))}slot{display:inline-flex;align-items:center}";
|
|
10
|
-
|
|
11
|
-
const MgTag$1 = /*@__PURE__*/ proxyCustomElement(class MgTag extends HTMLElement {
|
|
12
|
-
constructor(registerHost) {
|
|
13
|
-
super();
|
|
14
|
-
if (registerHost !== false) {
|
|
15
|
-
this.__registerHost();
|
|
16
|
-
}
|
|
17
|
-
this.__attachShadow();
|
|
18
|
-
/************
|
|
19
|
-
* Internal *
|
|
20
|
-
************/
|
|
21
|
-
// Classes
|
|
22
|
-
this.classOutline = 'mg-c-tag--outline';
|
|
23
|
-
this.classSoft = 'mg-c-tag--soft';
|
|
24
|
-
/**
|
|
25
|
-
* Define tag variant
|
|
26
|
-
*/
|
|
27
|
-
this.variant = 'primary';
|
|
28
|
-
/**
|
|
29
|
-
* Define if tag is using outline style
|
|
30
|
-
*/
|
|
31
|
-
this.outline = false;
|
|
32
|
-
/**
|
|
33
|
-
* Define if tag is using soft style
|
|
34
|
-
*/
|
|
35
|
-
this.soft = false;
|
|
36
|
-
/**
|
|
37
|
-
* Component classes
|
|
38
|
-
*/
|
|
39
|
-
this.classCollection = new ClassList(['mg-c-tag']);
|
|
40
|
-
}
|
|
41
|
-
validateVariant(newValue, oldValue) {
|
|
42
|
-
if (!variants.includes(newValue)) {
|
|
43
|
-
throw new Error(`<mg-tag> prop "variant" must be one of: ${variants.join(', ')}. Passed value: ${toString(newValue)}.`);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
if (oldValue !== undefined) {
|
|
47
|
-
this.classCollection.delete(`mg-c-tag--${oldValue}`);
|
|
48
|
-
}
|
|
49
|
-
this.classCollection.add(`mg-c-tag--${newValue}`);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
validateOutline(newValue) {
|
|
53
|
-
if (newValue)
|
|
54
|
-
this.classCollection.add(this.classOutline);
|
|
55
|
-
else
|
|
56
|
-
this.classCollection.delete(this.classOutline);
|
|
57
|
-
}
|
|
58
|
-
validateSoft(newValue) {
|
|
59
|
-
// usage validation
|
|
60
|
-
if (newValue && this.outline)
|
|
61
|
-
throw new Error('<mg-tag> prop "soft" can NOT be used with prop "outline".');
|
|
62
|
-
// apply class
|
|
63
|
-
if (newValue)
|
|
64
|
-
this.classCollection.add(this.classSoft);
|
|
65
|
-
else
|
|
66
|
-
this.classCollection.delete(this.classSoft);
|
|
67
|
-
}
|
|
68
|
-
/*************
|
|
69
|
-
* Methods *
|
|
70
|
-
*************/
|
|
71
|
-
/**
|
|
72
|
-
* Validate the given textContent
|
|
73
|
-
* @param textContent - html element textContent property
|
|
74
|
-
*/
|
|
75
|
-
validateTextContent(textContent) {
|
|
76
|
-
if (!isValidString(textContent))
|
|
77
|
-
throw new Error('<mg-tag> slot must contain a text content.');
|
|
78
|
-
}
|
|
79
|
-
/*************
|
|
80
|
-
* Lifecycle *
|
|
81
|
-
*************/
|
|
82
|
-
/**
|
|
83
|
-
* Check if props are well configured on init
|
|
84
|
-
*/
|
|
85
|
-
componentWillLoad() {
|
|
86
|
-
this.validateVariant(this.variant);
|
|
87
|
-
this.validateOutline(this.outline);
|
|
88
|
-
this.validateSoft(this.soft);
|
|
89
|
-
this.validateTextContent(this.element.textContent);
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Render
|
|
93
|
-
* @returns HTML Element
|
|
94
|
-
*/
|
|
95
|
-
render() {
|
|
96
|
-
return (h("span", { key: '8edd72c80d7179fdb5c1c37caeaecb54c086df8c', class: this.classCollection.join() }, h("slot", { key: 'e6bf4574a943f83856a6a61cba480d54ff153cb3' })));
|
|
97
|
-
}
|
|
98
|
-
get element() { return this; }
|
|
99
|
-
static get watchers() { return {
|
|
100
|
-
"variant": ["validateVariant"],
|
|
101
|
-
"outline": ["validateOutline"],
|
|
102
|
-
"soft": ["validateSoft"]
|
|
103
|
-
}; }
|
|
104
|
-
static get style() { return mgTagCss; }
|
|
105
|
-
}, [257, "mg-tag", {
|
|
106
|
-
"variant": [1],
|
|
107
|
-
"outline": [4],
|
|
108
|
-
"soft": [4],
|
|
109
|
-
"classCollection": [32]
|
|
110
|
-
}, undefined, {
|
|
111
|
-
"variant": ["validateVariant"],
|
|
112
|
-
"outline": ["validateOutline"],
|
|
113
|
-
"soft": ["validateSoft"]
|
|
114
|
-
}]);
|
|
115
|
-
function defineCustomElement$1() {
|
|
116
|
-
if (typeof customElements === "undefined") {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
const components = ["mg-tag"];
|
|
120
|
-
components.forEach(tagName => { switch (tagName) {
|
|
121
|
-
case "mg-tag":
|
|
122
|
-
if (!customElements.get(tagName)) {
|
|
123
|
-
customElements.define(tagName, MgTag$1);
|
|
124
|
-
}
|
|
125
|
-
break;
|
|
126
|
-
} });
|
|
127
|
-
}
|
|
128
|
-
defineCustomElement$1();
|
|
129
|
-
|
|
130
|
-
const MgTag = MgTag$1;
|
|
131
|
-
const defineCustomElement = defineCustomElement$1;
|
|
132
|
-
|
|
133
|
-
export { MgTag, defineCustomElement };
|
|
1
|
+
import{transformTag as o,proxyCustomElement as r,HTMLElement as g,h as a}from"@stencil/core/internal/client";import{C as t,t as c,i as e}from"./index2.js";const l=["primary","secondary","success","warning","danger","info"],n=r(class extends g{constructor(o){super(),!1!==o&&this.__registerHost(),this.__attachShadow(),this.classOutline="mg-c-tag--outline",this.classSoft="mg-c-tag--soft",this.variant="primary",this.outline=!1,this.soft=!1,this.classCollection=new t(["mg-c-tag"])}validateVariant(o,r){if(!l.includes(o))throw Error(`<mg-tag> prop "variant" must be one of: ${l.join(", ")}. Passed value: ${c(o)}.`);void 0!==r&&this.classCollection.delete("mg-c-tag--"+r),this.classCollection.add("mg-c-tag--"+o)}validateOutline(o){o?this.classCollection.add(this.classOutline):this.classCollection.delete(this.classOutline)}validateSoft(o){if(o&&this.outline)throw Error('<mg-tag> prop "soft" can NOT be used with prop "outline".');o?this.classCollection.add(this.classSoft):this.classCollection.delete(this.classSoft)}validateTextContent(o){if(!e(o))throw Error("<mg-tag> slot must contain a text content.")}componentWillLoad(){this.validateVariant(this.variant),this.validateOutline(this.outline),this.validateSoft(this.soft),this.validateTextContent(this.element.textContent)}render(){return a("span",{key:"3604851191691e002f8f7a701e37abe0059238e3",class:this.classCollection.join()},a("slot",{key:"c51e18e61908772878f380d1ae798e5e5f43ca02"}))}get element(){return this}static get watchers(){return{variant:[{validateVariant:0}],outline:[{validateOutline:0}],soft:[{validateSoft:0}]}}static get style(){return":host{display:inline-block}.mg-c-tag{display:inline-flex;min-height:var(--mg-c-tag-height);box-sizing:border-box;align-items:center;padding:calc((var(--mg-c-tag-height) - 2*var(--mg-b-size-border) - var(--mg-c-tag-font-size)*var(--mg-b-line-height))/2) calc(var(--mg-b-size-8) - var(--mg-b-size-border));border:var(--mg-b-size-border) solid;border-radius:var(--mg-c-tag-border-radius);font-size:var(--mg-c-tag-font-size);font-weight:600;vertical-align:middle}.mg-c-tag.mg-c-tag--primary{border-color:var(--mg-b-color-neutral-110);background-color:var(--mg-b-color-neutral-110);color:var(--mg-b-color-text-on-primary)}.mg-c-tag.mg-c-tag--primary.mg-c-tag--outline{background-color:rgba(0,0,0,0);color:var(--mg-b-color-neutral-110)}.mg-c-tag.mg-c-tag--primary.mg-c-tag--soft{border-color:var(--mg-b-color-neutral-20);background-color:var(--mg-b-color-neutral-20);color:var(--mg-b-color-dark);font-weight:400}.mg-c-tag.mg-c-tag--primary.mg-c-tag--soft ::slotted(mg-icon){color:var(--mg-b-color-neutral-110)}.mg-c-tag.mg-c-tag--secondary{border-color:var(--mg-b-color-neutral-10);background-color:var(--mg-b-color-neutral-10);color:var(--mg-b-color-text-on-secondary)}.mg-c-tag.mg-c-tag--secondary.mg-c-tag--outline{background-color:rgba(0,0,0,0);color:var(--mg-b-color-neutral-10)}.mg-c-tag.mg-c-tag--secondary.mg-c-tag--soft{border-color:var(--mg-b-color-neutral-20);background-color:var(--mg-b-color-neutral-20);color:var(--mg-b-color-dark);font-weight:400}.mg-c-tag.mg-c-tag--secondary.mg-c-tag--soft ::slotted(mg-icon){color:var(--mg-b-color-text-on-secondary)}.mg-c-tag.mg-c-tag--danger{border-color:var(--mg-b-color-danger);background-color:var(--mg-b-color-danger);color:var(--mg-b-color-text-on-danger)}.mg-c-tag.mg-c-tag--danger.mg-c-tag--outline{background-color:rgba(0,0,0,0);color:var(--mg-b-color-danger)}.mg-c-tag.mg-c-tag--danger.mg-c-tag--soft{border-color:var(--mg-b-color-red-20);background-color:var(--mg-b-color-red-20);color:var(--mg-b-color-dark);font-weight:400}.mg-c-tag.mg-c-tag--danger.mg-c-tag--soft ::slotted(mg-icon){color:var(--mg-b-color-danger)}.mg-c-tag.mg-c-tag--info{border-color:var(--mg-b-color-info);background-color:var(--mg-b-color-info);color:var(--mg-b-color-text-on-info)}.mg-c-tag.mg-c-tag--info.mg-c-tag--outline{background-color:rgba(0,0,0,0);color:var(--mg-b-color-info)}.mg-c-tag.mg-c-tag--info.mg-c-tag--soft{border-color:var(--mg-b-color-blue-20);background-color:var(--mg-b-color-blue-20);color:var(--mg-b-color-dark);font-weight:400}.mg-c-tag.mg-c-tag--info.mg-c-tag--soft ::slotted(mg-icon){color:var(--mg-b-color-info)}.mg-c-tag.mg-c-tag--success{border-color:var(--mg-b-color-success);background-color:var(--mg-b-color-success);color:var(--mg-b-color-text-on-success)}.mg-c-tag.mg-c-tag--success.mg-c-tag--outline{background-color:rgba(0,0,0,0);color:var(--mg-b-color-success)}.mg-c-tag.mg-c-tag--success.mg-c-tag--soft{border-color:var(--mg-b-color-green-20);background-color:var(--mg-b-color-green-20);color:var(--mg-b-color-dark);font-weight:400}.mg-c-tag.mg-c-tag--success.mg-c-tag--soft ::slotted(mg-icon){color:var(--mg-b-color-success)}.mg-c-tag.mg-c-tag--warning{border-color:var(--mg-b-color-warning);background-color:var(--mg-b-color-warning);color:var(--mg-b-color-text-on-warning)}.mg-c-tag.mg-c-tag--warning.mg-c-tag--outline{background-color:rgba(0,0,0,0);color:var(--mg-b-color-warning)}.mg-c-tag.mg-c-tag--warning.mg-c-tag--soft{border-color:var(--mg-b-color-yellow-20);background-color:var(--mg-b-color-yellow-20);color:var(--mg-b-color-dark);font-weight:400}.mg-c-tag.mg-c-tag--warning.mg-c-tag--soft ::slotted(mg-icon){color:var(--mg-b-color-warning)}::slotted(mg-icon){align-self:start;margin-right:var(--mg-b-size-4)}::slotted(mg-icon[size=small]){margin-top:calc(var(--mg-b-line-height)*1rem - var(--mg-b-size-12))}slot{display:inline-flex;align-items:center}"}},[257,"mg-tag",{variant:[1],outline:[4],soft:[4],classCollection:[32]},void 0,{variant:[{validateVariant:0}],outline:[{validateOutline:0}],soft:[{validateSoft:0}]}]);function m(){"undefined"!=typeof customElements&&["mg-tag"].forEach((r=>{"mg-tag"===r&&(customElements.get(o(r))||customElements.define(o(r),n))}))}m();const i=n,s=m;export{i as MgTag,s as defineCustomElement}
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const MgTooltipContent = MgTooltipContent$1;
|
|
4
|
-
const defineCustomElement = defineCustomElement$1;
|
|
5
|
-
|
|
6
|
-
export { MgTooltipContent, defineCustomElement };
|
|
1
|
+
import{M as o,d as t}from"./mg-tooltip-content2.js";const s=o,m=t;export{s as MgTooltipContent,m as defineCustomElement}
|
|
@@ -1,42 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const mgTooltipContentCss = ":host{z-index:1000;display:none;max-width:var(--mg-b-size-floating-element-max-width);box-sizing:border-box;padding:var(--mg-b-size-4) var(--mg-b-size-8);border-radius:var(--mg-c-tooltip-border-radius);background-color:var(--mg-c-tooltip-color-background);color:var(--mg-c-tooltip-color-text);font-family:var(--mg-b-font-family);font-size:var(--mg-b-font-size);font-weight:400;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:var(--mg-b-size-8);height:var(--mg-b-size-8);background-color:var(--mg-c-tooltip-color-background)}:host([data-popper-placement^=top])>::slotted([slot=arrow]){bottom:calc(-1*var(--mg-b-size-4))}:host([data-popper-placement^=bottom])>::slotted([slot=arrow]){top:calc(-1*var(--mg-b-size-4))}:host([data-popper-placement^=left])>::slotted([slot=arrow]){right:calc(-1*var(--mg-b-size-4))}:host([data-popper-placement^=right])>::slotted([slot=arrow]){left:calc(-1*var(--mg-b-size-4))}";
|
|
4
|
-
|
|
5
|
-
const MgTooltipContent = /*@__PURE__*/ proxyCustomElement(class MgTooltipContent extends HTMLElement {
|
|
6
|
-
constructor(registerHost) {
|
|
7
|
-
super();
|
|
8
|
-
if (registerHost !== false) {
|
|
9
|
-
this.__registerHost();
|
|
10
|
-
}
|
|
11
|
-
this.__attachShadow();
|
|
12
|
-
}
|
|
13
|
-
/*************
|
|
14
|
-
* Lifecycle *
|
|
15
|
-
*************/
|
|
16
|
-
/**
|
|
17
|
-
* Render
|
|
18
|
-
* @returns HTML Element
|
|
19
|
-
*/
|
|
20
|
-
render() {
|
|
21
|
-
return (h(Host, { key: '2221de3ca0ef7c9d6e46e24b19c69007fababf81', role: "tooltip" }, h("span", { key: '9e14f7f5b3f5e5060ed9f42e8d7259b17575168e', innerHTML: this.message, class: "mg-tooltip-content__message" }), h("slot", { key: 'bc083567d77e8f4ffccee98b96036ba8ac494fb6', name: "arrow" })));
|
|
22
|
-
}
|
|
23
|
-
static get style() { return mgTooltipContentCss; }
|
|
24
|
-
}, [257, "mg-tooltip-content", {
|
|
25
|
-
"message": [1]
|
|
26
|
-
}]);
|
|
27
|
-
function defineCustomElement() {
|
|
28
|
-
if (typeof customElements === "undefined") {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const components = ["mg-tooltip-content"];
|
|
32
|
-
components.forEach(tagName => { switch (tagName) {
|
|
33
|
-
case "mg-tooltip-content":
|
|
34
|
-
if (!customElements.get(tagName)) {
|
|
35
|
-
customElements.define(tagName, MgTooltipContent);
|
|
36
|
-
}
|
|
37
|
-
break;
|
|
38
|
-
} });
|
|
39
|
-
}
|
|
40
|
-
defineCustomElement();
|
|
41
|
-
|
|
42
|
-
export { MgTooltipContent as M, defineCustomElement as d };
|
|
1
|
+
import{transformTag as t,proxyCustomElement as o,HTMLElement as e,h as a,Host as r}from"@stencil/core/internal/client";const s=o(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow()}render(){return a(r,{key:"efe7a2b2622713929caf9a2e114e7a1267643f5e",role:"tooltip"},a("span",{key:"00f0066cfa058e55a88533f8b6daaa8ab283b29c",innerHTML:this.message,class:"mg-tooltip-content__message"}),a("slot",{key:"fd952c4db7b77b54591bf2c58012096579de45c2",name:"arrow"}))}static get style(){return':host{z-index:1000;display:none;max-width:var(--mg-b-size-floating-element-max-width);box-sizing:border-box;padding:var(--mg-b-size-4) var(--mg-b-size-8);border-radius:var(--mg-c-tooltip-border-radius);background-color:var(--mg-c-tooltip-color-background);color:var(--mg-c-tooltip-color-text);font-family:var(--mg-b-font-family);font-size:var(--mg-b-font-size);font-weight:400;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:var(--mg-b-size-8);height:var(--mg-b-size-8);background-color:var(--mg-c-tooltip-color-background)}:host([data-popper-placement^=top])>::slotted([slot=arrow]){bottom:calc(-1*var(--mg-b-size-4))}:host([data-popper-placement^=bottom])>::slotted([slot=arrow]){top:calc(-1*var(--mg-b-size-4))}:host([data-popper-placement^=left])>::slotted([slot=arrow]){right:calc(-1*var(--mg-b-size-4))}:host([data-popper-placement^=right])>::slotted([slot=arrow]){left:calc(-1*var(--mg-b-size-4))}'}},[257,"mg-tooltip-content",{message:[1]}]);function i(){"undefined"!=typeof customElements&&["mg-tooltip-content"].forEach((o=>{"mg-tooltip-content"===o&&(customElements.get(t(o))||customElements.define(t(o),s))}))}i();export{s as M,i as d}
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const MgTooltip = MgTooltip$1;
|
|
4
|
-
const defineCustomElement = defineCustomElement$1;
|
|
5
|
-
|
|
6
|
-
export { MgTooltip, defineCustomElement };
|
|
1
|
+
import{M as o,d as t}from"./mg-tooltip2.js";const s=o,m=t;export{s as MgTooltip,m as defineCustomElement}
|