@redseed/redseed-ui-vue3 2.11.18 → 2.12.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redseed/redseed-ui-vue3",
3
- "version": "2.11.18",
3
+ "version": "2.12.1",
4
4
  "description": "RedSeed UI Vue 3 components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,80 @@
1
+ <script setup>
2
+ import { ref } from 'vue'
3
+ import FormFieldSlot from './FormFieldSlot.vue'
4
+
5
+ defineOptions({
6
+ inheritAttrs: false,
7
+ })
8
+
9
+ const model = defineModel({ default: '' })
10
+
11
+ const props = defineProps({
12
+ options: {
13
+ type: Array,
14
+ default: () => []
15
+ },
16
+ })
17
+
18
+ const emit = defineEmits(['input'])
19
+
20
+ function setValue(value) {
21
+ model.value = value
22
+ emit('input', value)
23
+ }
24
+
25
+ </script>
26
+ <template>
27
+ <FormFieldSlot :id="$attrs.id" :class="[$attrs.class, 'rsui-form-field-radio-group']" :required="$attrs.required"
28
+ :compact="$attrs.compact">
29
+ <template #label v-if="$slots.label">
30
+ <slot name="label"></slot>
31
+ </template>
32
+ <div class="rsui-form-field-radio-group__items">
33
+ <div v-for="option in options" :key="option" class="rsui-form-field-radio-group__item"
34
+ @click="setValue(option.value)">
35
+ <div class="rsui-form-field-radio-group__control" v-if="model !== option.value"></div>
36
+ <div class="rsui-form-field-radio-group__control rsui-form-field-radio-group__control--active"
37
+ v-if="model == option.value">
38
+ <div></div>
39
+ </div>
40
+ <input class="rsui-form-field-radio-group__item-native-control" type="radio" :value="option.value"
41
+ v-model="model" :id="$attrs.id" :name="$attrs.name">
42
+ <label class="rsui-form-field-radio-group__item-label">{{ option.label }}</label>
43
+ </div>
44
+ </div>
45
+ <template #help v-if="$slots.help">
46
+ <slot name="help"></slot>
47
+ </template>
48
+
49
+ <template #error v-if="$slots.error">
50
+ <slot name="error"></slot>
51
+ </template>
52
+ </FormFieldSlot>
53
+ </template>
54
+ <style lang="scss" scoped>
55
+ .rsui-form-field-radio-group {
56
+ @apply inline-flex space-y-2;
57
+ &__items {
58
+ @apply flex flex-wrap items-start content-start self-stretch gap-x-9 gap-y-3;
59
+ }
60
+ &__item {
61
+ @apply flex items-center gap-2 cursor-pointer;
62
+ }
63
+ &__item-native-control {
64
+ @apply appearance-none;
65
+ }
66
+ &__control {
67
+ @apply shrink-0 size-6 border border-gray-400 rounded-full bg-white;
68
+ &--active {
69
+ @apply bg-primary border-primary flex items-center justify-center;
70
+ div {
71
+ @apply size-3 bg-white rounded-full;
72
+ }
73
+ }
74
+ }
75
+ &__item-label {
76
+ @apply font-normal cursor-pointer mb-0;
77
+ }
78
+ }
79
+
80
+ </style>
@@ -4,6 +4,7 @@ import FormFieldHidden from './FormFieldHidden.vue'
4
4
  import FormFieldNumber from './FormFieldNumber.vue'
5
5
  import FormFieldPassword from './FormFieldPassword.vue'
6
6
  import FormFieldPasswordToggle from './FormFieldPasswordToggle.vue'
7
+ import FormFieldRadioGroup from './FormFieldRadioGroup.vue'
7
8
  import FormFieldSearch from './FormFieldSearch.vue'
8
9
  import FormFieldSelect from './FormFieldSelect.vue'
9
10
  import FormFieldSlot from './FormFieldSlot.vue'
@@ -18,6 +19,7 @@ export {
18
19
  FormFieldNumber,
19
20
  FormFieldPassword,
20
21
  FormFieldPasswordToggle,
22
+ FormFieldRadioGroup,
21
23
  FormFieldSearch,
22
24
  FormFieldSelect,
23
25
  FormFieldSlot,