@una-ui/nuxt 0.50.3 → 0.50.4
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/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -77,28 +77,28 @@ const reverseClassVariants = computed(() => {
|
|
|
77
77
|
})
|
|
78
78
|
|
|
79
79
|
// html refs
|
|
80
|
-
const
|
|
80
|
+
const inputRef = ref<HTMLTextAreaElement>()
|
|
81
81
|
|
|
82
82
|
function resizeTextarea(): void {
|
|
83
|
-
if (!(props.type === 'textarea' && props.autoresize) || !
|
|
83
|
+
if (!(props.type === 'textarea' && props.autoresize) || !inputRef.value)
|
|
84
84
|
return
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
inputRef.value.rows = props.rows
|
|
87
87
|
|
|
88
|
-
const styles = window.getComputedStyle(
|
|
88
|
+
const styles = window.getComputedStyle(inputRef.value)
|
|
89
89
|
const paddingTop = Number.parseInt(styles.paddingTop)
|
|
90
90
|
const paddingBottom = Number.parseInt(styles.paddingBottom)
|
|
91
91
|
const padding = paddingTop + paddingBottom
|
|
92
92
|
const lineHeight = Number.parseInt(styles.lineHeight)
|
|
93
|
-
const { scrollHeight } =
|
|
93
|
+
const { scrollHeight } = inputRef.value
|
|
94
94
|
const newRows = (scrollHeight - padding) / lineHeight
|
|
95
95
|
|
|
96
96
|
if (newRows > props.rows)
|
|
97
|
-
|
|
97
|
+
inputRef.value.rows = newRows
|
|
98
98
|
|
|
99
99
|
const maxAutoresizeRows = typeof props.autoresize === 'number' ? props.autoresize : Number.POSITIVE_INFINITY
|
|
100
|
-
if (
|
|
101
|
-
|
|
100
|
+
if (inputRef.value.rows > maxAutoresizeRows)
|
|
101
|
+
inputRef.value.rows = maxAutoresizeRows
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
function onInput(event: Event): void {
|
|
@@ -110,6 +110,13 @@ function onInput(event: Event): void {
|
|
|
110
110
|
onMounted(() => {
|
|
111
111
|
resizeTextarea()
|
|
112
112
|
})
|
|
113
|
+
|
|
114
|
+
defineExpose({
|
|
115
|
+
focus: () => inputRef.value?.focus(),
|
|
116
|
+
blur: () => inputRef.value?.blur(),
|
|
117
|
+
select: () => inputRef.value?.select(),
|
|
118
|
+
inputRef,
|
|
119
|
+
})
|
|
113
120
|
</script>
|
|
114
121
|
|
|
115
122
|
<template>
|
|
@@ -144,7 +151,7 @@ onMounted(() => {
|
|
|
144
151
|
<component
|
|
145
152
|
:is="props.type !== 'textarea' ? 'input' : 'textarea'"
|
|
146
153
|
:id
|
|
147
|
-
ref="
|
|
154
|
+
ref="inputRef"
|
|
148
155
|
:value="modelValue"
|
|
149
156
|
:type="props.type !== 'textarea' ? props.type : undefined"
|
|
150
157
|
:class="cn(
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@una-ui/nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.50.
|
|
4
|
+
"version": "0.50.4",
|
|
5
5
|
"description": "Nuxt module for @una-ui",
|
|
6
6
|
"author": "Phojie Rengel <phojrengel@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"typescript": "5.6.3",
|
|
60
60
|
"unocss": "^66.0.0",
|
|
61
61
|
"unocss-preset-animations": "^1.1.1",
|
|
62
|
-
"@una-ui/extractor-vue-script": "^0.50.
|
|
63
|
-
"@una-ui/preset": "^0.50.
|
|
62
|
+
"@una-ui/extractor-vue-script": "^0.50.4",
|
|
63
|
+
"@una-ui/preset": "^0.50.4"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@iconify-json/lucide": "^1.2.34",
|