@maggioli-design-system/mds-input 7.6.0 → 7.7.1

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.
Files changed (66) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/mds-input.cjs.entry.js +187 -14
  3. package/dist/cjs/mds-input.cjs.js +1 -1
  4. package/dist/collection/components/mds-input/mds-input.css +59 -17
  5. package/dist/collection/components/mds-input/mds-input.js +188 -21
  6. package/dist/collection/components/mds-input/meta/dictionary.js +7 -0
  7. package/dist/collection/components/mds-input/meta/input-type/InputMaskPattern.js +5 -0
  8. package/dist/collection/components/mds-input/meta/input-type/InputValidationManager.js +65 -0
  9. package/dist/collection/components/mds-input/meta/types.js +1 -0
  10. package/dist/collection/components/mds-input/meta/validators.js +56 -0
  11. package/dist/collection/components/mds-input/test/mds-input.stories.js +5 -1
  12. package/dist/collection/dictionary/button.js +3 -2
  13. package/dist/collection/dictionary/variant.js +14 -2
  14. package/dist/components/mds-input.js +192 -15
  15. package/dist/documentation.json +222 -15
  16. package/dist/esm/loader.js +1 -1
  17. package/dist/esm/mds-input.entry.js +187 -14
  18. package/dist/esm/mds-input.js +1 -1
  19. package/dist/esm-es5/loader.js +1 -1
  20. package/dist/esm-es5/mds-input.entry.js +2 -2
  21. package/dist/esm-es5/mds-input.js +1 -1
  22. package/dist/mds-input/mds-input.esm.js +1 -1
  23. package/dist/mds-input/p-3d99713e.system.js +1 -1
  24. package/dist/mds-input/p-65072ca2.system.entry.js +6 -0
  25. package/dist/mds-input/p-83542c96.entry.js +6 -0
  26. package/dist/stats.json +344 -34
  27. package/dist/types/components/mds-input/mds-input.d.ts +21 -3
  28. package/dist/types/components/mds-input/meta/dictionary.d.ts +2 -0
  29. package/dist/types/components/mds-input/meta/input-type/InputMaskPattern.d.ts +5 -0
  30. package/dist/types/components/mds-input/meta/input-type/InputValidationManager.d.ts +10 -0
  31. package/dist/types/components/mds-input/meta/types.d.ts +1 -0
  32. package/dist/types/components/mds-input/meta/validators.d.ts +19 -0
  33. package/dist/types/components/mds-input/test/mds-input.stories.d.ts +1 -0
  34. package/dist/types/components.d.ts +18 -2
  35. package/dist/types/type/button.d.ts +1 -1
  36. package/dist/types/type/input.d.ts +1 -1
  37. package/dist/types/type/variant.d.ts +2 -2
  38. package/documentation.json +261 -34
  39. package/package.json +6 -6
  40. package/readme.md +108 -46
  41. package/src/components/mds-input/mds-input.css +42 -12
  42. package/src/components/mds-input/mds-input.tsx +77 -10
  43. package/src/components/mds-input/meta/dictionary.ts +10 -0
  44. package/src/components/mds-input/meta/input-type/InputMaskPattern.ts +5 -0
  45. package/src/components/mds-input/meta/input-type/InputValidationManager.ts +78 -0
  46. package/src/components/mds-input/meta/types.ts +17 -0
  47. package/src/components/mds-input/meta/validators.ts +76 -0
  48. package/src/components/mds-input/readme.md +106 -44
  49. package/src/components/mds-input/test/mds-input.e2e.ts +232 -6
  50. package/src/components/mds-input/test/mds-input.stories.tsx +6 -1
  51. package/src/components/mds-input/test/validator.spec.ts +126 -0
  52. package/src/components.d.ts +18 -2
  53. package/src/dictionary/button.ts +3 -2
  54. package/src/dictionary/variant.ts +14 -2
  55. package/src/fixtures/icons.json +17 -0
  56. package/src/type/button.ts +6 -5
  57. package/src/type/input.ts +4 -0
  58. package/src/type/variant.ts +14 -2
  59. package/www/build/mds-input.esm.js +1 -1
  60. package/www/build/p-3d99713e.system.js +1 -1
  61. package/www/build/p-65072ca2.system.entry.js +6 -0
  62. package/www/build/p-83542c96.entry.js +6 -0
  63. package/dist/mds-input/p-9261a056.system.entry.js +0 -6
  64. package/dist/mds-input/p-fd259f13.entry.js +0 -6
  65. package/www/build/p-9261a056.system.entry.js +0 -6
  66. package/www/build/p-fd259f13.entry.js +0 -6
