vueless 0.0.549 → 0.0.550

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 (49) hide show
  1. package/package.json +1 -1
  2. package/types.ts +4 -0
  3. package/ui.button/UButton.vue +5 -5
  4. package/ui.button/types.ts +3 -0
  5. package/ui.button-link/ULink.vue +19 -11
  6. package/ui.button-toggle/UToggle.vue +6 -7
  7. package/ui.button-toggle/types.ts +6 -1
  8. package/ui.button-toggle-item/UToggleItem.vue +44 -21
  9. package/ui.button-toggle-item/types.ts +19 -0
  10. package/ui.button-toggle-item/useAttrs.ts +1 -1
  11. package/ui.container-modal-confirm/types.ts +3 -3
  12. package/ui.dropdown-button/UDropdownButton.vue +1 -3
  13. package/ui.dropdown-button/types.ts +3 -0
  14. package/ui.dropdown-link/UDropdownLink.vue +1 -2
  15. package/ui.dropdown-link/types.ts +2 -0
  16. package/ui.form-checkbox/UCheckbox.vue +2 -2
  17. package/ui.form-checkbox/types.ts +5 -2
  18. package/ui.form-checkbox-group/types.ts +3 -3
  19. package/ui.form-checkbox-multi-state/types.ts +3 -2
  20. package/ui.form-radio/URadio.vue +59 -157
  21. package/ui.form-radio/storybook/Docs.mdx +2 -2
  22. package/ui.form-radio/storybook/{stories.js → stories.ts} +11 -3
  23. package/ui.form-radio/types.ts +99 -0
  24. package/ui.form-radio/useAttrs.ts +35 -0
  25. package/ui.form-radio-group/URadioGroup.vue +45 -125
  26. package/ui.form-radio-group/storybook/Docs.mdx +2 -2
  27. package/ui.form-radio-group/storybook/{stories.js → stories.ts} +13 -5
  28. package/ui.form-radio-group/types.ts +92 -0
  29. package/ui.form-radio-group/useAttrs.ts +18 -0
  30. package/ui.image-avatar/UAvatar.vue +1 -1
  31. package/ui.image-icon/UIcon.vue +1 -1
  32. package/ui.navigation-tab/UTab.vue +5 -4
  33. package/ui.navigation-tab/types.ts +4 -0
  34. package/ui.navigation-tabs/types.ts +12 -2
  35. package/ui.text-alert/UAlert.vue +17 -5
  36. package/ui.text-alert/types.ts +3 -0
  37. package/ui.text-badge/UBadge.vue +2 -2
  38. package/ui.text-badge/types.ts +2 -0
  39. package/ui.text-empty/UEmpty.vue +5 -4
  40. package/ui.text-empty/types.ts +3 -0
  41. package/ui.text-file/UFile.vue +6 -5
  42. package/ui.text-file/types.ts +3 -0
  43. package/web-types.json +100 -60
  44. package/ui.form-radio/useAttrs.js +0 -23
  45. package/ui.form-radio-group/useAttrs.js +0 -15
  46. /package/ui.form-radio/{config.js → config.ts} +0 -0
  47. /package/ui.form-radio/{constants.js → constants.ts} +0 -0
  48. /package/ui.form-radio-group/{config.js → config.ts} +0 -0
  49. /package/ui.form-radio-group/{constants.js → constants.ts} +0 -0
@@ -1,167 +1,34 @@
1
- <template>
2
- <ULabel
3
- :for="elementId"
4
- :label="label"
5
- :error="error"
6
- :size="radioSize"
7
- :align="labelAlign"
8
- :disabled="disabled"
9
- :description="description"
10
- v-bind="radioLabelAttrs"
11
- :data-test="`${dataTest}-label`"
12
- >
13
- <input
14
- :id="elementId"
15
- type="radio"
16
- :value="radioValue"
17
- :name="radioName"
18
- :checked="checked || isChecked"
19
- :disabled="disabled"
20
- v-bind="radioAttrs"
21
- :data-test="dataTest"
22
- @change="onChange"
23
- />
24
-
25
- <template #bottom>
26
- <!-- @slot Use it to add something below the radio. -->
27
- <slot name="bottom" />
28
- </template>
29
- </ULabel>
30
- </template>
31
-
32
- <script setup>
1
+ <script lang="ts" setup>
33
2
  import { computed, inject, onMounted, ref, watchEffect, toValue, useId } from "vue";
