@mgdis/mg-components 3.1.0 → 4.0.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-85a4a0b6.js → index-88560a66.js} +123 -48
- package/dist/cjs/index-a39c5567.js +233 -0
- package/dist/cjs/loader.cjs.js +3 -17
- package/dist/cjs/mg-badge_21.cjs.entry.js +3538 -0
- package/dist/cjs/mg-components.cjs.js +3 -7
- package/dist/cjs/mg-modal.cjs.entry.js +117 -0
- package/dist/cjs/mg-popover.cjs.entry.js +170 -0
- package/dist/cjs/popper-71bf3058.js +1790 -0
- package/dist/collection/collection-manifest.json +4 -1
- package/dist/collection/components/atoms/mg-badge/{mg-badge.stories.js → doc/mg-badge.stories.js} +4 -1
- package/dist/collection/components/atoms/mg-badge/mg-badge.conf.js +1 -1
- package/dist/collection/components/atoms/mg-badge/mg-badge.css +0 -2
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +26 -10
- package/dist/collection/components/atoms/mg-button/{mg-button.stories.js → doc/mg-button.stories.js} +7 -2
- package/dist/collection/components/atoms/mg-button/mg-button.conf.js +1 -1
- package/dist/collection/components/atoms/mg-button/mg-button.css +46 -49
- package/dist/collection/components/atoms/mg-button/mg-button.js +78 -4
- package/dist/collection/components/atoms/mg-character-left/{mg-character-left.stories.js → doc/mg-character-left.stories.js} +8 -0
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +20 -46
- package/dist/collection/components/atoms/mg-icon/{mg-icon.stories.js → doc/mg-icon.stories.js} +1 -1
- package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +104 -9
- package/dist/collection/components/atoms/mg-icon/mg-icon.css +9 -7
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +33 -7
- package/dist/collection/components/atoms/mg-input-title/{mg-input-title.stories.js → doc/mg-input-title.stories.js} +0 -0
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.css +4 -4
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +14 -3
- package/dist/collection/components/atoms/mg-tag/{mg-tag.stories.js → doc/mg-tag.stories.js} +4 -1
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +28 -6
- package/dist/collection/components/atoms/mg-tooltip/{mg-tooltip.stories.js → doc/mg-tooltip.stories.js} +14 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +20 -0
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +16 -2
- package/dist/collection/components/molecules/inputs/MgInput.conf.js +1 -7
- package/dist/collection/components/molecules/inputs/MgInput.js +25 -29
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/{mg-input-checkbox.stories.js → doc/mg-input-checkbox.stories.js} +6 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +25 -11
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +102 -52
- package/dist/collection/components/molecules/inputs/mg-input-date/{mg-input-date.stories.js → doc/mg-input-date.stories.js} +6 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +37 -9
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +136 -66
- package/dist/collection/components/molecules/inputs/mg-input-numeric/{mg-input-numeric.stories.js → doc/mg-input-numeric.stories.js} +15 -3
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +38 -10
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +180 -80
- package/dist/collection/components/molecules/inputs/mg-input-password/{mg-input-password.stories.js → doc/mg-input-password.stories.js} +16 -2
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +37 -9
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +108 -47
- package/dist/collection/components/molecules/inputs/mg-input-radio/{mg-input-radio.stories.js → doc/mg-input-radio.stories.js} +6 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +25 -11
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +113 -42
- package/dist/collection/components/molecules/inputs/mg-input-select/{mg-input-select.stories.js → doc/mg-input-select.stories.js} +22 -2
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +39 -10
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +145 -71
- package/dist/collection/components/molecules/inputs/mg-input-text/{mg-input-text.stories.js → doc/mg-input-text.stories.js} +17 -8
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +69 -19
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +184 -83
- package/dist/collection/components/molecules/inputs/mg-input-textarea/{mg-input-textarea.stories.js → doc/mg-input-textarea.stories.js} +16 -5
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +69 -13
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +163 -70
- package/dist/collection/components/molecules/inputs/mg-input-toggle/{mg-input-toggle.stories.js → doc/mg-input-toggle.stories.js} +6 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +22 -10
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +68 -33
- package/dist/collection/components/molecules/mg-form/doc/mg-form.stories.js +58 -0
- package/dist/collection/components/molecules/mg-form/mg-form.css +19 -0
- package/dist/collection/components/molecules/mg-form/mg-form.js +271 -0
- package/dist/collection/components/molecules/mg-message/{mg-message.stories.js → doc/mg-message.stories.js} +6 -2
- package/dist/collection/components/molecules/mg-message/mg-message.css +1 -1
- package/dist/collection/components/molecules/mg-message/mg-message.js +26 -11
- package/dist/collection/components/molecules/mg-modal/doc/mg-modal.stories.js +51 -0
- package/dist/collection/components/molecules/mg-modal/mg-modal.css +52 -0
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +240 -0
- package/dist/collection/components/molecules/mg-pagination/{mg-pagination.stories.js → doc/mg-pagination.stories.js} +1 -0
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +47 -28
- package/dist/collection/components/molecules/mg-panel/doc/mg-panel.stories.js +39 -0
- package/dist/collection/components/molecules/mg-panel/mg-panel.css +53 -0
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +356 -0
- package/dist/collection/components/molecules/mg-popover/{mg-popover.stories.js → doc/mg-popover.stories.js} +10 -0
- package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js +20 -0
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +2 -2
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +37 -12
- package/dist/collection/components/molecules/mg-tabs/{mg-tabs.stories.js → doc/mg-tabs.stories.js} +20 -4
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +11 -1
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +17 -3
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +139 -26
- package/dist/collection/locales/index.js +33 -4
- package/dist/collection/stories/helpers.stories.js +33 -0
- package/dist/collection/utils/components.utils.js +16 -9
- package/dist/collection/utils/locale.utils.js +13 -7
- package/dist/collection/utils/test.utils.js +27 -15
- package/dist/collection/variables.css +39 -5
- package/dist/collection/variables.scss +39 -5
- package/dist/components/MgInput.js +26 -37
- package/dist/components/components.utils.js +16 -9
- package/dist/components/index.d.ts +24 -6
- package/dist/components/index.js +23 -0
- package/dist/components/index2.js +116 -17
- package/dist/components/locale.utils.js +13 -8
- package/dist/components/mg-badge2.js +25 -9
- package/dist/components/mg-button2.js +29 -5
- package/dist/components/mg-character-left2.js +14 -26
- package/dist/components/mg-form.d.ts +11 -0
- package/dist/components/mg-form.js +148 -0
- package/dist/components/mg-icon2.js +138 -17
- package/dist/components/mg-input-checkbox.js +66 -53
- package/dist/components/mg-input-date.js +100 -69
- package/dist/components/mg-input-numeric.js +125 -81
- package/dist/components/mg-input-password.js +69 -48
- package/dist/components/mg-input-radio.js +74 -46
- package/dist/components/mg-input-select2.js +103 -71
- package/dist/components/mg-input-text.js +1 -237
- package/dist/components/mg-input-text2.js +300 -0
- package/dist/components/mg-input-textarea.js +100 -46
- package/dist/components/mg-input-title2.js +13 -4
- package/dist/components/mg-input-toggle.js +39 -31
- package/dist/components/mg-message.js +25 -10
- package/dist/components/mg-modal.d.ts +11 -0
- package/dist/components/mg-modal.js +153 -0
- package/dist/components/mg-pagination.js +45 -31
- package/dist/components/mg-panel.d.ts +11 -0
- package/dist/components/mg-panel.js +244 -0
- package/dist/components/mg-popover.js +31 -11
- package/dist/components/mg-tabs.js +113 -23
- package/dist/components/mg-tag.js +27 -5
- package/dist/components/mg-tooltip2.js +10 -1
- package/dist/components/popper.js +6 -2
- package/dist/esm/{index-e3e84606.js → index-bca81100.js} +124 -46
- package/dist/esm/index-e51ae032.js +228 -0
- package/dist/esm/loader.js +3 -17
- package/dist/esm/mg-badge_21.entry.js +3514 -0
- package/dist/esm/mg-components.js +3 -7
- package/dist/esm/mg-modal.entry.js +113 -0
- package/dist/esm/mg-popover.entry.js +166 -0
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/popper-93ecb064.js +1788 -0
- 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-003a1344.entry.js +1 -0
- package/dist/mg-components/p-462d648a.entry.js +1 -0
- package/dist/mg-components/p-4c66f794.js +1 -0
- package/dist/mg-components/p-5126ab10.entry.js +1 -0
- package/dist/mg-components/p-780bd52d.js +1 -0
- package/dist/mg-components/p-b14a3443.js +2 -0
- package/dist/mg-components/variables.css +39 -5
- package/dist/mg-components/variables.scss +39 -5
- package/dist/types/components/atoms/mg-badge/{mg-badge.stories.d.ts → doc/mg-badge.stories.d.ts} +5 -0
- package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +16 -5
- package/dist/types/components/atoms/mg-button/{mg-button.stories.d.ts → doc/mg-button.stories.d.ts} +5 -0
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +23 -3
- package/dist/types/components/atoms/mg-character-left/{mg-character-left.stories.d.ts → doc/mg-character-left.stories.d.ts} +9 -0
- package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +16 -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.conf.d.ts +1 -1
- package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +14 -4
- 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-input-title/mg-input-title.d.ts +11 -1
- package/dist/types/components/atoms/mg-tag/{mg-tag.stories.d.ts → doc/mg-tag.stories.d.ts} +5 -0
- package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +18 -4
- package/dist/types/components/atoms/mg-tooltip/doc/mg-tooltip.stories.d.ts +29 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +8 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +13 -3
- package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +6 -4
- package/dist/types/components/molecules/inputs/MgInput.d.ts +7 -8
- package/dist/types/components/molecules/inputs/mg-input-checkbox/{mg-input-checkbox.stories.d.ts → doc/mg-input-checkbox.stories.d.ts} +5 -0
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +36 -13
- package/dist/types/components/molecules/inputs/mg-input-date/{mg-input-date.stories.d.ts → doc/mg-input-date.stories.d.ts} +5 -0
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +46 -15
- package/dist/types/components/molecules/inputs/mg-input-numeric/{mg-input-numeric.stories.d.ts → doc/mg-input-numeric.stories.d.ts} +11 -0
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +61 -16
- package/dist/types/components/molecules/inputs/mg-input-password/doc/mg-input-password.stories.d.ts +22 -0
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +35 -11
- package/dist/types/components/molecules/inputs/mg-input-radio/{mg-input-radio.stories.d.ts → doc/mg-input-radio.stories.d.ts} +5 -0
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.conf.d.ts +1 -1
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +42 -9
- package/dist/types/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.d.ts +34 -0
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.conf.d.ts +1 -1
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +37 -9
- package/dist/types/components/molecules/inputs/mg-input-text/{mg-input-text.stories.d.ts → doc/mg-input-text.stories.d.ts} +13 -0
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +52 -16
- package/dist/types/components/molecules/inputs/mg-input-textarea/doc/mg-input-textarea.stories.d.ts +19 -0
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +45 -17
- package/dist/types/components/molecules/inputs/mg-input-toggle/{mg-input-toggle.stories.d.ts → doc/mg-input-toggle.stories.d.ts} +5 -0
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.d.ts +1 -1
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +29 -12
- package/dist/types/components/molecules/{mg-popover/mg-popover.stories.d.ts → mg-form/doc/mg-form.stories.d.ts} +3 -4
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +83 -0
- package/dist/types/components/molecules/mg-message/{mg-message.stories.d.ts → doc/mg-message.stories.d.ts} +10 -0
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +13 -4
- package/dist/types/components/molecules/mg-modal/doc/mg-modal.stories.d.ts +13 -0
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +85 -0
- package/dist/types/components/molecules/mg-pagination/{mg-pagination.stories.d.ts → doc/mg-pagination.stories.d.ts} +5 -0
- package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +31 -7
- package/dist/types/components/molecules/mg-panel/doc/mg-panel.stories.d.ts +11 -0
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +139 -0
- package/dist/types/components/molecules/mg-popover/doc/mg-popover.stories.d.ts +25 -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 +27 -4
- package/dist/types/components/molecules/mg-tabs/doc/mg-tabs.stories.d.ts +20 -0
- package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +11 -0
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +70 -6
- package/dist/types/components.d.ts +528 -211
- package/dist/types/locales/index.d.ts +108 -38
- package/dist/types/stories/{buttons.stories.d.ts → helpers.stories.d.ts} +1 -1
- package/dist/types/utils/components.utils.d.ts +16 -9
- package/dist/types/utils/locale.utils.d.ts +13 -6
- package/dist/types/utils/test.utils.d.ts +13 -1
- package/loader/index.js +1 -1
- package/package.json +45 -14
- package/readme.md +9 -35
- package/dist/cjs/css-shim-a22512c4.js +0 -6
- package/dist/cjs/mg-badge_20.cjs.entry.js +0 -4661
- package/dist/cjs/shadow-css-8940f82d.js +0 -390
- 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-7c240feb.js +0 -4
- package/dist/esm/mg-badge_20.entry.js +0 -4638
- package/dist/esm/shadow-css-5d2d01ce.js +0 -388
- package/dist/esm-es5/css-shim-7c240feb.js +0 -1
- package/dist/esm-es5/index-e3e84606.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_20.entry.js +0 -2
- package/dist/esm-es5/mg-components.js +0 -1
- package/dist/esm-es5/shadow-css-5d2d01ce.js +0 -12
- package/dist/mg-components/mg-components.js +0 -132
- package/dist/mg-components/p-1cd24462.system.js +0 -1
- package/dist/mg-components/p-2e2f6b27.system.entry.js +0 -2
- package/dist/mg-components/p-366a224e.js +0 -1
- package/dist/mg-components/p-422c429b.system.js +0 -1
- package/dist/mg-components/p-50ea2036.system.js +0 -1
- package/dist/mg-components/p-62fa3797.js +0 -1
- package/dist/mg-components/p-71d57b8b.system.js +0 -13
- package/dist/mg-components/p-9a215712.system.js +0 -1
- package/dist/mg-components/p-cbf0464b.entry.js +0 -1
- package/dist/mg-components/p-f6455ab3.js +0 -12
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.stories.d.ts +0 -11
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.stories.d.ts +0 -9
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.stories.d.ts +0 -14
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.stories.d.ts +0 -6
- package/dist/types/components/molecules/mg-tabs/mg-tabs.stories.d.ts +0 -7
- package/dist/types/stories/messages.stories.d.ts +0 -13
- package/dist/types/stories/tags.stories.d.ts +0 -5
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
.mg-panel {
|
|
2
|
+
background-color: hsl(var(--mg-panel-background));
|
|
3
|
+
border-radius: var(--mg-panel-border-radius);
|
|
4
|
+
box-shadow: var(--box-shadow);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.mg-panel__header {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-wrap: wrap;
|
|
10
|
+
justify-content: space-between;
|
|
11
|
+
padding: 0 1rem 0 0.3rem;
|
|
12
|
+
align-items: flex-start;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.mg-panel__header-left,
|
|
16
|
+
.mg-panel__header-right {
|
|
17
|
+
display: flex;
|
|
18
|
+
margin: 0.3rem 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.mg-panel__header-left--full {
|
|
22
|
+
flex: 1 1 auto;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.mg-panel__header-right {
|
|
26
|
+
flex: 1 auto;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.mg-panel__header-left mg-input-text {
|
|
30
|
+
flex-grow: 1;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.mg-panel__collapse-button .mg-button {
|
|
34
|
+
font-family: var(--font-family-heading);
|
|
35
|
+
font-size: 1.4rem;
|
|
36
|
+
font-weight: 500;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.mg-panel__collapse-button,
|
|
40
|
+
.mg-panel__edit-button {
|
|
41
|
+
margin: 0 0.3rem 0 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.mg-panel__content {
|
|
45
|
+
padding: 1.5rem;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.mg-panel ::slotted([slot=header-right]) {
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-wrap: wrap;
|
|
51
|
+
gap: 1rem;
|
|
52
|
+
margin-left: auto;
|
|
53
|
+
}
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { Component, Element, h, Prop, State, Watch, Event } from '@stencil/core';
|
|
2
|
+
import { createID, ClassList } from '../../../utils/components.utils';
|
|
3
|
+
import { initLocales } from '../../../locales';
|
|
4
|
+
export class MgPanel {
|
|
5
|
+
constructor() {
|
|
6
|
+
/**
|
|
7
|
+
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
8
|
+
* If not set, it will be created.
|
|
9
|
+
*/
|
|
10
|
+
this.identifier = createID('mg-panel');
|
|
11
|
+
/**
|
|
12
|
+
* Panel is opened
|
|
13
|
+
*/
|
|
14
|
+
this.expanded = false;
|
|
15
|
+
/**
|
|
16
|
+
* Disable possibility to toggle expand
|
|
17
|
+
*/
|
|
18
|
+
this.expandToggleDisabled = false;
|
|
19
|
+
/**
|
|
20
|
+
* Panel title is editabled
|
|
21
|
+
*/
|
|
22
|
+
this.titleEditable = false;
|
|
23
|
+
/**
|
|
24
|
+
* Component classes
|
|
25
|
+
*/
|
|
26
|
+
this.classList = new ClassList(['mg-panel']);
|
|
27
|
+
/**
|
|
28
|
+
* Title is in edition mode
|
|
29
|
+
*/
|
|
30
|
+
this.isEditing = false;
|
|
31
|
+
/************
|
|
32
|
+
* Methods *
|
|
33
|
+
************/
|
|
34
|
+
/**
|
|
35
|
+
* Toggle is editing state
|
|
36
|
+
*
|
|
37
|
+
* @returns {void}
|
|
38
|
+
*/
|
|
39
|
+
this.toggleIsEditing = () => {
|
|
40
|
+
this.isEditing = !this.isEditing;
|
|
41
|
+
};
|
|
42
|
+
/************
|
|
43
|
+
* Handlers *
|
|
44
|
+
************/
|
|
45
|
+
/**
|
|
46
|
+
* Collapse button click handler
|
|
47
|
+
*
|
|
48
|
+
* @returns {void}
|
|
49
|
+
*/
|
|
50
|
+
this.handleCollapseButton = () => {
|
|
51
|
+
if (!this.expandToggleDisabled) {
|
|
52
|
+
this.expanded = !this.expanded;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Edit button click handler
|
|
57
|
+
*
|
|
58
|
+
* @returns {void}
|
|
59
|
+
*/
|
|
60
|
+
this.handleEditButton = () => {
|
|
61
|
+
this.toggleIsEditing();
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Update title handler
|
|
65
|
+
*
|
|
66
|
+
* @param {CustomEvent<string>} event input value change event
|
|
67
|
+
* @returns {void}
|
|
68
|
+
*/
|
|
69
|
+
this.handleUpdateTitle = (event) => {
|
|
70
|
+
this.updatedPanelTitle = event.detail;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Cancel edition button handler
|
|
74
|
+
*
|
|
75
|
+
* @returns {void}
|
|
76
|
+
*/
|
|
77
|
+
this.handleCancelEditButton = () => {
|
|
78
|
+
this.updatedPanelTitle = undefined;
|
|
79
|
+
this.toggleIsEditing();
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Validate edition button handler
|
|
83
|
+
*
|
|
84
|
+
* @returns {void}
|
|
85
|
+
*/
|
|
86
|
+
this.handleValidateEditButton = () => {
|
|
87
|
+
if (this.editInputElement.valid) {
|
|
88
|
+
if (this.updatedPanelTitle !== undefined)
|
|
89
|
+
this.panelTitle = this.updatedPanelTitle;
|
|
90
|
+
this.toggleIsEditing();
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Header left conditional render
|
|
95
|
+
*
|
|
96
|
+
* @typedef {HTMLElement} HTMLMgButtonElement
|
|
97
|
+
* @returns {HTMLMgButtonElement | HTMLElement | HTMLElement[]} header left element
|
|
98
|
+
*/
|
|
99
|
+
this.headerLeft = () => {
|
|
100
|
+
const collapseButton = () => (h("mg-button", { onClick: this.handleCollapseButton, variant: "flat", class: "mg-panel__collapse-button", identifier: `${this.identifier}-collapse-button`, expanded: this.expanded, controls: `${this.identifier}-content`, disabled: this.expandToggleDisabled },
|
|
101
|
+
h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down' }),
|
|
102
|
+
!this.isEditing && this.panelTitle));
|
|
103
|
+
if (this.titleEditable && !this.isEditing) {
|
|
104
|
+
return [
|
|
105
|
+
collapseButton(),
|
|
106
|
+
h("mg-button", { "is-icon": true, variant: "flat", class: "mg-panel__edit-button", label: this.messages.panel.editLabel, onClick: this.handleEditButton, identifier: `${this.identifier}-edit-button` },
|
|
107
|
+
h("mg-icon", { icon: "pen" })),
|
|
108
|
+
];
|
|
109
|
+
}
|
|
110
|
+
if (this.titleEditable && this.isEditing) {
|
|
111
|
+
return [
|
|
112
|
+
collapseButton(),
|
|
113
|
+
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) },
|
|
114
|
+
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` },
|
|
115
|
+
h("mg-icon", { icon: "cross" })),
|
|
116
|
+
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` },
|
|
117
|
+
h("mg-icon", { icon: "check" }))),
|
|
118
|
+
];
|
|
119
|
+
}
|
|
120
|
+
return collapseButton();
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
handelTileChange(newValue) {
|
|
124
|
+
this.titleChange.emit(newValue);
|
|
125
|
+
}
|
|
126
|
+
validatetitlePattern(newValue) {
|
|
127
|
+
if (newValue && !this.titleEditable) {
|
|
128
|
+
throw new Error('<mg-panel> prop "titleEditable" must be set to `true`.');
|
|
129
|
+
}
|
|
130
|
+
if (newValue && this.titlePatternErrorMessage === undefined) {
|
|
131
|
+
throw new Error('<mg-panel> prop "titlePattern" must be paired with the prop "titlePatternErrorMessage".');
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
handleExpanded(newValue) {
|
|
135
|
+
this.expandedChange.emit(newValue);
|
|
136
|
+
}
|
|
137
|
+
/*************
|
|
138
|
+
* Lifecycle *
|
|
139
|
+
*************/
|
|
140
|
+
/**
|
|
141
|
+
* Check if props are well configured on init
|
|
142
|
+
*
|
|
143
|
+
* @returns {void}
|
|
144
|
+
*/
|
|
145
|
+
componentWillLoad() {
|
|
146
|
+
// Get locales
|
|
147
|
+
this.messages = initLocales(this.element).messages;
|
|
148
|
+
// Validate
|
|
149
|
+
this.validatetitlePattern(this.titlePattern);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Edit DOM after render
|
|
153
|
+
*
|
|
154
|
+
* @returns {void}
|
|
155
|
+
*/
|
|
156
|
+
componentDidRender() {
|
|
157
|
+
// when we are editing we get focus on edition input
|
|
158
|
+
if (this.isEditing) {
|
|
159
|
+
this.editInputElement.setFocus();
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Render component
|
|
164
|
+
*
|
|
165
|
+
* @returns {HTMLElement} html element
|
|
166
|
+
*/
|
|
167
|
+
render() {
|
|
168
|
+
return (h("section", { class: this.classList.join(), id: this.identifier },
|
|
169
|
+
h("header", { class: "mg-panel__header", id: `${this.identifier}-header` },
|
|
170
|
+
h("div", { class: `mg-panel__header-left ${this.isEditing ? 'mg-panel__header-left--full' : ''}` }, this.headerLeft()),
|
|
171
|
+
h("div", { class: "mg-panel__header-right" },
|
|
172
|
+
h("slot", { name: "header-right" }))),
|
|
173
|
+
h("article", { class: "mg-panel__content", id: `${this.identifier}-content`, "aria-labelledby": `${this.identifier}-header`, hidden: !this.expanded },
|
|
174
|
+
h("slot", null))));
|
|
175
|
+
}
|
|
176
|
+
static get is() { return "mg-panel"; }
|
|
177
|
+
static get encapsulation() { return "shadow"; }
|
|
178
|
+
static get originalStyleUrls() { return {
|
|
179
|
+
"$": ["mg-panel.scss"]
|
|
180
|
+
}; }
|
|
181
|
+
static get styleUrls() { return {
|
|
182
|
+
"$": ["mg-panel.css"]
|
|
183
|
+
}; }
|
|
184
|
+
static get properties() { return {
|
|
185
|
+
"identifier": {
|
|
186
|
+
"type": "string",
|
|
187
|
+
"mutable": false,
|
|
188
|
+
"complexType": {
|
|
189
|
+
"original": "string",
|
|
190
|
+
"resolved": "string",
|
|
191
|
+
"references": {}
|
|
192
|
+
},
|
|
193
|
+
"required": false,
|
|
194
|
+
"optional": false,
|
|
195
|
+
"docs": {
|
|
196
|
+
"tags": [],
|
|
197
|
+
"text": "Identifier is used for the element ID (id is a reserved prop in Stencil.js)\nIf not set, it will be created."
|
|
198
|
+
},
|
|
199
|
+
"attribute": "identifier",
|
|
200
|
+
"reflect": false,
|
|
201
|
+
"defaultValue": "createID('mg-panel')"
|
|
202
|
+
},
|
|
203
|
+
"panelTitle": {
|
|
204
|
+
"type": "string",
|
|
205
|
+
"mutable": true,
|
|
206
|
+
"complexType": {
|
|
207
|
+
"original": "string",
|
|
208
|
+
"resolved": "string",
|
|
209
|
+
"references": {}
|
|
210
|
+
},
|
|
211
|
+
"required": true,
|
|
212
|
+
"optional": false,
|
|
213
|
+
"docs": {
|
|
214
|
+
"tags": [],
|
|
215
|
+
"text": "Panel title"
|
|
216
|
+
},
|
|
217
|
+
"attribute": "panel-title",
|
|
218
|
+
"reflect": false
|
|
219
|
+
},
|
|
220
|
+
"titlePattern": {
|
|
221
|
+
"type": "string",
|
|
222
|
+
"mutable": true,
|
|
223
|
+
"complexType": {
|
|
224
|
+
"original": "string",
|
|
225
|
+
"resolved": "string",
|
|
226
|
+
"references": {}
|
|
227
|
+
},
|
|
228
|
+
"required": false,
|
|
229
|
+
"optional": false,
|
|
230
|
+
"docs": {
|
|
231
|
+
"tags": [],
|
|
232
|
+
"text": "Panel title pattern"
|
|
233
|
+
},
|
|
234
|
+
"attribute": "title-pattern",
|
|
235
|
+
"reflect": false
|
|
236
|
+
},
|
|
237
|
+
"titlePatternErrorMessage": {
|
|
238
|
+
"type": "string",
|
|
239
|
+
"mutable": true,
|
|
240
|
+
"complexType": {
|
|
241
|
+
"original": "string",
|
|
242
|
+
"resolved": "string",
|
|
243
|
+
"references": {}
|
|
244
|
+
},
|
|
245
|
+
"required": false,
|
|
246
|
+
"optional": false,
|
|
247
|
+
"docs": {
|
|
248
|
+
"tags": [],
|
|
249
|
+
"text": "Panel title pattern error message"
|
|
250
|
+
},
|
|
251
|
+
"attribute": "title-pattern-error-message",
|
|
252
|
+
"reflect": false
|
|
253
|
+
},
|
|
254
|
+
"expanded": {
|
|
255
|
+
"type": "boolean",
|
|
256
|
+
"mutable": true,
|
|
257
|
+
"complexType": {
|
|
258
|
+
"original": "boolean",
|
|
259
|
+
"resolved": "boolean",
|
|
260
|
+
"references": {}
|
|
261
|
+
},
|
|
262
|
+
"required": false,
|
|
263
|
+
"optional": false,
|
|
264
|
+
"docs": {
|
|
265
|
+
"tags": [],
|
|
266
|
+
"text": "Panel is opened"
|
|
267
|
+
},
|
|
268
|
+
"attribute": "expanded",
|
|
269
|
+
"reflect": false,
|
|
270
|
+
"defaultValue": "false"
|
|
271
|
+
},
|
|
272
|
+
"expandToggleDisabled": {
|
|
273
|
+
"type": "boolean",
|
|
274
|
+
"mutable": true,
|
|
275
|
+
"complexType": {
|
|
276
|
+
"original": "boolean",
|
|
277
|
+
"resolved": "boolean",
|
|
278
|
+
"references": {}
|
|
279
|
+
},
|
|
280
|
+
"required": false,
|
|
281
|
+
"optional": false,
|
|
282
|
+
"docs": {
|
|
283
|
+
"tags": [],
|
|
284
|
+
"text": "Disable possibility to toggle expand"
|
|
285
|
+
},
|
|
286
|
+
"attribute": "expand-toggle-disabled",
|
|
287
|
+
"reflect": false,
|
|
288
|
+
"defaultValue": "false"
|
|
289
|
+
},
|
|
290
|
+
"titleEditable": {
|
|
291
|
+
"type": "boolean",
|
|
292
|
+
"mutable": false,
|
|
293
|
+
"complexType": {
|
|
294
|
+
"original": "boolean",
|
|
295
|
+
"resolved": "boolean",
|
|
296
|
+
"references": {}
|
|
297
|
+
},
|
|
298
|
+
"required": false,
|
|
299
|
+
"optional": false,
|
|
300
|
+
"docs": {
|
|
301
|
+
"tags": [],
|
|
302
|
+
"text": "Panel title is editabled"
|
|
303
|
+
},
|
|
304
|
+
"attribute": "title-editable",
|
|
305
|
+
"reflect": false,
|
|
306
|
+
"defaultValue": "false"
|
|
307
|
+
}
|
|
308
|
+
}; }
|
|
309
|
+
static get states() { return {
|
|
310
|
+
"classList": {},
|
|
311
|
+
"isEditing": {},
|
|
312
|
+
"updatedPanelTitle": {}
|
|
313
|
+
}; }
|
|
314
|
+
static get events() { return [{
|
|
315
|
+
"method": "titleChange",
|
|
316
|
+
"name": "title-change",
|
|
317
|
+
"bubbles": true,
|
|
318
|
+
"cancelable": true,
|
|
319
|
+
"composed": true,
|
|
320
|
+
"docs": {
|
|
321
|
+
"tags": [],
|
|
322
|
+
"text": "Emmited event when title change"
|
|
323
|
+
},
|
|
324
|
+
"complexType": {
|
|
325
|
+
"original": "string",
|
|
326
|
+
"resolved": "string",
|
|
327
|
+
"references": {}
|
|
328
|
+
}
|
|
329
|
+
}, {
|
|
330
|
+
"method": "expandedChange",
|
|
331
|
+
"name": "expanded-change",
|
|
332
|
+
"bubbles": true,
|
|
333
|
+
"cancelable": true,
|
|
334
|
+
"composed": true,
|
|
335
|
+
"docs": {
|
|
336
|
+
"tags": [],
|
|
337
|
+
"text": "Emmited event when expanded change"
|
|
338
|
+
},
|
|
339
|
+
"complexType": {
|
|
340
|
+
"original": "boolean",
|
|
341
|
+
"resolved": "boolean",
|
|
342
|
+
"references": {}
|
|
343
|
+
}
|
|
344
|
+
}]; }
|
|
345
|
+
static get elementRef() { return "element"; }
|
|
346
|
+
static get watchers() { return [{
|
|
347
|
+
"propName": "panelTitle",
|
|
348
|
+
"methodName": "handelTileChange"
|
|
349
|
+
}, {
|
|
350
|
+
"propName": "titlePattern",
|
|
351
|
+
"methodName": "validatetitlePattern"
|
|
352
|
+
}, {
|
|
353
|
+
"propName": "expanded",
|
|
354
|
+
"methodName": "handleExpanded"
|
|
355
|
+
}]; }
|
|
356
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
|
+
import { placements } from '../mg-popover.conf';
|
|
2
3
|
export default {
|
|
3
4
|
component: 'mg-popover',
|
|
4
5
|
title: 'Molecules/mg-popover',
|
|
@@ -6,6 +7,15 @@ export default {
|
|
|
6
7
|
layout: 'centered',
|
|
7
8
|
docs: { iframeHeight: 600 },
|
|
8
9
|
},
|
|
10
|
+
argTypes: {
|
|
11
|
+
placement: {
|
|
12
|
+
options: placements,
|
|
13
|
+
control: { type: 'select' },
|
|
14
|
+
table: {
|
|
15
|
+
defaultValue: { summary: placements[0] },
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
9
19
|
};
|
|
10
20
|
/**
|
|
11
21
|
* 1. camelCase arguments must be written in the template, for exemple labelOnTop must be placed in the template as label-on-top={args.labelOnTop}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List of all possibles placements
|
|
3
|
+
*/
|
|
4
|
+
export const placements = [
|
|
5
|
+
'auto',
|
|
6
|
+
'auto-start',
|
|
7
|
+
'auto-end',
|
|
8
|
+
'top',
|
|
9
|
+
'top-start',
|
|
10
|
+
'top-end',
|
|
11
|
+
'bottom',
|
|
12
|
+
'bottom-start',
|
|
13
|
+
'bottom-end',
|
|
14
|
+
'right',
|
|
15
|
+
'right-start',
|
|
16
|
+
'right-end',
|
|
17
|
+
'left',
|
|
18
|
+
'left-start',
|
|
19
|
+
'left-end',
|
|
20
|
+
];
|
|
@@ -11,7 +11,7 @@ mg-popover::slotted(*) {
|
|
|
11
11
|
z-index: 9999;
|
|
12
12
|
border-radius: 0.5rem;
|
|
13
13
|
background-color: hsl(var(--mg-popover-background-color));
|
|
14
|
-
box-shadow:
|
|
14
|
+
box-shadow: var(--box-shadow);
|
|
15
15
|
color: hsl(var(--mg-popover-font-color));
|
|
16
16
|
}
|
|
17
17
|
.mg-popover[data-show] {
|
|
@@ -28,7 +28,7 @@ mg-popover::slotted(*) {
|
|
|
28
28
|
position: absolute;
|
|
29
29
|
width: 2rem;
|
|
30
30
|
height: 2rem;
|
|
31
|
-
z-index:
|
|
31
|
+
z-index: -1;
|
|
32
32
|
background: inherit;
|
|
33
33
|
}
|
|
34
34
|
.mg-popover .mg-popover__arrow {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Component, Element, Host, h, Prop, Watch } from '@stencil/core';
|
|
2
2
|
import { createID } from '../../../utils/components.utils';
|
|
3
3
|
import { createPopper } from '@popperjs/core';
|
|
4
|
-
import {
|
|
4
|
+
import { initLocales } from '../../../locales';
|
|
5
5
|
export class MgPopover {
|
|
6
6
|
constructor() {
|
|
7
7
|
this.closeButtonId = '';
|
|
@@ -28,18 +28,19 @@ export class MgPopover {
|
|
|
28
28
|
this.disabled = false;
|
|
29
29
|
/**
|
|
30
30
|
* Check if clicked outside of component
|
|
31
|
-
*
|
|
31
|
+
*
|
|
32
|
+
* @param {MouseEvent} event mouse event
|
|
33
|
+
* @returns {void}
|
|
32
34
|
*/
|
|
33
|
-
|
|
34
|
-
/* istanbul ignore next */
|
|
35
|
-
this.clickOutside = e => {
|
|
35
|
+
this.clickOutside = (event) => {
|
|
36
36
|
var _a;
|
|
37
|
-
if (!this.disabled && ((_a =
|
|
37
|
+
if (!this.disabled && ((_a = event.target.closest(`#${this.identifier}`)) === null || _a === void 0 ? void 0 : _a.parentElement.nodeName) !== 'MG-POPOVER') {
|
|
38
38
|
this.display = false;
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
/**
|
|
42
42
|
* Show popover
|
|
43
|
+
*
|
|
43
44
|
* @returns {void}
|
|
44
45
|
*/
|
|
45
46
|
this.show = () => {
|
|
@@ -52,13 +53,12 @@ export class MgPopover {
|
|
|
52
53
|
// hide when click outside
|
|
53
54
|
// setTimeout is used to prevent event to trigger after creation
|
|
54
55
|
setTimeout(() => {
|
|
55
|
-
// Unable to trigger document events in unit tests: https://gitlab.mgdis.fr/core/core-ui/mg-components/-/issues/57
|
|
56
|
-
/* istanbul ignore next */
|
|
57
56
|
document.addEventListener('click', this.clickOutside, false);
|
|
58
57
|
}, 0);
|
|
59
58
|
};
|
|
60
59
|
/**
|
|
61
60
|
* Hide popover
|
|
61
|
+
*
|
|
62
62
|
* @returns {void}
|
|
63
63
|
*/
|
|
64
64
|
this.hide = () => {
|
|
@@ -66,11 +66,12 @@ export class MgPopover {
|
|
|
66
66
|
this.popover.removeAttribute('data-show');
|
|
67
67
|
// Disable the event listeners
|
|
68
68
|
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }] })));
|
|
69
|
-
// Remove
|
|
69
|
+
// Remove event listener
|
|
70
70
|
document.removeEventListener('click', this.clickOutside, false);
|
|
71
71
|
};
|
|
72
72
|
/**
|
|
73
73
|
* Handle action for close button
|
|
74
|
+
*
|
|
74
75
|
* @returns {void}
|
|
75
76
|
*/
|
|
76
77
|
this.handleCloseButton = () => {
|
|
@@ -88,6 +89,20 @@ export class MgPopover {
|
|
|
88
89
|
/*************
|
|
89
90
|
* Lifecycle *
|
|
90
91
|
*************/
|
|
92
|
+
/**
|
|
93
|
+
* Check if component props are well configured on init
|
|
94
|
+
*
|
|
95
|
+
* @returns {void} timeout
|
|
96
|
+
*/
|
|
97
|
+
componentWillLoad() {
|
|
98
|
+
// Get locales
|
|
99
|
+
this.messages = initLocales(this.element).messages;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Check if component props are well configured on init
|
|
103
|
+
*
|
|
104
|
+
* @returns {void}
|
|
105
|
+
*/
|
|
91
106
|
componentDidLoad() {
|
|
92
107
|
//Check if slotted title is a heading
|
|
93
108
|
const headingElements = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
@@ -130,11 +145,16 @@ export class MgPopover {
|
|
|
130
145
|
});
|
|
131
146
|
this.handleDisplay(this.display);
|
|
132
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* Render
|
|
150
|
+
*
|
|
151
|
+
* @returns {HTMLElement} HTML Element
|
|
152
|
+
*/
|
|
133
153
|
render() {
|
|
134
154
|
return (h(Host, null,
|
|
135
155
|
h("slot", null),
|
|
136
156
|
h("div", { id: this.identifier, class: "mg-popover" },
|
|
137
|
-
!this.disabled && this.closeButton && (h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: messages.
|
|
157
|
+
!this.disabled && this.closeButton && (h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton },
|
|
138
158
|
h("mg-icon", { icon: "cross" }))),
|
|
139
159
|
h("div", { class: "mg-popover__title" },
|
|
140
160
|
h("slot", { name: "title" })),
|
|
@@ -172,9 +192,14 @@ export class MgPopover {
|
|
|
172
192
|
"type": "string",
|
|
173
193
|
"mutable": false,
|
|
174
194
|
"complexType": {
|
|
175
|
-
"original": "
|
|
195
|
+
"original": "Placement",
|
|
176
196
|
"resolved": "\"auto\" | \"auto-end\" | \"auto-start\" | \"bottom\" | \"bottom-end\" | \"bottom-start\" | \"left\" | \"left-end\" | \"left-start\" | \"right\" | \"right-end\" | \"right-start\" | \"top\" | \"top-end\" | \"top-start\"",
|
|
177
|
-
"references": {
|
|
197
|
+
"references": {
|
|
198
|
+
"Placement": {
|
|
199
|
+
"location": "import",
|
|
200
|
+
"path": "./mg-popover.conf"
|
|
201
|
+
}
|
|
202
|
+
}
|
|
178
203
|
},
|
|
179
204
|
"required": false,
|
|
180
205
|
"optional": false,
|
package/dist/collection/components/molecules/mg-tabs/{mg-tabs.stories.js → doc/mg-tabs.stories.js}
RENAMED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
|
+
import { sizes, Status } from '../mg-tabs.conf';
|
|
2
3
|
export default {
|
|
3
4
|
component: 'mg-tabs',
|
|
4
5
|
title: 'Molecules/mg-tabs',
|
|
6
|
+
argTypes: {
|
|
7
|
+
size: {
|
|
8
|
+
options: sizes,
|
|
9
|
+
control: { type: 'select' },
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
parameters: { actions: { handles: ['active-tab-change'] } },
|
|
5
13
|
};
|
|
6
14
|
/**
|
|
7
15
|
* 1. camelCase arguments must be written in the template, for exemple labelOnTop must be placed in the template as label-on-top={args.labelOnTop}
|
|
@@ -14,16 +22,18 @@ const Template = args => {
|
|
|
14
22
|
return (h("mg-tabs", Object.assign({}, args, { "active-tab": activeTab }),
|
|
15
23
|
h("div", { slot: "tab_content-1" }, "Content 1"),
|
|
16
24
|
h("div", { slot: "tab_content-2" }, "Content 2"),
|
|
17
|
-
h("div", { slot: "tab_content-3" }, "Content 3")
|
|
25
|
+
h("div", { slot: "tab_content-3" }, "Content 3"),
|
|
26
|
+
h("div", { slot: "tab_content-4" }, "Content 4")));
|
|
18
27
|
};
|
|
19
28
|
export const MgTabs = Template.bind({});
|
|
20
29
|
MgTabs.args = {
|
|
21
|
-
items: ['Tab 1', 'Tab 2', 'Tab 3'],
|
|
22
|
-
label: 'Short tabs description.
|
|
30
|
+
items: ['Tab 1', 'Tab 2', 'Tab 3', 'Tab 4'],
|
|
31
|
+
label: 'Short tabs description. Needed for accessibility',
|
|
23
32
|
activeTab: undefined,
|
|
33
|
+
size: sizes[0], // regular
|
|
24
34
|
};
|
|
25
35
|
export const MgTabsItems = Template.bind({});
|
|
26
|
-
MgTabsItems.args = Object.assign(Object.assign({}, MgTabs.args), { items: [
|
|
36
|
+
MgTabsItems.args = Object.assign(Object.assign({}, MgTabs.args), { activeTab: 3, items: [
|
|
27
37
|
{
|
|
28
38
|
label: 'Tab 1',
|
|
29
39
|
icon: 'check',
|
|
@@ -32,9 +42,15 @@ MgTabsItems.args = Object.assign(Object.assign({}, MgTabs.args), { items: [
|
|
|
32
42
|
{
|
|
33
43
|
label: 'Tab 2',
|
|
34
44
|
badge: { value: 5, label: 'messages' },
|
|
45
|
+
status: Status.DISABLED,
|
|
35
46
|
},
|
|
36
47
|
{
|
|
37
48
|
label: 'Tab 3',
|
|
38
49
|
icon: 'cross',
|
|
39
50
|
},
|
|
51
|
+
{
|
|
52
|
+
label: 'Tab 4',
|
|
53
|
+
icon: 'trash',
|
|
54
|
+
status: Status.HIDDEN,
|
|
55
|
+
},
|
|
40
56
|
] });
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
export
|
|
1
|
+
export var Status;
|
|
2
|
+
(function (Status) {
|
|
3
|
+
Status["VISIBLE"] = "visible";
|
|
4
|
+
Status["HIDDEN"] = "hidden";
|
|
5
|
+
Status["DISABLED"] = "disabled";
|
|
6
|
+
Status["ACTIVE"] = "active";
|
|
7
|
+
})(Status || (Status = {}));
|
|
8
|
+
/**
|
|
9
|
+
* List of all possibles sizes
|
|
10
|
+
*/
|
|
11
|
+
export const sizes = ['regular', 'large'];
|