vueless 0.0.502 → 0.0.504

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 (80) hide show
  1. package/package.json +1 -1
  2. package/plugin-vite.d.ts +43 -11
  3. package/types.ts +25 -3
  4. package/ui.form-date-picker/UDatePicker.vue +1 -1
  5. package/ui.other-dot/UDot.vue +14 -42
  6. package/ui.other-dot/storybook/Docs.mdx +2 -2
  7. package/ui.other-dot/storybook/{stories.js → stories.ts} +13 -5
  8. package/ui.other-dot/types.ts +46 -0
  9. package/ui.other-dot/useAttrs.ts +18 -0
  10. package/ui.text-alert/UAlert.vue +85 -157
  11. package/ui.text-alert/storybook/Docs.mdx +2 -2
  12. package/ui.text-alert/storybook/{stories.js → stories.ts} +17 -9
  13. package/ui.text-alert/types.ts +76 -0
  14. package/ui.text-alert/useAttrs.ts +18 -0
  15. package/ui.text-badge/UBadge.vue +1 -0
  16. package/ui.text-badge/storybook/stories.ts +1 -8
  17. package/ui.text-badge/types.ts +2 -0
  18. package/ui.text-badge/useAttrs.ts +1 -3
  19. package/ui.text-block/UText.vue +1 -0
  20. package/ui.text-block/storybook/stories.ts +1 -1
  21. package/ui.text-block/types.ts +2 -0
  22. package/ui.text-block/useAttrs.ts +1 -1
  23. package/ui.text-empty/UEmpty.vue +39 -75
  24. package/ui.text-empty/storybook/Docs.mdx +2 -2
  25. package/ui.text-empty/storybook/{stories.js → stories.ts} +14 -6
  26. package/ui.text-empty/types.ts +30 -0
  27. package/ui.text-empty/useAttrs.ts +18 -0
  28. package/ui.text-file/UFile.vue +49 -109
  29. package/ui.text-file/storybook/Docs.mdx +2 -2
  30. package/ui.text-file/storybook/{stories.js → stories.ts} +10 -3
  31. package/ui.text-file/types.ts +45 -0
  32. package/ui.text-file/useAttrs.ts +18 -0
  33. package/ui.text-files/UFiles.vue +46 -106
  34. package/ui.text-files/storybook/Docs.mdx +2 -2
  35. package/ui.text-files/storybook/{stories.js → stories.ts} +10 -3
  36. package/ui.text-files/types.ts +45 -0
  37. package/ui.text-files/useAttrs.ts +18 -0
  38. package/ui.text-header/UHeader.vue +19 -76
  39. package/ui.text-header/storybook/Docs.mdx +2 -2
  40. package/ui.text-header/storybook/{stories.js → stories.ts} +13 -5
  41. package/ui.text-header/types.ts +66 -0
  42. package/ui.text-header/useAttrs.ts +18 -0
  43. package/ui.text-money/UMoney.vue +58 -168
  44. package/ui.text-money/storybook/Docs.mdx +2 -2
  45. package/ui.text-money/storybook/{stories.js → stories.ts} +13 -5
  46. package/ui.text-money/types.ts +101 -0
  47. package/ui.text-money/useAttrs.ts +18 -0
  48. package/ui.text-money/{utilMoney.js → utilMoney.ts} +1 -1
  49. package/ui.text-notify/UNotify.vue +89 -116
  50. package/ui.text-notify/storybook/Docs.mdx +2 -2
  51. package/ui.text-notify/storybook/{stories.js → stories.ts} +12 -5
  52. package/ui.text-notify/types.ts +25 -0
  53. package/ui.text-notify/useAttrs.ts +18 -0
  54. package/ui.text-notify/utilNotify.ts +140 -0
  55. package/web-types.json +152 -77
  56. package/ui.other-dot/useAttrs.js +0 -15
  57. package/ui.text-alert/useAttrs.js +0 -15
  58. package/ui.text-empty/useAttrs.js +0 -15
  59. package/ui.text-file/useAttrs.js +0 -15
  60. package/ui.text-files/useAttrs.js +0 -15
  61. package/ui.text-header/useAttrs.js +0 -15
  62. package/ui.text-money/useAttrs.js +0 -15
  63. package/ui.text-notify/useAttrs.js +0 -15
  64. package/ui.text-notify/utilNotify.js +0 -86
  65. /package/ui.other-dot/{config.js → config.ts} +0 -0
  66. /package/ui.other-dot/{constants.js → constants.ts} +0 -0
  67. /package/ui.text-alert/{config.js → config.ts} +0 -0
  68. /package/ui.text-alert/{constants.js → constants.ts} +0 -0
  69. /package/ui.text-empty/{config.js → config.ts} +0 -0
  70. /package/ui.text-empty/{constants.js → constants.ts} +0 -0
  71. /package/ui.text-file/{config.js → config.ts} +0 -0
  72. /package/ui.text-file/{constants.js → constants.ts} +0 -0
  73. /package/ui.text-files/{config.js → config.ts} +0 -0
  74. /package/ui.text-files/{constants.js → constants.ts} +0 -0
  75. /package/ui.text-header/{config.js → config.ts} +0 -0
  76. /package/ui.text-header/{constants.js → constants.ts} +0 -0
  77. /package/ui.text-money/{config.js → config.ts} +0 -0
  78. /package/ui.text-money/{constants.js → constants.ts} +0 -0
  79. /package/ui.text-notify/{config.js → config.ts} +0 -0
  80. /package/ui.text-notify/{constants.js → constants.ts} +0 -0
