@redseed/redseed-ui-vue3 1.0.14 → 1.0.15

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/index.js CHANGED
@@ -15,6 +15,7 @@ import FormFieldPassword from './src/components/FormField/FormFieldPassword.vue'
15
15
  import FormFieldPasswordToggle from './src/components/FormField/FormFieldPasswordToggle.vue'
16
16
  import FormFieldSlot from './src/components/FormField/FormFieldSlot.vue'
17
17
  import FormFieldText from './src/components/FormField/FormFieldText.vue'
18
+ import FormFieldTextSuffix from './src/components/FormField/FormFieldTextSuffix.vue'
18
19
  import FormRegister from './src/components/Form/FormRegister.vue'
19
20
  import Image from './src/components/Image/Image.vue'
20
21
  import LogoRedSeedLMS from './src/components/Logo/LogoRedSeedLMS.vue'
@@ -40,6 +41,7 @@ export {
40
41
  FormFieldPasswordToggle,
41
42
  FormFieldSlot,
42
43
  FormFieldText,
44
+ FormFieldTextSuffix,
43
45
  FormRegister,
44
46
  Image,
45
47
  LogoRedSeedLMS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redseed/redseed-ui-vue3",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "RedSeed UI Vue 3 components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -26,19 +26,36 @@ const input = ref(null)
26
26
  <template #label v-if="$slots.label">
27
27
  <slot name="label"></slot>
28
28
  </template>
29
- <input ref="input"
30
- v-bind="$attrs"
31
- type="text"
32
- :value="modelValue"
33
- @input="$emit('update:modelValue', $event.target.value)"
34
- >
29
+
30
+ <div :class="{
31
+ 'form-field-text__group': true,
32
+ 'form-field-text__group--suffix': $slots.suffix,
33
+ }">
34
+ <input ref="input"
35
+ v-bind="$attrs"
36
+ type="text"
37
+ :value="modelValue"
38
+ @input="$emit('update:modelValue', $event.target.value)"
39
+ >
40
+
41
+ <slot name="suffix"></slot>
42
+ </div>
43
+
35
44
  <template #help v-if="$slots.help">
36
45
  <slot name="help"></slot>
37
46
  </template>
47
+
38
48
  <template #error v-if="$slots.error">
39
49
  <slot name="error"></slot>
40
50
  </template>
41
51
  </FormFieldSlot>
42
52
  </template>
43
53
  <style lang="scss" scoped>
54
+ .form-field-text {
55
+ @apply relative;
56
+
57
+ &__group {
58
+ @apply relative;
59
+ }
60
+ }
44
61
  </style>
@@ -0,0 +1,41 @@
1
+ <script setup>
2
+ import { ref } from 'vue'
3
+ import FormFieldText from './FormFieldText.vue'
4
+
5
+ // Apply all attributes to the input element, not the wrapper div
6
+ defineOptions({
7
+ inheritAttrs: false,
8
+ })
9
+ </script>
10
+ <template>
11
+ <FormFieldText
12
+ v-bind="$attrs"
13
+ >
14
+ <template #label v-if="$slots.label">
15
+ <slot name="label"></slot>
16
+ </template>
17
+
18
+ <template #suffix>
19
+ <div class="form-field-text__suffix">
20
+ <slot name="suffix"></slot>
21
+ </div>
22
+ </template>
23
+
24
+ <template #help v-if="$slots.help">
25
+ <slot name="help"></slot>
26
+ </template>
27
+
28
+ <template #error v-if="$slots.error">
29
+ <slot name="error"></slot>
30
+ </template>
31
+ </FormFieldText>
32
+ </template>
33
+ <style lang="scss" scoped>
34
+ .form-field-text {
35
+ &__suffix {
36
+ @apply absolute top-px bottom-px right-px rounded-tr rounded-br;
37
+ @apply flex items-center justify-center px-3 select-none;
38
+ @apply bg-gray-100 border-l border-gray-300;
39
+ }
40
+ }
41
+ </style>