@@ -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":[513],"max":[513],"maxlength":[1538],"min":[520],"minlength":[514],"name":[513],"pattern":[513],"placeholder":[513],"readonly":[516],"required":[516],"variant":[513],"tip":[513],"step":[513],"type":[513],"typography":[513],"value":[1537],"hasFocus":[32],"language":[32],"currentLengthLabel":[32],"countVariant":[32],"isPasswordVisible":[32],"updateLang":[64],"setFocus":[64],"getInputElement":[64]},null,{"value":["valueChanged"],"maxlength":["maxLengthChanged"],"disabled":["disabledChanged"]}]]]], options);
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":[513],"max":[513],"maxlength":[1538],"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],"currentLengthLabel":[32],"countVariant":[32],"isPasswordVisible":[32],"updateLang":[64],"addValidator":[64],"removeValidator":[64],"hasValidator":[64],"getErrors":[64],"setFocus":[64],"getInputElement":[64]},null,{"value":["valueChanged"],"maxlength":["maxLengthChanged"],"disabled":["disabledChanged"]}]]]], options);
12
12
  };
13
13
 
14
14
  exports.setNonce = index.setNonce;
@@ -904,7 +904,134 @@ const localeIt = {
904
904
  hidePassword: hidePassword
905
905
  };
906
906
 
