@mgdis/mg-components 3.1.0 → 3.2.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/css-shim-629916b0.js +6 -0
- package/dist/cjs/index-369388eb.js +146 -0
- package/dist/cjs/{index-85a4a0b6.js → index-bead7dbd.js} +78 -2
- package/dist/cjs/loader.cjs.js +4 -4
- package/dist/cjs/mg-badge_21.cjs.entry.js +3313 -0
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/cjs/mg-modal.cjs.entry.js +111 -0
- package/dist/cjs/mg-popover.cjs.entry.js +165 -0
- package/dist/cjs/popper-0c3964e7.js +1786 -0
- package/dist/cjs/{shadow-css-8940f82d.js → shadow-css-546083ef.js} +1 -1
- package/dist/collection/collection-manifest.json +4 -1
- package/dist/collection/components/atoms/mg-badge/mg-badge.conf.js +1 -1
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +11 -7
- package/dist/collection/components/atoms/mg-badge/mg-badge.stories.js +3 -0
- package/dist/collection/components/atoms/mg-button/mg-button.css +26 -17
- package/dist/collection/components/atoms/mg-button/mg-button.js +71 -2
- package/dist/collection/components/atoms/mg-button/mg-button.stories.js +5 -0
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +12 -1
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.stories.js +8 -0
- package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +8 -0
- package/dist/collection/components/atoms/mg-icon/mg-icon.css +5 -7
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +11 -1
- 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.js +10 -3
- package/dist/collection/components/atoms/mg-tag/mg-tag.stories.js +3 -0
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +9 -0
- package/dist/collection/components/molecules/inputs/MgInput.js +20 -14
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +9 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +103 -40
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.stories.js +6 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +27 -0
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +125 -56
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.stories.js +6 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +27 -0
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +144 -68
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.stories.js +6 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +27 -0
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +101 -35
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.stories.js +6 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +9 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +115 -37
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.stories.js +6 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +28 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +132 -51
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.stories.js +14 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +27 -0
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +155 -53
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.stories.js +7 -2
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +27 -0
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +108 -42
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.stories.js +7 -2
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +4 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +60 -31
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.stories.js +6 -1
- package/dist/collection/components/molecules/mg-form/mg-form.css +15 -0
- package/dist/collection/components/molecules/mg-form/mg-form.js +269 -0
- package/dist/collection/components/molecules/mg-form/mg-form.stories.js +58 -0
- package/dist/collection/components/molecules/mg-message/mg-message.css +1 -1
- package/dist/collection/components/molecules/mg-message/mg-message.js +11 -4
- package/dist/collection/components/molecules/mg-message/mg-message.stories.js +5 -1
- package/dist/collection/components/molecules/mg-modal/mg-modal.css +54 -0
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +233 -0
- package/dist/collection/components/molecules/mg-modal/mg-modal.stories.js +51 -0
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +32 -12
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.stories.js +1 -0
- package/dist/collection/components/molecules/mg-panel/mg-panel.css +42 -0
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +255 -0
- package/dist/collection/components/molecules/mg-panel/mg-panel.stories.js +31 -0
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +2 -2
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +19 -4
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +4 -1
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +14 -3
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +68 -20
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.stories.js +10 -1
- package/dist/collection/stories/messages.stories.js +1 -1
- package/dist/collection/utils/components.utils.js +16 -9
- package/dist/collection/utils/locale.utils.js +6 -3
- package/dist/collection/utils/test.utils.js +27 -15
- package/dist/collection/variables.css +30 -1
- package/dist/collection/variables.scss +30 -1
- package/dist/components/MgInput.js +20 -14
- package/dist/components/components.utils.js +16 -9
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index2.js +22 -12
- package/dist/components/locale.utils.js +6 -3
- package/dist/components/mg-badge2.js +9 -5
- package/dist/components/mg-button2.js +21 -2
- package/dist/components/mg-character-left2.js +12 -1
- package/dist/components/mg-form.d.ts +11 -0
- package/dist/components/mg-form.js +146 -0
- package/dist/components/mg-icon2.js +20 -2
- package/dist/components/mg-input-checkbox.js +65 -36
- package/dist/components/mg-input-date.js +87 -52
- package/dist/components/mg-input-numeric.js +105 -63
- package/dist/components/mg-input-password.js +60 -29
- package/dist/components/mg-input-radio.js +74 -34
- package/dist/components/mg-input-select2.js +89 -46
- package/dist/components/mg-input-text.js +1 -237
- package/dist/components/mg-input-text2.js +288 -0
- package/dist/components/mg-input-textarea.js +67 -36
- package/dist/components/mg-input-title2.js +13 -4
- package/dist/components/mg-input-toggle.js +30 -22
- package/dist/components/mg-message.js +10 -3
- package/dist/components/mg-modal.d.ts +11 -0
- package/dist/components/mg-modal.js +147 -0
- package/dist/components/mg-pagination.js +31 -11
- package/dist/components/mg-panel.d.ts +11 -0
- package/dist/components/mg-panel.js +210 -0
- package/dist/components/mg-popover.js +20 -5
- package/dist/components/mg-tabs.js +43 -11
- package/dist/components/mg-tag.js +8 -1
- package/dist/components/mg-tooltip2.js +9 -0
- package/dist/esm/css-shim-0993aa3b.js +4 -0
- package/dist/esm/{index-e3e84606.js → index-9e877561.js} +78 -2
- package/dist/esm/index-c346f52d.js +139 -0
- package/dist/esm/loader.js +4 -4
- package/dist/esm/mg-badge_21.entry.js +3289 -0
- package/dist/esm/mg-components.js +3 -3
- package/dist/esm/mg-modal.entry.js +107 -0
- package/dist/esm/mg-popover.entry.js +161 -0
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/popper-8874fd6c.js +1784 -0
- package/dist/esm/{shadow-css-5d2d01ce.js → shadow-css-dfa0587f.js} +1 -1
- package/dist/esm-es5/css-shim-0993aa3b.js +1 -0
- package/dist/esm-es5/index-9e877561.js +1 -0
- package/dist/esm-es5/index-c346f52d.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mg-badge_21.entry.js +2 -0
- package/dist/esm-es5/mg-components.js +1 -1
- package/dist/esm-es5/mg-modal.entry.js +1 -0
- package/dist/esm-es5/mg-popover.entry.js +1 -0
- package/dist/esm-es5/popper-8874fd6c.js +1 -0
- package/dist/esm-es5/{shadow-css-5d2d01ce.js → shadow-css-dfa0587f.js} +0 -0
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/mg-components.js +2 -2
- package/dist/mg-components/p-3633e9e1.system.entry.js +2 -0
- package/dist/mg-components/p-3c14153d.js +1 -0
- package/dist/mg-components/p-55a22b35.system.js +1 -0
- package/dist/mg-components/{p-f6455ab3.js → p-5e796581.js} +0 -0
- package/dist/mg-components/p-656b5efb.system.js +1 -0
- package/dist/mg-components/p-68d6f104.js +1 -0
- package/dist/mg-components/{p-366a224e.js → p-6d49ed95.js} +1 -1
- package/dist/mg-components/p-70177194.entry.js +1 -0
- package/dist/mg-components/{p-71d57b8b.system.js → p-8b2d8a2a.system.js} +0 -0
- package/dist/mg-components/p-8cb61c3f.system.js +1 -0
- package/dist/mg-components/p-ace173b1.js +1 -0
- package/dist/mg-components/p-c46fbd54.entry.js +1 -0
- package/dist/mg-components/p-c90cc4bf.system.js +1 -0
- package/dist/mg-components/p-cd2a4acc.system.entry.js +1 -0
- package/dist/mg-components/p-de1164fa.system.entry.js +1 -0
- package/dist/mg-components/p-dfe25da3.entry.js +1 -0
- package/dist/mg-components/p-e4a502b5.system.js +1 -0
- package/dist/mg-components/variables.css +30 -1
- package/dist/mg-components/variables.scss +30 -1
- package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +8 -4
- package/dist/types/components/atoms/mg-badge/mg-badge.stories.d.ts +5 -0
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +22 -2
- package/dist/types/components/atoms/mg-button/mg-button.stories.d.ts +5 -0
- package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +13 -2
- package/dist/types/components/atoms/mg-character-left/mg-character-left.stories.d.ts +9 -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 +11 -1
- package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +11 -1
- package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +10 -3
- package/dist/types/components/atoms/mg-tag/mg-tag.stories.d.ts +5 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +11 -2
- package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +8 -0
- package/dist/types/components/molecules/inputs/MgInput.d.ts +5 -4
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +31 -11
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.stories.d.ts +5 -0
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +39 -14
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.stories.d.ts +5 -0
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +53 -14
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.stories.d.ts +5 -0
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +28 -9
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.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 +37 -8
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.stories.d.ts +5 -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 +30 -7
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.stories.d.ts +14 -0
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +46 -10
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.stories.d.ts +5 -0
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +30 -10
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.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 +27 -12
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.stories.d.ts +5 -0
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +82 -0
- package/dist/types/components/molecules/mg-form/mg-form.stories.d.ts +11 -0
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +11 -4
- package/dist/types/components/molecules/mg-message/mg-message.stories.d.ts +10 -0
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +83 -0
- package/dist/types/components/molecules/mg-modal/mg-modal.stories.d.ts +13 -0
- package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +23 -7
- package/dist/types/components/molecules/mg-pagination/mg-pagination.stories.d.ts +5 -0
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +110 -0
- package/dist/types/components/molecules/mg-panel/mg-panel.stories.d.ts +6 -0
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +18 -3
- package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +5 -0
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +21 -6
- package/dist/types/components/molecules/mg-tabs/mg-tabs.stories.d.ts +8 -0
- package/dist/types/components.d.ts +365 -78
- package/dist/types/locales/index.d.ts +15 -8
- package/dist/types/utils/components.utils.d.ts +16 -9
- package/dist/types/utils/locale.utils.d.ts +6 -3
- package/dist/types/utils/test.utils.d.ts +13 -1
- package/package.json +13 -9
- package/readme.md +3 -0
- package/dist/cjs/css-shim-a22512c4.js +0 -6
- package/dist/cjs/mg-badge_20.cjs.entry.js +0 -4661
- package/dist/esm/css-shim-7c240feb.js +0 -4
- package/dist/esm/mg-badge_20.entry.js +0 -4638
- package/dist/esm-es5/css-shim-7c240feb.js +0 -1
- package/dist/esm-es5/index-e3e84606.js +0 -1
- package/dist/esm-es5/mg-badge_20.entry.js +0 -2
- 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-422c429b.system.js +0 -1
- package/dist/mg-components/p-62fa3797.js +0 -1
- package/dist/mg-components/p-9a215712.system.js +0 -1
- package/dist/mg-components/p-cbf0464b.entry.js +0 -1
|
@@ -16,14 +16,17 @@
|
|
|
16
16
|
"./components/molecules/inputs/mg-input-text/mg-input-text.js",
|
|
17
17
|
"./components/molecules/inputs/mg-input-textarea/mg-input-textarea.js",
|
|
18
18
|
"./components/molecules/inputs/mg-input-toggle/mg-input-toggle.js",
|
|
19
|
+
"./components/molecules/mg-form/mg-form.js",
|
|
19
20
|
"./components/molecules/mg-message/mg-message.js",
|
|
21
|
+
"./components/molecules/mg-modal/mg-modal.js",
|
|
20
22
|
"./components/molecules/mg-pagination/mg-pagination.js",
|
|
23
|
+
"./components/molecules/mg-panel/mg-panel.js",
|
|
21
24
|
"./components/molecules/mg-popover/mg-popover.js",
|
|
22
25
|
"./components/molecules/mg-tabs/mg-tabs.js"
|
|
23
26
|
],
|
|
24
27
|
"compiler": {
|
|
25
28
|
"name": "@stencil/core",
|
|
26
|
-
"version": "2.
|
|
29
|
+
"version": "2.15.1",
|
|
27
30
|
"typescriptVersion": "4.5.4"
|
|
28
31
|
},
|
|
29
32
|
"collections": [],
|
|
@@ -6,13 +6,13 @@ export class MgBadge {
|
|
|
6
6
|
/**
|
|
7
7
|
* Define button variant
|
|
8
8
|
*/
|
|
9
|
-
this.variant = variants[
|
|
9
|
+
this.variant = variants[0]; // info
|
|
10
10
|
/**
|
|
11
11
|
* Component classes
|
|
12
12
|
*/
|
|
13
13
|
this.classList = new ClassList(['mg-badge']);
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
validateValue(newValue) {
|
|
16
16
|
if (`${newValue}`.match(/^(\d+|[?*!a-z])$/i) === null) {
|
|
17
17
|
throw new Error('<mg-badge> prop "value" must be interger or ponctuation character.');
|
|
18
18
|
}
|
|
@@ -29,14 +29,18 @@ export class MgBadge {
|
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Check if props are well configured on init
|
|
32
|
+
*
|
|
33
|
+
* @returns {void}
|
|
32
34
|
*/
|
|
33
35
|
componentWillLoad() {
|
|
34
|
-
this.
|
|
36
|
+
this.validateValue(this.value);
|
|
35
37
|
this.validateVariant(this.variant);
|
|
36
38
|
this.validateOutline(this.outline);
|
|
37
39
|
}
|
|
38
40
|
/**
|
|
39
41
|
* Render
|
|
42
|
+
*
|
|
43
|
+
* @returns {HTMLElement} HTML Element
|
|
40
44
|
*/
|
|
41
45
|
render() {
|
|
42
46
|
return (h("span", { class: this.classList.join() },
|
|
@@ -105,14 +109,14 @@ export class MgBadge {
|
|
|
105
109
|
"references": {}
|
|
106
110
|
},
|
|
107
111
|
"required": false,
|
|
108
|
-
"optional":
|
|
112
|
+
"optional": false,
|
|
109
113
|
"docs": {
|
|
110
114
|
"tags": [],
|
|
111
115
|
"text": "Define button variant"
|
|
112
116
|
},
|
|
113
117
|
"attribute": "variant",
|
|
114
118
|
"reflect": false,
|
|
115
|
-
"defaultValue": "variants[
|
|
119
|
+
"defaultValue": "variants[0]"
|
|
116
120
|
},
|
|
117
121
|
"outline": {
|
|
118
122
|
"type": "boolean",
|
|
@@ -123,7 +127,7 @@ export class MgBadge {
|
|
|
123
127
|
"references": {}
|
|
124
128
|
},
|
|
125
129
|
"required": false,
|
|
126
|
-
"optional":
|
|
130
|
+
"optional": false,
|
|
127
131
|
"docs": {
|
|
128
132
|
"tags": [],
|
|
129
133
|
"text": "Define if button is using outline style"
|
|
@@ -137,7 +141,7 @@ export class MgBadge {
|
|
|
137
141
|
}; }
|
|
138
142
|
static get watchers() { return [{
|
|
139
143
|
"propName": "value",
|
|
140
|
-
"methodName": "
|
|
144
|
+
"methodName": "validateValue"
|
|
141
145
|
}, {
|
|
142
146
|
"propName": "variant",
|
|
143
147
|
"methodName": "validateVariant"
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
position: relative;
|
|
6
6
|
display: inline-flex;
|
|
7
7
|
align-items: center;
|
|
8
|
+
column-gap: 0.6rem;
|
|
8
9
|
padding: calc((var(--default-size) - 0.2rem - var(--font-size) * var(--line-height)) / 2) 1.1rem;
|
|
9
10
|
min-height: var(--default-size);
|
|
10
11
|
box-sizing: border-box;
|
|
@@ -14,7 +15,11 @@
|
|
|
14
15
|
border-bottom-left-radius: var(--mg-button-border-radius-bottom-left, var(--mg-button-border-radius));
|
|
15
16
|
cursor: pointer;
|
|
16
17
|
background-image: none;
|
|
17
|
-
border: 0.1rem
|
|
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;
|
|
18
23
|
font-family: inherit;
|
|
19
24
|
text-decoration: none;
|
|
20
25
|
font-weight: normal;
|
|
@@ -23,14 +28,19 @@
|
|
|
23
28
|
}
|
|
24
29
|
.mg-button[disabled], .mg-button[aria-disabled], .mg-button.disabled {
|
|
25
30
|
opacity: var(--mg-button-disabled-opacity);
|
|
26
|
-
cursor:
|
|
31
|
+
cursor: default;
|
|
27
32
|
}
|
|
28
33
|
.mg-button.mg-button--icon {
|
|
29
34
|
padding: 0;
|
|
30
35
|
justify-content: center;
|
|
31
36
|
width: var(--default-size);
|
|
32
37
|
height: var(--default-size);
|
|
33
|
-
border-radius: var(--mg-button-icon-border-radius);
|
|
38
|
+
border-top-right-radius: var(--mg-button-border-radius-top-right, var(--mg-button-icon-border-radius));
|
|
39
|
+
border-top-left-radius: var(--mg-button-border-radius-top-left, var(--mg-button-icon-border-radius));
|
|
40
|
+
border-bottom-right-radius: var(--mg-button-border-radius-bottom-right, var(--mg-button-icon-border-radius));
|
|
41
|
+
border-bottom-left-radius: var(--mg-button-border-radius-bottom-left, var(--mg-button-icon-border-radius));
|
|
42
|
+
font-size: var(--font-size);
|
|
43
|
+
line-height: var(--font-size);
|
|
34
44
|
}
|
|
35
45
|
.mg-button.mg-button--primary {
|
|
36
46
|
border-color: hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l));
|
|
@@ -39,7 +49,7 @@
|
|
|
39
49
|
color: hsl(var(--mg-button-primary-font-color));
|
|
40
50
|
background: hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l));
|
|
41
51
|
/* IE FIX */
|
|
42
|
-
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) - 10%)));
|
|
52
|
+
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%)));
|
|
43
53
|
}
|
|
44
54
|
.mg-button.mg-button--primary:hover:not([disabled], [aria-disabled], .disabled), .mg-button.mg-button--primary:focus:not([disabled], [aria-disabled], .disabled), .mg-button.mg-button--primary:active:not([disabled], [aria-disabled], .disabled) {
|
|
45
55
|
background: hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l));
|
|
@@ -51,7 +61,7 @@
|
|
|
51
61
|
color: hsl(var(--mg-button-secondary-font-color));
|
|
52
62
|
background: hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l));
|
|
53
63
|
/* IE FIX */
|
|
54
|
-
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) - 10%)));
|
|
64
|
+
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%)));
|
|
55
65
|
}
|
|
56
66
|
.mg-button.mg-button--secondary:hover:not([disabled], [aria-disabled], .disabled), .mg-button.mg-button--secondary:focus:not([disabled], [aria-disabled], .disabled), .mg-button.mg-button--secondary:active:not([disabled], [aria-disabled], .disabled) {
|
|
57
67
|
background: hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l));
|
|
@@ -63,7 +73,7 @@
|
|
|
63
73
|
color: hsl(var(--color-neutral));
|
|
64
74
|
background: hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l));
|
|
65
75
|
/* IE FIX */
|
|
66
|
-
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) - 10%)));
|
|
76
|
+
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%)));
|
|
67
77
|
}
|
|
68
78
|
.mg-button.mg-button--danger:hover:not([disabled], [aria-disabled], .disabled), .mg-button.mg-button--danger:focus:not([disabled], [aria-disabled], .disabled), .mg-button.mg-button--danger:active:not([disabled], [aria-disabled], .disabled) {
|
|
69
79
|
background: hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l));
|
|
@@ -75,7 +85,7 @@
|
|
|
75
85
|
color: hsl(var(--color-danger));
|
|
76
86
|
background: hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l));
|
|
77
87
|
/* IE FIX */
|
|
78
|
-
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) - 10%)));
|
|
88
|
+
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%)));
|
|
79
89
|
}
|
|
80
90
|
.mg-button.mg-button--danger-alt:hover:not([disabled], [aria-disabled], .disabled), .mg-button.mg-button--danger-alt:focus:not([disabled], [aria-disabled], .disabled), .mg-button.mg-button--danger-alt:active:not([disabled], [aria-disabled], .disabled) {
|
|
81
91
|
background: hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l));
|
|
@@ -87,7 +97,7 @@
|
|
|
87
97
|
color: hsl(var(--color-neutral));
|
|
88
98
|
background: hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l));
|
|
89
99
|
/* IE FIX */
|
|
90
|
-
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) - 10%)));
|
|
100
|
+
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%)));
|
|
91
101
|
}
|
|
92
102
|
.mg-button.mg-button--info:hover:not([disabled], [aria-disabled], .disabled), .mg-button.mg-button--info:focus:not([disabled], [aria-disabled], .disabled), .mg-button.mg-button--info:active:not([disabled], [aria-disabled], .disabled) {
|
|
93
103
|
background: hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l));
|
|
@@ -99,28 +109,27 @@
|
|
|
99
109
|
.mg-button.mg-button--flat:hover:not([disabled], [aria-disabled], .disabled), .mg-button.mg-button--flat:focus:not([disabled], [aria-disabled], .disabled), .mg-button.mg-button--flat:active:not([disabled], [aria-disabled], .disabled) {
|
|
100
110
|
background: hsla(var(--color-dark), 0.1);
|
|
101
111
|
}
|
|
112
|
+
.mg-button mg-icon:only-child,
|
|
102
113
|
.mg-button ::slotted(mg-icon) {
|
|
103
114
|
display: inline-flex;
|
|
104
115
|
flex-shrink: 0;
|
|
105
116
|
line-height: 1;
|
|
106
117
|
margin: auto 0;
|
|
107
118
|
}
|
|
108
|
-
.mg-
|
|
109
|
-
display: flex;
|
|
110
|
-
align-items: baseline;
|
|
111
|
-
column-gap: 0.6rem;
|
|
112
|
-
}
|
|
113
|
-
.mg-button--loading > mg-icon {
|
|
119
|
+
.mg-button.mg-button--loading > mg-icon {
|
|
114
120
|
position: absolute;
|
|
115
121
|
left: 50%;
|
|
116
122
|
top: 50%;
|
|
117
123
|
transform: translate(-50%, -50%);
|
|
118
124
|
}
|
|
119
|
-
.mg-button--loading .mg-button__content {
|
|
125
|
+
.mg-button.mg-button--loading .mg-button__content {
|
|
120
126
|
opacity: 0;
|
|
121
127
|
}
|
|
122
|
-
|
|
123
|
-
|
|
128
|
+
|
|
129
|
+
.mg-button__content {
|
|
130
|
+
display: flex;
|
|
131
|
+
align-items: center;
|
|
132
|
+
column-gap: 0.6rem;
|
|
124
133
|
}
|
|
125
134
|
|
|
126
135
|
mg-button {
|
|
@@ -30,6 +30,15 @@ export class MgButton {
|
|
|
30
30
|
* Parent component have to remove the attribute 'disabled' when the process ends.
|
|
31
31
|
*/
|
|
32
32
|
this.disableOnClick = false;
|
|
33
|
+
/**
|
|
34
|
+
* Prop to set aria-expanded on button element
|
|
35
|
+
*/
|
|
36
|
+
this.expanded = false;
|
|
37
|
+
/**
|
|
38
|
+
* Option to set aria-haspopup
|
|
39
|
+
* The aria-haspopup state informs assistive technology users that there is a popup and the type of popup it is, but provides no interactivity.
|
|
40
|
+
*/
|
|
41
|
+
this.haspopup = false;
|
|
33
42
|
/**
|
|
34
43
|
* Define if button is loading, default to false.
|
|
35
44
|
* Trigger when button is clicked or key-up ['enter', 'space], then value change to true.
|
|
@@ -42,6 +51,9 @@ export class MgButton {
|
|
|
42
51
|
this.classList = new ClassList(['mg-button']);
|
|
43
52
|
/**
|
|
44
53
|
* Trigger actions onClick event
|
|
54
|
+
*
|
|
55
|
+
* @param {MouseEvent} event click event
|
|
56
|
+
* @returns {void}
|
|
45
57
|
*/
|
|
46
58
|
this.handleClick = (event) => {
|
|
47
59
|
if (this.disabled)
|
|
@@ -79,6 +91,8 @@ export class MgButton {
|
|
|
79
91
|
}
|
|
80
92
|
/**
|
|
81
93
|
* Check if props are well configured on init
|
|
94
|
+
*
|
|
95
|
+
* @returns {void}
|
|
82
96
|
*/
|
|
83
97
|
componentWillLoad() {
|
|
84
98
|
this.validateVariant(this.variant);
|
|
@@ -94,9 +108,11 @@ export class MgButton {
|
|
|
94
108
|
}
|
|
95
109
|
/**
|
|
96
110
|
* Render component
|
|
111
|
+
*
|
|
112
|
+
* @returns {HTMLElement} html element
|
|
97
113
|
*/
|
|
98
114
|
render() {
|
|
99
|
-
return (h("button", { id: this.identifier, class: this.classList.join(), "aria-label": this.label, "aria-disabled": this.disabled, onClick: this.handleClick },
|
|
115
|
+
return (h("button", { id: this.identifier, class: this.classList.join(), "aria-label": this.label, "aria-disabled": this.disabled, "aria-expanded": this.expanded, "aria-controls": this.controls, "aria-haspopup": this.haspopup, onClick: this.handleClick },
|
|
100
116
|
this.loading && h("mg-icon", { icon: "loader", spin: true }),
|
|
101
117
|
h("div", { class: "mg-button__content" },
|
|
102
118
|
h("slot", null))));
|
|
@@ -137,7 +153,7 @@ export class MgButton {
|
|
|
137
153
|
"references": {}
|
|
138
154
|
},
|
|
139
155
|
"required": false,
|
|
140
|
-
"optional":
|
|
156
|
+
"optional": false,
|
|
141
157
|
"docs": {
|
|
142
158
|
"tags": [],
|
|
143
159
|
"text": "Identifier is used for the element ID (id is a reserved prop in Stencil.js)\nIf not set, it will be created."
|
|
@@ -216,6 +232,59 @@ export class MgButton {
|
|
|
216
232
|
"attribute": "disable-on-click",
|
|
217
233
|
"reflect": false,
|
|
218
234
|
"defaultValue": "false"
|
|
235
|
+
},
|
|
236
|
+
"expanded": {
|
|
237
|
+
"type": "boolean",
|
|
238
|
+
"mutable": false,
|
|
239
|
+
"complexType": {
|
|
240
|
+
"original": "boolean",
|
|
241
|
+
"resolved": "boolean",
|
|
242
|
+
"references": {}
|
|
243
|
+
},
|
|
244
|
+
"required": false,
|
|
245
|
+
"optional": false,
|
|
246
|
+
"docs": {
|
|
247
|
+
"tags": [],
|
|
248
|
+
"text": "Prop to set aria-expanded on button element"
|
|
249
|
+
},
|
|
250
|
+
"attribute": "expanded",
|
|
251
|
+
"reflect": false,
|
|
252
|
+
"defaultValue": "false"
|
|
253
|
+
},
|
|
254
|
+
"controls": {
|
|
255
|
+
"type": "string",
|
|
256
|
+
"mutable": false,
|
|
257
|
+
"complexType": {
|
|
258
|
+
"original": "string",
|
|
259
|
+
"resolved": "string",
|
|
260
|
+
"references": {}
|
|
261
|
+
},
|
|
262
|
+
"required": false,
|
|
263
|
+
"optional": false,
|
|
264
|
+
"docs": {
|
|
265
|
+
"tags": [],
|
|
266
|
+
"text": "Prop to set aria-controls on button element"
|
|
267
|
+
},
|
|
268
|
+
"attribute": "controls",
|
|
269
|
+
"reflect": false
|
|
270
|
+
},
|
|
271
|
+
"haspopup": {
|
|
272
|
+
"type": "any",
|
|
273
|
+
"mutable": false,
|
|
274
|
+
"complexType": {
|
|
275
|
+
"original": "boolean | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'",
|
|
276
|
+
"resolved": "\"dialog\" | \"grid\" | \"listbox\" | \"menu\" | \"tree\" | boolean",
|
|
277
|
+
"references": {}
|
|
278
|
+
},
|
|
279
|
+
"required": false,
|
|
280
|
+
"optional": false,
|
|
281
|
+
"docs": {
|
|
282
|
+
"tags": [],
|
|
283
|
+
"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."
|
|
284
|
+
},
|
|
285
|
+
"attribute": "haspopup",
|
|
286
|
+
"reflect": false,
|
|
287
|
+
"defaultValue": "false"
|
|
219
288
|
}
|
|
220
289
|
}; }
|
|
221
290
|
static get states() { return {
|
|
@@ -8,6 +8,9 @@ export default {
|
|
|
8
8
|
variant: {
|
|
9
9
|
options: variants,
|
|
10
10
|
control: { type: 'select' },
|
|
11
|
+
table: {
|
|
12
|
+
defaultValue: { summary: variants[0] },
|
|
13
|
+
},
|
|
11
14
|
},
|
|
12
15
|
},
|
|
13
16
|
};
|
|
@@ -31,6 +34,8 @@ MgButton.args = {
|
|
|
31
34
|
disabled: false,
|
|
32
35
|
disableOnClick: false,
|
|
33
36
|
isIcon: false,
|
|
37
|
+
expanded: false,
|
|
38
|
+
controls: undefined,
|
|
34
39
|
};
|
|
35
40
|
export const IsIcon = Template.bind({});
|
|
36
41
|
IsIcon.args = Object.assign(Object.assign({}, MgButton.args), { isIcon: true, slot: h("mg-icon", { icon: Object.keys(icons)[0] }) });
|
|
@@ -17,7 +17,8 @@ export class MgCharacterLeft {
|
|
|
17
17
|
this.characters = '';
|
|
18
18
|
/**
|
|
19
19
|
* Calculate number character left
|
|
20
|
-
*
|
|
20
|
+
*
|
|
21
|
+
* @returns {string} message
|
|
21
22
|
*/
|
|
22
23
|
this.getMessage = () => {
|
|
23
24
|
return this.template.replace(this.mustacheCounter, `<strong>${this.maxlength - this.characters.length}</strong>`);
|
|
@@ -36,10 +37,20 @@ export class MgCharacterLeft {
|
|
|
36
37
|
/*************
|
|
37
38
|
* Lifecycle *
|
|
38
39
|
*************/
|
|
40
|
+
/**
|
|
41
|
+
* Check if props are well configured on init
|
|
42
|
+
*
|
|
43
|
+
* @returns {void}
|
|
44
|
+
*/
|
|
39
45
|
componentWillLoad() {
|
|
40
46
|
this.validateTemplate(this.template);
|
|
41
47
|
this.validateMaxlength(this.maxlength);
|
|
42
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Render component
|
|
51
|
+
*
|
|
52
|
+
* @returns {HTMLElement} HTML Element
|
|
53
|
+
*/
|
|
43
54
|
render() {
|
|
44
55
|
return h("span", { id: this.identifier, innerHTML: this.getMessage(), "aria-live": "polite" });
|
|
45
56
|
}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
|
+
import { messages } from '../../../locales';
|
|
2
3
|
export default {
|
|
3
4
|
component: 'mg-character-left',
|
|
4
5
|
title: 'Atoms/mg-character-left',
|
|
6
|
+
argTypes: {
|
|
7
|
+
template: {
|
|
8
|
+
table: {
|
|
9
|
+
defaultValue: { summary: messages.nbCharLeft },
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
5
13
|
};
|
|
6
14
|
const Template = args => h("mg-character-left", Object.assign({}, args));
|
|
7
15
|
export const MgCharacterLeft = Template.bind({});
|
|
@@ -7,6 +7,7 @@ export const icons = {
|
|
|
7
7
|
'arrow-left': () => (h("path", { fill: "currentColor", d: "M5.88,12.93V10.18a.3.3,0,0,1,.28-.32H15a.31.31,0,0,0,.29-.33h0V6.32A.31.31,0,0,0,15,6H6.17a.32.32,0,0,1-.29-.31h0V2.93a.3.3,0,0,0-.28-.32.32.32,0,0,0-.23.09L.79,7.76a.36.36,0,0,0,0,.46l4.58,5a.31.31,0,0,0,.43,0A.4.4,0,0,0,5.88,12.93Z" })),
|
|
8
8
|
'arrow-right': () => (h("path", { fill: "currentColor", d: "M10.16,3V5.75a.3.3,0,0,1-.28.32H1a.31.31,0,0,0-.29.33h0V9.61A.31.31,0,0,0,1,9.94H9.87a.29.29,0,0,1,.29.31h0V13a.3.3,0,0,0,.28.32.32.32,0,0,0,.23-.09l4.58-5.06a.36.36,0,0,0,0-.46l-4.58-5a.3.3,0,0,0-.42,0C10.16,2.76,10.16,2.87,10.16,3Z" })),
|
|
9
9
|
'arrow-up': () => (h("path", { fill: "currentColor", d: "M3.06,5.82H5.81a.31.31,0,0,1,.32.28h0V15a.31.31,0,0,0,.33.29H9.67A.3.3,0,0,0,10,15h0V6.11a.3.3,0,0,1,.31-.29h2.75a.3.3,0,0,0,.23-.51L8.23.73a.36.36,0,0,0-.46,0l-5,4.58a.3.3,0,0,0,0,.43C2.82,5.83,2.92,5.82,3.06,5.82Z" })),
|
|
10
|
+
'arrow-up-right-square': () => (h("path", { fill: "currentColor", d: "M14.33 3v10A1.34 1.34 0 0 1 13 14.33H3A1.34 1.34 0 0 1 1.67 13V3A1.34 1.34 0 0 1 3 1.67h10A1.34 1.34 0 0 1 14.33 3Zm-2.48.46H8.68a.67.67 0 0 0-.68.7.63.63 0 0 0 .2.47l.91.91-5.53 5.53a.33.33 0 0 0 0 .48l.87.87a.33.33 0 0 0 .48 0l5.53-5.52.91.9a.69.69 0 0 0 1 0 .71.71 0 0 0 .19-.48V4.15a.67.67 0 0 0-.67-.67Z" })),
|
|
10
11
|
'arrows-rotate': () => (h("path", { fill: "currentColor", d: "M2.3,7h3.4c0.3,0,0.6-0.3,0.6-0.6c0-0.1-0.1-0.3-0.2-0.4L5.1,4.9c1.7-1.6,4.4-1.5,6,0.2c0,0,0,0,0,0 c0.5,0.5,0.8,1.2,1,1.9h2.1C13.7,3.5,10.4,1.2,7,1.8C5.7,2,4.6,2.6,3.6,3.4L2.7,2.5c-0.2-0.2-0.6-0.2-0.8,0c0,0,0,0,0,0l0,0 C1.8,2.6,1.7,2.8,1.7,2.9v3.4C1.7,6.7,1.9,7,2.3,7z M13.7,9h-3.4C9.9,9,9.7,9.3,9.7,9.6c0,0.2,0.1,0.3,0.2,0.4l1.1,1.1 c-1.7,1.6-4.4,1.5-6-0.2C4.4,10.4,4,9.7,3.8,9H1.7c0.6,3.5,3.9,5.8,7.3,5.2c1.3-0.2,2.4-0.8,3.3-1.7l0.9,0.9c0.2,0.2,0.6,0.2,0.8,0 c0,0,0,0,0,0l0,0c0.1-0.1,0.2-0.3,0.2-0.4V9.6C14.3,9.3,14.1,9,13.7,9z" })),
|
|
11
12
|
'ban': () => (h("path", { fill: "currentColor", d: "M8 .67A7.33 7.33 0 1 0 15.33 8 7.33 7.33 0 0 0 8 .67Zm3.85 3.48a5.46 5.46 0 0 1 .61 7L4.88 3.54a5.46 5.46 0 0 1 6.97.61Zm-7.7 7.7a5.45 5.45 0 0 1-.61-7l7.58 7.58a5.46 5.46 0 0 1-7-.61Z" })),
|
|
12
13
|
'calculator': () => (h("path", { fill: "currentColor", d: "M12.83.67H3.17a.5.5 0 0 0-.5.5v13.66a.5.5 0 0 0 .5.5h9.66a.5.5 0 0 0 .5-.5V1.17a.5.5 0 0 0-.5-.5ZM5.58 13.39a.29.29 0 0 1-.28.3H4.1a.29.29 0 0 1-.3-.28v-1.2a.29.29 0 0 1 .28-.3h1.2a.29.29 0 0 1 .3.28v1.2Zm0-3.28a.29.29 0 0 1-.3.3H4.1a.29.29 0 0 1-.3-.3V8.93a.29.29 0 0 1 .28-.3h1.2a.29.29 0 0 1 .3.28v1.2Zm3.29 3.28a.29.29 0 0 1-.3.3H7.38a.29.29 0 0 1-.3-.3v-1.18a.29.29 0 0 1 .3-.3h1.19a.29.29 0 0 1 .3.3Zm0-3.28a.32.32 0 0 1-.3.3H7.38a.32.32 0 0 1-.3-.3V8.93a.29.29 0 0 1 .3-.3h1.19a.29.29 0 0 1 .3.3Zm3.33 3.28a.29.29 0 0 1-.28.3h-1.25a.29.29 0 0 1-.3-.28V8.93a.29.29 0 0 1 .28-.3h1.25a.29.29 0 0 1 .3.28v4.48Zm0-7.15a.29.29 0 0 1-.3.3H4.1a.29.29 0 0 1-.3-.3V2.61a.29.29 0 0 1 .28-.3h7.82a.29.29 0 0 1 .3.28v3.65Z" })),
|
|
@@ -33,6 +34,7 @@ export const icons = {
|
|
|
33
34
|
h("path", { fill: "currentColor", class: "loader__full-circle", d: "M8 2.67A5.33 5.33 0 1 1 2.67 8 5.33 5.33 0 0 1 8 2.67m0-2A7.33 7.33 0 1 0 15.33 8 7.33 7.33 0 0 0 8 .67Z" }),
|
|
34
35
|
h("path", { fill: "currentColor", d: "M8 2.67v-2A7.33 7.33 0 0 0 .67 8h2A5.33 5.33 0 0 1 8 2.67Z" }),
|
|
35
36
|
],
|
|
37
|
+
'log-in': () => (h("path", { fill: "currentColor", d: "M10.97,7.78h0L6.97,3.78c-.12-.12-.31-.12-.42,0h0c-.07,.06-.12,.15-.13,.24v2.07c0,.17-.13,.3-.3,.32H1.97c-.16,0-.29,.12-.3,.28h0v2.58c0,.16,.12,.29,.28,.3H6.11c.17,0,.3,.14,.3,.31v2.14c0,.16,.12,.29,.28,.3h0c.11,.01,.21-.03,.28-.11l4-4c.11-.12,.11-.3,0-.42Zm3.37,5.26h0v1c0,.16-.13,.28-.28,.28h-4.77c-.16,0-.28-.13-.28-.28v-1c0-.16,.13-.28,.28-.28h3.43V3.3h-3.42c-.16,0-.29-.13-.29-.29V1.97c0-.16,.13-.29,.29-.29h4.76c.16,0,.29,.13,.29,.29v.68h0V13.04Z" })),
|
|
36
38
|
'log-out': () => [
|
|
37
39
|
h("path", { fill: "currentColor", d: "M14.25,7.77h0l-4-4a.31.31,0,0,0-.43,0A.34.34,0,0,0,9.7,4V6.07a.32.32,0,0,1-.3.32H5.23a.3.3,0,0,0-.3.3V9.25a.3.3,0,0,0,.3.3H9.4a.31.31,0,0,1,.3.31V12a.3.3,0,0,0,.3.3.33.33,0,0,0,.23-.09l4-4A.29.29,0,0,0,14.25,7.77Z" }),
|
|
38
40
|
h("path", { fill: "currentColor", d: "M6.71,12.72H3.27V3.26H6.69A.31.31,0,0,0,7,3V2a.3.3,0,0,0-.31-.3H2A.29.29,0,0,0,1.67,2h0V3h0V14a.27.27,0,0,0,.1.24h0a.32.32,0,0,0,.14.08H6.71A.3.3,0,0,0,7,14V13A.3.3,0,0,0,6.71,12.72Z" }),
|
|
@@ -40,7 +42,13 @@ export const icons = {
|
|
|
40
42
|
'magnifying-glass': () => (h("path", { fill: "currentColor", d: "M11.24,9.52A5.17,5.17,0,0,0,9.51,2.41l-.17-.09A5.18,5.18,0,0,0,4,11.18a5.16,5.16,0,0,0,5.54.11L12.3,14a1,1,0,0,0,1.41,0l.33-.33a1,1,0,0,0,0-1.41Zm-4.4.5A3.19,3.19,0,1,1,10,6.8v.06A3.19,3.19,0,0,1,6.84,10Z" })),
|
|
41
43
|
'paper-plane': () => (h("path", { fill: "currentColor", d: "M14 1.69 1.84 7a.28.28 0 0 0-.15.36.29.29 0 0 0 .16.15l3.27 1.82a.57.57 0 0 0 .61-.06l6.45-5.57c.05 0 .15-.1.19-.06s0 .14-.06.18l-5.59 6.29a.52.52 0 0 0 0 .63l2.09 3.44a.28.28 0 0 0 .37.12.3.3 0 0 0 .13-.12l5-12.11a.3.3 0 0 0-.14-.37.28.28 0 0 0-.17-.01Z" })),
|
|
42
44
|
'paper-plane-slash': () => (h("path", { fill: "currentColor", d: "M2.67,1.69,14.26,13.28l-1,1-2.79-2.8-1.1,2.67a.3.3,0,0,1-.13.12.28.28,0,0,1-.37-.12L6.75,10.74a.52.52,0,0,1,0-.63L7.82,8.9l-.76-.76L5.76,9.27a.57.57,0,0,1-.61.06L1.88,7.51a.29.29,0,0,1-.16-.15A.28.28,0,0,1,1.87,7L4.68,5.76l-3-3Zm11.53,0a.28.28,0,0,0-.22,0L7.53,4.51,9.26,6.24l3-2.54s.15-.1.19-.06,0,.14-.06.18L9.75,6.73l1.88,1.88,2.71-6.54A.3.3,0,0,0,14.2,1.7Z" })),
|
|
45
|
+
'pen': () => (h("path", { fill: "currentColor", d: "M1.67,11.69v2.64h2.64l7.78-7.78-2.64-2.64L1.67,11.69ZM14.13,4.51c.27-.28,.27-.72,0-1h0l-1.65-1.64c-.28-.27-.72-.27-1,0h0l-1.28,1.29,2.64,2.64,1.29-1.29Z" })),
|
|
46
|
+
'pen-fancy': () => (h("path", { fill: "currentColor", d: "M3.63,8.65c-.24,.07-.43,.26-.5,.5l-1.46,4.37,.11,.12,2.3-2.3c0-.06,0-.13,0-.19,0-.44,.35-.8,.79-.81,.44,0,.8,.35,.81,.79,0,.44-.35,.8-.79,.81,0,0-.01,0-.02,0h-.19l-2.3,2.3,.12,.11,4.37-1.46c.24-.07,.43-.26,.5-.5l.82-2.08-2.49-2.48-2.07,.82ZM10.8,2.35L6.27,7.28l2.42,2.42,4.94-4.52c2.1-1.86-.99-4.92-2.83-2.83Z" })),
|
|
43
47
|
'plus-circle': () => (h("path", { fill: "currentColor", d: "M8,0.7C4,0.7,0.7,4,0.7,8S4,15.3,8,15.3S15.3,12,15.3,8l0,0C15.3,4,12,0.7,8,0.7 C8,0.7,8,0.7,8,0.7z M12.3,8.8c0,0.2-0.2,0.4-0.4,0.4H9.2v2.7c0,0.2-0.2,0.4-0.4,0.4H7.2c-0.2,0-0.4-0.2-0.3-0.4V9.2H4.1 C3.9,9.2,3.7,9,3.7,8.8V7.2c0-0.2,0.2-0.4,0.4-0.3h2.7V4.1c0-0.2,0.2-0.4,0.3-0.4h1.7c0.2,0,0.4,0.2,0.4,0.4v2.7h2.7 c0.2,0,0.4,0.2,0.4,0.3L12.3,8.8z" })),
|
|
48
|
+
'trash': () => [
|
|
49
|
+
h("path", { fill: "currentColor", d: "M11.5,14.8h-7 c-0.6,0-1.1-0.5-1.1-1.1V4.4h9.3v9.2C12.6,14.2,12.1,14.8,11.5,14.8 M6.9,6.8c0-0.3-0.3-0.6-0.6-0.6S5.8,6.5,5.8,6.8v5.2 c0,0.3,0.3,0.6,0.6,0.6s0.6-0.3,0.6-0.6V6.8z M10.3,6.8c0-0.3-0.3-0.6-0.6-0.6S9.2,6.5,9.2,6.8v5.2c0,0.3,0.3,0.6,0.6,0.6 s0.6-0.3,0.6-0.6V6.8z" }),
|
|
50
|
+
h("path", { fill: "currentColor", d: "M13,2h-2.9L9.9,1.6 C9.8,1.4,9.6,1.2,9.4,1.2H6.6c-0.2,0-0.4,0.1-0.5,0.3L5.8,2H2.9C2.7,2,2.5,2.2,2.5,2.4c0,0,0,0,0,0v0.8c0,0.2,0.2,0.4,0.4,0.4H13 c0.2,0,0.4-0.2,0.4-0.4V2.4C13.4,2.2,13.2,2,13,2z" }),
|
|
51
|
+
],
|
|
44
52
|
'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" })),
|
|
45
53
|
'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" })),
|
|
46
54
|
};
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
vertical-align: middle;
|
|
4
|
+
}
|
|
5
|
+
|
|
1
6
|
.mg-icon[size=regular], .mg-icon.mg-icon--size-regular {
|
|
2
7
|
width: var(--mg-icon-regular-size);
|
|
3
8
|
height: var(--mg-icon-regular-size);
|
|
@@ -27,13 +32,6 @@
|
|
|
27
32
|
background-color: hsl(var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) + 20%));
|
|
28
33
|
}
|
|
29
34
|
|
|
30
|
-
mg-icon,
|
|
31
|
-
.mg-icon {
|
|
32
|
-
display: inline-block;
|
|
33
|
-
vertical-align: middle;
|
|
34
|
-
line-height: 1;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
35
|
/**
|
|
38
36
|
* Loader icon
|
|
39
37
|
**/
|
|
@@ -15,6 +15,12 @@ export class MgIcon {
|
|
|
15
15
|
* Component classes
|
|
16
16
|
*/
|
|
17
17
|
this.classList = new ClassList(['mg-icon']);
|
|
18
|
+
/**
|
|
19
|
+
* getIcon
|
|
20
|
+
*
|
|
21
|
+
* @returns {HTMLElement} icon html
|
|
22
|
+
*/
|
|
23
|
+
this.getIcon = () => icons[this.icon]();
|
|
18
24
|
}
|
|
19
25
|
validateIcon(newValue) {
|
|
20
26
|
if (!Object.keys(icons).includes(newValue)) {
|
|
@@ -43,6 +49,8 @@ export class MgIcon {
|
|
|
43
49
|
}
|
|
44
50
|
/**
|
|
45
51
|
* Check if props are well configured on init
|
|
52
|
+
*
|
|
53
|
+
* @returns {void}
|
|
46
54
|
*/
|
|
47
55
|
componentWillLoad() {
|
|
48
56
|
this.validateIcon(this.icon);
|
|
@@ -52,9 +60,11 @@ export class MgIcon {
|
|
|
52
60
|
}
|
|
53
61
|
/**
|
|
54
62
|
* Render component
|
|
63
|
+
*
|
|
64
|
+
* @returns {HTMLElement} HTML Element
|
|
55
65
|
*/
|
|
56
66
|
render() {
|
|
57
|
-
return (h("svg", { class: this.classList.join(), "aria-hidden": "true", focusable: "false", viewBox: "0 0 16 16" },
|
|
67
|
+
return (h("svg", { class: this.classList.join(), "aria-hidden": "true", focusable: "false", viewBox: "0 0 16 16" }, this.getIcon()));
|
|
58
68
|
}
|
|
59
69
|
static get is() { return "mg-icon"; }
|
|
60
70
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Not scoped into `mg-input-title` because it could be used outside of an input
|
|
3
|
-
* (ex: All input with a * are required)
|
|
4
|
-
*/
|
|
5
1
|
.is-asterisk {
|
|
6
2
|
color: hsl(var(--color-danger));
|
|
7
3
|
}
|
|
@@ -9,4 +5,8 @@
|
|
|
9
5
|
legend.mg-input-title {
|
|
10
6
|
padding-left: 0;
|
|
11
7
|
padding-right: 0;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.mg-input-title__required {
|
|
11
|
+
display: var(--mg-input-title-display, unset);
|
|
12
12
|
}
|
|
@@ -16,16 +16,27 @@ export class MgInputTitle {
|
|
|
16
16
|
/*************
|
|
17
17
|
* Lifecycle *
|
|
18
18
|
*************/
|
|
19
|
+
/**
|
|
20
|
+
* Init tag name
|
|
21
|
+
*
|
|
22
|
+
* @returns {void}
|
|
23
|
+
*/
|
|
19
24
|
componentWillLoad() {
|
|
20
|
-
// Init tag name
|
|
21
25
|
this.getTagName();
|
|
22
26
|
}
|
|
23
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Render
|
|
29
|
+
*
|
|
30
|
+
* @returns {HTMLElement} HTML Element
|
|
31
|
+
*/
|
|
24
32
|
render() {
|
|
25
33
|
const TagName = this.tagName;
|
|
34
|
+
// \u00A0 represent a
|
|
26
35
|
return (h(TagName, { class: "mg-input-title", htmlFor: this.isLegend ? undefined : this.identifier },
|
|
27
36
|
h("slot", null),
|
|
28
|
-
this.required &&
|
|
37
|
+
this.required && (h("span", { class: "mg-input-title__required" },
|
|
38
|
+
"\u00A0",
|
|
39
|
+
h("span", { class: "is-asterisk" }, "*")))));
|
|
29
40
|
}
|
|
30
41
|
static get is() { return "mg-input-title"; }
|
|
31
42
|
static get encapsulation() { return "scoped"; }
|
|
@@ -6,7 +6,7 @@ export class MgTag {
|
|
|
6
6
|
/**
|
|
7
7
|
* Define button variant
|
|
8
8
|
*/
|
|
9
|
-
this.variant = variants[0];
|
|
9
|
+
this.variant = variants[0]; // info
|
|
10
10
|
/**
|
|
11
11
|
* Component classes
|
|
12
12
|
*/
|
|
@@ -22,8 +22,13 @@ export class MgTag {
|
|
|
22
22
|
if (newValue)
|
|
23
23
|
this.classList.add(`mg-tag--outline`);
|
|
24
24
|
}
|
|
25
|
+
/*************
|
|
26
|
+
* Lifecycle *
|
|
27
|
+
*************/
|
|
25
28
|
/**
|
|
26
29
|
* Check if props are well configured on init
|
|
30
|
+
*
|
|
31
|
+
* @returns {void}
|
|
27
32
|
*/
|
|
28
33
|
componentWillLoad() {
|
|
29
34
|
this.validateVariant(this.variant);
|
|
@@ -31,6 +36,8 @@ export class MgTag {
|
|
|
31
36
|
}
|
|
32
37
|
/**
|
|
33
38
|
* Render
|
|
39
|
+
*
|
|
40
|
+
* @returns {HTMLElement} HTML Element
|
|
34
41
|
*/
|
|
35
42
|
render() {
|
|
36
43
|
return (h("span", { class: this.classList.join() },
|
|
@@ -54,7 +61,7 @@ export class MgTag {
|
|
|
54
61
|
"references": {}
|
|
55
62
|
},
|
|
56
63
|
"required": false,
|
|
57
|
-
"optional":
|
|
64
|
+
"optional": false,
|
|
58
65
|
"docs": {
|
|
59
66
|
"tags": [],
|
|
60
67
|
"text": "Define button variant"
|
|
@@ -72,7 +79,7 @@ export class MgTag {
|
|
|
72
79
|
"references": {}
|
|
73
80
|
},
|
|
74
81
|
"required": false,
|
|
75
|
-
"optional":
|
|
82
|
+
"optional": false,
|
|
76
83
|
"docs": {
|
|
77
84
|
"tags": [],
|
|
78
85
|
"text": "Define if button is using outline style"
|