@maggioli-design-system/mds-input 7.8.0 → 7.8.2
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/loader.cjs.js +1 -1
- package/dist/cjs/mds-input.cjs.entry.js +120 -32
- package/dist/cjs/mds-input.cjs.js +1 -1
- package/dist/collection/common/locale.js +10 -8
- package/dist/collection/common/slot.js +10 -1
- package/dist/collection/components/mds-input/mds-input.js +53 -27
- package/dist/collection/components/mds-input/meta/input-type/InputValidationManager.js +4 -0
- package/dist/collection/components/mds-input/meta/validators.js +40 -0
- package/dist/collection/components/mds-input/test/mds-input.stories.js +166 -104
- package/dist/collection/dictionary/button.js +5 -1
- package/dist/collection/dictionary/icon.js +1 -1
- package/dist/components/mds-input.js +120 -33
- package/dist/documentation.json +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mds-input.entry.js +120 -32
- package/dist/esm/mds-input.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mds-input.entry.js +1 -1
- package/dist/esm-es5/mds-input.js +1 -1
- package/dist/mds-input/mds-input.esm.js +1 -1
- package/dist/mds-input/p-3d99713e.system.js +1 -1
- package/dist/mds-input/p-602b856a.system.entry.js +6 -0
- package/dist/mds-input/p-6a36cef1.entry.js +6 -0
- package/dist/stats.json +17 -24
- package/dist/types/common/slot.d.ts +2 -1
- package/dist/types/components/mds-input/mds-input.d.ts +3 -1
- package/dist/types/components/mds-input/meta/validators.d.ts +4 -0
- package/dist/types/components/mds-input/test/mds-input.stories.d.ts +175 -22
- package/dist/types/dictionary/button.d.ts +2 -1
- package/dist/types/type/button.d.ts +1 -0
- package/documentation.json +17 -2
- package/package.json +2 -2
- package/src/common/locale.ts +10 -8
- package/src/common/slot.ts +12 -0
- package/src/components/mds-input/mds-input.tsx +44 -16
- package/src/components/mds-input/meta/input-type/InputValidationManager.ts +2 -0
- package/src/components/mds-input/meta/validators.ts +44 -0
- package/src/components/mds-input/test/{mds-input.stories.mdx → mds-input.mdx} +1 -1
- package/src/components/mds-input/test/mds-input.stories.tsx +252 -131
- package/src/components/mds-input/test/validator.spec.ts +0 -1
- package/src/dictionary/button.ts +6 -0
- package/src/dictionary/icon.ts +2 -1
- package/src/fixtures/icons.json +4 -0
- package/src/tailwind/components.css +1 -1
- package/src/type/button.ts +4 -0
- package/www/build/mds-input.esm.js +1 -1
- package/www/build/p-3d99713e.system.js +1 -1
- package/www/build/p-602b856a.system.entry.js +6 -0
- package/www/build/p-6a36cef1.entry.js +6 -0
- package/dist/mds-input/p-ae3c84eb.system.entry.js +0 -6
- package/dist/mds-input/p-dbfb8643.entry.js +0 -6
- package/src/fixtures/iconsauce.json +0 -310
- package/www/build/p-ae3c84eb.system.entry.js +0 -6
- package/www/build/p-dbfb8643.entry.js +0 -6
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -8,7 +8,7 @@ const appGlobals = require('./app-globals-3a1e7e63.js');
|
|
|
8
8
|
const defineCustomElements = async (win, options) => {
|
|
9
9
|
if (typeof window === 'undefined') return undefined;
|
|
10
10
|
await appGlobals.globalScripts();
|
|
11
|
-
return index.bootstrapLazy([["mds-input.cjs",[[65,"mds-input",{"autocomplete":[513],"autofocus":[516],"await":[516],"controlsLayout":[513,"controls-layout"],"controlsIcon":[513,"controls-icon"],"controlIncreaseLabel":[513,"control-increase-label"],"controlDecreaseLabel":[513,"control-decrease-label"],"datalist":[16],"disabled":[516],"icon":[1537],"max":[520],"maxlength":[1538],"mic":[516],"min":[520],"minlength":[514],"name":[513],"pattern":[513],"placeholder":[513],"readonly":[516],"required":[516],"variant":[1537],"tip":[513],"step":[513],"type":[513],"typography":[513],"value":[1537],"hasFocus":[32],"language":[32],"isRecording":[32],"currentLengthLabel":[32],"countVariant":[32],"isPasswordVisible":[32],"
|
|
11
|
+
return index.bootstrapLazy([["mds-input.cjs",[[65,"mds-input",{"autocomplete":[513],"autofocus":[516],"await":[516],"controlsLayout":[513,"controls-layout"],"controlsIcon":[513,"controls-icon"],"controlIncreaseLabel":[513,"control-increase-label"],"controlDecreaseLabel":[513,"control-decrease-label"],"datalist":[16],"disabled":[516],"icon":[1537],"max":[520],"maxlength":[1538],"mic":[516],"min":[520],"minlength":[514],"name":[513],"pattern":[513],"placeholder":[513],"readonly":[516],"required":[516],"variant":[1537],"tip":[513],"step":[513],"type":[513],"typography":[513],"value":[1537],"hasFocus":[32],"language":[32],"isRecording":[32],"currentLengthLabel":[32],"countVariant":[32],"isPasswordVisible":[32],"updateLang":[64],"addValidator":[64],"removeValidator":[64],"hasValidator":[64],"getErrors":[64],"setFocus":[64],"getInputElement":[64]},null,{"value":["valueChanged"],"variant":["variantChanged"],"maxlength":["maxLengthChanged"],"disabled":["disabledChanged"]}]]]], options);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
exports.setNonce = index.setNonce;
|
|
@@ -827,15 +827,17 @@ class Locale {
|
|
|
827
827
|
};
|
|
828
828
|
this.update = (doc) => {
|
|
829
829
|
const context = doc !== null && doc !== void 0 ? doc : this.element.shadowRoot;
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
830
|
+
if (context) {
|
|
831
|
+
context.querySelectorAll('*').forEach(el => {
|
|
832
|
+
if (el.tagName.toLowerCase().startsWith('mds-')) {
|
|
833
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
834
|
+
if (el && 'updateLang' in el) {
|
|
835
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
836
|
+
el.updateLang();
|
|
837
|
+
}
|
|
836
838
|
}
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
+
});
|
|
840
|
+
}
|
|
839
841
|
};
|
|
840
842
|
this.pluralize = (tag, context) => {
|
|
841
843
|
const languagePhrase = this.config[this.language] ? this.config[this.language][tag] : this.config[this.rollbackLanguage][tag];
|
|
@@ -943,7 +945,47 @@ const localeIt = {
|
|
|
943
945
|
|
|
944
946
|
const NullValidator = () => null;
|
|
945
947
|
const requiredValidor = (input) => { return input.length > 0 ? null : { required: '' }; };
|
|
948
|
+
const maxValidator = (max) => {
|
|
949
|
+
return (input) => {
|
|
950
|
+
if (input === '' || max === null) {
|
|
951
|
+
return null; // don't validate empty values to allow optional controls
|
|
952
|
+
}
|
|
953
|
+
const value = parseFloat(input);
|
|
954
|
+
// Controls with NaN values after parsing should be treated as not having a
|
|
955
|
+
// maximum, per the HTML forms spec: https://www.w3.org/TR/html5/forms.html#attr-input-max
|
|
956
|
+
return !isNaN(value) && value > max ? { max: `valore massimo ${max}` } : null;
|
|
957
|
+
};
|
|
958
|
+
};
|
|
959
|
+
const minValidator = (min) => {
|
|
960
|
+
return (input) => {
|
|
961
|
+
if (input === '' || min === null) {
|
|
962
|
+
return null; // don't validate empty values to allow optional controls
|
|
963
|
+
}
|
|
964
|
+
const value = parseFloat(input);
|
|
965
|
+
// Controls with NaN values after parsing should be treated as not having a
|
|
966
|
+
// minimum, per the HTML forms spec: https://www.w3.org/TR/html5/forms.html#attr-input-min
|
|
967
|
+
return !isNaN(value) && value < min ? { min: `valore minimo ${min}` } : null;
|
|
968
|
+
};
|
|
969
|
+
};
|
|
970
|
+
const maxLenghtValidator = (length) => {
|
|
971
|
+
return (input) => {
|
|
972
|
+
if (input === '' || length === null) {
|
|
973
|
+
return null; // don't validate empty values to allow optional controls
|
|
974
|
+
}
|
|
975
|
+
return input.length > length ? { minLenght: `La lunghezza massima accettata è ${length}` } : null;
|
|
976
|
+
};
|
|
977
|
+
};
|
|
978
|
+
const minLenghtValidator = (length) => {
|
|
979
|
+
return (input) => {
|
|
980
|
+
if (input === '' || length === null) {
|
|
981
|
+
return null; // don't validate empty values to allow optional controls
|
|
982
|
+
}
|
|
983
|
+
return input.length < length ? { minLenght: `La lunghezza minima accettata è ${length}` } : null;
|
|
984
|
+
};
|
|
985
|
+
};
|
|
946
986
|
const isbnValidatorFn = (input) => {
|
|
987
|
+
if (input === '')
|
|
988
|
+
return null; // don't validate empty values to allow optional controls
|
|
947
989
|
if (Number.isNaN(input.slice(0, -1)) || (input.length !== 10 && input.length !== 13))
|
|
948
990
|
return { 'isbn-error': 'formato isbn non correto' };
|
|
949
991
|
const v = input.split('').map(v => (v === 'X' ? 10 : Number(v)));
|
|
@@ -1049,9 +1091,13 @@ function createInputValidationManager(type) {
|
|
|
1049
1091
|
case 'cf':
|
|
1050
1092
|
inputManager = new InputValidationManager(InputMaskPattern.CF_MASK);
|
|
1051
1093
|
inputManager.validator.addValidator((input) => {
|
|
1094
|
+
if (input === '')
|
|
1095
|
+
return null; // don't validate empty values to allow optional controls
|
|
1052
1096
|
return InputMaskPattern.CF_Regex.test(input) ? null : { 'cf-regex': 'Codice fiscale inserito non corretto' };
|
|
1053
1097
|
});
|
|
1054
1098
|
inputManager.validator.addValidator((input) => {
|
|
1099
|
+
if (input === '')
|
|
1100
|
+
return null; // don't validate empty values to allow optional controls
|
|
1055
1101
|
return input.length === 16 ? null : { 'cf-length': 'Codice fiscale deve essere lungo 16 caratteri' };
|
|
1056
1102
|
});
|
|
1057
1103
|
break;
|
|
@@ -1068,6 +1114,22 @@ function createInputValidationManager(type) {
|
|
|
1068
1114
|
return inputManager;
|
|
1069
1115
|
}
|
|
1070
1116
|
|
|
1117
|
+
const hash = (s) => {
|
|
1118
|
+
let i, h;
|
|
1119
|
+
for (i = 0, h = 0; i < s.length; i++) {
|
|
1120
|
+
h = Math.imul(31, h) + s.charCodeAt(i) | 0;
|
|
1121
|
+
}
|
|
1122
|
+
return h.toString();
|
|
1123
|
+
};
|
|
1124
|
+
const randomInt = (max) => Math.floor(Math.random() * max);
|
|
1125
|
+
const hashRandomValue = (value) => {
|
|
1126
|
+
const randomValue = randomInt(1000000);
|
|
1127
|
+
if (value) {
|
|
1128
|
+
return `${value}-${hash(randomValue.toString())}`;
|
|
1129
|
+
}
|
|
1130
|
+
return hash(randomValue.toString());
|
|
1131
|
+
};
|
|
1132
|
+
|
|
1071
1133
|
const mdsInputCss = "/**\n * @prop --mds-input-background: Sets the background-color of the component\n * @prop --mds-input-icon-color: Sets the icon color of the component\n * @prop --mds-input-placeholder-default-color: Sets the color of the placeholder\n * @prop --mds-input-placeholder-focus-color: Sets the color of the placeholder when the input is focused\n * @prop --mds-input-placeholder-hover-color: Sets the color of the placeholder when the input is hovered\n * @prop --mds-input-ring: Sets the box-shadow of the component's input\n * @prop --mds-input-shadow: Sets the box-shadow of the component's input\n * @prop --mds-input-textarea-field-sizing: Sets the height of the textarea automatically, this is an EXPERIMENTAL css property, so it couldn't work in every browser\n * @prop --mds-input-textarea-max-height: Sets the `max-height` of the component when attribute `type` is set to `textarea`\n * @prop --mds-input-textarea-min-height: Sets the `min-height` of the component when attribute `type` is set to `textarea`\n * @prop --mds-input-tip-background: Sets the background color of the tip message at the bottom right of the component\n * @prop --mds-input-variant-color: Sets the variant colors of the component\n */\n\n:host {\n --mds-input-background: rgb(var(--tone-neutral));\n --mds-input-icon-color: var(--mds-input-variant-color);\n --mds-input-placeholder-default-color: rgb(var(--tone-neutral-06));\n --mds-input-placeholder-focus-color: rgb(var(--tone-neutral-07));\n --mds-input-placeholder-hover-color: var(--mds-input-placeholder-default-color);\n --mds-input-ring: 0 0 0 1px rgb(var(--mds-input-variant-color) / 0.1);\n --mds-input-shadow: 0 1px 3px 0 rgb(var(--mds-input-variant-color) / 0.1), 0 1px 2px 0 rgb(var(--mds-input-variant-color) / 0.06);\n --mds-input-textarea-field-sizing: content;\n --mds-input-textarea-resize: none;\n --mds-input-textarea-max-height: 16rem;\n --mds-input-textarea-min-height: 6rem;\n --mds-input-tip-background: 84 84 84;\n --mds-input-variant-color: 0 0 0;\n /* private */ --mds-input-controls-border: 2px solid rgb(var(--tone-neutral-09));\n /* private */ --mds-input-controls-color: rgb(var(--tone-neutral-03)); min-height: 1.5rem; font-family: Karla, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 1rem; line-height: 1.5rem; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; gap: 0.5rem;\n\n container-type: inline-size;\n display: -ms-flexbox;\n display: flex;\n position: relative;\n}\n\n:host([typography=\"detail\"]) .input {\n min-height: 1.5rem;\n font-family: Karla, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n font-size: 1rem;\n line-height: 1.5rem;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n:host([typography=\"snippet\"]) .input {\n min-height: 1.5rem;\n font-family: 'Roboto Mono', 'Courier New', monospace;\n font-size: 1rem;\n line-height: 1.5rem;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.input {\n font-family: Karla, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n font-size: 1rem;\n line-height: 1.5rem;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n margin: 0rem;\n border-radius: 0.5rem;\n padding-left: 1rem;\n padding-right: 1rem;\n padding-top: 0.75rem;\n padding-bottom: 0.75rem;\n -webkit-transition-duration: 300ms;\n transition-duration: 300ms;\n -webkit-transition-timing-function: cubic-bezier(0.19, 1, 0.22, 1);\n transition-timing-function: cubic-bezier(0.19, 1, 0.22, 1);\n\n background-color: var(--mds-input-background);\n border: 0;\n -webkit-box-shadow: var(--mds-input-ring), var(--mds-input-shadow);\n box-shadow: var(--mds-input-ring), var(--mds-input-shadow);\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n color: rgb(var(--tone-neutral-02));\n max-width: 100%;\n min-height: 3rem;\n overflow: hidden;\n text-overflow: ellipsis;\n -webkit-transition-property: background-color, border-color, color, fill, margin, opacity, padding, -webkit-box-shadow, -webkit-transform;\n transition-property: background-color, border-color, color, fill, margin, opacity, padding, -webkit-box-shadow, -webkit-transform;\n transition-property: background-color, border-color, box-shadow, color, fill, margin, opacity, padding, transform;\n transition-property: background-color, border-color, box-shadow, color, fill, margin, opacity, padding, transform, -webkit-box-shadow, -webkit-transform;\n width: 100%;\n}\n\n.input::-moz-placeholder {\n transition-duration: 300ms;\n transition-timing-function: cubic-bezier(0.19, 1, 0.22, 1);\n\n color: var(--mds-input-placeholder-default-color);\n -moz-transition-property: color;\n transition-property: color;\n}\n\n.input::-webkit-input-placeholder {\n -webkit-transition-duration: 300ms;\n transition-duration: 300ms;\n -webkit-transition-timing-function: cubic-bezier(0.19, 1, 0.22, 1);\n transition-timing-function: cubic-bezier(0.19, 1, 0.22, 1);\n\n color: var(--mds-input-placeholder-default-color);\n -webkit-transition-property: color;\n transition-property: color;\n}\n\n.input:-ms-input-placeholder {\n transition-duration: 300ms;\n transition-timing-function: cubic-bezier(0.19, 1, 0.22, 1);\n\n color: var(--mds-input-placeholder-default-color);\n -ms-transition-property: color;\n transition-property: color;\n}\n\n.input::-ms-input-placeholder {\n transition-duration: 300ms;\n transition-timing-function: cubic-bezier(0.19, 1, 0.22, 1);\n\n color: var(--mds-input-placeholder-default-color);\n -ms-transition-property: color;\n transition-property: color;\n}\n\n.input::placeholder {\n -webkit-transition-duration: 300ms;\n transition-duration: 300ms;\n -webkit-transition-timing-function: cubic-bezier(0.19, 1, 0.22, 1);\n transition-timing-function: cubic-bezier(0.19, 1, 0.22, 1);\n\n color: var(--mds-input-placeholder-default-color);\n -webkit-transition-property: color;\n transition-property: color;\n}\n\n.input:hover::-moz-placeholder {\n color: var(--mds-input-placeholder-hover-color);\n}\n\n.input:hover::-webkit-input-placeholder {\n color: var(--mds-input-placeholder-hover-color);\n}\n\n.input:hover:-ms-input-placeholder {\n color: var(--mds-input-placeholder-hover-color);\n}\n\n.input:hover::-ms-input-placeholder {\n color: var(--mds-input-placeholder-hover-color);\n}\n\n.input:hover::placeholder {\n color: var(--mds-input-placeholder-hover-color);\n}\n\n.input:focus::-moz-placeholder {\n color: var(--mds-input-placeholder-focus-color);\n}\n\n.input:focus::-webkit-input-placeholder {\n color: var(--mds-input-placeholder-focus-color);\n}\n\n.input:focus:-ms-input-placeholder {\n color: var(--mds-input-placeholder-focus-color);\n}\n\n.input:focus::-ms-input-placeholder {\n color: var(--mds-input-placeholder-focus-color);\n}\n\n.input:focus::placeholder {\n color: var(--mds-input-placeholder-focus-color);\n}\n\n.input::-webkit-outer-spin-button,\n.input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n appearance: none;\n display: none;\n margin: 0;\n}\n\n:host textarea.input,\n:host([typography]) textarea.input {\n border-bottom-right-radius: 0;\n\n field-sizing: var(--mds-input-textarea-field-sizing);\n max-height: var(--mds-input-textarea-max-height);\n min-height: var(--mds-input-textarea-min-height);\n overflow: auto;\n resize: var(--mds-input-textarea-resize);\n}\n\n.input:focus {\n outline: 2px solid transparent;\n outline-offset: 2px;\n\n --mds-input-ring: 0 0 0 3px rgb(var(--mds-input-variant-color) / 1);\n --mds-input-shadow: 0 4px 6px 3px rgb(var(--mds-input-variant-color) / 0.1), 0 2px 4px -1px rgb(var(--mds-input-variant-color) / 0.06);\n}\n\n.input:disabled {\n background-color: rgb(var(--tone-neutral-10));\n}\n\n.input:disabled::-moz-placeholder {\n color: rgb(var(--tone-neutral-05));\n}\n\n.input:disabled::-webkit-input-placeholder {\n color: rgb(var(--tone-neutral-05));\n}\n\n.input:disabled:-ms-input-placeholder {\n color: rgb(var(--tone-neutral-05));\n}\n\n.input:disabled::-ms-input-placeholder {\n color: rgb(var(--tone-neutral-05));\n}\n\n.input:disabled,\n.input:disabled::placeholder {\n color: rgb(var(--tone-neutral-05));\n}\n\n.input.has-icon {\n padding-left: 2.75rem;\n}\n\n.input.has-right-icon {\n padding-right: 2.75rem;\n}\n\n\n.await,\n.icon {\n left: 0.75rem;\n top: 0.75rem;\n\n fill: rgb(var(--mds-input-icon-color));\n position: absolute;\n}\n\n.await {\n color: rgb(var(--mds-input-icon-color));\n height: 24px;\n width: 24px;\n}\n\n.counter {\n border-left: var(--mds-input-controls-border);\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: column;\n flex-direction: column;\n gap: 0;\n position: absolute;\n right: 0;\n}\n\n.counter-button {\n height: 1.5rem;\n width: 1.75rem;\n border-radius: 0.5rem;\n\n --mds-button-background: transparent;\n\n border: 0;\n fill: var(--mds-input-controls-color);\n min-height: 0;\n padding: 0;\n}\n\n.counter-button:hover {\n --mds-button-background: rgb(var(--tone-neutral-09));\n}\n\n.counter .counter-button:first-child {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n border-top-left-radius: 0;\n}\n\n.counter .counter-button:last-child {\n border-bottom-left-radius: 0;\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n}\n\n.counter-button--horizontal {\n height: 3rem;\n width: 3rem;\n\n bottom: 0;\n position: absolute;\n top: 0;\n}\n\n.counter-button--decrease {\n border-bottom-right-radius: 0;\n border-right: var(--mds-input-controls-border);\n border-top-right-radius: 0;\n left: 0;\n}\n\n.counter-button--increase {\n border-bottom-left-radius: 0;\n border-left: var(--mds-input-controls-border);\n border-top-left-radius: 0;\n right: 0;\n}\n\n.password-toggle-button {\n top: 0.375rem;\n right: 0.375rem;\n\n fill: var(--mds-input-controls-color);\n position: absolute;\n}\n\n.mic-toggle-button {\n top: 0.375rem;\n right: 0.375rem;\n\n fill: var(--mds-input-controls-color);\n position: absolute;\n}\n\n.toggle-button--error {\n cursor: help;\n fill: rgb(var(--tone-neutral-06));\n}\n\n@-webkit-keyframes pulse {\n\n 50% {\n opacity: .5;\n }\n}\n\n@keyframes pulse {\n\n 50% {\n opacity: .5;\n }\n}\n\n.mic-toggle-button--recording {\n -webkit-animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n}\n\n:host([type=\"number\"]) .input {\n\n /* required to avoid input number buttons on firefox go be shown always */\n\n /* stylelint-disable-next-line property-no-vendor-prefix */\n -moz-appearance: textfield;\n padding-right: 2rem;\n}\n\n:host([type=\"number\"][controls-layout=\"horizontal\"]) .input {\n padding-left: 3.5rem;\n padding-right: 3.5rem;\n\n text-align: center;\n}\n\n:host([type=\"number\"][controls-layout=\"horizontal\"][icon]) .input {\n padding-left: 6rem;\n\n text-align: left;\n}\n\n\n:host([type=\"number\"][controls-layout=\"horizontal\"]) .icon {\n left: 3.75rem;\n}\n\n:host([type=\"password\"]) .input {\n padding-right: 2.5rem;\n}\n\n:host([type=\"password\"]) .input[type=\"password\"]:not(:-moz-placeholder-shown) {\n font-size: 3rem;\n max-height: 3rem;\n}\n\n:host([type=\"password\"]) .input[type=\"password\"]:not(:-ms-input-placeholder) {\n font-size: 3rem;\n max-height: 3rem;\n}\n\n:host([type=\"password\"]) .input[type=\"password\"]:not(:placeholder-shown) {\n font-size: 3rem;\n max-height: 3rem;\n}\n\n:host([type=\"password\"]) .input[type=\"text\"]:not(:-moz-placeholder-shown) {\n min-height: 1.5rem;\n font-family: 'Roboto Mono', 'Courier New', monospace;\n font-size: 1rem;\n line-height: 1.5rem;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n:host([type=\"password\"]) .input[type=\"text\"]:not(:-ms-input-placeholder) {\n min-height: 1.5rem;\n font-family: 'Roboto Mono', 'Courier New', monospace;\n font-size: 1rem;\n line-height: 1.5rem;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n:host([type=\"password\"]) .input[type=\"text\"]:not(:placeholder-shown) {\n min-height: 1.5rem;\n font-family: 'Roboto Mono', 'Courier New', monospace;\n font-size: 1rem;\n line-height: 1.5rem;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n:host([type=\"cf\"]) .input {\n min-height: 1.5rem;\n font-family: 'Roboto Mono', 'Courier New', monospace;\n font-size: 1rem;\n line-height: 1.5rem;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n text-transform: uppercase;\n}\n\n@container (max-width: 210px) {\n :host .tip__content,\n :host(:focus-within) .tip__content {\n grid-template-columns: 0fr;\n opacity: 0;\n }\n\n :host .tip {\n padding-left: 0;\n padding-right: 0;\n }\n\n :host {\n --mds-input-background: rgb(var(--variant-primary-07));\n }\n}\n\n:host {\n --mds-input-icon-color: var(--variant-primary-03);\n --mds-input-variant-color: 0 0 0;\n}\n\n:host(:focus) {\n --mds-input-variant-color: var(--variant-primary-04);\n}\n\n:host([variant=\"ai\"]) {\n --mds-input-icon-color: var(--variant-ai-05);\n --mds-input-tip-background: var(--variant-ai-05);\n --mds-input-variant-color: 0 0 0;\n}\n\n:host([variant=\"ai\"]:focus) {\n --mds-input-icon-color: var(--variant-ai-04);\n --mds-input-variant-color: var(--variant-ai-05);\n}\n\n:host([variant=\"info\"]) {\n --mds-input-icon-color: var(--status-info-05);\n --mds-input-tip-background: var(--status-info-05);\n --mds-input-variant-color: 0 0 0;\n}\n\n:host([variant=\"info\"]:focus) {\n --mds-input-icon-color: var(--status-info-04);\n --mds-input-variant-color: var(--status-info-05);\n}\n\n:host([variant=\"success\"]) {\n --mds-input-icon-color: var(--status-success-05);\n --mds-input-tip-background: var(--status-success-05);\n --mds-input-variant-color: 0 0 0;\n}\n\n:host([variant=\"success\"]:focus) {\n --mds-input-icon-color: var(--status-success-04);\n --mds-input-variant-color: var(--status-success-05);\n}\n\n:host([variant=\"warning\"]) {\n --mds-input-icon-color: var(--status-warning-05);\n --mds-input-tip-background: var(--status-warning-05);\n --mds-input-variant-color: 0 0 0;\n}\n\n:host([variant=\"warning\"]:focus) {\n --mds-input-icon-color: var(--status-warning-04);\n --mds-input-variant-color: var(--status-warning-05);\n}\n\n:host([variant=\"error\"]) {\n --mds-input-icon-color: var(--status-error-05);\n --mds-input-tip-background: var(--status-error-05);\n --mds-input-variant-color: 0 0 0;\n}\n\n:host([variant=\"error\"]:focus) {\n --mds-input-icon-color: var(--status-error-04);\n --mds-input-variant-color: var(--status-error-05);\n}\n\n:host-context(.pref-animation-reduce) .input {\n -webkit-transition-duration: 0s;\n transition-duration: 0s;\n}\n\n@media (prefers-reduced-motion) {\n :host-context(.pref-animation-system) .input {\n -webkit-transition-duration: 0s;\n transition-duration: 0s;\n }\n}\n\n:host-context(.pref-theme-dark) {\n --mds-input-ring: 0 0 0 2px rgb(var(--tone-neutral-01) / 0.3);\n --mds-input-background: rgb(var(--tone-neutral-09));\n --mds-input-controls-border: 2px solid rgb(var(--tone-neutral-06));\n}\n\n:host-context(.pref-theme-dark) .counter-button:hover {\n --mds-button-background: rgb(var(--tone-neutral-08));\n}\n\n@media (prefers-color-scheme: dark) {\n :host-context(.pref-theme-system) {\n --mds-input-ring: 0 0 0 2px rgb(var(--tone-neutral-01) / 0.3);\n --mds-input-background: rgb(var(--tone-neutral-09));\n --mds-input-controls-border: 2px solid rgb(var(--tone-neutral-06));\n }\n\n :host-context(.pref-theme-system) .counter-button:hover {\n --mds-button-background: rgb(var(--tone-neutral-08));\n }\n}\n\n:host-context(.pref-contrast-more) {\n --mds-input-ring: 0 0 0 2px rgb(var(--tone-neutral-01) / 0.6);\n --mds-input-background: rgb(var(--tone-neutral-09));\n --mds-input-controls-border: 2px solid rgb(var(--tone-neutral-05));\n}\n\n:host-context(.pref-contrast-more) .input::-moz-placeholder {\n color: rgb(var(--tone-neutral-03));\n}\n\n:host-context(.pref-contrast-more) .input::-webkit-input-placeholder {\n color: rgb(var(--tone-neutral-03));\n}\n\n:host-context(.pref-contrast-more) .input:-ms-input-placeholder {\n color: rgb(var(--tone-neutral-03));\n}\n\n:host-context(.pref-contrast-more) .input::-ms-input-placeholder {\n color: rgb(var(--tone-neutral-03));\n}\n\n:host-context(.pref-contrast-more) .input::placeholder {\n color: rgb(var(--tone-neutral-03));\n}\n\n@media (prefers-contrast: more) {\n :host-context(.pref-contrast-system) {\n --mds-input-ring: 0 0 0 2px rgb(var(--tone-neutral-01) / 0.6);\n --mds-input-background: rgb(var(--tone-neutral-09));\n --mds-input-controls-border: 2px solid rgb(var(--tone-neutral-05));\n }\n\n :host-context(.pref-contrast-more) .input::-moz-placeholder {\n color: rgb(var(--tone-neutral-03));\n }\n\n :host-context(.pref-contrast-more) .input::-webkit-input-placeholder {\n color: rgb(var(--tone-neutral-03));\n }\n\n :host-context(.pref-contrast-more) .input:-ms-input-placeholder {\n color: rgb(var(--tone-neutral-03));\n }\n\n :host-context(.pref-contrast-more) .input::-ms-input-placeholder {\n color: rgb(var(--tone-neutral-03));\n }\n\n :host-context(.pref-contrast-more) .input::placeholder {\n color: rgb(var(--tone-neutral-03));\n }\n}\n\n:host(:not(:is([hydrated], .hydrated))) {\n -webkit-animation-duration: 0s;\n animation-duration: 0s;\n border-color: transparent;\n -webkit-box-shadow: 0 0 0 transparent;\n box-shadow: 0 0 0 transparent;\n opacity: 0;\n outline-color: transparent;\n -webkit-transition-delay: 0s;\n transition-delay: 0s;\n -webkit-transition-duration: 0s;\n transition-duration: 0s;\n visibility: hidden;\n}\n\n/* TODO refact(stencil): Uses only used selector from parent shadowDOM component */\n\nmds-accordion:not(:is([hydrated], .hydrated)),\nmds-accordion-item:not(:is([hydrated], .hydrated)),\nmds-accordion-timer:not(:is([hydrated], .hydrated)),\nmds-accordion-timer-item:not(:is([hydrated], .hydrated)),\nmds-author:not(:is([hydrated], .hydrated)),\nmds-avatar:not(:is([hydrated], .hydrated)),\nmds-badge:not(:is([hydrated], .hydrated)),\nmds-banner:not(:is([hydrated], .hydrated)),\nmds-benchmark-bar:not(:is([hydrated], .hydrated)),\nmds-bibliography:not(:is([hydrated], .hydrated)),\nmds-breadcrumb:not(:is([hydrated], .hydrated)),\nmds-breadcrumb-item:not(:is([hydrated], .hydrated)),\nmds-button:not(:is([hydrated], .hydrated)),\nmds-card:not(:is([hydrated], .hydrated)),\nmds-card-content:not(:is([hydrated], .hydrated)),\nmds-card-footer:not(:is([hydrated], .hydrated)),\nmds-card-header:not(:is([hydrated], .hydrated)),\nmds-card-media:not(:is([hydrated], .hydrated)),\nmds-chip:not(:is([hydrated], .hydrated)),\nmds-details:not(:is([hydrated], .hydrated)),\nmds-dropdown:not(:is([hydrated], .hydrated)),\nmds-entity:not(:is([hydrated], .hydrated)),\nmds-file:not(:is([hydrated], .hydrated)),\nmds-file-preview:not(:is([hydrated], .hydrated)),\nmds-filter:not(:is([hydrated], .hydrated)),\nmds-filter-item:not(:is([hydrated], .hydrated)),\nmds-header:not(:is([hydrated], .hydrated)),\nmds-header-bar:not(:is([hydrated], .hydrated)),\nmds-help:not(:is([hydrated], .hydrated)),\nmds-horizontal-scroll:not(:is([hydrated], .hydrated)),\nmds-hr:not(:is([hydrated], .hydrated)),\nmds-icon:not(:is([hydrated], .hydrated)),\nmds-img:not(:is([hydrated], .hydrated)),\nmds-input:not(:is([hydrated], .hydrated)),\nmds-input-field:not(:is([hydrated], .hydrated)),\nmds-input-range:not(:is([hydrated], .hydrated)),\nmds-input-select:not(:is([hydrated], .hydrated)),\nmds-input-switch:not(:is([hydrated], .hydrated)),\nmds-input-tip:not(:is([hydrated], .hydrated)),\nmds-input-tip-item:not(:is([hydrated], .hydrated)),\nmds-input-upload:not(:is([hydrated], .hydrated)),\nmds-keyboard:not(:is([hydrated], .hydrated)),\nmds-keyboard-key:not(:is([hydrated], .hydrated)),\nmds-kpi:not(:is([hydrated], .hydrated)),\nmds-kpi-item:not(:is([hydrated], .hydrated)),\nmds-label:not(:is([hydrated], .hydrated)),\nmds-list:not(:is([hydrated], .hydrated)),\nmds-list-item:not(:is([hydrated], .hydrated)),\nmds-modal:not(:is([hydrated], .hydrated)),\nmds-note:not(:is([hydrated], .hydrated)),\nmds-notification:not(:is([hydrated], .hydrated)),\nmds-paginator:not(:is([hydrated], .hydrated)),\nmds-paginator-item:not(:is([hydrated], .hydrated)),\nmds-pref:not(:is([hydrated], .hydrated)),\nmds-pref-animation:not(:is([hydrated], .hydrated)),\nmds-pref-consumption:not(:is([hydrated], .hydrated)),\nmds-pref-contrast:not(:is([hydrated], .hydrated)),\nmds-pref-language:not(:is([hydrated], .hydrated)),\nmds-pref-language-item:not(:is([hydrated], .hydrated)),\nmds-pref-theme:not(:is([hydrated], .hydrated)),\nmds-price-table:not(:is([hydrated], .hydrated)),\nmds-price-table-features:not(:is([hydrated], .hydrated)),\nmds-price-table-features-cell:not(:is([hydrated], .hydrated)),\nmds-price-table-features-row:not(:is([hydrated], .hydrated)),\nmds-price-table-header:not(:is([hydrated], .hydrated)),\nmds-price-table-list:not(:is([hydrated], .hydrated)),\nmds-price-table-list-item:not(:is([hydrated], .hydrated)),\nmds-progress:not(:is([hydrated], .hydrated)),\nmds-push-notification:not(:is([hydrated], .hydrated)),\nmds-push-notifications:not(:is([hydrated], .hydrated)),\nmds-quote:not(:is([hydrated], .hydrated)),\nmds-separator:not(:is([hydrated], .hydrated)),\nmds-spinner:not(:is([hydrated], .hydrated)),\nmds-stepper-bar:not(:is([hydrated], .hydrated)),\nmds-stepper-bar-item:not(:is([hydrated], .hydrated)),\nmds-tab:not(:is([hydrated], .hydrated)),\nmds-tab-bar:not(:is([hydrated], .hydrated)),\nmds-tab-bar-item:not(:is([hydrated], .hydrated)),\nmds-tab-item:not(:is([hydrated], .hydrated)),\nmds-table:not(:is([hydrated], .hydrated)),\nmds-table-body:not(:is([hydrated], .hydrated)),\nmds-table-cell:not(:is([hydrated], .hydrated)),\nmds-table-footer:not(:is([hydrated], .hydrated)),\nmds-table-header:not(:is([hydrated], .hydrated)),\nmds-table-header-cell:not(:is([hydrated], .hydrated)),\nmds-table-row:not(:is([hydrated], .hydrated)),\nmds-text:not(:is([hydrated], .hydrated)),\nmds-toast:not(:is([hydrated], .hydrated)),\nmds-tooltip:not(:is([hydrated], .hydrated)),\nmds-tree:not(:is([hydrated], .hydrated)),\nmds-tree-item:not(:is([hydrated], .hydrated)),\nmds-url-view:not(:is([hydrated], .hydrated)),\nmds-usage:not(:is([hydrated], .hydrated)),\nmds-video-wall:not(:is([hydrated], .hydrated)),\nmds-zero:not(:is([hydrated], .hydrated))\n{\n -webkit-animation-duration: 0s;\n animation-duration: 0s;\n border-color: transparent;\n -webkit-box-shadow: 0 0 0 transparent;\n box-shadow: 0 0 0 transparent;\n opacity: 0;\n outline-color: transparent;\n -webkit-transition-delay: 0s;\n transition-delay: 0s;\n -webkit-transition-duration: 0s;\n transition-duration: 0s;\n visibility: hidden;\n}\n\n";
|
|
1072
1134
|
const MdsInputStyle0 = mdsInputCss;
|
|
1073
1135
|
|
|
@@ -1092,7 +1154,6 @@ const MdsInput = class {
|
|
|
1092
1154
|
this.isRecording = false;
|
|
1093
1155
|
this.countVariant = 'count-empty';
|
|
1094
1156
|
this.isPasswordVisible = false;
|
|
1095
|
-
this.transcript = '';
|
|
1096
1157
|
// private valuePristine?: string
|
|
1097
1158
|
this.t = new Locale({
|
|
1098
1159
|
el: localeEl,
|
|
@@ -1196,8 +1257,7 @@ const MdsInput = class {
|
|
|
1196
1257
|
};
|
|
1197
1258
|
this.onBlur = () => {
|
|
1198
1259
|
this.hasFocus = false;
|
|
1199
|
-
|
|
1200
|
-
this.validateInput();
|
|
1260
|
+
this.validateInput();
|
|
1201
1261
|
this.blurEvent.emit();
|
|
1202
1262
|
// this.isValidInput = this.validateInput()
|
|
1203
1263
|
};
|
|
@@ -1246,12 +1306,12 @@ const MdsInput = class {
|
|
|
1246
1306
|
this.speechToTextIcon = miOutlineMicOff;
|
|
1247
1307
|
};
|
|
1248
1308
|
this.startRecognition = () => {
|
|
1249
|
-
var _a, _b;
|
|
1309
|
+
var _a, _b, _c;
|
|
1250
1310
|
if (!this.speechButton) {
|
|
1251
1311
|
this.speechButton = (_b = (_a = this.el) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.mic-toggle-button');
|
|
1252
1312
|
}
|
|
1253
1313
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1254
|
-
const SpeechRecognition = window.SpeechRecognition
|
|
1314
|
+
const SpeechRecognition = (_c = window.SpeechRecognition) !== null && _c !== void 0 ? _c : window.webkitSpeechRecognition;
|
|
1255
1315
|
this.value = '';
|
|
1256
1316
|
if (!SpeechRecognition) {
|
|
1257
1317
|
this.onSpeechRecognitionError();
|
|
@@ -1262,11 +1322,19 @@ const MdsInput = class {
|
|
|
1262
1322
|
this.recognition.lang = navigator.language || 'it-IT';
|
|
1263
1323
|
this.recognition.interimResults = true;
|
|
1264
1324
|
this.recognition.maxAlternatives = 1;
|
|
1325
|
+
let transcript = '';
|
|
1326
|
+
let progress = 0; // need to save position progress on speech results
|
|
1265
1327
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1266
1328
|
this.recognition.onresult = (event) => {
|
|
1267
|
-
const speechResult = event.results
|
|
1268
|
-
|
|
1269
|
-
|
|
1329
|
+
const speechResult = event.results;
|
|
1330
|
+
const interimResult = speechResult[progress];
|
|
1331
|
+
if (interimResult.isFinal) {
|
|
1332
|
+
transcript += interimResult[0].transcript;
|
|
1333
|
+
this.value = transcript;
|
|
1334
|
+
progress += 1;
|
|
1335
|
+
return;
|
|
1336
|
+
}
|
|
1337
|
+
this.value = transcript + interimResult[0].transcript;
|
|
1270
1338
|
};
|
|
1271
1339
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1272
1340
|
this.recognition.onerror = (event) => {
|
|
@@ -1289,6 +1357,9 @@ const MdsInput = class {
|
|
|
1289
1357
|
formResetCallback() {
|
|
1290
1358
|
this.internals.setFormValue('');
|
|
1291
1359
|
}
|
|
1360
|
+
connectedCallback() {
|
|
1361
|
+
this.datalistId = `datalist-${hashRandomValue()}`;
|
|
1362
|
+
}
|
|
1292
1363
|
componentWillLoad() {
|
|
1293
1364
|
var _a;
|
|
1294
1365
|
this.language = this.t.lang(this.el);
|
|
@@ -1304,6 +1375,7 @@ const MdsInput = class {
|
|
|
1304
1375
|
}
|
|
1305
1376
|
this.internals.setFormValue((_a = this.value) !== null && _a !== void 0 ? _a : null);
|
|
1306
1377
|
this.maxLengthChanged(this.maxlength);
|
|
1378
|
+
this.isValid = !(this.required && this.value === '');
|
|
1307
1379
|
this.el.focus = () => {
|
|
1308
1380
|
var _a;
|
|
1309
1381
|
(_a = this.nativeInput) === null || _a === void 0 ? void 0 : _a.focus();
|
|
@@ -1312,15 +1384,25 @@ const MdsInput = class {
|
|
|
1312
1384
|
componentDidLoad() {
|
|
1313
1385
|
var _a, _b, _c;
|
|
1314
1386
|
this.inputValidation = createInputValidationManager(this.type);
|
|
1315
|
-
|
|
1316
|
-
this.inputValidation.validator.addValidator(requiredValidor);
|
|
1317
|
-
}
|
|
1387
|
+
this.setValidators();
|
|
1318
1388
|
(_a = this.nativeInput) === null || _a === void 0 ? void 0 : _a.setAttribute('pattern', String(this.inputValidation.pattern));
|
|
1319
1389
|
if (this.autofocus) {
|
|
1320
1390
|
(_b = this.nativeInput) === null || _b === void 0 ? void 0 : _b.focus();
|
|
1321
1391
|
}
|
|
1322
1392
|
this.variantChanged((_c = this.variant) !== null && _c !== void 0 ? _c : 'primary');
|
|
1323
1393
|
}
|
|
1394
|
+
setValidators() {
|
|
1395
|
+
if (this.required)
|
|
1396
|
+
this.inputValidation.validator.addValidator(requiredValidor);
|
|
1397
|
+
if (this.max !== '' && Number(this.max))
|
|
1398
|
+
this.inputValidation.validator.addValidator(maxValidator(Number(this.max)));
|
|
1399
|
+
if (this.min !== '' && Number(this.min))
|
|
1400
|
+
this.inputValidation.validator.addValidator(minValidator(Number(this.max)));
|
|
1401
|
+
if (this.maxlength)
|
|
1402
|
+
this.inputValidation.validator.addValidator(maxLenghtValidator(this.maxlength));
|
|
1403
|
+
if (this.minlength)
|
|
1404
|
+
this.inputValidation.validator.addValidator(minLenghtValidator(this.minlength));
|
|
1405
|
+
}
|
|
1324
1406
|
/**
|
|
1325
1407
|
* Emits the change event when the component value changes
|
|
1326
1408
|
*/
|
|
@@ -1331,6 +1413,9 @@ const MdsInput = class {
|
|
|
1331
1413
|
if (this.maxlength !== undefined) {
|
|
1332
1414
|
this.countMaxLength();
|
|
1333
1415
|
}
|
|
1416
|
+
// if is necessary for skip validation when reset input to retype correct value, validation is always onBlur
|
|
1417
|
+
if (this.value === '')
|
|
1418
|
+
return;
|
|
1334
1419
|
if (!this.isValid)
|
|
1335
1420
|
this.validateInput();
|
|
1336
1421
|
}
|
|
@@ -1370,7 +1455,11 @@ const MdsInput = class {
|
|
|
1370
1455
|
// validate input only when atleast one validator is present
|
|
1371
1456
|
if (this.inputValidation.validator.hasValidator()) {
|
|
1372
1457
|
this.isValid = this.inputValidation.isValid(this.value);
|
|
1373
|
-
|
|
1458
|
+
// set variant attribute
|
|
1459
|
+
if (this.value === '' && !this.required)
|
|
1460
|
+
this.variant = 'primary';
|
|
1461
|
+
else
|
|
1462
|
+
this.variant = this.isValid ? 'success' : 'error';
|
|
1374
1463
|
this.validationEvent.emit(this.isValid);
|
|
1375
1464
|
}
|
|
1376
1465
|
return this.isValid;
|
|
@@ -1399,7 +1488,6 @@ const MdsInput = class {
|
|
|
1399
1488
|
* Returns the native `<input>` element used under the hood.
|
|
1400
1489
|
*/
|
|
1401
1490
|
getInputElement() {
|
|
1402
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1403
1491
|
return Promise.resolve(this.nativeInput);
|
|
1404
1492
|
}
|
|
1405
1493
|
componentWillRender() {
|
|
@@ -1407,21 +1495,21 @@ const MdsInput = class {
|
|
|
1407
1495
|
}
|
|
1408
1496
|
render() {
|
|
1409
1497
|
var _a, _b;
|
|
1410
|
-
return (index.h(index.Host, { key: '
|
|
1498
|
+
return (index.h(index.Host, { key: 'e941279da5baa9217b4adb599cd920552b3bf7bb' }, this.type === 'number'
|
|
1411
1499
|
&& this.controlsLayout === 'horizontal'
|
|
1412
|
-
&& index.h("mds-button", { key: '
|
|
1500
|
+
&& index.h("mds-button", { key: '2c95dc102824fc41bd238e22f57391f07762c640', class: "counter-button counter-button--horizontal counter-button--decrease", icon: this.controlsIcon === 'arrow' ? miBaselineArrowDown : miBaselineRemove, onClick: this.stepDown, tabindex: "0", title: this.t.get('decrease'), part: "counter-button-decrease" }), this.type === 'textarea'
|
|
1413
1501
|
? index.h("textarea", { class: clsx('input', ((_a = this.icon) !== null && _a !== void 0 ? _a : this.await) && 'has-icon', this.mic && 'has-right-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, part: "field", placeholder: this.placeholder, readOnly: this.readonly, ref: input => (this.nativeInput = input), required: this.required, tabIndex: this.tabindex, value: this.value })
|
|
1414
|
-
: index.h("input", { class: clsx('input', ((_b = this.icon) !== null && _b !== void 0 ? _b : this.await) && 'has-icon', this.mic && 'has-right-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.
|
|
1502
|
+
: index.h("input", { class: clsx('input', ((_b = this.icon) !== null && _b !== void 0 ? _b : this.await) && 'has-icon', this.mic && 'has-right-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.datalistId, part: "field", placeholder: this.placeholder, readOnly: this.readonly, ref: input => (this.nativeInput = input), required: this.required, step: this.step, tabIndex: this.tabindex, type: this.type === 'password' && this.isPasswordVisible ? 'text' : this.type, value: this.value }), this.type === 'number'
|
|
1415
1503
|
&& this.controlsLayout === 'vertical'
|
|
1416
|
-
&& index.h("div", { key: '
|
|
1504
|
+
&& index.h("div", { key: '83b0cc36e9b29adc9b1adffab2e09f54e6bcc792', class: "counter counter--vertical" }, index.h("mds-button", { key: 'daaee3633fb9dcf24feb2f269fb94a475f9209f7', class: "counter-button", icon: this.controlsIcon === 'arrow' ? miBaselineArrowUp : miBaselineAdd, onClick: this.stepUp, tabindex: "0", title: this.t.get('increase'), part: "counter-button-increase" }), index.h("mds-button", { key: '9ce934c848cb8553c9f149d220f2c61ccb3d9ab0', class: "counter-button", icon: this.controlsIcon === 'arrow' ? miBaselineArrowDown : miBaselineRemove, onClick: this.stepDown, tabindex: "0", title: this.t.get('decrease'), part: "counter-button-decrease" })), this.type === 'number'
|
|
1417
1505
|
&& this.controlsLayout === 'horizontal'
|
|
1418
|
-
&& index.h("mds-button", { key: '
|
|
1419
|
-
&& index.h("mds-button", { key: '
|
|
1420
|
-
&& index.h("mds-button", { key: '
|
|
1421
|
-
index.h("mds-input-tip-item", { key: '
|
|
1422
|
-
index.h("datalist", { key: '
|
|
1423
|
-
return index.h("option", { value: element });
|
|
1424
|
-
})), this.icon && !this.await && index.h("mds-icon", { key: '
|
|
1506
|
+
&& index.h("mds-button", { key: 'd038ffd983d94b4d443f364d3047cd8a3c822d23', class: "counter-button counter-button--horizontal counter-button--increase", icon: this.controlsIcon === 'arrow' ? miBaselineArrowUp : miBaselineAdd, onClick: this.stepUp, tabindex: "0", title: this.t.get('increase'), part: "counter-button-increase" }), this.type === 'password'
|
|
1507
|
+
&& index.h("mds-button", { key: '37a5438ad082f49e5aa5b12bd68a0d8c7f920ecb', class: "password-toggle-button", icon: this.isPasswordVisible ? miBaselineVisibleOff : miBaselineVisible, onClick: () => this.isPasswordVisible = !this.isPasswordVisible, tabindex: "0", tone: "quiet", title: this.isPasswordVisible ? this.t.get('hidePassword') : this.t.get('showPassword'), part: "password-toggle-button" }), this.mic
|
|
1508
|
+
&& index.h("mds-button", { key: 'fce9a5d3b490b2f3359e53700acfdb097bcd9725', class: clsx('mic-toggle-button', this.isRecording && 'mic-toggle-button--recording'), icon: this.speechToTextIcon, onClick: () => this.toggleTextRecognition(), tabindex: "0", variant: "dark", tone: "quiet", title: this.speechToTextLabel, part: "mic-toggle-button" }), index.h("mds-input-tip", { key: '1711eb78f44d175c2798e9c51b539ed31ce1d37d', lang: this.language, position: "top", active: this.hasFocus }, this.disabled && index.h("mds-input-tip-item", { key: 'bd974692531f61b58100b2a9fa66367789babb9e', expanded: true, variant: "disabled" }), this.readonly && index.h("mds-input-tip-item", { key: '9185ecde9fa1a93dfdbf83606d28012ca028c503', expanded: true, variant: "readonly" }), this.required &&
|
|
1509
|
+
index.h("mds-input-tip-item", { key: '5ca514e81c4cacf40af585f4438c3681542a57bb', expanded: this.hasFocus, variant: this.isValid ? 'required-success' : 'required' })), index.h("mds-input-tip", { key: '5d0ad9c86aad01c8260b65b736a65a86f5bc9fe7', lang: this.language, position: "bottom", active: this.hasFocus }, this.tip && index.h("mds-input-tip-item", { key: '1394db789468f3656532a9eb35387cbaaea250e2', expanded: true, variant: "text" }, this.tip), this.maxlength && index.h("mds-input-tip-item", { key: '6239db2e8f3806357962a0dab1716261ac7b25b5', part: "tip-count", expanded: true, variant: this.countVariant }, this.currentLengthLabel)), this.datalist &&
|
|
1510
|
+
index.h("datalist", { key: '1063302936ee816d6297f0a7ded3164282000b35', id: this.datalistId, class: "datalist" }, this.datalist.map((element, i) => {
|
|
1511
|
+
return index.h("option", { key: i, value: element });
|
|
1512
|
+
})), this.icon && !this.await && index.h("mds-icon", { key: 'f66025e785c7deead521071e0d036f987c5b1310', class: clsx('icon', this.variant), name: this.icon }), index.h("mds-spinner", { key: 'fa01747cbcf9ced6a9ccdec27cedc015f652deb9', running: this.await, class: clsx('await', this.variant) })));
|
|
1425
1513
|
}
|
|
1426
1514
|
static get formAssociated() { return true; }
|
|
1427
1515
|
get el() { return index.getElement(this); }
|
|
@@ -19,7 +19,7 @@ var patchBrowser = () => {
|
|
|
19
19
|
|
|
20
20
|
patchBrowser().then(async (options) => {
|
|
21
21
|
await appGlobals.globalScripts();
|
|
22
|
-
return index.bootstrapLazy([["mds-input.cjs",[[65,"mds-input",{"autocomplete":[513],"autofocus":[516],"await":[516],"controlsLayout":[513,"controls-layout"],"controlsIcon":[513,"controls-icon"],"controlIncreaseLabel":[513,"control-increase-label"],"controlDecreaseLabel":[513,"control-decrease-label"],"datalist":[16],"disabled":[516],"icon":[1537],"max":[520],"maxlength":[1538],"mic":[516],"min":[520],"minlength":[514],"name":[513],"pattern":[513],"placeholder":[513],"readonly":[516],"required":[516],"variant":[1537],"tip":[513],"step":[513],"type":[513],"typography":[513],"value":[1537],"hasFocus":[32],"language":[32],"isRecording":[32],"currentLengthLabel":[32],"countVariant":[32],"isPasswordVisible":[32],"
|
|
22
|
+
return index.bootstrapLazy([["mds-input.cjs",[[65,"mds-input",{"autocomplete":[513],"autofocus":[516],"await":[516],"controlsLayout":[513,"controls-layout"],"controlsIcon":[513,"controls-icon"],"controlIncreaseLabel":[513,"control-increase-label"],"controlDecreaseLabel":[513,"control-decrease-label"],"datalist":[16],"disabled":[516],"icon":[1537],"max":[520],"maxlength":[1538],"mic":[516],"min":[520],"minlength":[514],"name":[513],"pattern":[513],"placeholder":[513],"readonly":[516],"required":[516],"variant":[1537],"tip":[513],"step":[513],"type":[513],"typography":[513],"value":[1537],"hasFocus":[32],"language":[32],"isRecording":[32],"currentLengthLabel":[32],"countVariant":[32],"isPasswordVisible":[32],"updateLang":[64],"addValidator":[64],"removeValidator":[64],"hasValidator":[64],"getErrors":[64],"setFocus":[64],"getInputElement":[64]},null,{"value":["valueChanged"],"variant":["variantChanged"],"maxlength":["maxLengthChanged"],"disabled":["disabledChanged"]}]]]], options);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
exports.setNonce = index.setNonce;
|
|
@@ -19,15 +19,17 @@ export class Locale {
|
|
|
19
19
|
};
|
|
20
20
|
this.update = (doc) => {
|
|
21
21
|
const context = doc !== null && doc !== void 0 ? doc : this.element.shadowRoot;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
if (context) {
|
|
23
|
+
context.querySelectorAll('*').forEach(el => {
|
|
24
|
+
if (el.tagName.toLowerCase().startsWith('mds-')) {
|
|
25
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
26
|
+
if (el && 'updateLang' in el) {
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
|
+
el.updateLang();
|
|
29
|
+
}
|
|
28
30
|
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
31
33
|
};
|
|
32
34
|
this.pluralize = (tag, context) => {
|
|
33
35
|
const languagePhrase = this.config[this.language] ? this.config[this.language][tag] : this.config[this.rollbackLanguage][tag];
|
|
@@ -25,4 +25,13 @@ const hasSlotted = (el, name) => {
|
|
|
25
25
|
}
|
|
26
26
|
return false;
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
const hasSlottedContent = (el, name) => {
|
|
29
|
+
var _a;
|
|
30
|
+
const query = name ? `slot[name="${name}"]` : 'slot:not([name])';
|
|
31
|
+
const slot = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(query);
|
|
32
|
+
if (!slot)
|
|
33
|
+
return false;
|
|
34
|
+
const assignedNodes = slot.assignedNodes({ flatten: true });
|
|
35
|
+
return assignedNodes.some(node => { var _a; return node.nodeType === Node.TEXT_NODE && ((_a = node.textContent) === null || _a === void 0 ? void 0 : _a.trim()) !== ''; });
|
|
36
|
+
};
|
|
37
|
+
export { hasSlottedElements, hasSlottedNodes, hasSlottedContent, hasSlotted, };
|
|
@@ -16,7 +16,8 @@ import localeEn from "./meta/locale.en.json";
|
|
|
16
16
|
import localeEs from "./meta/locale.es.json";
|
|
17
17
|
import localeIt from "./meta/locale.it.json";
|
|
18
18
|
import { createInputValidationManager } from "./meta/input-type/InputValidationManager";
|
|
19
|
-
import { requiredValidor } from "./meta/validators";
|
|
19
|
+
import { maxLenghtValidator, maxValidator, minLenghtValidator, minValidator, requiredValidor } from "./meta/validators";
|
|
20
|
+
import { hashRandomValue } from "../../common/aria";
|
|
20
21
|
export class MdsInput {
|
|
21
22
|
constructor() {
|
|
22
23
|
this.speechToTextIcon = miOutlineMic;
|
|
@@ -24,7 +25,6 @@ export class MdsInput {
|
|
|
24
25
|
this.isRecording = false;
|
|
25
26
|
this.countVariant = 'count-empty';
|
|
26
27
|
this.isPasswordVisible = false;
|
|
27
|
-
this.transcript = '';
|
|
28
28
|
// private valuePristine?: string
|
|
29
29
|
this.t = new Locale({
|
|
30
30
|
el: localeEl,
|
|
@@ -128,8 +128,7 @@ export class MdsInput {
|
|
|
128
128
|
};
|
|
129
129
|
this.onBlur = () => {
|
|
130
130
|
this.hasFocus = false;
|
|
131
|
-
|
|
132
|
-
this.validateInput();
|
|
131
|
+
this.validateInput();
|
|
133
132
|
this.blurEvent.emit();
|
|
134
133
|
// this.isValidInput = this.validateInput()
|
|
135
134
|
};
|
|
@@ -178,12 +177,12 @@ export class MdsInput {
|
|
|
178
177
|
this.speechToTextIcon = miOutlineMicOff;
|
|
179
178
|
};
|
|
180
179
|
this.startRecognition = () => {
|
|
181
|
-
var _a, _b;
|
|
180
|
+
var _a, _b, _c;
|
|
182
181
|
if (!this.speechButton) {
|
|
183
182
|
this.speechButton = (_b = (_a = this.el) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.mic-toggle-button');
|
|
184
183
|
}
|
|
185
184
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
186
|
-
const SpeechRecognition = window.SpeechRecognition
|
|
185
|
+
const SpeechRecognition = (_c = window.SpeechRecognition) !== null && _c !== void 0 ? _c : window.webkitSpeechRecognition;
|
|
187
186
|
this.value = '';
|
|
188
187
|
if (!SpeechRecognition) {
|
|
189
188
|
this.onSpeechRecognitionError();
|
|
@@ -194,11 +193,19 @@ export class MdsInput {
|
|
|
194
193
|
this.recognition.lang = navigator.language || 'it-IT';
|
|
195
194
|
this.recognition.interimResults = true;
|
|
196
195
|
this.recognition.maxAlternatives = 1;
|
|
196
|
+
let transcript = '';
|
|
197
|
+
let progress = 0; // need to save position progress on speech results
|
|
197
198
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
198
199
|
this.recognition.onresult = (event) => {
|
|
199
|
-
const speechResult = event.results
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
const speechResult = event.results;
|
|
201
|
+
const interimResult = speechResult[progress];
|
|
202
|
+
if (interimResult.isFinal) {
|
|
203
|
+
transcript += interimResult[0].transcript;
|
|
204
|
+
this.value = transcript;
|
|
205
|
+
progress += 1;
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
this.value = transcript + interimResult[0].transcript;
|
|
202
209
|
};
|
|
203
210
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
204
211
|
this.recognition.onerror = (event) => {
|
|
@@ -221,6 +228,9 @@ export class MdsInput {
|
|
|
221
228
|
formResetCallback() {
|
|
222
229
|
this.internals.setFormValue('');
|
|
223
230
|
}
|
|
231
|
+
connectedCallback() {
|
|
232
|
+
this.datalistId = `datalist-${hashRandomValue()}`;
|
|
233
|
+
}
|
|
224
234
|
componentWillLoad() {
|
|
225
235
|
var _a;
|
|
226
236
|
this.language = this.t.lang(this.el);
|
|
@@ -236,6 +246,7 @@ export class MdsInput {
|
|
|
236
246
|
}
|
|
237
247
|
this.internals.setFormValue((_a = this.value) !== null && _a !== void 0 ? _a : null);
|
|
238
248
|
this.maxLengthChanged(this.maxlength);
|
|
249
|
+
this.isValid = !(this.required && this.value === '');
|
|
239
250
|
this.el.focus = () => {
|
|
240
251
|
var _a;
|
|
241
252
|
(_a = this.nativeInput) === null || _a === void 0 ? void 0 : _a.focus();
|
|
@@ -244,15 +255,25 @@ export class MdsInput {
|
|
|
244
255
|
componentDidLoad() {
|
|
245
256
|
var _a, _b, _c;
|
|
246
257
|
this.inputValidation = createInputValidationManager(this.type);
|
|
247
|
-
|
|
248
|
-
this.inputValidation.validator.addValidator(requiredValidor);
|
|
249
|
-
}
|
|
258
|
+
this.setValidators();
|
|
250
259
|
(_a = this.nativeInput) === null || _a === void 0 ? void 0 : _a.setAttribute('pattern', String(this.inputValidation.pattern));
|
|
251
260
|
if (this.autofocus) {
|
|
252
261
|
(_b = this.nativeInput) === null || _b === void 0 ? void 0 : _b.focus();
|
|
253
262
|
}
|
|
254
263
|
this.variantChanged((_c = this.variant) !== null && _c !== void 0 ? _c : 'primary');
|
|
255
264
|
}
|
|
265
|
+
setValidators() {
|
|
266
|
+
if (this.required)
|
|
267
|
+
this.inputValidation.validator.addValidator(requiredValidor);
|
|
268
|
+
if (this.max !== '' && Number(this.max))
|
|
269
|
+
this.inputValidation.validator.addValidator(maxValidator(Number(this.max)));
|
|
270
|
+
if (this.min !== '' && Number(this.min))
|
|
271
|
+
this.inputValidation.validator.addValidator(minValidator(Number(this.max)));
|
|
272
|
+
if (this.maxlength)
|
|
273
|
+
this.inputValidation.validator.addValidator(maxLenghtValidator(this.maxlength));
|
|
274
|
+
if (this.minlength)
|
|
275
|
+
this.inputValidation.validator.addValidator(minLenghtValidator(this.minlength));
|
|
276
|
+
}
|
|
256
277
|
/**
|
|
257
278
|
* Emits the change event when the component value changes
|
|
258
279
|
*/
|
|
@@ -263,6 +284,9 @@ export class MdsInput {
|
|
|
263
284
|
if (this.maxlength !== undefined) {
|
|
264
285
|
this.countMaxLength();
|
|
265
286
|
}
|
|
287
|
+
// if is necessary for skip validation when reset input to retype correct value, validation is always onBlur
|
|
288
|
+
if (this.value === '')
|
|
289
|
+
return;
|
|
266
290
|
if (!this.isValid)
|
|
267
291
|
this.validateInput();
|
|
268
292
|
}
|
|
@@ -302,7 +326,11 @@ export class MdsInput {
|
|
|
302
326
|
// validate input only when atleast one validator is present
|
|
303
327
|
if (this.inputValidation.validator.hasValidator()) {
|
|
304
328
|
this.isValid = this.inputValidation.isValid(this.value);
|
|
305
|
-
|
|
329
|
+
// set variant attribute
|
|
330
|
+
if (this.value === '' && !this.required)
|
|
331
|
+
this.variant = 'primary';
|
|
332
|
+
else
|
|
333
|
+
this.variant = this.isValid ? 'success' : 'error';
|
|
306
334
|
this.validationEvent.emit(this.isValid);
|
|
307
335
|
}
|
|
308
336
|
return this.isValid;
|
|
@@ -331,7 +359,6 @@ export class MdsInput {
|
|
|
331
359
|
* Returns the native `<input>` element used under the hood.
|
|
332
360
|
*/
|
|
333
361
|
getInputElement() {
|
|
334
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
335
362
|
return Promise.resolve(this.nativeInput);
|
|
336
363
|
}
|
|
337
364
|
componentWillRender() {
|
|
@@ -339,21 +366,21 @@ export class MdsInput {
|
|
|
339
366
|
}
|
|
340
367
|
render() {
|
|
341
368
|
var _a, _b;
|
|
342
|
-
return (h(Host, { key: '
|
|
369
|
+
return (h(Host, { key: 'e941279da5baa9217b4adb599cd920552b3bf7bb' }, this.type === 'number'
|
|
343
370
|
&& this.controlsLayout === 'horizontal'
|
|
344
|
-
&& h("mds-button", { key: '
|
|
371
|
+
&& h("mds-button", { key: '2c95dc102824fc41bd238e22f57391f07762c640', class: "counter-button counter-button--horizontal counter-button--decrease", icon: this.controlsIcon === 'arrow' ? miBaselineArrowDown : miBaselineRemove, onClick: this.stepDown, tabindex: "0", title: this.t.get('decrease'), part: "counter-button-decrease" }), this.type === 'textarea'
|
|
345
372
|
? h("textarea", { class: clsx('input', ((_a = this.icon) !== null && _a !== void 0 ? _a : this.await) && 'has-icon', this.mic && 'has-right-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, part: "field", placeholder: this.placeholder, readOnly: this.readonly, ref: input => (this.nativeInput = input), required: this.required, tabIndex: this.tabindex, value: this.value })
|
|
346
|
-
: h("input", { class: clsx('input', ((_b = this.icon) !== null && _b !== void 0 ? _b : this.await) && 'has-icon', this.mic && 'has-right-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.
|
|
373
|
+
: h("input", { class: clsx('input', ((_b = this.icon) !== null && _b !== void 0 ? _b : this.await) && 'has-icon', this.mic && 'has-right-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.datalistId, part: "field", placeholder: this.placeholder, readOnly: this.readonly, ref: input => (this.nativeInput = input), required: this.required, step: this.step, tabIndex: this.tabindex, type: this.type === 'password' && this.isPasswordVisible ? 'text' : this.type, value: this.value }), this.type === 'number'
|
|
347
374
|
&& this.controlsLayout === 'vertical'
|
|
348
|
-
&& h("div", { key: '
|
|
375
|
+
&& h("div", { key: '83b0cc36e9b29adc9b1adffab2e09f54e6bcc792', class: "counter counter--vertical" }, h("mds-button", { key: 'daaee3633fb9dcf24feb2f269fb94a475f9209f7', class: "counter-button", icon: this.controlsIcon === 'arrow' ? miBaselineArrowUp : miBaselineAdd, onClick: this.stepUp, tabindex: "0", title: this.t.get('increase'), part: "counter-button-increase" }), h("mds-button", { key: '9ce934c848cb8553c9f149d220f2c61ccb3d9ab0', class: "counter-button", icon: this.controlsIcon === 'arrow' ? miBaselineArrowDown : miBaselineRemove, onClick: this.stepDown, tabindex: "0", title: this.t.get('decrease'), part: "counter-button-decrease" })), this.type === 'number'
|
|
349
376
|
&& this.controlsLayout === 'horizontal'
|
|
350
|
-
&& h("mds-button", { key: '
|
|
351
|
-
&& h("mds-button", { key: '
|
|
352
|
-
&& h("mds-button", { key: '
|
|
353
|
-
h("mds-input-tip-item", { key: '
|
|
354
|
-
h("datalist", { key: '
|
|
355
|
-
return h("option", { value: element });
|
|
356
|
-
})), this.icon && !this.await && h("mds-icon", { key: '
|
|
377
|
+
&& h("mds-button", { key: 'd038ffd983d94b4d443f364d3047cd8a3c822d23', class: "counter-button counter-button--horizontal counter-button--increase", icon: this.controlsIcon === 'arrow' ? miBaselineArrowUp : miBaselineAdd, onClick: this.stepUp, tabindex: "0", title: this.t.get('increase'), part: "counter-button-increase" }), this.type === 'password'
|
|
378
|
+
&& h("mds-button", { key: '37a5438ad082f49e5aa5b12bd68a0d8c7f920ecb', class: "password-toggle-button", icon: this.isPasswordVisible ? miBaselineVisibleOff : miBaselineVisible, onClick: () => this.isPasswordVisible = !this.isPasswordVisible, tabindex: "0", tone: "quiet", title: this.isPasswordVisible ? this.t.get('hidePassword') : this.t.get('showPassword'), part: "password-toggle-button" }), this.mic
|
|
379
|
+
&& h("mds-button", { key: 'fce9a5d3b490b2f3359e53700acfdb097bcd9725', class: clsx('mic-toggle-button', this.isRecording && 'mic-toggle-button--recording'), icon: this.speechToTextIcon, onClick: () => this.toggleTextRecognition(), tabindex: "0", variant: "dark", tone: "quiet", title: this.speechToTextLabel, part: "mic-toggle-button" }), h("mds-input-tip", { key: '1711eb78f44d175c2798e9c51b539ed31ce1d37d', lang: this.language, position: "top", active: this.hasFocus }, this.disabled && h("mds-input-tip-item", { key: 'bd974692531f61b58100b2a9fa66367789babb9e', expanded: true, variant: "disabled" }), this.readonly && h("mds-input-tip-item", { key: '9185ecde9fa1a93dfdbf83606d28012ca028c503', expanded: true, variant: "readonly" }), this.required &&
|
|
380
|
+
h("mds-input-tip-item", { key: '5ca514e81c4cacf40af585f4438c3681542a57bb', expanded: this.hasFocus, variant: this.isValid ? 'required-success' : 'required' })), h("mds-input-tip", { key: '5d0ad9c86aad01c8260b65b736a65a86f5bc9fe7', lang: this.language, position: "bottom", active: this.hasFocus }, this.tip && h("mds-input-tip-item", { key: '1394db789468f3656532a9eb35387cbaaea250e2', expanded: true, variant: "text" }, this.tip), this.maxlength && h("mds-input-tip-item", { key: '6239db2e8f3806357962a0dab1716261ac7b25b5', part: "tip-count", expanded: true, variant: this.countVariant }, this.currentLengthLabel)), this.datalist &&
|
|
381
|
+
h("datalist", { key: '1063302936ee816d6297f0a7ded3164282000b35', id: this.datalistId, class: "datalist" }, this.datalist.map((element, i) => {
|
|
382
|
+
return h("option", { key: i, value: element });
|
|
383
|
+
})), this.icon && !this.await && h("mds-icon", { key: 'f66025e785c7deead521071e0d036f987c5b1310', class: clsx('icon', this.variant), name: this.icon }), h("mds-spinner", { key: 'fa01747cbcf9ced6a9ccdec27cedc015f652deb9', running: this.await, class: clsx('await', this.variant) })));
|
|
357
384
|
}
|
|
358
385
|
static get is() { return "mds-input"; }
|
|
359
386
|
static get encapsulation() { return "shadow"; }
|
|
@@ -921,8 +948,7 @@ export class MdsInput {
|
|
|
921
948
|
"isRecording": {},
|
|
922
949
|
"currentLengthLabel": {},
|
|
923
950
|
"countVariant": {},
|
|
924
|
-
"isPasswordVisible": {}
|
|
925
|
-
"transcript": {}
|
|
951
|
+
"isPasswordVisible": {}
|
|
926
952
|
};
|
|
927
953
|
}
|
|
928
954
|
static get events() {
|