34
3
 
35
4
  import ULabel from "../ui.form-label/ULabel.vue";
36
5
  import { getDefault } from "../utils/ui.ts";
37
6
 
38
- import defaultConfig from "./config.js";
39
- import useAttrs from "./useAttrs.js";
40
- import { URadio } from "./constants.js";
7
+ import defaultConfig from "./config.ts";
8
+ import useAttrs from "./useAttrs.ts";
9
+ import { URadio } from "./constants.ts";
10
+
11
+ import type { URadioProps, LocalValueType } from "./types.ts";
12
+ import type { SetRadioGroupSelectedItem } from "../ui.form-radio-group/types.ts";
41
13
 
42
14
  defineOptions({ inheritAttrs: false });
43
15
 
44
- const setRadioGroupSelectedItem = inject("setRadioGroupSelectedItem", null);
16
+ const setRadioGroupSelectedItem = inject<SetRadioGroupSelectedItem>(
17
+ "setRadioGroupSelectedItem",
18
+ null,
19
+ );
45
20
  const getRadioGroupName = inject("getRadioGroupName", null);
46
21
  const getRadioGroupColor = inject("getRadioGroupColor", null);
47
22
  const getRadioGroupSize = inject("getRadioGroupSize", null);
48
23
  const getRadioGroupSelectedItem = inject("getRadioGroupSelectedItem", null);
49
24
 
