@xy-planning-network/trees 0.7.4-dev → 0.7.5-dev

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.
Files changed (29) hide show
  1. package/dist/trees.es.js +2780 -2715
  2. package/dist/trees.umd.js +9 -9
  3. package/package.json +1 -1
  4. package/src/index.css +0 -16
  5. package/src/lib-components/forms/BaseInput.vue +49 -67
  6. package/src/lib-components/forms/Checkbox.vue +22 -16
  7. package/src/lib-components/forms/DateRangePicker.vue +11 -7
  8. package/src/lib-components/forms/FieldsetLegend.vue +7 -7
  9. package/src/lib-components/forms/InputHelp.vue +2 -4
  10. package/src/lib-components/forms/InputLabel.vue +5 -10
  11. package/src/lib-components/forms/MultiCheckboxes.vue +35 -43
  12. package/src/lib-components/forms/Radio.vue +36 -45
  13. package/src/lib-components/forms/RadioCards.vue +36 -22
  14. package/src/lib-components/forms/Select.vue +44 -38
  15. package/src/lib-components/forms/TextArea.vue +33 -34
  16. package/src/lib-components/forms/Toggle.vue +58 -18
  17. package/src/lib-components/forms/YesOrNoRadio.vue +42 -48
  18. package/types/composables/forms.d.ts +10 -8
  19. package/types/helpers/Debounce.d.ts +1 -1
  20. package/types/lib-components/forms/BaseInput.vue.d.ts +2 -2
  21. package/types/lib-components/forms/FieldsetLegend.vue.d.ts +7 -9
  22. package/types/lib-components/forms/InputLabel.vue.d.ts +0 -5
  23. package/types/lib-components/forms/MultiCheckboxes.vue.d.ts +10 -17
  24. package/types/lib-components/forms/Radio.vue.d.ts +10 -17
  25. package/types/lib-components/forms/RadioCards.vue.d.ts +8 -8
  26. package/types/lib-components/forms/Select.vue.d.ts +0 -5
  27. package/types/lib-components/forms/Toggle.vue.d.ts +14 -4
  28. package/types/lib-components/forms/YesOrNoRadio.vue.d.ts +5 -10
  29. package/types/lib-components/overlays/Modal.vue.d.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xy-planning-network/trees",
3
- "version": "0.7.4-dev",
3
+ "version": "0.7.5-dev",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "repository": "github:xy-planning-network/trees",
package/src/index.css CHANGED
@@ -32,17 +32,6 @@
32
32
  h6 {
33
33
  @apply text-xs leading-4 font-semibold;
34
34
  }
35
-
36
- /* Forms: here for backward compatibility. Use <BaseInput> instead. */
37
- [type="text"],
38
- [type="email"],
39
- [type="password"],
40
- [type="number"],
41
- [type="search"],
42
- [type="tel"],
43
- textarea {
44
- @apply mt-1 shadow-sm focus:ring-xy-blue-500 focus:border-xy-blue block w-full sm:text-sm border-gray-600 rounded-md;
45
- }
46
35
  }
47
36
 
48
37
  @layer components {
@@ -131,9 +120,4 @@
131
120
  .max-h-screen-1\/2 {
132
121
  max-height: 50vh;
133
122
  }
134
-
135
- /* Forms */
136
- .xy-input-error {
137
- @apply focus:ring-red-700 focus:border-red-700 text-red-900 placeholder-red-700 placeholder-opacity-75 border-red-700;
138
- }
139
123
  }
@@ -1,13 +1,29 @@
1
1
  <script setup lang="ts">
2
- import Uniques from "@/helpers/Uniques"
3
2
  import InputLabel from "./InputLabel.vue"
4
3
  import InputHelp from "./InputHelp.vue"
5
- import { computed, useAttrs } from "vue"
4
+ import { useInputField } from "@/composables/forms"
6
5
 
