@mgdis/mg-components 4.0.1 → 4.1.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/.storybook/utils.js +24 -0
- package/dist/cjs/{index-a39c5567.js → index-179621c8.js} +11 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{mg-badge_21.cjs.entry.js → mg-badge_24.cjs.entry.js} +2362 -213
- package/dist/cjs/mg-components.cjs.js +2 -2
- package/dist/cjs/mg-modal.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/components/atoms/mg-badge/doc/mg-badge.stories.js +9 -5
- package/dist/collection/components/atoms/mg-button/doc/mg-button.stories.js +15 -12
- package/dist/collection/components/atoms/mg-button/mg-button.conf.js +4 -0
- package/dist/collection/components/atoms/mg-button/mg-button.js +46 -20
- package/dist/collection/components/atoms/mg-character-left/doc/mg-character-left.stories.js +9 -12
- package/dist/collection/components/atoms/mg-icon/doc/mg-icon.stories.js +11 -3
- package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +13 -0
- package/dist/collection/components/atoms/mg-input-title/doc/mg-input-title.stories.js +9 -9
- package/dist/collection/components/atoms/mg-tag/doc/mg-tag.stories.js +9 -7
- package/dist/collection/components/atoms/mg-tooltip/doc/mg-tooltip.stories.js +27 -8
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +6 -0
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +64 -11
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/doc/mg-input-checkbox.stories.js +3 -15
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-date/doc/mg-input-date.stories.js +3 -12
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-numeric/doc/mg-input-numeric.stories.js +3 -14
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-password/doc/mg-input-password.stories.js +3 -14
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-radio/doc/mg-input-radio.stories.js +3 -14
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.js +3 -16
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-text/doc/mg-input-text.stories.js +11 -22
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-textarea/doc/mg-input-textarea.stories.js +4 -13
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-toggle/doc/mg-input-toggle.stories.js +17 -38
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +16 -7
- package/dist/collection/components/molecules/mg-details/doc/mg-details.stories.js +25 -0
- package/dist/collection/components/molecules/mg-details/mg-details.css +14 -0
- package/dist/collection/components/molecules/mg-details/mg-details.js +141 -0
- package/dist/collection/components/molecules/mg-form/doc/mg-form.stories.js +9 -6
- package/dist/collection/components/molecules/mg-form/mg-form.css +1 -1
- package/dist/collection/components/molecules/mg-form/mg-form.js +48 -4
- package/dist/collection/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.js +22 -0
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.css +37 -0
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +74 -0
- package/dist/collection/components/molecules/mg-message/doc/mg-message.stories.js +9 -15
- package/dist/collection/components/molecules/mg-modal/doc/mg-modal.stories.js +23 -31
- package/dist/collection/components/molecules/mg-pagination/doc/mg-pagination.stories.js +7 -11
- package/dist/collection/components/molecules/mg-panel/doc/mg-panel.stories.js +16 -26
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +1 -6
- package/dist/collection/components/molecules/mg-popover/doc/mg-popover.stories.js +13 -17
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +24 -8
- package/dist/collection/components/molecules/mg-tabs/doc/mg-tabs.stories.js +11 -12
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +14 -14
- package/dist/collection/stories/helpers.stories.js +11 -3
- package/dist/collection/stories/icons.stories.js +10 -2
- package/dist/collection/stories/typography.stories.js +8 -1
- package/dist/collection/utils/components.utils.js +10 -0
- package/dist/components/components.utils.js +11 -1
- package/dist/components/index.d.ts +25 -23
- package/dist/components/index.js +2 -0
- package/dist/components/mg-button2.js +6 -14
- package/dist/components/mg-details.d.ts +11 -0
- package/dist/components/mg-details.js +87 -0
- package/dist/components/mg-form.js +35 -5
- package/dist/components/mg-icon2.js +13 -0
- package/dist/components/mg-illustrated-message.d.ts +11 -0
- package/dist/components/mg-illustrated-message.js +68 -0
- package/dist/components/mg-input-checkbox.js +1 -1
- package/dist/components/mg-input-date.js +1 -1
- package/dist/components/mg-input-numeric.js +1 -1
- package/dist/components/mg-input-password.js +1 -1
- package/dist/components/mg-input-radio.js +1 -1
- package/dist/components/mg-input-select2.js +1 -1
- package/dist/components/mg-input-text2.js +1 -1
- package/dist/components/mg-input-textarea.js +1 -1
- package/dist/components/mg-input-toggle.js +17 -8
- package/dist/components/mg-panel.js +0 -4
- package/dist/components/mg-popover.js +10 -9
- package/dist/components/mg-tabs.js +5 -4
- package/dist/components/mg-tooltip2.js +73 -11
- package/dist/esm/{index-e51ae032.js → index-7efedd97.js} +11 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/{mg-badge_21.entry.js → mg-badge_24.entry.js} +2359 -213
- package/dist/esm/mg-components.js +2 -2
- package/dist/esm/mg-modal.entry.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-5f89600c.js +1 -0
- package/dist/mg-components/{p-462d648a.entry.js → p-a2883dc7.entry.js} +1 -1
- package/dist/mg-components/p-cffe0519.entry.js +1 -0
- package/dist/types/components/atoms/mg-button/doc/mg-button.stories.d.ts +6 -0
- package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +8 -0
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +11 -0
- package/dist/types/components/atoms/mg-character-left/doc/mg-character-left.stories.d.ts +0 -10
- package/dist/types/components/atoms/mg-tooltip/doc/mg-tooltip.stories.d.ts +1 -6
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +5 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +25 -1
- package/dist/types/components/molecules/mg-details/doc/mg-details.stories.d.ts +11 -0
- package/dist/types/components/molecules/mg-details/mg-details.d.ts +49 -0
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +13 -0
- package/dist/types/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.d.ts +6 -0
- package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +28 -0
- package/dist/types/components/molecules/mg-popover/doc/mg-popover.stories.d.ts +4 -1
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +6 -1
- package/dist/types/components.d.ts +95 -0
- package/dist/types/home/runner/work/mg-components/mg-components/.stencil/.storybook/utils.d.ts +1 -0
- package/dist/types/utils/components.utils.d.ts +8 -0
- package/package.json +11 -11
- package/dist/cjs/mg-popover.cjs.entry.js +0 -170
- package/dist/cjs/popper-71bf3058.js +0 -1790
- package/dist/esm/mg-popover.entry.js +0 -166
- package/dist/esm/popper-93ecb064.js +0 -1788
- package/dist/mg-components/p-4c66f794.js +0 -1
- package/dist/mg-components/p-5126ab10.entry.js +0 -1
- package/dist/mg-components/p-766c918b.entry.js +0 -1
- package/dist/mg-components/p-780bd52d.js +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Component, Element, h, Host, Prop, Watch } from '@stencil/core';
|
|
2
2
|
import { createID } from '../../../utils/components.utils';
|
|
3
3
|
import { createPopper } from '@popperjs/core';
|
|
4
|
+
import { Guard } from './mg-tooltip.conf';
|
|
4
5
|
export class MgTooltip {
|
|
5
6
|
constructor() {
|
|
6
7
|
/**
|
|
@@ -44,9 +45,51 @@ export class MgTooltip {
|
|
|
44
45
|
// Disable the event listeners
|
|
45
46
|
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }] })));
|
|
46
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* Method to set display prop
|
|
50
|
+
*
|
|
51
|
+
* @param {boolean} newValue display prop new value
|
|
52
|
+
* @param {boolean} condition additionnal condition to apply display prop newValue
|
|
53
|
+
* @returns {void}
|
|
54
|
+
*/
|
|
55
|
+
this.setDisplay = (newValue, condition = true) => {
|
|
56
|
+
if (!this.disabled && condition)
|
|
57
|
+
this.display = newValue;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Action for tooltip element and tooltiped element mouse listener
|
|
61
|
+
*
|
|
62
|
+
* @param {Guard} elementGuard tooltip element guard
|
|
63
|
+
* @param {boolean} isMouseenter mouseenter validation
|
|
64
|
+
* @param {Guard} conditionalGuard guard condition
|
|
65
|
+
* @returns {void}
|
|
66
|
+
*/
|
|
67
|
+
this.tooltipMouseListenerAction = (elementGuard, isMouseenter, conditionalGuard) => {
|
|
68
|
+
// we mutate elementGuard
|
|
69
|
+
if (this.guard !== Guard.FOCUS) {
|
|
70
|
+
this.guard = elementGuard;
|
|
71
|
+
if (!isMouseenter) {
|
|
72
|
+
setTimeout(() => {
|
|
73
|
+
this.setDisplay(isMouseenter, this.guard !== conditionalGuard);
|
|
74
|
+
this.resetGuard();
|
|
75
|
+
}, 100);
|
|
76
|
+
}
|
|
77
|
+
else if (isMouseenter && elementGuard === Guard.HOVER_TOOLTIPED_ELEMENT) {
|
|
78
|
+
this.setDisplay(isMouseenter);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Method to reset guard value
|
|
84
|
+
*
|
|
85
|
+
* @returns {void}
|
|
86
|
+
*/
|
|
87
|
+
this.resetGuard = () => {
|
|
88
|
+
this.guard = undefined;
|
|
89
|
+
};
|
|
47
90
|
}
|
|
48
|
-
handleDisplay(
|
|
49
|
-
if (
|
|
91
|
+
handleDisplay(newValue) {
|
|
92
|
+
if (newValue) {
|
|
50
93
|
this.show();
|
|
51
94
|
}
|
|
52
95
|
else {
|
|
@@ -97,21 +140,31 @@ export class MgTooltip {
|
|
|
97
140
|
},
|
|
98
141
|
],
|
|
99
142
|
});
|
|
100
|
-
//
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
this.display = true;
|
|
105
|
-
});
|
|
143
|
+
// Manage tooltipedElement focus/blur events
|
|
144
|
+
tooltipedElement.addEventListener('focus', () => {
|
|
145
|
+
this.guard = Guard.FOCUS;
|
|
146
|
+
this.setDisplay(true);
|
|
106
147
|
});
|
|
107
|
-
['
|
|
148
|
+
['blur', 'keydown'].forEach(event => {
|
|
108
149
|
tooltipedElement.addEventListener(event, (e) => {
|
|
109
150
|
// we continue to process ONLY for KeyboardEvents 'Escape'
|
|
110
151
|
if (e.type === 'keydown' && e.code !== 'Escape') {
|
|
111
152
|
return;
|
|
112
153
|
}
|
|
113
|
-
|
|
114
|
-
|
|
154
|
+
this.resetGuard();
|
|
155
|
+
this.setDisplay(false);
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
// manage tooltipElement & tooltipedElement mouseenter/mouseleave events
|
|
159
|
+
['mouseenter', 'mouseleave'].forEach(event => {
|
|
160
|
+
const isMouseenter = event === 'mouseenter';
|
|
161
|
+
[
|
|
162
|
+
{ element: this.tooltip, action: () => this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIP_ELEMENT, isMouseenter, Guard.HOVER_TOOLTIPED_ELEMENT) },
|
|
163
|
+
{ element: tooltipedElement, action: () => this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIPED_ELEMENT, isMouseenter, Guard.HOVER_TOOLTIP_ELEMENT) },
|
|
164
|
+
].forEach(({ element, action }) => {
|
|
165
|
+
element.addEventListener(event, () => {
|
|
166
|
+
action();
|
|
167
|
+
});
|
|
115
168
|
});
|
|
116
169
|
});
|
|
117
170
|
this.handleDisplay(this.display);
|
|
@@ -1,30 +1,18 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
|
+
import { filterArgs } from '../../../../../../.storybook/utils';
|
|
2
3
|
export default {
|
|
3
4
|
component: 'mg-input-checkbox',
|
|
4
5
|
title: 'Molecules/Inputs/mg-input-checkbox',
|
|
5
6
|
parameters: { actions: { handles: ['value-change', 'input-valid'] } },
|
|
6
7
|
};
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
-
* 2. boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
|
|
9
|
+
* Template
|
|
10
10
|
*
|
|
11
11
|
* @param {any} args component arguments
|
|
12
12
|
* @returns {HTMLElement} HTMLElement
|
|
13
13
|
*/
|
|
14
14
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
-
const Template = (args) => {
|
|
16
|
-
// Extract slot so it won't be render as an attribute
|
|
17
|
-
const labelOnTop = args.labelOnTop;
|
|
18
|
-
delete args.labelOnTop;
|
|
19
|
-
const helpText = args.helpText;
|
|
20
|
-
delete args.helpText;
|
|
21
|
-
const inputVerticalList = args.inputVerticalList;
|
|
22
|
-
delete args.inputVerticalList;
|
|
23
|
-
const labelHide = args.labelHide;
|
|
24
|
-
delete args.labelHide;
|
|
25
|
-
// return element
|
|
26
|
-
return h("mg-input-checkbox", Object.assign({}, args, { "label-on-top": labelOnTop, "label-hide": labelHide, "help-text": helpText, "input-vertical-list": inputVerticalList }));
|
|
27
|
-
};
|
|
15
|
+
const Template = (args) => h("mg-input-checkbox", Object.assign({}, filterArgs(args)));
|
|
28
16
|
export const MgInputCheckbox = Template.bind({});
|
|
29
17
|
MgInputCheckbox.args = {
|
|
30
18
|
// Global
|
|
@@ -64,9 +64,6 @@
|
|
|
64
64
|
height: var(--mg-icon-regular-size);
|
|
65
65
|
margin-left: var(--mg-inputs-spacer);
|
|
66
66
|
}
|
|
67
|
-
.mg-input__input-container mg-icon {
|
|
68
|
-
display: flex;
|
|
69
|
-
}
|
|
70
67
|
.mg-input__input-container .mg-input__help-text,
|
|
71
68
|
.mg-input__input-container .mg-input__error {
|
|
72
69
|
text-align: start;
|
|
@@ -96,6 +93,10 @@
|
|
|
96
93
|
color: hsl(var(--color-danger));
|
|
97
94
|
}
|
|
98
95
|
|
|
96
|
+
.mg-input__input mg-icon, .mg-input__error mg-icon {
|
|
97
|
+
display: flex;
|
|
98
|
+
}
|
|
99
|
+
|
|
99
100
|
/**
|
|
100
101
|
* Manage style when input needs to be a fieldset, like checkbox and radio.
|
|
101
102
|
*/
|
package/dist/collection/components/molecules/inputs/mg-input-date/doc/mg-input-date.stories.js
CHANGED
|
@@ -1,27 +1,18 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
|
+
import { filterArgs } from '../../../../../../.storybook/utils';
|
|
2
3
|
export default {
|
|
3
4
|
component: 'mg-input-date',
|
|
4
5
|
title: 'Molecules/Inputs/mg-input-date',
|
|
5
6
|
parameters: { actions: { handles: ['value-change', 'input-valid'] } },
|
|
6
7
|
};
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
-
* 2. boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
|
|
9
|
+
* Template
|
|
10
10
|
*
|
|
11
11
|
* @param {any} args component arguments
|
|
12
12
|
* @returns {HTMLElement} HTMLElement
|
|
13
13
|
*/
|
|
14
14
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
-
const Template = (args) => {
|
|
16
|
-
const labelOnTop = args.labelOnTop;
|
|
17
|
-
delete args.labelOnTop;
|
|
18
|
-
const labelHide = args.labelHide;
|
|
19
|
-
delete args.labelHide;
|
|
20
|
-
const helpText = args.helpText;
|
|
21
|
-
delete args.helpText;
|
|
22
|
-
// return element
|
|
23
|
-
return h("mg-input-date", Object.assign({}, args, { "label-on-top": labelOnTop, "label-hide": labelHide, "help-text": helpText }));
|
|
24
|
-
};
|
|
15
|
+
const Template = (args) => h("mg-input-date", Object.assign({}, filterArgs(args)));
|
|
25
16
|
const date = new Date();
|
|
26
17
|
const getFormatedNumber = (number) => {
|
|
27
18
|
return `${number > 9 ? number : '0' + number}`;
|
|
@@ -64,9 +64,6 @@
|
|
|
64
64
|
height: var(--mg-icon-regular-size);
|
|
65
65
|
margin-left: var(--mg-inputs-spacer);
|
|
66
66
|
}
|
|
67
|
-
.mg-input__input-container mg-icon {
|
|
68
|
-
display: flex;
|
|
69
|
-
}
|
|
70
67
|
.mg-input__input-container .mg-input__help-text,
|
|
71
68
|
.mg-input__input-container .mg-input__error {
|
|
72
69
|
text-align: start;
|
|
@@ -96,6 +93,10 @@
|
|
|
96
93
|
color: hsl(var(--color-danger));
|
|
97
94
|
}
|
|
98
95
|
|
|
96
|
+
.mg-input__input mg-icon, .mg-input__error mg-icon {
|
|
97
|
+
display: flex;
|
|
98
|
+
}
|
|
99
|
+
|
|
99
100
|
/**
|
|
100
101
|
* Style for input "box":
|
|
101
102
|
* - input[type="text"]
|
package/dist/collection/components/molecules/inputs/mg-input-numeric/doc/mg-input-numeric.stories.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
|
+
import { filterArgs } from '../../../../../../.storybook/utils';
|
|
2
3
|
import { types } from '../mg-input-numeric.conf';
|
|
3
4
|
export default {
|
|
4
5
|
component: 'mg-input-numeric',
|
|
@@ -16,25 +17,13 @@ export default {
|
|
|
16
17
|
parameters: { actions: { handles: ['value-change', 'input-valid'] } },
|
|
17
18
|
};
|
|
18
19
|
/**
|
|
19
|
-
*
|
|
20
|
-
* 2. boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
|
|
20
|
+
* Template
|
|
21
21
|
*
|
|
22
22
|
* @param {any} args component arguments
|
|
23
23
|
* @returns {HTMLElement} HTMLElement
|
|
24
24
|
*/
|
|
25
25
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
-
const Template = (args) => {
|
|
27
|
-
const labelOnTop = args.labelOnTop;
|
|
28
|
-
delete args.labelOnTop;
|
|
29
|
-
const labelHide = args.labelHide;
|
|
30
|
-
delete args.labelHide;
|
|
31
|
-
const helpText = args.helpText;
|
|
32
|
-
delete args.helpText;
|
|
33
|
-
const mgWidth = args.mgWidth;
|
|
34
|
-
delete args.mgWidth;
|
|
35
|
-
// return element
|
|
36
|
-
return h("mg-input-numeric", Object.assign({}, args, { "label-on-top": labelOnTop, "label-hide": labelHide, "help-text": helpText, "mg-width": mgWidth }));
|
|
37
|
-
};
|
|
26
|
+
const Template = (args) => h("mg-input-numeric", Object.assign({}, filterArgs(args)));
|
|
38
27
|
/**
|
|
39
28
|
* Global use
|
|
40
29
|
*/
|
|
@@ -64,9 +64,6 @@
|
|
|
64
64
|
height: var(--mg-icon-regular-size);
|
|
65
65
|
margin-left: var(--mg-inputs-spacer);
|
|
66
66
|
}
|
|
67
|
-
.mg-input__input-container mg-icon {
|
|
68
|
-
display: flex;
|
|
69
|
-
}
|
|
70
67
|
.mg-input__input-container .mg-input__help-text,
|
|
71
68
|
.mg-input__input-container .mg-input__error {
|
|
72
69
|
text-align: start;
|
|
@@ -96,6 +93,10 @@
|
|
|
96
93
|
color: hsl(var(--color-danger));
|
|
97
94
|
}
|
|
98
95
|
|
|
96
|
+
.mg-input__input mg-icon, .mg-input__error mg-icon {
|
|
97
|
+
display: flex;
|
|
98
|
+
}
|
|
99
|
+
|
|
99
100
|
/**
|
|
100
101
|
* Style for input "box":
|
|
101
102
|
* - input[type="text"]
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
|
+
import { filterArgs } from '../../../../../../.storybook/utils';
|
|
2
3
|
export default {
|
|
3
4
|
component: 'mg-input-password',
|
|
4
5
|
title: 'Molecules/Inputs/mg-input-password',
|
|
@@ -11,25 +12,13 @@ export default {
|
|
|
11
12
|
parameters: { actions: { handles: ['value-change', 'input-valid'] } },
|
|
12
13
|
};
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
-
* 2. boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
|
|
15
|
+
* Template
|
|
16
16
|
*
|
|
17
17
|
* @param {any} args component arguments
|
|
18
18
|
* @returns {HTMLElement} HTMLElement
|
|
19
19
|
*/
|
|
20
20
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
|
-
const Template = (args) => {
|
|
22
|
-
const labelOnTop = args.labelOnTop;
|
|
23
|
-
delete args.labelOnTop;
|
|
24
|
-
const labelHide = args.labelHide;
|
|
25
|
-
delete args.labelHide;
|
|
26
|
-
const helpText = args.helpText;
|
|
27
|
-
delete args.helpText;
|
|
28
|
-
const mgWidth = args.mgWidth;
|
|
29
|
-
delete args.mgWidth;
|
|
30
|
-
// return element
|
|
31
|
-
return h("mg-input-password", Object.assign({}, args, { "label-on-top": labelOnTop, "label-hide": labelHide, "help-text": helpText, "mg-width": mgWidth }));
|
|
32
|
-
};
|
|
21
|
+
const Template = (args) => h("mg-input-password", Object.assign({}, filterArgs(args)));
|
|
33
22
|
/**
|
|
34
23
|
* Global use
|
|
35
24
|
*/
|
|
@@ -64,9 +64,6 @@
|
|
|
64
64
|
height: var(--mg-icon-regular-size);
|
|
65
65
|
margin-left: var(--mg-inputs-spacer);
|
|
66
66
|
}
|
|
67
|
-
.mg-input__input-container mg-icon {
|
|
68
|
-
display: flex;
|
|
69
|
-
}
|
|
70
67
|
.mg-input__input-container .mg-input__help-text,
|
|
71
68
|
.mg-input__input-container .mg-input__error {
|
|
72
69
|
text-align: start;
|
|
@@ -96,6 +93,10 @@
|
|
|
96
93
|
color: hsl(var(--color-danger));
|
|
97
94
|
}
|
|
98
95
|
|
|
96
|
+
.mg-input__input mg-icon, .mg-input__error mg-icon {
|
|
97
|
+
display: flex;
|
|
98
|
+
}
|
|
99
|
+
|
|
99
100
|
/**
|
|
100
101
|
* Style for input "box":
|
|
101
102
|
* - input[type="text"]
|
package/dist/collection/components/molecules/inputs/mg-input-radio/doc/mg-input-radio.stories.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
|
+
import { filterArgs } from '../../../../../../.storybook/utils';
|
|
2
3
|
export default {
|
|
3
4
|
component: 'mg-input-radio',
|
|
4
5
|
title: 'Molecules/Inputs/mg-input-radio',
|
|
@@ -11,25 +12,13 @@ export default {
|
|
|
11
12
|
parameters: { actions: { handles: ['value-change', 'input-valid'] } },
|
|
12
13
|
};
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
-
* 2. boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
|
|
15
|
+
* Template
|
|
16
16
|
*
|
|
17
17
|
* @param {any} args component arguments
|
|
18
18
|
* @returns {HTMLElement} HTMLElement
|
|
19
19
|
*/
|
|
20
20
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
|
-
const Template = (args) => {
|
|
22
|
-
const labelOnTop = args.labelOnTop;
|
|
23
|
-
delete args.labelOnTop;
|
|
24
|
-
const helpText = args.helpText;
|
|
25
|
-
delete args.helpText;
|
|
26
|
-
const inputVerticalList = args.inputVerticalList;
|
|
27
|
-
delete args.inputVerticalList;
|
|
28
|
-
const labelHide = args.labelHide;
|
|
29
|
-
delete args.labelHide;
|
|
30
|
-
// return element
|
|
31
|
-
return h("mg-input-radio", Object.assign({}, args, { "label-on-top": labelOnTop, "label-hide": labelHide, "help-text": helpText, "input-vertical-list": inputVerticalList }));
|
|
32
|
-
};
|
|
21
|
+
const Template = (args) => h("mg-input-radio", Object.assign({}, filterArgs(args)));
|
|
33
22
|
export const MgInputRadio = Template.bind({});
|
|
34
23
|
MgInputRadio.args = {
|
|
35
24
|
// Global
|
|
@@ -64,9 +64,6 @@
|
|
|
64
64
|
height: var(--mg-icon-regular-size);
|
|
65
65
|
margin-left: var(--mg-inputs-spacer);
|
|
66
66
|
}
|
|
67
|
-
.mg-input__input-container mg-icon {
|
|
68
|
-
display: flex;
|
|
69
|
-
}
|
|
70
67
|
.mg-input__input-container .mg-input__help-text,
|
|
71
68
|
.mg-input__input-container .mg-input__error {
|
|
72
69
|
text-align: start;
|
|
@@ -96,6 +93,10 @@
|
|
|
96
93
|
color: hsl(var(--color-danger));
|
|
97
94
|
}
|
|
98
95
|
|
|
96
|
+
.mg-input__input mg-icon, .mg-input__error mg-icon {
|
|
97
|
+
display: flex;
|
|
98
|
+
}
|
|
99
|
+
|
|
99
100
|
/**
|
|
100
101
|
* Manage style when input needs to be a fieldset, like checkbox and radio.
|
|
101
102
|
*/
|
package/dist/collection/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
|
+
import { filterArgs } from '../../../../../../.storybook/utils';
|
|
2
3
|
import messages from '../../../../../locales/en/messages.json';
|
|
3
4
|
export default {
|
|
4
5
|
component: 'mg-input-select',
|
|
@@ -24,22 +25,7 @@ export default {
|
|
|
24
25
|
* @returns {HTMLElement} HTMLElement
|
|
25
26
|
*/
|
|
26
27
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
|
-
const Template = (args) => {
|
|
28
|
-
const labelOnTop = args.labelOnTop;
|
|
29
|
-
delete args.labelOnTop;
|
|
30
|
-
const labelHide = args.labelHide;
|
|
31
|
-
delete args.labelHide;
|
|
32
|
-
const helpText = args.helpText;
|
|
33
|
-
delete args.helpText;
|
|
34
|
-
const placeholderDisabled = args.placeholderDisabled;
|
|
35
|
-
delete args.placeholderDisabled;
|
|
36
|
-
const placeholderHide = args.placeholderHide;
|
|
37
|
-
delete args.placeholderHide;
|
|
38
|
-
const mgWidth = args.mgWidth;
|
|
39
|
-
delete args.mgWidth;
|
|
40
|
-
// return element
|
|
41
|
-
return (h("mg-input-select", Object.assign({}, args, { "label-on-top": labelOnTop, "label-hide": labelHide, "help-text": helpText, "placeholder-hide": placeholderHide, "placeholder-disabled": placeholderDisabled, "mg-width": mgWidth })));
|
|
42
|
-
};
|
|
28
|
+
const Template = (args) => h("mg-input-select", Object.assign({}, filterArgs(args, { placeholder: messages.input.select.placeholder })));
|
|
43
29
|
export const MgInputSelect = Template.bind({});
|
|
44
30
|
MgInputSelect.args = {
|
|
45
31
|
// Global
|
|
@@ -61,6 +47,7 @@ MgInputSelect.args = {
|
|
|
61
47
|
// Help Text
|
|
62
48
|
helpText: 'Help text with html <strong>bold</strong>, <em>italic</em>.',
|
|
63
49
|
// Placeholder
|
|
50
|
+
placeholder: undefined,
|
|
64
51
|
placeholderHide: false,
|
|
65
52
|
placeholderDisabled: false,
|
|
66
53
|
};
|
|
@@ -64,9 +64,6 @@
|
|
|
64
64
|
height: var(--mg-icon-regular-size);
|
|
65
65
|
margin-left: var(--mg-inputs-spacer);
|
|
66
66
|
}
|
|
67
|
-
.mg-input__input-container mg-icon {
|
|
68
|
-
display: flex;
|
|
69
|
-
}
|
|
70
67
|
.mg-input__input-container .mg-input__help-text,
|
|
71
68
|
.mg-input__input-container .mg-input__error {
|
|
72
69
|
text-align: start;
|
|
@@ -96,6 +93,10 @@
|
|
|
96
93
|
color: hsl(var(--color-danger));
|
|
97
94
|
}
|
|
98
95
|
|
|
96
|
+
.mg-input__input mg-icon, .mg-input__error mg-icon {
|
|
97
|
+
display: flex;
|
|
98
|
+
}
|
|
99
|
+
|
|
99
100
|
/**
|
|
100
101
|
* Style for input "box":
|
|
101
102
|
* - input[type="text"]
|
package/dist/collection/components/molecules/inputs/mg-input-text/doc/mg-input-text.stories.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
|
+
import { filterArgs } from '../../../../../../.storybook/utils';
|
|
2
3
|
export default {
|
|
3
4
|
component: 'mg-input-text',
|
|
4
5
|
title: 'Molecules/Inputs/mg-input-text',
|
|
@@ -11,28 +12,17 @@ export default {
|
|
|
11
12
|
parameters: { actions: { handles: ['value-change', 'input-valid'] } },
|
|
12
13
|
};
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
-
* 2. boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
|
|
15
|
+
* Template
|
|
16
16
|
*
|
|
17
17
|
* @param {any} args component arguments
|
|
18
18
|
* @returns {HTMLElement} HTMLElement
|
|
19
19
|
*/
|
|
20
20
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
21
|
const Template = (args) => {
|
|
22
|
-
const labelOnTop = args.labelOnTop;
|
|
23
|
-
delete args.labelOnTop;
|
|
24
|
-
const labelHide = args.labelHide;
|
|
25
|
-
delete args.labelHide;
|
|
26
|
-
const patternErrorMessage = args.patternErrorMessage;
|
|
27
|
-
delete args.patternErrorMessage;
|
|
28
22
|
const displayCharacterLeft = args.displayCharacterLeft;
|
|
29
23
|
delete args.displayCharacterLeft;
|
|
30
|
-
const helpText = args.helpText;
|
|
31
|
-
delete args.helpText;
|
|
32
|
-
const mgWidth = args.mgWidth;
|
|
33
|
-
delete args.mgWidth;
|
|
34
24
|
// return element
|
|
35
|
-
return
|
|
25
|
+
return h("mg-input-text", Object.assign({}, filterArgs(args), { "display-character-left": displayCharacterLeft ? undefined : 'false' }));
|
|
36
26
|
};
|
|
37
27
|
/**
|
|
38
28
|
* Global use
|
|
@@ -56,6 +46,7 @@ MgInputText.args = {
|
|
|
56
46
|
pattern: undefined,
|
|
57
47
|
patternErrorMessage: undefined,
|
|
58
48
|
mgWidth: 'full',
|
|
49
|
+
type: 'text',
|
|
59
50
|
// Tooltip
|
|
60
51
|
tooltip: 'This is a tooltip',
|
|
61
52
|
// Nb Char Left
|
|
@@ -102,20 +93,18 @@ URL.args = Object.assign(Object.assign({}, Emails.args), { label: 'URL',
|
|
|
102
93
|
// Help Text
|
|
103
94
|
helpText: 'Exemple: https://www.exemple.fr' });
|
|
104
95
|
/**
|
|
105
|
-
*
|
|
96
|
+
* Template
|
|
97
|
+
*
|
|
98
|
+
* @param {any} args component arguments
|
|
99
|
+
* @returns {HTMLElement} HTMLElement
|
|
106
100
|
*/
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
delete args.labelOnTop;
|
|
110
|
-
const labelHide = args.labelHide;
|
|
111
|
-
delete args.labelHide;
|
|
112
|
-
const patternErrorMessage = args.patternErrorMessage;
|
|
113
|
-
delete args.patternErrorMessage;
|
|
101
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
102
|
+
const SearchTemplate = (args) => {
|
|
114
103
|
const displayCharacterLeft = args.displayCharacterLeft;
|
|
115
104
|
delete args.displayCharacterLeft;
|
|
116
105
|
// return element
|
|
117
106
|
return (h("form", { role: "search" },
|
|
118
|
-
h("mg-input-text", Object.assign({}, args, { "
|
|
107
|
+
h("mg-input-text", Object.assign({}, filterArgs(args), { "display-character-left": displayCharacterLeft ? undefined : 'false' }),
|
|
119
108
|
h("mg-button", { slot: "append-input", label: "search" },
|
|
120
109
|
h("mg-icon", { icon: "magnifying-glass" }),
|
|
121
110
|
" Search"))));
|
|
@@ -64,9 +64,6 @@
|
|
|
64
64
|
height: var(--mg-icon-regular-size);
|
|
65
65
|
margin-left: var(--mg-inputs-spacer);
|
|
66
66
|
}
|
|
67
|
-
.mg-input__input-container mg-icon {
|
|
68
|
-
display: flex;
|
|
69
|
-
}
|
|
70
67
|
.mg-input__input-container .mg-input__help-text,
|
|
71
68
|
.mg-input__input-container .mg-input__error {
|
|
72
69
|
text-align: start;
|
|
@@ -96,6 +93,10 @@
|
|
|
96
93
|
color: hsl(var(--color-danger));
|
|
97
94
|
}
|
|
98
95
|
|
|
96
|
+
.mg-input__input mg-icon, .mg-input__error mg-icon {
|
|
97
|
+
display: flex;
|
|
98
|
+
}
|
|
99
|
+
|
|
99
100
|
/**
|
|
100
101
|
* Style for input "box":
|
|
101
102
|
* - input[type="text"]
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
|
+
import { filterArgs } from '../../../../../../.storybook/utils';
|
|
2
3
|
export default {
|
|
3
4
|
component: 'mg-input-textarea',
|
|
4
5
|
title: 'Molecules/Inputs/mg-input-textarea',
|
|
@@ -11,28 +12,17 @@ export default {
|
|
|
11
12
|
parameters: { actions: { handles: ['value-change', 'input-valid'] } },
|
|
12
13
|
};
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
-
* 2. boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
|
|
15
|
+
* Template
|
|
16
16
|
*
|
|
17
17
|
* @param {any} args component arguments
|
|
18
18
|
* @returns {HTMLElement} HTMLElement
|
|
19
19
|
*/
|
|
20
20
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
21
|
const Template = (args) => {
|
|
22
|
-
const labelOnTop = args.labelOnTop;
|
|
23
|
-
delete args.labelOnTop;
|
|
24
|
-
const labelHide = args.labelHide;
|
|
25
|
-
delete args.labelHide;
|
|
26
|
-
const patternErrorMessage = args.patternErrorMessage;
|
|
27
|
-
delete args.patternErrorMessage;
|
|
28
22
|
const displayCharacterLeft = args.displayCharacterLeft;
|
|
29
23
|
delete args.displayCharacterLeft;
|
|
30
|
-
const helpText = args.helpText;
|
|
31
|
-
delete args.helpText;
|
|
32
|
-
const mgWidth = args.mgWidth;
|
|
33
|
-
delete args.mgWidth;
|
|
34
24
|
// return element
|
|
35
|
-
return
|
|
25
|
+
return h("mg-input-textarea", Object.assign({}, filterArgs(args), { "display-character-left": displayCharacterLeft ? undefined : 'false' }));
|
|
36
26
|
};
|
|
37
27
|
export const MgInputTextarea = Template.bind({});
|
|
38
28
|
MgInputTextarea.args = {
|
|
@@ -54,6 +44,7 @@ MgInputTextarea.args = {
|
|
|
54
44
|
patternErrorMessage: undefined,
|
|
55
45
|
rows: 3,
|
|
56
46
|
mgWidth: 'full',
|
|
47
|
+
resizable: 'none',
|
|
57
48
|
// Tooltip
|
|
58
49
|
tooltip: 'This is a tooltip',
|
|
59
50
|
// Nb Char Left
|
|
@@ -64,9 +64,6 @@
|
|
|
64
64
|
height: var(--mg-icon-regular-size);
|
|
65
65
|
margin-left: var(--mg-inputs-spacer);
|
|
66
66
|
}
|
|
67
|
-
.mg-input__input-container mg-icon {
|
|
68
|
-
display: flex;
|
|
69
|
-
}
|
|
70
67
|
.mg-input__input-container .mg-input__help-text,
|
|
71
68
|
.mg-input__input-container .mg-input__error {
|
|
72
69
|
text-align: start;
|
|
@@ -96,6 +93,10 @@
|
|
|
96
93
|
color: hsl(var(--color-danger));
|
|
97
94
|
}
|
|
98
95
|
|
|
96
|
+
.mg-input__input mg-icon, .mg-input__error mg-icon {
|
|
97
|
+
display: flex;
|
|
98
|
+
}
|
|
99
|
+
|
|
99
100
|
/**
|
|
100
101
|
* Style for input "box":
|
|
101
102
|
* - input[type="text"]
|