@redseed/redseed-ui-vue3 2.3.0 → 2.3.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/package.json +1 -1
- package/src/components/FormField/FormFieldCheckbox.vue +28 -32
- package/src/components/FormField/FormFieldEmail.vue +4 -28
- package/src/components/FormField/FormFieldHidden.vue +6 -4
- package/src/components/FormField/FormFieldPassword.vue +4 -48
- package/src/components/FormField/FormFieldPasswordToggle.vue +12 -24
- package/src/components/FormField/FormFieldSearch.vue +7 -20
- package/src/components/FormField/FormFieldSelect.vue +30 -34
- package/src/components/FormField/FormFieldSlot.vue +50 -23
- package/src/components/FormField/FormFieldText.vue +43 -24
- package/src/components/FormField/FormFieldTextSuffix.vue +6 -17
package/package.json
CHANGED
|
@@ -1,46 +1,37 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { ref
|
|
2
|
+
import { ref } from 'vue'
|
|
3
3
|
import FormFieldSlot from './FormFieldSlot.vue'
|
|
4
4
|
import { CheckIcon } from '@heroicons/vue/24/outline'
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const props = defineProps({
|
|
9
|
-
checked: {
|
|
10
|
-
type: [Array, Boolean],
|
|
11
|
-
default: false,
|
|
12
|
-
},
|
|
13
|
-
value: {
|
|
14
|
-
type: String,
|
|
15
|
-
default: null,
|
|
16
|
-
},
|
|
6
|
+
defineOptions({
|
|
7
|
+
inheritAttrs: false,
|
|
17
8
|
})
|
|
18
9
|
|
|
19
|
-
const
|
|
10
|
+
const model = defineModel()
|
|
20
11
|
|
|
21
|
-
const
|
|
22
|
-
get() {
|
|
23
|
-
iconChecked.value = props.checked
|
|
24
|
-
return props.checked
|
|
25
|
-
},
|
|
12
|
+
const checked = ref(model.value || false)
|
|
26
13
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
14
|
+
const emit = defineEmits(['input'])
|
|
15
|
+
|
|
16
|
+
function check(event) {
|
|
17
|
+
checked.value = !checked.value
|
|
18
|
+
emit('input', event)
|
|
19
|
+
}
|
|
32
20
|
</script>
|
|
33
21
|
<template>
|
|
34
22
|
<FormFieldSlot class="rsui-form-field-checkbox">
|
|
35
23
|
<template #label>
|
|
36
24
|
<div class="rsui-form-field-checkbox__checkbox">
|
|
37
25
|
<div class="rsui-form-field-checkbox__check">
|
|
38
|
-
<CheckIcon v-if="
|
|
26
|
+
<CheckIcon v-if="checked"></CheckIcon>
|
|
39
27
|
<input
|
|
40
|
-
v-model="
|
|
41
|
-
|
|
28
|
+
v-model="model"
|
|
29
|
+
:id="$attrs.id"
|
|
30
|
+
:name="$attrs.name"
|
|
31
|
+
:disabled="$attrs.disabled"
|
|
32
|
+
:required="$attrs.required"
|
|
33
|
+
@input="check"
|
|
42
34
|
type="checkbox"
|
|
43
|
-
:value="value"
|
|
44
35
|
>
|
|
45
36
|
</div>
|
|
46
37
|
<div v-if="$slots.label"
|
|
@@ -64,13 +55,18 @@ const proxyChecked = computed({
|
|
|
64
55
|
@apply ml-2;
|
|
65
56
|
}
|
|
66
57
|
&__check {
|
|
67
|
-
@apply
|
|
58
|
+
@apply size-6 shrink-0 relative bg-white rounded-md;
|
|
59
|
+
@apply has-[:disabled]:text-rsui-light;
|
|
68
60
|
|
|
69
61
|
input[type="checkbox"] {
|
|
70
|
-
@apply appearance-none absolute inset-0 rounded-md transition
|
|
71
|
-
@apply w-full h-full border border-
|
|
72
|
-
@apply focus:
|
|
73
|
-
@apply invalid:border-
|
|
62
|
+
@apply appearance-none absolute inset-0 z-0 rounded-md transition focus:outline-none;
|
|
63
|
+
@apply w-full h-full text-rsui-default border border-rsui-grey-200 text-transparent bg-none;
|
|
64
|
+
@apply focus:ring focus:ring-rsui-light focus:border-rsui-light;
|
|
65
|
+
@apply invalid:border-danger invalid:ring-0;
|
|
66
|
+
@apply disabled:text-rsui-light disabled:bg-rsui-grey-200;
|
|
67
|
+
}
|
|
68
|
+
svg {
|
|
69
|
+
@apply size-full relative z-1;
|
|
74
70
|
}
|
|
75
71
|
}
|
|
76
72
|
}
|
|
@@ -1,44 +1,20 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import
|
|
3
|
-
import FormFieldSlot from './FormFieldSlot.vue'
|
|
4
|
-
|
|
5
|
-
// Apply all attributes to the input element, not the wrapper div
|
|
6
|
-
defineOptions({
|
|
7
|
-
inheritAttrs: false,
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
const props = defineProps({
|
|
11
|
-
modelValue: [
|
|
12
|
-
String,
|
|
13
|
-
Number
|
|
14
|
-
], //vue3 specific v-model pattern
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
defineEmits(['update:modelValue']) //vue3 specific v-model pattern
|
|
18
|
-
|
|
19
|
-
const input = ref(null)
|
|
2
|
+
import FormFieldText from './FormFieldText.vue'
|
|
20
3
|
</script>
|
|
21
4
|
<template>
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
:id="$attrs.id"
|
|
5
|
+
<FormFieldText class="rsui-form-field-email"
|
|
6
|
+
type="email"
|
|
25
7
|
>
|
|
26
8
|
<template #label v-if="$slots.label">
|
|
27
9
|
<slot name="label"></slot>
|
|
28
10
|
</template>
|
|
29
|
-
<input ref="input"
|
|
30
|
-
v-bind="$attrs"
|
|
31
|
-
type="email"
|
|
32
|
-
:value="modelValue"
|
|
33
|
-
@input="$emit('update:modelValue', $event.target.value)"
|
|
34
|
-
>
|
|
35
11
|
<template #help v-if="$slots.help">
|
|
36
12
|
<slot name="help"></slot>
|
|
37
13
|
</template>
|
|
38
14
|
<template #error v-if="$slots.error">
|
|
39
15
|
<slot name="error"></slot>
|
|
40
16
|
</template>
|
|
41
|
-
</
|
|
17
|
+
</FormFieldText>
|
|
42
18
|
</template>
|
|
43
19
|
<style lang="scss" scoped>
|
|
44
20
|
</style>
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { ref } from 'vue'
|
|
3
2
|
import FormFieldSlot from './FormFieldSlot.vue'
|
|
4
3
|
|
|
5
|
-
// Apply all attributes to the input element, not the wrapper div
|
|
6
4
|
defineOptions({
|
|
7
5
|
inheritAttrs: false,
|
|
8
6
|
})
|
|
9
7
|
|
|
10
|
-
const
|
|
8
|
+
const model = defineModel()
|
|
11
9
|
</script>
|
|
12
10
|
<template>
|
|
13
11
|
<FormFieldSlot
|
|
14
12
|
class="rsui-form-field-hidden"
|
|
15
13
|
>
|
|
16
|
-
<input
|
|
14
|
+
<input
|
|
15
|
+
v-model="model"
|
|
16
|
+
:id="$attrs.id"
|
|
17
|
+
:name="$attrs.name"
|
|
18
|
+
:required="$attrs.required"
|
|
17
19
|
type="hidden"
|
|
18
20
|
>
|
|
19
21
|
<template #error v-if="$slots.error">
|
|
@@ -1,46 +1,14 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import
|
|
3
|
-
import FormFieldSlot from './FormFieldSlot.vue'
|
|
4
|
-
|
|
5
|
-
// Apply all attributes to the input element, not the wrapper div
|
|
6
|
-
defineOptions({
|
|
7
|
-
inheritAttrs: false,
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
const props = defineProps({
|
|
11
|
-
modelValue: [
|
|
12
|
-
String,
|
|
13
|
-
Number
|
|
14
|
-
], //vue3 specific v-model pattern
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
defineEmits(['update:modelValue']) //vue3 specific v-model pattern
|
|
18
|
-
|
|
19
|
-
const input = ref(null)
|
|
2
|
+
import FormFieldText from './FormFieldText.vue'
|
|
20
3
|
</script>
|
|
21
4
|
<template>
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
:id="$attrs.id"
|
|
5
|
+
<FormFieldText class="rsui-form-field-password"
|
|
6
|
+
type="password"
|
|
25
7
|
>
|
|
26
8
|
<template #label v-if="$slots.label">
|
|
27
9
|
<slot name="label"></slot>
|
|
28
10
|
</template>
|
|
29
11
|
|
|
30
|
-
<div :class="{
|
|
31
|
-
'rsui-form-field-password__group': true,
|
|
32
|
-
'rsui-form-field-password__group--toggle': $slots.toggle,
|
|
33
|
-
}">
|
|
34
|
-
<input ref="input"
|
|
35
|
-
type="password"
|
|
36
|
-
v-bind="$attrs"
|
|
37
|
-
:value="modelValue"
|
|
38
|
-
@input="$emit('update:modelValue', $event.target.value)"
|
|
39
|
-
>
|
|
40
|
-
|
|
41
|
-
<slot name="toggle"></slot>
|
|
42
|
-
</div>
|
|
43
|
-
|
|
44
12
|
<template #help v-if="$slots.help">
|
|
45
13
|
<slot name="help"></slot>
|
|
46
14
|
</template>
|
|
@@ -48,19 +16,7 @@ const input = ref(null)
|
|
|
48
16
|
<template #error v-if="$slots.error">
|
|
49
17
|
<slot name="error"></slot>
|
|
50
18
|
</template>
|
|
51
|
-
</
|
|
19
|
+
</FormFieldText>
|
|
52
20
|
</template>
|
|
53
21
|
<style lang="scss" scoped>
|
|
54
|
-
.rsui-form-field-password {
|
|
55
|
-
@apply relative;
|
|
56
|
-
|
|
57
|
-
&__group {
|
|
58
|
-
@apply relative;
|
|
59
|
-
&--toggle {
|
|
60
|
-
input {
|
|
61
|
-
@apply pr-12;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
22
|
</style>
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { ref } from 'vue'
|
|
3
|
-
import
|
|
3
|
+
import FormFieldText from './FormFieldText.vue'
|
|
4
4
|
import { EyeIcon, EyeSlashIcon } from '@heroicons/vue/24/outline'
|
|
5
5
|
|
|
6
|
-
// Apply all attributes to the input element, not the wrapper div
|
|
7
|
-
defineOptions({
|
|
8
|
-
inheritAttrs: false,
|
|
9
|
-
})
|
|
10
|
-
|
|
11
6
|
const show = ref(false)
|
|
12
7
|
|
|
13
8
|
function togglePassword() {
|
|
@@ -15,24 +10,19 @@ function togglePassword() {
|
|
|
15
10
|
}
|
|
16
11
|
</script>
|
|
17
12
|
<template>
|
|
18
|
-
<
|
|
19
|
-
v-bind="$attrs"
|
|
13
|
+
<FormFieldText class="rsui-form-field-password"
|
|
20
14
|
:type="show ? 'text' : 'password'"
|
|
21
15
|
>
|
|
22
16
|
<template #label v-if="$slots.label">
|
|
23
17
|
<slot name="label"></slot>
|
|
24
18
|
</template>
|
|
25
19
|
|
|
26
|
-
<template #
|
|
27
|
-
<div class="rsui-form-field-
|
|
28
|
-
@click="togglePassword"
|
|
20
|
+
<template #suffix>
|
|
21
|
+
<div class="rsui-form-field-password__icon"
|
|
22
|
+
@click.prevent="togglePassword"
|
|
29
23
|
>
|
|
30
|
-
<EyeIcon v-if="!show"
|
|
31
|
-
|
|
32
|
-
></EyeIcon>
|
|
33
|
-
<EyeSlashIcon v-if="show"
|
|
34
|
-
class="rsui-form-field-password__toggle-icon"
|
|
35
|
-
></EyeSlashIcon>
|
|
24
|
+
<EyeIcon v-if="!show"></EyeIcon>
|
|
25
|
+
<EyeSlashIcon v-if="show"></EyeSlashIcon>
|
|
36
26
|
</div>
|
|
37
27
|
</template>
|
|
38
28
|
|
|
@@ -43,17 +33,15 @@ function togglePassword() {
|
|
|
43
33
|
<template #error v-if="$slots.error">
|
|
44
34
|
<slot name="error"></slot>
|
|
45
35
|
</template>
|
|
46
|
-
</
|
|
36
|
+
</FormFieldText>
|
|
47
37
|
</template>
|
|
48
38
|
<style lang="scss" scoped>
|
|
49
39
|
.rsui-form-field-password {
|
|
50
|
-
&
|
|
51
|
-
@apply
|
|
52
|
-
@apply flex items-center justify-center px-3 select-none cursor-pointer;
|
|
40
|
+
&__icon {
|
|
41
|
+
@apply size-5 text-rsui-default;
|
|
53
42
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
@apply w-5 h-5;
|
|
43
|
+
:deep(.rsui-form-field-text__suffix) {
|
|
44
|
+
@apply pl-0;
|
|
57
45
|
}
|
|
58
46
|
}
|
|
59
47
|
</style>
|
|
@@ -1,26 +1,15 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { ref } from 'vue'
|
|
3
2
|
import FormFieldText from './FormFieldText.vue'
|
|
4
3
|
import { MagnifyingGlassIcon } from '@heroicons/vue/24/outline'
|
|
5
|
-
|
|
6
|
-
// Apply all attributes to the input element, not the wrapper div
|
|
7
|
-
defineOptions({
|
|
8
|
-
inheritAttrs: false,
|
|
9
|
-
})
|
|
10
4
|
</script>
|
|
11
5
|
<template>
|
|
12
|
-
<FormFieldText
|
|
13
|
-
v-bind="$attrs"
|
|
14
|
-
class="rsui-form-field-search"
|
|
15
|
-
>
|
|
6
|
+
<FormFieldText class="rsui-form-field-search">
|
|
16
7
|
<template #label v-if="$slots.label">
|
|
17
8
|
<slot name="label"></slot>
|
|
18
9
|
</template>
|
|
19
10
|
|
|
20
|
-
<template #prefix
|
|
21
|
-
<
|
|
22
|
-
<MagnifyingGlassIcon class="rsui-form-field-search__icon"></MagnifyingGlassIcon>
|
|
23
|
-
</div>
|
|
11
|
+
<template #prefix>
|
|
12
|
+
<MagnifyingGlassIcon class="rsui-form-field-search__icon"></MagnifyingGlassIcon>
|
|
24
13
|
</template>
|
|
25
14
|
|
|
26
15
|
<template #help v-if="$slots.help">
|
|
@@ -34,13 +23,11 @@ defineOptions({
|
|
|
34
23
|
</template>
|
|
35
24
|
<style lang="scss" scoped>
|
|
36
25
|
.rsui-form-field-search {
|
|
37
|
-
&__prefix {
|
|
38
|
-
@apply absolute top-px bottom-px left-px rounded-tl rounded-bl;
|
|
39
|
-
@apply flex items-center justify-center select-none;
|
|
40
|
-
@apply w-10 pointer-events-none;
|
|
41
|
-
}
|
|
42
26
|
&__icon {
|
|
43
|
-
@apply size-5 text-rsui-
|
|
27
|
+
@apply size-5 text-rsui-light;
|
|
28
|
+
}
|
|
29
|
+
:deep(.rsui-form-field-text__prefix) {
|
|
30
|
+
@apply pr-0;
|
|
44
31
|
}
|
|
45
32
|
}
|
|
46
33
|
</style>
|
|
@@ -4,31 +4,28 @@ import { onClickOutside } from '@vueuse/core'
|
|
|
4
4
|
import FormFieldSlot from './FormFieldSlot.vue'
|
|
5
5
|
import { ChevronDownIcon, CheckIcon } from '@heroicons/vue/24/outline'
|
|
6
6
|
|
|
7
|
-
// Apply all attributes to the input element, not the wrapper div
|
|
8
7
|
defineOptions({
|
|
9
8
|
inheritAttrs: false,
|
|
10
9
|
})
|
|
11
10
|
|
|
11
|
+
const model = defineModel({ default: '' })
|
|
12
|
+
|
|
12
13
|
const props = defineProps({
|
|
13
|
-
modelValue: [
|
|
14
|
-
String,
|
|
15
|
-
Number
|
|
16
|
-
], //vue3 specific v-model pattern
|
|
17
14
|
options: {
|
|
18
15
|
type: Array,
|
|
19
16
|
default: () => []
|
|
20
17
|
},
|
|
21
18
|
})
|
|
22
19
|
|
|
23
|
-
const emit = defineEmits(['
|
|
20
|
+
const emit = defineEmits(['change'])
|
|
24
21
|
|
|
25
|
-
const
|
|
22
|
+
const formFieldSelectElement = ref(null)
|
|
26
23
|
|
|
27
|
-
onClickOutside(
|
|
24
|
+
onClickOutside(formFieldSelectElement, () => close())
|
|
28
25
|
|
|
29
26
|
const isOpen = ref(false)
|
|
30
27
|
|
|
31
|
-
function
|
|
28
|
+
function toggleOptions() {
|
|
32
29
|
isOpen.value = !isOpen.value
|
|
33
30
|
}
|
|
34
31
|
|
|
@@ -36,39 +33,31 @@ function close() {
|
|
|
36
33
|
isOpen.value = false
|
|
37
34
|
}
|
|
38
35
|
|
|
39
|
-
|
|
40
|
-
function onClick() {
|
|
41
|
-
toggle()
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function onChange(event) {
|
|
45
|
-
emit('change', event)
|
|
46
|
-
emit('update:modelValue', event.target.value)
|
|
47
|
-
close()
|
|
48
|
-
}
|
|
49
|
-
|
|
50
36
|
function choose(option) {
|
|
37
|
+
model.value = option.value
|
|
51
38
|
emit('change', option.value)
|
|
52
|
-
emit('update:modelValue', option.value)
|
|
53
39
|
close()
|
|
54
40
|
}
|
|
55
41
|
</script>
|
|
56
42
|
<template>
|
|
57
43
|
<FormFieldSlot
|
|
58
|
-
ref="
|
|
44
|
+
ref="formFieldSelectElement"
|
|
59
45
|
class="rsui-form-field-select"
|
|
60
46
|
:id="$attrs.id"
|
|
47
|
+
:compact="$attrs.compact"
|
|
61
48
|
>
|
|
62
49
|
<template #label v-if="$slots.label">
|
|
63
50
|
<slot name="label"></slot>
|
|
64
51
|
</template>
|
|
65
|
-
<div
|
|
66
|
-
'rsui-form-field-select__group': true,
|
|
67
|
-
}">
|
|
52
|
+
<div class="rsui-form-field-select__group">
|
|
68
53
|
<select
|
|
69
|
-
v-
|
|
70
|
-
|
|
71
|
-
|
|
54
|
+
v-model="model"
|
|
55
|
+
:id="$attrs.id"
|
|
56
|
+
:name="$attrs.name"
|
|
57
|
+
:disabled="$attrs.disabled"
|
|
58
|
+
:required="$attrs.required"
|
|
59
|
+
@click.prevent="toggleOptions"
|
|
60
|
+
@change.prevent
|
|
72
61
|
>
|
|
73
62
|
<option value="">
|
|
74
63
|
<slot name="default-option">
|
|
@@ -102,9 +91,11 @@ function choose(option) {
|
|
|
102
91
|
<div class="rsui-form-field-select__option rsui-form-field-select__option--disabled"
|
|
103
92
|
value=""
|
|
104
93
|
>
|
|
105
|
-
<
|
|
106
|
-
|
|
107
|
-
|
|
94
|
+
<div class="rsui-form-field-select__option-label">
|
|
95
|
+
<slot name="default-option">
|
|
96
|
+
Select an option
|
|
97
|
+
</slot>
|
|
98
|
+
</div>
|
|
108
99
|
</div>
|
|
109
100
|
<div v-for="option in options"
|
|
110
101
|
:key="option.value"
|
|
@@ -164,10 +155,15 @@ function choose(option) {
|
|
|
164
155
|
|
|
165
156
|
&__group {
|
|
166
157
|
@apply relative;
|
|
167
|
-
}
|
|
168
158
|
|
|
169
|
-
|
|
170
|
-
|
|
159
|
+
select {
|
|
160
|
+
@apply pl-5 pr-14 truncate;
|
|
161
|
+
@apply appearance-none rounded-full cursor-pointer;
|
|
162
|
+
@apply focus:ring focus:ring-rsui-light focus:border-rsui-light;
|
|
163
|
+
option {
|
|
164
|
+
@apply hidden;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
171
167
|
}
|
|
172
168
|
|
|
173
169
|
&__options {
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, useAttrs } from 'vue'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
compact: {
|
|
6
|
+
type: Boolean,
|
|
7
|
+
required: false,
|
|
8
|
+
},
|
|
9
|
+
})
|
|
10
|
+
|
|
5
11
|
defineOptions({
|
|
6
12
|
inheritAttrs: false,
|
|
7
13
|
})
|
|
@@ -9,8 +15,11 @@ defineOptions({
|
|
|
9
15
|
const attrs = useAttrs()
|
|
10
16
|
|
|
11
17
|
const formFieldSlotClass = computed(() => [
|
|
18
|
+
attrs.class,
|
|
12
19
|
'rsui-form-field-slot',
|
|
13
|
-
|
|
20
|
+
{
|
|
21
|
+
'rsui-form-field-slot--compact': props.compact,
|
|
22
|
+
},
|
|
14
23
|
])
|
|
15
24
|
</script>
|
|
16
25
|
<template>
|
|
@@ -24,29 +33,43 @@ const formFieldSlotClass = computed(() => [
|
|
|
24
33
|
<slot name="label"></slot>
|
|
25
34
|
</label>
|
|
26
35
|
</div>
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
<div class="rsui-form-field-slot__field">
|
|
37
|
+
<slot></slot>
|
|
38
|
+
<div v-if="$slots.help"
|
|
39
|
+
class="rsui-form-field-slot__help"
|
|
40
|
+
>
|
|
41
|
+
<slot name="help"></slot>
|
|
42
|
+
</div>
|
|
43
|
+
<div v-if="$slots.error"
|
|
44
|
+
class="rsui-form-field-slot__error"
|
|
45
|
+
>
|
|
46
|
+
<slot name="error"></slot>
|
|
47
|
+
</div>
|
|
37
48
|
</div>
|
|
38
49
|
</div>
|
|
39
50
|
</template>
|
|
40
51
|
<style lang="scss" scoped>
|
|
41
52
|
.rsui-form-field-slot {
|
|
42
|
-
@apply flex flex-col
|
|
53
|
+
@apply flex flex-col gap-y-1 border-0 bg-transparent p-0;
|
|
54
|
+
&--compact {
|
|
55
|
+
@apply flex-row justify-between gap-x-2;
|
|
56
|
+
.rsui-form-field-slot {
|
|
57
|
+
&__label {
|
|
58
|
+
@apply pt-3 truncate;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
43
62
|
|
|
44
63
|
&__label {
|
|
45
64
|
label {
|
|
46
|
-
@apply
|
|
65
|
+
@apply font-medium text-base text-gray-700;
|
|
47
66
|
}
|
|
48
67
|
}
|
|
49
68
|
|
|
69
|
+
&__field {
|
|
70
|
+
@apply shrink-0 flex flex-col gap-y-1;
|
|
71
|
+
}
|
|
72
|
+
|
|
50
73
|
&__help {
|
|
51
74
|
@apply text-xs text-gray-500;
|
|
52
75
|
}
|
|
@@ -58,17 +81,21 @@ const formFieldSlotClass = computed(() => [
|
|
|
58
81
|
</style>
|
|
59
82
|
<style lang="scss">
|
|
60
83
|
.rsui-form-field-slot {
|
|
61
|
-
input
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
@apply
|
|
84
|
+
input[type='text'],
|
|
85
|
+
input[type='email'],
|
|
86
|
+
input[type='password']
|
|
87
|
+
{
|
|
88
|
+
@apply flex-1;
|
|
89
|
+
@apply text-base text-rsui-default transition py-3 px-4 outline-none focus:outline-none;
|
|
90
|
+
@apply bg-white placeholder-rsui-light;
|
|
91
|
+
@apply disabled:text-rsui-light disabled:bg-rsui-grey-200 disabled:ring-0;
|
|
66
92
|
}
|
|
67
93
|
select {
|
|
68
|
-
@apply
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
94
|
+
@apply block w-full border ring-0 bg-none;
|
|
95
|
+
@apply text-base text-rsui-default transition py-3 px-4 rounded-md outline-none focus:outline-none;
|
|
96
|
+
@apply bg-white placeholder-rsui-light border-rsui-grey-200;
|
|
97
|
+
@apply invalid:border-danger invalid:ring-0;
|
|
98
|
+
@apply disabled:text-rsui-light disabled:bg-rsui-grey-200 disabled:ring-0;
|
|
72
99
|
}
|
|
73
100
|
}
|
|
74
101
|
</style>
|
|
@@ -2,45 +2,50 @@
|
|
|
2
2
|
import { ref } from 'vue'
|
|
3
3
|
import FormFieldSlot from './FormFieldSlot.vue'
|
|
4
4
|
|
|
5
|
-
// Apply all attributes to the input element, not the wrapper div
|
|
6
5
|
defineOptions({
|
|
7
6
|
inheritAttrs: false,
|
|
8
7
|
})
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
modelValue: [
|
|
12
|
-
String,
|
|
13
|
-
Number
|
|
14
|
-
], //vue3 specific v-model pattern
|
|
15
|
-
})
|
|
9
|
+
defineEmits(['input'])
|
|
16
10
|
|
|
17
|
-
|
|
11
|
+
const model = defineModel()
|
|
18
12
|
|
|
19
|
-
const
|
|
13
|
+
const inputElement = ref(null)
|
|
20
14
|
</script>
|
|
21
15
|
<template>
|
|
22
16
|
<FormFieldSlot
|
|
23
|
-
class="rsui-form-field-text"
|
|
24
17
|
:id="$attrs.id"
|
|
18
|
+
:class="$attrs.class || 'rsui-form-field-text'"
|
|
19
|
+
:compact="$attrs.compact"
|
|
25
20
|
>
|
|
26
21
|
<template #label v-if="$slots.label">
|
|
27
22
|
<slot name="label"></slot>
|
|
28
23
|
</template>
|
|
29
|
-
<div
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
:
|
|
40
|
-
|
|
24
|
+
<div class="rsui-form-field-text__group">
|
|
25
|
+
<div v-if="$slots.prefix"
|
|
26
|
+
class="rsui-form-field-text__prefix"
|
|
27
|
+
@click.prevent="$refs.inputElement.focus()"
|
|
28
|
+
>
|
|
29
|
+
<slot name="prefix"></slot>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
<input ref="inputElement"
|
|
33
|
+
v-model="model"
|
|
34
|
+
:id="$attrs.id"
|
|
35
|
+
:name="$attrs.name"
|
|
36
|
+
:type="$attrs.type || 'text'"
|
|
37
|
+
:placeholder="$attrs.placeholder"
|
|
38
|
+
:disabled="$attrs.disabled"
|
|
39
|
+
:required="$attrs.required"
|
|
40
|
+
@input="$emit('input', $event)"
|
|
41
41
|
>
|
|
42
42
|
|
|
43
|
-
<
|
|
43
|
+
<div v-if="$slots.suffix"
|
|
44
|
+
class="rsui-form-field-text__suffix"
|
|
45
|
+
@click.prevent="$refs.inputElement.focus()"
|
|
46
|
+
>
|
|
47
|
+
<slot name="suffix"></slot>
|
|
48
|
+
</div>
|
|
44
49
|
</div>
|
|
45
50
|
|
|
46
51
|
<template #help v-if="$slots.help">
|
|
@@ -57,7 +62,21 @@ const input = ref(null)
|
|
|
57
62
|
@apply relative;
|
|
58
63
|
|
|
59
64
|
&__group {
|
|
60
|
-
@apply relative;
|
|
65
|
+
@apply relative flex flex-nowrap overflow-hidden;
|
|
66
|
+
@apply text-base transition;
|
|
67
|
+
@apply w-full border rounded-md ring-0;
|
|
68
|
+
@apply bg-white placeholder-rsui-light border-rsui-grey-200;
|
|
69
|
+
@apply has-[:focus]:ring has-[:focus]:ring-rsui-light has-[:focus]:border-rsui-light;
|
|
70
|
+
@apply has-[:invalid]:border-danger has-[:invalid]:ring-0;
|
|
71
|
+
@apply has-[:disabled]:text-rsui-light has-[:disabled]:bg-rsui-grey-200 has-[:disbaled]:ring-0;
|
|
72
|
+
}
|
|
73
|
+
&__prefix {
|
|
74
|
+
@apply flex items-center justify-center px-4 select-none;
|
|
75
|
+
@apply bg-transparent;
|
|
76
|
+
}
|
|
77
|
+
&__suffix {
|
|
78
|
+
@apply flex items-center justify-center px-4 select-none;
|
|
79
|
+
@apply bg-transparent;
|
|
61
80
|
}
|
|
62
81
|
}
|
|
63
82
|
</style>
|
|
@@ -1,24 +1,14 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { ref } from 'vue'
|
|
3
2
|
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
3
|
</script>
|
|
10
4
|
<template>
|
|
11
|
-
<FormFieldText
|
|
12
|
-
v-bind="$attrs"
|
|
13
|
-
>
|
|
5
|
+
<FormFieldText class="rsui-form-field-suffix">
|
|
14
6
|
<template #label v-if="$slots.label">
|
|
15
7
|
<slot name="label"></slot>
|
|
16
8
|
</template>
|
|
17
9
|
|
|
18
10
|
<template #suffix>
|
|
19
|
-
<
|
|
20
|
-
<slot name="suffix"></slot>
|
|
21
|
-
</div>
|
|
11
|
+
<slot name="suffix"></slot>
|
|
22
12
|
</template>
|
|
23
13
|
|
|
24
14
|
<template #help v-if="$slots.help">
|
|
@@ -31,11 +21,10 @@ defineOptions({
|
|
|
31
21
|
</FormFieldText>
|
|
32
22
|
</template>
|
|
33
23
|
<style lang="scss" scoped>
|
|
34
|
-
.rsui-form-field-
|
|
35
|
-
|
|
36
|
-
@apply
|
|
37
|
-
@apply
|
|
38
|
-
@apply bg-gray-100 border-l border-gray-300;
|
|
24
|
+
.rsui-form-field-suffix {
|
|
25
|
+
:deep(.rsui-form-field-text__suffix) {
|
|
26
|
+
@apply border-l rounded-r-md;
|
|
27
|
+
@apply bg-rsui-grey-200 border-rsui-light;
|
|
39
28
|
}
|
|
40
29
|
}
|
|
41
30
|
</style>
|