7
- const attrs = useAttrs()
8
- const props = withDefaults(
6
+ defineOptions({
7
+ inheritAttrs: false,
8
+ })
9
+
10
+ type TextLikeInputs =
11
+ | "date"
12
+ | "datetime-local"
13
+ | "email"
14
+ | "month"
15
+ | "number"
16
+ | "password"
17
+ | "search"
18
+ | "tel"
19
+ | "text"
20
+ | "time"
21
+ | "url"
22
+ | "week"
23
+
24
+ withDefaults(
9
25
  defineProps<{
10
- type: string
26
+ type: TextLikeInputs
11
27
  help?: string
12
28
  label?: string
13
29
  modelValue?: string | number
@@ -20,68 +36,34 @@ const props = withDefaults(
20
36
  )
21
37
 
22
38
  const emit = defineEmits(["update:modelValue"])
23
-
24
- const uuid = (attrs.id as string) || Uniques.CreateIdAttribute()
25
-
26
- /**
27
- * common text based inputs
28
- */
29
- const textInputTypes = [
30
- "date",
31
- "datetime-local",
32
- "email",
33
- "month",
34
- "number",
35
- "password",
36
- "search",
37
- "tel",
38
- "text",
39
- "time",
40
- "url",
41
- "week",
42
- ]
43
-
44
- /**
45
- * determine if this input is a common text based input
46
- */
47
- const isTextType = computed((): boolean => {
48
- return typeof props.type === "string" && textInputTypes.includes(props.type)
49
- })
39
+ const { inputID, isValid } = useInputField()
50
40
  </script>
41
+
51
42
  <template>
52
- <InputLabel
53
- :id="`${uuid}-label`"
54
- class="block"
55
- :for="uuid"
56
- :label="label"
57
- ></InputLabel>
58
- <input
59
- :id="uuid"
60
- :aria-labelledby="label ? `${uuid}-label` : undefined"
61
- :aria-describedby="help ? `${uuid}-help` : undefined"
62
- :class="[
63
- ...['mt-1', 'sm:text-sm'],
64
- ...(isTextType
65
- ? [
66
- 'block',
67
- 'shadow-sm',
68
- 'focus:xy-blue-500',
69
- 'focus:border-xy-blue ',
70
- 'border-gray-600',
71
- 'rounded-md',
72
- 'w-full',
73
- 'disabled:opacity-70',
74
- 'disabled:cursor-not-allowed',
75
- ]
76
- : []),
77
- ]"
78
- :placeholder="label"
79
- :type="type"
80
- :value="modelValue"
81
- v-bind="$attrs"
82
- @input="
83
- emit('update:modelValue', ($event.target as HTMLInputElement).value)
84
- "
85
- />
86
- <InputHelp :id="`${uuid}-help`" :text="help"></InputHelp>
43
+ <div>
44
+ <div class="mb-1">
45
+ <InputLabel :id="`${inputID}-label`" :for="inputID" :label="label" />
46
+ </div>
47
+ <input
48
+ :id="inputID"
49
+ :aria-labelledby="label ? `${inputID}-label` : undefined"
50
+ :aria-describedby="help ? `${inputID}-help` : undefined"
51
+ :class="[
52
+ 'block w-full rounded-md border-0 py-2 shadow-sm ring-1 ring-inset focus:ring-2 sm:text-sm sm:leading-6',
53
+ 'disabled:cursor-not-allowed disabled:bg-gray-50 disabled:text-gray-600 disabled:ring-gray-200',
54
+ isValid
55
+ ? 'text-gray-800 ring-gray-300 placeholder:text-gray-400 focus:ring-xy-blue-500'
56
+ : 'text-red-900 ring-red-700 placeholder:text-red-300 focus:ring-red-700',
57
+ ]"
58
+ :type="type"
59
+ :value="modelValue"
60
+ v-bind="$attrs"
61
+ @input="
62
+ emit('update:modelValue', ($event.target as HTMLInputElement).value)
63
+ "
64
+ />
65
+ <div class="mt-1">
66
+ <InputHelp :id="`${inputID}-help`" :text="help" />
67
+ </div>
68
+ </div>
87
69
  </template>
@@ -1,8 +1,11 @@
1
1
  <script setup lang="ts">
2
2
  import InputLabel from "./InputLabel.vue"
3
3
  import InputHelp from "./InputHelp.vue"
4
- import Uniques from "@/helpers/Uniques"
5
- import { useAttrs } from "vue"
4
+ import { useInputField } from "@/composables/forms"
5
+
6
+ defineOptions({
7
+ inheritAttrs: false,
8
+ })
6
9
 
7
10
  withDefaults(
8
11
  defineProps<{
@@ -16,18 +19,24 @@ withDefaults(
16
19
  }
17
20
  )
18
21
  const emits = defineEmits(["update:modelValue"])
19
- const attrs = useAttrs()
20
- const uuid = (attrs.id as string) || Uniques.CreateIdAttribute()
22
+ const { inputID, isDisabled, isValid } = useInputField()
21
23
  </script>
24
+
22
25
  <template>
23
26
  <div class="relative flex items-start">
24
- <div class="flex items-center h-5">
27
+ <div class="flex items-center h-6">
25
28
  <input
26
- :id="uuid"
27
- :aria-labelledby="label ? `${uuid}-label` : undefined"
28
- :aria-describedby="help ? `${uuid}-help` : undefined"
29
+ :id="inputID"
30
+ :aria-labelledby="label ? `${inputID}-label` : undefined"
31
+ :aria-describedby="help ? `${inputID}-help` : undefined"
29
32
  :checked="modelValue"
30
- class="focus:ring-xy-blue-500 h-4 w-4 text-xy-blue border-gray-600 rounded disabled:opacity-50 disabled:cursor-not-allowed"
33
+ :class="[
34
+ 'h-4 w-4 rounded',
35
+ 'border-gray-300 text-xy-blue',
36
+ 'disabled:bg-gray-100 disabled:border-gray-200 disabled:cursor-not-allowed disabled:opacity-100',
37
+ 'checked:disabled:bg-xy-blue checked:disabled:border-xy-blue checked:disabled:opacity-50',
38
+ isValid ? 'focus:ring-xy-blue-500' : 'focus:ring-red-700',
39
+ ]"
31
40
  type="checkbox"
32
41
  v-bind="{
33
42
  onChange: ($event) => {
@@ -39,15 +48,12 @@ const uuid = (attrs.id as string) || Uniques.CreateIdAttribute()
39
48
  </div>
40
49
  <div class="ml-3">
41
50
  <InputLabel
42
- :id="`${uuid}-label`"
43
- class="mt-auto"
44
- :disabled="
45
- $attrs.hasOwnProperty('disabled') && $attrs.disabled !== false
46
- "
47
- :for="uuid"
51
+ :id="`${inputID}-label`"
52
+ :for="inputID"
48
53
  :label="label"
54
+ :class="isDisabled && 'cursor-not-allowed'"
49
55
  />
50
- <InputHelp :id="`${uuid}-help`" class="-mt-1" :text="help"></InputHelp>
56
+ <InputHelp :id="`${inputID}-help`" :text="help"></InputHelp>
51
57
  </div>
52
58
  </div>
53
59
  </template>
@@ -1,9 +1,13 @@
1
1
  <script setup lang="ts">
2
- import Uniques from "@/helpers/Uniques"
3
2
  import flatpickr from "flatpickr"
4
3
  import "flatpickr/dist/flatpickr.min.css"
5
- import { onMounted, useAttrs } from "vue"
4
+ import { onMounted } from "vue"
6
5
  import BaseInput from "./BaseInput.vue"
6
+ import { useInputField } from "@/composables/forms"
7
+
8
+ defineOptions({
9
+ inheritAttrs: false,
10
+ })
7
11
 
8
12
  const props = withDefaults(
9
13
  defineProps<{
@@ -25,8 +29,7 @@ const props = withDefaults(
25
29
  )
26
30
 
27
31
  const emits = defineEmits(["update:modelValue"])
28
- const attrs = useAttrs()
29
- const uuid = (attrs.id as string) || Uniques.CreateIdAttribute()
32
+ const { inputID } = useInputField()
30
33
 
31
34
  const updateModelValue = (value: { minDate: number; maxDate: number }) => {
32
35
  emits("update:modelValue", value)
@@ -84,15 +87,16 @@ onMounted(() => {
84
87
  }
85
88
  }
86
89
 
87
- flatpickr(`#${uuid}`, opts)
90
+ flatpickr(`#${inputID.value}`, opts)
88
91
  })
89
92
  </script>
93
+
90
94
  <template>
91
95
  <BaseInput
92
- :id="uuid"
96
+ :id="inputID"
93
97
  type="text"
94
98
  placeholder="mm-dd-yyyy range"
95
99
  :label="label"
96
100
  :help="help"
97
- ></BaseInput>
101
+ />
98
102
  </template>
@@ -1,23 +1,23 @@
1
1
  <script setup lang="ts">
2
- import { hasSlotContent } from "@/helpers/Slots"
3
2
  withDefaults(
4
3
  defineProps<{
4
+ label?: string
5
5
  tag?: string
6
6
  }>(),
7
7
  {
8
+ label: "",
8
9
  tag: "legend",
9
10
  }
10
11
  )
11
12
  </script>
13
+
12
14
  <template>
13
15
  <component
14
16
  :is="tag"
15
- v-if="hasSlotContent($slots.default)"
16
- v-bind="{
17
- ...$attrs,
18
- class: 'text-sm font-semibold leading-snug text-gray-900',
19
- }"
17
+ v-if="label"
18
+ class="block text-base/6 font-medium text-gray-800"
19
+ v-bind="$attrs"
20
20
  >
21
- <slot />
21
+ {{ label }}
22
22
  </component>
23
23
  </template>
@@ -14,10 +14,8 @@ withDefaults(
14
14
  <component
15
15
  :is="tag"
16
16
  v-if="text"
17
- v-bind="{
18
- ...$attrs,
19
- class: 'mt-1 text-sm leading-snug font-normal text-gray-700',
20
- }"
17
+ class="text-sm leading-6 font-normal text-gray-600"
18
+ v-bind="$attrs"
21
19
  >
22
20
  {{ text }}
23
21
  </component>
@@ -1,28 +1,23 @@
1
1
  <script setup lang="ts">
2
2
  withDefaults(
3
3
  defineProps<{
4
- disabled?: boolean
5
4
  label?: string
6
5
  tag?: string
7
6
  }>(),
8
7
  {
9
- disabled: false,
10
8
  label: "",
11
9
  tag: "label",
12
10
  }
13
11
  )
14
12
  </script>
13
+
15
14
  <template>
16
15
  <component
17
16
  :is="tag"
18
17
  v-if="label"
19
- :class="{
20
- 'block my-1 text-sm font-semibold leading-snug text-gray-900': true,
21
- 'opacity-75': disabled,
22
- }"
23
- v-bind="{
24
- ...$attrs,
25
- }"
26
- >{{ label }}</component
18
+ class="block text-sm/6 font-medium text-gray-800"
19
+ v-bind="$attrs"
27
20
  >
