mithril-materialized 3.5.0 → 3.5.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.
- package/dist/core.css +126 -126
- package/dist/forms.css +126 -126
- package/dist/index.css +126 -126
- package/dist/index.esm.js +14 -1
- package/dist/index.js +14 -1
- package/dist/index.min.css +1 -1
- package/dist/index.umd.js +14 -1
- package/package.json +1 -1
- package/sass/components/forms/_input-fields.scss +10 -10
package/dist/index.umd.js
CHANGED
|
@@ -3300,9 +3300,11 @@
|
|
|
3300
3300
|
? true
|
|
3301
3301
|
: false;
|
|
3302
3302
|
const rangeType = type === 'range' && !attrs.minmax;
|
|
3303
|
+
// Only add validate class if input is interactive and validation is needed
|
|
3304
|
+
const shouldValidate = !isNonInteractive && (validate || type === 'email' || type === 'url' || isNumeric);
|
|
3303
3305
|
return m('.input-field', { className: cn, style }, [
|
|
3304
3306
|
iconName ? m('i.material-icons.prefix', iconName) : undefined,
|
|
3305
|
-
m('input
|
|
3307
|
+
m('input', Object.assign(Object.assign({ class: shouldValidate ? 'validate' : undefined }, params), { type, tabindex: 0, id,
|
|
3306
3308
|
placeholder, value: controlled ? value : undefined, class: type === 'range' && attrs.vertical ? 'range-slider vertical' : undefined, style: type === 'range' && attrs.vertical
|
|
3307
3309
|
? {
|
|
3308
3310
|
height: attrs.height || '200px',
|
|
@@ -3383,6 +3385,17 @@
|
|
|
3383
3385
|
state.active = false;
|
|
3384
3386
|
const target = e.target;
|
|
3385
3387
|
state.hasInteracted = true;
|
|
3388
|
+
// Skip validation for readonly/disabled inputs
|
|
3389
|
+
if (attrs.readonly || attrs.disabled) {
|
|
3390
|
+
// Call original onblur if provided
|
|
3391
|
+
if (attrs.onblur) {
|
|
3392
|
+
attrs.onblur(e);
|
|
3393
|
+
}
|
|
3394
|
+
if (onchange && state.inputElement) {
|
|
3395
|
+
onchange(getValue(state.inputElement));
|
|
3396
|
+
}
|
|
3397
|
+
return;
|
|
3398
|
+
}
|
|
3386
3399
|
if (target && validate) {
|
|
3387
3400
|
const value = getValue(target);
|
|
3388
3401
|
// Only validate if user has entered some text
|
package/package.json
CHANGED
|
@@ -76,32 +76,32 @@ textarea.materialize-textarea {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
// Valid Input Style
|
|
79
|
-
&.valid,
|
|
80
|
-
&:focus.valid {
|
|
79
|
+
&.valid:not([readonly]):not([disabled]),
|
|
80
|
+
&:focus.valid:not([readonly]):not([disabled]) {
|
|
81
81
|
@extend %valid-input-style !optional;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
// Custom Success Message
|
|
85
|
-
&.valid ~ .helper-text:after,
|
|
86
|
-
&:focus.valid ~ .helper-text:after {
|
|
85
|
+
&.valid:not([readonly]):not([disabled]) ~ .helper-text:after,
|
|
86
|
+
&:focus.valid:not([readonly]):not([disabled]) ~ .helper-text:after {
|
|
87
87
|
@extend %custom-success-message !optional;
|
|
88
88
|
}
|
|
89
|
-
&:focus.valid ~ label {
|
|
89
|
+
&:focus.valid:not([readonly]):not([disabled]) ~ label {
|
|
90
90
|
color: variables.$input-success-color;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
// Invalid Input Style
|
|
94
|
-
&.invalid,
|
|
95
|
-
&:focus.invalid {
|
|
94
|
+
&.invalid:not([readonly]):not([disabled]),
|
|
95
|
+
&:focus.invalid:not([readonly]):not([disabled]) {
|
|
96
96
|
@extend %invalid-input-style !optional;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
// Custom Error message
|
|
100
|
-
&.invalid ~ .helper-text:after,
|
|
101
|
-
&:focus.invalid ~ .helper-text:after {
|
|
100
|
+
&.invalid:not([readonly]):not([disabled]) ~ .helper-text:after,
|
|
101
|
+
&:focus.invalid:not([readonly]):not([disabled]) ~ .helper-text:after {
|
|
102
102
|
@extend %custom-error-message !optional;
|
|
103
103
|
}
|
|
104
|
-
&:focus.invalid ~ label {
|
|
104
|
+
&:focus.invalid:not([readonly]):not([disabled]) ~ label {
|
|
105
105
|
color: variables.$input-error-color;
|
|
106
106
|
}
|
|
107
107
|
|