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
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import defaultConfig from "./config.ts";
|
|
2
|
+
|
|
3
|
+
export type Config = Partial<typeof defaultConfig>;
|
|
4
|
+
|
|
5
|
+
export interface UColProps {
|
|
6
|
+
/**
|
|
7
|
+
* The distance between nested elements.
|
|
8
|
+
*/
|
|
9
|
+
gap?: "none" | "3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Items horizontal align (align-items).
|
|
13
|
+
*/
|
|
14
|
+
align?: "start" | "end" | "center" | "stretch" | "baseline";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Items horizontal 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 vertical 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
|
+
* Component config object.
|
|
47
|
+
*/
|
|
48
|
+
config?: Partial<typeof defaultConfig>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Data-test attribute for automated testing.
|
|
52
|
+
*/
|
|
53
|
+
dataTest?: string;
|
|
54
|
+
}
|
|
@@ -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 { UColProps, Config } from "./types.ts";
|
|
7
|
+
|
|
8
|
+
export default function useAttrs(props: UColProps): 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,103 +1,31 @@
|
|
|
1
|
-
<
|
|
2
|
-
<div :data-test="dataTest" v-bind="wrapperAttrs">
|
|
3
|
-
<div v-bind="dividerAttrs" />
|
|
4
|
-
<span v-if="label" v-bind="labelAttrs" v-text="label" />
|
|
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 { UDivider } from "./constants.
|
|
12
|
-
import defaultConfig from "./config.
|
|
13
|
-
import useAttrs from "./useAttrs.
|
|
14
|
-
|
|
15
|
-
defineOptions({ inheritAttrs: false });
|
|
16
|
-
|
|
17
|
-
const props = defineProps({
|
|
18
|
-
/**
|
|
19
|
-
* Divider label.
|
|
20
|
-
*/
|
|
21
|
-
label: {
|
|
22
|
-
type: String,
|
|
23
|
-
default: "",
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Divider padding size.
|
|
28
|
-
* @values xs, sm, md, lg, xl
|
|
29
|
-
*/
|
|
30
|
-
size: {
|
|
31
|
-
type: String,
|
|
32
|
-
default: getDefault(defaultConfig, UDivider).size,
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Divider color.
|
|
37
|
-
* @values light, default, dark
|
|
38
|
-
*/
|
|
39
|
-
variant: {
|
|
40
|
-
type: String,
|
|
41
|
-
default: getDefault(defaultConfig, UDivider).variant,
|
|
42
|
-
},
|
|
4
|
+
import { UDivider } from "./constants.ts";
|
|
5
|
+
import defaultConfig from "./config.ts";
|
|
6
|
+
import useAttrs from "./useAttrs.ts";
|
|
43
7
|
|
|
44
|
-
|
|
45
|
-
* Set padding around the Divider.
|
|
46
|
-
* @values none, before, after, all
|
|
47
|
-
*/
|
|
48
|
-
padding: {
|
|
49
|
-
type: String,
|
|
50
|
-
default: getDefault(defaultConfig, UDivider).padding,
|
|
51
|
-
},
|
|
8
|
+
import type { UDividerProps } from "./types.ts";
|
|
52
9
|
|
|
53
|
-
|
|
54
|
-
* Set line dashed.
|
|
55
|
-
*/
|
|
56
|
-
dashed: {
|
|
57
|
-
type: Boolean,
|
|
58
|
-
default: getDefault(defaultConfig, UDivider).dashed,
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Set line dotted.
|
|
63
|
-
*/
|
|
64
|
-
dotted: {
|
|
65
|
-
type: Boolean,
|
|
66
|
-
default: getDefault(defaultConfig, UDivider).dotted,
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Set divider vertically orientated.
|
|
71
|
-
*/
|
|
72
|
-
vertical: {
|
|
73
|
-
type: Boolean,
|
|
74
|
-
default: getDefault(defaultConfig, UDivider).vertical,
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Remove border (keeps only spacings).
|
|
79
|
-
*/
|
|
80
|
-
noBorder: {
|
|
81
|
-
type: Boolean,
|
|
82
|
-
default: getDefault(defaultConfig, UDivider).noBorder,
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Component config object.
|
|
87
|
-
*/
|
|
88
|
-
config: {
|
|
89
|
-
type: Object,
|
|
90
|
-
default: () => ({}),
|
|
91
|
-
},
|
|
10
|
+
defineOptions({ inheritAttrs: false });
|
|
92
11
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
12
|
+
const props = withDefaults(defineProps<UDividerProps>(), {
|
|
13
|
+
size: getDefault<UDividerProps>(defaultConfig, UDivider).size,
|
|
14
|
+
variant: getDefault<UDividerProps>(defaultConfig, UDivider).variant,
|
|
15
|
+
padding: getDefault<UDividerProps>(defaultConfig, UDivider).padding,
|
|
16
|
+
dashed: getDefault<UDividerProps>(defaultConfig, UDivider).dashed,
|
|
17
|
+
dotted: getDefault<UDividerProps>(defaultConfig, UDivider).dotted,
|
|
18
|
+
vertical: getDefault<UDividerProps>(defaultConfig, UDivider).vertical,
|
|
19
|
+
noBorder: getDefault<UDividerProps>(defaultConfig, UDivider).noBorder,
|
|
20
|
+
dataTest: "",
|
|
100
21
|
});
|
|
101
22
|
|
|
102
23
|
const { wrapperAttrs, dividerAttrs, labelAttrs } = useAttrs(props);
|
|
103
24
|
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<div :data-test="dataTest" v-bind="wrapperAttrs">
|
|
28
|
+
<div v-bind="dividerAttrs" />
|
|
29
|
+
<span v-if="label" v-bind="labelAttrs" v-text="label" />
|
|
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} />
|
|
@@ -3,6 +3,14 @@ import { getArgTypes, getSlotNames, getSlotsFragment } from "../../utils/storybo
|
|
|
3
3
|
import URow from "../../ui.container-row/URow.vue";
|
|
4
4
|
import UDivider from "../../ui.container-divider/UDivider.vue";
|
|
5
5
|
|
|
6
|
+
import type { Meta, StoryFn } from "@storybook/vue3";
|
|
7
|
+
import type { UDividerProps } from "../types.ts";
|
|
8
|
+
|
|
9
|
+
interface UDividerArgs extends UDividerProps {
|
|
10
|
+
slotTemplate?: string;
|
|
11
|
+
enum: "variant" | "size" | "padding";
|
|
12
|
+
}
|
|
13
|
+
|
|
6
14
|
/**
|
|
7
15
|
* The `UDivider` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.container-divider)
|
|
8
16
|
*/
|
|
@@ -13,9 +21,9 @@ export default {
|
|
|
13
21
|
argTypes: {
|
|
14
22
|
...getArgTypes(UDivider.__name),
|
|
15
23
|
},
|
|
16
|
-
};
|
|
24
|
+
} as Meta;
|
|
17
25
|
|
|
18
|
-
const DefaultTemplate = (args) => ({
|
|
26
|
+
const DefaultTemplate: StoryFn<UDividerArgs> = (args: UDividerArgs) => ({
|
|
19
27
|
components: { UDivider },
|
|
20
28
|
setup() {
|
|
21
29
|
const slots = getSlotNames(UDivider.__name);
|
|
@@ -24,17 +32,17 @@ const DefaultTemplate = (args) => ({
|
|
|
24
32
|
},
|
|
25
33
|
template: `
|
|
26
34
|
<UDivider v-bind="args">
|
|
27
|
-
${args.slotTemplate || getSlotsFragment()}
|
|
35
|
+
${args.slotTemplate || getSlotsFragment("")}
|
|
28
36
|
</UDivider>
|
|
29
37
|
`,
|
|
30
38
|
});
|
|
31
39
|
|
|
32
|
-
const EnumVariantTemplate = (args, { argTypes }) => ({
|
|
40
|
+
const EnumVariantTemplate: StoryFn<UDividerArgs> = (args: UDividerArgs, { argTypes }) => ({
|
|
33
41
|
components: { UDivider, URow },
|
|
34
42
|
setup() {
|
|
35
43
|
return {
|
|
36
44
|
args,
|
|
37
|
-
options: argTypes[args.enum]
|
|
45
|
+
options: argTypes?.[args.enum]?.options,
|
|
38
46
|
};
|
|
39
47
|
},
|
|
40
48
|
template: `
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import defaultConfig from "./config.ts";
|
|
2
|
+
|
|
3
|
+
export type Config = Partial<typeof defaultConfig>;
|
|
4
|
+
|
|
5
|
+
export interface UDividerProps {
|
|
6
|
+
/**
|
|
7
|
+
* Divider label.
|
|
8
|
+
*/
|
|
9
|
+
label?: string;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Divider padding size.
|
|
13
|
+
*/
|
|
14
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Divider color.
|
|
18
|
+
*/
|
|
19
|
+
variant?: "light" | "default" | "dark";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Set padding around the Divider.
|
|
23
|
+
*/
|
|
24
|
+
padding?: "none" | "before" | "after" | "all";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Set line dashed.
|
|
28
|
+
*/
|
|
29
|
+
dashed?: boolean;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Set line dotted.
|
|
33
|
+
*/
|
|
34
|
+
dotted?: boolean;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Set divider vertically orientated.
|
|
38
|
+
*/
|
|
39
|
+
vertical?: boolean;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Remove border (keeps only spacings).
|
|
43
|
+
*/
|
|
44
|
+
noBorder?: boolean;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Component config object.
|
|
48
|
+
*/
|
|
49
|
+
config?: Partial<typeof defaultConfig>;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Data-test attribute for automated testing.
|
|
53
|
+
*/
|
|
54
|
+
dataTest?: string;
|
|
55
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
import useUI from "../composables/useUI.ts";
|
|
3
|
+
|
|
4
|
+
import defaultConfig from "./config.ts";
|
|
5
|
+
|
|
6
|
+
import type { UseAttrs } from "../types.ts";
|
|
7
|
+
import type { UDividerProps, Config } from "./types.ts";
|
|
8
|
+
|
|
9
|
+
export default function useAttrs(props: UDividerProps): UseAttrs<Config> {
|
|
10
|
+
const { config, getKeysAttrs, hasSlotContent } = useUI<Config>(defaultConfig, () => props.config);
|
|
11
|
+
|
|
12
|
+
const mutatedProps = computed(() => ({
|
|
13
|
+
label: Boolean(props.label),
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
const keysAttrs = getKeysAttrs(mutatedProps);
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
config,
|
|
20
|
+
...keysAttrs,
|
|
21
|
+
hasSlotContent,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { getDefault } from "../utils/ui.ts";
|
|
3
|
+
import UDivider from "../ui.container-divider/UDivider.vue";
|
|
4
|
+
import UHeader from "../ui.text-header/UHeader.vue";
|
|
5
|
+
|
|
6
|
+
import { UGroup } from "./constants.ts";
|
|
7
|
+
import defaultConfig from "./config.ts";
|
|
8
|
+
import useAttrs from "./useAttrs.ts";
|
|
9
|
+
|
|
10
|
+
import type { UGroupProps } from "./types.ts";
|
|
11
|
+
|
|
12
|
+
defineOptions({ inheritAttrs: false });
|
|
13
|
+
|
|
14
|
+
const props = withDefaults(defineProps<UGroupProps>(), {
|
|
15
|
+
gap: getDefault<UGroupProps>(defaultConfig, UGroup).gap,
|
|
16
|
+
upperlined: getDefault<UGroupProps>(defaultConfig, UGroup).upperlined,
|
|
17
|
+
underlined: getDefault<UGroupProps>(defaultConfig, UGroup).underlined,
|
|
18
|
+
dataTest: "",
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const {
|
|
22
|
+
headerAttrs,
|
|
23
|
+
wrapperAttrs,
|
|
24
|
+
headerLeftFallbackAttrs,
|
|
25
|
+
titleAttrs,
|
|
26
|
+
upperlineAttrs,
|
|
27
|
+
underlineAttrs,
|
|
28
|
+
contentAttrs,
|
|
29
|
+
} = useAttrs(props);
|
|
30
|
+
</script>
|
|
31
|
+
|
|
1
32
|
<template>
|
|
2
33
|
<div v-bind="wrapperAttrs" :data-test="dataTest">
|
|
3
34
|
<template v-if="title">
|
|
@@ -30,76 +61,3 @@
|
|
|
30
61
|
</div>
|
|
31
62
|
</div>
|
|
32
63
|
</template>
|
|
33
|
-
|
|
34
|
-
<script setup>
|
|
35
|
-
import { getDefault } from "../utils/ui.ts";
|
|
36
|
-
import UDivider from "../ui.container-divider/UDivider.vue";
|
|
37
|
-
import UHeader from "../ui.text-header/UHeader.vue";
|
|
38
|
-
|
|
39
|
-
import { UGroup } from "./constants.js";
|
|
40
|
-
import defaultConfig from "./config.js";
|
|
41
|
-
import useAttrs from "./useAttrs.js";
|
|
42
|
-
|
|
43
|
-
defineOptions({ inheritAttrs: false });
|
|
44
|
-
|
|
45
|
-
const props = defineProps({
|
|
46
|
-
/**
|
|
47
|
-
* Group title.
|
|
48
|
-
*/
|
|
49
|
-
title: {
|
|
50
|
-
type: String,
|
|
51
|
-
default: "",
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* The distance between nested elements.
|
|
56
|
-
* @values none, xs, sm, md, lg, xl
|
|
57
|
-
*/
|
|
58
|
-
gap: {
|
|
59
|
-
type: String,
|
|
60
|
-
default: getDefault(defaultConfig, UGroup).gap,
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Show line above the header.
|
|
65
|
-
*/
|
|
66
|
-
upperlined: {
|
|
67
|
-
type: Boolean,
|
|
68
|
-
default: getDefault(defaultConfig, UGroup).upperlined,
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Show line under the header.
|
|
73
|
-
*/
|
|
74
|
-
underlined: {
|
|
75
|
-
type: Boolean,
|
|
76
|
-
default: getDefault(defaultConfig, UGroup).underlined,
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Component config object.
|
|
81
|
-
*/
|
|
82
|
-
config: {
|
|
83
|
-
type: Object,
|
|
84
|
-
default: () => ({}),
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Data-test attribute for automated testing.
|
|
89
|
-
*/
|
|
90
|
-
dataTest: {
|
|
91
|
-
type: String,
|
|
92
|
-
default: "",
|
|
93
|
-
},
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
const {
|
|
97
|
-
headerAttrs,
|
|
98
|
-
wrapperAttrs,
|
|
99
|
-
headerLeftFallbackAttrs,
|
|
100
|
-
titleAttrs,
|
|
101
|
-
upperlineAttrs,
|
|
102
|
-
underlineAttrs,
|
|
103
|
-
contentAttrs,
|
|
104
|
-
} = useAttrs(props);
|
|
105
|
-
</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.
|
|
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,13 @@ import UCol from "../../ui.container-col/UCol.vue";
|
|
|
5
5
|
import UInput from "../../ui.form-input/UInput.vue";
|
|
6
6
|
import UButton from "../../ui.button/UButton.vue";
|
|
7
7
|
|
|
8
|
+
import type { Meta, StoryFn } from "@storybook/vue3";
|
|
9
|
+
import type { UGroupProps } from "../types.ts";
|
|
10
|
+
|
|
11
|
+
interface UGroupArgs extends UGroupProps {
|
|
12
|
+
slotTemplate?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
8
15
|
/**
|
|
9
16
|
* The `UGroup` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.container-group)
|
|
10
17
|
*/
|
|
@@ -25,7 +32,7 @@ export default {
|
|
|
25
32
|
},
|
|
26
33
|
},
|
|
27
34
|
},
|
|
28
|
-
};
|
|
35
|
+
} as Meta;
|
|
29
36
|
|
|
30
37
|
const defaultTemplate = `
|
|
31
38
|
<UCol>
|
|
@@ -35,7 +42,7 @@ const defaultTemplate = `
|
|
|
35
42
|
</UCol>
|
|
36
43
|
`;
|
|
37
44
|
|
|
38
|
-
const DefaultTemplate = (args) => ({
|
|
45
|
+
const DefaultTemplate: StoryFn<UGroupArgs> = (args: UGroupArgs) => ({
|
|
39
46
|
components: { UGroup, UCol, UInput, UButton },
|
|
40
47
|
setup() {
|
|
41
48
|
const slots = getSlotNames(UGroup.__name);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import defaultConfig from "./config.ts";
|
|
2
|
+
|
|
3
|
+
export type Config = Partial<typeof defaultConfig>;
|
|
4
|
+
|
|
5
|
+
export interface UGroupProps {
|
|
6
|
+
/**
|
|
7
|
+
* Group title.
|
|
8
|
+
*/
|
|
9
|
+
title?: string;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The distance between nested elements.
|
|
13
|
+
* @values none, xs, sm, md, lg, xl
|
|
14
|
+
*/
|
|
15
|
+
gap?: "none" | "xs" | "sm" | "md" | "lg" | "xl";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Show line above the header.
|
|
19
|
+
*/
|
|
20
|
+
upperlined?: boolean;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Show line under the header.
|
|
24
|
+
*/
|
|
25
|
+
underlined?: boolean;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Component config object.
|
|
29
|
+
*/
|
|
30
|
+
config?: Partial<typeof defaultConfig>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Data-test attribute for automated testing.
|
|
34
|
+
*/
|
|
35
|
+
dataTest?: string;
|
|
36
|
+
}
|
|
@@ -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 { UGroupProps, Config } from "./types.ts";
|
|
7
|
+
|
|
8
|
+
export default function useAttrs(props: UGroupProps): 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
|
+
}
|