21
+ {{ label }}
22
+ </component>
28
23
  </template>
@@ -1,9 +1,12 @@
1
1
  <script setup lang="ts">
2
- import Uniques from "@/helpers/Uniques"
3
- import { computed, useAttrs, useSlots } from "vue"
4
2
  import FieldsetLegend from "./FieldsetLegend.vue"
5
3
  import InputLabel from "./InputLabel.vue"
6
4
  import InputHelp from "./InputHelp.vue"
5
+ import { useInputField } from "@/composables/forms"
6
+
7
+ defineOptions({
8
+ inheritAttrs: false,
9
+ })
7
10
 
8
11
  type CheckboxValue = string | number
9
12
  type ModelValue = CheckboxValue[]
@@ -17,13 +20,13 @@ const props = withDefaults(
17
20
  value: CheckboxValue
18
21
  }[]
19
22
  help?: string
20
- legend?: string
23
+ label?: string
21
24
  modelValue: ModelValue
22
- columns?: 2 | 3 | 4
25
+ columns?: 2 | 3
23
26
  }>(),
24
27
  {
25
28
  help: "",
26
- legend: "",
29
+ label: "",
27
30
  columns: undefined,
28
31
  }
29
32
  )
@@ -31,12 +34,9 @@ const props = withDefaults(
31
34
  const emit = defineEmits<{
32
35
  (e: "update:modelValue", modelValue: ModelValue): void
33
36
  }>()
34
- const attrs = useAttrs()
35
- const slots = useSlots()
36
- const uuid = (attrs.id as string) || Uniques.CreateIdAttribute()
37
- const hasLegend = computed(() => {
38
- return props.legend !== "" || slots.legend !== undefined
39
- })
37
+
38
+ const { inputID, isDisabled } = useInputField()
39
+
40
40
  const onChange = (checked: boolean, val: CheckboxValue) => {
41
41
  let updateModelValue = [...props.modelValue]
42
42
 
@@ -49,27 +49,25 @@ const onChange = (checked: boolean, val: CheckboxValue) => {
49
49
  emit("update:modelValue", updateModelValue)
50
50
  }
51
51
  </script>
52
+
52
53
  <template>
53
54
  <fieldset
54
55
  class="space-y-5"
55
- :aria-labelledby="hasLegend ? `${uuid}-legend` : undefined"
56
- :aria-describedby="help ? `${uuid}-help` : undefined"
56
+ :aria-labelledby="label ? `${inputID}-legend` : undefined"
57
+ :aria-describedby="help ? `${inputID}-help` : undefined"
57
58
  >
58
- <div v-if="hasLegend || help" class="space-y-0.5">
59
- <FieldsetLegend :id="`${uuid}-legend`">
60
- <div v-if="legend">{{ legend }}</div>
61
- <slot v-if="$slots.legend" name="legend"></slot>
62
- </FieldsetLegend>
63
- <InputHelp :id="`${uuid}-help`" tag="p" :text="help" />
59
+ <div v-if="label">
60
+ <FieldsetLegend :id="`${inputID}-legend`" :label="label" />
61
+ <InputHelp v-if="help" :id="`${inputID}-help`" tag="p" :text="help" />
64
62
  </div>
63
+
65
64
  <div class="flex">
66
65
  <div
67
- class="grid gap-4"
66
+ class="grid gap-y-5"
68
67
  :class="{
69
- 'sm:grid sm:gap-y-4 sm:gap-x-5 sm:space-y-0': columns !== undefined,
68
+ 'sm:grid sm:gap-x-5 sm:space-y-0': columns !== undefined,
70
69
  'sm:grid-cols-2': columns === 2,
71
70
  'sm:grid-cols-3': columns === 3,
72
- 'sm:grid-cols-4': columns === 4,
73
71
  }"
74
72
  >
75
73
  <div
@@ -77,18 +75,21 @@ const onChange = (checked: boolean, val: CheckboxValue) => {
77
75
  :key="option.value"
78
76
  class="flex items-start"
79
77
  >
80
- <div class="flex items-center h-5">
78
+ <div class="flex items-center h-6">
81
79
  <input
82
- :id="`${uuid}-${index}`"
83
- :aria-labelledby="`${uuid}-${index}-label`"
80
+ :id="`${inputID}-${index}`"
81
+ :aria-labelledby="`${inputID}-${index}-label`"
84
82
  :aria-describedby="
85
- option?.help && option.help
86
- ? `${uuid}-${index}-help`
87
- : undefined
83
+ option.help ? `${inputID}-${index}-help` : undefined
88
84
  "
89
85
  :checked="modelValue.includes(option.value)"
90
- :disabled="option.disabled === true ? true : undefined"
91
- class="focus:ring-xy-blue-500 h-4 w-4 text-xy-blue border-gray-600 rounded disabled:opacity-50 disabled:cursor-not-allowed"
86
+ :disabled="option.disabled"
87
+ :class="[
88
+ 'h-4 w-4 rounded',
89
+ 'border-gray-300 text-xy-blue focus:ring-xy-blue-500',
90
+ 'disabled:bg-gray-100 disabled:border-gray-200 disabled:cursor-not-allowed disabled:opacity-100',
91
+ 'checked:disabled:bg-xy-blue checked:disabled:border-xy-blue checked:disabled:opacity-50',
92
+ ]"
92
93
  type="checkbox"
93
94
  v-bind="{
94
95
  onChange: ($event) => {
@@ -100,21 +101,12 @@ const onChange = (checked: boolean, val: CheckboxValue) => {
100
101
  </div>
101
102
  <div class="ml-3">
102
103
  <InputLabel
103
- :id="`${uuid}-${index}-label`"
104
- class="mt-auto"
105
- :disabled="
106
- ($attrs.hasOwnProperty('disabled') &&
107
- $attrs.disabled !== false) ||
108
- option.disabled === true
109
- "
110
- :for="`${uuid}-${index}`"
104
+ :id="`${inputID}-${index}-label`"
105
+ :for="`${inputID}-${index}`"
111
106
  :label="option.label"
107
+ :class="(isDisabled || option.disabled) && 'cursor-not-allowed'"
112
108
  />
113
- <InputHelp
114
- :id="`${uuid}-${index}-help`"
115
- class="-mt-1"
116
- :text="option.help"
117
- />
109
+ <InputHelp :id="`${inputID}-${index}-help`" :text="option.help" />
118
110
  </div>
119
111
  </div>
120
112
  </div>
@@ -1,11 +1,14 @@
1
1
  <script setup lang="ts">
2
- import Uniques from "@/helpers/Uniques"
3
- import { computed, useAttrs, useSlots } from "vue"
4
2
  import FieldsetLegend from "./FieldsetLegend.vue"
5
3
  import InputHelp from "./InputHelp.vue"
6
4
  import InputLabel from "./InputLabel.vue"
5
+ import { useInputField } from "@/composables/forms"
7
6
 
8
- const props = withDefaults(
7
+ defineOptions({
8
+ inheritAttrs: false,
9
+ })
10
+
11
+ withDefaults(
9
12
  defineProps<{
10
13
  options: {
11
14
  disabled?: boolean
@@ -14,46 +17,39 @@ const props = withDefaults(
14
17
  value: string | number
15
18
  }[]
16
19
  help?: string
17
- legend?: string
20
+ label?: string
18
21
  modelValue?: string | number
19
- columns?: 2 | 3 | 4
22
+ columns?: 2 | 3
20
23
  }>(),
21
24
  {
22
25
  help: "",
23
- legend: "",
26
+ label: "",
24
27
  modelValue: undefined,
25
28
  columns: undefined,
26
29
  }
27
30
  )
28
31
  const emits = defineEmits(["update:modelValue"])
29
- const attrs = useAttrs()
30
- const slots = useSlots()
31
- const uuid = (attrs.id as string) || Uniques.CreateIdAttribute()
32
- const hasLegend = computed(() => {
33
- return props.legend !== "" || slots.legend !== undefined
34
- })
32
+ const { inputID, isDisabled } = useInputField()
35
33
  </script>
34
+
36
35
  <template>
37
36
  <fieldset
38
37
  class="space-y-5"
39
- :aria-labelledby="hasLegend ? `${uuid}-legend` : undefined"
40
- :aria-describedby="help ? `${uuid}-help` : undefined"
38
+ :aria-labelledby="label ? `${inputID}-legend` : undefined"
39
+ :aria-describedby="help ? `${inputID}-help` : undefined"
41
40
  >
42
- <div v-if="hasLegend || help" class="space-y-0.5">
43
- <FieldsetLegend :id="`${uuid}-legend`">
44
- <div v-if="legend">{{ legend }}</div>
45
- <slot v-if="$slots.legend" name="legend"></slot>
46
- </FieldsetLegend>
47
- <InputHelp :id="`${uuid}-help`" tag="p" :text="help" />
41
+ <div v-if="label">
42
+ <FieldsetLegend :id="`${inputID}-legend`" :label="label" />
43
+ <InputHelp v-if="help" :id="`${inputID}-help`" tag="p" :text="help" />
48
44
  </div>
45
+
49
46
  <div class="flex">
50
47
  <div
51
- class="grid gap-4"
48
+ class="grid gap-y-5"
52
49
  :class="{
53
- 'sm:grid sm:gap-y-4 sm:gap-x-5 sm:space-y-0': columns !== undefined,
50
+ 'sm:grid sm:gap-x-5 sm:space-y-0': columns !== undefined,
54
51
  'sm:grid-cols-2': columns === 2,
55
52
  'sm:grid-cols-3': columns === 3,
56
- 'sm:grid-cols-4': columns === 4,
57
53
  }"
58
54
  >
59
55
  <div
@@ -61,19 +57,22 @@ const hasLegend = computed(() => {
61
57
  :key="option.value"
62
58
  class="flex items-start"
63
59
  >
64
- <div class="flex items-center h-5">
60
+ <div class="flex items-center h-6">
65
61
  <input
66
- :id="`${uuid}-${index}`"
62
+ :id="`${inputID}-${index}`"
67
63
  :aria-describedby="
68
- option?.help && option.help
69
- ? `${uuid}-${index}-help`
70
- : undefined
64
+ option.help ? `${inputID}-${index}-help` : undefined
71
65
  "
72
- :aria-labelledby="`${uuid}-${index}-label`"
66
+ :aria-labelledby="`${inputID}-${index}-label`"
73
67
  :checked="modelValue === option.value"
74
- class="w-4 h-4 border-gray-600 focus:ring-xy-blue-500 text-xy-blue disabled:opacity-50 disabled:cursor-not-allowed"
75
- :disabled="option.disabled === true ? true : undefined"
76
- :name="uuid"
68
+ :class="[
69
+ 'h-4 w-4',
70
+ 'border-gray-300 text-xy-blue focus:ring-xy-blue-500',
71
+ 'disabled:bg-gray-100 disabled:border-gray-200 disabled:cursor-not-allowed disabled:opacity-100',
72
+ 'checked:disabled:bg-xy-blue checked:disabled:border-xy-blue checked:disabled:opacity-50',
73
+ ]"
74
+ :disabled="option.disabled"
75
+ :name="inputID"
77
76
  type="radio"
78
77
  :value="option.value"
79
78
  v-bind="{
@@ -86,21 +85,13 @@ const hasLegend = computed(() => {
86
85
  </div>
87
86
  <div class="ml-3">
88
87
  <InputLabel
89
- :id="`${uuid}-${index}-label`"
90
- class="mt-auto"
91
- :disabled="
92
- ($attrs.hasOwnProperty('disabled') &&
93
- $attrs.disabled !== false) ||
94
- option.disabled === true
95
- "
96
- :for="`${uuid}-${index}`"
88
+ :id="`${inputID}-${index}-label`"
89
+ :for="`${inputID}-${index}`"
97
90
  :label="option.label"
91
+ :class="(isDisabled || option.disabled) && 'cursor-not-allowed'"
98
92
  />
99
- <InputHelp
100
- :id="`${uuid}-${index}-help`"
101
- class="-mt-1"
102
- :text="option.help"
103
- />
93
+
94
+ <InputHelp :id="`${inputID}-${index}-help`" :text="option.help" />
104
95
  </div>
105
96
  </div>
106
97
  </div>