vueless 0.0.513 → 0.0.514

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 (74) hide show
  1. package/package.json +1 -1
  2. package/types.ts +18 -0
  3. package/ui.button-link/types.ts +3 -1
  4. package/ui.container-accordion/UAccordion.vue +33 -69
  5. package/ui.container-accordion/storybook/Docs.mdx +2 -2
  6. package/ui.container-accordion/storybook/{stories.js → stories.ts} +10 -3
  7. package/ui.container-accordion/types.ts +35 -0
  8. package/ui.container-accordion/{useAttrs.js → useAttrs.ts} +14 -3
  9. package/ui.container-card/UCard.vue +43 -71
  10. package/ui.container-card/storybook/Docs.mdx +2 -2
  11. package/ui.container-card/storybook/{stories.js → stories.ts} +9 -2
  12. package/ui.container-card/types.ts +25 -0
  13. package/ui.container-card/useAttrs.ts +18 -0
  14. package/ui.container-col/UCol.vue +21 -79
  15. package/ui.container-col/storybook/Docs.mdx +2 -2
  16. package/ui.container-col/storybook/{stories.js → stories.ts} +9 -2
  17. package/ui.container-col/types.ts +54 -0
  18. package/ui.container-col/useAttrs.ts +18 -0
  19. package/ui.container-divider/UDivider.vue +22 -94
  20. package/ui.container-divider/storybook/Docs.mdx +2 -2
  21. package/ui.container-divider/storybook/{stories.js → stories.ts} +13 -5
  22. package/ui.container-divider/types.ts +55 -0
  23. package/ui.container-divider/useAttrs.ts +23 -0
  24. package/ui.container-group/UGroup.vue +31 -73
  25. package/ui.container-group/storybook/Docs.mdx +2 -2
  26. package/ui.container-group/storybook/{stories.js → stories.ts} +9 -2
  27. package/ui.container-group/types.ts +36 -0
  28. package/ui.container-group/useAttrs.ts +18 -0
  29. package/ui.container-modal/UModal.vue +122 -232
  30. package/ui.container-modal/storybook/Docs.mdx +2 -2
  31. package/ui.container-modal/storybook/{stories.js → stories.ts} +16 -6
  32. package/ui.container-modal/types.ts +82 -0
  33. package/ui.container-modal/useAttrs.ts +22 -0
  34. package/ui.container-modal-confirm/UModalConfirm.vue +82 -199
  35. package/ui.container-modal-confirm/storybook/Docs.mdx +2 -2
  36. package/ui.container-modal-confirm/storybook/{stories.js → stories.ts} +14 -3
  37. package/ui.container-modal-confirm/types.ts +106 -0
  38. package/ui.container-modal-confirm/useAttrs.ts +18 -0
  39. package/ui.container-page/UPage.vue +79 -153
  40. package/ui.container-page/storybook/Docs.mdx +2 -2
  41. package/ui.container-page/storybook/{stories.js → stories.ts} +9 -2
  42. package/ui.container-page/types.ts +57 -0
  43. package/ui.container-page/{useAttrs.js → useAttrs.ts} +14 -3
  44. package/ui.container-row/URow.vue +22 -87
  45. package/ui.container-row/storybook/Docs.mdx +2 -2
  46. package/ui.container-row/storybook/{stories.js → stories.ts} +11 -3
  47. package/ui.container-row/types.ts +59 -0
  48. package/ui.container-row/useAttrs.ts +18 -0
  49. package/web-types.json +182 -92
  50. package/ui.container-card/useAttrs.js +0 -15
  51. package/ui.container-col/useAttrs.js +0 -15
  52. package/ui.container-divider/useAttrs.js +0 -20
  53. package/ui.container-group/useAttrs.js +0 -15
  54. package/ui.container-modal/useAttrs.js +0 -19
  55. package/ui.container-modal-confirm/useAttrs.js +0 -15
  56. package/ui.container-row/useAttrs.js +0 -15
  57. /package/ui.container-accordion/{config.js → config.ts} +0 -0
  58. /package/ui.container-accordion/{constants.js → constants.ts} +0 -0
  59. /package/ui.container-card/{config.js → config.ts} +0 -0
  60. /package/ui.container-card/{constants.js → constants.ts} +0 -0
  61. /package/ui.container-col/{config.js → config.ts} +0 -0
  62. /package/ui.container-col/{constants.js → constants.ts} +0 -0
  63. /package/ui.container-divider/{config.js → config.ts} +0 -0
  64. /package/ui.container-divider/{constants.js → constants.ts} +0 -0
  65. /package/ui.container-group/{config.js → config.ts} +0 -0
  66. /package/ui.container-group/{constants.js → constants.ts} +0 -0
  67. /package/ui.container-modal/{config.js → config.ts} +0 -0
  68. /package/ui.container-modal/{constants.js → constants.ts} +0 -0
  69. /package/ui.container-modal-confirm/{config.js → config.ts} +0 -0
  70. /package/ui.container-modal-confirm/{constants.js → constants.ts} +0 -0
  71. /package/ui.container-page/{config.js → config.ts} +0 -0
  72. /package/ui.container-page/{constants.js → constants.ts} +0 -0
  73. /package/ui.container-row/{config.js → config.ts} +0 -0
  74. /package/ui.container-row/{constants.js → constants.ts} +0 -0
