@redseed/redseed-ui-vue3 2.10.6 → 2.11.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redseed/redseed-ui-vue3",
3
- "version": "2.10.6",
3
+ "version": "2.11.0",
4
4
  "description": "RedSeed UI Vue 3 components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,74 @@
1
+ <script setup>
2
+ import { ref } from 'vue'
3
+ import FormFieldSlot from './FormFieldSlot.vue'
4
+ import { useTextareaAutosize } from '@vueuse/core'
5
+
6
+ defineOptions({
7
+ inheritAttrs: false,
8
+ })
9
+
10
+ const emit = defineEmits(['input', 'select'])
11
+
12
+ const { textarea, input } = useTextareaAutosize({ styleProp: 'minHeight' })
13
+
14
+ const model = defineModel()
15
+
16
+ function onInput(event) {
17
+ model.value = input.value
18
+ emit('input', event)
19
+ }
20
+
21
+ function onSelect(event) {
22
+ emit('select', event)
23
+ }
24
+ </script>
25
+ <template>
26
+ <FormFieldSlot
27
+ :id="$attrs.id"
28
+ :class="[$attrs.class, 'rsui-form-field-textarea']"
29
+ :required="$attrs.required"
30
+ :compact="$attrs.compact"
31
+ >
32
+ <template #label v-if="$slots.label">
33
+ <slot name="label"></slot>
34
+ </template>
35
+ <textarea ref="textarea"
36
+ v-model="input"
37
+ :id="$attrs.id"
38
+ :name="$attrs.name"
39
+ :placeholder="$attrs.placeholder"
40
+ :disabled="$attrs.disabled"
41
+ :required="$attrs.required"
42
+ :rows="$attrs.rows"
43
+ @input="onInput"
44
+ @select="onSelect"
45
+ ></textarea>
46
+
47
+ <template #help v-if="$slots.help">
48
+ <slot name="help"></slot>
49
+ </template>
50
+
51
+ <template #error v-if="$slots.error">
52
+ <slot name="error"></slot>
53
+ </template>
54
+ </FormFieldSlot>
55
+ </template>
56
+ <style lang="scss" scoped>
57
+ .rsui-form-field-textarea {
58
+ @apply relative;
59
+
60
+ textarea {
61
+ @apply w-full border rounded-md ring-0 text-base transition resize-none;
62
+ @apply py-3 px-4 outline-none focus:outline-none;
63
+ @apply text-rsui-default bg-white placeholder-rsui-light border-rsui-grey-200;
64
+ @apply focus:ring focus:ring-highlight focus:border-highlight;
65
+ @apply invalid:border-danger invalid:ring-0;
66
+ @apply disabled:text-rsui-light disabled:bg-rsui-grey-200 disabled:ring-0;
67
+ -ms-overflow-style: none;
68
+ scrollbar-width: none;
69
+ &::-webkit-scrollbar {
70
+ display: none;
71
+ }
72
+ }
73
+ }
74
+ </style>
@@ -8,6 +8,7 @@ import FormFieldSearch from './FormFieldSearch.vue'
8
8
  import FormFieldSelect from './FormFieldSelect.vue'
9
9
  import FormFieldSlot from './FormFieldSlot.vue'
10
10
  import FormFieldText from './FormFieldText.vue'
11
+ import FormFieldTextarea from './FormFieldTextarea.vue'
11
12
  import FormFieldTextSuffix from './FormFieldTextSuffix.vue'
12
13
 
13
14
  export {
@@ -21,5 +22,6 @@ export {
21
22
  FormFieldSelect,
22
23
  FormFieldSlot,
23
24
  FormFieldText,
25
+ FormFieldTextarea,
24
26
  FormFieldTextSuffix,
25
27
  }