@@ -0,0 +1,45 @@
1
+ import defaultConfig from "./config.ts";
2
+
3
+ export type Config = Partial<typeof defaultConfig>;
4
+
5
+ export interface UFileProps {
6
+ /**
7
+ * File url.
8
+ */
9
+ url?: string;
10
+
11
+ /**
12
+ * Image url.
13
+ */
14
+ imageUrl?: string;
15
+
16
+ /**
17
+ * File label.
18
+ */
19
+ label?: string;
20
+
21
+ /**
22
+ * File size.
23
+ */
24
+ size?: "sm" | "md" | "lg";
25
+
26
+ /**
27
+ * Unique element id.
28
+ */
29
+ id?: string;
30
+
31
+ /**
32
+ * Show remove button.
33
+ */
34
+ removable?: boolean;
35
+
36
+ /**
37
+ * Component config object.
38
+ */
39
+ config?: Partial<typeof defaultConfig>;
40
+
41
+ /**
42
+ * Data-test attribute for automated testing.
43
+ */
44
+ dataTest?: string;
45
+ }
@@ -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 { UFileProps, Config } from "./types.ts";
7
+
8
+ export default function useAttrs(props: UFileProps): 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,3 +1,49 @@
1
+ <script lang="ts" setup>
2
+ import UFile from "../ui.text-file/UFile.vue";
3
+ import ULabel from "../ui.form-label/ULabel.vue";
4
+ import { getDefault } from "../utils/ui.ts";
5
+
6
+ import { UFiles } from "./constants.ts";
7
+ import defaultConfig from "./config.ts";
8
+ import useAttrs from "./useAttrs.ts";
9
+ import { computed } from "vue";
10
+
11
+ import type { UFilesProps } from "./types.ts";
12
+
13
+ defineOptions({ inheritAttrs: false });
14
+
15
+ const props = withDefaults(defineProps<UFilesProps>(), {
16
+ labelAlign: getDefault<UFilesProps>(defaultConfig, UFiles).labelAlign,
17
+ size: getDefault<UFilesProps>(defaultConfig, UFiles).size,
18
+ dataTest: "",
19
+ });
20
+
21
+ const emit = defineEmits([
22
+ /**
23
+ * Triggers when remove button is clicked.
24
+ * @property {string} fileId
25
+ */
26
+ "remove",
27
+ ]);
28
+
29
+ const { filesLabelAttrs, itemsAttrs, itemAttrs } = useAttrs(props);
30
+
31
+ const formattedFileList = computed(() =>
32
+ props.fileList.map((file) => {
33
+ return {
34
+ id: file.name,
35
+ label: file.name,
36
+ url: URL.createObjectURL(file),
37
+ imageUrl: file.type.includes("image") ? URL.createObjectURL(file) : undefined,
38
+ };
39
+ }),
40
+ );
41
+
42
+ function onRemoveFile(fileId) {
43
+ emit("remove", fileId);
44
+ }
45
+ </script>
46
+
1
47
  <template>