@@ -9,6 +9,13 @@ import UButton from "../../ui.button/UButton.vue";
9
9
  import UIcon from "../../ui.image-icon/UIcon.vue";
10
10
  import UHeader from "../../ui.text-header/UHeader.vue";
11
11
 
12
+ import type { Meta, StoryFn } from "@storybook/vue3";
13
+ import type { UPageProps } from "../types.ts";
14
+
15
+ interface UPageArgs extends UPageProps {
16
+ slotTemplate?: string;
17
+ }
18
+
12
19
  /**
13
20
  * The `UPage` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.container-page)
14
21
  */
@@ -23,7 +30,7 @@ export default {
23
30
  argTypes: {
24
31
  ...getArgTypes(UPage.__name),
25
32
  },
26
- };
33
+ } as Meta;
27
34
 
28
35
  const defaultTemplate = `
29
36
  <UCard title="Card title">
@@ -35,7 +42,7 @@ const defaultTemplate = `
35
42
  </UCard>
36
43
  `;
37
44
 
38
- const DefaultTemplate = (args) => ({
45
+ const DefaultTemplate: StoryFn<UPageArgs> = (args: UPageArgs) => ({
39
46
  components: {
40
47
  UPage,
41
48
  UCard,
@@ -0,0 +1,57 @@
1
+ import defaultConfig from "./config.ts";
2
+
3
+ import type { RouteLocationRaw } from "vue-router";
4
+
5
+ export type Config = Partial<typeof defaultConfig>;
6
+
7
+ export interface UPageProps {
8
+ /**
9
+ * Page size (width).
10
+ */
11
+ size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "wide";
12
+
13
+ /**
14
+ * Page title.
15
+ */
16
+ title?: string;
17
+
18
+ /**
19
+ * Page title size.
20
+ */
21
+ titleSize?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
22
+
23
+ /**
24
+ * Set page description.
25
+ */
26
+ description?: string;
27
+
28
+ /**
29
+ * Back link vue-router route object.
30
+ */
31
+ backTo?: RouteLocationRaw;
32
+
33
+ /**
34
+ * Back link label.
35
+ */
36
+ backLabel?: string;
37
+
38
+ /**
39
+ * Sets background light gray (useful if the page contains nested cards).
40
+ */
41
+ gray?: boolean;
42
+
43
+ /**
44
+ * Stick right page rounding.
45
+ */
46
+ fixedRounding?: boolean;
47
+
48
+ /**
49
+ * Component config object.
50
+ */
51
+ config?: Partial<typeof defaultConfig>;
52
+
53
+ /**
54
+ * Data-test attribute for automated testing.
55
+ */
56
+ dataTest?: string;
57
+ }
@@ -2,10 +2,21 @@ import { computed } from "vue";
2
2
  import useUI from "../composables/useUI.ts";
3
3
  import { isMobileApp } from "../utils/platform.ts";
4
4
 
5
- import defaultConfig from "./config.js";
5
+ import defaultConfig from "./config.ts";
6
6
 
7
- export default function useAttrs(props, { isMobileBreakpoint }) {
8
- const { config, getKeysAttrs, hasSlotContent, getExtendingKeysClasses } = useUI(
7
+ import type { Ref } from "vue";
8
+ import type { UseAttrs } from "../types.ts";
9
+ import type { UPageProps, Config } from "./types.ts";
10
+
11
+ type ComponentState = {
12
+ isMobileBreakpoint: Ref<boolean>;
13
+ };
14
+
15
+ export default function useAttrs(
16
+ props: UPageProps,
17
+ { isMobileBreakpoint }: ComponentState,
18
+ ): UseAttrs<Config> {
19
+ const { config, getKeysAttrs, hasSlotContent, getExtendingKeysClasses } = useUI<Config>(
9
20
  defaultConfig,
10
21
  () => props.config,
11
22
  "wrapper",
@@ -1,96 +1,31 @@
1
- <template>
2
- <div v-bind="wrapperAttrs" :data-test="dataTest">
3
- <!-- @slot Use it to add something inside. -->
4
- <slot />
5
- </div>
6
- </template>
7
-
8
- <script setup>
1
+ <script lang="ts" setup>
9
2
  import { getDefault } from "../utils/ui.ts";
10
3
 
11
- import { URow } from "./constants.js";
12
- import defaultConfig from "./config.js";
13
- import useAttrs from "./useAttrs.js";
14
-
15
- defineOptions({ inheritAttrs: false });
16
-
17
- const props = defineProps({
18
- /**
19
- * The distance between nested elements.
20
- * @values none, 2xs, xs, sm, md, lg, xl, 2xl
21
- */
22
- gap: {
23
- type: String,
24
- default: getDefault(defaultConfig, URow).gap,
25
- },
26
-
27
- /**
28
- * Items vertical align (align-items).
29
- * @values start, end, center, stretch, baseline
30
- */
31
- align: {
32
- type: String,
33
- default: getDefault(defaultConfig, URow).align,
34
- },
35
-
36
- /**
37
- * Items vertical align for multi-row flex containers (align-content).
38
- * @values start, end, center, around, evenly, between, normal, stretch, baseline
39
- */
40
- content: {
41
- type: String,
42
- default: getDefault(defaultConfig, URow).content,
43
- },
4
+ import { URow } from "./constants.ts";
5
+ import defaultConfig from "./config.ts";
6
+ import useAttrs from "./useAttrs.ts";
44
7
 
45
- /**
46
- * Items horizontally align (justify-content).
47
- * @values start, end, center, around, evenly, between
48
- */
49
- justify: {
50
- type: String,
51
- default: getDefault(defaultConfig, URow).justify,
52
- },
8
+ import type { URowProps } from "./types.ts";
53
9
 
54
- /**
55
- * Reverse nested items order.
56
- */
57
- reverse: {
58
- type: Boolean,
59
- default: getDefault(defaultConfig, URow).reverse,
60
- },
61
-
62
- /**
63
- * Allow items to wrap (flex flex-wrap).
64
- */
65
- wrap: {
66
- type: Boolean,
67
- default: getDefault(defaultConfig, URow).wrap,
68
- },
69
-
70
- /**
71
- * Disables mobile adaptivity.
72
- */
73
- noMobile: {
74
- type: Boolean,
75
- default: getDefault(defaultConfig, URow).noMobile,
76
- },
77
-
78
- /**
79
- * Component config object.
80
- */
81
- config: {
82
- type: Object,
83
- default: () => ({}),
84
- },
10
+ defineOptions({ inheritAttrs: false });
85
11
 
86
- /**
87
- * Data-test attribute for automated testing.
88
- */
89
- dataTest: {
90
- type: String,
91
- default: "",
92
- },
12
+ const props = withDefaults(defineProps<URowProps>(), {
13
+ gap: getDefault<URowProps>(defaultConfig, URow).gap,
14
+ align: getDefault<URowProps>(defaultConfig, URow).align,
15
+ content: getDefault<URowProps>(defaultConfig, URow).content,
16
+ justify: getDefault<URowProps>(defaultConfig, URow).justify,
17
+ reverse: getDefault<URowProps>(defaultConfig, URow).reverse,
18
+ wrap: getDefault<URowProps>(defaultConfig, URow).wrap,
19
+ noMobile: getDefault<URowProps>(defaultConfig, URow).noMobile,
20
+ dataTest: "",
93
21
  });
94
22
 
95
23
  const { wrapperAttrs } = useAttrs(props);
96
24
  </script>
25
+
26
+ <template>
27
+ <div v-bind="wrapperAttrs" :data-test="dataTest">
28
+ <!-- @slot Use it to add something inside. -->
29
+ <slot />
30
+ </div>
31
+ </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 UInput from "../../ui.form-input/UInput.vue";
5
5
  import UCol from "../../ui.container-col/UCol.vue";
6
6
  import UButton from "../../ui.button/UButton.vue";
7
7
 
8
+ import type { Meta, StoryFn } from "@storybook/vue3";
9
+ import type { URowProps } from "../types.ts";
10
+
11
+ interface URowArgs extends URowProps {
12
+ slotTemplate?: string;
13
+ enum: "gap" | "align";
14
+ }
15
+
8
16
  /**
9
17
  * The `URow` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.container-row)
10
18
  */
@@ -15,14 +23,14 @@ export default {
15
23
  argTypes: {
16
24
  ...getArgTypes(URow.__name),
17
25
  },
18
- };
26
+ } as Meta;
19
27
 
20
28
  const defaultTemplate = `
