@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,82 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { C as ClassList } from './components.utils.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* List of all possibles variants
|
|
6
|
+
*/
|
|
7
|
+
const variants = ['primary', 'secondary', 'success', 'warning', 'danger', 'info'];
|
|
8
|
+
|
|
9
|
+
const mgBadgeCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}.mg-badge{padding:0 0.4rem;height:var(--mg-badge-size);min-width:var(--mg-badge-size);-webkit-box-sizing:border-box;box-sizing:border-box;border:0.1rem solid;border-radius:50%;border-radius:calc(var(--mg-badge-size) / 2);font-size:var(--mg-badge-font-size);font-weight:600;text-align:center;line-height:var(--mg-badge-size)}.mg-badge.mg-badge--primary{background-color:hsl(var(--color-dark));border-color:hsl(var(--color-dark));color:hsl(var(--color-light))}.mg-badge.mg-badge--primary.mg-badge--outline{background-color:transparent;color:hsl(var(--color-dark))}.mg-badge.mg-badge--secondary{background-color:hsl(var(--color-light));border-color:hsl(var(--color-light));color:hsl(var(--color-dark))}.mg-badge.mg-badge--secondary.mg-badge--outline{background-color:transparent;color:hsl(var(--color-light))}.mg-badge.mg-badge--success{background-color:hsl(var(--color-success));border-color:hsl(var(--color-success));color:hsl(var(--color-dark))}.mg-badge.mg-badge--success.mg-badge--outline{background-color:transparent;color:hsl(var(--color-success))}.mg-badge.mg-badge--warning{background-color:hsl(var(--color-warning));border-color:hsl(var(--color-warning));color:hsl(var(--color-dark))}.mg-badge.mg-badge--warning.mg-badge--outline{background-color:transparent;color:hsl(var(--color-warning))}.mg-badge.mg-badge--danger{background-color:hsl(var(--color-danger));border-color:hsl(var(--color-danger));color:hsl(var(--color-light))}.mg-badge.mg-badge--danger.mg-badge--outline{background-color:transparent;color:hsl(var(--color-danger))}.mg-badge.mg-badge--info{background-color:hsl(var(--color-info));border-color:hsl(var(--color-info));color:hsl(var(--color-light))}.mg-badge.mg-badge--info.mg-badge--outline{background-color:transparent;color:hsl(var(--color-info))}.mg-badge,mg-badge{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}";
|
|
10
|
+
|
|
11
|
+
const MgBadge = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
this.__registerHost();
|
|
15
|
+
this.__attachShadow();
|
|
16
|
+
/**
|
|
17
|
+
* Define button variant
|
|
18
|
+
*/
|
|
19
|
+
this.variant = variants[variants.length - 1];
|
|
20
|
+
/**
|
|
21
|
+
* Component classes
|
|
22
|
+
*/
|
|
23
|
+
this.classList = new ClassList(['mg-badge']);
|
|
24
|
+
}
|
|
25
|
+
valideValue(newValue) {
|
|
26
|
+
if (`${newValue}`.match(/^(\d+|[?*!a-z])$/i) === null) {
|
|
27
|
+
throw new Error('<mg-badge> prop "value" must be interger or ponctuation character.');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
validateVariant(newValue) {
|
|
31
|
+
if (!variants.includes(newValue)) {
|
|
32
|
+
throw new Error(`<mg-badge> prop "variant" must be one of : ${variants.join(', ')}.`);
|
|
33
|
+
}
|
|
34
|
+
this.classList.add(`mg-badge--${this.variant}`);
|
|
35
|
+
}
|
|
36
|
+
validateOutline(newValue) {
|
|
37
|
+
if (newValue)
|
|
38
|
+
this.classList.add(`mg-badge--outline`);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Check if props are well configured on init
|
|
42
|
+
*/
|
|
43
|
+
componentWillLoad() {
|
|
44
|
+
this.valideValue(this.value);
|
|
45
|
+
this.validateVariant(this.variant);
|
|
46
|
+
this.validateOutline(this.outline);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Render
|
|
50
|
+
*/
|
|
51
|
+
render() {
|
|
52
|
+
return (h("span", { class: this.classList.join() }, this.value, h("span", { class: "sr-only" }, this.label)));
|
|
53
|
+
}
|
|
54
|
+
static get watchers() { return {
|
|
55
|
+
"value": ["valideValue"],
|
|
56
|
+
"variant": ["validateVariant"],
|
|
57
|
+
"outline": ["validateOutline"]
|
|
58
|
+
}; }
|
|
59
|
+
static get style() { return mgBadgeCss; }
|
|
60
|
+
}, [1, "mg-badge", {
|
|
61
|
+
"value": [1032],
|
|
62
|
+
"label": [1],
|
|
63
|
+
"variant": [1],
|
|
64
|
+
"outline": [4],
|
|
65
|
+
"classList": [32]
|
|
66
|
+
}]);
|
|
67
|
+
function defineCustomElement() {
|
|
68
|
+
if (typeof customElements === "undefined") {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const components = ["mg-badge"];
|
|
72
|
+
components.forEach(tagName => { switch (tagName) {
|
|
73
|
+
case "mg-badge":
|
|
74
|
+
if (!customElements.get(tagName)) {
|
|
75
|
+
customElements.define(tagName, MgBadge);
|
|
76
|
+
}
|
|
77
|
+
break;
|
|
78
|
+
} });
|
|
79
|
+
}
|
|
80
|
+
defineCustomElement();
|
|
81
|
+
|
|
82
|
+
export { MgBadge as M, defineCustomElement as d };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface MgButton extends Components.MgButton, HTMLElement {}
|
|
4
|
+
export const MgButton: {
|
|
5
|
+
prototype: MgButton;
|
|
6
|
+
new (): MgButton;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { c as createID, C as ClassList } from './components.utils.js';
|
|
3
|
+
import { d as defineCustomElement$1 } from './mg-icon2.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* List of all possibles variants
|
|
7
|
+
*/
|
|
8
|
+
const variants = ['primary', 'secondary', 'danger', 'danger-alt', 'info', 'flat'];
|
|
9
|
+
|
|
10
|
+
const mgButtonCss = ".mg-button.sc-mg-button{position:relative;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;padding:calc((var(--default-size) - 0.2rem - var(--font-size) * var(--line-height)) / 2) 1.1rem;min-height:var(--default-size);-webkit-box-sizing:border-box;box-sizing:border-box;border-top-right-radius:var(--mg-button-border-radius-top-right, var(--mg-button-border-radius));border-top-left-radius:var(--mg-button-border-radius-top-left, var(--mg-button-border-radius));border-bottom-right-radius:var(--mg-button-border-radius-bottom-right, var(--mg-button-border-radius));border-bottom-left-radius:var(--mg-button-border-radius-bottom-left, var(--mg-button-border-radius));cursor:pointer;background-image:none;border:0.1rem solid;font-family:inherit;text-decoration:none;font-weight:normal;text-align:left;-ms-touch-action:manipulation;touch-action:manipulation}.mg-button[disabled].sc-mg-button,.mg-button[aria-disabled].sc-mg-button,.mg-button.disabled.sc-mg-button{opacity:var(--mg-button-disabled-opacity);cursor:not-allowed}.mg-button.mg-button--icon.sc-mg-button{padding:0;-ms-flex-pack:center;justify-content:center;width:var(--default-size);height:var(--default-size);border-radius:var(--mg-button-icon-border-radius)}.mg-button.mg-button--primary.sc-mg-button{border-color:hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l));border-color:hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), calc(var(--mg-button-primary-color-l) - 10%));color:hsl(var(--mg-button-primary-font-color));background:hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l));background:-webkit-gradient(linear, left top, left bottom, from(hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l))), to(hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), calc(var(--mg-button-primary-color-l) - 10%))));background:linear-gradient(to bottom, hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l)), hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), calc(var(--mg-button-primary-color-l) - 10%)))}.mg-button.mg-button--primary.sc-mg-button:hover:not([disabled],[aria-disabled].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--primary.sc-mg-button:focus:not([disabled],[aria-disabled].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--primary.sc-mg-button:active:not([disabled],[aria-disabled].sc-mg-button,.disabled).sc-mg-button{background:hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l))}.mg-button.mg-button--secondary.sc-mg-button{border-color:hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l));border-color:hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), calc(var(--mg-button-secondary-color-l) - 10%));color:hsl(var(--mg-button-secondary-font-color));background:hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l));background:-webkit-gradient(linear, left top, left bottom, from(hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l))), to(hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), calc(var(--mg-button-secondary-color-l) - 10%))));background:linear-gradient(to bottom, hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l)), hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), calc(var(--mg-button-secondary-color-l) - 10%)))}.mg-button.mg-button--secondary.sc-mg-button:hover:not([disabled],[aria-disabled].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--secondary.sc-mg-button:focus:not([disabled],[aria-disabled].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--secondary.sc-mg-button:active:not([disabled],[aria-disabled].sc-mg-button,.disabled).sc-mg-button{background:hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l))}.mg-button.mg-button--danger.sc-mg-button{border-color:hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l));border-color:hsl(var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) - 10%));color:hsl(var(--color-neutral));background:hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l));background:-webkit-gradient(linear, left top, left bottom, from(hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l))), to(hsl(var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) - 10%))));background:linear-gradient(to bottom, hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l)), hsl(var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) - 10%)))}.mg-button.mg-button--danger.sc-mg-button:hover:not([disabled],[aria-disabled].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--danger.sc-mg-button:focus:not([disabled],[aria-disabled].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--danger.sc-mg-button:active:not([disabled],[aria-disabled].sc-mg-button,.disabled).sc-mg-button{background:hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l))}.mg-button.mg-button--danger-alt.sc-mg-button{border-color:hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l));border-color:hsl(var(--color-neutral-h), var(--color-neutral-s), calc(var(--color-neutral-l) - 10%));color:hsl(var(--color-danger));background:hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l));background:-webkit-gradient(linear, left top, left bottom, from(hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l))), to(hsl(var(--color-neutral-h), var(--color-neutral-s), calc(var(--color-neutral-l) - 10%))));background:linear-gradient(to bottom, hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l)), hsl(var(--color-neutral-h), var(--color-neutral-s), calc(var(--color-neutral-l) - 10%)))}.mg-button.mg-button--danger-alt.sc-mg-button:hover:not([disabled],[aria-disabled].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--danger-alt.sc-mg-button:focus:not([disabled],[aria-disabled].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--danger-alt.sc-mg-button:active:not([disabled],[aria-disabled].sc-mg-button,.disabled).sc-mg-button{background:hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l))}.mg-button.mg-button--info.sc-mg-button{border-color:hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l));border-color:hsl(var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) - 10%));color:hsl(var(--color-neutral));background:hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l));background:-webkit-gradient(linear, left top, left bottom, from(hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l))), to(hsl(var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) - 10%))));background:linear-gradient(to bottom, hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l)), hsl(var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) - 10%)))}.mg-button.mg-button--info.sc-mg-button:hover:not([disabled],[aria-disabled].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--info.sc-mg-button:focus:not([disabled],[aria-disabled].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--info.sc-mg-button:active:not([disabled],[aria-disabled].sc-mg-button,.disabled).sc-mg-button{background:hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l))}.mg-button.mg-button--flat.sc-mg-button{background:none;border:none}.mg-button.mg-button--flat.sc-mg-button:hover:not([disabled],[aria-disabled].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--flat.sc-mg-button:focus:not([disabled],[aria-disabled].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--flat.sc-mg-button:active:not([disabled],[aria-disabled].sc-mg-button,.disabled).sc-mg-button{background:hsla(var(--color-dark), 0.1)}.mg-button.sc-mg-button-s>mg-icon,.mg-button .sc-mg-button-s>mg-icon{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-negative:0;flex-shrink:0;line-height:1;margin:auto 0}.mg-button__content.sc-mg-button{display:-ms-flexbox;display:flex;-ms-flex-align:baseline;align-items:baseline;-webkit-column-gap:0.6rem;-moz-column-gap:0.6rem;column-gap:0.6rem}.mg-button--loading.sc-mg-button>mg-icon.sc-mg-button{position:absolute;left:50%;top:50%;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%)}.mg-button--loading.sc-mg-button .mg-button__content.sc-mg-button{opacity:0}.mg-button.sc-mg-button-s>mg-badge,.mg-button .sc-mg-button-s>mg-badge{margin-left:0.3rem}mg-button.sc-mg-button{display:inline-block}.mg-button.sc-mg-button,mg-button.sc-mg-button{vertical-align:middle;max-width:100%}";
|
|
11
|
+
|
|
12
|
+
const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
this.__registerHost();
|
|
16
|
+
/************
|
|
17
|
+
* Internal *
|
|
18
|
+
************/
|
|
19
|
+
this.onClickElementFn = null;
|
|
20
|
+
/**
|
|
21
|
+
* Define button variant
|
|
22
|
+
*/
|
|
23
|
+
this.variant = variants[0]; // Primary
|
|
24
|
+
/**
|
|
25
|
+
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
26
|
+
* If not set, it will be created.
|
|
27
|
+
*/
|
|
28
|
+
this.identifier = createID('mg-button');
|
|
29
|
+
/**
|
|
30
|
+
* Disable button
|
|
31
|
+
*/
|
|
32
|
+
this.disabled = false;
|
|
33
|
+
/**
|
|
34
|
+
* Define if button is round.
|
|
35
|
+
* Used for icon button.
|
|
36
|
+
*/
|
|
37
|
+
this.isIcon = false;
|
|
38
|
+
/**
|
|
39
|
+
* Option to set input disable on click, in order to prevent multi-click.
|
|
40
|
+
* Parent component have to remove the attribute 'disabled' when the process ends.
|
|
41
|
+
*/
|
|
42
|
+
this.disableOnClick = false;
|
|
43
|
+
/**
|
|
44
|
+
* Define if button is loading, default to false.
|
|
45
|
+
* Trigger when button is clicked or key-up ['enter', 'space], then value change to true.
|
|
46
|
+
* It's required to reset to false when action/promise in parent is done to stop the loading state
|
|
47
|
+
*/
|
|
48
|
+
this.loading = false;
|
|
49
|
+
/**
|
|
50
|
+
* Component classes
|
|
51
|
+
*/
|
|
52
|
+
this.classList = new ClassList(['mg-button']);
|
|
53
|
+
/**
|
|
54
|
+
* Trigger actions onClick event
|
|
55
|
+
*/
|
|
56
|
+
this.handleClick = (event) => {
|
|
57
|
+
if (this.disabled)
|
|
58
|
+
event.stopPropagation();
|
|
59
|
+
// Used to prevent multi-click.
|
|
60
|
+
if (this.disableOnClick && !this.disabled) {
|
|
61
|
+
this.loading = true;
|
|
62
|
+
this.disabled = true;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
validateVariant(newValue) {
|
|
67
|
+
if (!variants.includes(newValue)) {
|
|
68
|
+
throw new Error(`<mg-button> prop "variant" must be one of : ${variants.join(', ')}`);
|
|
69
|
+
}
|
|
70
|
+
this.classList.add(`mg-button--${this.variant}`);
|
|
71
|
+
}
|
|
72
|
+
disabledHandler(isDisabled) {
|
|
73
|
+
// Remove loading when enable
|
|
74
|
+
// Will be set back onclick
|
|
75
|
+
if (!isDisabled && this.disableOnClick) {
|
|
76
|
+
this.loading = false;
|
|
77
|
+
}
|
|
78
|
+
// Manage if onclick
|
|
79
|
+
this.element.onclick = isDisabled ? undefined : this.onClickElementFn;
|
|
80
|
+
}
|
|
81
|
+
loadingHandler(newValue) {
|
|
82
|
+
// we add loading style if it newvalue is true else we remove it
|
|
83
|
+
if (newValue) {
|
|
84
|
+
this.classList.add('mg-button--loading');
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
this.classList.delete('mg-button--loading');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Check if props are well configured on init
|
|
92
|
+
*/
|
|
93
|
+
componentWillLoad() {
|
|
94
|
+
this.validateVariant(this.variant);
|
|
95
|
+
if (this.isIcon) {
|
|
96
|
+
this.classList.add(`mg-button--icon`);
|
|
97
|
+
if (typeof this.label !== 'string' || this.label === '') {
|
|
98
|
+
throw new Error(`<mg-button> prop "label" is mandatory when prop "isIcon" is set to true.`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// Store the onclick fn
|
|
102
|
+
this.onClickElementFn = this.element.onclick;
|
|
103
|
+
this.disabledHandler(this.disabled);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Render component
|
|
107
|
+
*/
|
|
108
|
+
render() {
|
|
109
|
+
return (h("button", { id: this.identifier, class: this.classList.join(), "aria-label": this.label, "aria-disabled": this.disabled, onClick: this.handleClick }, this.loading && h("mg-icon", { icon: "loader", spin: true }), h("div", { class: "mg-button__content" }, h("slot", null))));
|
|
110
|
+
}
|
|
111
|
+
get element() { return this; }
|
|
112
|
+
static get watchers() { return {
|
|
113
|
+
"variant": ["validateVariant"],
|
|
114
|
+
"disabled": ["disabledHandler"],
|
|
115
|
+
"loading": ["loadingHandler"]
|
|
116
|
+
}; }
|
|
117
|
+
static get style() { return mgButtonCss; }
|
|
118
|
+
}, [6, "mg-button", {
|
|
119
|
+
"variant": [1],
|
|
120
|
+
"identifier": [1],
|
|
121
|
+
"label": [1],
|
|
122
|
+
"disabled": [1028],
|
|
123
|
+
"isIcon": [4, "is-icon"],
|
|
124
|
+
"disableOnClick": [4, "disable-on-click"],
|
|
125
|
+
"loading": [32],
|
|
126
|
+
"classList": [32]
|
|
127
|
+
}]);
|
|
128
|
+
function defineCustomElement() {
|
|
129
|
+
if (typeof customElements === "undefined") {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const components = ["mg-button", "mg-icon"];
|
|
133
|
+
components.forEach(tagName => { switch (tagName) {
|
|
134
|
+
case "mg-button":
|
|
135
|
+
if (!customElements.get(tagName)) {
|
|
136
|
+
customElements.define(tagName, MgButton);
|
|
137
|
+
}
|
|
138
|
+
break;
|
|
139
|
+
case "mg-icon":
|
|
140
|
+
if (!customElements.get(tagName)) {
|
|
141
|
+
defineCustomElement$1();
|
|
142
|
+
}
|
|
143
|
+
break;
|
|
144
|
+
} });
|
|
145
|
+
}
|
|
146
|
+
defineCustomElement();
|
|
147
|
+
|
|
148
|
+
export { MgButton as M, defineCustomElement as d };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface MgCharacterLeft extends Components.MgCharacterLeft, HTMLElement {}
|
|
4
|
+
export const MgCharacterLeft: {
|
|
5
|
+
prototype: MgCharacterLeft;
|
|
6
|
+
new (): MgCharacterLeft;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { m as messages } from './index2.js';
|
|
3
|
+
|
|
4
|
+
const mgCharacterLeftCss = "mg-character-left.sc-mg-character-left{display:block}";
|
|
5
|
+
|
|
6
|
+
const MgCharacterLeft = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.__registerHost();
|
|
10
|
+
/************
|
|
11
|
+
* Internal *
|
|
12
|
+
************/
|
|
13
|
+
this.mustacheCounter = '{counter}';
|
|
14
|
+
/**
|
|
15
|
+
* Template to display remaining characters.
|
|
16
|
+
* Must have {counter} inside
|
|
17
|
+
*/
|
|
18
|
+
this.template = messages.nbCharLeft;
|
|
19
|
+
/**
|
|
20
|
+
* Sets the characters to count
|
|
21
|
+
*/
|
|
22
|
+
this.characters = '';
|
|
23
|
+
/**
|
|
24
|
+
* Calculate number character left
|
|
25
|
+
* @returns {string}
|
|
26
|
+
*/
|
|
27
|
+
this.getMessage = () => {
|
|
28
|
+
return this.template.replace(this.mustacheCounter, `<strong>${this.maxlength - this.characters.length}</strong>`);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
validateTemplate(newValue) {
|
|
32
|
+
if (typeof newValue !== 'string' || newValue === '' || newValue.indexOf(this.mustacheCounter) === -1) {
|
|
33
|
+
throw new Error(`<mg-character-left> prop "template" must contain "${this.mustacheCounter}".`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
validateMaxlength(newValue) {
|
|
37
|
+
if (typeof newValue !== 'number') {
|
|
38
|
+
throw new Error('<mg-character-left> prop "maxlength" is required.');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/*************
|
|
42
|
+
* Lifecycle *
|
|
43
|
+
*************/
|
|
44
|
+
componentWillLoad() {
|
|
45
|
+
this.validateTemplate(this.template);
|
|
46
|
+
this.validateMaxlength(this.maxlength);
|
|
47
|
+
}
|
|
48
|
+
render() {
|
|
49
|
+
return h("span", { id: this.identifier, innerHTML: this.getMessage(), "aria-live": "polite" });
|
|
50
|
+
}
|
|
51
|
+
static get watchers() { return {
|
|
52
|
+
"template": ["validateTemplate"],
|
|
53
|
+
"maxlength": ["validateMaxlength"]
|
|
54
|
+
}; }
|
|
55
|
+
static get style() { return mgCharacterLeftCss; }
|
|
56
|
+
}, [2, "mg-character-left", {
|
|
57
|
+
"identifier": [1],
|
|
58
|
+
"template": [1],
|
|
59
|
+
"characters": [1],
|
|
60
|
+
"maxlength": [2]
|
|
61
|
+
}]);
|
|
62
|
+
function defineCustomElement() {
|
|
63
|
+
if (typeof customElements === "undefined") {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const components = ["mg-character-left"];
|
|
67
|
+
components.forEach(tagName => { switch (tagName) {
|
|
68
|
+
case "mg-character-left":
|
|
69
|
+
if (!customElements.get(tagName)) {
|
|
70
|
+
customElements.define(tagName, MgCharacterLeft);
|
|
71
|
+
}
|
|
72
|
+
break;
|
|
73
|
+
} });
|
|
74
|
+
}
|
|
75
|
+
defineCustomElement();
|
|
76
|
+
|
|
77
|
+
export { MgCharacterLeft as M, defineCustomElement as d };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface MgIcon extends Components.MgIcon, HTMLElement {}
|
|
4
|
+
export const MgIcon: {
|
|
5
|
+
prototype: MgIcon;
|
|
6
|
+
new (): MgIcon;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { h, proxyCustomElement, HTMLElement } from '@stencil/core/internal/client';
|
|
2
|
+
import { C as ClassList } from './components.utils.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Icon SVG paths
|
|
6
|
+
*/
|
|
7
|
+
const icons = {
|
|
8
|
+
'arrow-down': () => (h("path", { fill: "currentColor", d: "M13,10.1H10.23a.31.31,0,0,1-.32-.28h0V.94A.3.3,0,0,0,9.59.65H6.37A.32.32,0,0,0,6,.94H6V9.81a.29.29,0,0,1-.31.29H3a.3.3,0,0,0-.31.29.27.27,0,0,0,.08.22l5.06,4.58a.36.36,0,0,0,.46,0l5-4.58a.29.29,0,0,0,0-.42C13.22,10.1,13.12,10.1,13,10.1Z" })),
|
|
9
|
+
'arrow-left': () => (h("path", { fill: "currentColor", d: "M5.88,12.93V10.18a.3.3,0,0,1,.28-.32H15a.31.31,0,0,0,.29-.33h0V6.32A.31.31,0,0,0,15,6H6.17a.32.32,0,0,1-.29-.31h0V2.93a.3.3,0,0,0-.28-.32.32.32,0,0,0-.23.09L.79,7.76a.36.36,0,0,0,0,.46l4.58,5a.31.31,0,0,0,.43,0A.4.4,0,0,0,5.88,12.93Z" })),
|
|
10
|
+
'arrow-right': () => (h("path", { fill: "currentColor", d: "M10.16,3V5.75a.3.3,0,0,1-.28.32H1a.31.31,0,0,0-.29.33h0V9.61A.31.31,0,0,0,1,9.94H9.87a.29.29,0,0,1,.29.31h0V13a.3.3,0,0,0,.28.32.32.32,0,0,0,.23-.09l4.58-5.06a.36.36,0,0,0,0-.46l-4.58-5a.3.3,0,0,0-.42,0C10.16,2.76,10.16,2.87,10.16,3Z" })),
|
|
11
|
+
'arrow-up': () => (h("path", { fill: "currentColor", d: "M3.06,5.82H5.81a.31.31,0,0,1,.32.28h0V15a.31.31,0,0,0,.33.29H9.67A.3.3,0,0,0,10,15h0V6.11a.3.3,0,0,1,.31-.29h2.75a.3.3,0,0,0,.23-.51L8.23.73a.36.36,0,0,0-.46,0l-5,4.58a.3.3,0,0,0,0,.43C2.82,5.83,2.92,5.82,3.06,5.82Z" })),
|
|
12
|
+
'arrows-rotate': () => (h("path", { fill: "currentColor", d: "M2.3,7h3.4c0.3,0,0.6-0.3,0.6-0.6c0-0.1-0.1-0.3-0.2-0.4L5.1,4.9c1.7-1.6,4.4-1.5,6,0.2c0,0,0,0,0,0 c0.5,0.5,0.8,1.2,1,1.9h2.1C13.7,3.5,10.4,1.2,7,1.8C5.7,2,4.6,2.6,3.6,3.4L2.7,2.5c-0.2-0.2-0.6-0.2-0.8,0c0,0,0,0,0,0l0,0 C1.8,2.6,1.7,2.8,1.7,2.9v3.4C1.7,6.7,1.9,7,2.3,7z M13.7,9h-3.4C9.9,9,9.7,9.3,9.7,9.6c0,0.2,0.1,0.3,0.2,0.4l1.1,1.1 c-1.7,1.6-4.4,1.5-6-0.2C4.4,10.4,4,9.7,3.8,9H1.7c0.6,3.5,3.9,5.8,7.3,5.2c1.3-0.2,2.4-0.8,3.3-1.7l0.9,0.9c0.2,0.2,0.6,0.2,0.8,0 c0,0,0,0,0,0l0,0c0.1-0.1,0.2-0.3,0.2-0.4V9.6C14.3,9.3,14.1,9,13.7,9z" })),
|
|
13
|
+
'ban': () => (h("path", { fill: "currentColor", d: "M8 .67A7.33 7.33 0 1 0 15.33 8 7.33 7.33 0 0 0 8 .67Zm3.85 3.48a5.46 5.46 0 0 1 .61 7L4.88 3.54a5.46 5.46 0 0 1 6.97.61Zm-7.7 7.7a5.45 5.45 0 0 1-.61-7l7.58 7.58a5.46 5.46 0 0 1-7-.61Z" })),
|
|
14
|
+
'calculator': () => (h("path", { fill: "currentColor", d: "M12.83.67H3.17a.5.5 0 0 0-.5.5v13.66a.5.5 0 0 0 .5.5h9.66a.5.5 0 0 0 .5-.5V1.17a.5.5 0 0 0-.5-.5ZM5.58 13.39a.29.29 0 0 1-.28.3H4.1a.29.29 0 0 1-.3-.28v-1.2a.29.29 0 0 1 .28-.3h1.2a.29.29 0 0 1 .3.28v1.2Zm0-3.28a.29.29 0 0 1-.3.3H4.1a.29.29 0 0 1-.3-.3V8.93a.29.29 0 0 1 .28-.3h1.2a.29.29 0 0 1 .3.28v1.2Zm3.29 3.28a.29.29 0 0 1-.3.3H7.38a.29.29 0 0 1-.3-.3v-1.18a.29.29 0 0 1 .3-.3h1.19a.29.29 0 0 1 .3.3Zm0-3.28a.32.32 0 0 1-.3.3H7.38a.32.32 0 0 1-.3-.3V8.93a.29.29 0 0 1 .3-.3h1.19a.29.29 0 0 1 .3.3Zm3.33 3.28a.29.29 0 0 1-.28.3h-1.25a.29.29 0 0 1-.3-.28V8.93a.29.29 0 0 1 .28-.3h1.25a.29.29 0 0 1 .3.28v4.48Zm0-7.15a.29.29 0 0 1-.3.3H4.1a.29.29 0 0 1-.3-.3V2.61a.29.29 0 0 1 .28-.3h7.82a.29.29 0 0 1 .3.28v3.65Z" })),
|
|
15
|
+
'check': () => (h("path", { fill: "currentColor", d: "M15.3,4.2L14.2,3c-0.1-0.1-0.3-0.1-0.4,0L6,10.4l-3.8-4C2.2,6.3,2.1,6.3,2,6.4L0.7,7.6c-0.1,0.1-0.1,0.2,0,0.3l5.1,5.4c0.1,0.1,0.2,0.1,0.3,0c0,0,0,0,0,0L7.4,12l0,0l7.9-7.4C15.4,4.5,15.4,4.3,15.3,4.2C15.3,4.2,15.3,4.2,15.3,4.2z" })),
|
|
16
|
+
'check-circle': () => (h("path", { fill: "currentColor", d: "M15.33 8A7.33 7.33 0 1 1 8 .67 7.33 7.33 0 0 1 15.33 8Zm-8.18 3.88 5.44-5.44a.46.46 0 0 0 0-.65l-.67-.67a.48.48 0 0 0-.67 0L6.82 9.54 4.75 7.47a.46.46 0 0 0-.65 0l-.67.67a.46.46 0 0 0 0 .65l3.07 3.07a.46.46 0 0 0 .65 0Z" })),
|
|
17
|
+
'chevron-down': () => (h("path", { fill: "currentColor", d: "M7.43,12.21.9,5.69a.81.81,0,0,1,0-1.14h0l.76-.77a.81.81,0,0,1,1.14,0L8,9l5.2-5.18a.81.81,0,0,1,1.14,0l.76.77a.8.8,0,0,1,0,1.13h0L8.57,12.21a.79.79,0,0,1-1.13,0Z" })),
|
|
18
|
+
'chevron-left': () => (h("path", { fill: "currentColor", d: "M3.79,7.43,10.31.9a.81.81,0,0,1,1.14,0h0l.77.76a.81.81,0,0,1,0,1.14L7,8l5.18,5.2a.81.81,0,0,1,0,1.14l-.77.76a.8.8,0,0,1-1.13,0h0L3.79,8.57a.79.79,0,0,1,0-1.13Z" })),
|
|
19
|
+
'chevron-right': () => (h("path", { fill: "currentColor", d: "M12.21,8.57,5.69,15.1a.81.81,0,0,1-1.14,0h0l-.77-.76a.81.81,0,0,1,0-1.14L9,8,3.78,2.8a.81.81,0,0,1,0-1.14L4.55.9A.8.8,0,0,1,5.68.9h0l6.53,6.53a.79.79,0,0,1,0,1.13Z" })),
|
|
20
|
+
'chevron-up': () => (h("path", { fill: "currentColor", d: "M8.57,3.79l6.53,6.52a.81.81,0,0,1,0,1.14h0l-.76.77a.81.81,0,0,1-1.14,0L8,7,2.8,12.22a.81.81,0,0,1-1.14,0L.9,11.45a.8.8,0,0,1,0-1.13h0L7.43,3.79a.79.79,0,0,1,1.13,0Z" })),
|
|
21
|
+
'cross': () => (h("path", { fill: "currentColor", d: "M14.26 12.74 9.52 8l4.7-4.7a.29.29 0 0 0 0-.41l-1.1-1.1a.29.29 0 0 0-.41 0L8 6.48 3.26 1.74a.24.24 0 0 0-.34 0L1.74 2.91a.24.24 0 0 0 0 .34L6.48 8l-4.7 4.7a.29.29 0 0 0 0 .41l1.1 1.1a.29.29 0 0 0 .41 0L8 9.52l4.74 4.74a.24.24 0 0 0 .34 0l1.17-1.17a.24.24 0 0 0 0-.34Z" })),
|
|
22
|
+
'cross-circle': () => (h("path", { fill: "currentColor", d: "M8.06.67H8A7.33 7.33 0 0 0 .68 8v.1a7.42 7.42 0 0 0 7.23 7.23A7.33 7.33 0 1 0 8.06.67Zm3.6 9.57a.28.28 0 0 1 0 .4l-.19.2-.61.61-.2.19a.27.27 0 0 1-.39 0L8 9.41l-2.23 2.24a.27.27 0 0 1-.39 0l-.2-.2-.6-.6-.19-.2a.28.28 0 0 1 0-.4L6.6 8 4.36 5.76a.28.28 0 0 1 0-.4l1-1a.28.28 0 0 1 .4 0L8 6.59l2.24-2.24a.28.28 0 0 1 .4 0l.2.2.6.6.2.2a.28.28 0 0 1 0 .4L9.42 8Z" })),
|
|
23
|
+
'download': () => (h("path", { fill: "currentColor", d: "M6.44,2V6.09a.31.31,0,0,1-.31.31H4a.31.31,0,0,0-.31.29.33.33,0,0,0,.1.23l4,4a.29.29,0,0,0,.41,0h0l4-4a.3.3,0,0,0,0-.42A.29.29,0,0,0,12,6.4H9.91a.31.31,0,0,1-.31-.31h0V2a.29.29,0,0,0-.28-.3H6.74a.29.29,0,0,0-.3.28ZM1.69,13v1a.29.29,0,0,0,.29.29H14a.29.29,0,0,0,.29-.29V13a.29.29,0,0,0-.28-.3H2a.29.29,0,0,0-.33.25Z" })),
|
|
24
|
+
'exclamation-circle': () => (h("path", { fill: "currentColor", d: "M8 15.33A7.33 7.33 0 1 0 .67 8 7.33 7.33 0 0 0 8 15.33ZM7 4a.29.29 0 0 1 .3-.3h1.35A.29.29 0 0 1 9 4v4.68a.29.29 0 0 1-.28.3H7.35a.29.29 0 0 1-.3-.28Zm0 6.78a.29.29 0 0 1 .3-.3h1.35a.29.29 0 0 1 .3.3H9V12a.29.29 0 0 1-.28.3H7.35a.29.29 0 0 1-.3-.28Z" })),
|
|
25
|
+
'exclamation-triangle': () => (h("path", { fill: "currentColor", d: "m14.28 13.87-6-12a.32.32 0 0 0-.41-.15.36.36 0 0 0-.15.15l-6 12a.31.31 0 0 0 .14.42.33.33 0 0 0 .14 0h12a.3.3 0 0 0 .33-.28.31.31 0 0 0-.05-.14ZM7 6a.29.29 0 0 1 .28-.28h1.44A.28.28 0 0 1 9 6v4a.28.28 0 0 1-.28.29H7.28A.29.29 0 0 1 7 10Zm2 7a.31.31 0 0 1-.3.32H7.32A.32.32 0 0 1 7 13v-1.38a.31.31 0 0 1 .31-.31h1.4a.31.31 0 0 1 .31.31H9Z" })),
|
|
26
|
+
'file-cog': () => (h("path", { fill: "currentColor", d: "M9,10.1C9,10.6,8.5,11,8,11l0,0c-0.6,0-1-0.4-1-1c0-0.6,0.4-1,1-1C8.6,9,9,9.4,9,10.1C9,10,9,10,9,10.1z M13.2,3.7l-2.8-2.8c-0.1-0.1-0.3-0.2-0.5-0.2H9.8v3.7h3.5V4.2C13.3,4,13.2,3.8,13.2,3.7L13.2,3.7z M9.6,5.3h3.8v9.4 c0,0.4-0.3,0.6-0.7,0.7H3.3c-0.4,0-0.7-0.3-0.7-0.7c0,0,0,0,0,0V1.3C2.7,1,3,0.7,3.3,0.7h5.5v3.9l0,0C8.9,4.9,9.2,5.2,9.6,5.3 C9.5,5.2,9.5,5.2,9.6,5.3z M10,8L9.5,8.3C9.3,8.1,9,8,8.8,7.9V7.3c0-0.1,0-0.1-0.1-0.1c-0.4-0.1-0.9-0.1-1.3,0 c-0.1,0-0.1,0.1-0.1,0.1v0.6C7,8,6.7,8.1,6.5,8.3L6,8C5.9,8,5.9,8,5.8,8C5.5,8.3,5.3,8.7,5.2,9.1c0,0.1,0,0.1,0.1,0.2l0.5,0.3 c-0.1,0.3-0.1,0.6,0,0.8l-0.5,0.3c-0.1,0-0.1,0.1-0.1,0.2c0.1,0.4,0.4,0.8,0.7,1.1c0.1,0,0.1,0,0.2,0l0.5-0.3 C6.7,11.9,7,12,7.2,12.1v0.6c0,0.1,0,0.1,0.1,0.1c0.4,0.1,0.9,0.1,1.3,0c0.1,0,0.1-0.1,0.1-0.1v-0.5C9,12.1,9.3,12,9.5,11.8l0.5,0.3 c0.1,0,0.1,0,0.2,0c0.3-0.3,0.5-0.7,0.6-1.1c0-0.1,0-0.1-0.1-0.2l0,0l-0.5-0.3c0-0.3,0-0.6,0-0.8l0.5-0.3c0.1,0,0.1-0.1,0.1-0.2 c-0.1-0.4-0.4-0.8-0.6-1.1C10.1,8,10.1,8,10,8z" })),
|
|
27
|
+
'file-text': () => (h("path", { fill: "currentColor", d: "M8.9 4.6V.7H3.3c-.3 0-.6.3-.6.6v13.3c0 .4.3.7.7.7h9.3c.4 0 .7-.3.7-.7V5.3H9.6c-.4-.1-.7-.4-.7-.7zm1.8 6.7c0 .2-.2.3-.3.4H5.7c-.2 0-.3-.2-.3-.4v-.2c0-.2.2-.3.3-.3h4.6c.2 0 .3.2.3.3v.2zm0-1.8c0 .2-.2.3-.3.3H5.7c-.2 0-.3-.2-.3-.3v-.2c0-.2.2-.3.3-.3h4.6c.2 0 .3.2.3.3v.2zm0-2.1v.2c0 .2-.2.3-.3.3H5.7c-.2.1-.4-.1-.4-.2v-.3c0-.2.2-.3.3-.3h4.6c.3 0 .5.1.5.3zm2.6-3.2v.2H9.8V.7h.2c.2 0 .3.1.5.2l2.7 2.8c0 .1.1.3.1.5z" })),
|
|
28
|
+
'file-upload': () => [
|
|
29
|
+
h("path", { fill: "currentColor", d: "M13.1 3.7 10.4.9c-.1-.1-.3-.2-.5-.2h-.1v3.7h3.5v-.2c0-.2-.1-.4-.2-.5z" }),
|
|
30
|
+
h("path", { fill: "currentColor", d: "M13.3 14.6V5.3H9.6c-.4 0-.7-.3-.7-.7V.7H3.3c-.3 0-.6.3-.6.6v13.3c0 .4.3.7.7.7h9.3c.3 0 .6-.3.6-.7zm-3-4.6H8.9c-.1 0-.2.1-.2.2v2.6c0 .1-.1.2-.2.2H6.9c-.1 0-.2-.1-.2-.2v-2.6c0-.1-.1-.2-.2-.2H5.1C5 9.9 5 9.8 5 9.7l2.5-2.6c.1-.1.2-.1.3 0l2.5 2.5.1.1c.1.2 0 .3-.1.3z" }),
|
|
31
|
+
],
|
|
32
|
+
'floppy-disk': () => (h("path", { fill: "currentColor", d: "m13.94 4.44-2.38-2.38a1.39 1.39 0 0 0-1-.39H3A1.35 1.35 0 0 0 1.67 3v10A1.35 1.35 0 0 0 3 14.33h10A1.35 1.35 0 0 0 14.33 13V5.4a1.39 1.39 0 0 0-.39-1ZM8 12.52a1.81 1.81 0 1 1 1.81-1.81A1.81 1.81 0 0 1 8 12.52Zm2.71-8.6v2.84a.34.34 0 0 1-.34.34H3.82a.34.34 0 0 1-.34-.34V3.82a.34.34 0 0 1 .34-.34h6.46a.35.35 0 0 1 .24.1l.1.1a.35.35 0 0 1 .1.24Z" })),
|
|
33
|
+
'info-circle': () => (h("path", { fill: "currentColor", d: "M8 .67A7.33 7.33 0 1 0 15.33 8 7.33 7.33 0 0 0 8 .67ZM9 12a.29.29 0 0 1-.3.3H7.35a.29.29 0 0 1-.3-.3V7.32A.29.29 0 0 1 7.33 7h1.32a.29.29 0 0 1 .35.3Zm0-6.74a.29.29 0 0 1-.3.3H7.35a.29.29 0 0 1-.3-.3V4a.29.29 0 0 1 .28-.3h1.32a.29.29 0 0 1 .3.28V4Z" })),
|
|
34
|
+
'loader': () => [
|
|
35
|
+
h("path", { fill: "currentColor", class: "loader__full-circle", d: "M8 2.67A5.33 5.33 0 1 1 2.67 8 5.33 5.33 0 0 1 8 2.67m0-2A7.33 7.33 0 1 0 15.33 8 7.33 7.33 0 0 0 8 .67Z" }),
|
|
36
|
+
h("path", { fill: "currentColor", d: "M8 2.67v-2A7.33 7.33 0 0 0 .67 8h2A5.33 5.33 0 0 1 8 2.67Z" }),
|
|
37
|
+
],
|
|
38
|
+
'log-out': () => [
|
|
39
|
+
h("path", { fill: "currentColor", d: "M14.25,7.77h0l-4-4a.31.31,0,0,0-.43,0A.34.34,0,0,0,9.7,4V6.07a.32.32,0,0,1-.3.32H5.23a.3.3,0,0,0-.3.3V9.25a.3.3,0,0,0,.3.3H9.4a.31.31,0,0,1,.3.31V12a.3.3,0,0,0,.3.3.33.33,0,0,0,.23-.09l4-4A.29.29,0,0,0,14.25,7.77Z" }),
|
|
40
|
+
h("path", { fill: "currentColor", d: "M6.71,12.72H3.27V3.26H6.69A.31.31,0,0,0,7,3V2a.3.3,0,0,0-.31-.3H2A.29.29,0,0,0,1.67,2h0V3h0V14a.27.27,0,0,0,.1.24h0a.32.32,0,0,0,.14.08H6.71A.3.3,0,0,0,7,14V13A.3.3,0,0,0,6.71,12.72Z" }),
|
|
41
|
+
],
|
|
42
|
+
'magnifying-glass': () => (h("path", { fill: "currentColor", d: "M11.24,9.52A5.17,5.17,0,0,0,9.51,2.41l-.17-.09A5.18,5.18,0,0,0,4,11.18a5.16,5.16,0,0,0,5.54.11L12.3,14a1,1,0,0,0,1.41,0l.33-.33a1,1,0,0,0,0-1.41Zm-4.4.5A3.19,3.19,0,1,1,10,6.8v.06A3.19,3.19,0,0,1,6.84,10Z" })),
|
|
43
|
+
'paper-plane': () => (h("path", { fill: "currentColor", d: "M14 1.69 1.84 7a.28.28 0 0 0-.15.36.29.29 0 0 0 .16.15l3.27 1.82a.57.57 0 0 0 .61-.06l6.45-5.57c.05 0 .15-.1.19-.06s0 .14-.06.18l-5.59 6.29a.52.52 0 0 0 0 .63l2.09 3.44a.28.28 0 0 0 .37.12.3.3 0 0 0 .13-.12l5-12.11a.3.3 0 0 0-.14-.37.28.28 0 0 0-.17-.01Z" })),
|
|
44
|
+
'paper-plane-slash': () => (h("path", { fill: "currentColor", d: "M2.67,1.69,14.26,13.28l-1,1-2.79-2.8-1.1,2.67a.3.3,0,0,1-.13.12.28.28,0,0,1-.37-.12L6.75,10.74a.52.52,0,0,1,0-.63L7.82,8.9l-.76-.76L5.76,9.27a.57.57,0,0,1-.61.06L1.88,7.51a.29.29,0,0,1-.16-.15A.28.28,0,0,1,1.87,7L4.68,5.76l-3-3Zm11.53,0a.28.28,0,0,0-.22,0L7.53,4.51,9.26,6.24l3-2.54s.15-.1.19-.06,0,.14-.06.18L9.75,6.73l1.88,1.88,2.71-6.54A.3.3,0,0,0,14.2,1.7Z" })),
|
|
45
|
+
'plus-circle': () => (h("path", { fill: "currentColor", d: "M8,0.7C4,0.7,0.7,4,0.7,8S4,15.3,8,15.3S15.3,12,15.3,8l0,0C15.3,4,12,0.7,8,0.7 C8,0.7,8,0.7,8,0.7z M12.3,8.8c0,0.2-0.2,0.4-0.4,0.4H9.2v2.7c0,0.2-0.2,0.4-0.4,0.4H7.2c-0.2,0-0.4-0.2-0.3-0.4V9.2H4.1 C3.9,9.2,3.7,9,3.7,8.8V7.2c0-0.2,0.2-0.4,0.4-0.3h2.7V4.1c0-0.2,0.2-0.4,0.3-0.4h1.7c0.2,0,0.4,0.2,0.4,0.4v2.7h2.7 c0.2,0,0.4,0.2,0.4,0.3L12.3,8.8z" })),
|
|
46
|
+
'user-plus': () => (h("path", { fill: "currentColor", d: "M14,3.33H12.65V2a.36.36,0,0,0-.35-.33h-.65A.36.36,0,0,0,11.3,2V3.33H10a.34.34,0,0,0-.33.34v.66a.34.34,0,0,0,.33.34H11.3V6a.37.37,0,0,0,.35.33h.65A.37.37,0,0,0,12.65,6V4.67H14a.34.34,0,0,0,.32-.34V3.67A.34.34,0,0,0,14,3.33ZM9.28,9.77h-.2a5.19,5.19,0,0,1-3.91,0H5A3,3,0,0,0,1.7,12.46h0v.72A1.27,1.27,0,0,0,3,14.33h8.25a1.26,1.26,0,0,0,1.36-1.14v-.68A3,3,0,0,0,9.37,9.76H9.28ZM7.13,3.7A2.64,2.64,0,1,1,4.5,6.34h0A2.64,2.64,0,0,1,7.13,3.7Z" })),
|
|
47
|
+
'users': () => (h("path", { fill: "currentColor", d: "M12,8.76h-.2a5.24,5.24,0,0,1-3.93,0H7.61a3.05,3.05,0,0,0-3.3,2.75v.69a1.28,1.28,0,0,0,1.38,1.14H14a1.27,1.27,0,0,0,1.37-1.14v-.69A3.07,3.07,0,0,0,12,8.75Zm-6.4-.32A2,2,0,0,0,4.31,8H2.48A1.69,1.69,0,0,0,.65,9.53v.76a.85.85,0,0,0,.91.76H3.45A3.58,3.58,0,0,1,5.61,8.44ZM9.81,2.66A2.65,2.65,0,1,1,7.16,5.31h0A2.65,2.65,0,0,1,9.81,2.66ZM3.31,4.18A1.51,1.51,0,1,1,1.8,5.69,1.51,1.51,0,0,1,3.31,4.18Z" })),
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* List of all possibles sizes
|
|
51
|
+
*/
|
|
52
|
+
const sizes = ['regular', 'large', 'extra-large'];
|
|
53
|
+
/**
|
|
54
|
+
* List of all possibles variants
|
|
55
|
+
*/
|
|
56
|
+
const variants = ['success', 'warning', 'danger', 'info'];
|
|
57
|
+
|
|
58
|
+
const mgIconCss = ".mg-icon[size=regular],.mg-icon.mg-icon--size-regular{width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size)}.mg-icon[size=large],.mg-icon.mg-icon--size-large{width:var(--mg-icon-large-size);height:var(--mg-icon-large-size)}.mg-icon[size=extra-large],.mg-icon.mg-icon--size-extra-large{width:var(--mg-icon-extra-large-size);height:var(--mg-icon-extra-large-size)}.mg-icon[class*=mg-icon--variant-]{border-radius:var(--mg-message-border-radius);padding:0.3rem}.mg-icon.mg-icon--variant-success{background-color:hsl(var(--color-success-h), var(--color-success-s), calc(var(--color-success-l) + 20%))}.mg-icon.mg-icon--variant-warning{background-color:hsl(var(--color-warning-h), var(--color-warning-s), calc(var(--color-warning-l) + 20%))}.mg-icon.mg-icon--variant-danger{background-color:hsl(var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) + 20%))}.mg-icon.mg-icon--variant-info{background-color:hsl(var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) + 20%))}mg-icon,.mg-icon{display:inline-block;vertical-align:middle;line-height:1}.loader__full-circle{opacity:0.2}.mg-icon--spin{-webkit-animation-name:rotate;animation-name:rotate;-webkit-animation-duration:0.75s;animation-duration:0.75s;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}@-webkit-keyframes rotate{to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes rotate{to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}";
|
|
59
|
+
|
|
60
|
+
const MgIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
61
|
+
constructor() {
|
|
62
|
+
super();
|
|
63
|
+
this.__registerHost();
|
|
64
|
+
this.__attachShadow();
|
|
65
|
+
/**
|
|
66
|
+
* Define icon size
|
|
67
|
+
*/
|
|
68
|
+
this.size = 'regular';
|
|
69
|
+
/**
|
|
70
|
+
* Make the icon spin
|
|
71
|
+
*/
|
|
72
|
+
this.spin = false;
|
|
73
|
+
/**
|
|
74
|
+
* Component classes
|
|
75
|
+
*/
|
|
76
|
+
this.classList = new ClassList(['mg-icon']);
|
|
77
|
+
}
|
|
78
|
+
validateIcon(newValue) {
|
|
79
|
+
if (!Object.keys(icons).includes(newValue)) {
|
|
80
|
+
throw new Error(`<mg-icon> prop "icon" must be one of : ${Object.keys(icons).join(', ')}`);
|
|
81
|
+
}
|
|
82
|
+
this.classList.add(`mg-icon--${this.icon}`);
|
|
83
|
+
}
|
|
84
|
+
validateSize(newValue) {
|
|
85
|
+
if (!sizes.includes(newValue)) {
|
|
86
|
+
throw new Error(`<mg-icon> prop "size" must be one of : ${sizes.join(', ')}`);
|
|
87
|
+
}
|
|
88
|
+
this.classList.add(`mg-icon--size-${this.size}`);
|
|
89
|
+
}
|
|
90
|
+
validateVariant(newValue) {
|
|
91
|
+
if (newValue !== undefined && !variants.includes(newValue)) {
|
|
92
|
+
throw new Error(`<mg-icon> prop "variant" must be one of : ${variants.join(', ')}`);
|
|
93
|
+
}
|
|
94
|
+
else if (newValue !== undefined) {
|
|
95
|
+
this.classList.add(`mg-icon--variant-${this.variant}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
handleSpin(newValue) {
|
|
99
|
+
if (newValue) {
|
|
100
|
+
this.classList.add('mg-icon--spin');
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Check if props are well configured on init
|
|
105
|
+
*/
|
|
106
|
+
componentWillLoad() {
|
|
107
|
+
this.validateIcon(this.icon);
|
|
108
|
+
this.validateSize(this.size);
|
|
109
|
+
this.validateVariant(this.variant);
|
|
110
|
+
this.handleSpin(this.spin);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Render component
|
|
114
|
+
*/
|
|
115
|
+
render() {
|
|
116
|
+
return (h("svg", { class: this.classList.join(), "aria-hidden": "true", focusable: "false", viewBox: "0 0 16 16" }, icons[this.icon]()));
|
|
117
|
+
}
|
|
118
|
+
static get watchers() { return {
|
|
119
|
+
"icon": ["validateIcon"],
|
|
120
|
+
"size": ["validateSize"],
|
|
121
|
+
"variant": ["validateVariant"],
|
|
122
|
+
"spin": ["handleSpin"]
|
|
123
|
+
}; }
|
|
124
|
+
static get style() { return mgIconCss; }
|
|
125
|
+
}, [1, "mg-icon", {
|
|
126
|
+
"icon": [1],
|
|
127
|
+
"size": [1],
|
|
128
|
+
"variant": [1],
|
|
129
|
+
"spin": [4],
|
|
130
|
+
"classList": [32]
|
|
131
|
+
}]);
|
|
132
|
+
function defineCustomElement() {
|
|
133
|
+
if (typeof customElements === "undefined") {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const components = ["mg-icon"];
|
|
137
|
+
components.forEach(tagName => { switch (tagName) {
|
|
138
|
+
case "mg-icon":
|
|
139
|
+
if (!customElements.get(tagName)) {
|
|
140
|
+
customElements.define(tagName, MgIcon);
|
|
141
|
+
}
|
|
142
|
+
break;
|
|
143
|
+
} });
|
|
144
|
+
}
|
|
145
|
+
defineCustomElement();
|
|
146
|
+
|
|
147
|
+
export { MgIcon as M, defineCustomElement as d };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface MgInputCheckbox extends Components.MgInputCheckbox, HTMLElement {}
|
|
4
|
+
export const MgInputCheckbox: {
|
|
5
|
+
prototype: MgInputCheckbox;
|
|
6
|
+
new (): MgInputCheckbox;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|