vueless 0.0.532 → 0.0.533

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 (48) hide show
  1. package/package.json +1 -1
  2. package/types.ts +12 -0
  3. package/ui.image-avatar/UAvatar.vue +51 -115
  4. package/ui.image-avatar/storybook/Docs.mdx +2 -2
  5. package/ui.image-avatar/storybook/{stories.js → stories.ts} +13 -5
  6. package/ui.image-avatar/types.ts +71 -0
  7. package/ui.image-avatar/useAttrs.ts +18 -0
  8. package/ui.image-icon/UIcon.vue +28 -113
  9. package/ui.image-icon/storybook/Docs.mdx +1 -1
  10. package/ui.image-icon/storybook/{stories.js → stories.ts} +13 -5
  11. package/ui.image-icon/types.ts +83 -0
  12. package/ui.image-icon/useAttrs.ts +18 -0
  13. package/ui.navigation-pagination/UPagination.vue +141 -262
  14. package/ui.navigation-pagination/storybook/Docs.mdx +2 -2
  15. package/ui.navigation-pagination/storybook/{stories.js → stories.ts} +11 -4
  16. package/ui.navigation-pagination/types.ts +85 -0
  17. package/ui.navigation-pagination/{useAttrs.js → useAttrs.ts} +5 -2
  18. package/ui.navigation-progress/StepperProgress.vue +26 -47
  19. package/ui.navigation-progress/UProgress.vue +60 -118
  20. package/ui.navigation-progress/{config.js → config.ts} +1 -0
  21. package/ui.navigation-progress/storybook/Docs.mdx +2 -2
  22. package/ui.navigation-progress/storybook/{stories.js → stories.ts} +19 -7
  23. package/ui.navigation-progress/types.ts +93 -0
  24. package/ui.navigation-progress/{useAttrs.js → useAttrs.ts} +6 -3
  25. package/ui.navigation-tab/UTab.vue +18 -54
  26. package/ui.navigation-tab/storybook/Docs.mdx +2 -2
  27. package/ui.navigation-tab/storybook/{stories.js → stories.ts} +10 -5
  28. package/ui.navigation-tab/types.ts +30 -0
  29. package/ui.navigation-tab/{useAttrs.js → useAttrs.ts} +15 -3
  30. package/ui.navigation-tabs/UTabs.vue +29 -78
  31. package/ui.navigation-tabs/storybook/Docs.mdx +2 -2
  32. package/ui.navigation-tabs/storybook/{stories.js → stories.ts} +13 -5
  33. package/ui.navigation-tabs/types.ts +37 -0
  34. package/ui.navigation-tabs/useAttrs.ts +18 -0
  35. package/web-types.json +146 -77
  36. package/ui.image-avatar/useAttrs.js +0 -15
  37. package/ui.image-icon/useAttrs.js +0 -15
  38. package/ui.navigation-tabs/useAttrs.js +0 -15
  39. /package/ui.image-avatar/{config.js → config.ts} +0 -0
  40. /package/ui.image-avatar/{constants.js → constants.ts} +0 -0
  41. /package/ui.image-icon/{constants.js → constants.ts} +0 -0
  42. /package/ui.navigation-pagination/{config.js → config.ts} +0 -0
  43. /package/ui.navigation-pagination/{constants.js → constants.ts} +0 -0
  44. /package/ui.navigation-progress/{constants.js → constants.ts} +0 -0
  45. /package/ui.navigation-tab/{config.js → config.ts} +0 -0
  46. /package/ui.navigation-tab/{constants.js → constants.ts} +0 -0
  47. /package/ui.navigation-tabs/{config.js → config.ts} +0 -0
  48. /package/ui.navigation-tabs/{constants.js → constants.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.532",
3
+ "version": "0.0.533",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
package/types.ts CHANGED
@@ -35,6 +35,12 @@ import URowConfig from "./ui.container-row/config.ts";
35
35
  import ULoaderConfig from "./ui.loader/config.ts";
36
36
  import ULoaderOverlayConfig from "./ui.loader-overlay/config.ts";
37
37
  import ULoaderProgressConfig from "./ui.loader-progress/config.ts";
38
+ import UPaginationConfig from "./ui.navigation-pagination/config.ts";
39
+ import UProgressConfig from "./ui.navigation-progress/config.ts";
40
+ import UTabConfig from "./ui.navigation-tab/config.ts";
41
+ import UTabsConfig from "./ui.navigation-tabs/config.ts";
42
+ import UAvatarConfig from "./ui.image-avatar/config.ts";
43
+ import UIconConfig from "./ui.image-icon/config.ts";
38
44
 
39
45
  import type { ComputedRef, MaybeRef, Ref } from "vue";
40
46
  import type { Props } from "tippy.js";
@@ -181,6 +187,12 @@ export interface Components {
181
187
  ULoader?: Partial<typeof ULoaderConfig>;
182
188
  ULoaderOverlay?: Partial<typeof ULoaderOverlayConfig>;
183
189
  ULoaderProgress?: Partial<typeof ULoaderProgressConfig>;
190
+ UPagination?: Partial<typeof UPaginationConfig>;
191
+ UProgress?: Partial<typeof UProgressConfig>;
192
+ UTab?: Partial<typeof UTabConfig>;
193
+ UTabs?: Partial<typeof UTabsConfig>;
194
+ UAvatar?: Partial<typeof UAvatarConfig>;
195
+ UIcon?: Partial<typeof UIconConfig>;
184
196
  }
185
197
 
186
198
  export interface Directives {
@@ -1,125 +1,24 @@
1
- <template>
2
- <div
3
- :title="label"
4
- :style="backgroundImage"
5
- :data-test="dataTest"
6
- v-bind="avatarAttrs"
7
- @click="onClick"
8
- >
9
- <template v-if="!backgroundImage">
10
- <template v-if="labelFirstLetters">{{ labelFirstLetters }}</template>
11
- <!--
12
- @slot Use it to add something instead of the avatar image placeholder.
13
- @binding {string} icon-name
14
- @binding {string} icon-color
15
- @binding {string} icon-size
16
- -->
17
- <slot
18
- v-else
19
- name="placeholder"
20
- :icon-name="placeholderIcon"
21
- :icon-color="componentColor"
22
- :icon-size="size"
23
- >
24
- <UIcon
25
- internal
26
- :size="size"
27
- :color="componentColor"
28
- :name="placeholderIcon"
29
- v-bind="placeholderIconAttrs"
30
- />
31
- </slot>
32
- </template>
33
- </div>
34
- </template>
35
-
36
- <script setup>
1
+ <script lang="ts" setup>
37
2
  import { computed } from "vue";
38
3
 
39
4
  import UIcon from "../ui.image-icon/UIcon.vue";
40
5
  import { getDefault } from "../utils/ui.ts";
41
6
 
42
- import { UAvatar } from "./constants.js";
43
- import defaultConfig from "./config.js";
44
- import useAttrs from "./useAttrs.js";
45
-
46
- defineOptions({ inheritAttrs: false });
47
-
48
- const props = defineProps({
49
- /**
50
- * Avatar image source.
51
- */
52
- src: {
53
- type: String,
54
- default: "",
55
- },
56
-
57
- /**
58
- * Avatar label (username, nickname, etc.).
59
- */
60
- label: {
61
- type: String,
62
- default: "",
63
- },
64
-
65
- /**
66
- * Avatar placeholder icon.
67
- */
68
- placeholderIcon: {
69
- type: String,
70
- default: getDefault(defaultConfig, UAvatar).placeholderIcon,
71
- },
72
-
73
- /**
74
- * Avatar size.
75
- * @values 3xs, 2xs, xs, sm, md, lg, xl, 2xl, 3xl
76
- */
77
- size: {
78
- type: String,
79
- default: getDefault(defaultConfig, UAvatar).size,
80
- },
81
-
82
- /**
83
- * Avatar color.
84
- * @values brand, grayscale, gray, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose, white
85
- */
86
- color: {
87
- type: String,
88
- default: getDefault(defaultConfig, UAvatar).color,
89
- },
7
+ import { UAvatar } from "./constants.ts";
8
+ import defaultConfig from "./config.ts";
9
+ import useAttrs from "./useAttrs.ts";
90
10
 
91
- /**
92
- * Avatar corner rounding.
93
- * @values dynamic, none, sm, md, lg, full
94
- */
95
- rounded: {
96
- type: String,
97
- default: getDefault(defaultConfig, UAvatar).rounded,
98
- },
11
+ import type { UAvatarProps } from "./types.ts";
99
12
 
100
- /**
101
- * Add border to the avatar.
102
- */
103
- bordered: {
104
- type: Boolean,
105
- default: getDefault(defaultConfig, UAvatar).bordered,
106
- },
107
-
108
- /**
109
- * Component config object.
110
- */
111
- config: {
112
- type: Object,
113
- default: () => ({}),
114
- },
13
+ defineOptions({ inheritAttrs: false });
115
14
 
116
- /**
117
- * Data-test attribute for automated testing.
118
- */
119
- dataTest: {
120
- type: String,
121
- default: "",
122
- },
15
+ const props = withDefaults(defineProps<UAvatarProps>(), {
16
+ placeholderIcon: getDefault<UAvatarProps>(defaultConfig, UAvatar).placeholderIcon,
17
+ size: getDefault<UAvatarProps>(defaultConfig, UAvatar).size,
18
+ color: getDefault<UAvatarProps>(defaultConfig, UAvatar).color,
19
+ rounded: getDefault<UAvatarProps>(defaultConfig, UAvatar).rounded,
20
+ bordered: getDefault<UAvatarProps>(defaultConfig, UAvatar).bordered,
21
+ dataTest: "",
123
22
  });
124
23
 
125
24
  const emit = defineEmits([
@@ -132,6 +31,8 @@ const emit = defineEmits([
132
31
  const { avatarAttrs, placeholderIconAttrs } = useAttrs(props);
133
32
 
134
33
  const labelFirstLetters = computed(() => {
34
+ if (!props.label) return "";
35
+
135
36
  const [firstWord, secondWord] = props.label.split(" ");
136
37
 
137
38
  const firstWordLetter = firstWord ? firstWord[0].toUpperCase() : "";
@@ -151,7 +52,42 @@ const componentColor = computed(() => {
151
52
  return props.color === "white" ? "grayscale" : props.color;
152
53
  });
153
54
 
154
- function onClick(event) {
55
+ function onClick(event: Event) {
155
56
  emit("click", event);
156
57
  }
157
58
  </script>
59
+
60
+ <template>
61
+ <div
62
+ :title="label"
63
+ :style="backgroundImage"
64
+ :data-test="dataTest"
65
+ v-bind="avatarAttrs"
66
+ @click="onClick"
67
+ >
68
+ <template v-if="!backgroundImage">
69
+ <template v-if="labelFirstLetters">{{ labelFirstLetters }}</template>
70
+ <!--
71
+ @slot Use it to add something instead of the avatar image placeholder.
72
+ @binding {string} icon-name
73
+ @binding {string} icon-color
74
+ @binding {string} icon-size
75
+ -->
76
+ <slot
77
+ v-else
78
+ name="placeholder"
79
+ :icon-name="placeholderIcon"
80
+ :icon-color="componentColor"
81
+ :icon-size="size"
82
+ >
83
+ <UIcon
84
+ internal
85
+ :size="size"
86
+ :color="componentColor"
87
+ :name="placeholderIcon"
88
+ v-bind="placeholderIconAttrs"
89
+ />
90
+ </slot>
91
+ </template>
92
+ </div>
93
+ </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 URow from "../../ui.container-row/URow.vue";
5
5
  import UCol from "../../ui.container-col/UCol.vue";
6
6
  import ULoader from "../../ui.loader/ULoader.vue";
7
7
 
8
+ import type { Meta, StoryFn } from "@storybook/vue3";
9
+ import type { UAvatarProps } from "../types.ts";
10
+
11
+ interface UAvatarArgs extends UAvatarProps {
12
+ slotTemplate?: string;
13
+ enum: "size" | "rounded" | "color";
14
+ }
15
+
8
16
  /**
9
17
  * The `UAvatar` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.image-avatar)
10
18
  */
@@ -15,9 +23,9 @@ export default {
15
23
  argTypes: {
16
24
  ...getArgTypes(UAvatar.__name),
17
25
  },
18
- };
26
+ } as Meta;
19
27
 
20
- const DefaultTemplate = (args) => ({
28
+ const DefaultTemplate: StoryFn<UAvatarArgs> = (args: UAvatarArgs) => ({
21
29
  components: { UAvatar, ULoader },
22
30
  setup() {
23
31
  const slots = getSlotNames(UAvatar.__name);
@@ -26,17 +34,17 @@ const DefaultTemplate = (args) => ({
26
34
  },
27
35
  template: `
28
36
  <UAvatar v-bind="args">
29
- ${args.slotTemplate || getSlotsFragment()}
37
+ ${args.slotTemplate || getSlotsFragment("")}
30
38
  </UAvatar>
31
39
  `,
32
40
  });
33
41
 
34
- const EnumVariantTemplate = (args, { argTypes }) => ({
42
+ const EnumVariantTemplate: StoryFn<UAvatarArgs> = (args: UAvatarArgs, { argTypes }) => ({
35
43
  components: { UCol, URow, UAvatar },
36
44
  setup() {
37
45
  return {
38
46
  args,
39
- options: argTypes[args.enum].options,
47
+ options: argTypes?.[args.enum]?.options,
40
48
  };
41
49
  },
42
50
  template: `
@@ -0,0 +1,71 @@
1
+ import defaultConfig from "./config.ts";
2
+
3
+ export type Config = Partial<typeof defaultConfig>;
4
+
5
+ export interface UAvatarProps {
6
+ /**
7
+ * Avatar image source.
8
+ */
9
+ src?: string;
10
+
11
+ /**
12
+ * Avatar label (username, nickname, etc.).
13
+ */
14
+ label?: string;
15
+
16
+ /**
17
+ * Avatar placeholder icon.
18
+ */
19
+ placeholderIcon?: string;
20
+
21
+ /**
22
+ * Avatar size.
23
+ */
24
+ size?: "3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl";
25
+
26
+ /**
27
+ * Avatar color.
28
+ */
29
+ color?:
30
+ | "brand"
31
+ | "grayscale"
32
+ | "gray"
33
+ | "red"
34
+ | "orange"
35
+ | "amber"
36
+ | "yellow"
37
+ | "lime"
38
+ | "green"
39
+ | "emerald"
40
+ | "teal"
41
+ | "cyan"
42
+ | "sky"
43
+ | "blue"
44
+ | "indigo"
45
+ | "violet"
46
+ | "purple"
47
+ | "fuchsia"
48
+ | "pink"
49
+ | "rose"
50
+ | "white";
51
+
52
+ /**
53
+ * Avatar corner rounding.
54
+ */
55
+ rounded?: "dynamic" | "none" | "sm" | "md" | "lg" | "full";
56
+
57
+ /**
58
+ * Add border to the avatar.
59
+ */
60
+ bordered?: boolean;
61
+
62
+ /**
63
+ * Component config object.
64
+ */
65
+ config?: Partial<typeof defaultConfig>;
66
+
67
+ /**
68
+ * Data-test attribute for automated testing.
69
+ */
70
+ dataTest?: string;
71
+ }
@@ -0,0 +1,18 @@
1
+ import useUI from "../composables/useUI.ts";
2
+
3
+ import defaultConfig from "./config.ts";
4
+
5
+ import type { UseAttrs } from "../types.ts";
6
+ import type { UAvatarProps, Config } from "./types.ts";
7
+
8
+ export default function useAttrs(props: UAvatarProps): UseAttrs<Config> {
9
+ const { config, getKeysAttrs, hasSlotContent } = useUI<Config>(defaultConfig, () => props.config);
10
+
11
+ const keysAttrs = getKeysAttrs();
12
+
13
+ return {
14
+ config,
15
+ ...keysAttrs,
16
+ hasSlotContent,
17
+ };
18
+ }
@@ -1,120 +1,24 @@
1
- <template>
2
- <component
3
- :is="dynamicComponent"
4
- v-tooltip="tooltipConfig"
5
- tabindex="-1"
6
- v-bind="iconAttrs"
7
- :data-test="dataTest"
8
- @click="onClick"
9
- />
10
- </template>
11
-
12
- <script setup>
1
+ <script lang="ts" setup>
13
2
  import { computed, defineAsyncComponent } from "vue";
14
3
  import { vTooltip } from "../directives";
15
4
  import { getDefault } from "../utils/ui.ts";
16
5
  import { isSSR } from "../utils/helper.ts";
17
6
  import { VUELESS_ICONS_CACHED_DIR, VUELESS_LIBRARY } from "../constants.js";
18
7
 
19
- import { UIcon } from "./constants.js";
8
+ import { UIcon } from "./constants.ts";
20
9
  import defaultConfig from "./config.ts";
21
- import useAttrs from "./useAttrs.js";
22
-
23
- defineOptions({ inheritAttrs: false });
24
-
25
- const props = defineProps({
26
- /**
27
- * Icon name.
28
- */
29
- name: {
30
- type: String,
31
- default: "",
32
- },
33
-
34
- /**
35
- * Icon source (svg as a vue component).
36
- */
37
- src: {
38
- type: Object,
39
- default: () => {},
40
- },
41
-
42
- /**
43
- * Icon color.
44
- * @values brand, grayscale, gray, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose, black, white
45
- */
46
- color: {
47
- type: String,
48
- default: getDefault(defaultConfig, UIcon).color,
49
- },
10
+ import useAttrs from "./useAttrs.ts";
50
11
 
51
- /**
52
- * Icon size.
53
- * @values 4xs, 3xs, 2xs, xs, sm, md, lg, xl, 2xl, 3xl, 4xl, 5xl
54
- */
55
- size: {
56
- type: String,
57
- default: getDefault(defaultConfig, UIcon).size,
58
- },
12
+ import type { UIconProps } from "./types.ts";
59
13
 
60
- /**
61
- * Icon variant.
62
- * @values light, default, dark
63
- */
64
- variant: {
65
- type: String,
66
- default: getDefault(defaultConfig, UIcon).variant,
67
- },
68
-
69
- /**
70
- * Make the icon interactive (cursor pointer, etc.).
71
- */
72
- interactive: {
73
- type: Boolean,
74
- default: getDefault(defaultConfig, UIcon).interactive,
75
- },
76
-
77
- /**
78
- * Add tooltip text on hover.
79
- */
80
- tooltip: {
81
- type: String,
82
- default: "",
83
- },
84
-
85
- /**
86
- * Tooltip settings.
87
- * [See all settings here](https://kabbouchi.github.io/vue-tippy/4.0/features/placement.html).
88
- */
89
- tooltipSettings: {
90
- type: Object,
91
- default: () => {},
92
- },
93
-
94
- /**
95
- * Component config object.
96
- */
97
- config: {
98
- type: Object,
99
- default: () => ({}),
100
- },
101
-
102
- /**
103
- * Data-test attribute for automated testing.
104
- */
105
- dataTest: {
106
- type: String,
107
- default: "",
108
- },
14
+ defineOptions({ inheritAttrs: false });
109
15
 
110
- /**
111
- * Mark that Icon used inside Vueless components (used to get icons from vueless library).
112
- * @ignore
113
- */
114
- internal: {
115
- type: Boolean,
116
- default: false,
117
- },
16
+ const props = withDefaults(defineProps<UIconProps>(), {
17
+ color: getDefault<UIconProps>(defaultConfig, UIcon).color,
18
+ size: getDefault<UIconProps>(defaultConfig, UIcon).size,
19
+ variant: getDefault<UIconProps>(defaultConfig, UIcon).variant,
20
+ interactive: getDefault<UIconProps>(defaultConfig, UIcon).interactive,
21
+ dataTest: "",
118
22
  });
119
23
 
120
24
  const emit = defineEmits([
@@ -144,11 +48,11 @@ const dynamicComponent = computed(() => {
144
48
  generatedIcons.value.find(([path]) => path.includes(VUELESS_LIBRARY + "/" + props.name)),
145
49
  );
146
50
 
147
- const userLibrary = config.value.defaults.library;
51
+ const userLibrary = config.value?.defaults?.library;
148
52
  const library = props.internal && isInternalIcon ? VUELESS_LIBRARY : userLibrary;
149
- const weight = config.value.defaults.weight;
150
- const style = config.value.defaults.style;
151
- const isFill = props.name.endsWith(FILL_SUFFIX);
53
+ const weight = config.value?.defaults?.weight;
54
+ const style = config.value?.defaults?.style;
55
+ const isFill = props.name?.endsWith(FILL_SUFFIX);
152
56
  const name = props.name;
153
57
  const src = props.src;
154
58
 
@@ -161,7 +65,7 @@ const dynamicComponent = computed(() => {
161
65
  /* Dynamic import */
162
66
  if (!name) return "";
163
67
 
164
- function getIcon(params) {
68
+ function getIcon(params: Array<string | number | undefined>) {
165
69
  const [, component] =
166
70
  generatedIcons.value.find(([path]) =>
167
71
  params.every(
@@ -216,7 +120,18 @@ const tooltipConfig = computed(() => ({
216
120
  content: props.tooltip,
217
121
  }));
218
122
 
219
- function onClick(event) {
123
+ function onClick(event: Event) {
220
124
  emit("click", event);
221
125
  }
222
126
  </script>
127
+
128
+ <template>
129
+ <component
130
+ :is="dynamicComponent"
131
+ v-tooltip="tooltipConfig"
132
+ tabindex="-1"
133
+ v-bind="iconAttrs"
134
+ :data-test="dataTest"
135
+ @click="onClick"
136
+ />
137
+ </template>
@@ -1,7 +1,7 @@
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";
4
+ import * as stories from "./stories.ts";
5
5
  import defaultConfig from "../config.ts?raw"
6
6
 
7
7
  <Meta of={stories} />
@@ -3,6 +3,14 @@ import { getArgTypes, getSlotNames, getSlotsFragment } from "../../utils/storybo
3
3
  import UIcon from "../../ui.image-icon/UIcon.vue";
4
4
  import URow from "../../ui.container-row/URow.vue";
5
5
 
6
+ import type { Meta, StoryFn } from "@storybook/vue3";
7
+ import type { UIconProps } from "../types.ts";
8
+
9
+ interface UIconArgs extends UIconProps {
10
+ slotTemplate?: string;
11
+ enum: "color" | "size" | "variant";
12
+ }
13
+
6
14
  /**
7
15
  * The `UIcon` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.image-icon)
8
16
  */
@@ -16,9 +24,9 @@ export default {
16
24
  argTypes: {
17
25
  ...getArgTypes(UIcon.__name),
18
26
  },
19
- };
27
+ } as Meta;
20
28
 
21
- const DefaultTemplate = (args) => ({
29
+ const DefaultTemplate: StoryFn<UIconArgs> = (args: UIconArgs) => ({
22
30
  components: { UIcon },
23
31
  setup() {
24
32
  const slots = getSlotNames(UIcon.__name);
@@ -27,17 +35,17 @@ const DefaultTemplate = (args) => ({
27
35
  },
28
36
  template: `
29
37
  <UIcon v-bind="args">
30
- ${args.slotTemplate || getSlotsFragment()}
38
+ ${args.slotTemplate || getSlotsFragment("")}
31
39
  </UIcon>
32
40
  `,
33
41
  });
34
42
 
35
- const EnumVariantTemplate = (args, { argTypes }) => ({
43
+ const EnumVariantTemplate: StoryFn<UIconArgs> = (args: UIconArgs, { argTypes }) => ({
36
44
  components: { UIcon, URow },
37
45
  setup() {
38
46
  return {
39
47
  args,
40
- options: argTypes[args.enum].options,
48
+ options: argTypes?.[args.enum]?.options,
41
49
  };
42
50
  },
43
51
  template: `
@@ -0,0 +1,83 @@
1
+ import defaultConfig from "./config.ts";
2
+
3
+ export type Config = Partial<typeof defaultConfig>;
4
+
5
+ export interface UIconProps {
6
+ /**
7
+ * Icon name.
8
+ */
9
+ name?: string;
10
+
11
+ /**
12
+ * Icon source (svg as a vue component).
13
+ */
14
+ src?: object;
15
+
16
+ /**
17
+ * Icon color.
18
+ */
19
+ color?:
20
+ | "brand"
21
+ | "grayscale"
22
+ | "gray"
23
+ | "red"
24
+ | "orange"
25
+ | "amber"
26
+ | "yellow"
27
+ | "lime"
28
+ | "green"
29
+ | "emerald"
30
+ | "teal"
31
+ | "cyan"
32
+ | "sky"
33
+ | "blue"
34
+ | "indigo"
35
+ | "violet"
36
+ | "purple"
37
+ | "fuchsia"
38
+ | "pink"
39
+ | "rose"
40
+ | "black"
41
+ | "white";
42
+
43
+ /**
44
+ * Icon size.
45
+ */
46
+ size?: "4xs" | "3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl";
47
+
48
+ /**
49
+ * Icon variant.
50
+ */
51
+ variant?: "light" | "default" | "dark";
52
+
53
+ /**
54
+ * Make the icon interactive (cursor pointer, etc.).
55
+ */
56
+ interactive?: boolean;
57
+
58
+ /**
59
+ * Add tooltip text on hover.
60
+ */
61
+ tooltip?: string;
62
+
63
+ /**
64
+ * Tooltip settings.
65
+ * [See all settings here](https://kabbouchi.github.io/vue-tippy/4.0/features/placement.html).
66
+ */
67
+ tooltipSettings?: object;
68
+
69
+ /**
70
+ * Mark that Icon used inside Vueless components (used to get icons from vueless library).
71
+ */
72
+ internal?: boolean;
73
+
74
+ /**
75
+ * Component config object.
76
+ */
77
+ config?: Partial<typeof defaultConfig>;
78
+
79
+ /**
80
+ * Data-test attribute for automated testing.
81
+ */
82
+ dataTest?: string;
83
+ }