2
48
  <ULabel
3
49
  :label="label"
@@ -42,109 +88,3 @@
42
88
  </div>
43
89
  </ULabel>
44
90
  </template>
45
-
46
- <script setup>
47
- import UFile from "../ui.text-file/UFile.vue";
48
- import ULabel from "../ui.form-label/ULabel.vue";
49
- import { getDefault } from "../utils/ui.ts";
50
-
51
- import { UFiles } from "./constants.js";
52
- import defaultConfig from "./config.js";
53
- import useAttrs from "./useAttrs.js";
54
- import { computed } from "vue";
55
-
56
- defineOptions({ inheritAttrs: false });
57
-
58
- const props = defineProps({
59
- /**
60
- * List of file objects.
61
- */
62
- fileList: {
63
- type: Array,
64
- default: () => [],
65
- },
66
-
67
- /**
68
- * File list label.
69
- */
70
- label: {
71
- type: String,
72
- default: "",
73
- },
74
-
75
- /**
76
- * File list label placement.
77
- * @values top, topWithDesc
78
- */
79
- labelAlign: {
80
- type: String,
81
- default: getDefault(defaultConfig, UFiles).labelAlign,
82
- },
83
-
84
- /**
85
- * File list description.
86
- */
87
- description: {
88
- type: String,
89
- default: "",
90
- },
91
-
92
- /**
93
- * File list size.
94
- * @values sm, md, lg
95
- */
96
- size: {
97
- type: String,
98
- default: getDefault(defaultConfig, UFiles).size,
99
- },
100
-
101
- /**
102
- * Show remove button for each file
103
- */
104
- removable: {
105
- type: Boolean,
106
- default: false,
107
- },
108
-
109
- /**
110
- * Component config object.
111
- */
112
- config: {
113
- type: Object,
114
- default: () => ({}),
115
- },
116
-
117
- /**
118
- * Data-test attribute for automated testing.
119
- */
120
- dataTest: {
121
- type: String,
122
- default: "",
123
- },
124
- });
125
-
126
- const emit = defineEmits([
127
- /**
128
- * Triggers when remove button is clicked.
129
- * @property {string} fileId
130
- */
131
- "remove",
132
- ]);
133
-
134
- const { filesLabelAttrs, itemsAttrs, itemAttrs } = useAttrs(props);
135
-
136
- const formattedFileList = computed(() =>
137
- props.fileList.map((file) => {
138
- return {
139
- id: file.name,
140
- label: file.name,
141
- url: URL.createObjectURL(file),
142
- imageUrl: file.type.includes("image") ? URL.createObjectURL(file) : undefined,
143
- };
144
- }),
145
- );
146
-
147
- function onRemoveFile(fileId) {
148
- emit("remove", fileId);
149
- }
150
- </script>
@@ -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} />
@@ -2,6 +2,13 @@ import { getArgTypes, getSlotNames, getSlotsFragment } from "../../utils/storybo
2
2
 
3
3
  import UFiles from "../../ui.text-files/UFiles.vue";
4
4
 
5
+ import type { Meta, StoryFn } from "@storybook/vue3";
6
+ import type { UFilesProps } from "../types.ts";
7
+
8
+ interface UFilesArgs extends UFilesProps {
9
+ slotTemplate?: string;
10
+ }
11
+
5
12
  /**
6
13
  * The `UFiles` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.text-files)
7
14
  */
@@ -19,9 +26,9 @@ export default {
19
26
  argTypes: {
20
27
  ...getArgTypes(UFiles.__name),
21
28
  },
22
- };
29
+ } as Meta;
23
30
 
