@mgdis/mg-components 3.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/LICENSE +29 -0
- package/dist/cjs/css-shim-a22512c4.js +6 -0
- package/dist/cjs/index-85a4a0b6.js +1674 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +35 -0
- package/dist/cjs/mg-badge_20.cjs.entry.js +4661 -0
- package/dist/cjs/mg-components.cjs.js +23 -0
- package/dist/cjs/shadow-css-8940f82d.js +390 -0
- package/dist/collection/collection-manifest.json +31 -0
- package/dist/collection/components/atoms/mg-badge/mg-badge.conf.js +4 -0
- package/dist/collection/components/atoms/mg-badge/mg-badge.css +99 -0
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +148 -0
- package/dist/collection/components/atoms/mg-badge/mg-badge.stories.js +27 -0
- package/dist/collection/components/atoms/mg-button/mg-button.conf.js +4 -0
- package/dist/collection/components/atoms/mg-button/mg-button.css +134 -0
- package/dist/collection/components/atoms/mg-button/mg-button.js +236 -0
- package/dist/collection/components/atoms/mg-button/mg-button.stories.js +38 -0
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.css +3 -0
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +133 -0
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.stories.js +15 -0
- package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +54 -0
- package/dist/collection/components/atoms/mg-icon/mg-icon.css +57 -0
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +155 -0
- package/dist/collection/components/atoms/mg-icon/mg-icon.stories.js +34 -0
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.css +12 -0
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +95 -0
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.stories.js +21 -0
- package/dist/collection/components/atoms/mg-tag/mg-tag.conf.js +4 -0
- package/dist/collection/components/atoms/mg-tag/mg-tag.css +73 -0
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +94 -0
- package/dist/collection/components/atoms/mg-tag/mg-tag.stories.js +25 -0
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.css +44 -0
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +225 -0
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.stories.js +26 -0
- package/dist/collection/components/molecules/inputs/MgInput.conf.js +7 -0
- package/dist/collection/components/molecules/inputs/MgInput.js +130 -0
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +156 -0
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +444 -0
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.stories.js +57 -0
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.conf.js +7 -0
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +171 -0
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +467 -0
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.stories.js +46 -0
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.js +11 -0
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +199 -0
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +633 -0
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.stories.js +68 -0
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +195 -0
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +401 -0
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.stories.js +43 -0
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.conf.js +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +156 -0
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +443 -0
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.stories.js +65 -0
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.conf.js +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +201 -0
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +532 -0
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.stories.js +70 -0
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +222 -0
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +589 -0
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.stories.js +115 -0
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +217 -0
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +553 -0
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.stories.js +52 -0
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.js +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +213 -0
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +457 -0
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.stories.js +73 -0
- package/dist/collection/components/molecules/mg-message/mg-message.conf.js +4 -0
- package/dist/collection/components/molecules/mg-message/mg-message.css +94 -0
- package/dist/collection/components/molecules/mg-message/mg-message.js +285 -0
- package/dist/collection/components/molecules/mg-message/mg-message.stories.js +43 -0
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.conf.js +5 -0
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.css +39 -0
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +218 -0
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.stories.js +23 -0
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +59 -0
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +249 -0
- package/dist/collection/components/molecules/mg-popover/mg-popover.stories.js +36 -0
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +1 -0
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +30 -0
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +212 -0
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.stories.js +40 -0
- package/dist/collection/fonts/OpenSans-Regular.ttf +0 -0
- package/dist/collection/fonts/OpenSans-SemiBold.ttf +0 -0
- package/dist/collection/fonts/Poppins-Bold.ttf +0 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/locales/index.js +4 -0
- package/dist/collection/stories/buttons.stories.js +43 -0
- package/dist/collection/stories/grids.stories.js +50 -0
- package/dist/collection/stories/icons.stories.js +20 -0
- package/dist/collection/stories/messages.stories.js +44 -0
- package/dist/collection/stories/tags.stories.js +13 -0
- package/dist/collection/stories/typography.stories.js +28 -0
- package/dist/collection/utils/components.utils.js +67 -0
- package/dist/collection/utils/locale.utils.js +32 -0
- package/dist/collection/utils/test.utils.js +26 -0
- package/dist/collection/variables.css +177 -0
- package/dist/collection/variables.scss +177 -0
- package/dist/components/MgInput.js +140 -0
- package/dist/components/components.utils.js +69 -0
- package/dist/components/index.d.ts +26 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index2.js +54 -0
- package/dist/components/locale.utils.js +35 -0
- package/dist/components/mg-badge.d.ts +11 -0
- package/dist/components/mg-badge.js +6 -0
- package/dist/components/mg-badge2.js +82 -0
- package/dist/components/mg-button.d.ts +11 -0
- package/dist/components/mg-button.js +6 -0
- package/dist/components/mg-button2.js +148 -0
- package/dist/components/mg-character-left.d.ts +11 -0
- package/dist/components/mg-character-left.js +6 -0
- package/dist/components/mg-character-left2.js +77 -0
- package/dist/components/mg-icon.d.ts +11 -0
- package/dist/components/mg-icon.js +6 -0
- package/dist/components/mg-icon2.js +147 -0
- package/dist/components/mg-input-checkbox.d.ts +11 -0
- package/dist/components/mg-input-checkbox.js +222 -0
- package/dist/components/mg-input-date.d.ts +11 -0
- package/dist/components/mg-input-date.js +245 -0
- package/dist/components/mg-input-numeric.d.ts +11 -0
- package/dist/components/mg-input-numeric.js +324 -0
- package/dist/components/mg-input-password.d.ts +11 -0
- package/dist/components/mg-input-password.js +171 -0
- package/dist/components/mg-input-radio.d.ts +11 -0
- package/dist/components/mg-input-radio.js +211 -0
- package/dist/components/mg-input-select.d.ts +11 -0
- package/dist/components/mg-input-select.js +6 -0
- package/dist/components/mg-input-select2.js +243 -0
- package/dist/components/mg-input-text.d.ts +11 -0
- package/dist/components/mg-input-text.js +242 -0
- package/dist/components/mg-input-textarea.d.ts +11 -0
- package/dist/components/mg-input-textarea.js +224 -0
- package/dist/components/mg-input-title.d.ts +11 -0
- package/dist/components/mg-input-title.js +6 -0
- package/dist/components/mg-input-title2.js +55 -0
- package/dist/components/mg-input-toggle.d.ts +11 -0
- package/dist/components/mg-input-toggle.js +247 -0
- package/dist/components/mg-message.d.ts +11 -0
- package/dist/components/mg-message.js +183 -0
- package/dist/components/mg-pagination.d.ts +11 -0
- package/dist/components/mg-pagination.js +175 -0
- package/dist/components/mg-popover.d.ts +11 -0
- package/dist/components/mg-popover.js +183 -0
- package/dist/components/mg-tabs.d.ts +11 -0
- package/dist/components/mg-tabs.js +160 -0
- package/dist/components/mg-tag.d.ts +11 -0
- package/dist/components/mg-tag.js +76 -0
- package/dist/components/mg-tooltip.d.ts +11 -0
- package/dist/components/mg-tooltip.js +6 -0
- package/dist/components/mg-tooltip2.js +150 -0
- package/dist/components/popper.js +1784 -0
- package/dist/esm/css-shim-7c240feb.js +4 -0
- package/dist/esm/index-e3e84606.js +1643 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +31 -0
- package/dist/esm/mg-badge_20.entry.js +4638 -0
- package/dist/esm/mg-components.js +21 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/shadow-css-5d2d01ce.js +388 -0
- package/dist/esm-es5/css-shim-7c240feb.js +1 -0
- package/dist/esm-es5/index-e3e84606.js +1 -0
- package/dist/esm-es5/index.js +0 -0
- package/dist/esm-es5/loader.js +1 -0
- package/dist/esm-es5/mg-badge_20.entry.js +2 -0
- package/dist/esm-es5/mg-components.js +1 -0
- package/dist/esm-es5/shadow-css-5d2d01ce.js +12 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/mg-components/fonts/OpenSans-Regular.ttf +0 -0
- package/dist/mg-components/fonts/OpenSans-SemiBold.ttf +0 -0
- package/dist/mg-components/fonts/Poppins-Bold.ttf +0 -0
- package/dist/mg-components/index.esm.js +0 -0
- package/dist/mg-components/mg-components.css +1 -0
- package/dist/mg-components/mg-components.esm.js +1 -0
- package/dist/mg-components/mg-components.js +132 -0
- package/dist/mg-components/p-1cd24462.system.js +1 -0
- package/dist/mg-components/p-2e2f6b27.system.entry.js +2 -0
- package/dist/mg-components/p-366a224e.js +1 -0
- package/dist/mg-components/p-422c429b.system.js +1 -0
- package/dist/mg-components/p-50ea2036.system.js +1 -0
- package/dist/mg-components/p-62fa3797.js +1 -0
- package/dist/mg-components/p-71d57b8b.system.js +13 -0
- package/dist/mg-components/p-9a215712.system.js +1 -0
- package/dist/mg-components/p-cbf0464b.entry.js +1 -0
- package/dist/mg-components/p-f6455ab3.js +12 -0
- package/dist/mg-components/variables.css +177 -0
- package/dist/mg-components/variables.scss +177 -0
- package/dist/types/components/atoms/mg-badge/mg-badge.conf.d.ts +8 -0
- package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +36 -0
- package/dist/types/components/atoms/mg-badge/mg-badge.stories.d.ts +19 -0
- package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +4 -0
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +67 -0
- package/dist/types/components/atoms/mg-button/mg-button.stories.d.ts +16 -0
- package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +39 -0
- package/dist/types/components/atoms/mg-character-left/mg-character-left.stories.d.ts +7 -0
- package/dist/types/components/atoms/mg-icon/mg-icon.conf.d.ts +12 -0
- package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +36 -0
- package/dist/types/components/atoms/mg-icon/mg-icon.stories.d.ts +26 -0
- package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +24 -0
- package/dist/types/components/atoms/mg-input-title/mg-input-title.stories.d.ts +6 -0
- package/dist/types/components/atoms/mg-tag/mg-tag.conf.d.ts +4 -0
- package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +25 -0
- package/dist/types/components/atoms/mg-tag/mg-tag.stories.d.ts +14 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +56 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.stories.d.ts +11 -0
- package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +10 -0
- package/dist/types/components/molecules/inputs/MgInput.d.ts +35 -0
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +19 -0
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +120 -0
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.stories.d.ts +6 -0
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.conf.d.ts +6 -0
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +128 -0
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.stories.d.ts +7 -0
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.d.ts +10 -0
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +173 -0
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.stories.d.ts +21 -0
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +111 -0
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.stories.d.ts +9 -0
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.conf.d.ts +9 -0
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +121 -0
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.stories.d.ts +15 -0
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.conf.d.ts +18 -0
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +133 -0
- 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 +160 -0
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.stories.d.ts +26 -0
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +150 -0
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.stories.d.ts +6 -0
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.d.ts +8 -0
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +117 -0
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.stories.d.ts +7 -0
- package/dist/types/components/molecules/mg-message/mg-message.conf.d.ts +4 -0
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +76 -0
- package/dist/types/components/molecules/mg-message/mg-message.stories.d.ts +16 -0
- package/dist/types/components/molecules/mg-pagination/mg-pagination.conf.d.ts +4 -0
- package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +53 -0
- package/dist/types/components/molecules/mg-pagination/mg-pagination.stories.d.ts +6 -0
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +62 -0
- package/dist/types/components/molecules/mg-popover/mg-popover.stories.d.ts +12 -0
- package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +10 -0
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +63 -0
- package/dist/types/components/molecules/mg-tabs/mg-tabs.stories.d.ts +7 -0
- package/dist/types/components.d.ts +1987 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/locales/index.d.ts +44 -0
- package/dist/types/stencil-public-runtime.d.ts +1565 -0
- package/dist/types/stories/buttons.stories.d.ts +13 -0
- package/dist/types/stories/grids.stories.d.ts +5 -0
- package/dist/types/stories/icons.stories.d.ts +13 -0
- package/dist/types/stories/messages.stories.d.ts +13 -0
- package/dist/types/stories/tags.stories.d.ts +5 -0
- package/dist/types/stories/typography.stories.d.ts +5 -0
- package/dist/types/utils/components.utils.d.ts +43 -0
- package/dist/types/utils/locale.utils.d.ts +22 -0
- package/dist/types/utils/test.utils.d.ts +5 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +86 -0
- package/readme.md +159 -0
package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.stories.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { h } from '@stencil/core';
|
|
2
|
+
export default {
|
|
3
|
+
component: 'mg-input-toggle',
|
|
4
|
+
title: 'Molecules/Inputs/mg-input-toggle',
|
|
5
|
+
};
|
|
6
|
+
const args = {
|
|
7
|
+
// Global
|
|
8
|
+
value: null,
|
|
9
|
+
items: [
|
|
10
|
+
{ title: 'non', value: false },
|
|
11
|
+
{ title: 'oui', value: true },
|
|
12
|
+
],
|
|
13
|
+
identifier: 'identifier',
|
|
14
|
+
name: 'input-name',
|
|
15
|
+
// Label
|
|
16
|
+
label: 'Option',
|
|
17
|
+
labelOnTop: false,
|
|
18
|
+
labelHide: false,
|
|
19
|
+
// toggle
|
|
20
|
+
isIcon: false,
|
|
21
|
+
isOnOff: false,
|
|
22
|
+
// Input
|
|
23
|
+
disabled: false,
|
|
24
|
+
readonly: false,
|
|
25
|
+
// Tooltip
|
|
26
|
+
tooltip: 'This is a tooltip',
|
|
27
|
+
// Help Text
|
|
28
|
+
helpText: 'Help text with html <strong>bold</strong>, <em>italic</em>.',
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* 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
|
+
* 2. boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
|
|
33
|
+
*/
|
|
34
|
+
const Template = args => {
|
|
35
|
+
// Extract slot so it won't be render as an attribute
|
|
36
|
+
const labelOnTop = args.labelOnTop;
|
|
37
|
+
delete args.labelOnTop;
|
|
38
|
+
const labelHide = args.labelHide;
|
|
39
|
+
delete args.labelHide;
|
|
40
|
+
const isIcon = args.isIcon;
|
|
41
|
+
delete args.isIcon;
|
|
42
|
+
const isOnOff = args.isOnOff;
|
|
43
|
+
delete args.isOnOff;
|
|
44
|
+
const helpText = args.helpText;
|
|
45
|
+
delete args.helpText;
|
|
46
|
+
// return element
|
|
47
|
+
return (h("mg-input-toggle", Object.assign({}, args, { "label-on-top": labelOnTop, "label-hide": labelHide, "help-text": helpText, "is-icon": isIcon, "is-on-off": isOnOff }),
|
|
48
|
+
h("span", { slot: "item-1" }, "Non"),
|
|
49
|
+
h("span", { slot: "item-2" }, "Oui")));
|
|
50
|
+
};
|
|
51
|
+
export const MgInputToggle = Template.bind({});
|
|
52
|
+
MgInputToggle.args = Object.assign({}, args);
|
|
53
|
+
const TemplateIcon = args => {
|
|
54
|
+
// Extract slot so it won't be render as an attribute
|
|
55
|
+
const labelOnTop = args.labelOnTop;
|
|
56
|
+
delete args.labelOnTop;
|
|
57
|
+
const helpText = args.helpText;
|
|
58
|
+
delete args.helpText;
|
|
59
|
+
const labelHide = args.labelHide;
|
|
60
|
+
delete args.labelHide;
|
|
61
|
+
const isIcon = args.isIcon;
|
|
62
|
+
delete args.isIcon;
|
|
63
|
+
const isOnOff = args.isOnOff;
|
|
64
|
+
delete args.isOnOff;
|
|
65
|
+
// return element
|
|
66
|
+
return (h("mg-input-toggle", Object.assign({}, args, { "label-on-top": labelOnTop, "label-hide": labelHide, "help-text": helpText, "is-icon": isIcon, "is-on-off": isOnOff }),
|
|
67
|
+
h("span", { slot: "item-1" },
|
|
68
|
+
h("mg-icon", { icon: "cross" })),
|
|
69
|
+
h("span", { slot: "item-2" },
|
|
70
|
+
h("mg-icon", { icon: "check" }))));
|
|
71
|
+
};
|
|
72
|
+
export const MgInputToggleWithIcon = TemplateIcon.bind({});
|
|
73
|
+
MgInputToggleWithIcon.args = Object.assign(Object.assign({}, args), { isIcon: true, isOnOff: true });
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
.mg-message {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
position: relative;
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
min-height: var(--default-size);
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
background-color: white;
|
|
8
|
+
border-radius: var(--mg-message-border-radius);
|
|
9
|
+
box-shadow: 0 0.3rem 0.8rem 0 hsla(var(--color-dark), 0.1);
|
|
10
|
+
}
|
|
11
|
+
.mg-message::before {
|
|
12
|
+
content: "";
|
|
13
|
+
position: absolute;
|
|
14
|
+
top: 0;
|
|
15
|
+
left: 0;
|
|
16
|
+
width: 0.3rem;
|
|
17
|
+
height: 100%;
|
|
18
|
+
}
|
|
19
|
+
.mg-message.mg-message--info::before {
|
|
20
|
+
background-color: hsl(var(--color-info));
|
|
21
|
+
}
|
|
22
|
+
.mg-message.mg-message--info .mg-message__icon {
|
|
23
|
+
color: hsl(var(--color-info));
|
|
24
|
+
}
|
|
25
|
+
.mg-message.mg-message--warning::before {
|
|
26
|
+
background-color: hsl(var(--color-warning));
|
|
27
|
+
}
|
|
28
|
+
.mg-message.mg-message--warning .mg-message__icon {
|
|
29
|
+
color: hsl(var(--color-warning));
|
|
30
|
+
}
|
|
31
|
+
.mg-message.mg-message--success::before {
|
|
32
|
+
background-color: hsl(var(--color-success));
|
|
33
|
+
}
|
|
34
|
+
.mg-message.mg-message--success .mg-message__icon {
|
|
35
|
+
color: hsl(var(--color-success));
|
|
36
|
+
}
|
|
37
|
+
.mg-message.mg-message--danger::before {
|
|
38
|
+
background-color: hsl(var(--color-danger));
|
|
39
|
+
}
|
|
40
|
+
.mg-message.mg-message--danger .mg-message__icon {
|
|
41
|
+
color: hsl(var(--color-danger));
|
|
42
|
+
}
|
|
43
|
+
.mg-message.mg-message--close-button {
|
|
44
|
+
padding-right: 3.4rem;
|
|
45
|
+
}
|
|
46
|
+
.mg-message.mg-message--hide {
|
|
47
|
+
display: none;
|
|
48
|
+
}
|
|
49
|
+
.mg-message ::slotted(*) {
|
|
50
|
+
margin: 0;
|
|
51
|
+
padding: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.mg-message__icon {
|
|
55
|
+
position: absolute;
|
|
56
|
+
top: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);
|
|
57
|
+
left: 1.3rem;
|
|
58
|
+
line-height: 1;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.mg-message__content {
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-wrap: wrap;
|
|
64
|
+
justify-content: flex-end;
|
|
65
|
+
align-content: stretch;
|
|
66
|
+
padding: 0 1rem 0 3.8rem;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.mg-message__content-slot {
|
|
70
|
+
flex-grow: 1;
|
|
71
|
+
margin: 0.84rem 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.mg-message__content-separator {
|
|
75
|
+
display: inline-block;
|
|
76
|
+
width: 4.5rem;
|
|
77
|
+
height: 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.mg-message__content-actions-slot {
|
|
81
|
+
padding: 1rem 0;
|
|
82
|
+
text-align: right;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.mg-message__close-button {
|
|
86
|
+
position: absolute;
|
|
87
|
+
top: 0;
|
|
88
|
+
right: 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.mg-message,
|
|
92
|
+
mg-message {
|
|
93
|
+
max-width: 100%;
|
|
94
|
+
}
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { Component, Element, Event, h, Prop, State, Watch } from '@stencil/core';
|
|
2
|
+
import { createID, ClassList } from '../../../utils/components.utils';
|
|
3
|
+
import { variants } from './mg-message.conf';
|
|
4
|
+
import { messages } from '../../../locales';
|
|
5
|
+
export class MgMessage {
|
|
6
|
+
constructor() {
|
|
7
|
+
/************
|
|
8
|
+
* Internal *
|
|
9
|
+
************/
|
|
10
|
+
this.closeButtonId = '';
|
|
11
|
+
// Stored timer setted when hide action is run from setTimeOut
|
|
12
|
+
this.storedTimer = null;
|
|
13
|
+
/**
|
|
14
|
+
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
15
|
+
* If not set, it will be created.
|
|
16
|
+
*/
|
|
17
|
+
this.identifier = createID('mg-message');
|
|
18
|
+
/**
|
|
19
|
+
* Message variant
|
|
20
|
+
*/
|
|
21
|
+
this.variant = variants[0];
|
|
22
|
+
/**
|
|
23
|
+
* Define if message has a cross button
|
|
24
|
+
* RG 01: https://jira.mgdis.fr/browse/PDA9-140
|
|
25
|
+
*/
|
|
26
|
+
this.closeButton = false;
|
|
27
|
+
/**
|
|
28
|
+
* Define if message is hidden
|
|
29
|
+
*/
|
|
30
|
+
this.hide = false;
|
|
31
|
+
/**
|
|
32
|
+
* Component classes
|
|
33
|
+
*/
|
|
34
|
+
this.classList = new ClassList(['mg-message']);
|
|
35
|
+
/**
|
|
36
|
+
* Define if component is using actions slot
|
|
37
|
+
*/
|
|
38
|
+
this.hasActions = false;
|
|
39
|
+
/**
|
|
40
|
+
* Handle close button
|
|
41
|
+
*/
|
|
42
|
+
this.handleClose = () => {
|
|
43
|
+
this.hide = true;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Hide component whith delay
|
|
47
|
+
*/
|
|
48
|
+
this.hideWithDelay = () => {
|
|
49
|
+
if (this.delay > 0 && this.hide !== true) {
|
|
50
|
+
this.storedTimer = setTimeout(() => (this.hide = true), this.delay * 1000);
|
|
51
|
+
}
|
|
52
|
+
else if (this.storedTimer !== null) {
|
|
53
|
+
clearTimeout(this.storedTimer);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Get icon corresponding to variant
|
|
58
|
+
*/
|
|
59
|
+
this.getIcon = () => {
|
|
60
|
+
switch (this.variant) {
|
|
61
|
+
case 'info':
|
|
62
|
+
return 'info-circle';
|
|
63
|
+
case 'warning':
|
|
64
|
+
return 'exclamation-triangle';
|
|
65
|
+
case 'success':
|
|
66
|
+
return 'check-circle';
|
|
67
|
+
case 'danger':
|
|
68
|
+
return 'exclamation-circle';
|
|
69
|
+
default:
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
validateDelay(newValue) {
|
|
75
|
+
if (newValue && newValue < 2) {
|
|
76
|
+
throw new Error(`<mg-message> prop "delay" must be greater than 2 seconds.`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
validateVariant(newValue, oldValue) {
|
|
80
|
+
if (!variants.includes(newValue)) {
|
|
81
|
+
throw new Error(`<mg-message> prop "variant" must be one of : ${variants.join(', ')}`);
|
|
82
|
+
}
|
|
83
|
+
if (oldValue !== undefined) {
|
|
84
|
+
this.classList.delete(`mg-message--${oldValue}`);
|
|
85
|
+
}
|
|
86
|
+
this.classList.add(`mg-message--${this.variant}`);
|
|
87
|
+
}
|
|
88
|
+
validateCloseButton(newValue) {
|
|
89
|
+
if (newValue && this.hasActions) {
|
|
90
|
+
this.closeButton = false;
|
|
91
|
+
throw new Error('<mg-message> prop "close-button" can\'t be used with the actions slot.');
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
validateHide(newValue) {
|
|
95
|
+
if (newValue) {
|
|
96
|
+
this.componentHide.emit();
|
|
97
|
+
this.classList.add('mg-message--hide');
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
this.componentShow.emit();
|
|
101
|
+
this.classList.delete('mg-message--hide');
|
|
102
|
+
}
|
|
103
|
+
this.hideWithDelay();
|
|
104
|
+
}
|
|
105
|
+
/*************
|
|
106
|
+
* Lifecycle *
|
|
107
|
+
*************/
|
|
108
|
+
/**
|
|
109
|
+
* Check if component props are well configured on init
|
|
110
|
+
*/
|
|
111
|
+
componentWillLoad() {
|
|
112
|
+
this.validateVariant(this.variant);
|
|
113
|
+
// Check if close button is an can be activated
|
|
114
|
+
this.hasActions = this.element.querySelector('[slot="actions"]') !== null;
|
|
115
|
+
this.validateCloseButton(this.closeButton);
|
|
116
|
+
if (this.closeButton) {
|
|
117
|
+
this.classList.add('mg-message--close-button');
|
|
118
|
+
this.closeButtonId = `${this.identifier}-close-button`;
|
|
119
|
+
}
|
|
120
|
+
this.validateDelay(this.delay);
|
|
121
|
+
this.validateHide(this.hide);
|
|
122
|
+
}
|
|
123
|
+
render() {
|
|
124
|
+
return (h("div", { id: this.identifier, class: this.classList.join(), role: this.variant === 'info' ? 'status' : 'alert' },
|
|
125
|
+
h("span", { class: "mg-message__icon" },
|
|
126
|
+
h("mg-icon", { icon: this.getIcon() })),
|
|
127
|
+
h("div", { class: "mg-message__content" },
|
|
128
|
+
h("span", { class: "mg-message__content-slot" },
|
|
129
|
+
h("slot", null)),
|
|
130
|
+
this.hasActions && h("span", { class: "mg-message__content-separator" }),
|
|
131
|
+
this.hasActions && (h("span", { class: "mg-message__content-actions-slot" },
|
|
132
|
+
h("slot", { name: "actions" })))),
|
|
133
|
+
this.closeButton && (h("span", { class: "mg-message__close-button" },
|
|
134
|
+
h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: messages.message.closeButton, onClick: this.handleClose },
|
|
135
|
+
h("mg-icon", { icon: "cross" }))))));
|
|
136
|
+
}
|
|
137
|
+
static get is() { return "mg-message"; }
|
|
138
|
+
static get encapsulation() { return "shadow"; }
|
|
139
|
+
static get originalStyleUrls() { return {
|
|
140
|
+
"$": ["mg-message.scss"]
|
|
141
|
+
}; }
|
|
142
|
+
static get styleUrls() { return {
|
|
143
|
+
"$": ["mg-message.css"]
|
|
144
|
+
}; }
|
|
145
|
+
static get properties() { return {
|
|
146
|
+
"identifier": {
|
|
147
|
+
"type": "string",
|
|
148
|
+
"mutable": false,
|
|
149
|
+
"complexType": {
|
|
150
|
+
"original": "string",
|
|
151
|
+
"resolved": "string",
|
|
152
|
+
"references": {}
|
|
153
|
+
},
|
|
154
|
+
"required": false,
|
|
155
|
+
"optional": false,
|
|
156
|
+
"docs": {
|
|
157
|
+
"tags": [],
|
|
158
|
+
"text": "Identifier is used for the element ID (id is a reserved prop in Stencil.js)\nIf not set, it will be created."
|
|
159
|
+
},
|
|
160
|
+
"attribute": "identifier",
|
|
161
|
+
"reflect": false,
|
|
162
|
+
"defaultValue": "createID('mg-message')"
|
|
163
|
+
},
|
|
164
|
+
"delay": {
|
|
165
|
+
"type": "number",
|
|
166
|
+
"mutable": false,
|
|
167
|
+
"complexType": {
|
|
168
|
+
"original": "number",
|
|
169
|
+
"resolved": "number",
|
|
170
|
+
"references": {}
|
|
171
|
+
},
|
|
172
|
+
"required": false,
|
|
173
|
+
"optional": false,
|
|
174
|
+
"docs": {
|
|
175
|
+
"tags": [],
|
|
176
|
+
"text": "Add a delay to hide/close message when it passed\nValue is defined in seconds and must greater than 2 seconds (PDA9-314 RG-06)"
|
|
177
|
+
},
|
|
178
|
+
"attribute": "delay",
|
|
179
|
+
"reflect": false
|
|
180
|
+
},
|
|
181
|
+
"variant": {
|
|
182
|
+
"type": "string",
|
|
183
|
+
"mutable": false,
|
|
184
|
+
"complexType": {
|
|
185
|
+
"original": "string",
|
|
186
|
+
"resolved": "string",
|
|
187
|
+
"references": {}
|
|
188
|
+
},
|
|
189
|
+
"required": false,
|
|
190
|
+
"optional": false,
|
|
191
|
+
"docs": {
|
|
192
|
+
"tags": [],
|
|
193
|
+
"text": "Message variant"
|
|
194
|
+
},
|
|
195
|
+
"attribute": "variant",
|
|
196
|
+
"reflect": false,
|
|
197
|
+
"defaultValue": "variants[0]"
|
|
198
|
+
},
|
|
199
|
+
"closeButton": {
|
|
200
|
+
"type": "boolean",
|
|
201
|
+
"mutable": false,
|
|
202
|
+
"complexType": {
|
|
203
|
+
"original": "boolean",
|
|
204
|
+
"resolved": "boolean",
|
|
205
|
+
"references": {}
|
|
206
|
+
},
|
|
207
|
+
"required": false,
|
|
208
|
+
"optional": false,
|
|
209
|
+
"docs": {
|
|
210
|
+
"tags": [],
|
|
211
|
+
"text": "Define if message has a cross button\nRG 01: https://jira.mgdis.fr/browse/PDA9-140"
|
|
212
|
+
},
|
|
213
|
+
"attribute": "close-button",
|
|
214
|
+
"reflect": false,
|
|
215
|
+
"defaultValue": "false"
|
|
216
|
+
},
|
|
217
|
+
"hide": {
|
|
218
|
+
"type": "boolean",
|
|
219
|
+
"mutable": true,
|
|
220
|
+
"complexType": {
|
|
221
|
+
"original": "boolean",
|
|
222
|
+
"resolved": "boolean",
|
|
223
|
+
"references": {}
|
|
224
|
+
},
|
|
225
|
+
"required": false,
|
|
226
|
+
"optional": false,
|
|
227
|
+
"docs": {
|
|
228
|
+
"tags": [],
|
|
229
|
+
"text": "Define if message is hidden"
|
|
230
|
+
},
|
|
231
|
+
"attribute": "hide",
|
|
232
|
+
"reflect": false,
|
|
233
|
+
"defaultValue": "false"
|
|
234
|
+
}
|
|
235
|
+
}; }
|
|
236
|
+
static get states() { return {
|
|
237
|
+
"classList": {},
|
|
238
|
+
"hasActions": {}
|
|
239
|
+
}; }
|
|
240
|
+
static get events() { return [{
|
|
241
|
+
"method": "componentShow",
|
|
242
|
+
"name": "component-show",
|
|
243
|
+
"bubbles": true,
|
|
244
|
+
"cancelable": true,
|
|
245
|
+
"composed": true,
|
|
246
|
+
"docs": {
|
|
247
|
+
"tags": [],
|
|
248
|
+
"text": "Emmited event when message is diplayed"
|
|
249
|
+
},
|
|
250
|
+
"complexType": {
|
|
251
|
+
"original": "string",
|
|
252
|
+
"resolved": "string",
|
|
253
|
+
"references": {}
|
|
254
|
+
}
|
|
255
|
+
}, {
|
|
256
|
+
"method": "componentHide",
|
|
257
|
+
"name": "component-hide",
|
|
258
|
+
"bubbles": true,
|
|
259
|
+
"cancelable": true,
|
|
260
|
+
"composed": true,
|
|
261
|
+
"docs": {
|
|
262
|
+
"tags": [],
|
|
263
|
+
"text": "Emmited event when message is hidden"
|
|
264
|
+
},
|
|
265
|
+
"complexType": {
|
|
266
|
+
"original": "string",
|
|
267
|
+
"resolved": "string",
|
|
268
|
+
"references": {}
|
|
269
|
+
}
|
|
270
|
+
}]; }
|
|
271
|
+
static get elementRef() { return "element"; }
|
|
272
|
+
static get watchers() { return [{
|
|
273
|
+
"propName": "delay",
|
|
274
|
+
"methodName": "validateDelay"
|
|
275
|
+
}, {
|
|
276
|
+
"propName": "variant",
|
|
277
|
+
"methodName": "validateVariant"
|
|
278
|
+
}, {
|
|
279
|
+
"propName": "closeButton",
|
|
280
|
+
"methodName": "validateCloseButton"
|
|
281
|
+
}, {
|
|
282
|
+
"propName": "hide",
|
|
283
|
+
"methodName": "validateHide"
|
|
284
|
+
}]; }
|
|
285
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { h } from '@stencil/core';
|
|
2
|
+
import { variants } from './mg-message.conf';
|
|
3
|
+
export default {
|
|
4
|
+
component: 'mg-message',
|
|
5
|
+
title: 'Molecules/mg-message',
|
|
6
|
+
argTypes: {
|
|
7
|
+
variant: {
|
|
8
|
+
options: variants,
|
|
9
|
+
control: { type: 'select' },
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* 1. camelCase arguments must be written in the template, for exemple labelOnTop must be placed in the template as label-on-top={args.labelOnTop}
|
|
15
|
+
* 2. boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
|
|
16
|
+
*/
|
|
17
|
+
const Template = args => {
|
|
18
|
+
// Extract slot so it won't be render as an attribute
|
|
19
|
+
const slotContent = args.slotContent;
|
|
20
|
+
delete args.slotContent;
|
|
21
|
+
const slotActions = args.slotActions;
|
|
22
|
+
delete args.slotActions;
|
|
23
|
+
const closeButton = args.closeButton;
|
|
24
|
+
delete args.closeButton;
|
|
25
|
+
// return element
|
|
26
|
+
return (h("mg-message", Object.assign({}, args, { "close-button": closeButton }),
|
|
27
|
+
slotContent && h("span", { innerHTML: slotContent }),
|
|
28
|
+
slotActions && h("span", { slot: "actions", innerHTML: slotActions })));
|
|
29
|
+
};
|
|
30
|
+
export const MgMessage = Template.bind({});
|
|
31
|
+
MgMessage.args = {
|
|
32
|
+
slotContent: `<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>`,
|
|
33
|
+
slotActions: ``,
|
|
34
|
+
identifier: 'identifier',
|
|
35
|
+
variant: variants[0],
|
|
36
|
+
closeButton: false,
|
|
37
|
+
hide: false,
|
|
38
|
+
delay: undefined,
|
|
39
|
+
};
|
|
40
|
+
export const WithCloseButton = Template.bind({});
|
|
41
|
+
WithCloseButton.args = Object.assign(Object.assign({}, MgMessage.args), { variant: 'danger', closeButton: true });
|
|
42
|
+
export const WithActions = Template.bind({});
|
|
43
|
+
WithActions.args = Object.assign(Object.assign({}, MgMessage.args), { variant: 'warning', slotActions: `<div slot="actions" class="mg-group-elements mg-group-elements--align-right"><mg-button>Primary</mg-button><mg-button variant="secondary">Secondary</mg-button></div>` });
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A11Y
|
|
3
|
+
*/
|
|
4
|
+
.sr-only {
|
|
5
|
+
border: 0 !important;
|
|
6
|
+
clip: rect(1px, 1px, 1px, 1px) !important;
|
|
7
|
+
-webkit-clip-path: inset(50%) !important;
|
|
8
|
+
clip-path: inset(50%) !important;
|
|
9
|
+
height: 1px !important;
|
|
10
|
+
margin: -1px !important;
|
|
11
|
+
overflow: hidden !important;
|
|
12
|
+
padding: 0 !important;
|
|
13
|
+
position: absolute !important;
|
|
14
|
+
width: 1px !important;
|
|
15
|
+
white-space: nowrap !important;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
*:focus:not(:focus-visible) {
|
|
19
|
+
outline: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.mg-pagination__nav {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
flex-direction: row;
|
|
26
|
+
}
|
|
27
|
+
.mg-pagination__nav mg-input-select {
|
|
28
|
+
margin-right: 0.5rem;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.mg-pagination__button {
|
|
32
|
+
display: flex;
|
|
33
|
+
}
|
|
34
|
+
.mg-pagination__button:first-of-type {
|
|
35
|
+
margin-right: 1rem;
|
|
36
|
+
}
|
|
37
|
+
.mg-pagination__button:last-of-type {
|
|
38
|
+
margin-left: 1rem;
|
|
39
|
+
}
|