907
- 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-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-tip-background: 84 84 84;\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-variant-color: 0 0 0;\n --mds-input-controls-color: rgb(var(--variant-primary-03));\n --mds-input-controls-border: 2px solid rgb(var(--tone-neutral-09));\n --mds-input-textarea-min-height: 6rem;\n --mds-input-textarea-max-height: 16rem;\n --mds-input-textarea-field-sizing: content;\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 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 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 color: rgb(var(--tone-neutral-04));\n}\n\n.input::-webkit-input-placeholder {\n color: rgb(var(--tone-neutral-04));\n}\n\n.input:-ms-input-placeholder {\n color: rgb(var(--tone-neutral-04));\n}\n\n.input::-ms-input-placeholder {\n color: rgb(var(--tone-neutral-04));\n}\n\n.input::placeholder {\n color: rgb(var(--tone-neutral-04));\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\ntextarea.input {\n resize: vertical;\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}\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\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:host([type=\"number\"]) .input {\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@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=\"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";
907
+ const NullValidator = () => null;
908
+ const requiredValidor = (input) => { return input.length > 0 ? null : { required: '' }; };
909
+ const isbnValidatorFn = (input) => {
910
+ if (Number.isNaN(input.slice(0, -1)) || (input.length !== 10 && input.length !== 13))
911
+ return { 'isbn-error': 'formato isbn non correto' };
912
+ const v = input.split('').map(v => (v === 'X' ? 10 : Number(v)));
913
+ let check = 0;
914
+ // check isbn-10
915
+ if (input.length === 10) {
916
+ const numVerify = v.reduce((prev, curr, i) => {
917
+ return prev + ((10 - i) * curr);
918
+ }, 0);
919
+ check = numVerify % 11;
920
+ }
921
+ else {
922
+ // check isbn-13
923
+ const numVerify = v.reduce((prev, curr, i) => {
924
+ const multiply = i % 2 === 0 ? 1 : 3;
925
+ return prev + (curr * multiply);
926
+ }, 0);
927
+ check = numVerify % 10;
928
+ }
929
+ return check === 0 ? null : { 'isbn-error': 'codice isbn non valido' };
930
+ };
931
+ class Validator {
932
+ constructor() {
933
+ this._validators = [];
934
+ this._errors = null;
935
+ this.isValid = true;
936
+ }
937
+ addValidator(validator) {
938
+ if (Array.isArray(validator)) {
939
+ this._validators.push(...validator);
940
+ }
941
+ else {
942
+ this._validators.push(validator);
943
+ }
944
+ }
945
+ _hasValidator(validators, validator) {
946
+ return Array.isArray(validators) ? validators.includes(validator) : validators === validator;
947
+ }
948
+ hasValidator(validator) {
949
+ return validator ? this._hasValidator(this._validators, validator) : this._validators.length > 0;
950
+ }
951
+ removeValidator(validator) {
952
+ this._validators = this._validators.filter(v => !this._hasValidator(validator, v));
953
+ }
954
+ validate(value) {
955
+ const res = this._validators.map(v => v(value)).reduce((prev, curr) => (Object.assign(Object.assign({}, prev), curr)), NullValidator);
956
+ this._errors = Object.keys(res).length === 0 ? null : res;
957
+ this.isValid = !this._errors;
958
+ }
959
+ get errors() {
960
+ return this._errors;
961
+ }
962
+ }
963
+
964
+ class InputMaskPattern {
965
+ }
966
+ InputMaskPattern.CF_Regex = /^(?:[A-Z][AEIOU][AEIOUX]|[AEIOU]X{2}|[B-DF-HJ-NP-TV-Z]{2}[A-Z]){2}(?:[\dLMNP-V]{2}(?:[A-EHLMPR-T](?:[04LQ][1-9MNP-V]|[15MR][\dLMNP-V]|[26NS][0-8LMNP-U])|[DHPS][37PT][0L]|[ACELMRT][37PT][01LM]|[AC-EHLMPR-T][26NS][9V])|(?:[02468LNQSU][048LQU]|[13579MPRTV][26NS])B[26NS][9V])(?:[A-MZ][1-9MNP-V][\dLMNP-V]{2}|[A-M][0L](?:[1-9MNP-V][\dLMNP-V]|[0L][1-9MNP-V]))[A-Z]$/i;
967
+ InputMaskPattern.CF_MASK = 'A{6}(99|AA)A(99|AA)A(999|AAA)A';
968
+ InputMaskPattern.CC_MASK = '9999-9999-9999-9999';
969
+
970
+ // TODO use input mask when it will be supported by shadow dom
971
+ // https://github.com/RobinHerbots/Inputmask/pull/2753
972
+ // import InputMask from 'inputmask'
973
+ class InputValidationManager {
974
+ // private _inputMask: InputMask.Instance
975
+ constructor(pattern) {
976
+ this.validator = new Validator();
977
+ this.pattern = pattern;
978
+ // this._inputMask = new InputMask()
979
+ }
980
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
981
+ mask(_nativeInput) {
982
+ if (!this.pattern) {
983
+ throw new Error('no pattern found, set pattern before mask');
984
+ }
985
+ // const inputMaskOptions : InputMask.Options = {
986
+ // mask: this.pattern,
987
+ // }
988
+ // this._inputMask = new InputMask(inputMaskOptions)
989
+ // if (!nativeInput) throw new Error('input undefined or null')
990
+ // this._inputMask.mask(nativeInput)
991
+ }
992
+ isValid(value) {
993
+ this.validator.validate(value);
994
+ // if (this.pattern) {
995
+ // return this._inputMask.isValid() && this.validator.isValid
996
+ // }
997
+ return this.validator.isValid;
998
+ }
999
+ }
1000
+ function createInputValidationManager(type) {
1001
+ let inputManager;
1002
+ switch (type) {
1003
+ case 'tel':
1004
+ inputManager = new InputValidationManager('');
1005
+ break;
1006
+ case 'url':
1007
+ inputManager = new InputValidationManager('');
1008
+ break;
1009
+ case 'cc':
1010
+ inputManager = new InputValidationManager(InputMaskPattern.CC_MASK);
1011
+ break;
1012
+ case 'cf':
1013
+ inputManager = new InputValidationManager(InputMaskPattern.CF_MASK);
1014
+ inputManager.validator.addValidator((input) => {
1015
+ return InputMaskPattern.CF_Regex.test(input) ? null : { 'cf-regex': 'Codice fiscale inserito non corretto' };
1016
+ });
1017
+ inputManager.validator.addValidator((input) => {
1018
+ return input.length === 16 ? null : { 'cf-length': 'Codice fiscale deve essere lungo 16 caratteri' };
1019
+ });
1020
+ break;
1021
+ case 'isbn':
1022
+ inputManager = new InputValidationManager();
1023
+ inputManager.validator.addValidator(isbnValidatorFn);
1024
+ break;
1025
+ case 'piva':
1026
+ inputManager = new InputValidationManager('');
1027
+ break;
1028
+ default:
1029
+ inputManager = new InputValidationManager('');
1030
+ }
1031
+ return inputManager;
1032
+ }
1033
+
1034
+ const mdsInputCss = "\n\n/**\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(--variant-primary-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\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: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=\"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";
908
1035
  const MdsInputStyle0 = mdsInputCss;
909
1036
 
910
1037
  const MdsInput = class {
@@ -914,6 +1041,7 @@ const MdsInput = class {
914
1041
  this.keyDownEvent = index.createEvent(this, "mdsInputKeydown", 7);
915
1042
  this.blurEvent = index.createEvent(this, "mdsInputBlur", 7);
916
1043
  this.focusEvent = index.createEvent(this, "mdsInputFocus", 7);
1044
+ this.validationEvent = index.createEvent(this, "mdsInputValidation", 7);
917
1045
  if (hostRef.$hostElement$["s-ei"]) {
918
1046
  this.internals = hostRef.$hostElement$["s-ei"];
919
1047
  }
@@ -924,6 +1052,7 @@ const MdsInput = class {
924
1052
  this.hasFocus = false;
925
1053
  this.countVariant = 'count-empty';
926
1054
  this.isPasswordVisible = false;
1055
+ // private valuePristine?: string
927
1056
  this.t = new Locale({
928
1057
  el: localeEl,
929
1058
  en: localeEn,
@@ -962,10 +1091,6 @@ const MdsInput = class {
962
1091
  * If true, the element is displayed as disabled
963
1092
  */
964
1093
  this.disabled = false;
965
- /**
966
- * Specifies a short hint that describes the expected value of the element
967
- */
968
- this.placeholder = '';
969
1094
  /**
970
1095
  * Specifies that the element is read-only
971
1096
  */
@@ -1026,7 +1151,10 @@ const MdsInput = class {
1026
1151
  };
1027
1152
  this.onBlur = () => {
1028
1153
  this.hasFocus = false;
1154
+ if (this.isValid)
1155
+ this.validateInput();
1029
1156
  this.blurEvent.emit();
1157
+ // this.isValidInput = this.validateInput()
1030
1158
  };
1031
1159
  this.onFocus = (ev) => {
1032
1160
  const input = ev.target;
@@ -1063,6 +1191,7 @@ const MdsInput = class {
1063
1191
  componentWillLoad() {
1064
1192
  var _a;
1065
1193
  this.language = this.t.lang(this.el);
1194
+ // this.valuePristine = this.value
1066
1195
  // If the mds-input has a tabindex attribute we get the value
1067
1196
  // and pass it down to the native input, then remove it from the
1068
1197
  // mds-input to avoid causing tabbing twice on the same element
@@ -1073,6 +1202,21 @@ const MdsInput = class {
1073
1202
  }
1074
1203
  this.internals.setFormValue((_a = this.value) !== null && _a !== void 0 ? _a : null);
1075
1204
  this.maxLengthChanged(this.maxlength);
1205
+ this.el.focus = () => {
1206
+ var _a;
1207
+ (_a = this.nativeInput) === null || _a === void 0 ? void 0 : _a.focus();
1208
+ };
1209
+ }
1210
+ componentDidLoad() {
1211
+ var _a, _b;
1212
+ this.inputValidation = createInputValidationManager(this.type);
1213
+ if (this.required) {
1214
+ this.inputValidation.validator.addValidator(requiredValidor);
1215
+ }
1216
+ (_a = this.nativeInput) === null || _a === void 0 ? void 0 : _a.setAttribute('pattern', String(this.inputValidation.pattern));
1217
+ if (this.autofocus) {
1218
+ (_b = this.nativeInput) === null || _b === void 0 ? void 0 : _b.focus();
1219
+ }
1076
1220
  }
1077
1221
  /**
1078
1222
  * Emits the change event when the component value changes
@@ -1084,6 +1228,8 @@ const MdsInput = class {
1084
1228
  if (this.maxlength !== undefined) {
1085
1229
  this.countMaxLength();
1086
1230
  }
1231
+ if (!this.isValid)
1232
+ this.validateInput();
1087
1233
  }
1088
1234
  maxLengthChanged(newValue) {
1089
1235
  if (newValue === undefined)
@@ -1094,6 +1240,33 @@ const MdsInput = class {
1094
1240
  }
1095
1241
  this.countMaxLength();
1096
1242
  }
1243
+ async addValidator(validator) {
1244
+ this.inputValidation.validator.addValidator(validator);
1245
+ return Promise.resolve();
1246
+ }
1247
+ async removeValidator(validator) {
1248
+ this.inputValidation.validator.removeValidator(validator);
1249
+ }
1250
+ /**
1251
+ * Returns if validator is presen
1252
+ * @param validator validator to check if it is present
1253
+ * @returns if a validator is present or not, if no validator given, return if there are at least one validator
1254
+ */
1255
+ async hasValidator(validator) {
1256
+ return this.inputValidation.validator.hasValidator(validator);
1257
+ }
1258
+ async getErrors() {
1259
+ return Promise.resolve(this.inputValidation.validator.errors);
1260
+ }
1261
+ validateInput() {
1262
+ // validate input only when atleast one validator is present
1263
+ if (this.inputValidation.validator.hasValidator()) {
1264
+ this.isValid = this.inputValidation.isValid(this.value);
1265
+ this.variant = this.isValid ? 'success' : 'error';
1266
+ this.validationEvent.emit(this.isValid);
1267
+ }
1268
+ return this.isValid;
1269
+ }
1097
1270
  disabledChanged(newValue) {
1098
1271
  /**
1099
1272
  * This is related to ALL disabled attributes set on Magma input components
@@ -1126,20 +1299,20 @@ const MdsInput = class {
1126
1299
  }
1127
1300
  render() {
1128
1301
  var _a, _b;
1129
- return (index.h(index.Host, { key: '092c047d986f352fb6619c0226ee298ba7c47b5d' }, this.type === 'number'
1302
+ return (index.h(index.Host, { key: '7bcf91aca53feb18a28157e00ee4da810e010fa1' }, this.type === 'number'
1130
1303
  && this.controlsLayout === 'horizontal'
1131
- && index.h("mds-button", { key: '8d1102c0c344ef165aa8362f07a70c5c15486497', class: "counter-button counter-button--horizontal counter-button--decrease", icon: this.controlsIcon === 'arrow' ? miBaselineArrowDown : miBaselineRemove, onClick: this.stepDown, role: "button", tabindex: "0", title: this.t.get('decrease'), part: "counter-button-decrease" }), this.type === 'textarea'
1304
+ && index.h("mds-button", { key: '8b2dec6e8ea8f97a56860eb0dcad9906fca34db2', 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'
1132
1305
  ? index.h("textarea", { class: clsx('input', ((_a = this.icon) !== null && _a !== void 0 ? _a : this.await) && '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, part: "field", placeholder: this.placeholder, readOnly: this.readonly, ref: input => (this.nativeInput = input), required: this.required, tabIndex: this.tabindex, value: this.value })
1133
1306
  : index.h("input", { class: clsx('input', ((_b = this.icon) !== null && _b !== void 0 ? _b : this.await) && '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', 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'
1134
1307
  && this.controlsLayout === 'vertical'
1135
- && index.h("div", { key: 'cb9f7381220cc239be4a7b0496632f712b5884a8', class: "counter counter--vertical" }, index.h("mds-button", { key: '811d62fc18062aa87d3c2feb367ea0ff5a8b96ee', class: "counter-button", icon: this.controlsIcon === 'arrow' ? miBaselineArrowUp : miBaselineAdd, onClick: this.stepUp, role: "button", tabindex: "0", title: this.t.get('increase'), part: "counter-button-increase" }), index.h("mds-button", { key: '1da6e70684e4c54ffc5fd6e46ee72e93fa71c92e', class: "counter-button", icon: this.controlsIcon === 'arrow' ? miBaselineArrowDown : miBaselineRemove, onClick: this.stepDown, role: "button", tabindex: "0", title: this.t.get('decrease'), part: "counter-button-decrease" })), this.type === 'number'
1308
+ && index.h("div", { key: '44152354d2e397d804a3cc1136d835893926637b', class: "counter counter--vertical" }, index.h("mds-button", { key: '838e644c66e08177b4aebd5f73e83a1cc80cc514', 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: '65bb7254cbca18664b6c41302da0da0e091b610e', 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'
1136
1309
  && this.controlsLayout === 'horizontal'
1137
- && index.h("mds-button", { key: 'c272f0e9fd2af1f2947a82c8954a33b91ec8952b', class: "counter-button counter-button--horizontal counter-button--increase", icon: this.controlsIcon === 'arrow' ? miBaselineArrowUp : miBaselineAdd, onClick: this.stepUp, role: "button", tabindex: "0", title: this.t.get('increase'), part: "counter-button-increase" }), this.type === 'password'
1138
- && index.h("mds-button", { key: '2276154fb4451cf52f0fb806c4bd206299a75798', class: "password-toggle-button", icon: this.isPasswordVisible ? miBaselineVisibleOff : miBaselineVisible, onClick: () => this.isPasswordVisible = !this.isPasswordVisible, role: "button", tabindex: "0", tone: "quiet", title: this.isPasswordVisible ? this.t.get('hidePassword') : this.t.get('showPassword'), part: "password-toggle-button" }), index.h("mds-input-tip", { key: '0b8733d237a76ebc88c0a57bb9b3bd23608a21aa', lang: this.language, position: "top", active: this.hasFocus }, this.disabled && index.h("mds-input-tip-item", { key: 'ba27f229ed7eab375381ba4e84979a738e33a14e', expanded: true, variant: "disabled" }), this.readonly && index.h("mds-input-tip-item", { key: '8acbfe6d3df8d1500b23a217fbb595470e9fef34', expanded: true, variant: "readonly" }), this.required &&
1139
- index.h("mds-input-tip-item", { key: '85605f3ecd99fb27e219273c5f7e22c2059389d9', expanded: this.hasFocus, variant: this.value === '' ? 'required' : 'required-success' })), index.h("mds-input-tip", { key: '8550422b58133c91848038dd29c09e2e7bcecbe4', lang: this.language, position: "bottom", active: this.hasFocus }, this.tip && index.h("mds-input-tip-item", { key: '65de4760bffbd1c938c440a6112d04bcbfe2f62d', expanded: true, variant: "text" }, this.tip), this.maxlength && index.h("mds-input-tip-item", { key: 'f47b47b2fcd1cc20f834596e1dd2b74f1ca7b4b5', part: "tip-count", expanded: true, variant: this.countVariant }, this.currentLengthLabel)), this.datalist &&
1140
- index.h("datalist", { key: 'bdc3f13692b00dae9e034f33f450ab4f4d6260f6', id: "datalist", class: "datalist" }, this.datalist.forEach(element => {
1141
- index.h("option", { value: element });
1142
- })), this.icon && !this.await && index.h("mds-icon", { key: '890a24ac77cea5ceac8c8ac10d9995fd1e76a3f1', class: clsx('icon', this.variant), name: this.icon }), index.h("mds-spinner", { key: '83bea6775de9cabd0d399dcd547404a42a739730', running: this.await, class: clsx('await', this.variant) })));
1310
+ && index.h("mds-button", { key: 'b7aaf01c01071cca8a37084b4d2e41d0e1b84e4e', 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'
1311
+ && index.h("mds-button", { key: 'b961439524106e40471302d24270176973eebcb7', 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" }), index.h("mds-input-tip", { key: 'a244562862771dde8f08020bbf44c63086b8f685', lang: this.language, position: "top", active: this.hasFocus }, this.disabled && index.h("mds-input-tip-item", { key: '28fd9702190626d711d414086d5a61de34fe08b1', expanded: true, variant: "disabled" }), this.readonly && index.h("mds-input-tip-item", { key: '64a95ac2e2d0ffee636bb5bfd55f45dcc9399a2c', expanded: true, variant: "readonly" }), this.required &&
1312
+ index.h("mds-input-tip-item", { key: 'fa957185f104bec23eeebb1c4e98146ebc0789ab', expanded: this.hasFocus, variant: this.isValid ? 'required-success' : 'required' })), index.h("mds-input-tip", { key: '2a86141b562df5e7f1f4f28f5ccd55b04dea27c8', lang: this.language, position: "bottom", active: this.hasFocus }, this.tip && index.h("mds-input-tip-item", { key: 'a258201f5d84b1d6556194c37a0e48dd0172088b', expanded: true, variant: "text" }, this.tip), this.maxlength && index.h("mds-input-tip-item", { key: '325f117d6dc5cca6e29575ef5e9f4fb6957f975c', part: "tip-count", expanded: true, variant: this.countVariant }, this.currentLengthLabel)), this.datalist &&
1313
+ index.h("datalist", { key: '0b2d39716babb08b0363598eb9362e531dd7bcdd', id: "datalist", class: "datalist" }, this.datalist.forEach(element => {
1314
+ return index.h("option", { value: element });
1315
+ })), this.icon && !this.await && index.h("mds-icon", { key: 'a65f0a2ef1ab08c809b77e7e1384653fd88b1610', class: clsx('icon', this.variant), name: this.icon }), index.h("mds-spinner", { key: '20186147633cfb40ad5a27a3c5254810346e1dbf', running: this.await, class: clsx('await', this.variant) })));
1143
1316
  }
1144
1317
  static get formAssociated() { return true; }
1145
1318
  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":[513],"max":[513],"maxlength":[1538],"min":[520],"minlength":[514],"name":[513],"pattern":[513],"placeholder":[513],"readonly":[516],"required":[516],"variant":[513],"tip":[513],"step":[513],"type":[513],"typography":[513],"value":[1537],"hasFocus":[32],"language":[32],"currentLengthLabel":[32],"countVariant":[32],"isPasswordVisible":[32],"updateLang":[64],"setFocus":[64],"getInputElement":[64]},null,{"value":["valueChanged"],"maxlength":["maxLengthChanged"],"disabled":["disabledChanged"]}]]]], options);
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":[513],"max":[513],"maxlength":[1538],"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],"currentLengthLabel":[32],"countVariant":[32],"isPasswordVisible":[32],"updateLang":[64],"addValidator":[64],"removeValidator":[64],"hasValidator":[64],"getErrors":[64],"setFocus":[64],"getInputElement":[64]},null,{"value":["valueChanged"],"maxlength":["maxLengthChanged"],"disabled":["disabledChanged"]}]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;
@@ -1,6 +1,9 @@
1
1
  /**
2
2
  * @prop --mds-input-background: Sets the background-color of the component
3
3
  * @prop --mds-input-icon-color: Sets the icon color of the component
4
+ * @prop --mds-input-placeholder-default-color: Sets the color of the placeholder
5
+ * @prop --mds-input-placeholder-focus-color: Sets the color of the placeholder when the input is focused
6
+ * @prop --mds-input-placeholder-hover-color: Sets the color of the placeholder when the input is hovered
4
7
  * @prop --mds-input-ring: Sets the box-shadow of the component's input
5
8
  * @prop --mds-input-shadow: Sets the box-shadow of the component's input
6
9
  * @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
@@ -13,22 +16,19 @@
13
16
  :host {
14
17
  --mds-input-background: rgb(var(--tone-neutral));
15
18
  --mds-input-icon-color: var(--mds-input-variant-color);
16
- --mds-input-tip-background: 84 84 84;
19
+ --mds-input-placeholder-default-color: rgb(var(--tone-neutral-06));
20
+ --mds-input-placeholder-focus-color: rgb(var(--tone-neutral-07));
21
+ --mds-input-placeholder-hover-color: var(--mds-input-placeholder-default-color);
17
22
  --mds-input-ring: 0 0 0 1px rgb(var(--mds-input-variant-color) / 0.1);
18
23
  --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);
19
- --mds-input-variant-color: 0 0 0;
20
- --mds-input-controls-color: rgb(var(--variant-primary-03));
21
- --mds-input-controls-border: 2px solid rgb(var(--tone-neutral-09));
22
- --mds-input-textarea-min-height: 6rem;
23
- --mds-input-textarea-max-height: 16rem;
24
24
  --mds-input-textarea-field-sizing: content;
25
- min-height: 1.5rem;
26
- font-family: Karla, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
27
- font-size: 1rem;
28
- line-height: 1.5rem;
29
- -webkit-font-smoothing: antialiased;
30
- -moz-osx-font-smoothing: grayscale;
31
- gap: 0.5rem;
25
+ --mds-input-textarea-resize: none;
26
+ --mds-input-textarea-max-height: 16rem;
27
+ --mds-input-textarea-min-height: 6rem;
28
+ --mds-input-tip-background: 84 84 84;
29
+ --mds-input-variant-color: 0 0 0;
30
+ /* private */ --mds-input-controls-border: 2px solid rgb(var(--tone-neutral-09));
31
+ /* private */ --mds-input-controls-color: rgb(var(--variant-primary-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;
32
32
 
33
33
  container-type: inline-size;
34
34
  display: flex;
@@ -73,6 +73,7 @@
73
73
  box-shadow: var(--mds-input-ring), var(--mds-input-shadow);
74
74
  box-sizing: border-box;
75
75
  color: rgb(var(--tone-neutral-02));
76
+ max-width: 100%;
76
77
  min-height: 3rem;
77
78
  overflow: hidden;
78
79
  text-overflow: ellipsis;
@@ -81,11 +82,36 @@
81
82
  }
82
83
 
83
84
  .input::-moz-placeholder {
84
- color: rgb(var(--tone-neutral-04));
85
+ transition-duration: 300ms;
86
+ transition-timing-function: cubic-bezier(0.19, 1, 0.22, 1);
87
+
88
+ color: var(--mds-input-placeholder-default-color);
89
+ -moz-transition-property: color;
90
+ transition-property: color;
85
91
  }
86
92
 
87
93
  .input::placeholder {
88
- color: rgb(var(--tone-neutral-04));
94
+ transition-duration: 300ms;
95
+ transition-timing-function: cubic-bezier(0.19, 1, 0.22, 1);
96
+
97
+ color: var(--mds-input-placeholder-default-color);
98
+ transition-property: color;
99
+ }
100
+
101
+ .input:hover::-moz-placeholder {
102
+ color: var(--mds-input-placeholder-hover-color);
103
+ }
104
+
105
+ .input:hover::placeholder {
106
+ color: var(--mds-input-placeholder-hover-color);
107
+ }
108
+
109
+ .input:focus::-moz-placeholder {
110
+ color: var(--mds-input-placeholder-focus-color);
111
+ }
112
+
113
+ .input:focus::placeholder {
114
+ color: var(--mds-input-placeholder-focus-color);
89
115
  }
90
116
 
91
117
  .input::-webkit-outer-spin-button,
@@ -96,14 +122,15 @@
96
122
  margin: 0;
97
123
  }
98
124
 
99
- textarea.input {
100
- resize: vertical;
125
+ :host textarea.input,
126
+ :host([typography]) textarea.input {
101
127
  border-bottom-right-radius: 0;
102
128
 
103
129
  field-sizing: var(--mds-input-textarea-field-sizing);
104
130
  max-height: var(--mds-input-textarea-max-height);
105
131
  min-height: var(--mds-input-textarea-min-height);
106
132
  overflow: auto;
133
+ resize: var(--mds-input-textarea-resize);
107
134
  }
108
135
 
109
136
  .input:focus {
@@ -217,6 +244,11 @@ textarea.input {
217
244
  }
218
245
 
219
246
  :host([type="number"]) .input {
247
+
248
+ /* required to avoid input number buttons on firefox go be shown always */
249
+
250
+ /* stylelint-disable-next-line property-no-vendor-prefix */
251
+ -moz-appearance: textfield;
220
252
  padding-right: 2rem;
221
253
  }
222
254
 
@@ -270,6 +302,16 @@ textarea.input {
270
302
  -moz-osx-font-smoothing: grayscale;
271
303
  }
272
304
 
305
+ :host([type="cf"]) .input {
306
+ min-height: 1.5rem;
307
+ font-family: 'Roboto Mono', 'Courier New', monospace;
308
+ font-size: 1rem;
309
+ line-height: 1.5rem;
310
+ -webkit-font-smoothing: antialiased;
311
+ -moz-osx-font-smoothing: grayscale;
312
+ text-transform: uppercase;
313
+ }
314
+
273
315
  @container (max-width: 210px) {
274
316
  :host .tip__content,
275
317
  :host(:focus-within) .tip__content {