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.
- package/package.json +1 -1
- package/types.ts +18 -0
- package/ui.button-link/types.ts +3 -1
- package/ui.container-accordion/UAccordion.vue +33 -69
- package/ui.container-accordion/storybook/Docs.mdx +2 -2
- package/ui.container-accordion/storybook/{stories.js → stories.ts} +10 -3
- package/ui.container-accordion/types.ts +35 -0
- package/ui.container-accordion/{useAttrs.js → useAttrs.ts} +14 -3
- package/ui.container-card/UCard.vue +43 -71
- package/ui.container-card/storybook/Docs.mdx +2 -2
- package/ui.container-card/storybook/{stories.js → stories.ts} +9 -2
- package/ui.container-card/types.ts +25 -0
- package/ui.container-card/useAttrs.ts +18 -0
- package/ui.container-col/UCol.vue +21 -79
- package/ui.container-col/storybook/Docs.mdx +2 -2
- package/ui.container-col/storybook/{stories.js → stories.ts} +9 -2
- package/ui.container-col/types.ts +54 -0
- package/ui.container-col/useAttrs.ts +18 -0
- package/ui.container-divider/UDivider.vue +22 -94
- package/ui.container-divider/storybook/Docs.mdx +2 -2
- package/ui.container-divider/storybook/{stories.js → stories.ts} +13 -5
- package/ui.container-divider/types.ts +55 -0
- package/ui.container-divider/useAttrs.ts +23 -0
- package/ui.container-group/UGroup.vue +31 -73
- package/ui.container-group/storybook/Docs.mdx +2 -2
- package/ui.container-group/storybook/{stories.js → stories.ts} +9 -2
- package/ui.container-group/types.ts +36 -0
- package/ui.container-group/useAttrs.ts +18 -0
- package/ui.container-modal/UModal.vue +122 -232
- package/ui.container-modal/storybook/Docs.mdx +2 -2
- package/ui.container-modal/storybook/{stories.js → stories.ts} +16 -6
- package/ui.container-modal/types.ts +82 -0
- package/ui.container-modal/useAttrs.ts +22 -0
- package/ui.container-modal-confirm/UModalConfirm.vue +82 -199
- package/ui.container-modal-confirm/storybook/Docs.mdx +2 -2
- package/ui.container-modal-confirm/storybook/{stories.js → stories.ts} +14 -3
- package/ui.container-modal-confirm/types.ts +106 -0
- package/ui.container-modal-confirm/useAttrs.ts +18 -0
- package/ui.container-page/UPage.vue +79 -153
- package/ui.container-page/storybook/Docs.mdx +2 -2
- package/ui.container-page/storybook/{stories.js → stories.ts} +9 -2
- package/ui.container-page/types.ts +57 -0
- package/ui.container-page/{useAttrs.js → useAttrs.ts} +14 -3
- package/ui.container-row/URow.vue +22 -87
- package/ui.container-row/storybook/Docs.mdx +2 -2
- package/ui.container-row/storybook/{stories.js → stories.ts} +11 -3
- package/ui.container-row/types.ts +59 -0
- package/ui.container-row/useAttrs.ts +18 -0
- package/web-types.json +182 -92
- package/ui.container-card/useAttrs.js +0 -15
- package/ui.container-col/useAttrs.js +0 -15
- package/ui.container-divider/useAttrs.js +0 -20
- package/ui.container-group/useAttrs.js +0 -15
- package/ui.container-modal/useAttrs.js +0 -19
- package/ui.container-modal-confirm/useAttrs.js +0 -15
- package/ui.container-row/useAttrs.js +0 -15
- /package/ui.container-accordion/{config.js → config.ts} +0 -0
- /package/ui.container-accordion/{constants.js → constants.ts} +0 -0
- /package/ui.container-card/{config.js → config.ts} +0 -0
- /package/ui.container-card/{constants.js → constants.ts} +0 -0
- /package/ui.container-col/{config.js → config.ts} +0 -0
- /package/ui.container-col/{constants.js → constants.ts} +0 -0
- /package/ui.container-divider/{config.js → config.ts} +0 -0
- /package/ui.container-divider/{constants.js → constants.ts} +0 -0
- /package/ui.container-group/{config.js → config.ts} +0 -0
- /package/ui.container-group/{constants.js → constants.ts} +0 -0
- /package/ui.container-modal/{config.js → config.ts} +0 -0
- /package/ui.container-modal/{constants.js → constants.ts} +0 -0
- /package/ui.container-modal-confirm/{config.js → config.ts} +0 -0
- /package/ui.container-modal-confirm/{constants.js → constants.ts} +0 -0
- /package/ui.container-page/{config.js → config.ts} +0 -0
- /package/ui.container-page/{constants.js → constants.ts} +0 -0
- /package/ui.container-row/{config.js → config.ts} +0 -0
- /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.
|
|
5
|
+
import defaultConfig from "./config.ts";
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
<
|
|
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.
|
|
12
|
-
import defaultConfig from "./config.
|
|
13
|
-
import useAttrs from "./useAttrs.
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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.
|
|
5
|
-
import defaultConfig from "../config.
|
|
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
|
+
}
|