@maggioli-design-system/mds-input 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index-3aa055da.js +1207 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/mds-input.cjs.entry.js +162 -0
- package/dist/cjs/mds-input.cjs.js +19 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/mds-input/mds-input.css +482 -0
- package/dist/collection/components/mds-input/mds-input.js +586 -0
- package/dist/collection/components/mds-input/meta/interfaces.js +1 -0
- package/dist/collection/components/mds-input/test/mds-input.stories.js +165 -0
- package/dist/collection/dictionary/autocomplete.js +59 -0
- package/dist/collection/dictionary/button.js +26 -0
- package/dist/collection/dictionary/color.js +19 -0
- package/dist/collection/dictionary/icon.js +3 -0
- package/dist/collection/dictionary/input-text-type.js +13 -0
- package/dist/collection/dictionary/loading.js +5 -0
- package/dist/collection/dictionary/typography.js +43 -0
- package/dist/collection/dictionary/variant.js +65 -0
- package/dist/collection/fixtures/cities.js +110 -0
- package/dist/collection/interface/input-value.js +1 -0
- package/dist/collection/types/autocomplete.js +1 -0
- package/dist/collection/types/button.js +1 -0
- package/dist/collection/types/form-rel.js +1 -0
- package/dist/collection/types/input-text-type.js +1 -0
- package/dist/collection/types/input-value-type.js +1 -0
- package/dist/collection/types/loading.js +1 -0
- package/dist/collection/types/typography.js +1 -0
- package/dist/collection/types/variant.js +1 -0
- package/dist/components/index.d.ts +26 -0
- package/dist/components/index.js +1 -0
- package/dist/components/mds-input.d.ts +11 -0
- package/dist/components/mds-input.js +200 -0
- package/dist/esm/index-2cdf06e7.js +1179 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/mds-input.entry.js +158 -0
- package/dist/esm/mds-input.js +17 -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-es5/index-2cdf06e7.js +1 -0
- package/dist/esm-es5/index.js +0 -0
- package/dist/esm-es5/loader.js +1 -0
- package/dist/esm-es5/mds-input.entry.js +1 -0
- package/dist/esm-es5/mds-input.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/mds-input/index.esm.js +0 -0
- package/dist/mds-input/mds-input.esm.js +1 -0
- package/dist/mds-input/mds-input.js +130 -0
- package/dist/mds-input/p-132bdeae.system.entry.js +1 -0
- package/dist/mds-input/p-275873d7.entry.js +1 -0
- package/dist/mds-input/p-50ea2036.system.js +1 -0
- package/dist/mds-input/p-8bdf82a6.js +1 -0
- package/dist/mds-input/p-91d946fe.system.js +1 -0
- package/dist/mds-input/p-992602db.system.js +1 -0
- package/dist/stats.json +1424 -0
- package/dist/types/components/mds-input/meta/interfaces.d.ts +4 -0
- package/dist/types/components.d.ts +218 -0
- package/dist/types/dictionary/autocomplete.d.ts +2 -0
- package/dist/types/dictionary/button.d.ts +5 -0
- package/dist/types/dictionary/color.d.ts +3 -0
- package/dist/types/dictionary/icon.d.ts +2 -0
- package/dist/types/dictionary/input-text-type.d.ts +2 -0
- package/dist/types/dictionary/loading.d.ts +2 -0
- package/dist/types/dictionary/typography.d.ts +6 -0
- package/dist/types/dictionary/variant.d.ts +9 -0
- package/dist/types/fixtures/cities.d.ts +2 -0
- package/dist/types/interface/input-value.d.ts +4 -0
- package/dist/types/stencil-public-runtime.d.ts +1565 -0
- package/dist/types/types/autocomplete.d.ts +2 -0
- package/dist/types/types/button.d.ts +4 -0
- package/dist/types/types/form-rel.d.ts +1 -0
- package/dist/types/types/input-text-type.d.ts +1 -0
- package/dist/types/types/input-value-type.d.ts +1 -0
- package/dist/types/types/loading.d.ts +1 -0
- package/dist/types/types/typography.d.ts +5 -0
- package/dist/types/types/variant.d.ts +10 -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 +46 -0
- package/readme.md +97 -0
- package/src/components/mds-input/css/mds-input-variant.css +65 -0
- package/src/components/mds-input/mds-input.css +133 -0
- package/src/components/mds-input/mds-input.tsx +294 -0
- package/src/components/mds-input/meta/interfaces.ts +5 -0
- package/src/components/mds-input/readme.md +77 -0
- package/src/components/mds-input/test/mds-input.e2e.ts +12 -0
- package/src/components/mds-input/test/mds-input.spec.tsx +19 -0
- package/src/components/mds-input/test/mds-input.stories.js +165 -0
- package/src/components.d.ts +218 -0
- package/src/dictionary/autocomplete.ts +62 -0
- package/src/dictionary/button.ts +35 -0
- package/src/dictionary/color.ts +24 -0
- package/src/dictionary/icon.ts +5 -0
- package/src/dictionary/input-text-type.ts +17 -0
- package/src/dictionary/loading.ts +9 -0
- package/src/dictionary/typography.ts +54 -0
- package/src/dictionary/variant.ts +82 -0
- package/src/fixtures/cities.ts +116 -0
- package/src/interface/input-value.ts +5 -0
- package/src/types/autocomplete.ts +69 -0
- package/src/types/button.ts +24 -0
- package/src/types/form-rel.ts +11 -0
- package/src/types/input-text-type.ts +11 -0
- package/src/types/input-value-type.ts +5 -0
- package/src/types/loading.ts +3 -0
- package/src/types/typography.ts +41 -0
- package/src/types/variant.ts +73 -0
- package/www/build/index.esm.js +0 -0
- package/www/build/mds-input.esm.js +1 -0
- package/www/build/mds-input.js +130 -0
- package/www/build/p-132bdeae.system.entry.js +1 -0
- package/www/build/p-275873d7.entry.js +1 -0
- package/www/build/p-50ea2036.system.js +1 -0
- package/www/build/p-8bdf82a6.js +1 -0
- package/www/build/p-91d946fe.system.js +1 -0
- package/www/build/p-992602db.system.js +1 -0
- package/www/host.config.json +15 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-3aa055da.js');
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
Stencil Client Patch Esm v2.12.1 | MIT Licensed | https://stenciljs.com
|
|
9
|
+
*/
|
|
10
|
+
const patchEsm = () => {
|
|
11
|
+
return index.promiseResolve();
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const defineCustomElements = (win, options) => {
|
|
15
|
+
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
|
+
return patchEsm().then(() => {
|
|
17
|
+
return index.bootstrapLazy([["mds-input.cjs",[[1,"mds-input",{"autocomplete":[1],"autofocus":[4],"datalist":[16],"disabled":[4],"icon":[1],"max":[2],"maxlength":[2],"min":[1],"minlength":[2],"name":[1],"pattern":[1],"placeholder":[1],"readonly":[4],"required":[4],"variant":[513],"variantTip":[1,"variant-tip"],"step":[1],"type":[1],"value":[8],"hasFocus":[32],"setFocus":[64],"getInputElement":[64]}]]]], options);
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.defineCustomElements = defineCustomElements;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-3aa055da.js');
|
|
6
|
+
|
|
7
|
+
function toVal(mix) {
|
|
8
|
+
var k, y, str='';
|
|
9
|
+
|
|
10
|
+
if (typeof mix === 'string' || typeof mix === 'number') {
|
|
11
|
+
str += mix;
|
|
12
|
+
} else if (typeof mix === 'object') {
|
|
13
|
+
if (Array.isArray(mix)) {
|
|
14
|
+
for (k=0; k < mix.length; k++) {
|
|
15
|
+
if (mix[k]) {
|
|
16
|
+
if (y = toVal(mix[k])) {
|
|
17
|
+
str && (str += ' ');
|
|
18
|
+
str += y;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
for (k in mix) {
|
|
24
|
+
if (mix[k]) {
|
|
25
|
+
str && (str += ' ');
|
|
26
|
+
str += k;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return str;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function clsx () {
|
|
36
|
+
var i=0, tmp, x, str='';
|
|
37
|
+
while (i < arguments.length) {
|
|
38
|
+
if (tmp = arguments[i++]) {
|
|
39
|
+
if (x = toVal(tmp)) {
|
|
40
|
+
str && (str += ' ');
|
|
41
|
+
str += x;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return str;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const mdsInputCss = "*,::before,::after{--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}@tailwind utilities; :host{font-family:Karla, -apple-system, BlinkMacSystemFont, 'San Francisco', 'Segoe UI', 'Helvetica Neue', sans-serif;font-size:1rem;line-height:1.5rem;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;position:relative;display:-ms-flexbox;display:flex}.input{font-family:Karla, -apple-system, BlinkMacSystemFont, 'San Francisco', 'Segoe UI', 'Helvetica Neue', sans-serif;font-size:1rem;line-height:1.5rem;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;margin:0px;-webkit-box-sizing:border-box;box-sizing:border-box;min-height:3rem;width:100%;overflow:hidden;text-overflow:ellipsis;border-radius:0.5rem;border-style:none;border-color:transparent;padding-left:1rem;padding-right:1rem;padding-top:0.75rem;padding-bottom:0.75rem;--tw-text-opacity:1;color:rgba(var(--adjust-tone-02), var(--tw-text-opacity));--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);-webkit-box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);--tw-ring-color:rgba(var(--adjust-tone-02), var(--tw-ring-opacity));--tw-ring-opacity:0.1;-webkit-transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-duration:300ms;transition-duration:300ms;-webkit-transition-timing-function:cubic-bezier(0.19, 1, 0.22, 1);transition-timing-function:cubic-bezier(0.19, 1, 0.22, 1);background-color:var(--background, rgb(var(--adjust-tone)))}textarea.input:active{-webkit-transition-property:none;transition-property:none}textarea.input{max-height:16rem;min-height:6rem;border-bottom-right-radius:0px}.input:focus{--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);--tw-shadow-color:rgba(var(--brand-maggioli-04), 0.5);--tw-shadow:var(--tw-shadow-colored);outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);-webkit-box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);--tw-ring-opacity:1;--tw-ring-color:rgba(var(--brand-maggioli-04), var(--tw-ring-opacity));-webkit-transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-duration:300ms;transition-duration:300ms;-webkit-transition-timing-function:cubic-bezier(0.19, 1, 0.22, 1);transition-timing-function:cubic-bezier(0.19, 1, 0.22, 1)}.input:disabled{--tw-bg-opacity:1;background-color:rgba(var(--adjust-tone-10), var(--tw-bg-opacity))}.input:disabled::-moz-placeholder{--tw-text-opacity:1;color:rgba(var(--adjust-tone-05), var(--tw-text-opacity))}.input:disabled:-ms-input-placeholder{--tw-text-opacity:1;color:rgba(var(--adjust-tone-05), var(--tw-text-opacity))}.input:disabled::-webkit-input-placeholder{--tw-text-opacity:1;color:rgba(var(--adjust-tone-05), var(--tw-text-opacity))}.input:disabled::-ms-input-placeholder{--tw-text-opacity:1;color:rgba(var(--adjust-tone-05), var(--tw-text-opacity))}.input:disabled,.input:disabled::placeholder{--tw-text-opacity:1;color:rgba(var(--adjust-tone-05), var(--tw-text-opacity))}.input.has-icon{padding-left:2.75rem}.tip,.tip-variant{pointer-events:none;position:absolute;right:0.25rem;height:0.75rem;-ms-flex-pack:center;justify-content:center;border-radius:9999px;padding-left:0.5rem;padding-right:0.5rem;text-align:center;--tw-text-opacity:1;color:rgba(var(--adjust-tone), var(--tw-text-opacity));-webkit-transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-duration:300ms;transition-duration:300ms;-webkit-transition-timing-function:cubic-bezier(0.19, 1, 0.22, 1);transition-timing-function:cubic-bezier(0.19, 1, 0.22, 1);line-height:0.75rem}.read-only{--tw-bg-opacity:1;background-color:rgba(var(--status-info-05), var(--tw-bg-opacity));--tw-text-opacity:1;color:rgba(var(--status-info-09), var(--tw-text-opacity))}.required{width:0.75rem;--tw-bg-opacity:1;background-color:rgba(var(--status-error-05), var(--tw-bg-opacity));padding:0px;color:rgba(var(--adjust-tone), var(--tw-text-opacity));--tw-text-opacity:0}.disabled{--tw-bg-opacity:1;background-color:rgba(var(--adjust-tone-05), var(--tw-bg-opacity))}.input:focus+.required{width:6rem;--tw-text-opacity:1}.icon{position:absolute;left:0.75rem;top:0.75rem;--tw-text-opacity:1;color:rgba(var(--brand-maggioli-04), var(--tw-text-opacity))}.top-1{top:0.25rem}.bottom-1{bottom:0.25rem}.border{border-width:1px}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}:host([variant=info]) .input:focus{--tw-shadow-color:rgba(var(--status-info-06), 0.5);--tw-shadow:var(--tw-shadow-colored);--tw-ring-opacity:1;--tw-ring-color:rgba(var(--status-info-06), var(--tw-ring-opacity))}:host([variant=info]) .tip-variant{--tw-bg-opacity:1;background-color:rgba(var(--status-info-06), var(--tw-bg-opacity));--tw-text-opacity:1;color:rgba(var(--adjust-tone), var(--tw-text-opacity))}:host([variant=info]) .icon{--tw-text-opacity:1;color:rgba(var(--status-info-06), var(--tw-text-opacity))}:host([variant=success]) .input:focus{--tw-shadow-color:rgba(var(--status-success-06), 0.5);--tw-shadow:var(--tw-shadow-colored);--tw-ring-opacity:1;--tw-ring-color:rgba(var(--status-success-06), var(--tw-ring-opacity))}:host([variant=success]) .tip-variant{--tw-bg-opacity:1;background-color:rgba(var(--status-success-06), var(--tw-bg-opacity));--tw-text-opacity:1;color:rgba(var(--adjust-tone), var(--tw-text-opacity))}:host([variant=success]) .icon{--tw-text-opacity:1;color:rgba(var(--status-success-06), var(--tw-text-opacity))}:host([variant=warning]) .input:focus{--tw-shadow-color:rgba(var(--status-warning-06), 0.5);--tw-shadow:var(--tw-shadow-colored);--tw-ring-opacity:1;--tw-ring-color:rgba(var(--status-warning-06), var(--tw-ring-opacity))}:host([variant=warning]) .tip-variant{--tw-bg-opacity:1;background-color:rgba(var(--status-warning-06), var(--tw-bg-opacity));--tw-text-opacity:1;color:rgba(var(--adjust-tone), var(--tw-text-opacity))}:host([variant=warning]) .icon{--tw-text-opacity:1;color:rgba(var(--status-warning-06), var(--tw-text-opacity))}:host([variant=error]) .input:focus{--tw-shadow-color:rgba(var(--status-error-06), 0.5);--tw-shadow:var(--tw-shadow-colored);--tw-ring-opacity:1;--tw-ring-color:rgba(var(--status-error-06), var(--tw-ring-opacity))}:host([variant=error]) .tip-variant{--tw-bg-opacity:1;background-color:rgba(var(--status-error-06), var(--tw-bg-opacity));--tw-text-opacity:1;color:rgba(var(--adjust-tone), var(--tw-text-opacity))}:host([variant=error]) .icon{--tw-text-opacity:1;color:rgba(var(--status-error-06), var(--tw-text-opacity))}";
|
|
49
|
+
|
|
50
|
+
let MdsInput = class {
|
|
51
|
+
constructor(hostRef) {
|
|
52
|
+
index.registerInstance(this, hostRef);
|
|
53
|
+
this.changeEvent = index.createEvent(this, "changeEvent", 7);
|
|
54
|
+
this.keyDownEvent = index.createEvent(this, "keyDownEvent", 7);
|
|
55
|
+
this.blurEvent = index.createEvent(this, "blurEvent", 7);
|
|
56
|
+
this.focusEvent = index.createEvent(this, "focusEvent", 7);
|
|
57
|
+
this.hasFocus = false;
|
|
58
|
+
/**
|
|
59
|
+
* Specifies whether the element should have autocomplete enabled
|
|
60
|
+
*/
|
|
61
|
+
this.autocomplete = 'off';
|
|
62
|
+
/**
|
|
63
|
+
* Specifies that the element should automatically get focus when the page loads
|
|
64
|
+
*/
|
|
65
|
+
this.autofocus = false;
|
|
66
|
+
/**
|
|
67
|
+
* If true, the element is displayed as disabled
|
|
68
|
+
*/
|
|
69
|
+
this.disabled = false;
|
|
70
|
+
/**
|
|
71
|
+
* Specifies that the element is read-only
|
|
72
|
+
*/
|
|
73
|
+
this.readonly = false;
|
|
74
|
+
/**
|
|
75
|
+
* Specifies that the element must be filled out before submitting the form
|
|
76
|
+
*/
|
|
77
|
+
this.required = false;
|
|
78
|
+
/**
|
|
79
|
+
* Specifies the type of input element
|
|
80
|
+
*/
|
|
81
|
+
this.type = 'text';
|
|
82
|
+
/**
|
|
83
|
+
* Specifies the value of the input element
|
|
84
|
+
*/
|
|
85
|
+
this.value = '';
|
|
86
|
+
this.onInput = (ev) => {
|
|
87
|
+
const input = ev.target;
|
|
88
|
+
if (input) {
|
|
89
|
+
this.value = input.value || '';
|
|
90
|
+
}
|
|
91
|
+
this.keyDownEvent.emit(ev);
|
|
92
|
+
};
|
|
93
|
+
this.onBlur = () => {
|
|
94
|
+
this.hasFocus = false;
|
|
95
|
+
this.blurEvent.emit();
|
|
96
|
+
};
|
|
97
|
+
this.onFocus = (ev) => {
|
|
98
|
+
const input = ev.target;
|
|
99
|
+
this.hasFocus = true;
|
|
100
|
+
this.focusEvent.emit();
|
|
101
|
+
if (this.readonly) {
|
|
102
|
+
// setTimeout to avoid Safari 14.1.2
|
|
103
|
+
// to unselect text when mouse is clicked slowly
|
|
104
|
+
setTimeout(() => {
|
|
105
|
+
input.select();
|
|
106
|
+
}, 10);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
componentWillLoad() {
|
|
111
|
+
// If the mds-input has a tabindex attribute we get the value
|
|
112
|
+
// and pass it down to the native input, then remove it from the
|
|
113
|
+
// mds-input to avoid causing tabbing twice on the same element
|
|
114
|
+
if (this.el.hasAttribute('tabindex')) {
|
|
115
|
+
const tabindex = this.el.getAttribute('tabindex');
|
|
116
|
+
this.tabindex = tabindex !== null ? parseInt(tabindex) : undefined;
|
|
117
|
+
this.el.removeAttribute('tabindex');
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Emits the change event when the component value changes
|
|
122
|
+
*/
|
|
123
|
+
valueChanged() {
|
|
124
|
+
this.changeEvent.emit({ value: this.value === null ? this.value : this.value.toString() });
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Sets focus on the specified `my-input`.
|
|
128
|
+
* Use this method instead
|
|
129
|
+
* of the global `input.focus()`.
|
|
130
|
+
*/
|
|
131
|
+
async setFocus() {
|
|
132
|
+
if (this.nativeInput !== null) {
|
|
133
|
+
this.nativeInput.focus();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Returns the native `<input>` element used under the hood.
|
|
138
|
+
*/
|
|
139
|
+
getInputElement() {
|
|
140
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
141
|
+
return Promise.resolve(this.nativeInput);
|
|
142
|
+
}
|
|
143
|
+
getValue() {
|
|
144
|
+
return typeof this.value === 'number' ? this.value.toString() : (this.value || '').toString();
|
|
145
|
+
}
|
|
146
|
+
render() {
|
|
147
|
+
const value = this.getValue();
|
|
148
|
+
return (index.h(index.Host, null, this.type === 'textarea'
|
|
149
|
+
? index.h("textarea", { class: clsx('input', this.icon && 'has-icon'), autoFocus: this.autofocus, disabled: this.disabled, maxLength: this.maxlength, minLength: this.minlength, name: this.name, onBlur: this.onBlur, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder || '', readOnly: this.readonly, ref: input => (this.nativeInput = input), required: this.required, tabIndex: this.tabindex, value: value })
|
|
150
|
+
: index.h("input", { class: clsx('input', this.icon && 'has-icon'), autoComplete: this.autocomplete, autoFocus: this.autofocus, disabled: this.disabled, max: this.max, maxLength: this.maxlength, min: this.min, minLength: this.minlength, name: this.name, onBlur: this.onBlur, onFocus: this.onFocus, onInput: this.onInput, pattern: this.pattern, list: this.datalist && 'datalist', placeholder: this.placeholder || '', readOnly: this.readonly, ref: input => (this.nativeInput = input), required: this.required, step: this.step, tabIndex: this.tabindex, type: this.type, value: value }), this.required && index.h("mds-text", { typography: "option", class: "tip top-1 required" }, "Obbligatorio"), this.disabled && index.h("mds-text", { typography: "option", class: "tip top-1 disabled" }, "Disabilitato"), this.readonly && index.h("mds-text", { typography: "option", class: "tip top-1 read-only" }, "Sola lettura"), this.variant && this.variantTip && index.h("mds-text", { typography: "option", class: "tip-variant bottom-1" }, this.variantTip), this.datalist &&
|
|
151
|
+
index.h("datalist", { id: "datalist", class: "datalist" }, this.datalist.forEach(element => {
|
|
152
|
+
index.h("option", { value: element });
|
|
153
|
+
})), this.icon && index.h("mds-icon", { class: clsx('icon', this.variant), name: this.icon })));
|
|
154
|
+
}
|
|
155
|
+
get el() { return index.getElement(this); }
|
|
156
|
+
static get watchers() { return {
|
|
157
|
+
"value": ["valueChanged"]
|
|
158
|
+
}; }
|
|
159
|
+
};
|
|
160
|
+
MdsInput.style = mdsInputCss;
|
|
161
|
+
|
|
162
|
+
exports.mds_input = MdsInput;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-3aa055da.js');
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
Stencil Client Patch Browser v2.12.1 | MIT Licensed | https://stenciljs.com
|
|
7
|
+
*/
|
|
8
|
+
const patchBrowser = () => {
|
|
9
|
+
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('mds-input.cjs.js', document.baseURI).href));
|
|
10
|
+
const opts = {};
|
|
11
|
+
if (importMeta !== '') {
|
|
12
|
+
opts.resourcesUrl = new URL('.', importMeta).href;
|
|
13
|
+
}
|
|
14
|
+
return index.promiseResolve(opts);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
patchBrowser().then(options => {
|
|
18
|
+
return index.bootstrapLazy([["mds-input.cjs",[[1,"mds-input",{"autocomplete":[1],"autofocus":[4],"datalist":[16],"disabled":[4],"icon":[1],"max":[2],"maxlength":[2],"min":[1],"minlength":[2],"name":[1],"pattern":[1],"placeholder":[1],"readonly":[4],"required":[4],"variant":[513],"variantTip":[1,"variant-tip"],"step":[1],"type":[1],"value":[8],"hasFocus":[32],"setFocus":[64],"getInputElement":[64]}]]]], options);
|
|
19
|
+
});
|