vueless 0.0.253 → 0.0.254
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/ui.form-calendar/index.stories.js +4 -4
- package/ui.form-color-picker/index.stories.js +15 -11
- package/ui.form-date-picker/configs/default.config.js +1 -0
- package/ui.form-date-picker/index.stories.js +26 -36
- package/ui.form-date-picker-range/index.stories.js +23 -32
- package/ui.form-radio/index.stories.js +5 -17
- package/ui.form-radio-group/index.stories.js +43 -86
- package/web-types.json +1 -1
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getArgTypes, getSlotNames,
|
|
1
|
+
import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
|
|
2
2
|
|
|
3
3
|
import UCalendar from "../ui.form-calendar";
|
|
4
4
|
|
|
@@ -36,7 +36,7 @@ const DefaultTemplate = (args) => ({
|
|
|
36
36
|
},
|
|
37
37
|
template: `
|
|
38
38
|
<UCalendar v-bind="args" v-model="value">
|
|
39
|
-
${
|
|
39
|
+
${args.slotTemplate || getSlotsFragment()}
|
|
40
40
|
</UCalendar>
|
|
41
41
|
|
|
42
42
|
<div class="mt-4">
|
|
@@ -52,8 +52,8 @@ export const Range = DefaultTemplate.bind({});
|
|
|
52
52
|
Range.args = {
|
|
53
53
|
range: true,
|
|
54
54
|
value: {
|
|
55
|
-
from: new Date(
|
|
56
|
-
to: new Date(
|
|
55
|
+
from: new Date(new Date().setDate(new Date().getDate() - new Date().getDay())),
|
|
56
|
+
to: new Date(new Date().setDate(new Date().getDate() + (6 - new Date().getDay()))),
|
|
57
57
|
},
|
|
58
58
|
};
|
|
59
59
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getArgTypes } from "../service.storybook";
|
|
1
|
+
import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
|
|
2
2
|
import UColorPicker from "../ui.form-color-picker";
|
|
3
3
|
import UCol from "../ui.container-col";
|
|
4
4
|
|
|
@@ -21,30 +21,34 @@ export default {
|
|
|
21
21
|
const DefaultTemplate = (args) => ({
|
|
22
22
|
components: { UColorPicker },
|
|
23
23
|
setup() {
|
|
24
|
-
|
|
24
|
+
const slots = getSlotNames(UColorPicker.name);
|
|
25
|
+
|
|
26
|
+
return { args, slots };
|
|
25
27
|
},
|
|
26
28
|
template: `
|
|
27
|
-
<UColorPicker v-bind="args" v-model="args.value"
|
|
29
|
+
<UColorPicker v-bind="args" v-model="args.value">
|
|
30
|
+
${args.slotTemplate || getSlotsFragment()}
|
|
31
|
+
</UColorPicker>
|
|
28
32
|
`,
|
|
29
33
|
});
|
|
30
34
|
|
|
31
|
-
const
|
|
35
|
+
const EnumVariantTemplate = (args, { argTypes } = {}) => ({
|
|
32
36
|
components: { UCol, UColorPicker },
|
|
33
37
|
setup() {
|
|
34
38
|
return {
|
|
35
39
|
args,
|
|
36
|
-
|
|
40
|
+
options: argTypes[args.enum].options,
|
|
37
41
|
};
|
|
38
42
|
},
|
|
39
43
|
template: `
|
|
40
44
|
<UCol>
|
|
41
45
|
<UColorPicker
|
|
42
|
-
v-for="(
|
|
43
|
-
v-bind="args"
|
|
44
|
-
:size="size"
|
|
46
|
+
v-for="(option, index) in options"
|
|
45
47
|
:key="index"
|
|
46
|
-
|
|
48
|
+
v-bind="args"
|
|
47
49
|
v-model="args.value"
|
|
50
|
+
:[args.enum]="option"
|
|
51
|
+
:name="option"
|
|
48
52
|
/>
|
|
49
53
|
</UCol>
|
|
50
54
|
`,
|
|
@@ -53,8 +57,8 @@ const SizesTemplate = (args, { argTypes } = {}) => ({
|
|
|
53
57
|
export const Default = DefaultTemplate.bind({});
|
|
54
58
|
Default.args = {};
|
|
55
59
|
|
|
56
|
-
export const Sizes =
|
|
57
|
-
Sizes.args = {};
|
|
60
|
+
export const Sizes = EnumVariantTemplate.bind({});
|
|
61
|
+
Sizes.args = { enum: "size" };
|
|
58
62
|
|
|
59
63
|
export const Description = DefaultTemplate.bind({});
|
|
60
64
|
Description.args = { description: "Description" };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getArgTypes, getSlotNames,
|
|
1
|
+
import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
|
|
2
2
|
|
|
3
3
|
import UDatePicker from "../ui.form-date-picker";
|
|
4
4
|
import UIcon from "../ui.image-icon";
|
|
@@ -27,7 +27,7 @@ export default {
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
const DefaultTemplate = (args) => ({
|
|
30
|
-
components: { UDatePicker },
|
|
30
|
+
components: { UDatePicker, UIcon },
|
|
31
31
|
setup() {
|
|
32
32
|
const slots = getSlotNames(UDatePicker.name);
|
|
33
33
|
|
|
@@ -40,7 +40,7 @@ const DefaultTemplate = (args) => ({
|
|
|
40
40
|
},
|
|
41
41
|
template: `
|
|
42
42
|
<UDatePicker v-bind="args" v-model="value">
|
|
43
|
-
${
|
|
43
|
+
${args.slotTemplate || getSlotsFragment()}
|
|
44
44
|
</UDatePicker>
|
|
45
45
|
|
|
46
46
|
<div class="mt-4">
|
|
@@ -49,24 +49,23 @@ const DefaultTemplate = (args) => ({
|
|
|
49
49
|
`,
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
const
|
|
52
|
+
const EnumVariantTemplate = (args, { argTypes } = {}) => ({
|
|
53
53
|
components: { UDatePicker, URow },
|
|
54
54
|
setup() {
|
|
55
55
|
return {
|
|
56
56
|
args,
|
|
57
|
-
|
|
57
|
+
options: argTypes[args.enum].options,
|
|
58
58
|
};
|
|
59
59
|
},
|
|
60
60
|
template: `
|
|
61
61
|
<URow>
|
|
62
62
|
<UDatePicker
|
|
63
|
-
v-for="(
|
|
64
|
-
:size="size"
|
|
65
|
-
:label="size"
|
|
66
|
-
v-bind="args"
|
|
63
|
+
v-for="(option, index) in options"
|
|
67
64
|
:key="index"
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
v-bind="args"
|
|
66
|
+
:[args.enum]="option"
|
|
67
|
+
:label="option"
|
|
68
|
+
/>
|
|
70
69
|
</URow>
|
|
71
70
|
`,
|
|
72
71
|
});
|
|
@@ -83,50 +82,44 @@ const OpenDirectionTemplate = (args) => ({
|
|
|
83
82
|
<UDatePicker
|
|
84
83
|
class="w-full"
|
|
85
84
|
open-direction-y="top"
|
|
85
|
+
open-direction-x="left"
|
|
86
86
|
v-bind="args"
|
|
87
87
|
v-model="args.value"
|
|
88
|
+
label="Top Left"
|
|
88
89
|
/>
|
|
89
90
|
<UDatePicker
|
|
90
91
|
class="w-full"
|
|
91
|
-
open-direction-y="
|
|
92
|
+
open-direction-y="top"
|
|
92
93
|
open-direction-x="right"
|
|
93
94
|
v-bind="args"
|
|
94
95
|
v-model="args.value"
|
|
96
|
+
label="Top Right"
|
|
95
97
|
/>
|
|
96
98
|
<UDatePicker
|
|
97
99
|
class="w-full"
|
|
98
100
|
open-direction-y="bottom"
|
|
101
|
+
open-direction-x="left"
|
|
99
102
|
v-bind="args"
|
|
100
103
|
v-model="args.value"
|
|
104
|
+
label="Bottom Left"
|
|
101
105
|
/>
|
|
102
106
|
<UDatePicker
|
|
103
107
|
class="w-full"
|
|
104
108
|
open-direction-y="bottom"
|
|
105
|
-
open-direction-x="
|
|
109
|
+
open-direction-x="right"
|
|
106
110
|
v-bind="args"
|
|
107
111
|
v-model="args.value"
|
|
112
|
+
label="Bottom Right"
|
|
108
113
|
/>
|
|
109
114
|
</URow>
|
|
110
115
|
`,
|
|
111
116
|
});
|
|
112
117
|
|
|
113
|
-
const SlotTemplate = (args) => ({
|
|
114
|
-
components: { UDatePicker, UIcon },
|
|
115
|
-
setup() {
|
|
116
|
-
return { args };
|
|
117
|
-
},
|
|
118
|
-
template: `
|
|
119
|
-
<UDatePicker v-bind="args">
|
|
120
|
-
${args.slotTemplate}
|
|
121
|
-
</UDatePicker>
|
|
122
|
-
`,
|
|
123
|
-
});
|
|
124
|
-
|
|
125
118
|
export const Default = DefaultTemplate.bind({});
|
|
126
119
|
Default.args = { value: new Date() };
|
|
127
120
|
|
|
128
|
-
export const sizes =
|
|
129
|
-
sizes.args = { label: "" };
|
|
121
|
+
export const sizes = EnumVariantTemplate.bind({});
|
|
122
|
+
sizes.args = { enum: "size", label: "" };
|
|
130
123
|
|
|
131
124
|
export const openDirection = OpenDirectionTemplate.bind({});
|
|
132
125
|
openDirection.args = {};
|
|
@@ -156,32 +149,29 @@ MinMax.args = {
|
|
|
156
149
|
value: new Date(2022, 2, 24),
|
|
157
150
|
};
|
|
158
151
|
|
|
159
|
-
export const slotIcon =
|
|
152
|
+
export const slotIcon = DefaultTemplate.bind({});
|
|
160
153
|
slotIcon.args = {
|
|
161
154
|
slotTemplate: `
|
|
162
155
|
<template #right-icon>
|
|
163
|
-
<UIcon
|
|
164
|
-
name="star"
|
|
165
|
-
color="black"
|
|
166
|
-
/>
|
|
156
|
+
<UIcon name="star" color="black" />
|
|
167
157
|
</template>
|
|
168
158
|
`,
|
|
169
159
|
};
|
|
170
160
|
|
|
171
|
-
export const slotRight =
|
|
161
|
+
export const slotRight = DefaultTemplate.bind({});
|
|
172
162
|
slotRight.args = {
|
|
173
163
|
slotTemplate: `
|
|
174
164
|
<template #right>
|
|
175
|
-
|
|
165
|
+
🤘🤘🤘
|
|
176
166
|
</template>
|
|
177
167
|
`,
|
|
178
168
|
};
|
|
179
169
|
|
|
180
|
-
export const slotLeft =
|
|
170
|
+
export const slotLeft = DefaultTemplate.bind({});
|
|
181
171
|
slotRight.args = {
|
|
182
172
|
slotTemplate: `
|
|
183
173
|
<template #left>
|
|
184
|
-
|
|
174
|
+
🤘🤘🤘
|
|
185
175
|
</template>
|
|
186
176
|
`,
|
|
187
177
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getArgTypes, getSlotNames,
|
|
1
|
+
import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
|
|
2
2
|
|
|
3
3
|
import UDatePickerRange from "../ui.form-date-picker-range";
|
|
4
4
|
import URow from "../ui.container-row";
|
|
@@ -44,7 +44,7 @@ const DefaultTemplate = (args) => ({
|
|
|
44
44
|
},
|
|
45
45
|
template: `
|
|
46
46
|
<UDatePickerRange v-bind="args" v-model="value">
|
|
47
|
-
${
|
|
47
|
+
${args.slotTemplate || getSlotsFragment()}
|
|
48
48
|
</UDatePickerRange>
|
|
49
49
|
|
|
50
50
|
<div class="mt-4">
|
|
@@ -53,74 +53,65 @@ const DefaultTemplate = (args) => ({
|
|
|
53
53
|
`,
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
-
const
|
|
57
|
-
components: { UDatePickerRange },
|
|
58
|
-
setup() {
|
|
59
|
-
return { args };
|
|
60
|
-
},
|
|
61
|
-
template: `
|
|
62
|
-
<UDatePickerRange v-bind="args" v-model="args.value">
|
|
63
|
-
${args.slotTemplate}
|
|
64
|
-
</UDatePickerRange>
|
|
65
|
-
`,
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
const VariantsTemplate = (args, { argTypes } = {}) => ({
|
|
56
|
+
const EnumVariantTemplate = (args, { argTypes } = {}) => ({
|
|
69
57
|
components: { UDatePickerRange, URow },
|
|
70
58
|
setup() {
|
|
71
59
|
return {
|
|
72
60
|
args,
|
|
73
|
-
|
|
61
|
+
options: argTypes[args.enum].options,
|
|
74
62
|
};
|
|
75
63
|
},
|
|
76
64
|
template: `
|
|
77
65
|
<URow>
|
|
78
66
|
<UDatePickerRange
|
|
79
|
-
v-for="(
|
|
80
|
-
:
|
|
67
|
+
v-for="(option, index) in options"
|
|
68
|
+
:key="index"
|
|
81
69
|
v-bind="args"
|
|
82
70
|
v-model="args.value"
|
|
83
|
-
:
|
|
71
|
+
:[args.enum]="option"
|
|
84
72
|
/>
|
|
85
73
|
</URow>
|
|
86
74
|
`,
|
|
87
75
|
});
|
|
88
76
|
|
|
89
|
-
const OpenDirectionTemplate = (args
|
|
77
|
+
const OpenDirectionTemplate = (args) => ({
|
|
90
78
|
components: { UDatePickerRange, URow },
|
|
91
79
|
setup() {
|
|
92
|
-
return {
|
|
93
|
-
args,
|
|
94
|
-
directions: argTypes.openDirection.options,
|
|
95
|
-
};
|
|
80
|
+
return { args };
|
|
96
81
|
},
|
|
97
82
|
template: `
|
|
98
83
|
<URow class="!flex-col">
|
|
99
84
|
<UDatePickerRange
|
|
100
85
|
class="w-full"
|
|
101
86
|
open-direction-y="top"
|
|
87
|
+
open-direction-x="left"
|
|
102
88
|
v-bind="args"
|
|
103
89
|
v-model="args.value"
|
|
90
|
+
label="Top Left"
|
|
104
91
|
/>
|
|
105
92
|
<UDatePickerRange
|
|
106
93
|
class="w-full"
|
|
107
|
-
open-direction-y="
|
|
94
|
+
open-direction-y="top"
|
|
108
95
|
open-direction-x="right"
|
|
109
96
|
v-bind="args"
|
|
110
97
|
v-model="args.value"
|
|
98
|
+
label="Top Right"
|
|
111
99
|
/>
|
|
112
100
|
<UDatePickerRange
|
|
113
101
|
class="w-full"
|
|
114
102
|
open-direction-y="bottom"
|
|
103
|
+
open-direction-x="left"
|
|
115
104
|
v-bind="args"
|
|
116
105
|
v-model="args.value"
|
|
106
|
+
label="Bottom Left"
|
|
117
107
|
/>
|
|
118
108
|
<UDatePickerRange
|
|
119
109
|
class="w-full"
|
|
120
110
|
open-direction-y="bottom"
|
|
121
|
-
open-direction-x="
|
|
111
|
+
open-direction-x="right"
|
|
122
112
|
v-bind="args"
|
|
123
113
|
v-model="args.value"
|
|
114
|
+
label="Bottom Right"
|
|
124
115
|
/>
|
|
125
116
|
</URow>
|
|
126
117
|
`,
|
|
@@ -129,14 +120,14 @@ const OpenDirectionTemplate = (args, { argTypes } = {}) => ({
|
|
|
129
120
|
export const Default = DefaultTemplate.bind({});
|
|
130
121
|
Default.args = {};
|
|
131
122
|
|
|
132
|
-
export const variants =
|
|
133
|
-
variants.args = {};
|
|
123
|
+
export const variants = EnumVariantTemplate.bind({});
|
|
124
|
+
variants.args = { enum: "variant" };
|
|
134
125
|
|
|
135
126
|
export const openDirection = OpenDirectionTemplate.bind({});
|
|
136
127
|
openDirection.args = {};
|
|
137
128
|
|
|
138
|
-
export const disabled =
|
|
139
|
-
disabled.args = { disabled: true };
|
|
129
|
+
export const disabled = EnumVariantTemplate.bind({});
|
|
130
|
+
disabled.args = { enum: "variant", disabled: true };
|
|
140
131
|
|
|
141
132
|
export const label = DefaultTemplate.bind({});
|
|
142
133
|
label.args = { variant: "input", label: "some label" };
|
|
@@ -174,7 +165,7 @@ customRangeButton.args = {
|
|
|
174
165
|
value: { from: null, to: null },
|
|
175
166
|
};
|
|
176
167
|
|
|
177
|
-
export const slotLeft =
|
|
168
|
+
export const slotLeft = DefaultTemplate.bind({});
|
|
178
169
|
slotLeft.args = {
|
|
179
170
|
variant: "input",
|
|
180
171
|
slotTemplate: `
|
|
@@ -184,7 +175,7 @@ slotLeft.args = {
|
|
|
184
175
|
`,
|
|
185
176
|
};
|
|
186
177
|
|
|
187
|
-
export const slotRight =
|
|
178
|
+
export const slotRight = DefaultTemplate.bind({});
|
|
188
179
|
slotRight.args = {
|
|
189
180
|
variant: "input",
|
|
190
181
|
slotTemplate: `
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getArgTypes, getSlotNames,
|
|
1
|
+
import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
|
|
2
2
|
|
|
3
3
|
import URadio from "../ui.form-radio";
|
|
4
4
|
import UBadge from "../ui.text-badge";
|
|
@@ -22,7 +22,7 @@ export default {
|
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
const DefaultTemplate = (args) => ({
|
|
25
|
-
components: { URadio },
|
|
25
|
+
components: { URadio, UBadge },
|
|
26
26
|
setup() {
|
|
27
27
|
const slots = getSlotNames(URadio.name);
|
|
28
28
|
|
|
@@ -30,19 +30,7 @@ const DefaultTemplate = (args) => ({
|
|
|
30
30
|
},
|
|
31
31
|
template: `
|
|
32
32
|
<URadio v-bind="args">
|
|
33
|
-
${
|
|
34
|
-
</URadio>
|
|
35
|
-
`,
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const SlotTemplate = (args) => ({
|
|
39
|
-
components: { URadio, UBadge },
|
|
40
|
-
setup() {
|
|
41
|
-
return { args };
|
|
42
|
-
},
|
|
43
|
-
template: `
|
|
44
|
-
<URadio v-bind="args">
|
|
45
|
-
${args.slotTemplate}
|
|
33
|
+
${args.slotTemplate || getSlotsFragment()}
|
|
46
34
|
</URadio>
|
|
47
35
|
`,
|
|
48
36
|
});
|
|
@@ -59,14 +47,14 @@ description.args = { name: "radio3", description: "description" };
|
|
|
59
47
|
export const checked = DefaultTemplate.bind({});
|
|
60
48
|
checked.args = { checked: true, name: "radio4" };
|
|
61
49
|
|
|
62
|
-
export const slotFooter =
|
|
50
|
+
export const slotFooter = DefaultTemplate.bind({});
|
|
63
51
|
slotFooter.args = {
|
|
64
52
|
name: "radio5",
|
|
65
53
|
label: "radio",
|
|
66
54
|
value: "radio",
|
|
67
55
|
slotTemplate: `
|
|
68
56
|
<template #footer>
|
|
69
|
-
|
|
57
|
+
<UBadge label="favourite" color="green" size="sm" />
|
|
70
58
|
</template>
|
|
71
59
|
`,
|
|
72
60
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getArgTypes } from "../service.storybook";
|
|
1
|
+
import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
|
|
2
2
|
|
|
3
3
|
import URadioGroup from "../ui.form-radio-group";
|
|
4
4
|
import URadio from "../ui.form-radio";
|
|
@@ -13,24 +13,28 @@ export default {
|
|
|
13
13
|
id: "3160",
|
|
14
14
|
title: "Form Inputs & Controls / Radio Group",
|
|
15
15
|
component: URadioGroup,
|
|
16
|
-
args: {
|
|
17
|
-
label: "Label",
|
|
18
|
-
value: "One",
|
|
19
|
-
radios: [
|
|
20
|
-
{ name: "radio", label: "Radio 1", value: "1" },
|
|
21
|
-
{ name: "radio", label: "Radio 2", value: "2" },
|
|
22
|
-
{ name: "radio", label: "Radio 3", value: "3" },
|
|
23
|
-
],
|
|
24
|
-
},
|
|
16
|
+
args: {},
|
|
25
17
|
argTypes: {
|
|
26
18
|
...getArgTypes(URadioGroup.name),
|
|
27
19
|
},
|
|
28
20
|
};
|
|
29
21
|
|
|
22
|
+
const defaultRadios = [
|
|
23
|
+
{ name: "slotValues", label: "Boolean", value: false },
|
|
24
|
+
{ name: "slotValues", label: "String", value: "One" },
|
|
25
|
+
{ name: "slotValues", label: "Number", value: 3 },
|
|
26
|
+
{ name: "slotValues", label: "Object", value: { key: "value" } },
|
|
27
|
+
{ name: "slotValues", label: "Array", value: ["Array", 1] },
|
|
28
|
+
];
|
|
29
|
+
|
|
30
30
|
const DefaultTemplate = (args) => ({
|
|
31
31
|
components: { URadioGroup, URadio, UAlert, URow, UCol },
|
|
32
32
|
setup() {
|
|
33
|
-
|
|
33
|
+
const slots = getSlotNames(URadioGroup.name);
|
|
34
|
+
|
|
35
|
+
const radios = args.radios ? args.radios : defaultRadios;
|
|
36
|
+
|
|
37
|
+
return { args, slots, radios };
|
|
34
38
|
},
|
|
35
39
|
data() {
|
|
36
40
|
return {
|
|
@@ -40,7 +44,13 @@ const DefaultTemplate = (args) => ({
|
|
|
40
44
|
template: `
|
|
41
45
|
<UCol gap="2xl">
|
|
42
46
|
<URadioGroup v-bind="args" v-model="value">
|
|
43
|
-
<URadio
|
|
47
|
+
<URadio
|
|
48
|
+
v-for="(radio, index) in radios"
|
|
49
|
+
:key="index"
|
|
50
|
+
v-bind="radio"
|
|
51
|
+
>
|
|
52
|
+
${args.slotTemplate || getSlotsFragment()}
|
|
53
|
+
</URadio>
|
|
44
54
|
</URadioGroup>
|
|
45
55
|
<UAlert color="gray" size="xs">
|
|
46
56
|
<code>Selected value: <b>{{ value }}</b></code>
|
|
@@ -49,78 +59,33 @@ const DefaultTemplate = (args) => ({
|
|
|
49
59
|
`,
|
|
50
60
|
});
|
|
51
61
|
|
|
52
|
-
const
|
|
53
|
-
components: { URadioGroup, URadio, UAlert, URow },
|
|
54
|
-
setup() {
|
|
55
|
-
return { args };
|
|
56
|
-
},
|
|
57
|
-
data() {
|
|
58
|
-
return {
|
|
59
|
-
value: args.value,
|
|
60
|
-
};
|
|
61
|
-
},
|
|
62
|
-
template: `
|
|
63
|
-
<URow class="!flex-col">
|
|
64
|
-
<URadioGroup v-bind="args" v-model="value" :options="args.radios" />
|
|
65
|
-
|
|
66
|
-
<URow>
|
|
67
|
-
<UAlert color="blue">
|
|
68
|
-
<p>Selected value: {{ value }}</p>
|
|
69
|
-
</UAlert>
|
|
70
|
-
</URow>
|
|
71
|
-
</URow>
|
|
72
|
-
`,
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
const ColorsTemplate = (args, { argTypes } = {}) => ({
|
|
62
|
+
const EnumVariantTemplate = (args, { argTypes } = {}) => ({
|
|
76
63
|
components: { URadioGroup, URow },
|
|
77
64
|
setup() {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
data() {
|
|
65
|
+
const radios = defaultRadios;
|
|
66
|
+
|
|
81
67
|
return {
|
|
82
|
-
|
|
83
|
-
|
|
68
|
+
args,
|
|
69
|
+
options: argTypes[args.enum].options,
|
|
70
|
+
radios,
|
|
84
71
|
};
|
|
85
72
|
},
|
|
86
|
-
template: `
|
|
87
|
-
<URow class="!flex-col">
|
|
88
|
-
<URadioGroup
|
|
89
|
-
v-bind="args"
|
|
90
|
-
v-for="color in colors"
|
|
91
|
-
:key="color"
|
|
92
|
-
:label="color"
|
|
93
|
-
:color="color"
|
|
94
|
-
:options="args.radios"
|
|
95
|
-
:name="color"
|
|
96
|
-
v-model="value"
|
|
97
|
-
/>
|
|
98
|
-
</URow>
|
|
99
|
-
`,
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
const SizesTemplate = (args, { argTypes } = {}) => ({
|
|
103
|
-
components: { URadioGroup, URow },
|
|
104
|
-
setup() {
|
|
105
|
-
return { args };
|
|
106
|
-
},
|
|
107
73
|
data() {
|
|
108
74
|
return {
|
|
109
75
|
value: args.value,
|
|
110
|
-
sizes: argTypes.size.options,
|
|
111
76
|
};
|
|
112
77
|
},
|
|
113
78
|
template: `
|
|
114
79
|
<URow class="!flex-col">
|
|
115
80
|
<URadioGroup
|
|
81
|
+
v-for="(option, index) in options"
|
|
82
|
+
:key="index"
|
|
116
83
|
v-bind="args"
|
|
117
|
-
v-for="size in sizes"
|
|
118
|
-
:key="size"
|
|
119
|
-
:label="size"
|
|
120
|
-
:size="size"
|
|
121
|
-
:options="args.radios"
|
|
122
|
-
:name="size"
|
|
123
84
|
v-model="value"
|
|
85
|
+
:[args.enum]="option"
|
|
86
|
+
:label="option"
|
|
87
|
+
:options="radios"
|
|
88
|
+
:name="option"
|
|
124
89
|
/>
|
|
125
90
|
</URow>
|
|
126
91
|
`,
|
|
@@ -129,30 +94,22 @@ const SizesTemplate = (args, { argTypes } = {}) => ({
|
|
|
129
94
|
export const Default = DefaultTemplate.bind({});
|
|
130
95
|
Default.args = {
|
|
131
96
|
name: "Default",
|
|
132
|
-
isDefaultStory: true,
|
|
133
|
-
radios: [
|
|
134
|
-
{ name: "slotValues", label: "Boolean", value: false },
|
|
135
|
-
{ name: "slotValues", label: "String", value: "One" },
|
|
136
|
-
{ name: "slotValues", label: "Number", value: 3 },
|
|
137
|
-
{ name: "slotValues", label: "Object", value: { key: "value" } },
|
|
138
|
-
{ name: "slotValues", label: "Array", value: ["Array", 1] },
|
|
139
|
-
],
|
|
140
97
|
};
|
|
141
98
|
|
|
142
|
-
export const Options =
|
|
99
|
+
export const Options = DefaultTemplate.bind({});
|
|
143
100
|
Options.args = {
|
|
144
101
|
name: "Options",
|
|
145
102
|
radios: [
|
|
146
103
|
{ name: "radioValues", label: "Boolean", value: false },
|
|
147
|
-
{ name: "radioValues", label: "String", value: "
|
|
148
|
-
{ name: "radioValues", label: "Number", value:
|
|
149
|
-
{ name: "radioValues", label: "Object", value: { key: "value" } },
|
|
150
|
-
{ name: "radioValues", label: "Array", value: ["
|
|
104
|
+
{ name: "radioValues", label: "String", value: "Custom string value" },
|
|
105
|
+
{ name: "radioValues", label: "Number", value: 4 },
|
|
106
|
+
{ name: "radioValues", label: "Object", value: { key: "Custom object value" } },
|
|
107
|
+
{ name: "radioValues", label: "Array", value: ["Custom array value", 2] },
|
|
151
108
|
],
|
|
152
109
|
};
|
|
153
110
|
|
|
154
|
-
export const Colors =
|
|
155
|
-
Colors.args = { name: "Colors" };
|
|
111
|
+
export const Colors = EnumVariantTemplate.bind({});
|
|
112
|
+
Colors.args = { enum: "color", name: "Colors" };
|
|
156
113
|
|
|
157
|
-
export const Sizes =
|
|
158
|
-
Sizes.args = { name: "Sizes" };
|
|
114
|
+
export const Sizes = EnumVariantTemplate.bind({});
|
|
115
|
+
Sizes.args = { enum: "size", name: "Sizes" };
|