vueless 0.0.534 → 0.0.535

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 (36) hide show
  1. package/composables/useAutoPosition.ts +0 -9
  2. package/package.json +1 -1
  3. package/types.ts +24 -0
  4. package/ui.button/types.ts +3 -22
  5. package/ui.button-link/types.ts +2 -22
  6. package/ui.dropdown-badge/UDropdownBadge.vue +16 -9
  7. package/ui.dropdown-badge/storybook/stories.ts +9 -6
  8. package/ui.dropdown-badge/types.ts +8 -27
  9. package/ui.dropdown-badge/useAttrs.ts +5 -5
  10. package/ui.dropdown-button/UDropdownButton.vue +32 -10
  11. package/ui.dropdown-button/storybook/stories.ts +15 -10
  12. package/ui.dropdown-button/types.ts +9 -28
  13. package/ui.dropdown-button/useAttrs.ts +6 -6
  14. package/ui.dropdown-link/UDropdownLink.vue +16 -9
  15. package/ui.dropdown-link/storybook/stories.ts +13 -10
  16. package/ui.dropdown-link/types.ts +8 -27
  17. package/ui.dropdown-link/useAttrs.ts +6 -7
  18. package/ui.dropdown-list/UDropdownList.vue +38 -26
  19. package/ui.dropdown-list/storybook/stories.ts +12 -10
  20. package/ui.dropdown-list/types.ts +28 -11
  21. package/ui.dropdown-list/useAttrs.ts +2 -2
  22. package/ui.dropdown-list/usePointer.ts +43 -46
  23. package/ui.form-date-picker-range/useAttrs.ts +3 -3
  24. package/ui.form-select/storybook/stories.js +1 -0
  25. package/ui.image-avatar/types.ts +3 -22
  26. package/ui.image-icon/types.ts +2 -23
  27. package/ui.loader/types.ts +3 -23
  28. package/ui.loader-overlay/types.ts +3 -23
  29. package/ui.loader-progress/types.ts +3 -22
  30. package/ui.navigation-progress/types.ts +3 -22
  31. package/ui.other-dot/types.ts +3 -22
  32. package/ui.text-alert/types.ts +3 -22
  33. package/ui.text-badge/types.ts +3 -22
  34. package/ui.text-header/types.ts +3 -22
  35. package/ui.text-money/types.ts +3 -22
  36. package/web-types.json +97 -439
