vueless 0.0.235 → 0.0.237
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/service.storybook/index.js +19 -3
- package/ui.form-input/configs/default.config.js +2 -2
- package/ui.form-input/index.vue +8 -8
- package/ui.form-input-search/configs/default.config.js +2 -2
- package/ui.form-input-search/index.vue +4 -3
- package/ui.text-alert/configs/default.config.js +27 -33
- package/ui.text-alert/index.stories.js +70 -135
- package/ui.text-alert/index.vue +52 -54
- package/ui.text-badge/index.stories.js +21 -89
- package/ui.text-block/index.stories.js +13 -15
- package/ui.text-empty/index.stories.js +15 -27
- package/ui.text-file/index.stories.js +4 -2
- package/ui.text-files/index.stories.js +4 -2
- package/ui.text-header/index.stories.js +17 -57
- package/ui.text-money/index.stories.js +24 -148
- package/ui.text-notify/index.stories.js +24 -24
- package/web-types.json +31 -40
package/ui.text-alert/index.vue
CHANGED
|
@@ -3,35 +3,41 @@
|
|
|
3
3
|
<!-- @slot Use it to add something above the text. -->
|
|
4
4
|
<slot name="top" />
|
|
5
5
|
|
|
6
|
-
<!--
|
|
7
|
-
@slot Use it to add something instead of the title.
|
|
8
|
-
@binding {string} title
|
|
9
|
-
-->
|
|
10
|
-
<slot name="title" :title="title">
|
|
11
|
-
<div v-if="title" v-bind="titleAttrs" v-text="title" />
|
|
12
|
-
</slot>
|
|
13
|
-
|
|
14
|
-
<!--
|
|
15
|
-
@slot Use it to add something instead of the description.
|
|
16
|
-
@binding {string} description
|
|
17
|
-
-->
|
|
18
|
-
<slot name="description" :description="description">
|
|
19
|
-
<div v-if="description" v-bind="descriptionAttrs" v-text="description" />
|
|
20
|
-
</slot>
|
|
21
|
-
|
|
22
6
|
<div v-bind="bodyAttrs">
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
v-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
7
|
+
<div v-bind="innerWrapperAttrs">
|
|
8
|
+
<!-- @slot Use it to add something before the text. -->
|
|
9
|
+
<slot name="left" />
|
|
10
|
+
|
|
11
|
+
<div v-bind="contentAttrs">
|
|
12
|
+
<!--
|
|
13
|
+
@slot Use it to add something instead of the title.
|
|
14
|
+
@binding {string} title
|
|
15
|
+
-->
|
|
16
|
+
<slot v-if="!hasSlotContent($slots['default'])" name="title" :title="title">
|
|
17
|
+
<div v-if="title" v-bind="titleAttrs" v-text="title" />
|
|
18
|
+
</slot>
|
|
19
|
+
|
|
20
|
+
<!--
|
|
21
|
+
@slot Use it to add something instead of the description.
|
|
22
|
+
@binding {string} description
|
|
23
|
+
-->
|
|
24
|
+
<slot
|
|
25
|
+
v-if="!hasSlotContent($slots['default'])"
|
|
26
|
+
name="description"
|
|
27
|
+
:description="description"
|
|
28
|
+
>
|
|
29
|
+
<div v-if="description" v-bind="descriptionAttrs" v-text="description" />
|
|
30
|
+
</slot>
|
|
31
|
+
|
|
32
|
+
<!-- @slot Use it to add something inside. -->
|
|
33
|
+
<UText v-bind="textAttrs" :size="size">
|
|
34
|
+
<slot />
|
|
35
|
+
</UText>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<!-- @slot Use it to add something after the text. -->
|
|
39
|
+
<slot name="right" />
|
|
40
|
+
</div>
|
|
35
41
|
|
|
36
42
|
<UButton
|
|
37
43
|
v-if="closable"
|
|
@@ -52,9 +58,6 @@
|
|
|
52
58
|
v-bind="iconAttrs"
|
|
53
59
|
/>
|
|
54
60
|
</UButton>
|
|
55
|
-
|
|
56
|
-
<!-- @slot Use it to add something after the text. -->
|
|
57
|
-
<slot name="right" />
|
|
58
61
|
</div>
|
|
59
62
|
|
|
60
63
|
<!-- @slot Use it to add something under the text. -->
|
|
@@ -79,20 +82,28 @@ defineOptions({ name: "UAlert" });
|
|
|
79
82
|
|
|
80
83
|
const props = defineProps({
|
|
81
84
|
/**
|
|
82
|
-
* Alert
|
|
83
|
-
* @values primary, secondary, thirdary
|
|
85
|
+
* Alert title.
|
|
84
86
|
*/
|
|
85
|
-
|
|
87
|
+
title: {
|
|
86
88
|
type: String,
|
|
87
|
-
default:
|
|
89
|
+
default: "",
|
|
88
90
|
},
|
|
89
91
|
|
|
90
92
|
/**
|
|
91
|
-
*
|
|
93
|
+
* Alert description.
|
|
94
|
+
*/
|
|
95
|
+
description: {
|
|
96
|
+
type: String,
|
|
97
|
+
default: "",
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Alert variant.
|
|
102
|
+
* @values primary, secondary, thirdary
|
|
92
103
|
*/
|
|
93
|
-
|
|
104
|
+
variant: {
|
|
94
105
|
type: String,
|
|
95
|
-
default: UIService.get(defaultConfig, UAlert).default.
|
|
106
|
+
default: UIService.get(defaultConfig, UAlert).default.variant,
|
|
96
107
|
},
|
|
97
108
|
|
|
98
109
|
/**
|
|
@@ -151,22 +162,6 @@ const props = defineProps({
|
|
|
151
162
|
type: String,
|
|
152
163
|
default: "",
|
|
153
164
|
},
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Alert title.
|
|
157
|
-
*/
|
|
158
|
-
title: {
|
|
159
|
-
type: String,
|
|
160
|
-
default: "",
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Alert description.
|
|
165
|
-
*/
|
|
166
|
-
description: {
|
|
167
|
-
type: String,
|
|
168
|
-
default: "",
|
|
169
|
-
},
|
|
170
165
|
});
|
|
171
166
|
|
|
172
167
|
const emit = defineEmits([
|
|
@@ -182,10 +177,13 @@ const {
|
|
|
182
177
|
config,
|
|
183
178
|
wrapperAttrs,
|
|
184
179
|
bodyAttrs,
|
|
180
|
+
contentAttrs,
|
|
181
|
+
textAttrs,
|
|
185
182
|
titleAttrs,
|
|
186
183
|
descriptionAttrs,
|
|
187
184
|
iconAttrs,
|
|
188
185
|
buttonAttrs,
|
|
186
|
+
innerWrapperAttrs,
|
|
189
187
|
hasSlotContent,
|
|
190
188
|
} = useAttrs(props);
|
|
191
189
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getArgTypes, getSlotNames,
|
|
1
|
+
import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
|
|
2
2
|
|
|
3
3
|
import UBadge from "../ui.text-badge";
|
|
4
4
|
import UIcon from "../ui.image-icon";
|
|
@@ -21,7 +21,7 @@ export default {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const DefaultTemplate = (args) => ({
|
|
24
|
-
components: { UBadge },
|
|
24
|
+
components: { UBadge, UIcon },
|
|
25
25
|
setup() {
|
|
26
26
|
const slots = getSlotNames(UBadge.name);
|
|
27
27
|
|
|
@@ -29,19 +29,7 @@ const DefaultTemplate = (args) => ({
|
|
|
29
29
|
},
|
|
30
30
|
template: `
|
|
31
31
|
<UBadge v-bind="args">
|
|
32
|
-
${
|
|
33
|
-
</UBadge>
|
|
34
|
-
`,
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const SlotTemplate = (args) => ({
|
|
38
|
-
components: { UBadge, UIcon },
|
|
39
|
-
setup() {
|
|
40
|
-
return { args };
|
|
41
|
-
},
|
|
42
|
-
template: `
|
|
43
|
-
<UBadge v-bind="args">
|
|
44
|
-
${args.slotTemplate}
|
|
32
|
+
${args.slotTemplate || getSlotsFragment()}
|
|
45
33
|
</UBadge>
|
|
46
34
|
`,
|
|
47
35
|
});
|
|
@@ -71,100 +59,44 @@ const ColorsTemplate = (args, { argTypes } = {}) => ({
|
|
|
71
59
|
`,
|
|
72
60
|
});
|
|
73
61
|
|
|
74
|
-
const
|
|
75
|
-
components: { UBadge, URow },
|
|
76
|
-
setup() {
|
|
77
|
-
return {
|
|
78
|
-
args,
|
|
79
|
-
sizes: argTypes.size.options,
|
|
80
|
-
};
|
|
81
|
-
},
|
|
82
|
-
template: `
|
|
83
|
-
<URow>
|
|
84
|
-
<UBadge
|
|
85
|
-
v-for="(size, index) in sizes"
|
|
86
|
-
v-bind="args"
|
|
87
|
-
:size="size"
|
|
88
|
-
:label="getText(size)"
|
|
89
|
-
:key="index"
|
|
90
|
-
/>
|
|
91
|
-
</URow>
|
|
92
|
-
`,
|
|
93
|
-
methods: {
|
|
94
|
-
getText(value) {
|
|
95
|
-
return `badge ${value}`;
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
const WeightTemplate = (args, { argTypes } = {}) => ({
|
|
62
|
+
const EnumVariantTemplate = (args, { argTypes } = {}) => ({
|
|
101
63
|
components: { UBadge, URow },
|
|
102
64
|
setup() {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
};
|
|
107
|
-
},
|
|
108
|
-
template: `
|
|
109
|
-
<URow>
|
|
110
|
-
<UBadge
|
|
111
|
-
v-for="(weight, index) in weights"
|
|
112
|
-
v-bind="args"
|
|
113
|
-
:weight="weight"
|
|
114
|
-
:label="getText(weight)"
|
|
115
|
-
:key="index"
|
|
116
|
-
/>
|
|
117
|
-
</URow>
|
|
118
|
-
`,
|
|
119
|
-
methods: {
|
|
120
|
-
getText(value) {
|
|
121
|
-
return `badge ${value}`;
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
});
|
|
65
|
+
function getText(value) {
|
|
66
|
+
return `Badge ${value}`;
|
|
67
|
+
}
|
|
125
68
|
|
|
126
|
-
|
|
127
|
-
components: { UBadge, URow },
|
|
128
|
-
setup() {
|
|
129
|
-
return {
|
|
130
|
-
args,
|
|
131
|
-
variants: argTypes.variant.options,
|
|
132
|
-
};
|
|
69
|
+
return { args, options: argTypes[args.enum].options, getText };
|
|
133
70
|
},
|
|
134
71
|
template: `
|
|
135
72
|
<URow>
|
|
136
73
|
<UBadge
|
|
137
|
-
v-for="(
|
|
74
|
+
v-for="(option, index) in options"
|
|
138
75
|
v-bind="args"
|
|
139
|
-
:
|
|
140
|
-
:label="getText(
|
|
76
|
+
:[args.enum]="option"
|
|
77
|
+
:label="getText(option)"
|
|
141
78
|
:key="index"
|
|
142
79
|
/>
|
|
143
80
|
</URow>
|
|
144
81
|
`,
|
|
145
|
-
methods: {
|
|
146
|
-
getText(value) {
|
|
147
|
-
return `badge ${value}`;
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
82
|
});
|
|
151
83
|
|
|
152
84
|
export const Default = DefaultTemplate.bind({});
|
|
153
85
|
Default.args = {};
|
|
154
86
|
|
|
155
|
-
export const Variants =
|
|
156
|
-
Variants.args = {};
|
|
87
|
+
export const Variants = EnumVariantTemplate.bind({});
|
|
88
|
+
Variants.args = { enum: "variant" };
|
|
157
89
|
|
|
158
|
-
export const Sizes =
|
|
159
|
-
Sizes.args = {};
|
|
90
|
+
export const Sizes = EnumVariantTemplate.bind({});
|
|
91
|
+
Sizes.args = { enum: "size" };
|
|
160
92
|
|
|
161
|
-
export const Weight =
|
|
162
|
-
Weight.args = {};
|
|
93
|
+
export const Weight = EnumVariantTemplate.bind({});
|
|
94
|
+
Weight.args = { enum: "weight" };
|
|
163
95
|
|
|
164
96
|
export const Colors = ColorsTemplate.bind({});
|
|
165
97
|
Colors.args = {};
|
|
166
98
|
|
|
167
|
-
export const slotRight =
|
|
99
|
+
export const slotRight = DefaultTemplate.bind({});
|
|
168
100
|
slotRight.args = {
|
|
169
101
|
slotTemplate: `
|
|
170
102
|
<template #right>
|
|
@@ -172,12 +104,12 @@ slotRight.args = {
|
|
|
172
104
|
tooltip="tooltip text"
|
|
173
105
|
name="info"
|
|
174
106
|
size="xs"
|
|
175
|
-
|
|
107
|
+
/>
|
|
176
108
|
</template>
|
|
177
109
|
`,
|
|
178
110
|
};
|
|
179
111
|
|
|
180
|
-
export const slotLeft =
|
|
112
|
+
export const slotLeft = DefaultTemplate.bind({});
|
|
181
113
|
slotLeft.args = {
|
|
182
114
|
slotTemplate: `
|
|
183
115
|
<template #left>
|
|
@@ -185,7 +117,7 @@ slotLeft.args = {
|
|
|
185
117
|
tooltip="tooltip text"
|
|
186
118
|
name="info"
|
|
187
119
|
size="xs"
|
|
188
|
-
|
|
120
|
+
/>
|
|
189
121
|
</template>
|
|
190
122
|
`,
|
|
191
123
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getArgTypes, getSlotNames } from "../service.storybook";
|
|
1
|
+
import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
|
|
2
2
|
|
|
3
3
|
import UText from "../ui.text-block";
|
|
4
4
|
import URow from "../ui.container-row";
|
|
@@ -17,13 +17,11 @@ export default {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
const defaultTemplate = `
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
</p>
|
|
26
|
-
</template>
|
|
20
|
+
<p>
|
|
21
|
+
<b>To proceed with your registration</b>, please enter your
|
|
22
|
+
<u>email address</u> in the field below. <i>A verification link</i> will be sent to your inbox shortly.
|
|
23
|
+
<a href="https://uk.wikipedia.org/wiki/Lorem_ipsum" target="_blank">Wikipedia</a>
|
|
24
|
+
</p>
|
|
27
25
|
`;
|
|
28
26
|
|
|
29
27
|
const DefaultTemplate = (args) => ({
|
|
@@ -35,24 +33,24 @@ const DefaultTemplate = (args) => ({
|
|
|
35
33
|
},
|
|
36
34
|
template: `
|
|
37
35
|
<UText v-bind="args">
|
|
38
|
-
${args.slotTemplate || defaultTemplate}
|
|
36
|
+
${args.slotTemplate || getSlotsFragment(defaultTemplate)}
|
|
39
37
|
</UText>
|
|
40
38
|
`,
|
|
41
39
|
});
|
|
42
40
|
|
|
43
|
-
const
|
|
41
|
+
const EnumVariantTemplate = (args, { argTypes } = {}) => ({
|
|
44
42
|
components: { UText, URow },
|
|
45
43
|
setup() {
|
|
46
44
|
return {
|
|
47
45
|
args,
|
|
48
|
-
|
|
46
|
+
options: argTypes[args.enum].options,
|
|
49
47
|
};
|
|
50
48
|
},
|
|
51
49
|
template: `
|
|
52
50
|
<URow>
|
|
53
51
|
<UText
|
|
54
|
-
v-for="(
|
|
55
|
-
:
|
|
52
|
+
v-for="(option, index) in options"
|
|
53
|
+
:[args.enum]="option"
|
|
56
54
|
v-bind="args"
|
|
57
55
|
:key="index"
|
|
58
56
|
>
|
|
@@ -65,8 +63,8 @@ const SizesTemplate = (args, { argTypes } = {}) => ({
|
|
|
65
63
|
export const Default = DefaultTemplate.bind({});
|
|
66
64
|
Default.args = {};
|
|
67
65
|
|
|
68
|
-
export const sizes =
|
|
69
|
-
sizes.args = {};
|
|
66
|
+
export const sizes = EnumVariantTemplate.bind({});
|
|
67
|
+
sizes.args = { enum: "size" };
|
|
70
68
|
|
|
71
69
|
export const paragraphs = DefaultTemplate.bind({});
|
|
72
70
|
paragraphs.args = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getArgTypes, getSlotNames,
|
|
1
|
+
import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
|
|
2
2
|
|
|
3
3
|
import UEmpty from "../ui.text-empty";
|
|
4
4
|
import UButton from "../ui.button";
|
|
@@ -22,7 +22,7 @@ export default {
|
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
const DefaultTemplate = (args) => ({
|
|
25
|
-
components: { UEmpty },
|
|
25
|
+
components: { UEmpty, UIcon, UButton },
|
|
26
26
|
setup() {
|
|
27
27
|
const slots = getSlotNames(UEmpty.name);
|
|
28
28
|
|
|
@@ -30,38 +30,26 @@ const DefaultTemplate = (args) => ({
|
|
|
30
30
|
},
|
|
31
31
|
template: `
|
|
32
32
|
<UEmpty v-bind="args">
|
|
33
|
-
${
|
|
33
|
+
${args.slotTemplate || getSlotsFragment()}
|
|
34
34
|
</UEmpty>
|
|
35
35
|
`,
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
-
const
|
|
39
|
-
components: { UEmpty, UIcon, UButton },
|
|
40
|
-
setup() {
|
|
41
|
-
return { args };
|
|
42
|
-
},
|
|
43
|
-
template: `
|
|
44
|
-
<UEmpty v-bind="args">
|
|
45
|
-
${args.slotTemplate}
|
|
46
|
-
</UEmpty>
|
|
47
|
-
`,
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
const SizesTemplate = (args, { argTypes } = {}) => ({
|
|
38
|
+
const EnumVariantTemplate = (args, { argTypes } = {}) => ({
|
|
51
39
|
components: { UEmpty, URow },
|
|
52
40
|
setup() {
|
|
53
41
|
return {
|
|
54
42
|
args,
|
|
55
|
-
|
|
43
|
+
options: argTypes[args.enum].options,
|
|
56
44
|
};
|
|
57
45
|
},
|
|
58
46
|
template: `
|
|
59
47
|
<URow>
|
|
60
48
|
<UEmpty
|
|
61
|
-
v-for="(
|
|
49
|
+
v-for="(option, index) in options"
|
|
62
50
|
v-bind="args"
|
|
63
|
-
:
|
|
64
|
-
:title="
|
|
51
|
+
:[args.enum]="option"
|
|
52
|
+
:title="option"
|
|
65
53
|
:key="index"
|
|
66
54
|
/>
|
|
67
55
|
</URow>
|
|
@@ -71,10 +59,10 @@ const SizesTemplate = (args, { argTypes } = {}) => ({
|
|
|
71
59
|
export const Default = DefaultTemplate.bind({});
|
|
72
60
|
Default.args = {};
|
|
73
61
|
|
|
74
|
-
export const sizes =
|
|
75
|
-
sizes.args = { title: "" };
|
|
62
|
+
export const sizes = EnumVariantTemplate.bind({});
|
|
63
|
+
sizes.args = { enum: "size", title: "" };
|
|
76
64
|
|
|
77
|
-
export const slotHeader =
|
|
65
|
+
export const slotHeader = DefaultTemplate.bind({});
|
|
78
66
|
slotHeader.args = {
|
|
79
67
|
slotTemplate: `
|
|
80
68
|
<template #header>
|
|
@@ -83,12 +71,12 @@ slotHeader.args = {
|
|
|
83
71
|
color="blue"
|
|
84
72
|
size="2xl"
|
|
85
73
|
pill
|
|
86
|
-
|
|
74
|
+
/>
|
|
87
75
|
</template>
|
|
88
76
|
`,
|
|
89
77
|
};
|
|
90
78
|
|
|
91
|
-
export const slotDefault =
|
|
79
|
+
export const slotDefault = DefaultTemplate.bind({});
|
|
92
80
|
slotDefault.args = {
|
|
93
81
|
slotTemplate: `
|
|
94
82
|
<template #default>
|
|
@@ -97,11 +85,11 @@ slotDefault.args = {
|
|
|
97
85
|
`,
|
|
98
86
|
};
|
|
99
87
|
|
|
100
|
-
export const slotFooter =
|
|
88
|
+
export const slotFooter = DefaultTemplate.bind({});
|
|
101
89
|
slotFooter.args = {
|
|
102
90
|
slotTemplate: `
|
|
103
91
|
<template #footer>
|
|
104
|
-
|
|
92
|
+
<UButton label="Add new one" size="sm" variant="thirdary" filled />
|
|
105
93
|
</template>
|
|
106
94
|
`,
|
|
107
95
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getArgTypes } from "../service.storybook";
|
|
1
|
+
import { getArgTypes, getSlotsFragment } from "../service.storybook";
|
|
2
2
|
|
|
3
3
|
import UFile from "../ui.text-file";
|
|
4
4
|
|
|
@@ -24,7 +24,9 @@ const DefaultTemplate = (args) => ({
|
|
|
24
24
|
return { args };
|
|
25
25
|
},
|
|
26
26
|
template: `
|
|
27
|
-
<UFile v-bind="args"
|
|
27
|
+
<UFile v-bind="args">
|
|
28
|
+
${args.slotTemplate || getSlotsFragment()}
|
|
29
|
+
</UFile>
|
|
28
30
|
`,
|
|
29
31
|
});
|
|
30
32
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getArgTypes } from "../service.storybook";
|
|
1
|
+
import { getArgTypes, getSlotsFragment } from "../service.storybook";
|
|
2
2
|
|
|
3
3
|
import UFiles from "../ui.text-files";
|
|
4
4
|
|
|
@@ -27,7 +27,9 @@ const DefaultTemplate = (args) => ({
|
|
|
27
27
|
return { args };
|
|
28
28
|
},
|
|
29
29
|
template: `
|
|
30
|
-
<UFiles v-bind="args"
|
|
30
|
+
<UFiles v-bind="args">
|
|
31
|
+
${args.slotTemplate || getSlotsFragment()}
|
|
32
|
+
</UFiles>
|
|
31
33
|
`,
|
|
32
34
|
});
|
|
33
35
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
|
|
2
2
|
|
|
3
3
|
import UHeader from "../ui.text-header";
|
|
4
4
|
import UGroup from "../ui.container-group";
|
|
@@ -26,68 +26,28 @@ const DefaultTemplate = (args) => ({
|
|
|
26
26
|
return { args, slots };
|
|
27
27
|
},
|
|
28
28
|
template: `
|
|
29
|
-
<UHeader v-bind="args"
|
|
29
|
+
<UHeader v-bind="args">
|
|
30
|
+
${args.slotTemplate || getSlotsFragment()}
|
|
31
|
+
</UHeader>
|
|
30
32
|
`,
|
|
31
33
|
});
|
|
32
34
|
|
|
33
|
-
const
|
|
35
|
+
const EnumVariantTemplate = (args, { argTypes } = {}) => ({
|
|
34
36
|
components: { UHeader, UGroup },
|
|
35
37
|
setup() {
|
|
36
38
|
return {
|
|
37
39
|
args,
|
|
38
|
-
|
|
40
|
+
options: argTypes[args.enum].options,
|
|
39
41
|
};
|
|
40
42
|
},
|
|
41
43
|
template: `
|
|
42
44
|
<UGroup>
|
|
43
45
|
<UHeader
|
|
44
|
-
v-for="(
|
|
46
|
+
v-for="(option, index) in options"
|
|
45
47
|
:key="index"
|
|
46
48
|
v-bind="args"
|
|
47
|
-
:
|
|
48
|
-
:label="'Header ' +
|
|
49
|
-
/>
|
|
50
|
-
</UGroup>
|
|
51
|
-
`,
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const SizesTemplate = (args, { argTypes } = {}) => ({
|
|
55
|
-
components: { UHeader, UGroup },
|
|
56
|
-
setup() {
|
|
57
|
-
return {
|
|
58
|
-
args,
|
|
59
|
-
sizes: argTypes.size.options,
|
|
60
|
-
};
|
|
61
|
-
},
|
|
62
|
-
template: `
|
|
63
|
-
<UGroup>
|
|
64
|
-
<UHeader
|
|
65
|
-
v-for="(size, index) in sizes"
|
|
66
|
-
:key="index"
|
|
67
|
-
v-bind="args"
|
|
68
|
-
:size="size"
|
|
69
|
-
:label="'Header ' + size"
|
|
70
|
-
/>
|
|
71
|
-
</UGroup>
|
|
72
|
-
`,
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
const ColorsTemplate = (args, { argTypes } = {}) => ({
|
|
76
|
-
components: { UHeader, UGroup },
|
|
77
|
-
setup() {
|
|
78
|
-
return {
|
|
79
|
-
args,
|
|
80
|
-
colors: argTypes.color.options,
|
|
81
|
-
};
|
|
82
|
-
},
|
|
83
|
-
template: `
|
|
84
|
-
<UGroup>
|
|
85
|
-
<UHeader
|
|
86
|
-
v-for="(color, index) in colors"
|
|
87
|
-
v-bind="args"
|
|
88
|
-
:key="index"
|
|
89
|
-
:color="color"
|
|
90
|
-
:label="'Header ' + color"
|
|
49
|
+
:[args.enum]="option"
|
|
50
|
+
:label="'Header ' + option"
|
|
91
51
|
/>
|
|
92
52
|
</UGroup>
|
|
93
53
|
`,
|
|
@@ -96,14 +56,14 @@ const ColorsTemplate = (args, { argTypes } = {}) => ({
|
|
|
96
56
|
export const Default = DefaultTemplate.bind({});
|
|
97
57
|
Default.args = {};
|
|
98
58
|
|
|
99
|
-
export const Weights =
|
|
100
|
-
Weights.args = {};
|
|
59
|
+
export const Weights = EnumVariantTemplate.bind({});
|
|
60
|
+
Weights.args = { enum: "weight" };
|
|
101
61
|
|
|
102
|
-
export const Sizes =
|
|
103
|
-
Sizes.args = {};
|
|
62
|
+
export const Sizes = EnumVariantTemplate.bind({});
|
|
63
|
+
Sizes.args = { enum: "size" };
|
|
104
64
|
|
|
105
|
-
export const Underlined =
|
|
106
|
-
Underlined.args = { underlined: true };
|
|
65
|
+
export const Underlined = EnumVariantTemplate.bind({});
|
|
66
|
+
Underlined.args = { enum: "size", underlined: true };
|
|
107
67
|
|
|
108
68
|
export const Multiline = DefaultTemplate.bind({});
|
|
109
69
|
Multiline.args = {
|
|
@@ -112,5 +72,5 @@ Multiline.args = {
|
|
|
112
72
|
label: "Some very long header you ever may imagine in your whole long and beautiful life",
|
|
113
73
|
};
|
|
114
74
|
|
|
115
|
-
export const Colors =
|
|
116
|
-
Colors.args = {};
|
|
75
|
+
export const Colors = EnumVariantTemplate.bind({});
|
|
76
|
+
Colors.args = { enum: "color" };
|