50
- const props = defineProps({
51
- /**
52
- * Radio value.
53
- */
54
- modelValue: {
55
- type: [Boolean, String, Number, Array, Object],
56
- default: null,
57
- },
58
-
59
- /**
60
- * Native value attribute.
61
- */
62
- value: {
63
- type: [Boolean, String, Number, Array, Object],
64
- default: "",
65
- },
66
-
67
- /**
68
- * Radio label.
69
- */
70
- label: {
71
- type: String,
72
- default: "",
73
- },
74
-
75
- /**
76
- * Label placement.
77
- * @values left, right
78
- */
79
- labelAlign: {
80
- type: String,
81
- default: getDefault(defaultConfig, URadio).labelAlign,
82
- },
83
-
84
- /**
85
- * Radio description.
86
- */
87
- description: {
88
- type: [String, Object],
89
- default: "",
90
- },
91
-
92
- /**
93
- * Error message.
94
- */
95
- error: {
96
- type: String,
97
- default: "",
98
- },
99
-
100
- /**
101
- * Radio name.
102
- */
103
- name: {
104
- type: String,
105
- default: "",
106
- },
107
-
108
- /**
109
- * Radio size.
110
- * @values sm, md, lg
111
- */
112
- size: {
113
- type: String,
114
- default: getDefault(defaultConfig, URadio).size,
115
- },
116
-
117
- /**
118
- * Radio color.
119
- * @values brand, grayscale, gray, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose
120
- */
121
- color: {
122
- type: String,
123
- default: getDefault(defaultConfig, URadio).color,
124
- },
125
-
126
- /**
127
- * Set radio disabled.
128
- */
129
- disabled: {
130
- type: Boolean,
131
- default: getDefault(defaultConfig, URadio).disabled,
132
- },
133
-
134
- /**
135
- * Set radio checked.
136
- */
137
- checked: {
138
- type: Boolean,
139
- default: getDefault(defaultConfig, URadio).checked,
140
- },
141
-
142
- /**
143
- * Unique element id.
144
- */
145
- id: {
146
- type: String,
147
- default: "",
148
- },
149
-
150
- /**
151
- * Component config object.
152
- */
153
- config: {
154
- type: Object,
155
- default: () => ({}),
156
- },
157
-
158
- /**
159
- * Data-test attribute for automated testing.
160
- */
161
- dataTest: {
162
- type: String,
163
- default: "",
164
- },
25
+ const props = withDefaults(defineProps<URadioProps>(), {
26
+ labelAlign: getDefault<URadioProps>(defaultConfig, URadio).labelAlign,
27
+ size: getDefault<URadioProps>(defaultConfig, URadio).size,
28
+ color: getDefault<URadioProps>(defaultConfig, URadio).color,
29
+ disabled: getDefault<URadioProps>(defaultConfig, URadio).disabled,
30
+ checked: getDefault<URadioProps>(defaultConfig, URadio).checked,
31
+ dataTest: "",
165
32
  });
166
33
 
167
34
  const emit = defineEmits([
@@ -172,8 +39,8 @@ const emit = defineEmits([
172
39
  "update:modelValue",
173
40
  ]);
174
41
 
175
- const localValue = ref("");
176
- const radioName = ref(null);
42
+ const localValue = ref<LocalValueType>("");
43
+ const radioName = ref("");
177
44
  const radioColor = ref(toValue(getRadioGroupColor) || props.color);
178
45
  const radioSize = ref(toValue(getRadioGroupSize) || props.size);
179
46
 
@@ -196,7 +63,7 @@ const radioValue = computed(() => {
196
63
  });
197
64
 
198
65
  onMounted(() => {
199
- radioName.value = props.name || toValue(getRadioGroupName);
66
+ radioName.value = props.name || toValue(getRadioGroupName) || "";
200
67
  });
201
68
 
202
69
  watchEffect(() => (radioColor.value = toValue(getRadioGroupColor) || props.color));
@@ -206,9 +73,44 @@ watchEffect(() => {
206
73
  emit("update:modelValue", props.value);
207
74
  });
208
75
 
209
- function onChange(event) {
210
- setRadioGroupSelectedItem && setRadioGroupSelectedItem(props.value);
76
+ function onChange(event: CustomEvent) {
77
+ const target = event.target as HTMLInputElement;
211
78
 
212
- emit("update:modelValue", event.target.value);
79
+ if (setRadioGroupSelectedItem) {
80
+ setRadioGroupSelectedItem(props.value ?? "");
81
+ }
82
+
83
+ emit("update:modelValue", target.value);
213
84
  }
214
85
  </script>
86
+
87
+ <template>
88
+ <ULabel
89
+ :for="elementId"
90
+ :label="label"
91
+ :error="error"
92
+ :size="radioSize"
93
+ :align="labelAlign"
94
+ :disabled="disabled"
95
+ :description="description"
96
+ v-bind="radioLabelAttrs"
97
+ :data-test="`${dataTest}-label`"
98
+ >
99
+ <input
100
+ :id="elementId"
101
+ type="radio"
102
+ :value="radioValue"
103
+ :name="radioName"
104
+ :checked="checked || isChecked"
105
+ :disabled="disabled"
106
+ v-bind="radioAttrs"
107
+ :data-test="dataTest"
108
+ @change="onChange"
109
+ />
110
+
111
+ <template #bottom>
112
+ <!-- @slot Use it to add something below the radio. -->
113
+ <slot name="bottom" />
114
+ </template>
115
+ </ULabel>
116
+ </template>
@@ -1,8 +1,8 @@
1
1
  import { Meta, Title, Subtitle, Description, Primary, Controls, Stories, Source } from "@storybook/blocks";
2
2
  import { getSource } from "../../utils/storybook.ts";
3
3
 
4
- import * as stories from "./stories.js";
5
- import defaultConfig from "../config.js?raw"
4
+ import * as stories from "./stories.ts";
5
+ import defaultConfig from "../config.ts?raw"
6
6
 
7
7
  <Meta of={stories} />
8
8
  <Title of={stories} />
@@ -3,6 +3,14 @@ import { getArgTypes, getSlotNames, getSlotsFragment } from "../../utils/storybo
3
3
  import URadio from "../../ui.form-radio/URadio.vue";
4
4
  import UBadge from "../../ui.text-badge/UBadge.vue";
5
5
 
6
+ import type { Meta, StoryFn } from "@storybook/vue3";
7
+ import type { URadioProps } from "../types.ts";
8
+
9
+ interface URadioArgs extends URadioProps {
10
+ slotTemplate?: string;
11
+ enum: "variant" | "size";
12
+ }
13
+
6
14
  /**
7
15
  * The `URadio` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.form-radio)
8
16
  */
@@ -19,9 +27,9 @@ export default {
19
27
  argTypes: {
20
28
  ...getArgTypes(URadio.__name),
21
29
  },
22
- };
30
+ } as Meta;
23
31
 
24
- const DefaultTemplate = (args) => ({
32
+ const DefaultTemplate: StoryFn<URadioArgs> = (args: URadioArgs) => ({
25
33
  components: { URadio, UBadge },
26
34
  setup() {
27
35
  const slots = getSlotNames(URadio.__name);
@@ -30,7 +38,7 @@ const DefaultTemplate = (args) => ({
30
38
  },
31
39
  template: `
32
40
  <URadio v-bind="args">
33
- ${args.slotTemplate || getSlotsFragment()}
41
+ ${args.slotTemplate || getSlotsFragment("")}
34
42
  </URadio>
35
43
  `,
36
44
  });
@@ -0,0 +1,99 @@
1
+ import defaultConfig from "./config.ts";
2
+
3
+ import type { UnknownObject, UnknownArray } from "../types.ts";
4
+
5
+ export type Config = Partial<typeof defaultConfig>;
6
+
7
+ export type LocalValueType = string | number | boolean | UnknownObject | null;
8
+
9
+ export interface URadioProps {
10
+ /**
11
+ * Radio value.
12
+ */
13
+ modelValue?: boolean | string | number | UnknownArray | UnknownObject;
14
+
15
+ /**
16
+ * Native value attribute.
17
+ */
18
+ value?: boolean | string | number | UnknownArray | UnknownObject;
19
+
20
+ /**
21
+ * Radio label.
22
+ */
23
+ label?: string;
24
+
25
+ /**
26
+ * Label placement.
27
+ */
28
+ labelAlign?: "left" | "right";
29
+
30
+ /**
31
+ * Radio description.
32
+ */
33
+ description?: string;
34
+
35
+ /**
36
+ * Error message.
37
+ */
38
+ error?: string;
39
+
40
+ /**
41
+ * Radio name.
42
+ */
43
+ name?: string;
44
+
45
+ /**
46
+ * Radio size.
47
+ */
48
+ size?: "sm" | "md" | "lg";
49
+
50
+ /**
51
+ * Radio color.
52
+ */
53
+ color?:
54
+ | "grayscale"
55
+ | "red"
56
+ | "orange"
57
+ | "amber"
58
+ | "yellow"
59
+ | "lime"
60
+ | "green"
61
+ | "emerald"
62
+ | "teal"
63
+ | "cyan"
64
+ | "sky"
65
+ | "blue"
66
+ | "indigo"
67
+ | "violet"
68
+ | "purple"
69
+ | "fuchsia"
70
+ | "pink"
71
+ | "rose"
72
+ | "gray"
73
+ | "brand";
74
+
75
+ /**
76
+ * Set radio disabled.
77
+ */
78
+ disabled?: boolean;
79
+
80
+ /**
81
+ * Set radio checked.
82
+ */
83
+ checked?: boolean;
84
+
85
+ /**
86
+ * Unique element id.
87
+ */
88
+ id?: string;
89
+
90
+ /**
91
+ * Component config object.
92
+ */
93
+ config?: Config;
94
+
95
+ /**
96
+ * Data-test attribute for automated testing.
97
+ */
98
+ dataTest?: string;
99
+ }
@@ -0,0 +1,35 @@
1
+ import { computed } from "vue";
2
+ import useUI from "../composables/useUI.ts";
3
+
4
+ import defaultConfig from "./config.ts";
5
+
6
+ import type { Ref } from "vue";
7
+ import type { UseAttrs } from "../types.ts";
8
+ import type { URadioProps, Config } from "./types.ts";
9
+
10
+ type ComponentState = {
11
+ radioColor: Ref<string>;
12
+ radioSize: Ref<string>;
13
+ };
14
+
15
+ export default function useAttrs(
16
+ props: URadioProps,
17
+ { radioColor, radioSize }: ComponentState,
18
+ ): UseAttrs<Config> {
19
+ const { config, getKeysAttrs, hasSlotContent } = useUI<Config>(defaultConfig, () => props.config);
20
+
21
+ const mutatedProps = computed(() => ({
22
+ color: radioColor.value,
23
+ size: radioSize.value,
24
+ label: Boolean(props.label),
25
+ error: Boolean(props.error),
26
+ }));
27
+
28
+ const keysAttrs = getKeysAttrs(mutatedProps);
29
+
30
+ return {
31
+ config,
32
+ ...keysAttrs,
33
+ hasSlotContent,
34
+ };
35
+ }
@@ -1,136 +1,24 @@
1
- <template>
2
- <ULabel
3
- :size="size"
4
- :label="label"
5
- :error="error"
6
- :description="description"
7
- :disabled="disabled"
8
- align="topWithDesc"
9
- v-bind="groupLabelAttrs"
10
- :data-test="dataTest"
11
- >
12
- <div v-bind="listAttrs">
13
- <!-- @slot Use it to add URadio directly. -->
14
- <slot>
15
- <URadio
16
- v-for="(option, index) in options"
17
- :key="option.value"
18
- :model-value="selectedItem"
19
- :value="option.value"
20
- :label="option.label"
21
- :description="option.description"
22
- :disabled="disabled"
23
- v-bind="groupRadioAttrs"
24
- :data-test="`${dataTest}-item-${index}`"
25
- />
26
- </slot>
27
- </div>
28
- </ULabel>
29
- </template>
30
-
31
- <script setup>
1
+ <script lang="ts" setup>
32
2
  import { computed, provide } from "vue";
33
3
 
34
4
  import ULabel from "../ui.form-label/ULabel.vue";
35
5
  import URadio from "../ui.form-radio/URadio.vue";
36
6
  import { getDefault } from "../utils/ui.ts";
37
7
 
38
- import defaultConfig from "./config.js";
39
- import { URadioGroup } from "./constants.js";
40
- import useAttrs from "./useAttrs.js";
41
-
42
- defineOptions({ inheritAttrs: false });
43
-
44
- const props = defineProps({
45
- /**
46
- * Radio group selected value.
47
- */
48
- modelValue: {
49
- type: [Boolean, String, Number, Array, Object],
50
- default: "",
51
- },
52
-
53
- /**
54
- * Radio group options.
55
- */
56
- options: {
57
- type: Array,
58
- default: () => [],
59
- },
60
-
61
- /**
62
- * Radio group label.
63
- */
64
- label: {
65
- type: String,
66
- default: "",
67
- },
68
-
69
- /**
70
- * Radio group description.
71
- */
72
- description: {
73
- type: String,
74
- default: "",
75
- },
76
-
77
- /**
78
- * Radio group error message.
79
- */
80
- error: {
81
- type: String,
82
- default: "",
83
- },
84
-
85
- /**
86
- * Radio size.
87
- * @values sm, md, lg
88
- */
89
- size: {
90
- type: String,
91
- default: getDefault(defaultConfig, URadioGroup).size,
92
- },
93
-
94
- /**
95
- * Radio group color.
96
- * @values brand, grayscale, gray, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose
97
- */
98
- color: {
99
- type: String,
100
- default: getDefault(defaultConfig, URadioGroup).color,
101
- },
102
-
103
- /**
104
- * Unique radio group name (sets for each radio).
105
- */
106
- name: {
107
- type: String,
108
- required: true,
109
- },
8
+ import defaultConfig from "./config.ts";
9
+ import { URadioGroup } from "./constants.ts";
10
+ import useAttrs from "./useAttrs.ts";
110
11
 
111
- /**
112
- * Disable the input.
113
- */
114
- disabled: {
115
- type: Boolean,
116
- default: getDefault(defaultConfig, URadioGroup).disabled,
117
- },
12
+ import type { URadioGroupProps, SetRadioGroupSelectedItem } from "./types.ts";
118
13
 
119
- /**
120
- * Component config object.
121
- */
122
- config: {
123
- type: Object,
124
- default: () => ({}),
125
- },
14
+ defineOptions({ inheritAttrs: false });
126
15
 
127
- /**
128
- * Data-test attribute for automated testing.
129
- */
130
- dataTest: {
131
- type: String,
132
- default: "",
133
- },
16
+ const props = withDefaults(defineProps<URadioGroupProps>(), {
17
+ size: getDefault<URadioGroupProps>(defaultConfig, URadioGroup).size,
18
+ color: getDefault<URadioGroupProps>(defaultConfig, URadioGroup).color,
19
+ disabled: getDefault<URadioGroupProps>(defaultConfig, URadioGroup).disabled,
20
+ modelValue: "",
21
+ dataTest: "",
134
22
  });
135
23
 
136
24
  const emit = defineEmits([
@@ -148,9 +36,41 @@ const selectedItem = computed({
148
36
  set: (value) => emit("update:modelValue", value),
149
37
  });
150
38
 
151
- provide("setRadioGroupSelectedItem", (value) => (selectedItem.value = value));
39
+ provide<SetRadioGroupSelectedItem>("setRadioGroupSelectedItem", (value) => {
40
+ selectedItem.value = value;
41
+ });
152
42
  provide("getRadioGroupSelectedItem", () => selectedItem.value);
153
43
  provide("getRadioGroupName", () => props.name);
154
44
  provide("getRadioGroupColor", () => props.color);
155
45
  provide("getRadioGroupSize", () => props.size);
156
46
  </script>
47
+
48
+ <template>
49
+ <ULabel
50
+ :size="size"
51
+ :label="label"
52
+ :error="error"
53
+ :description="description"
54
+ :disabled="disabled"
55
+ align="topWithDesc"
56
+ v-bind="groupLabelAttrs"
57
+ :data-test="dataTest"
58
+ >
59
+ <div v-bind="listAttrs">
60
+ <!-- @slot Use it to add URadio directly. -->
61
+ <slot>
62
+ <URadio
63
+ v-for="(option, index) in options"
64
+ :key="option.value"
65
+ :model-value="selectedItem"
66
+ :value="option.value"
67
+ :label="option.label"
68
+ :description="option.description"
69
+ :disabled="disabled"
70
+ v-bind="groupRadioAttrs"
71
+ :data-test="`${dataTest}-item-${index}`"
72
+ />
73
+ </slot>
74
+ </div>
75
+ </ULabel>
76
+ </template>
@@ -1,8 +1,8 @@
1
1
  import { Meta, Title, Subtitle, Description, Primary, Controls, Stories, Source } from "@storybook/blocks";
2
2
  import { getSource } from "../../utils/storybook.ts";
3
3
 
4
- import * as stories from "./stories.js";
5
- import defaultConfig from "../config.js?raw"
4
+ import * as stories from "./stories.ts";
5
+ import defaultConfig from "../config.ts?raw"
6
6
 
7
7
  <Meta of={stories} />
8
8
  <Title of={stories} />
@@ -5,6 +5,14 @@ import URadio from "../../ui.form-radio/URadio.vue";
5
5
  import UAlert from "../../ui.text-alert/UAlert.vue";
6
6
  import UCol from "../../ui.container-col/UCol.vue";
7
7
 
8
+ import type { Meta, StoryFn } from "@storybook/vue3";
9
+ import type { URadioGroupProps } from "../types.ts";
10
+
11
+ interface URadioGroupArgs extends URadioGroupProps {
12
+ slotTemplate?: string;
13
+ enum: "size" | "color";
14
+ }
15
+
8
16
  /**
9
17
  * The `URadioGroup` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.form-radio-group)
10
18
  */
@@ -26,9 +34,9 @@ export default {
26
34
  argTypes: {
27
35
  ...getArgTypes(URadioGroup.__name),
28
36
  },
29
- };
37
+ } as Meta;
30
38
 
31
- const DefaultTemplate = (args) => ({
39
+ const DefaultTemplate: StoryFn<URadioGroupArgs> = (args: URadioGroupArgs) => ({
32
40
  components: { URadioGroup, URadio, UAlert, UCol },
33
41
  setup() {
34
42
  const slots = getSlotNames(URadioGroup.__name);
@@ -43,7 +51,7 @@ const DefaultTemplate = (args) => ({
43
51
  :key="index"
44
52
  v-bind="radio"
45
53
  >
46
- ${args.slotTemplate || getSlotsFragment()}
54
+ ${args.slotTemplate || getSlotsFragment("")}
47
55
  </URadio>
48
56
  </URadioGroup>
49
57
 
@@ -54,12 +62,12 @@ const DefaultTemplate = (args) => ({
54
62
  `,
55
63
  });
56
64
 
57
- const EnumVariantTemplate = (args, { argTypes }) => ({
65
+ const EnumVariantTemplate: StoryFn<URadioGroupArgs> = (args: URadioGroupArgs, { argTypes }) => ({
58
66
  components: { URadioGroup, UCol },
59
67
  setup() {
60
68
  return {
61
69
  args,
62
- options: argTypes[args.enum].options,
70
+ options: argTypes?.[args.enum]?.options,
63
71
  };
64
72
  },
65
73
  template: `