24
- const DefaultTemplate = (args) => ({
31
+ const DefaultTemplate: StoryFn<UFilesArgs> = (args: UFilesArgs) => ({
25
32
  components: { UFiles },
26
33
  setup() {
27
34
  const slots = getSlotNames(UFiles.__name);
@@ -30,7 +37,7 @@ const DefaultTemplate = (args) => ({
30
37
  },
31
38
  template: `
32
39
  <UFiles v-bind="args">
33
- ${args.slotTemplate || getSlotsFragment()}
40
+ ${args.slotTemplate || getSlotsFragment("")}
34
41
  </UFiles>
35
42
  `,
36
43
  });
@@ -0,0 +1,45 @@
1
+ import defaultConfig from "./config.ts";
2
+
3
+ export type Config = Partial<typeof defaultConfig>;
4
+
5
+ export interface UFilesProps {
6
+ /**
7
+ * List of file objects.
8
+ */
9
+ fileList?: Array<object>;
10
+
11
+ /**
12
+ * File list label.
13
+ */
14
+ label?: string;
15
+
16
+ /**
17
+ * File list label placement.
18
+ */
19
+ labelAlign?: "top" | "topWithDesc";
20
+
21
+ /**
22
+ * File list description.
23
+ */
24
+ description?: string;
25
+
26
+ /**
27
+ * File list size.
28
+ */
29
+ size?: "sm" | "md" | "lg";
30
+
31
+ /**
32
+ * Show remove button for each file
33
+ */
34
+ removable?: boolean;
35
+
36
+ /**
37
+ * Component config object.
38
+ */
39
+ config?: Partial<typeof defaultConfig>;
40
+
41
+ /**
42
+ * Data-test attribute for automated testing.
43
+ */
44
+ dataTest?: string;
45
+ }
@@ -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 { UFilesProps, Config } from "./types.ts";
7
+
8
+ export default function useAttrs(props: UFilesProps): 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,85 +1,28 @@
1
- <template>
2
- <component :is="tag" v-bind="headerAttrs" :data-test="dataTest">
3
- <slot>{{ label }}</slot>
4
- </component>
5
- </template>
6
-
7
- <script setup>
1
+ <script lang="ts" setup>
8
2
  import { getDefault } from "../utils/ui.ts";
9
3
 
10
- import { UHeader } from "./constants.js";
11
- import defaultConfig from "./config.js";
12
- import useAttrs from "./useAttrs.js";
13
-
14
- defineOptions({ inheritAttrs: false });
15
-
16
- const props = defineProps({
17
- /**
18
- * Header label.
19
- */
20
- label: {
21
- type: String,
22
- default: "",
23
- },
24
-
25
- /**
26
- * Header size.
27
- * @values xs, sm, md, lg, xl, 2xl
28
- */
29
- size: {
30
- type: String,
31
- default: getDefault(defaultConfig, UHeader).size,
32
- },
4
+ import { UHeader } from "./constants.ts";
5
+ import defaultConfig from "./config.ts";
6
+ import useAttrs from "./useAttrs.ts";
33
7
 
34
- /**
35
- * Header color.
36
- * @values brand, grayscale, gray, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose, white
37
- */
38
- color: {
39
- type: String,
40
- default: getDefault(defaultConfig, UHeader).color,
41
- },
8
+ import type { UHeaderProps } from "./types.ts";
42
9
 
43
- /**
44
- * Allows changing HTML tag.
45
- */
46
- tag: {
47
- type: String,
48
- default: getDefault(defaultConfig, UHeader).tag,
49
- },
50
-
51
- /**
52
- * Removes text line height (disable for multiline headers).
53
- */
54
- line: {
55
- type: Boolean,
56
- default: getDefault(defaultConfig, UHeader).line,
57
- },
58
-
59
- /**
60
- * Show the underline.
61
- */
62
- underlined: {
63
- type: Boolean,
64
- default: getDefault(defaultConfig, UHeader).underlined,
65
- },
66
-
67
- /**
68
- * Component config object.
69
- */
70
- config: {
71
- type: Object,
72
- default: () => ({}),
73
- },
10
+ defineOptions({ inheritAttrs: false });
74
11
 
75
- /**
76
- * Data-test attribute for automated testing.
77
- */
78
- dataTest: {
79
- type: String,
80
- default: "",
81
- },
12
+ const props = withDefaults(defineProps<UHeaderProps>(), {
13
+ size: getDefault<UHeaderProps>(defaultConfig, UHeader).size,
14
+ color: getDefault<UHeaderProps>(defaultConfig, UHeader).color,
15
+ tag: getDefault<UHeaderProps>(defaultConfig, UHeader).tag,
16
+ line: getDefault<UHeaderProps>(defaultConfig, UHeader).line,
17
+ underlined: getDefault<UHeaderProps>(defaultConfig, UHeader).underlined,
18
+ dataTest: "",
82
19
  });
83
20
 
84
21
  const { headerAttrs } = useAttrs(props);
85
22
  </script>
23
+
24
+ <template>
25
+ <component :is="tag" v-bind="headerAttrs" :data-test="dataTest">
26
+ <slot>{{ label }}</slot>
27
+ </component>
28
+ </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 UHeader from "../../ui.text-header/UHeader.vue";
4
4
  import UCol from "../../ui.container-col/UCol.vue";
5
5
 
6
+ import type { Meta, StoryFn } from "@storybook/vue3";
7
+ import type { UHeaderProps } from "../types.ts";
8
+
9
+ interface UHeaderArgs extends UHeaderProps {
10
+ slotTemplate?: string;
11
+ enum: "size" | "color";
12
+ }
13
+
6
14
  /**
7
15
  * The `UHeader` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.text-header)
8
16
  */
@@ -16,9 +24,9 @@ export default {
16
24
  argTypes: {
17
25
  ...getArgTypes(UHeader.__name),
18
26
  },
19
- };
27
+ } as Meta;
20
28
 
21
- const DefaultTemplate = (args) => ({
29
+ const DefaultTemplate: StoryFn<UHeaderArgs> = (args: UHeaderArgs) => ({
22
30
  components: { UHeader },
23
31
  setup() {
24
32
  const slots = getSlotNames(UHeader.__name);
@@ -27,17 +35,17 @@ const DefaultTemplate = (args) => ({
27
35
  },
28
36
  template: `
29
37
  <UHeader v-bind="args">
30
- ${args.slotTemplate || getSlotsFragment()}
38
+ ${args.slotTemplate || getSlotsFragment("")}
31
39
  </UHeader>
32
40
  `,
33
41
  });
34
42
 
35
- const EnumVariantTemplate = (args, { argTypes }) => ({
43
+ const EnumVariantTemplate: StoryFn<UHeaderArgs> = (args: UHeaderArgs, { argTypes }) => ({
36
44
  components: { UHeader, UCol },
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,66 @@
1
+ import defaultConfig from "./config.ts";
2
+
3
+ export type Config = Partial<typeof defaultConfig>;
4
+
5
+ export interface UHeaderProps {
6
+ /**
7
+ * Header label.
8
+ */
9
+ label?: string;
10
+
11
+ /**
12
+ * Header size.
13
+ */
14
+ size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
15
+
16
+ /**
17
+ * Header 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
+ | "white";
41
+
42
+ /**
43
+ * Allows changing HTML tag.
44
+ */
45
+ tag?: string;
46
+
47
+ /**
48
+ * Removes text line height (disable for multiline headers).
49
+ */
50
+ line?: boolean;
51
+
52
+ /**
53
+ * Show the underline.
54
+ */
55
+ underlined?: boolean;
56
+
57
+ /**
58
+ * Component config object.
59
+ */
60
+ config?: Partial<typeof defaultConfig>;
61
+
62
+ /**
63
+ * Data-test attribute for automated testing.
64
+ */
65
+ dataTest?: string;
66
+ }
@@ -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 { UHeaderProps, Config } from "./types.ts";
7
+
8
+ export default function useAttrs(props: UHeaderProps): 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
+ }