@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
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create random ID
|
|
3
|
+
* @param prefix {string} add prefix to created ID
|
|
4
|
+
* @returns {string} ID
|
|
5
|
+
*/
|
|
6
|
+
export declare function createID(prefix?: string, length?: number): string;
|
|
7
|
+
/**
|
|
8
|
+
* Class to manage component classlist
|
|
9
|
+
* Set() are not working when imported in project
|
|
10
|
+
*/
|
|
11
|
+
export declare class ClassList {
|
|
12
|
+
classes: string[];
|
|
13
|
+
constructor(classlist?: string[]);
|
|
14
|
+
/**
|
|
15
|
+
* Add class
|
|
16
|
+
* @param className
|
|
17
|
+
* @returns {void}
|
|
18
|
+
*/
|
|
19
|
+
add: (className: string) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Delete class
|
|
22
|
+
* @param className
|
|
23
|
+
* @returns {void}
|
|
24
|
+
*/
|
|
25
|
+
delete: (className: string) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Check if class exist in list
|
|
28
|
+
* @param className
|
|
29
|
+
* @returns {boolean}
|
|
30
|
+
*/
|
|
31
|
+
has: (className: string) => boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Join classes seperated by spaces
|
|
34
|
+
* @returns {string}
|
|
35
|
+
*/
|
|
36
|
+
join: () => string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Check if all items are string
|
|
40
|
+
* @param items
|
|
41
|
+
* @returns {boolean}
|
|
42
|
+
*/
|
|
43
|
+
export declare function allItemsAreString(items: Array<string>): boolean;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format number to the locale currency
|
|
3
|
+
* @param number {number}
|
|
4
|
+
* @returns {string} formatted currency
|
|
5
|
+
*/
|
|
6
|
+
export declare function localeCurrency(number: number): string;
|
|
7
|
+
/**
|
|
8
|
+
* Format number to locale
|
|
9
|
+
* @param number {number}
|
|
10
|
+
* @returns {string} formatted number
|
|
11
|
+
*/
|
|
12
|
+
export declare function localeNumber(number: number): string;
|
|
13
|
+
/**
|
|
14
|
+
* Date RegExp
|
|
15
|
+
*/
|
|
16
|
+
export declare const dateRegExp: RegExp;
|
|
17
|
+
/**
|
|
18
|
+
* Locale date format
|
|
19
|
+
* @param date {string}
|
|
20
|
+
* @returns {string} formatted date
|
|
21
|
+
*/
|
|
22
|
+
export declare function localeDate(date: string): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { E2EPage } from '@stencil/core/testing';
|
|
2
|
+
import { Page as PuppeteerPage } from 'puppeteer';
|
|
3
|
+
export declare type DesignSystemE2EPage = E2EPage & Pick<PuppeteerPage, 'screenshot' | 'viewport'>;
|
|
4
|
+
export declare function createPage(htmlString?: string): Promise<DesignSystemE2EPage>;
|
|
5
|
+
export declare const cloneDeep: (el: any) => any;
|
package/loader/cdn.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from '../dist/types/components';
|
|
2
|
+
export interface CustomElementsDefineOptions {
|
|
3
|
+
exclude?: string[];
|
|
4
|
+
resourcesUrl?: string;
|
|
5
|
+
syncQueue?: boolean;
|
|
6
|
+
jmp?: (c: Function) => any;
|
|
7
|
+
raf?: (c: FrameRequestCallback) => number;
|
|
8
|
+
ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
9
|
+
rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function defineCustomElements(win?: Window, opts?: CustomElementsDefineOptions): Promise<void>;
|
|
12
|
+
export declare function applyPolyfills(): Promise<void>;
|
package/loader/index.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
|
|
2
|
+
(function(){if("undefined"!==typeof window&&void 0!==window.Reflect&&void 0!==window.customElements){var a=HTMLElement;window.HTMLElement=function(){return Reflect.construct(a,[],this.constructor)};HTMLElement.prototype=a.prototype;HTMLElement.prototype.constructor=HTMLElement;Object.setPrototypeOf(HTMLElement,a)}})();
|
|
3
|
+
export * from '../dist/esm/polyfills/index.js';
|
|
4
|
+
export * from '../dist/esm-es5/loader.js';
|
package/package.json
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mgdis/mg-components",
|
|
3
|
+
"version": "3.1.0",
|
|
4
|
+
"description": "MG Components",
|
|
5
|
+
"main": "dist/index.cjs.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"es2015": "dist/esm/index.mjs",
|
|
8
|
+
"es2017": "dist/esm/index.mjs",
|
|
9
|
+
"types": "dist/types/index.d.ts",
|
|
10
|
+
"collection": "dist/collection/collection-manifest.json",
|
|
11
|
+
"collection:main": "dist/collection/index.js",
|
|
12
|
+
"unpkg": "dist/mg-components/mg-components.esm.js",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist/",
|
|
15
|
+
"loader/"
|
|
16
|
+
],
|
|
17
|
+
"maintainers": [
|
|
18
|
+
"Simon Duhem <duhem-s@mgdis.fr>",
|
|
19
|
+
"Nicolas Jouanno <jouanno-n@mgdis.fr>"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "stencil build --docs",
|
|
23
|
+
"start": "stencil build --dev --watch --serve",
|
|
24
|
+
"lint": "run-s lint:es lint:prettier",
|
|
25
|
+
"lint:es": "eslint src/**/*.{ts,tsx}",
|
|
26
|
+
"lint:prettier": "prettier --check **/*.{ts,tsx,scss,html,mdx,json}",
|
|
27
|
+
"lint:prettier:fix": "prettier --write **/*.{ts,tsx,scss,html,mdx,json}",
|
|
28
|
+
"test": "stencil test --spec --e2e",
|
|
29
|
+
"test:unit": "stencil test --spec",
|
|
30
|
+
"test:e2e": "stencil test --e2e",
|
|
31
|
+
"test.watch": "stencil test --spec --e2e --watchAll",
|
|
32
|
+
"generate": "stencil generate",
|
|
33
|
+
"storybook": "start-storybook -p 6006 -s www/build",
|
|
34
|
+
"storybook:build": "build-storybook",
|
|
35
|
+
"prepare": "husky install"
|
|
36
|
+
},
|
|
37
|
+
"jest-junit": {
|
|
38
|
+
"outputDirectory": "coverage",
|
|
39
|
+
"outputName": "junit.xml"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@popperjs/core": "^2.11.2",
|
|
43
|
+
"@stencil/core": "^2.14.1",
|
|
44
|
+
"normalize.css": "^8.0.1"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@babel/core": "^7.15.5",
|
|
48
|
+
"@babel/plugin-transform-react-jsx": "^7.14.9",
|
|
49
|
+
"@pxtrn/storybook-addon-docs-stencil": "^6.4.1",
|
|
50
|
+
"@stencil/eslint-plugin": "^0.4.0",
|
|
51
|
+
"@stencil/sass": "^1.5.2",
|
|
52
|
+
"@storybook/addon-a11y": "^6.4.19",
|
|
53
|
+
"@storybook/addon-actions": "^6.4.19",
|
|
54
|
+
"@storybook/addon-docs": "^6.4.19",
|
|
55
|
+
"@storybook/addon-essentials": "^6.4.19",
|
|
56
|
+
"@storybook/addon-links": "^6.4.19",
|
|
57
|
+
"@storybook/html": "^6.4.19",
|
|
58
|
+
"@storybook/preset-scss": "^1.0.3",
|
|
59
|
+
"@types/jest": "^26.0.24",
|
|
60
|
+
"@types/jest-image-snapshot": "^4.3.1",
|
|
61
|
+
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
62
|
+
"@typescript-eslint/parser": "^4.33.0",
|
|
63
|
+
"babel-loader": "^8.2.2",
|
|
64
|
+
"babel-plugin-jsx-pragmatic": "^1.0.2",
|
|
65
|
+
"css-loader": "^5.2.7",
|
|
66
|
+
"eslint": "^7.32.0",
|
|
67
|
+
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
68
|
+
"eslint-plugin-react": "^7.26.1",
|
|
69
|
+
"eslint-plugin-storybook": "^0.5.7",
|
|
70
|
+
"husky": "^7.0.4",
|
|
71
|
+
"jest": "^26.6.3",
|
|
72
|
+
"jest-cli": "^26.6.3",
|
|
73
|
+
"jest-image-snapshot": "^4.5.1",
|
|
74
|
+
"jest-junit": "^13.0.0",
|
|
75
|
+
"jsx-dom": "^8.0.1-beta.1",
|
|
76
|
+
"npm-run-all": "^4.1.5",
|
|
77
|
+
"postcss": "^8.4.5",
|
|
78
|
+
"prettier": "^2.5.1",
|
|
79
|
+
"puppeteer": "^13.3.2",
|
|
80
|
+
"sass": "^1.41.0",
|
|
81
|
+
"sass-loader": "^10.2.0",
|
|
82
|
+
"style-loader": "^2.0.0",
|
|
83
|
+
"typescript": "^4.4.3"
|
|
84
|
+
},
|
|
85
|
+
"license": "BSD-3-Clause"
|
|
86
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# MG Components
|
|
4
|
+
|
|
5
|
+
This project centralize MGDIS standalone Web Components using [Stencil](https://stenciljs.com/).
|
|
6
|
+
|
|
7
|
+
All components refer to [PDA9-61 Spec](https://jira.mgdis.fr/browse/PDA9-61).
|
|
8
|
+
|
|
9
|
+
## Stencil
|
|
10
|
+
|
|
11
|
+
Stencil is a compiler for building fast web apps using Web Components.
|
|
12
|
+
|
|
13
|
+
Stencil combines the best concepts of the most popular frontend frameworks into a compile-time rather than run-time tool. Stencil takes TypeScript, JSX, a tiny virtual DOM layer, efficient one-way data binding, an asynchronous rendering pipeline (similar to React Fiber), and lazy-loading out of the box, and generates 100% standards-based Web Components that run in any browser supporting the Custom Elements v1 spec.
|
|
14
|
+
|
|
15
|
+
Stencil components are just Web Components, so they work in any major framework or with no framework at all.
|
|
16
|
+
|
|
17
|
+
## Getting Started
|
|
18
|
+
|
|
19
|
+
To run MG Components, clone this repo to a new directory:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
git clone https://gitlab.mgdis.fr/core/core-ui/mg-components
|
|
23
|
+
cd mg-components
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
and run:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm ci
|
|
30
|
+
npm start
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
To build for production, run:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm run build
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
To run tests for the components, run:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm run test
|
|
43
|
+
|
|
44
|
+
# only unit tests
|
|
45
|
+
npm run test:unit
|
|
46
|
+
|
|
47
|
+
# only e2e tests
|
|
48
|
+
npm run test:e2e
|
|
49
|
+
|
|
50
|
+
# filter on filename
|
|
51
|
+
npm run test -- mg-icon
|
|
52
|
+
```
|
|
53
|
+
To regenerate snapshot you must add the `-u` parameter.
|
|
54
|
+
|
|
55
|
+
To add a component, run:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm run generate component-path
|
|
59
|
+
|
|
60
|
+
# example for an atom
|
|
61
|
+
npm run generate atoms/mg-icon
|
|
62
|
+
|
|
63
|
+
# example for a molecule
|
|
64
|
+
npm run generate molecules/mg-message
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Naming Components
|
|
68
|
+
|
|
69
|
+
When creating new component tags, we recommend _not_ using `stencil` in the component name (ex: `<stencil-datepicker>`). This is because the generated component has little to nothing to do with Stencil; it's just a web component!
|
|
70
|
+
|
|
71
|
+
Instead, use a prefix that fits your company or any name for a group of related components. For example, all of the MGDIS generated web components use the prefix `mg`.
|
|
72
|
+
|
|
73
|
+
## Using this library
|
|
74
|
+
|
|
75
|
+
There are three strategies we recommend for using web components built with Stencil.
|
|
76
|
+
|
|
77
|
+
The first step for all three of these strategies is to [publish to NPM](https://docs.npmjs.com/getting-started/publishing-npm-packages).
|
|
78
|
+
|
|
79
|
+
### Script tag
|
|
80
|
+
|
|
81
|
+
- Put a script tag similar to this `<script src='https://unpkg.com/mg-button@0.0.1/dist/mg-button.esm.js'></script>` in the head of your index.html
|
|
82
|
+
- Then you can use the element anywhere in your template, JSX, html etc
|
|
83
|
+
|
|
84
|
+
### Node Modules
|
|
85
|
+
|
|
86
|
+
- Run `npm install @mgdis/mg-button --save`
|
|
87
|
+
- Put a script tag similar to this `<script src='node_modules/mg-button/dist/mg-button.esm.js'></script>` in the head of your index.html
|
|
88
|
+
- Then you can use the element anywhere in your template, JSX, html etc
|
|
89
|
+
|
|
90
|
+
### In a stencil-starter app
|
|
91
|
+
|
|
92
|
+
- Run `npm install @mgdis/mg-button --save`
|
|
93
|
+
- Add an import to the npm packages `import @mgdis/mg-button;`
|
|
94
|
+
- Then you can use the element anywhere in your template, JSX, html etc
|
|
95
|
+
|
|
96
|
+
## Style
|
|
97
|
+
|
|
98
|
+
### Naming methodology
|
|
99
|
+
|
|
100
|
+
MG Components is using [BEM](https://en.bem.info/) (Block, Element, Modifier) methodology with the [two dashes style](https://en.bem.info/methodology/naming-convention/#two-dashes-style) naming scheme.
|
|
101
|
+
|
|
102
|
+
### Declaration organisation
|
|
103
|
+
|
|
104
|
+
When a selector contains too many declaration it is recommended to organize them by theme : Display, Decoration, Font, Others.
|
|
105
|
+
|
|
106
|
+
```CSS
|
|
107
|
+
.mg-button {
|
|
108
|
+
// Display
|
|
109
|
+
display: inline-block;
|
|
110
|
+
vertical-align: middle;
|
|
111
|
+
min-height: 3.5rem;
|
|
112
|
+
padding: 0.6rem 1.2rem;
|
|
113
|
+
// Decoration
|
|
114
|
+
background-image: none;
|
|
115
|
+
border-radius: 0.3rem;
|
|
116
|
+
border: 0.1rem solid transparent;
|
|
117
|
+
cursor: pointer;
|
|
118
|
+
// Font
|
|
119
|
+
font-weight: normal;
|
|
120
|
+
text-align: center;
|
|
121
|
+
white-space: nowrap;
|
|
122
|
+
// Others
|
|
123
|
+
touch-action: manipulation;
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Accessibility
|
|
128
|
+
|
|
129
|
+
A good pratice is to manage hover, focus and active state at the same place.
|
|
130
|
+
|
|
131
|
+
```SCSS
|
|
132
|
+
/* SCSS */
|
|
133
|
+
button {
|
|
134
|
+
&:hover, &:focus, &:active {
|
|
135
|
+
text-decoration: underline;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* CSS */
|
|
140
|
+
button:hover, button:focus, button:active {
|
|
141
|
+
text-decoration: underline;
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Storybook
|
|
146
|
+
|
|
147
|
+
The plugin [storybook-addon-docs-stencil
|
|
148
|
+
](https://github.com/pixtron/storybook-addon-docs-stencil) is used to generate the doc. **To be up to date on local it needs a fresh build**.
|
|
149
|
+
|
|
150
|
+
### run
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
npm run storybook
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Notes
|
|
157
|
+
|
|
158
|
+
- camelCase arguments must be written in the template, for exemple labelOnTop must be placed in the template as label-on-top={args.labelOnTop}
|
|
159
|
+
- Boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
|