@mgdis/mg-components 4.2.0 → 5.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-64cee0c8.js → index-94497267.js} +220 -202
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{mg-badge_23.cjs.entry.js → mg-badge_24.cjs.entry.js} +2028 -26
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/cjs/mg-modal.cjs.entry.js +6 -2
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/atoms/mg-button/doc/mg-button.stories.js +0 -2
- package/dist/collection/components/atoms/mg-button/mg-button.css +106 -68
- package/dist/collection/components/atoms/mg-button/mg-button.js +51 -64
- package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +3 -0
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +3 -3
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +1 -1
- package/dist/collection/components/molecules/mg-form/mg-form.js +2 -3
- package/dist/collection/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.js +2 -1
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.css +15 -7
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +27 -2
- package/dist/collection/components/molecules/mg-modal/doc/mg-modal.stories.js +1 -1
- package/dist/collection/components/molecules/mg-modal/mg-modal.css +2 -2
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +4 -0
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +4 -3
- package/dist/collection/components/molecules/mg-panel/doc/mg-panel.stories.js +1 -1
- package/dist/collection/components/molecules/mg-panel/mg-panel.css +8 -7
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +5 -7
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +7 -8
- package/dist/collection/variables.css +6 -0
- package/dist/components/mg-button2.js +44 -13
- package/dist/components/mg-form.js +2 -3
- package/dist/components/mg-icon2.js +3 -0
- package/dist/components/mg-illustrated-message.js +12 -4
- package/dist/components/mg-input-numeric.js +1 -1
- package/dist/components/mg-modal.js +5 -1
- package/dist/components/mg-pagination.js +4 -3
- package/dist/components/mg-panel.js +2 -2
- package/dist/components/mg-popover.js +9 -9
- package/dist/components/mg-tooltip2.js +5 -4
- package/dist/components/popper.js +60 -49
- package/dist/esm/{index-120f47fd.js → index-aad0184c.js} +220 -202
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{mg-badge_23.entry.js → mg-badge_24.entry.js} +2027 -26
- package/dist/esm/mg-components.js +3 -3
- package/dist/esm/mg-modal.entry.js +6 -2
- package/dist/esm/polyfills/css-shim.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-3899d5d2.js +2 -0
- package/dist/mg-components/p-b60a4c53.entry.js +1 -0
- package/dist/mg-components/p-df947fa5.entry.js +1 -0
- package/dist/mg-components/variables.css +6 -0
- package/dist/types/components/atoms/mg-button/doc/mg-button.stories.d.ts +2 -2
- package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +5 -1
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +19 -17
- package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +4 -0
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +1 -0
- package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +1 -0
- package/dist/types/components.d.ts +13 -29
- package/dist/types/stencil-public-runtime.d.ts +15 -4
- package/package.json +2 -2
- package/dist/cjs/mg-popover.cjs.entry.js +0 -171
- package/dist/cjs/popper-71bf3058.js +0 -1790
- package/dist/collection/variables.scss +0 -212
- package/dist/esm/mg-popover.entry.js +0 -167
- package/dist/esm/popper-93ecb064.js +0 -1788
- package/dist/mg-components/p-21991be8.entry.js +0 -1
- package/dist/mg-components/p-36a64f8c.entry.js +0 -1
- package/dist/mg-components/p-4c66f794.js +0 -1
- package/dist/mg-components/p-7bc32a2f.js +0 -2
- package/dist/mg-components/p-b380a0df.entry.js +0 -1
- package/dist/mg-components/variables.scss +0 -212
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
3
|
+
const index = require('./index-94497267.js');
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
|
-
Stencil Client Patch Browser v2.18.
|
|
6
|
+
Stencil Client Patch Browser v2.18.1 | MIT Licensed | https://stenciljs.com
|
|
7
7
|
*/
|
|
8
8
|
const patchBrowser = () => {
|
|
9
9
|
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('mg-components.cjs.js', document.baseURI).href));
|
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["mg-
|
|
18
|
+
return index.bootstrapLazy([["mg-badge_24.cjs",[[1,"mg-panel",{"identifier":[1],"panelTitle":[1025,"panel-title"],"titlePattern":[1025,"title-pattern"],"titlePatternErrorMessage":[1025,"title-pattern-error-message"],"expanded":[1028],"expandToggleDisabled":[1028,"expand-toggle-disabled"],"titleEditable":[4,"title-editable"],"classList":[32],"isEditing":[32],"updatedPanelTitle":[32]}],[1,"mg-pagination",{"identifier":[1],"label":[1025],"totalPages":[2,"total-pages"],"currentPage":[1538,"current-page"]}],[1,"mg-input-textarea",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"maxlength":[2],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"pattern":[1],"patternErrorMessage":[1,"pattern-error-message"],"rows":[2],"tooltip":[1],"displayCharacterLeft":[4,"display-character-left"],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"resizable":[1],"classList":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-checkbox",{"value":[1040],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"inputVerticalList":[4,"input-vertical-list"],"required":[4],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"checkboxItems":[32],"displayError":[64]}],[1,"mg-input-date",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"required":[4],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"min":[1],"max":[1],"classList":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-numeric",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"tooltip":[1],"helpText":[1,"help-text"],"type":[1],"currency":[1],"max":[2],"min":[2],"integerLength":[2,"integer-length"],"decimalLength":[2,"decimal-length"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"hasFocus":[32],"displayError":[64]}],[1,"mg-input-password",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-radio",{"value":[1032],"items":[16],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"inputVerticalList":[4,"input-vertical-list"],"required":[4],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"options":[32],"displayError":[64]}],[1,"mg-input-toggle",{"value":[1032],"items":[16],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"isOnOff":[4,"is-on-off"],"isIcon":[4,"is-icon"],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"classList":[32],"options":[32],"checked":[32]}],[1,"mg-message",{"identifier":[1],"delay":[2],"variant":[1],"closeButton":[1028,"close-button"],"hide":[1028],"classList":[32],"hasActions":[32]}],[1,"mg-popover",{"identifier":[1],"placement":[1],"closeButton":[4,"close-button"],"display":[1028],"disabled":[1028]}],[1,"mg-tabs",{"identifier":[1],"label":[1],"size":[1],"items":[16],"activeTab":[1538,"active-tab"],"tabs":[32],"classList":[32]}],[1,"mg-details",{"toggleClosed":[1,"toggle-closed"],"toggleOpened":[1,"toggle-opened"],"expanded":[1028]}],[1,"mg-form",{"identifier":[1],"name":[1],"readonly":[4],"disabled":[4],"valid":[1028],"invalid":[1028],"classList":[32],"displayError":[64]}],[1,"mg-illustrated-message",{"size":[1],"direction":[1]}],[1,"mg-tag",{"variant":[1],"outline":[4],"classList":[32]}],[1,"mg-input-text",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"type":[1],"icon":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"maxlength":[2],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"pattern":[1],"patternErrorMessage":[1,"pattern-error-message"],"tooltip":[1],"displayCharacterLeft":[4,"display-character-left"],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"setFocus":[64],"displayError":[64]}],[1,"mg-input-select",{"value":[1032],"items":[16],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1025],"placeholderHide":[4,"placeholder-hide"],"placeholderDisabled":[4,"placeholder-disabled"],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"options":[32],"valueExist":[32],"readonlyValue":[32],"displayError":[64]}],[1,"mg-badge",{"value":[1032],"label":[1],"variant":[1],"outline":[4],"classList":[32]}],[2,"mg-character-left",{"identifier":[1],"characters":[1],"maxlength":[2]}],[1,"mg-button",{"variant":[1],"identifier":[1],"label":[1],"type":[1],"form":[1025],"disabled":[1028],"isIcon":[4,"is-icon"],"disableOnClick":[4,"disable-on-click"],"loading":[32],"classList":[32]}],[6,"mg-input-title",{"identifier":[1],"required":[4],"isLegend":[4,"is-legend"],"tagName":[32]}],[1,"mg-tooltip",{"identifier":[1],"message":[1],"placement":[1],"display":[1028],"disabled":[1028]}],[1,"mg-icon",{"icon":[1],"size":[1],"variant":[1],"spin":[4],"classList":[32]}]]],["mg-modal.cjs",[[1,"mg-modal",{"identifier":[1],"modalTitle":[1,"modal-title"],"closeButton":[1028,"close-button"],"hide":[1028],"hasActions":[32],"hasContent":[32],"classList":[32]},[[8,"keydown","handleKeyDown"]]]]]], options);
|
|
19
19
|
});
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-94497267.js');
|
|
6
6
|
const index$1 = require('./index-179621c8.js');
|
|
7
7
|
|
|
8
|
-
const mgModalCss = ".mg-modal{display:flex;justify-content:center;align-items:center;position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;padding:2rem 0;background-color:hsla(var(--color-light), 85%)}.mg-modal__dialog{display:flex;flex-direction:column;align-self:center;row-gap:3rem;padding:1.5rem 2.5rem;width:60rem;height:fit-content;max-width:100%;max-height:100%;box-sizing:border-box;background-color:hsl(var(--color-light));box-shadow:var(--box-shadow);border-radius:var(--mg-modal-border-radius)}.mg-modal__header{margin-bottom:0.5rem}.mg-modal__title{margin:0;font-family:var(--font-family-heading);font-size:var(--mg-modal-title-font-size);font-weight:600}.mg-modal__close-button{float:right;height:var(--mg-modal-title-font-size);margin-top:calc((var(--default-size) - var(--mg-modal-title-font-size) * var(--line-height)) / 2 * -1);margin-right:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2 * -1)}.mg-
|
|
8
|
+
const mgModalCss = ".mg-modal{display:flex;justify-content:center;align-items:center;position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;padding:2rem 0;background-color:hsla(var(--color-light), 85%)}.mg-modal__dialog{display:flex;flex-direction:column;align-self:center;row-gap:3rem;padding:1.5rem 2.5rem;width:60rem;height:fit-content;max-width:100%;max-height:100%;box-sizing:border-box;background-color:hsl(var(--color-light));box-shadow:var(--box-shadow);border-radius:var(--mg-modal-border-radius)}.mg-modal__header{margin-bottom:0.5rem}.mg-modal__title{margin:0;font-family:var(--font-family-heading);font-size:var(--mg-modal-title-font-size);font-weight:600}.mg-modal__close-button{float:right;height:var(--mg-modal-title-font-size);margin-top:calc((var(--default-size) - var(--mg-modal-title-font-size) * var(--line-height)) / 2 * -1);margin-right:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2 * -1)}.mg-modal__content{overflow-y:auto}.mg-modal__content::slotted(*){font-size:var(--mg-modal-content-font-size)}.mg-modal.mg-modal--hide{display:none}";
|
|
9
9
|
|
|
10
10
|
const MgModal = class {
|
|
11
11
|
constructor(hostRef) {
|
|
@@ -66,10 +66,12 @@ const MgModal = class {
|
|
|
66
66
|
if (newValue) {
|
|
67
67
|
this.componentHide.emit();
|
|
68
68
|
this.classList.add(this.classHide);
|
|
69
|
+
document.body.style.overflow = this.bodyOverflow;
|
|
69
70
|
}
|
|
70
71
|
else {
|
|
71
72
|
this.componentShow.emit();
|
|
72
73
|
this.classList.delete(this.classHide);
|
|
74
|
+
document.body.style.overflow = 'hidden';
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
/**
|
|
@@ -93,6 +95,8 @@ const MgModal = class {
|
|
|
93
95
|
* @returns {void}
|
|
94
96
|
*/
|
|
95
97
|
componentWillLoad() {
|
|
98
|
+
// Store body overflow
|
|
99
|
+
this.bodyOverflow = document.body.style.overflow;
|
|
96
100
|
// Get locales
|
|
97
101
|
this.messages = index$1.initLocales(this.element).messages;
|
|
98
102
|
// Validate
|
|
@@ -1,110 +1,146 @@
|
|
|
1
1
|
/* Variables */
|
|
2
2
|
/* Mixins */
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
align-items: center;
|
|
8
|
-
column-gap: 0.6rem;
|
|
9
|
-
padding: calc((var(--default-size) - 0.2rem - var(--font-size) * var(--line-height)) / 2) 1.1rem;
|
|
10
|
-
min-height: var(--default-size);
|
|
11
|
-
box-sizing: border-box;
|
|
12
|
-
border-top-right-radius: var(--mg-button-border-radius-top-right, var(--mg-button-border-radius));
|
|
13
|
-
border-top-left-radius: var(--mg-button-border-radius-top-left, var(--mg-button-border-radius));
|
|
14
|
-
border-bottom-right-radius: var(--mg-button-border-radius-bottom-right, var(--mg-button-border-radius));
|
|
15
|
-
border-bottom-left-radius: var(--mg-button-border-radius-bottom-left, var(--mg-button-border-radius));
|
|
16
|
-
cursor: pointer;
|
|
17
|
-
background-image: none;
|
|
18
|
-
border-top-width: var(--mg-button-border-top-width, 0.1rem);
|
|
19
|
-
border-right-width: var(--mg-button-border-right-width, 0.1rem);
|
|
20
|
-
border-bottom-width: var(--mg-button-border-bottom-width, 0.1rem);
|
|
21
|
-
border-left-width: var(--mg-button-border-left-width, 0.1rem);
|
|
22
|
-
border-style: solid;
|
|
23
|
-
font-family: inherit;
|
|
24
|
-
text-decoration: none;
|
|
25
|
-
font-weight: normal;
|
|
26
|
-
text-align: left;
|
|
27
|
-
touch-action: manipulation;
|
|
3
|
+
:host {
|
|
4
|
+
display: inline-block;
|
|
5
|
+
vertical-align: middle;
|
|
6
|
+
max-width: 100%;
|
|
28
7
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
8
|
+
|
|
9
|
+
:host(:focus-visible) {
|
|
10
|
+
outline: 0;
|
|
32
11
|
}
|
|
33
|
-
.mg-button.mg-button--
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
width:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
line-height: var(--font-size);
|
|
12
|
+
:host(:focus-visible) .mg-button:not(.mg-button--disabled) {
|
|
13
|
+
outline-color: -webkit-focus-ring-color;
|
|
14
|
+
outline-style: auto;
|
|
15
|
+
outline-width: 0.2rem;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:host(:hover) .mg-button--flat:not(.mg-button--disabled),
|
|
19
|
+
:host(:focus) .mg-button--flat:not(.mg-button--disabled),
|
|
20
|
+
:host(:active) .mg-button--flat:not(.mg-button--disabled) {
|
|
21
|
+
background: hsla(var(--color-dark), 0.1);
|
|
44
22
|
}
|
|
23
|
+
|
|
45
24
|
.mg-button.mg-button--primary {
|
|
46
25
|
border-color: hsl(var(--mg-button-primary-border-color, var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), calc(var(--mg-button-primary-color-l) - var(--mg-button-border-variation) * 10%)));
|
|
47
26
|
color: hsl(var(--mg-button-primary-font-color));
|
|
48
27
|
background: linear-gradient(to bottom, hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l)), hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), calc(var(--mg-button-primary-color-l) - var(--mg-button-gradient) * 10%)));
|
|
49
28
|
}
|
|
50
|
-
|
|
29
|
+
|
|
30
|
+
:host(:hover) .mg-button--primary:not(.mg-button--disabled),
|
|
31
|
+
:host(:focus) .mg-button--primary:not(.mg-button--disabled),
|
|
32
|
+
:host(:active) .mg-button--primary:not(.mg-button--disabled) {
|
|
51
33
|
background: hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l));
|
|
52
34
|
}
|
|
35
|
+
|
|
53
36
|
.mg-button.mg-button--secondary {
|
|
54
37
|
border-color: hsl(var(--mg-button-secondary-border-color, var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), calc(var(--mg-button-secondary-color-l) - var(--mg-button-border-variation) * 10%)));
|
|
55
38
|
color: hsl(var(--mg-button-secondary-font-color));
|
|
56
39
|
background: linear-gradient(to bottom, hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l)), hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), calc(var(--mg-button-secondary-color-l) - var(--mg-button-gradient) * 10%)));
|
|
57
40
|
}
|
|
58
|
-
|
|
41
|
+
|
|
42
|
+
:host(:hover) .mg-button--secondary:not(.mg-button--disabled),
|
|
43
|
+
:host(:focus) .mg-button--secondary:not(.mg-button--disabled),
|
|
44
|
+
:host(:active) .mg-button--secondary:not(.mg-button--disabled) {
|
|
59
45
|
background: hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l));
|
|
60
46
|
}
|
|
47
|
+
|
|
61
48
|
.mg-button.mg-button--danger {
|
|
62
49
|
border-color: hsl(var(--mg-button-danger-border-color, var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) - var(--mg-button-border-variation) * 10%)));
|
|
63
50
|
color: hsl(var(--color-neutral));
|
|
64
51
|
background: linear-gradient(to bottom, hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l)), hsl(var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) - var(--mg-button-gradient) * 10%)));
|
|
65
52
|
}
|
|
66
|
-
|
|
53
|
+
|
|
54
|
+
:host(:hover) .mg-button--danger:not(.mg-button--disabled),
|
|
55
|
+
:host(:focus) .mg-button--danger:not(.mg-button--disabled),
|
|
56
|
+
:host(:active) .mg-button--danger:not(.mg-button--disabled) {
|
|
67
57
|
background: hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l));
|
|
68
58
|
}
|
|
59
|
+
|
|
69
60
|
.mg-button.mg-button--danger-alt {
|
|
70
61
|
border-color: hsl(var(--mg-button-danger-alt-border-color, var(--color-neutral-h), var(--color-neutral-s), calc(var(--color-neutral-l) - var(--mg-button-border-variation) * 10%)));
|
|
71
62
|
color: hsl(var(--color-danger));
|
|
72
63
|
background: linear-gradient(to bottom, hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l)), hsl(var(--color-neutral-h), var(--color-neutral-s), calc(var(--color-neutral-l) - var(--mg-button-gradient) * 10%)));
|
|
73
64
|
}
|
|
74
|
-
|
|
65
|
+
|
|
66
|
+
:host(:hover) .mg-button--danger-alt:not(.mg-button--disabled),
|
|
67
|
+
:host(:focus) .mg-button--danger-alt:not(.mg-button--disabled),
|
|
68
|
+
:host(:active) .mg-button--danger-alt:not(.mg-button--disabled) {
|
|
75
69
|
background: hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l));
|
|
76
70
|
}
|
|
71
|
+
|
|
77
72
|
.mg-button.mg-button--info {
|
|
78
73
|
border-color: hsl(var(--mg-button-info-border-color, var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) - var(--mg-button-border-variation) * 10%)));
|
|
79
74
|
color: hsl(var(--color-neutral));
|
|
80
75
|
background: linear-gradient(to bottom, hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l)), hsl(var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) - var(--mg-button-gradient) * 10%)));
|
|
81
76
|
}
|
|
82
|
-
|
|
77
|
+
|
|
78
|
+
:host(:hover) .mg-button--info:not(.mg-button--disabled),
|
|
79
|
+
:host(:focus) .mg-button--info:not(.mg-button--disabled),
|
|
80
|
+
:host(:active) .mg-button--info:not(.mg-button--disabled) {
|
|
83
81
|
background: hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l));
|
|
84
82
|
}
|
|
83
|
+
|
|
85
84
|
.mg-button.mg-button--success {
|
|
86
85
|
border-color: hsl(var(--mg-button-success-border-color, var(--color-success-h), var(--color-success-s), calc(var(--color-success-l) - var(--mg-button-border-variation) * 10%)));
|
|
87
86
|
color: hsl(var(--color-dark));
|
|
88
87
|
background: linear-gradient(to bottom, hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l)), hsl(var(--color-success-h), var(--color-success-s), calc(var(--color-success-l) - var(--mg-button-gradient) * 10%)));
|
|
89
88
|
}
|
|
90
|
-
|
|
89
|
+
|
|
90
|
+
:host(:hover) .mg-button--success:not(.mg-button--disabled),
|
|
91
|
+
:host(:focus) .mg-button--success:not(.mg-button--disabled),
|
|
92
|
+
:host(:active) .mg-button--success:not(.mg-button--disabled) {
|
|
91
93
|
background: hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l));
|
|
92
94
|
}
|
|
95
|
+
|
|
96
|
+
/* Styles */
|
|
97
|
+
.mg-button {
|
|
98
|
+
position: relative;
|
|
99
|
+
display: inline-flex;
|
|
100
|
+
align-items: center;
|
|
101
|
+
column-gap: 0.6rem;
|
|
102
|
+
padding: calc((var(--default-size) - 0.2rem - var(--font-size) * var(--line-height)) / 2) 1.1rem;
|
|
103
|
+
min-height: var(--default-size);
|
|
104
|
+
box-sizing: border-box;
|
|
105
|
+
border-top-right-radius: var(--mg-button-border-radius-top-right, var(--mg-button-border-radius));
|
|
106
|
+
border-top-left-radius: var(--mg-button-border-radius-top-left, var(--mg-button-border-radius));
|
|
107
|
+
border-bottom-right-radius: var(--mg-button-border-radius-bottom-right, var(--mg-button-border-radius));
|
|
108
|
+
border-bottom-left-radius: var(--mg-button-border-radius-bottom-left, var(--mg-button-border-radius));
|
|
109
|
+
cursor: pointer;
|
|
110
|
+
background-image: none;
|
|
111
|
+
border-top-width: var(--mg-button-border-top-width, 0.1rem);
|
|
112
|
+
border-right-width: var(--mg-button-border-right-width, 0.1rem);
|
|
113
|
+
border-bottom-width: var(--mg-button-border-bottom-width, 0.1rem);
|
|
114
|
+
border-left-width: var(--mg-button-border-left-width, 0.1rem);
|
|
115
|
+
border-style: solid;
|
|
116
|
+
text-decoration: none;
|
|
117
|
+
font-family: inherit;
|
|
118
|
+
font-weight: var(--mg-button-font-weight, normal);
|
|
119
|
+
text-align: left;
|
|
120
|
+
font-size: var(--font-size);
|
|
121
|
+
touch-action: manipulation;
|
|
122
|
+
}
|
|
123
|
+
.mg-button.mg-button--disabled {
|
|
124
|
+
opacity: var(--mg-button-disabled-opacity);
|
|
125
|
+
cursor: default;
|
|
126
|
+
}
|
|
127
|
+
.mg-button.mg-button--icon {
|
|
128
|
+
padding: 0;
|
|
129
|
+
justify-content: center;
|
|
130
|
+
width: var(--default-size);
|
|
131
|
+
height: var(--default-size);
|
|
132
|
+
border-top-right-radius: var(--mg-button-border-radius-top-right, var(--mg-button-icon-border-radius));
|
|
133
|
+
border-top-left-radius: var(--mg-button-border-radius-top-left, var(--mg-button-icon-border-radius));
|
|
134
|
+
border-bottom-right-radius: var(--mg-button-border-radius-bottom-right, var(--mg-button-icon-border-radius));
|
|
135
|
+
border-bottom-left-radius: var(--mg-button-border-radius-bottom-left, var(--mg-button-icon-border-radius));
|
|
136
|
+
font-size: var(--font-size);
|
|
137
|
+
line-height: var(--font-size);
|
|
138
|
+
}
|
|
93
139
|
.mg-button.mg-button--flat {
|
|
94
140
|
background: none;
|
|
95
141
|
border: none;
|
|
96
142
|
}
|
|
97
|
-
.mg-button.mg-button--
|
|
98
|
-
background: hsla(var(--color-dark), 0.1);
|
|
99
|
-
}
|
|
100
|
-
.mg-button mg-icon:only-child,
|
|
101
|
-
.mg-button ::slotted(mg-icon) {
|
|
102
|
-
display: inline-flex;
|
|
103
|
-
flex-shrink: 0;
|
|
104
|
-
line-height: 1;
|
|
105
|
-
margin: auto 0;
|
|
106
|
-
}
|
|
107
|
-
.mg-button.mg-button--loading > mg-icon {
|
|
143
|
+
.mg-button.mg-button--loading > mg-icon:first-of-type {
|
|
108
144
|
position: absolute;
|
|
109
145
|
left: 50%;
|
|
110
146
|
top: 50%;
|
|
@@ -113,19 +149,21 @@
|
|
|
113
149
|
.mg-button.mg-button--loading .mg-button__content {
|
|
114
150
|
opacity: 0;
|
|
115
151
|
}
|
|
116
|
-
|
|
117
|
-
.mg-
|
|
152
|
+
.mg-button mg-icon:only-child,
|
|
153
|
+
.mg-button ::slotted(mg-icon) {
|
|
154
|
+
display: inline-flex;
|
|
155
|
+
flex-shrink: 0;
|
|
156
|
+
line-height: 1;
|
|
157
|
+
margin: auto 0;
|
|
158
|
+
}
|
|
159
|
+
.mg-button slot,
|
|
160
|
+
.mg-button ::slotted(*:not(mg-icon)) {
|
|
161
|
+
text-decoration: none;
|
|
162
|
+
font-family: inherit;
|
|
163
|
+
font-weight: var(--mg-button-font-weight, normal);
|
|
164
|
+
text-align: left;
|
|
165
|
+
font-size: var(--font-size);
|
|
118
166
|
display: flex;
|
|
119
167
|
align-items: center;
|
|
120
168
|
column-gap: 0.6rem;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
mg-button {
|
|
124
|
-
display: inline-block;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.mg-button,
|
|
128
|
-
mg-button {
|
|
129
|
-
vertical-align: middle;
|
|
130
|
-
max-width: 100%;
|
|
131
169
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h } from '@stencil/core';
|
|
1
|
+
import { h, Host } from '@stencil/core';
|
|
2
2
|
import { variants } from './mg-button.conf';
|
|
3
3
|
import { ClassList } from '../../../utils/components.utils';
|
|
4
4
|
export class MgButton {
|
|
@@ -7,6 +7,8 @@ export class MgButton {
|
|
|
7
7
|
* Internal *
|
|
8
8
|
************/
|
|
9
9
|
this.onClickElementFn = null;
|
|
10
|
+
this.classDisabled = 'mg-button--disabled';
|
|
11
|
+
this.classLoading = 'mg-button--loading';
|
|
10
12
|
/**
|
|
11
13
|
* Define button variant
|
|
12
14
|
*/
|
|
@@ -41,11 +43,38 @@ export class MgButton {
|
|
|
41
43
|
if (this.disabled)
|
|
42
44
|
event.stopPropagation();
|
|
43
45
|
// Used to prevent multi-click.
|
|
44
|
-
if (this.disableOnClick
|
|
46
|
+
else if (this.disableOnClick) {
|
|
45
47
|
this.loading = true;
|
|
46
48
|
this.disabled = true;
|
|
47
49
|
}
|
|
48
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* Handle onKeyDown event
|
|
53
|
+
*
|
|
54
|
+
* @param {KeyboardEvent} event keyboard event
|
|
55
|
+
* @returns {void}
|
|
56
|
+
*/
|
|
57
|
+
this.handleKeydown = (event) => {
|
|
58
|
+
if (!this.disabled && event.key === ' ') {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
}
|
|
61
|
+
else if (!this.disabled && ['Enter', 'NumpadEnter', 'Space'].includes(event.key)) {
|
|
62
|
+
event.preventDefault();
|
|
63
|
+
this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Handle onKeyUp event
|
|
68
|
+
*
|
|
69
|
+
* @param {KeyboardEvent} event keyboard event
|
|
70
|
+
* @returns {void}
|
|
71
|
+
*/
|
|
72
|
+
this.handleKeyup = (event) => {
|
|
73
|
+
if (!this.disabled && event.key === ' ') {
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));
|
|
76
|
+
}
|
|
77
|
+
};
|
|
49
78
|
}
|
|
50
79
|
validateVariant(newValue, oldValue) {
|
|
51
80
|
if (!variants.includes(newValue)) {
|
|
@@ -66,14 +95,21 @@ export class MgButton {
|
|
|
66
95
|
}
|
|
67
96
|
// Manage if onclick
|
|
68
97
|
this.element.onclick = isDisabled ? undefined : this.onClickElementFn;
|
|
98
|
+
// apply style
|
|
99
|
+
if (isDisabled) {
|
|
100
|
+
this.classList.add(this.classDisabled);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
this.classList.delete(this.classDisabled);
|
|
104
|
+
}
|
|
69
105
|
}
|
|
70
106
|
loadingHandler(newValue) {
|
|
71
107
|
// we add loading style if it newvalue is true else we remove it
|
|
72
108
|
if (newValue) {
|
|
73
|
-
this.classList.add(
|
|
109
|
+
this.classList.add(this.classLoading);
|
|
74
110
|
}
|
|
75
111
|
else {
|
|
76
|
-
this.classList.delete(
|
|
112
|
+
this.classList.delete(this.classLoading);
|
|
77
113
|
}
|
|
78
114
|
}
|
|
79
115
|
/**
|
|
@@ -99,13 +135,10 @@ export class MgButton {
|
|
|
99
135
|
* @returns {HTMLElement} html element
|
|
100
136
|
*/
|
|
101
137
|
render() {
|
|
102
|
-
return (h("button",
|
|
103
|
-
// has stencil does not support form attribute on button, we set the attribute from the ref
|
|
104
|
-
// https://github.com/ionic-team/stencil/issues/2703#issuecomment-1050943715
|
|
105
|
-
ref: btn => this.form && btn.setAttribute('form', this.form) }, this.loading && h("mg-icon", { icon: "loader", spin: true }), h("div", { class: "mg-button__content" }, h("slot", null))));
|
|
138
|
+
return (h(Host, { role: "button", tabIndex: this.disabled ? -1 : 0, type: this.type, form: this.form, "aria-label": this.label, "aria-disabled": this.disabled !== undefined && this.disabled.toString(), onClick: this.handleClick, onKeyUp: this.handleKeyup, onKeyDown: this.handleKeydown }, h("div", { class: this.classList.join(), id: this.identifier }, this.loading && h("mg-icon", { icon: "loader", spin: true }), h("div", { class: "mg-button__content" }, h("slot", null)))));
|
|
106
139
|
}
|
|
107
140
|
static get is() { return "mg-button"; }
|
|
108
|
-
static get encapsulation() { return "
|
|
141
|
+
static get encapsulation() { return "shadow"; }
|
|
109
142
|
static get originalStyleUrls() {
|
|
110
143
|
return {
|
|
111
144
|
"$": ["mg-button.scss"]
|
|
@@ -122,9 +155,14 @@ export class MgButton {
|
|
|
122
155
|
"type": "string",
|
|
123
156
|
"mutable": false,
|
|
124
157
|
"complexType": {
|
|
125
|
-
"original": "
|
|
126
|
-
"resolved": "
|
|
127
|
-
"references": {
|
|
158
|
+
"original": "VariantType",
|
|
159
|
+
"resolved": "\"danger\" | \"danger-alt\" | \"flat\" | \"info\" | \"primary\" | \"secondary\" | \"success\"",
|
|
160
|
+
"references": {
|
|
161
|
+
"VariantType": {
|
|
162
|
+
"location": "import",
|
|
163
|
+
"path": "./mg-button.conf"
|
|
164
|
+
}
|
|
165
|
+
}
|
|
128
166
|
},
|
|
129
167
|
"required": false,
|
|
130
168
|
"optional": false,
|
|
@@ -187,7 +225,7 @@ export class MgButton {
|
|
|
187
225
|
"optional": false,
|
|
188
226
|
"docs": {
|
|
189
227
|
"tags": [],
|
|
190
|
-
"text": "Define button type
|
|
228
|
+
"text": "Define button type"
|
|
191
229
|
},
|
|
192
230
|
"attribute": "type",
|
|
193
231
|
"reflect": false
|
|
@@ -261,57 +299,6 @@ export class MgButton {
|
|
|
261
299
|
"attribute": "disable-on-click",
|
|
262
300
|
"reflect": false,
|
|
263
301
|
"defaultValue": "false"
|
|
264
|
-
},
|
|
265
|
-
"expanded": {
|
|
266
|
-
"type": "boolean",
|
|
267
|
-
"mutable": false,
|
|
268
|
-
"complexType": {
|
|
269
|
-
"original": "boolean",
|
|
270
|
-
"resolved": "boolean",
|
|
271
|
-
"references": {}
|
|
272
|
-
},
|
|
273
|
-
"required": false,
|
|
274
|
-
"optional": false,
|
|
275
|
-
"docs": {
|
|
276
|
-
"tags": [],
|
|
277
|
-
"text": "Prop to set aria-expanded on button element"
|
|
278
|
-
},
|
|
279
|
-
"attribute": "expanded",
|
|
280
|
-
"reflect": false
|
|
281
|
-
},
|
|
282
|
-
"controls": {
|
|
283
|
-
"type": "string",
|
|
284
|
-
"mutable": false,
|
|
285
|
-
"complexType": {
|
|
286
|
-
"original": "string",
|
|
287
|
-
"resolved": "string",
|
|
288
|
-
"references": {}
|
|
289
|
-
},
|
|
290
|
-
"required": false,
|
|
291
|
-
"optional": false,
|
|
292
|
-
"docs": {
|
|
293
|
-
"tags": [],
|
|
294
|
-
"text": "Prop to set aria-controls on button element"
|
|
295
|
-
},
|
|
296
|
-
"attribute": "controls",
|
|
297
|
-
"reflect": false
|
|
298
|
-
},
|
|
299
|
-
"haspopup": {
|
|
300
|
-
"type": "any",
|
|
301
|
-
"mutable": false,
|
|
302
|
-
"complexType": {
|
|
303
|
-
"original": "boolean | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'",
|
|
304
|
-
"resolved": "\"dialog\" | \"grid\" | \"listbox\" | \"menu\" | \"tree\" | boolean",
|
|
305
|
-
"references": {}
|
|
306
|
-
},
|
|
307
|
-
"required": false,
|
|
308
|
-
"optional": false,
|
|
309
|
-
"docs": {
|
|
310
|
-
"tags": [],
|
|
311
|
-
"text": "Option to set aria-haspopup\nThe aria-haspopup state informs assistive technology users that there is a popup and the type of popup it is, but provides no interactivity."
|
|
312
|
-
},
|
|
313
|
-
"attribute": "haspopup",
|
|
314
|
-
"reflect": false
|
|
315
302
|
}
|
|
316
303
|
};
|
|
317
304
|
}
|
|
@@ -50,6 +50,8 @@ export const icons = {
|
|
|
50
50
|
'dashboard': () => h("path", { fill: "currentColor", d: "M1.67 8.7H7.3V1.67H1.67v7.04Zm0 5.63H7.3v-4.22H1.67v4.22Zm7.04 0h5.63V7.3H8.71v7.04Zm0-12.67v4.23h5.63V1.67H8.71Z" }),
|
|
51
51
|
'dashboard-outline': () => (h("path", { fill: "currentColor", d: "M13.33 2.67v2.22H9.7V2.67h3.63m-7.04 0V7.7H2.67V2.67H6.3m7.04 5.63v5.04H9.71V8.3h3.63M6.3 11.11v2.22H2.67v-2.22H6.3m8.03-9.44H8.7v4.22h5.63V1.67Zm-7.04 0H1.67v7.04H7.3V1.67Zm7.04 5.63H8.7v7.04h5.63V7.3Zm-7.04 2.81H1.67v4.22H7.3v-4.22Z" })),
|
|
52
52
|
'download': () => (h("path", { fill: "currentColor", d: "M6.4 2v4.1c0 .2-.1.3-.3.3H4c-.2 0-.3.1-.3.3 0 .1 0 .2.1.2l4 4c.1.1.3.1.4 0l4-4c.1-.1.1-.3 0-.4-.1-.1-.1-.1-.2-.1H9.9c-.2 0-.3-.1-.3-.3V2c0-.2-.1-.3-.3-.3H6.7c-.1 0-.3.1-.3.3zm7.9 11v1c0 .2-.1.3-.3.3H2c-.2 0-.3-.1-.3-.3v-1c0-.2.1-.3.3-.3h12c.2 0 .3.1.3.3z" })),
|
|
53
|
+
'ellipsis': () => (h("path", { fill: "currentColor", d: "M2.5 6.17A1.83 1.83 0 1 0 4.33 8c0-1.01-.82-1.83-1.83-1.83Zm11 0A1.83 1.83 0 1 0 15.33 8c0-1.01-.82-1.83-1.83-1.83Zm-5.5 0A1.83 1.83 0 1 0 9.83 8c0-1.01-.82-1.83-1.83-1.83Z" })),
|
|
54
|
+
'ellipsis-vertical': () => (h("path", { fill: "currentColor", d: "M6.17 13.5A1.83 1.83 0 1 0 8 11.67c-1.01 0-1.83.82-1.83 1.83Zm0-11A1.83 1.83 0 1 0 8 .67c-1.01 0-1.83.82-1.83 1.83Zm0 5.5A1.83 1.83 0 1 0 8 6.17c-1.01 0-1.83.82-1.83 1.83Z" })),
|
|
53
55
|
'euro': () => (h("path", { fill: "currentColor", d: "M13 13.14a.4.4 0 0 0-.47-.31A7.79 7.79 0 0 1 11 13a4.31 4.31 0 0 1-4-2.79h3.8a.41.41 0 0 0 .39-.31l.19-.9a.39.39 0 0 0-.3-.47H6.51a7.07 7.07 0 0 1 0-1.38h4.89a.4.4 0 0 0 .39-.31l.22-1a.4.4 0 0 0-.3-.47H7a4.2 4.2 0 0 1 3.92-2.45 6.57 6.57 0 0 1 1.26.14.41.41 0 0 0 .47-.29l.4-1.45a.4.4 0 0 0-.28-.48A9.43 9.43 0 0 0 11 .67a7.12 7.12 0 0 0-6.83 4.7h-1.1a.4.4 0 0 0-.4.39v1a.4.4 0 0 0 .4.39h.72a9.08 9.08 0 0 0 0 1.38h-.72a.39.39 0 0 0-.4.39v.93a.4.4 0 0 0 .4.39h1A7 7 0 0 0 11 15.3a8.7 8.7 0 0 0 2-.25.39.39 0 0 0 .3-.46l-.3-1.45Z" })),
|
|
54
56
|
'euro-circle': () => (h("path", { fill: "currentColor", d: "M8 .67C3.95.67.67 3.95.67 8S3.95 15.33 8 15.33s7.33-3.28 7.33-7.33S12.05.67 8 .67Zm2.27 11.4c-.38.09-.76.14-1.15.14a4.038 4.038 0 0 1-3.99-2.92h-.58c-.13 0-.23-.1-.23-.22v-.54c0-.12.11-.22.23-.22h.41a5.34 5.34 0 0 1 0-.8h-.41c-.13 0-.23-.1-.23-.22v-.58c0-.13.11-.22.23-.22h.63c.6-1.65 2.18-2.74 3.94-2.71.34 0 .68.03 1.02.1.12.03.19.16.16.28l-.23.84c-.03.12-.15.19-.27.17-.24-.05-.48-.08-.73-.08A2.42 2.42 0 0 0 6.81 6.5h2.71c.12.03.2.15.17.27l-.13.58c-.02.1-.12.18-.22.18H6.52c-.03.26-.03.53 0 .8h2.63c.12.03.2.15.17.27l-.11.52c-.03.1-.12.18-.22.18H6.8c.36.96 1.28 1.6 2.31 1.61.3 0 .59-.04.88-.1.12-.02.24.05.27.18l.17.84c.02.12-.05.24-.17.27v-.03Z" })),
|
|
55
57
|
'exclamation-circle': () => (h("path", { fill: "currentColor", d: "M8 15.33c4.05 0 7.33-3.28 7.33-7.33S12.05.67 8 .67.67 3.95.67 8 3.95 15.33 8 15.33Zm.95-3.3c0 .15-.12.27-.28.27h-1.4c-.15 0-.28-.12-.28-.27v-1.31c0-.15.12-.28.28-.28h1.4c.15 0 .28.12.28.28v1.31ZM7 3.96c0-.14.11-.25.25-.25H8.7c.14 0 .25.11.25.25v4.8c0 .14-.11.25-.25.25H7.25c-.14 0-.25-.11-.25-.25V3.95Z" })),
|
|
@@ -149,6 +151,7 @@ export const icons = {
|
|
|
149
151
|
'user-group': () => (h("path", { fill: "currentColor", d: "M13.15 4.12c-.81-.01-1.47.65-1.48 1.46 0 .82.65 1.47 1.46 1.48s1.47-.65 1.48-1.46-.65-1.47-1.46-1.48Zm-10.04.01a1.47 1.47 0 0 0-1.58 1.59c.06.71.62 1.28 1.34 1.34.81.07 1.52-.53 1.59-1.34.06-.81-.54-1.52-1.35-1.59Zm7.36.39c-.22-.84-.87-1.51-1.71-1.75-1.36-.41-2.8.36-3.22 1.72-.18.61-.13 1.27.14 1.85.41.9 1.33 1.48 2.32 1.45 1.41.01 2.56-1.14 2.57-2.55 0-.24-.03-.49-.1-.72Zm-.71 4h-.19c-.99.49-2.14.49-3.13 0h-.19c-1.46 0-2.64 1.18-2.64 2.64v2.69c1.23.93 2.74 1.47 4.39 1.47s3.17-.55 4.4-1.48v-2.68c0-1.46-1.18-2.64-2.64-2.64Zm5.52.25a7.282 7.282 0 0 1-1.65 3.91c-.08.1-.16.19-.25.28-.08.09-.17.18-.25.27v-.55h.03v-.72s.01-.07 0-.1v-.66c.01-1.25-.66-2.4-1.76-3 .27-.26.63-.41 1-.41h1.51c.63.01 1.17.41 1.37.98ZM2.86 11.16v1.52h.01v.55l-.28-.31c-.08-.08-.15-.16-.22-.24A7.238 7.238 0 0 1 .74 8.86c.16-.62.72-1.07 1.4-1.07h1.47c.37-.01.73.12 1.01.37-1.1.6-1.77 1.75-1.76 3Z" })),
|
|
150
152
|
'user-plus': () => (h("path", { fill: "currentColor", d: "M14,3.33H12.65V2a.36.36,0,0,0-.35-.33h-.65A.36.36,0,0,0,11.3,2V3.33H10a.34.34,0,0,0-.33.34v.66a.34.34,0,0,0,.33.34H11.3V6a.37.37,0,0,0,.35.33h.65A.37.37,0,0,0,12.65,6V4.67H14a.34.34,0,0,0,.32-.34V3.67A.34.34,0,0,0,14,3.33ZM9.28,9.77h-.2a5.19,5.19,0,0,1-3.91,0H5A3,3,0,0,0,1.7,12.46h0v.72A1.27,1.27,0,0,0,3,14.33h8.25a1.26,1.26,0,0,0,1.36-1.14v-.68A3,3,0,0,0,9.37,9.76H9.28ZM7.13,3.7A2.64,2.64,0,1,1,4.5,6.34h0A2.64,2.64,0,0,1,7.13,3.7Z" })),
|
|
151
153
|
'user-question-outline': () => (h("path", { fill: "currentColor", d: "M5.23 11.14c.86-.66 1.01-1.9.35-2.75s-1.9-1.01-2.75-.35a1.96 1.96 0 0 0 0 3.1c-.72.42-1.16 1.2-1.16 2.03v.8c0 .2.17.37.37.37h3.98c.2 0 .37-.17.37-.37v-.8c0-.83-.44-1.61-1.16-2.03ZM2.81 9.59c0-.67.55-1.22 1.22-1.22s1.22.55 1.22 1.22-.55 1.22-1.22 1.22-1.22-.55-1.22-1.22Zm2.83 4H2.41v-.42c0-.89.72-1.62 1.62-1.62s1.62.72 1.62 1.62v.42h-.01Zm7.13-11.93H8c-.86 0-1.56.7-1.56 1.56v7.16c0 .21.17.37.37.37.08 0 .16-.03.22-.07l1.49-1.12h4.25c.86 0 1.56-.7 1.56-1.56V3.22c0-.86-.7-1.56-1.56-1.56Zm.82 6.33c0 .45-.37.82-.82.82H8.4a.41.41 0 0 0-.22.07l-1 .75V3.22c0-.45.37-.82.82-.82h4.77c.45 0 .82.37.82.82v4.77Zm-2.8-.42c0 .23-.18.41-.41.41s-.41-.18-.41-.41.18-.41.41-.41c.23 0 .41.18.41.41Zm-.41-4.34c-.83 0-1.5.67-1.5 1.5 0 .23.18.41.41.41s.41-.18.41-.41c0-.38.31-.68.69-.68.38 0 .68.31.68.69 0 .38-.31.68-.68.68-.23 0-.41.18-.41.41v.44c0 .23.18.41.41.41s.41-.18.41-.41v-.09c.8-.23 1.26-1.06 1.04-1.85-.18-.65-.77-1.09-1.44-1.09Z" })),
|
|
154
|
+
'user-shield-outline': () => (h("path", { fill: "currentColor", d: "M8 8.92c-1.5 0-2.72-1.22-2.72-2.72S6.5 3.48 8 3.48s2.72 1.22 2.72 2.72S9.5 8.92 8 8.92Zm0-4.64a1.92 1.92 0 1 0 .001 3.841A1.92 1.92 0 0 0 8 4.28Zm4.97-1.84L8.56.78C8.2.65 7.81.65 7.45.78L3.03 2.43C2.41 2.66 2 3.26 2 3.92V8c0 3.82 4.23 6.47 5.52 7.2.15.08.31.13.48.13s.33-.04.48-.13C9.78 14.48 14 11.82 14 8V3.92c0-.66-.41-1.25-1.03-1.48ZM8.08 14.5c-.05.03-.12.03-.17 0-.49-.28-2.12-1.24-3.4-2.68.62-.82 1.94-1.39 3.47-1.39s2.84.61 3.49 1.4c-1.29 1.43-2.9 2.39-3.39 2.67ZM13.19 8c0 1.2-.51 2.28-1.22 3.22-.83-.91-2.34-1.59-4-1.59s-3.16.64-3.98 1.58c-.7-.93-1.2-2.01-1.2-3.2V3.93c0-.33.21-.62.51-.74l4.43-1.66c.09-.03.18-.05.27-.05s.19.02.27.05l4.42 1.66c.3.11.51.41.51.73V8Z" })),
|
|
152
155
|
'users': () => (h("path", { fill: "currentColor", d: "M12,8.76h-.2a5.24,5.24,0,0,1-3.93,0H7.61a3.05,3.05,0,0,0-3.3,2.75v.69a1.28,1.28,0,0,0,1.38,1.14H14a1.27,1.27,0,0,0,1.37-1.14v-.69A3.07,3.07,0,0,0,12,8.75Zm-6.4-.32A2,2,0,0,0,4.31,8H2.48A1.69,1.69,0,0,0,.65,9.53v.76a.85.85,0,0,0,.91.76H3.45A3.58,3.58,0,0,1,5.61,8.44ZM9.81,2.66A2.65,2.65,0,1,1,7.16,5.31h0A2.65,2.65,0,0,1,9.81,2.66ZM3.31,4.18A1.51,1.51,0,1,1,1.8,5.69,1.51,1.51,0,0,1,3.31,4.18Z" })),
|
|
153
156
|
'wallet': () => (h("path", { fill: "currentColor", d: "M13.88 5H3a.43.43 0 0 1-.46-.38.43.43 0 0 1 .46-.43h11a.43.43 0 0 0 .46-.38A1.28 1.28 0 0 0 13 2.67H2.5A1.7 1.7 0 0 0 .67 4.19v7.62a1.7 1.7 0 0 0 1.83 1.52h11.38a1.32 1.32 0 0 0 1.45-1.14V6.1A1.33 1.33 0 0 0 13.88 5Zm-1.21 5.29a1.1 1.1 0 1 1 1.1-1.1 1.1 1.1 0 0 1-1.1 1.05Z" })),
|
|
154
157
|
};
|
|
@@ -114,12 +114,12 @@ export class MgTooltip {
|
|
|
114
114
|
componentDidLoad() {
|
|
115
115
|
var _a;
|
|
116
116
|
// Get tooltip element
|
|
117
|
-
this.tooltip = this.element.querySelector(`#${this.identifier}`);
|
|
117
|
+
this.tooltip = this.element.shadowRoot.querySelector(`#${this.identifier}`);
|
|
118
118
|
// get slotted element
|
|
119
119
|
const slotElement = this.element.firstElementChild;
|
|
120
120
|
// Get interactive element
|
|
121
121
|
const interactiveElements = ['a', 'button', 'input', 'textarea', 'select']; //! Might needs updates
|
|
122
|
-
const interactiveElement = this.element.querySelector(interactiveElements.join(',')) || ((_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(interactiveElements.join(',')));
|
|
122
|
+
const interactiveElement = this.element.shadowRoot.querySelector(interactiveElements.join(',')) || ((_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(interactiveElements.join(',')));
|
|
123
123
|
// define selected element to become tooltip selector
|
|
124
124
|
const tooltipedElement = interactiveElement || slotElement;
|
|
125
125
|
// Add tabindex to slotted element if we can't find any interactive element
|
|
@@ -184,7 +184,7 @@ export class MgTooltip {
|
|
|
184
184
|
return (h(Host, null, h("slot", null), h("div", { role: "tooltip", id: this.identifier, class: "mg-tooltip", innerHTML: this.message }, h("div", { class: "mg-tooltip__arrow", "data-popper-arrow": true }))));
|
|
185
185
|
}
|
|
186
186
|
static get is() { return "mg-tooltip"; }
|
|
187
|
-
static get encapsulation() { return "
|
|
187
|
+
static get encapsulation() { return "shadow"; }
|
|
188
188
|
static get originalStyleUrls() {
|
|
189
189
|
return {
|
|
190
190
|
"$": ["mg-tooltip.scss"]
|
|
@@ -180,7 +180,7 @@ export class MgInputNumeric {
|
|
|
180
180
|
// Split number and decimal
|
|
181
181
|
const [integer, decimal = ''] = newValue.replace('-', '').split(/[\.,]/);
|
|
182
182
|
// Regex
|
|
183
|
-
const regex = this.type === 'integer' ?
|
|
183
|
+
const regex = this.type === 'integer' ? /^-?\d+$/ : /^-?\d+[.,]?\d*$/;
|
|
184
184
|
// Filter input
|
|
185
185
|
if (newValue === '' || (newValue.match(regex) && integer.length <= this.integerLength && decimal.length <= (this.type === 'integer' ? 0 : this.decimalLength))) {
|
|
186
186
|
this.storedValue = newValue;
|
|
@@ -120,9 +120,8 @@ export class MgForm {
|
|
|
120
120
|
*/
|
|
121
121
|
componentDidLoad() {
|
|
122
122
|
this.mgButtons.forEach(mgButton => {
|
|
123
|
-
// submit buttons should trigger form submition
|
|
124
|
-
|
|
125
|
-
if (['submit', null].includes(button.getAttribute('type'))) {
|
|
123
|
+
// submit buttons should trigger form submition;
|
|
124
|
+
if (['submit', null].includes(mgButton.getAttribute('type'))) {
|
|
126
125
|
mgButton.addEventListener('click', () => {
|
|
127
126
|
this.form.dispatchEvent(new CustomEvent('submit', { bubbles: true }));
|
|
128
127
|
});
|
|
@@ -10,9 +10,10 @@ export default {
|
|
|
10
10
|
*/
|
|
11
11
|
const Template = args => {
|
|
12
12
|
// return element
|
|
13
|
-
return (h("mg-illustrated-message", Object.assign({}, filterArgs(args, { size: 'regular' })), h("svg", { slot: "illustration", width: "190", height: "350", viewBox: "0 0 190 350", xmlns: "http://www.w3.org/2000/svg" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M0 0H15C23.2843 0 30 6.71573 30 15V290H40V15C40 6.71573 46.7157 0 55 0C63.2843 0 70 6.71573 70 15V275C70 277.761 67.7615 280 65 280H60V40H50V340H60V290H65C67.7615 290 70 292.239 70 295V340H80V295C80 291.158 78.5558 287.654 76.1805 285C78.5558 282.346 80 278.842 80 275V0H95C103.284 0 110 6.71573 110 15V25C110 28.8418 108.556 32.3462 106.181 35C108.556 37.6538 110 41.1582 110 45V305C110 307.761 107.761 310 105 310H100V45C100 42.2386 97.7615 40 95 40H90V325C90 333.284 96.7157 340 105 340H120V330H105C102.239 330 100 327.761 100 325V320H105C113.284 320 120 313.284 120 305V15C120 6.71573 126.716 0 135 0C143.284 0 150 6.71573 150 15V330H140V15C140 12.2386 137.761 10 135 10C132.239 10 130 12.2386 130 15V340H165C173.284 340 180 333.284 180 325V15C180 12.2386 177.761 10 175 10H170V325C170 327.761 167.761 330 165 330H160V0H175C183.284 0 190 6.71573 190 15V350H0V0ZM10 325C10 333.284 16.7157 340 25 340C33.2843 340 40 333.284 40 325V300H30V325C30 327.761 27.7615 330 25 330C22.2385 330 20 327.761 20 325V15C20 12.2386 17.7615 10 15 10H10V325ZM60 15V30H50V15C50 12.2386 52.2385 10 55 10C57.7615 10 60 12.2386 60 15ZM95 30H90V10H95C97.7615 10 100 12.2386 100 15V25C100 27.7614 97.7615 30 95 30Z", fill: "black" })), h("h2", { slot: "title" }, "Lorem Ipsum"), h("h3", { slot: "details" }, "The standard Lorem Ipsum passage, used since the 1500s"), h("div", { slot: "details" }, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")));
|
|
13
|
+
return (h("mg-illustrated-message", Object.assign({}, filterArgs(args, { size: 'regular', direction: 'vertical' })), h("svg", { slot: "illustration", width: "190", height: "350", viewBox: "0 0 190 350", xmlns: "http://www.w3.org/2000/svg" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M0 0H15C23.2843 0 30 6.71573 30 15V290H40V15C40 6.71573 46.7157 0 55 0C63.2843 0 70 6.71573 70 15V275C70 277.761 67.7615 280 65 280H60V40H50V340H60V290H65C67.7615 290 70 292.239 70 295V340H80V295C80 291.158 78.5558 287.654 76.1805 285C78.5558 282.346 80 278.842 80 275V0H95C103.284 0 110 6.71573 110 15V25C110 28.8418 108.556 32.3462 106.181 35C108.556 37.6538 110 41.1582 110 45V305C110 307.761 107.761 310 105 310H100V45C100 42.2386 97.7615 40 95 40H90V325C90 333.284 96.7157 340 105 340H120V330H105C102.239 330 100 327.761 100 325V320H105C113.284 320 120 313.284 120 305V15C120 6.71573 126.716 0 135 0C143.284 0 150 6.71573 150 15V330H140V15C140 12.2386 137.761 10 135 10C132.239 10 130 12.2386 130 15V340H165C173.284 340 180 333.284 180 325V15C180 12.2386 177.761 10 175 10H170V325C170 327.761 167.761 330 165 330H160V0H175C183.284 0 190 6.71573 190 15V350H0V0ZM10 325C10 333.284 16.7157 340 25 340C33.2843 340 40 333.284 40 325V300H30V325C30 327.761 27.7615 330 25 330C22.2385 330 20 327.761 20 325V15C20 12.2386 17.7615 10 15 10H10V325ZM60 15V30H50V15C50 12.2386 52.2385 10 55 10C57.7615 10 60 12.2386 60 15ZM95 30H90V10H95C97.7615 10 100 12.2386 100 15V25C100 27.7614 97.7615 30 95 30Z", fill: "black" })), h("h2", { slot: "title" }, "Lorem Ipsum"), h("h3", { slot: "details" }, "The standard Lorem Ipsum passage, used since the 1500s"), h("div", { slot: "details" }, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")));
|
|
14
14
|
};
|
|
15
15
|
export const MgIllustratedMessage = Template.bind({});
|
|
16
16
|
MgIllustratedMessage.args = {
|
|
17
17
|
size: 'regular',
|
|
18
|
+
direction: 'vertical',
|
|
18
19
|
};
|