@@ -14,15 +14,6 @@ export enum Direction {
14
14
  export type Align = `${Direction}`;
15
15
  export type Position = { x: Align; y: Align };
16
16
 
17
- // TODO: Remove it after ui.form-date-picker-range and ui.form-date-picker ts migration (use enum there instead).
18
- export const POSITION = {
19
- left: "left",
20
- right: "right",
21
- top: "top",
22
- bottom: "bottom",
23
- auto: "auto",
24
- };
25
-
26
17
  export function useAutoPosition(
27
18
  anchorElement: MaybeRef<HTMLElement | null>,
28
19
  targetElement: MaybeRef<HTMLElement | null>,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.534",
3
+ "version": "0.0.535",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
package/types.ts CHANGED
@@ -54,6 +54,30 @@ export enum ColorMode {
54
54
  Auto = "auto",
55
55
  }
56
56
 
57
+ export enum Color {
58
+ Brand = "brand",
59
+ Grayscale = "grayscale",
60
+ Gray = "gray",
61
+ Red = "red",
62
+ Orange = "orange",
63
+ Amber = "amber",
64
+ Yellow = "yellow",
65
+ Lime = "lime",
66
+ Green = "green",
67
+ Emerald = "emerald",
68
+ Teal = "teal",
69
+ Cyan = "cyan",
70
+ Sky = "sky",
71
+ Blue = "blue",
72
+ Indigo = "indigo",
73
+ Violet = "violet",
74
+ Purple = "purple",
75
+ Fuchsia = "fuchsia",
76
+ Pink = "pink",
77
+ Rose = "rose",
78
+ White = "white",
79
+ }
80
+
57
81
  export interface ExtendedKeyClasses {
58
82
  [key: string]: Ref<string>;
59
83
  }
@@ -1,5 +1,7 @@
1
1
  import defaultConfig from "./config.ts";
2
2
 
3
+ import type { Color } from "../types.ts";
4
+
3
5
  export type Config = Partial<typeof defaultConfig>;
4
6
 
5
7
  export interface UButtonProps {
@@ -11,28 +13,7 @@ export interface UButtonProps {
11
13
  /**
12
14
  * Button color.
13
15
  */
14
- color?:
15
- | "brand"
16
- | "grayscale"
17
- | "gray"
18
- | "red"
19
- | "orange"
20
- | "amber"
21
- | "yellow"
22
- | "lime"
23
- | "green"
24
- | "emerald"
25
- | "teal"
26
- | "cyan"
27
- | "sky"
28
- | "blue"
29
- | "indigo"
30
- | "violet"
31
- | "purple"
32
- | "fuchsia"
33
- | "pink"
34
- | "rose"
35
- | "white";
16
+ color?: `${Color}`;
36
17
 
37
18
  /**
38
19
  * Button size.
@@ -1,6 +1,7 @@
1
1
  import defaultConfig from "./config.ts";
2
2
 
3
3
  import type { RouteLocationRaw } from "vue-router";
4
+ import type { Color } from "src/types.ts";
4
5
 
5
6
  export type Config = Partial<typeof defaultConfig>;
6
7
 
@@ -28,28 +29,7 @@ export interface ULinkProps {
28
29
  /**
29
30
  * Link color.
30
31
  */
31
- color?:
32
- | "brand"
33
- | "grayscale"
34
- | "gray"
35
- | "red"
36
- | "orange"
37
- | "amber"
38
- | "yellow"
39
- | "lime"
40
- | "green"
41
- | "emerald"
42
- | "teal"
43
- | "cyan"
44
- | "sky"
45
- | "blue"
46
- | "indigo"
47
- | "violet"
48
- | "purple"
49
- | "fuchsia"
50
- | "pink"
51
- | "rose"
52
- | "white";
32
+ color?: `${Color}`;
53
33
 
54
34
  /**
55
35
  * Link open type behaviour.
@@ -1,5 +1,5 @@
1
- <script lang="ts" setup>
2
- import { nextTick, ref, useId } from "vue";
1
+ <script setup lang="ts">
2
+ import { nextTick, ref, useId, useTemplateRef } from "vue";
3
3
 
4
4
  import UIcon from "../ui.image-icon/UIcon.vue";
5
5
  import UBadge from "../ui.text-badge/UBadge.vue";
@@ -14,10 +14,13 @@ import { UDropdownBadge } from "./constants.ts";
14
14
  import useAttrs from "./useAttrs.ts";
15
15
 
16
16
  import type { UDropdownBadgeProps } from "./types.ts";
17
+ import type { Option } from "../ui.dropdown-list/types.ts";
17
18
 
18
19
  defineOptions({ inheritAttrs: false });
19
20
 
20
21
  const props = withDefaults(defineProps<UDropdownBadgeProps>(), {
22
+ label: getDefault<UDropdownBadgeProps>(defaultConfig, UDropdownBadge).label,
23
+ options: () => [],
21
24
  labelKey: getDefault<UDropdownBadgeProps>(defaultConfig, UDropdownBadge).labelKey,
22
25
  variant: getDefault<UDropdownBadgeProps>(defaultConfig, UDropdownBadge).variant,
23
26
  color: getDefault<UDropdownBadgeProps>(defaultConfig, UDropdownBadge).color,
@@ -26,7 +29,9 @@ const props = withDefaults(defineProps<UDropdownBadgeProps>(), {
26
29
  noIcon: getDefault<UDropdownBadgeProps>(defaultConfig, UDropdownBadge).noIcon,
27
30
  yPosition: getDefault<UDropdownBadgeProps>(defaultConfig, UDropdownBadge).yPosition,
28
31
  xPosition: getDefault<UDropdownBadgeProps>(defaultConfig, UDropdownBadge).xPosition,
32
+ id: "",
29
33
  dataTest: "",
34
+ config: () => ({}),
30
35
  });
31
36
 
32
37
  const emit = defineEmits([
@@ -37,8 +42,10 @@ const emit = defineEmits([
37
42
  "clickOption",
38
43
  ]);
39
44
 
45
+ type UDropdownListRef = InstanceType<typeof UDropdownList>;
46
+
40
47
  const isShownOptions = ref(false);
41
- const dropdownListRef = ref(null);
48
+ const dropdownListRef = useTemplateRef<UDropdownListRef>("dropdown-list");
42
49
 
43
50
  const elementId = props.id || useId();
44
51
 
@@ -53,7 +60,7 @@ function onClickBadge() {
53
60
  isShownOptions.value = !isShownOptions.value;
54
61
 
55
62
  if (isShownOptions.value) {
56
- nextTick(() => dropdownListRef.value.wrapperRef.focus());
63
+ nextTick(() => dropdownListRef.value?.wrapperRef?.focus());
57
64
  }
58
65
  }
59
66
 
@@ -61,7 +68,7 @@ function hideOptions() {
61
68
  isShownOptions.value = false;
62
69
  }
63
70
 
64
- function onClickOption(option) {
71
+ function onClickOption(option: Option) {
65
72
  emit("clickOption", option);
66
73
 
67
74
  hideOptions();
@@ -100,7 +107,7 @@ function onClickOption(option) {
100
107
  <slot :label="label" :opened="isShownOptions" />
101
108
  </template>
102
109
 
103
- <template #right="{ iconColor, iconSize }">
110
+ <template #right="{ iconColor }">
104
111
  <!--
105
112
  @slot Use it to add something after the label.
106
113
  @binding {boolean} opened
@@ -110,8 +117,8 @@ function onClickOption(option) {
110
117
  v-if="!noIcon"
111
118
  internal
112
119
  :color="iconColor"
113
- :size="iconSize"
114
- :name="config.defaults.dropdownIcon"
120
+ :size="size"
121
+ :name="config.defaults?.dropdownIcon"
115
122
  v-bind="dropdownIconAttrs"
116
123
  :data-test="`${dataTest}-dropdown`"
117
124
  />
@@ -121,7 +128,7 @@ function onClickOption(option) {
121
128
 
122
129
  <UDropdownList
123
130
  v-if="isShownOptions"
124
- ref="dropdownListRef"
131
+ ref="dropdown-list"
125
132
  :size="size"
126
133
  :options="options"
127
134
  :label-key="labelKey"
@@ -7,9 +7,12 @@ import UIcon from "../../ui.image-icon/UIcon.vue";
7
7
  import type { Meta, StoryFn } from "@storybook/vue3";
8
8
  import type { UDropdownBadgeProps } from "../types.ts";
9
9
 
10
- interface UDropdownBadgeArgs extends UDropdownBadgeProps {
10
+ interface DefaultUDropdownBadgeArgs extends UDropdownBadgeProps {
11
11
  slotTemplate?: string;
12
- enum: "color" | "size";
12
+ }
13
+
14
+ interface EnumUDropdownBadgeArgs extends DefaultUDropdownBadgeArgs {
15
+ enum: keyof Pick<UDropdownBadgeProps, "color" | "size">;
13
16
  }
14
17
 
15
18
  /**
@@ -35,7 +38,7 @@ export default {
35
38
  },
36
39
  } as Meta;
37
40
 
38
- const DefaultTemplate: StoryFn<UDropdownBadgeArgs> = (args: UDropdownBadgeArgs) => ({
41
+ const DefaultTemplate: StoryFn<DefaultUDropdownBadgeArgs> = (args: DefaultUDropdownBadgeArgs) => ({
39
42
  components: { UDropdownBadge, UIcon },
40
43
  setup() {
41
44
  const slots = getSlotNames(UDropdownBadge.__name);
@@ -51,15 +54,15 @@ const DefaultTemplate: StoryFn<UDropdownBadgeArgs> = (args: UDropdownBadgeArgs)
51
54
  `,
52
55
  });
53
56
 
54
- const EnumVariantTemplate: StoryFn<UDropdownBadgeArgs> = (
55
- args: UDropdownBadgeArgs,
57
+ const EnumVariantTemplate: StoryFn<EnumUDropdownBadgeArgs> = (
58
+ args: EnumUDropdownBadgeArgs,
56
59
  { argTypes },
57
60
  ) => ({
58
61
  components: { UDropdownBadge, URow },
59
62
  setup() {
60
63
  return {
61
64
  args,
62
- options: argTypes?.[args.enum]?.options,
65
+ options: argTypes[args.enum]?.options,
63
66
  };
64
67
  },
65
68
  template: `
@@ -1,6 +1,8 @@
1
1
  import defaultConfig from "./config.ts";
2
2
 
3
- import type { UnknownObject } from "../types.ts";
3
+ import type { Option } from "../ui.dropdown-list/types";
4
+ import type { Direction } from "../composables/useAutoPosition";
5
+ import type { Color } from "../types";
4
6
 
5
7
  export type Config = Partial<typeof defaultConfig>;
6
8
 
@@ -13,7 +15,7 @@ export interface UDropdownBadgeProps {
13
15
  /**
14
16
  * Options list.
15
17
  */
16
- options?: UnknownObject[];
18
+ options?: Option[];
17
19
 
18
20
  /**
19
21
  * Label key in the item object of options.
@@ -28,28 +30,7 @@ export interface UDropdownBadgeProps {
28
30
  /**
29
31
  * Badge color.
30
32
  */
31
- color?:
32
- | "brand"
33
- | "grayscale"
34
- | "gray"
35
- | "red"
36
- | "orange"
37
- | "amber"
38
- | "yellow"
39
- | "lime"
40
- | "green"
41
- | "emerald"
42
- | "teal"
43
- | "cyan"
44
- | "sky"
45
- | "blue"
46
- | "indigo"
47
- | "violet"
48
- | "purple"
49
- | "fuchsia"
50
- | "pink"
51
- | "rose"
52
- | "white";
33
+ color?: `${Color}`;
53
34
 
54
35
  /**
55
36
  * Badge size.
@@ -69,12 +50,12 @@ export interface UDropdownBadgeProps {
69
50
  /**
70
51
  * The position of dropdown list on the y-axis.
71
52
  */
72
- yPosition?: "top" | "bottom";
53
+ yPosition?: Direction.Top | Direction.Bottom;
73
54
 
74
55
  /**
75
56
  * The position of dropdown list on the x-axis.
76
57
  */
77
- xPosition?: "left" | "right";
58
+ xPosition?: Direction.Left | Direction.Right;
78
59
 
79
60
  /**
80
61
  * Unique element id.
@@ -84,7 +65,7 @@ export interface UDropdownBadgeProps {
84
65
  /**
85
66
  * Component config object.
86
67
  */
87
- config?: Partial<typeof defaultConfig>;
68
+ config?: Config;
88
69
 
89
70
  /**
90
71
  * Data-test attribute for automated testing.
@@ -4,16 +4,16 @@ import useUI from "../composables/useUI.ts";
4
4
  import defaultConfig from "./config.ts";
5
5
 
6
6
  import type { Ref } from "vue";
7
- import type { UseAttrs } from "../types.ts";
8
- import type { UDropdownBadgeProps, Config } from "./types.ts";
7
+ import type { Config, UDropdownBadgeProps } from "./types.ts";
8
+ import type { UseAttrs } from "src/types.ts";
9
9
 
10
- type ComponentState = {
10
+ interface DropdownBadgeState {
11
11
  isShownOptions: Ref<boolean>;
12
- };
12
+ }
13
13
 
14
14
  export default function useAttrs(
15
15
  props: UDropdownBadgeProps,
16
- { isShownOptions }: ComponentState,
16
+ { isShownOptions }: DropdownBadgeState,
17
17
  ): UseAttrs<Config> {
18
18
  const { config, getKeysAttrs, hasSlotContent, getExtendingKeysClasses } = useUI(
19
19
  defaultConfig,
@@ -1,5 +1,5 @@
1
- <script lang="ts" setup>
2
- import { nextTick, computed, provide, ref, useId } from "vue";
1
+ <script setup lang="ts">
2
+ import { nextTick, computed, provide, ref, useId, useTemplateRef } from "vue";
3
3
 
4
4
  import UIcon from "../ui.image-icon/UIcon.vue";
5
5
  import UButton from "../ui.button/UButton.vue";
@@ -14,14 +14,17 @@ import useAttrs from "./useAttrs.ts";
14
14
  import { UDropdownButton, BUTTON_VARIANT } from "./constants.ts";
15
15
 
16
16
  import type { UDropdownButtonProps } from "./types.ts";
17
+ import type { Option } from "../ui.dropdown-list/types.ts";
17
18
 
18
19
  defineOptions({ inheritAttrs: false });
19
20
 
20
21
  const props = withDefaults(defineProps<UDropdownButtonProps>(), {
22
+ label: getDefault<UDropdownButtonProps>(defaultConfig, UDropdownButton).label,
23
+ options: () => [],
21
24
  labelKey: getDefault<UDropdownButtonProps>(defaultConfig, UDropdownButton).labelKey,
22
25
  variant: getDefault<UDropdownButtonProps>(defaultConfig, UDropdownButton).variant,
23
- filled: getDefault<UDropdownButtonProps>(defaultConfig, UDropdownButton).filled,
24
26
  color: getDefault<UDropdownButtonProps>(defaultConfig, UDropdownButton).color,
27
+ filled: getDefault<UDropdownButtonProps>(defaultConfig, UDropdownButton).filled,
25
28
  size: getDefault<UDropdownButtonProps>(defaultConfig, UDropdownButton).size,
26
29
  round: getDefault<UDropdownButtonProps>(defaultConfig, UDropdownButton).round,
27
30
  square: getDefault<UDropdownButtonProps>(defaultConfig, UDropdownButton).square,
@@ -29,7 +32,9 @@ const props = withDefaults(defineProps<UDropdownButtonProps>(), {
29
32
  noIcon: getDefault<UDropdownButtonProps>(defaultConfig, UDropdownButton).noIcon,
30
33
  yPosition: getDefault<UDropdownButtonProps>(defaultConfig, UDropdownButton).yPosition,
31
34
  xPosition: getDefault<UDropdownButtonProps>(defaultConfig, UDropdownButton).xPosition,
35
+ id: "",
32
36
  dataTest: "",
37
+ config: () => ({}),
33
38
  });
34
39
 
35
40
  const emit = defineEmits([
@@ -42,8 +47,10 @@ const emit = defineEmits([
42
47
 
43
48
  provide("hideDropdownOptions", hideOptions);
44
49
 
50
+ type UDropdownListRef = InstanceType<typeof UDropdownList>;
51
+
45
52
  const isShownOptions = ref(false);
46
- const dropdownListRef = ref(null);
53
+ const dropdownListRef = useTemplateRef<UDropdownListRef>("dropdown-list");
47
54
 
48
55
  const elementId = props.id || useId();
49
56
 
@@ -54,6 +61,7 @@ const iconColor = computed(() => {
54
61
  return props.variant === BUTTON_VARIANT.primary ? "white" : props.color;
55
62
  });
56
63
 
64
+ type IconSize = "2xs" | "xs" | "sm" | "md" | "lg" | "xl";
57
65
  const iconSize = computed(() => {
58
66
  const sizes = {
59
67
  "2xs": "xs",
@@ -64,10 +72,24 @@ const iconSize = computed(() => {
64
72
  xl: "md",
65
73
  };
66
74
 
67
- return sizes[props.size];
75
+ return sizes[props.size] as IconSize;
76
+ });
77
+
78
+ type DropdownSize = "sm" | "md" | "lg";
79
+ const dropdownSize = computed(() => {
80
+ const sizes = {
81
+ "2xs": "sm",
82
+ xs: "sm",
83
+ sm: "sm",
84
+ md: "md",
85
+ lg: "lg",
86
+ xl: "lg",
87
+ };
88
+
89
+ return sizes[props.size] as DropdownSize;
68
90
  });
69
91
 
70
- function onClickOption(option) {
92
+ function onClickOption(option: Option) {
71
93
  emit("clickOption", option);
72
94
  }
73
95
 
@@ -75,7 +97,7 @@ function onClickButton() {
75
97
  isShownOptions.value = !isShownOptions.value;
76
98
 
77
99
  if (isShownOptions.value) {
78
- nextTick(() => dropdownListRef.value.wrapperRef.focus());
100
+ nextTick(() => dropdownListRef.value?.wrapperRef?.focus());
79
101
  }
80
102
  }
81
103
 
@@ -132,7 +154,7 @@ function onClickList() {
132
154
  internal
133
155
  :size="iconSize"
134
156
  :color="iconColor"
135
- :name="config.defaults.dropdownIcon"
157
+ :name="config.defaults?.dropdownIcon"
136
158
  v-bind="dropdownIconAttrs"
137
159
  :data-test="`${dataTest}-dropdown`"
138
160
  />
@@ -142,8 +164,8 @@ function onClickList() {
142
164
 
143
165
  <UDropdownList
144
166
  v-if="isShownOptions"
145
- ref="dropdownListRef"
146
- :size="size"
167
+ ref="dropdown-list"
168
+ :size="dropdownSize"
147
169
  :options="options"
148
170
  :label-key="labelKey"
149
171
  v-bind="dropdownListAttrs"
@@ -8,9 +8,12 @@ import UIcon from "../../ui.image-icon/UIcon.vue";
8
8
  import type { Meta, StoryFn } from "@storybook/vue3";
9
9
  import type { UDropdownButtonProps } from "../types.ts";
10
10
 
11
- interface UDropdownButtonArgs extends UDropdownButtonProps {
11
+ interface DefaultUDropdownButtonArgs extends UDropdownButtonProps {
12
12
  slotTemplate?: string;
13
- enum: "variant" | "size";
13
+ }
14
+
15
+ interface EnumUDropdownButtonArgs extends DefaultUDropdownButtonArgs {
16
+ enum: keyof Pick<UDropdownButtonProps, "size" | "variant">;
14
17
  }
15
18
 
16
19
  /**
@@ -36,7 +39,9 @@ export default {
36
39
  },
37
40
  } as Meta;
38
41
 
39
- const DefaultTemplate: StoryFn<UDropdownButtonArgs> = (args: UDropdownButtonArgs) => ({
42
+ const DefaultTemplate: StoryFn<DefaultUDropdownButtonArgs> = (
43
+ args: DefaultUDropdownButtonArgs,
44
+ ) => ({
40
45
  components: { UDropdownButton, UIcon },
41
46
  setup() {
42
47
  const slots = getSlotNames(UDropdownButton.__name);
@@ -50,15 +55,15 @@ const DefaultTemplate: StoryFn<UDropdownButtonArgs> = (args: UDropdownButtonArgs
50
55
  `,
51
56
  });
52
57
 
53
- const EnumVariantTemplate: StoryFn<UDropdownButtonArgs> = (
54
- args: UDropdownButtonArgs,
58
+ const EnumVariantTemplate: StoryFn<EnumUDropdownButtonArgs> = (
59
+ args: EnumUDropdownButtonArgs,
55
60
  { argTypes },
56
61
  ) => ({
57
62
  components: { UDropdownButton, URow },
58
63
  setup() {
59
64
  return {
60
65
  args,
61
- options: argTypes?.[args.enum]?.options,
66
+ options: argTypes[args.enum]?.options,
62
67
  };
63
68
  },
64
69
  template: `
@@ -74,16 +79,16 @@ const EnumVariantTemplate: StoryFn<UDropdownButtonArgs> = (
74
79
  `,
75
80
  });
76
81
 
77
- const VariantColorsTemplate: StoryFn<UDropdownButtonArgs> = (
78
- args: UDropdownButtonArgs,
82
+ const VariantColorsTemplate: StoryFn<EnumUDropdownButtonArgs> = (
83
+ args: EnumUDropdownButtonArgs,
79
84
  { argTypes },
80
85
  ) => ({
81
86
  components: { UDropdownButton, URow, UCol },
82
87
  setup() {
83
88
  return {
84
89
  args,
85
- variants: argTypes?.variant?.options,
86
- colors: argTypes?.color?.options,
90
+ variants: argTypes.variant?.options,
91
+ colors: argTypes.color?.options,
87
92
  };
88
93
  },
89
94
  template: `
@@ -1,6 +1,8 @@
1
1
  import defaultConfig from "./config.ts";
2
2
 
3
- import type { UnknownObject } from "../types.ts";
3
+ import type { Option } from "../ui.dropdown-list/types";
4
+ import type { Direction } from "../composables/useAutoPosition";
5
+ import type { Color } from "../types";
4
6
 
5
7
  export type Config = Partial<typeof defaultConfig>;
6
8
 
@@ -13,7 +15,7 @@ export interface UDropdownButtonProps {
13
15
  /**
14
16
  * Options list.
15
17
  */
16
- options?: UnknownObject[];
18
+ options?: Option[];
17
19
 
18
20
  /**
19
21
  * Label key in the item object of options.
@@ -33,28 +35,7 @@ export interface UDropdownButtonProps {
33
35
  /**
34
36
  * Button color.
35
37
  */
36
- color?:
37
- | "brand"
38
- | "grayscale"
39
- | "gray"
40
- | "red"
41
- | "orange"
42
- | "amber"
43
- | "yellow"
44
- | "lime"
45
- | "green"
46
- | "emerald"
47
- | "teal"
48
- | "cyan"
49
- | "sky"
50
- | "blue"
51
- | "indigo"
52
- | "violet"
53
- | "purple"
54
- | "fuchsia"
55
- | "pink"
56
- | "rose"
57
- | "white";
38
+ color?: `${Color}`;
58
39
 
59
40
  /**
60
41
  * Button size.
@@ -72,7 +53,7 @@ export interface UDropdownButtonProps {
72
53
  square?: boolean;
73
54
 
74
55
  /**
75
- * Disable the link.
56
+ * Disable the button.
76
57
  */
77
58
  disabled?: boolean;
78
59
 
@@ -84,12 +65,12 @@ export interface UDropdownButtonProps {
84
65
  /**
85
66
  * The position of dropdown list on the y-axis.
86
67
  */
87
- yPosition?: "top" | "bottom";
68
+ yPosition?: Direction.Top | Direction.Bottom;
88
69
 
89
70
  /**
90
71
  * The position of dropdown list on the x-axis.
91
72
  */
92
- xPosition?: "left" | "right";
73
+ xPosition?: Direction.Left | Direction.Right;
93
74
 
94
75
  /**
95
76
  * Unique element id.
@@ -99,7 +80,7 @@ export interface UDropdownButtonProps {
99
80
  /**
100
81
  * Component config object.
101
82
  */
102
- config?: Partial<typeof defaultConfig>;
83
+ config?: Config;
103
84
 
104
85
  /**
105
86
  * Data-test attribute for automated testing.
@@ -4,18 +4,18 @@ import useUI from "../composables/useUI.ts";
4
4
  import defaultConfig from "./config.ts";
5
5
 
6
6
  import type { Ref } from "vue";
7
- import type { UseAttrs } from "../types.ts";
8
- import type { UDropdownButtonProps, Config } from "./types.ts";
7
+ import type { Config, UDropdownButtonProps } from "./types.ts";
8
+ import type { UseAttrs } from "src/types.ts";
9
9
 
10
- type ComponentState = {
10
+ interface DropdownButtonState {
11
11
  isShownOptions: Ref<boolean>;
12
- };
12
+ }
13
13
 
14
14
  export default function useAttrs(
15
15
  props: UDropdownButtonProps,
16
- { isShownOptions }: ComponentState,
16
+ { isShownOptions }: DropdownButtonState,
17
17
  ): UseAttrs<Config> {
18
- const { config, getKeysAttrs, hasSlotContent, getExtendingKeysClasses } = useUI<Config>(
18
+ const { config, getKeysAttrs, hasSlotContent, getExtendingKeysClasses } = useUI(
19
19
  defaultConfig,
20
20
  () => props.config,
21
21
  );