21
29
  <UInput label="Name" />
22
30
  <UButton label="Submit" size="xs" block />
23
31
  `;
24
32
 
25
- const DefaultTemplate = (args) => ({
33
+ const DefaultTemplate: StoryFn<URowArgs> = (args: URowArgs) => ({
26
34
  components: { URow, UInput, UButton },
27
35
  setup() {
28
36
  const slots = getSlotNames(URow.__name);
@@ -36,7 +44,7 @@ const DefaultTemplate = (args) => ({
36
44
  `,
37
45
  });
38
46
 
39
- const EnumVariantTemplate = (args, { argTypes }) => ({
47
+ const EnumVariantTemplate: StoryFn<URowArgs> = (args: URowArgs, { argTypes }) => ({
40
48
  components: { UCol, URow, UInput, UButton },
41
49
  setup() {
42
50
  const isGapEnum = argTypes[args.enum].name === "gap";
@@ -0,0 +1,59 @@
1
+ import defaultConfig from "./config.ts";
2
+
3
+ export type Config = Partial<typeof defaultConfig>;
4
+
5
+ export interface URowProps {
6
+ /**
7
+ * The distance between nested elements.
8
+ */
9
+ gap?: "none" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
10
+
11
+ /**
12
+ * Items vertical align (align-items).
13
+ */
14
+ align?: "start" | "end" | "center" | "stretch" | "baseline";
15
+
16
+ /**
17
+ * Items vertical align for multi-row flex containers (align-content).
18
+ */
19
+ content?:
20
+ | "start"
21
+ | "end"
22
+ | "center"
23
+ | "around"
24
+ | "evenly"
25
+ | "between"
26
+ | "normal"
27
+ | "stretch"
28
+ | "baseline";
29
+
30
+ /**
31
+ * Items horizontally align (justify-content).
32
+ */
33
+ justify?: "start" | "end" | "center" | "around" | "evenly" | "between";
34
+
35
+ /**
36
+ * Reverse nested items order.
37
+ */
38
+ reverse?: boolean;
39
+
40
+ /**
41
+ * Allow items to wrap (flex flex-wrap).
42
+ */
43
+ wrap?: boolean;
44
+
45
+ /**
46
+ * Disables mobile adaptivity.
47
+ */
48
+ noMobile?: boolean;
49
+
50
+ /**
51
+ * Component config object.
52
+ */
53
+ config?: Partial<typeof defaultConfig>;
54
+
55
+ /**
56
+ * Data-test attribute for automated testing.
57
+ */
58
+ dataTest?: string;
59
+ }
@@ -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 { URowProps, Config } from "./types.ts";
7
+
8
+ export default function useAttrs(props: URowProps): 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
+ }