text-fields
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -59,2 +59,13 @@ | ||
} | ||
function $3a21e1140688247a$var$filled(field, container, fieldType) { | ||
if (field.value.trim().length > 0) container.classList.add(fieldType ? "textarea--filled" : "input--filled"); | ||
else container.classList.remove(fieldType ? "textarea--filled" : "input--filled"); | ||
} | ||
function $3a21e1140688247a$var$textareaResizeable(field, container, fieldType) { | ||
if (fieldType && container.classList.contains("textarea--auto-resizeable")) { | ||
const currentField = field; | ||
currentField.style.height = "auto"; | ||
currentField.style.height = `${currentField.scrollHeight}px`; | ||
} | ||
} | ||
function $3a21e1140688247a$var$listeners(field, container, notch, fieldType) { | ||
@@ -72,10 +83,7 @@ const eventType = fieldType ? "input" : "change"; | ||
field.addEventListener(eventType, ()=>{ | ||
if (field.value.trim().length > 0) container.classList.add(fieldType ? "textarea--filled" : "input--filled"); | ||
else container.classList.remove(fieldType ? "textarea--filled" : "input--filled"); | ||
if (fieldType && container.classList.contains("textarea--auto-resizeable")) { | ||
const currentField = field; | ||
currentField.style.height = "auto"; | ||
currentField.style.height = `${currentField.scrollHeight}px`; | ||
} | ||
$3a21e1140688247a$var$filled(field, container, fieldType); | ||
$3a21e1140688247a$var$textareaResizeable(field, container, fieldType); | ||
}); | ||
$3a21e1140688247a$var$filled(field, container, fieldType); | ||
notchStyle.width = $3a21e1140688247a$var$getNotchWidth(notch); | ||
} | ||
@@ -82,0 +90,0 @@ var $3a21e1140688247a$export$2e2bcd8739ae039 = $3a21e1140688247a$var$listeners; |
@@ -47,2 +47,13 @@ function $85068ae01dc596ad$var$notched() { | ||
} | ||
function $8290bb03cd88138a$var$filled(field, container, fieldType) { | ||
if (field.value.trim().length > 0) container.classList.add(fieldType ? "textarea--filled" : "input--filled"); | ||
else container.classList.remove(fieldType ? "textarea--filled" : "input--filled"); | ||
} | ||
function $8290bb03cd88138a$var$textareaResizeable(field, container, fieldType) { | ||
if (fieldType && container.classList.contains("textarea--auto-resizeable")) { | ||
const currentField = field; | ||
currentField.style.height = "auto"; | ||
currentField.style.height = `${currentField.scrollHeight}px`; | ||
} | ||
} | ||
function $8290bb03cd88138a$var$listeners(field, container, notch, fieldType) { | ||
@@ -60,10 +71,7 @@ const eventType = fieldType ? "input" : "change"; | ||
field.addEventListener(eventType, ()=>{ | ||
if (field.value.trim().length > 0) container.classList.add(fieldType ? "textarea--filled" : "input--filled"); | ||
else container.classList.remove(fieldType ? "textarea--filled" : "input--filled"); | ||
if (fieldType && container.classList.contains("textarea--auto-resizeable")) { | ||
const currentField = field; | ||
currentField.style.height = "auto"; | ||
currentField.style.height = `${currentField.scrollHeight}px`; | ||
} | ||
$8290bb03cd88138a$var$filled(field, container, fieldType); | ||
$8290bb03cd88138a$var$textareaResizeable(field, container, fieldType); | ||
}); | ||
$8290bb03cd88138a$var$filled(field, container, fieldType); | ||
notchStyle.width = $8290bb03cd88138a$var$getNotchWidth(notch); | ||
} | ||
@@ -70,0 +78,0 @@ var $8290bb03cd88138a$export$2e2bcd8739ae039 = $8290bb03cd88138a$var$listeners; |
{ | ||
"name": "text-fields", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Input, textarea, material", | ||
@@ -5,0 +5,0 @@ "author": "ux-ui.pro", |
@@ -6,2 +6,19 @@ function getNotchWidth(notch) { | ||
function filled(field, container, fieldType) { | ||
if (field.value.trim().length > 0) { | ||
container.classList.add(fieldType ? 'textarea--filled' : 'input--filled'); | ||
} else { | ||
container.classList.remove(fieldType ? 'textarea--filled' : 'input--filled'); | ||
} | ||
} | ||
function textareaResizeable(field, container, fieldType) { | ||
if (fieldType && container.classList.contains('textarea--auto-resizeable')) { | ||
const currentField = field; | ||
currentField.style.height = 'auto'; | ||
currentField.style.height = `${currentField.scrollHeight}px`; | ||
} | ||
} | ||
function listeners(field, container, notch, fieldType) { | ||
@@ -25,17 +42,11 @@ const eventType = fieldType ? 'input' : 'change'; | ||
field.addEventListener(eventType, () => { | ||
if (field.value.trim().length > 0) { | ||
container.classList.add(fieldType ? 'textarea--filled' : 'input--filled'); | ||
} else { | ||
container.classList.remove(fieldType ? 'textarea--filled' : 'input--filled'); | ||
} | ||
filled(field, container, fieldType); | ||
textareaResizeable(field, container, fieldType); | ||
}); | ||
if (fieldType && container.classList.contains('textarea--auto-resizeable')) { | ||
const currentField = field; | ||
filled(field, container, fieldType); | ||
currentField.style.height = 'auto'; | ||
currentField.style.height = `${currentField.scrollHeight}px`; | ||
} | ||
}); | ||
notchStyle.width = getNotchWidth(notch); | ||
} | ||
export default listeners; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
76848
347
0