@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
|
@@ -2,12 +2,17 @@ import { h } from '@stencil/core';
|
|
|
2
2
|
export default {
|
|
3
3
|
component: 'mg-input-text',
|
|
4
4
|
title: 'Molecules/Inputs/mg-input-text',
|
|
5
|
+
parameters: { actions: { handles: ['value-change', 'input-valid'] } },
|
|
5
6
|
};
|
|
6
7
|
/**
|
|
7
8
|
* 1. camelCase arguments must be written in the template, for exemple labelOnTop must be placed in the template as label-on-top={args.labelOnTop}
|
|
8
9
|
* 2. boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
|
|
10
|
+
*
|
|
11
|
+
* @param {any} args component arguments
|
|
12
|
+
* @returns {HTMLElement} HTMLElement
|
|
9
13
|
*/
|
|
10
|
-
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
+
const Template = (args) => {
|
|
11
16
|
const labelOnTop = args.labelOnTop;
|
|
12
17
|
delete args.labelOnTop;
|
|
13
18
|
const labelHide = args.labelHide;
|
|
@@ -21,7 +26,7 @@ const Template = args => {
|
|
|
21
26
|
const helpText = args.helpText;
|
|
22
27
|
delete args.helpText;
|
|
23
28
|
// return element
|
|
24
|
-
return (h("mg-input-text", Object.assign({}, args, { "label-on-top": labelOnTop, "label-hide": labelHide, "pattern-error-message": patternErrorMessage, "display-character-left": displayCharacterLeft, "character-left-template": characterLeftTemplate, "help-text": helpText })));
|
|
29
|
+
return (h("mg-input-text", Object.assign({}, args, { "label-on-top": labelOnTop, "label-hide": labelHide, "pattern-error-message": patternErrorMessage, "display-character-left": displayCharacterLeft ? 'true' : 'false', "character-left-template": characterLeftTemplate, "help-text": helpText })));
|
|
25
30
|
};
|
|
26
31
|
/**
|
|
27
32
|
* Global use
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
align-items: flex-start;
|
|
11
11
|
min-height: var(--default-size);
|
|
12
12
|
max-width: 100%;
|
|
13
|
+
margin-bottom: var(--mg-inputs-margin-bottom, 0);
|
|
13
14
|
/* Style when input is not valid */
|
|
14
15
|
/* Label */
|
|
15
16
|
/* Label-on-top */
|
|
@@ -96,6 +97,7 @@
|
|
|
96
97
|
*/
|
|
97
98
|
.mg-input__box {
|
|
98
99
|
padding: calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);
|
|
100
|
+
width: 100%;
|
|
99
101
|
height: var(--default-size);
|
|
100
102
|
box-sizing: border-box;
|
|
101
103
|
border-width: var(--mg-inputs-border-width);
|
|
@@ -145,6 +147,31 @@
|
|
|
145
147
|
display: none;
|
|
146
148
|
}
|
|
147
149
|
|
|
150
|
+
.mg-input.mg-input--label-on-top .mg-input__box {
|
|
151
|
+
width: auto;
|
|
152
|
+
max-width: 100%;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]) {
|
|
156
|
+
--mg-button-border-radius-top-right: 0;
|
|
157
|
+
--mg-button-border-radius-bottom-right: 0;
|
|
158
|
+
--mg-button-border-radius-top-left: 0;
|
|
159
|
+
/* IE FIX */
|
|
160
|
+
--mg-button-border-radius-bottom-left: 0;
|
|
161
|
+
/* IE FIX */
|
|
162
|
+
}
|
|
163
|
+
.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)) {
|
|
164
|
+
--mg-button-border-right-width: 0;
|
|
165
|
+
}
|
|
166
|
+
.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type) {
|
|
167
|
+
--mg-button-border-radius-top-right: var(--mg-inputs-border-radius);
|
|
168
|
+
--mg-button-border-radius-bottom-right: var(--mg-inputs-border-radius);
|
|
169
|
+
--mg-button-border-radius-top-left: 0;
|
|
170
|
+
/* IE FIX */
|
|
171
|
+
--mg-button-border-radius-bottom-left: 0;
|
|
172
|
+
/* IE FIX */
|
|
173
|
+
}
|
|
174
|
+
|
|
148
175
|
.mg-input.mg-input--is-append-input-slot-content:not(.mg-input--readonly) ::slotted([slot=append-input]) {
|
|
149
176
|
padding-top: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);
|
|
150
177
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Component, Event, h, Prop, State } from '@stencil/core';
|
|
1
|
+
import { Component, Event, h, Prop, State, Method, Watch } from '@stencil/core';
|
|
2
2
|
import { MgInput } from '../MgInput';
|
|
3
|
+
import { InputClass } from '../MgInput.conf';
|
|
3
4
|
import { createID, ClassList } from '../../../../utils/components.utils';
|
|
4
5
|
import { messages } from '../../../../locales';
|
|
5
|
-
import { InputClass } from '../MgInput.conf';
|
|
6
6
|
export class MgInputTextarea {
|
|
7
7
|
constructor() {
|
|
8
8
|
/************
|
|
@@ -61,9 +61,7 @@ export class MgInputTextarea {
|
|
|
61
61
|
* Handle input event
|
|
62
62
|
*/
|
|
63
63
|
this.handleInput = () => {
|
|
64
|
-
this.checkValidity();
|
|
65
64
|
this.value = this.input.value;
|
|
66
|
-
this.valueChange.emit(this.value);
|
|
67
65
|
};
|
|
68
66
|
/**
|
|
69
67
|
* Handle focus event
|
|
@@ -86,9 +84,45 @@ export class MgInputTextarea {
|
|
|
86
84
|
/**
|
|
87
85
|
* Get pattern validity
|
|
88
86
|
* Pattern is not defined on textarea field : https://developer.mozilla.org/fr/docs/Web/HTML/Element/Textarea
|
|
89
|
-
*
|
|
87
|
+
*
|
|
88
|
+
* @returns {boolean} is pattern valid
|
|
90
89
|
*/
|
|
91
90
|
this.getPatternValidity = () => this.pattern === undefined || new RegExp(`^${this.pattern}$`, 'u').test(this.value);
|
|
91
|
+
/**
|
|
92
|
+
* Check if input is valid
|
|
93
|
+
*/
|
|
94
|
+
this.checkValidity = () => {
|
|
95
|
+
if (!this.readonly && this.input !== undefined) {
|
|
96
|
+
const validity = this.input.checkValidity && this.input.checkValidity() && this.getPatternValidity();
|
|
97
|
+
// Set validity
|
|
98
|
+
this.valid = validity;
|
|
99
|
+
this.invalid = !validity;
|
|
100
|
+
//Send event
|
|
101
|
+
this.inputValid.emit(validity);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Check input errors
|
|
106
|
+
*/
|
|
107
|
+
this.checkError = () => {
|
|
108
|
+
// Set error message
|
|
109
|
+
this.errorMessage = undefined;
|
|
110
|
+
// Does not match pattern
|
|
111
|
+
if (!this.valid && !this.getPatternValidity()) {
|
|
112
|
+
this.errorMessage = this.patternErrorMessage;
|
|
113
|
+
}
|
|
114
|
+
// required
|
|
115
|
+
else if (!this.valid && this.input.validity.valueMissing) {
|
|
116
|
+
this.errorMessage = messages.errors.required;
|
|
117
|
+
}
|
|
118
|
+
// Update class
|
|
119
|
+
if (this.valid) {
|
|
120
|
+
this.classList.delete(this.classError);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
this.classList.add(this.classError);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
92
126
|
/**
|
|
93
127
|
* Validate pattern configuration
|
|
94
128
|
*/
|
|
@@ -101,49 +135,41 @@ export class MgInputTextarea {
|
|
|
101
135
|
}
|
|
102
136
|
};
|
|
103
137
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
checkValidity() {
|
|
108
|
-
if (!this.readonly && this.input !== undefined) {
|
|
109
|
-
const patternValidity = this.getPatternValidity();
|
|
110
|
-
const validity = this.input.checkValidity && this.input.checkValidity() && patternValidity;
|
|
111
|
-
// Set validity
|
|
112
|
-
this.valid = validity;
|
|
113
|
-
this.invalid = !validity;
|
|
114
|
-
}
|
|
138
|
+
handleValue(newValue) {
|
|
139
|
+
this.checkValidity();
|
|
140
|
+
this.valueChange.emit(newValue);
|
|
115
141
|
}
|
|
116
142
|
/**
|
|
117
|
-
*
|
|
143
|
+
* Public method to display errors
|
|
144
|
+
*
|
|
145
|
+
* @returns {Promise<void>}
|
|
118
146
|
*/
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
this.errorMessage = undefined;
|
|
123
|
-
if (!this.valid && !patternValidity) {
|
|
124
|
-
this.errorMessage = this.patternErrorMessage;
|
|
125
|
-
}
|
|
126
|
-
// required
|
|
127
|
-
else if (!this.valid && this.input.validity.valueMissing) {
|
|
128
|
-
this.errorMessage = messages.errors.required;
|
|
129
|
-
}
|
|
130
|
-
// Update class
|
|
131
|
-
if (this.valid) {
|
|
132
|
-
this.classList.delete(this.classError);
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
this.classList.add(this.classError);
|
|
136
|
-
}
|
|
147
|
+
async displayError() {
|
|
148
|
+
this.checkValidity();
|
|
149
|
+
this.checkError();
|
|
137
150
|
}
|
|
138
151
|
/*************
|
|
139
152
|
* Lifecycle *
|
|
140
153
|
*************/
|
|
154
|
+
/**
|
|
155
|
+
* Check if component props are well configured on init
|
|
156
|
+
*
|
|
157
|
+
* @returns {ReturnType<typeof setTimeout>} timeout
|
|
158
|
+
*/
|
|
141
159
|
componentWillLoad() {
|
|
142
160
|
this.validatePattern();
|
|
161
|
+
// Check validity when component is ready
|
|
143
162
|
// return a promise to process action only in the FIRST render().
|
|
144
163
|
// https://stenciljs.com/docs/component-lifecycle#componentwillload
|
|
145
|
-
return setTimeout(() =>
|
|
164
|
+
return setTimeout(() => {
|
|
165
|
+
this.checkValidity();
|
|
166
|
+
}, 0);
|
|
146
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
* Render
|
|
170
|
+
*
|
|
171
|
+
* @returns {HTMLElement} HTML Element
|
|
172
|
+
*/
|
|
147
173
|
render() {
|
|
148
174
|
return (h(MgInput, { identifier: this.identifier, classList: this.classList, label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, width: this.width, disabled: this.disabled, value: this.value, readonlyValue: undefined, tooltip: this.tooltip, displayCharacterLeft: this.displayCharacterLeft, characterLeftTemplate: this.characterLeftTemplate, maxlength: this.maxlength, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false },
|
|
149
175
|
h("textarea", { class: "mg-input__box", value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, rows: this.rows, maxlength: this.maxlength, disabled: this.disabled, required: this.required, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: el => (this.input = el) })));
|
|
@@ -183,7 +209,7 @@ export class MgInputTextarea {
|
|
|
183
209
|
"references": {}
|
|
184
210
|
},
|
|
185
211
|
"required": false,
|
|
186
|
-
"optional":
|
|
212
|
+
"optional": false,
|
|
187
213
|
"docs": {
|
|
188
214
|
"tags": [],
|
|
189
215
|
"text": "Identifier is used for the element ID (id is a reserved prop in Stencil.js)\nIf not set, it will be created."
|
|
@@ -201,7 +227,7 @@ export class MgInputTextarea {
|
|
|
201
227
|
"references": {}
|
|
202
228
|
},
|
|
203
229
|
"required": false,
|
|
204
|
-
"optional":
|
|
230
|
+
"optional": false,
|
|
205
231
|
"docs": {
|
|
206
232
|
"tags": [],
|
|
207
233
|
"text": "Input name\nIf not set the value equals the identifier"
|
|
@@ -222,7 +248,7 @@ export class MgInputTextarea {
|
|
|
222
248
|
"optional": false,
|
|
223
249
|
"docs": {
|
|
224
250
|
"tags": [],
|
|
225
|
-
"text": "Input label
|
|
251
|
+
"text": "Input label"
|
|
226
252
|
},
|
|
227
253
|
"attribute": "label",
|
|
228
254
|
"reflect": false
|
|
@@ -507,7 +533,7 @@ export class MgInputTextarea {
|
|
|
507
533
|
"optional": false,
|
|
508
534
|
"docs": {
|
|
509
535
|
"tags": [],
|
|
510
|
-
"text": "Define input
|
|
536
|
+
"text": "Define input valid state"
|
|
511
537
|
},
|
|
512
538
|
"attribute": "valid",
|
|
513
539
|
"reflect": false
|
|
@@ -524,7 +550,7 @@ export class MgInputTextarea {
|
|
|
524
550
|
"optional": false,
|
|
525
551
|
"docs": {
|
|
526
552
|
"tags": [],
|
|
527
|
-
"text": "Define input
|
|
553
|
+
"text": "Define input invalid state"
|
|
528
554
|
},
|
|
529
555
|
"attribute": "invalid",
|
|
530
556
|
"reflect": false
|
|
@@ -542,12 +568,52 @@ export class MgInputTextarea {
|
|
|
542
568
|
"composed": true,
|
|
543
569
|
"docs": {
|
|
544
570
|
"tags": [],
|
|
545
|
-
"text": "
|
|
571
|
+
"text": "Emited event when value change"
|
|
546
572
|
},
|
|
547
573
|
"complexType": {
|
|
548
574
|
"original": "string",
|
|
549
575
|
"resolved": "string",
|
|
550
576
|
"references": {}
|
|
551
577
|
}
|
|
578
|
+
}, {
|
|
579
|
+
"method": "inputValid",
|
|
580
|
+
"name": "input-valid",
|
|
581
|
+
"bubbles": true,
|
|
582
|
+
"cancelable": true,
|
|
583
|
+
"composed": true,
|
|
584
|
+
"docs": {
|
|
585
|
+
"tags": [],
|
|
586
|
+
"text": "Emited event when checking validity"
|
|
587
|
+
},
|
|
588
|
+
"complexType": {
|
|
589
|
+
"original": "boolean",
|
|
590
|
+
"resolved": "boolean",
|
|
591
|
+
"references": {}
|
|
592
|
+
}
|
|
593
|
+
}]; }
|
|
594
|
+
static get methods() { return {
|
|
595
|
+
"displayError": {
|
|
596
|
+
"complexType": {
|
|
597
|
+
"signature": "() => Promise<void>",
|
|
598
|
+
"parameters": [],
|
|
599
|
+
"references": {
|
|
600
|
+
"Promise": {
|
|
601
|
+
"location": "global"
|
|
602
|
+
}
|
|
603
|
+
},
|
|
604
|
+
"return": "Promise<void>"
|
|
605
|
+
},
|
|
606
|
+
"docs": {
|
|
607
|
+
"text": "Public method to display errors",
|
|
608
|
+
"tags": [{
|
|
609
|
+
"name": "returns",
|
|
610
|
+
"text": undefined
|
|
611
|
+
}]
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
}; }
|
|
615
|
+
static get watchers() { return [{
|
|
616
|
+
"propName": "value",
|
|
617
|
+
"methodName": "handleValue"
|
|
552
618
|
}]; }
|
|
553
619
|
}
|
package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.stories.js
CHANGED
|
@@ -2,12 +2,17 @@ import { h } from '@stencil/core';
|
|
|
2
2
|
export default {
|
|
3
3
|
component: 'mg-input-textarea',
|
|
4
4
|
title: 'Molecules/Inputs/mg-input-textarea',
|
|
5
|
+
parameters: { actions: { handles: ['value-change', 'input-valid'] } },
|
|
5
6
|
};
|
|
6
7
|
/**
|
|
7
8
|
* 1. camelCase arguments must be written in the template, for exemple labelOnTop must be placed in the template as label-on-top={args.labelOnTop}
|
|
8
9
|
* 2. boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
|
|
10
|
+
*
|
|
11
|
+
* @param {any} args component arguments
|
|
12
|
+
* @returns {HTMLElement} HTMLElement
|
|
9
13
|
*/
|
|
10
|
-
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
+
const Template = (args) => {
|
|
11
16
|
const labelOnTop = args.labelOnTop;
|
|
12
17
|
delete args.labelOnTop;
|
|
13
18
|
const labelHide = args.labelHide;
|
|
@@ -21,7 +26,7 @@ const Template = args => {
|
|
|
21
26
|
const helpText = args.helpText;
|
|
22
27
|
delete args.helpText;
|
|
23
28
|
// return element
|
|
24
|
-
return (h("mg-input-textarea", Object.assign({}, args, { "label-on-top": labelOnTop, "label-hide": labelHide, "pattern-error-message": patternErrorMessage, "display-character-left": displayCharacterLeft, "character-left-template": characterLeftTemplate, "help-text": helpText })));
|
|
29
|
+
return (h("mg-input-textarea", Object.assign({}, args, { "label-on-top": labelOnTop, "label-hide": labelHide, "pattern-error-message": patternErrorMessage, "display-character-left": displayCharacterLeft ? 'true' : 'false', "character-left-template": characterLeftTemplate, "help-text": helpText })));
|
|
25
30
|
};
|
|
26
31
|
export const MgInputTextarea = Template.bind({});
|
|
27
32
|
MgInputTextarea.args = {
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
align-items: flex-start;
|
|
11
11
|
min-height: var(--default-size);
|
|
12
12
|
max-width: 100%;
|
|
13
|
+
margin-bottom: var(--mg-inputs-margin-bottom, 0);
|
|
13
14
|
/* Style when input is not valid */
|
|
14
15
|
/* Label */
|
|
15
16
|
/* Label-on-top */
|
|
@@ -128,6 +129,9 @@
|
|
|
128
129
|
line-height: inherit;
|
|
129
130
|
cursor: pointer;
|
|
130
131
|
}
|
|
132
|
+
.mg-input__button-toggle:disabled {
|
|
133
|
+
cursor: default;
|
|
134
|
+
}
|
|
131
135
|
|
|
132
136
|
.mg-input__toggle-item-container {
|
|
133
137
|
padding: 0.5rem 0.9rem;
|
|
@@ -209,5 +213,4 @@
|
|
|
209
213
|
|
|
210
214
|
.mg-input.mg-input--toggle-disabled .mg-input__button-toggle {
|
|
211
215
|
opacity: 0.3;
|
|
212
|
-
cursor: not-allowed;
|
|
213
216
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1
3
|
import { Component, Event, h, Prop, State, Watch, Element } from '@stencil/core';
|
|
2
4
|
import { MgInput } from '../MgInput';
|
|
3
5
|
import { createID, ClassList, allItemsAreString } from '../../../../utils/components.utils';
|
|
4
6
|
/**
|
|
5
7
|
* type Option validation function
|
|
6
|
-
*
|
|
7
|
-
* @
|
|
8
|
+
*
|
|
9
|
+
* @param {ToggleValue} option radio option
|
|
10
|
+
* @returns {boolean} toggle option type is valid
|
|
8
11
|
*/
|
|
9
12
|
const isOption = (option) => typeof option === 'object' && typeof option.title === 'string' && option.value !== undefined;
|
|
10
13
|
export class MgInputToggle {
|
|
@@ -56,12 +59,16 @@ export class MgInputToggle {
|
|
|
56
59
|
this.checked = false;
|
|
57
60
|
/**
|
|
58
61
|
* Change checked value
|
|
62
|
+
*
|
|
63
|
+
* @returns {void}
|
|
59
64
|
*/
|
|
60
65
|
this.toggleChecked = () => {
|
|
61
|
-
this.
|
|
66
|
+
this.checked = !this.checked;
|
|
62
67
|
};
|
|
63
68
|
/**
|
|
64
69
|
* Slots validation
|
|
70
|
+
*
|
|
71
|
+
* @returns {void}
|
|
65
72
|
*/
|
|
66
73
|
this.validateSlots = () => {
|
|
67
74
|
const slots = Array.from(this.element.children);
|
|
@@ -75,6 +82,12 @@ export class MgInputToggle {
|
|
|
75
82
|
}
|
|
76
83
|
};
|
|
77
84
|
}
|
|
85
|
+
handleValue(newValue) {
|
|
86
|
+
// Swich to the right option
|
|
87
|
+
this.setChecked();
|
|
88
|
+
// Emit value-change event
|
|
89
|
+
this.valueChange.emit(newValue);
|
|
90
|
+
}
|
|
78
91
|
validateItems(newValue) {
|
|
79
92
|
if (typeof newValue === 'object' && this.items.length !== 2) {
|
|
80
93
|
throw new Error('<mg-input-toggle> prop "items" require 2 items.');
|
|
@@ -118,14 +131,14 @@ export class MgInputToggle {
|
|
|
118
131
|
else
|
|
119
132
|
this.classList.delete(this.classIsActive);
|
|
120
133
|
// update value
|
|
121
|
-
this.value = this.options[
|
|
122
|
-
this.valueChange.emit(this.value);
|
|
134
|
+
this.value = this.options[newValue ? 1 : 0].value;
|
|
123
135
|
}
|
|
124
136
|
/**
|
|
125
137
|
* set checked state
|
|
126
|
-
*
|
|
138
|
+
*
|
|
139
|
+
* @returns {void}
|
|
127
140
|
*/
|
|
128
|
-
setChecked(
|
|
141
|
+
setChecked() {
|
|
129
142
|
// has "value" props type is not a boolean, it is bind/render as an attributes/props
|
|
130
143
|
// true props will be represent by "true" string so we convert it has boolean
|
|
131
144
|
// true attribute will be represent by "" string so we convert it has boolean
|
|
@@ -133,15 +146,7 @@ export class MgInputToggle {
|
|
|
133
146
|
if (['', 'true'].includes(this.value) && this.options.find(option => option.value) !== undefined) {
|
|
134
147
|
this.value = true;
|
|
135
148
|
}
|
|
136
|
-
|
|
137
|
-
this.checked = newValue;
|
|
138
|
-
}
|
|
139
|
-
else if (this.value === this.options[1].value) {
|
|
140
|
-
this.checked = true;
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
this.checked = false;
|
|
144
|
-
}
|
|
149
|
+
this.checked = this.value === this.options[1].value;
|
|
145
150
|
}
|
|
146
151
|
/*************
|
|
147
152
|
* Lifecycle *
|
|
@@ -152,6 +157,8 @@ export class MgInputToggle {
|
|
|
152
157
|
componentWillLoad() {
|
|
153
158
|
// Check items format
|
|
154
159
|
this.validateItems(this.items);
|
|
160
|
+
// Check slots
|
|
161
|
+
this.validateSlots();
|
|
155
162
|
// init checked value
|
|
156
163
|
this.setChecked();
|
|
157
164
|
// apply handler
|
|
@@ -159,14 +166,15 @@ export class MgInputToggle {
|
|
|
159
166
|
this.handleIsIcon(this.isIcon);
|
|
160
167
|
this.handleReadonly(this.readonly);
|
|
161
168
|
this.handleDisabled(this.disabled);
|
|
162
|
-
this.validateSlots();
|
|
163
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* Render
|
|
172
|
+
*
|
|
173
|
+
* @returns {HTMLElement} HTML Element
|
|
174
|
+
*/
|
|
164
175
|
render() {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
h("button", { type: "button", role: "switch", "aria-checked": this.checked, "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-input__button-toggle", disabled: this.disabled || this.readonly,
|
|
168
|
-
// eslint-disable-next-line react/jsx-no-bind
|
|
169
|
-
onClick: () => this.toggleChecked() },
|
|
176
|
+
return (h(MgInput, { identifier: this.identifier, classList: this.classList, label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, readonly: undefined, width: undefined, disabled: this.disabled, value: this.value, readonlyValue: undefined, tooltip: !this.readonly && this.tooltip, displayCharacterLeft: undefined, characterLeftTemplate: undefined, maxlength: undefined, helpText: this.helpText, errorMessage: undefined, isFieldset: false },
|
|
177
|
+
h("button", { type: "button", role: "switch", "aria-checked": this.checked, "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-input__button-toggle", disabled: this.disabled || this.readonly, onClick: this.toggleChecked },
|
|
170
178
|
h("span", { "aria-hidden": "true", class: "mg-input__toggle-item-container" },
|
|
171
179
|
h("slot", { name: "item-1" })),
|
|
172
180
|
h("span", { "aria-hidden": "true", class: "mg-input__toggle-item-container" },
|
|
@@ -190,7 +198,7 @@ export class MgInputToggle {
|
|
|
190
198
|
"references": {}
|
|
191
199
|
},
|
|
192
200
|
"required": false,
|
|
193
|
-
"optional":
|
|
201
|
+
"optional": false,
|
|
194
202
|
"docs": {
|
|
195
203
|
"tags": [],
|
|
196
204
|
"text": "Component value"
|
|
@@ -214,8 +222,11 @@ export class MgInputToggle {
|
|
|
214
222
|
"required": true,
|
|
215
223
|
"optional": false,
|
|
216
224
|
"docs": {
|
|
217
|
-
"tags": [
|
|
218
|
-
|
|
225
|
+
"tags": [{
|
|
226
|
+
"name": "returns",
|
|
227
|
+
"text": undefined
|
|
228
|
+
}],
|
|
229
|
+
"text": "Items are the possible options to select"
|
|
219
230
|
}
|
|
220
231
|
},
|
|
221
232
|
"identifier": {
|
|
@@ -227,7 +238,7 @@ export class MgInputToggle {
|
|
|
227
238
|
"references": {}
|
|
228
239
|
},
|
|
229
240
|
"required": false,
|
|
230
|
-
"optional":
|
|
241
|
+
"optional": false,
|
|
231
242
|
"docs": {
|
|
232
243
|
"tags": [],
|
|
233
244
|
"text": "Identifier is used for the element ID (id is a reserved prop in Stencil.js)\nIf not set, it will be created."
|
|
@@ -245,7 +256,7 @@ export class MgInputToggle {
|
|
|
245
256
|
"references": {}
|
|
246
257
|
},
|
|
247
258
|
"required": false,
|
|
248
|
-
"optional":
|
|
259
|
+
"optional": false,
|
|
249
260
|
"docs": {
|
|
250
261
|
"tags": [],
|
|
251
262
|
"text": "Input name\nIf not set the value equals the identifier"
|
|
@@ -266,7 +277,7 @@ export class MgInputToggle {
|
|
|
266
277
|
"optional": false,
|
|
267
278
|
"docs": {
|
|
268
279
|
"tags": [],
|
|
269
|
-
"text": "Input label
|
|
280
|
+
"text": "Input label"
|
|
270
281
|
},
|
|
271
282
|
"attribute": "label",
|
|
272
283
|
"reflect": false
|
|
@@ -315,7 +326,7 @@ export class MgInputToggle {
|
|
|
315
326
|
"references": {}
|
|
316
327
|
},
|
|
317
328
|
"required": false,
|
|
318
|
-
"optional":
|
|
329
|
+
"optional": false,
|
|
319
330
|
"docs": {
|
|
320
331
|
"tags": [],
|
|
321
332
|
"text": "Define if toggle have on/off style"
|
|
@@ -333,7 +344,7 @@ export class MgInputToggle {
|
|
|
333
344
|
"references": {}
|
|
334
345
|
},
|
|
335
346
|
"required": false,
|
|
336
|
-
"optional":
|
|
347
|
+
"optional": false,
|
|
337
348
|
"docs": {
|
|
338
349
|
"tags": [],
|
|
339
350
|
"text": "Define if toggle display icon"
|
|
@@ -426,16 +437,34 @@ export class MgInputToggle {
|
|
|
426
437
|
"composed": true,
|
|
427
438
|
"docs": {
|
|
428
439
|
"tags": [],
|
|
429
|
-
"text": "
|
|
440
|
+
"text": "Emited event when value change"
|
|
430
441
|
},
|
|
431
442
|
"complexType": {
|
|
432
443
|
"original": "any",
|
|
433
444
|
"resolved": "any",
|
|
434
445
|
"references": {}
|
|
435
446
|
}
|
|
447
|
+
}, {
|
|
448
|
+
"method": "inputValid",
|
|
449
|
+
"name": "input-valid",
|
|
450
|
+
"bubbles": true,
|
|
451
|
+
"cancelable": true,
|
|
452
|
+
"composed": true,
|
|
453
|
+
"docs": {
|
|
454
|
+
"tags": [],
|
|
455
|
+
"text": "Emited event when checking validity"
|
|
456
|
+
},
|
|
457
|
+
"complexType": {
|
|
458
|
+
"original": "boolean",
|
|
459
|
+
"resolved": "boolean",
|
|
460
|
+
"references": {}
|
|
461
|
+
}
|
|
436
462
|
}]; }
|
|
437
463
|
static get elementRef() { return "element"; }
|
|
438
464
|
static get watchers() { return [{
|
|
465
|
+
"propName": "value",
|
|
466
|
+
"methodName": "handleValue"
|
|
467
|
+
}, {
|
|
439
468
|
"propName": "items",
|
|
440
469
|
"methodName": "validateItems"
|
|
441
470
|
}, {
|
package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.stories.js
CHANGED
|
@@ -2,6 +2,7 @@ import { h } from '@stencil/core';
|
|
|
2
2
|
export default {
|
|
3
3
|
component: 'mg-input-toggle',
|
|
4
4
|
title: 'Molecules/Inputs/mg-input-toggle',
|
|
5
|
+
parameters: { actions: { handles: ['value-change', 'input-valid'] } },
|
|
5
6
|
};
|
|
6
7
|
const args = {
|
|
7
8
|
// Global
|
|
@@ -30,8 +31,12 @@ const args = {
|
|
|
30
31
|
/**
|
|
31
32
|
* 1. camelCase arguments must be written in the template, for exemple labelOnTop must be placed in the template as label-on-top={args.labelOnTop}
|
|
32
33
|
* 2. boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
|
|
34
|
+
*
|
|
35
|
+
* @param {any} args component arguments
|
|
36
|
+
* @returns {HTMLElement} HTMLElement
|
|
33
37
|
*/
|
|
34
|
-
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
|
+
const Template = (args) => {
|
|
35
40
|
// Extract slot so it won't be render as an attribute
|
|
36
41
|
const labelOnTop = args.labelOnTop;
|
|
37
42
|
delete args.labelOnTop;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.is-asterisk {
|
|
2
|
+
color: hsl(var(--color-danger));
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.mg-form,
|
|
6
|
+
.mg-form-group {
|
|
7
|
+
--mg-inputs-margin-bottom: 1.5rem;
|
|
8
|
+
--mg-inputs-title-horizontal-space: 3rem;
|
|
9
|
+
--mg-inputs-title-width: 15rem;
|
|
10
|
+
--mg-inputs-shrink: 0;
|
|
11
|
+
}
|
|
12
|
+
.mg-form.mg-form--all-required,
|
|
13
|
+
.mg-form-group.mg-form--all-required {
|
|
14
|
+
--mg-input-title-display: none;
|
|
15
|
+
}
|