vueless 0.0.482 → 0.0.483
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.button/storybook/stories.js +100 -40
- package/ui.button-link/storybook/stories.js +109 -35
- package/web-types.json +1 -1
package/package.json
CHANGED
|
@@ -5,6 +5,8 @@ import {
|
|
|
5
5
|
getDocsDescription,
|
|
6
6
|
} from "../../utils/storybook.ts";
|
|
7
7
|
|
|
8
|
+
import { ref } from "vue";
|
|
9
|
+
|
|
8
10
|
import UButton from "../../ui.button/UButton.vue";
|
|
9
11
|
import UIcon from "../../ui.image-icon/UIcon.vue";
|
|
10
12
|
import URow from "../../ui.container-row/URow.vue";
|
|
@@ -46,7 +48,7 @@ const EnumVariantTemplate = (args, { argTypes }) => ({
|
|
|
46
48
|
},
|
|
47
49
|
template: `
|
|
48
50
|
<UCol>
|
|
49
|
-
<URow>
|
|
51
|
+
<URow no-mobile>
|
|
50
52
|
<UButton
|
|
51
53
|
v-for="(option, index) in options"
|
|
52
54
|
:key="index"
|
|
@@ -62,22 +64,28 @@ const EnumVariantTemplate = (args, { argTypes }) => ({
|
|
|
62
64
|
const ColorTemplate = (args, { argTypes }) => ({
|
|
63
65
|
components: { UButton, URow, UCol },
|
|
64
66
|
setup() {
|
|
67
|
+
const variants = [...argTypes.variant.options, "thirdary"];
|
|
68
|
+
|
|
65
69
|
return {
|
|
66
70
|
args,
|
|
67
|
-
variants
|
|
71
|
+
variants,
|
|
68
72
|
colors: argTypes.color.options,
|
|
73
|
+
shouldBeFilled: (variant, index) => {
|
|
74
|
+
return variant === "thirdary" && index === variants.length - 2;
|
|
75
|
+
},
|
|
69
76
|
};
|
|
70
77
|
},
|
|
71
78
|
template: `
|
|
72
79
|
<UCol>
|
|
73
|
-
<URow v-for="(variant,
|
|
80
|
+
<URow v-for="(variant, variantIndex) in variants" :key="variantIndex" no-mobile>
|
|
74
81
|
<UButton
|
|
75
|
-
v-for="(color,
|
|
82
|
+
v-for="(color, colorIndex) in colors"
|
|
76
83
|
v-bind="args"
|
|
77
84
|
:variant="variant"
|
|
78
85
|
:color="color"
|
|
79
86
|
:label="color"
|
|
80
|
-
:key="
|
|
87
|
+
:key="colorIndex"
|
|
88
|
+
:filled="shouldBeFilled(variant, variantIndex)"
|
|
81
89
|
/>
|
|
82
90
|
</URow>
|
|
83
91
|
</UCol>
|
|
@@ -96,6 +104,37 @@ Sizes.args = { enum: "size" };
|
|
|
96
104
|
export const Round = EnumVariantTemplate.bind({});
|
|
97
105
|
Round.args = { enum: "variant", round: true };
|
|
98
106
|
|
|
107
|
+
export const Loading = (args) => ({
|
|
108
|
+
components: { UButton, URow },
|
|
109
|
+
setup() {
|
|
110
|
+
const loading = ref(false);
|
|
111
|
+
|
|
112
|
+
function toggleLoading() {
|
|
113
|
+
loading.value = !loading.value;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return { args, toggleLoading, loading };
|
|
117
|
+
},
|
|
118
|
+
template: `
|
|
119
|
+
<URow no-mobile>
|
|
120
|
+
<UButton
|
|
121
|
+
label="Loader demo"
|
|
122
|
+
:loading="loading"
|
|
123
|
+
/>
|
|
124
|
+
<UButton
|
|
125
|
+
label="Toggle loading"
|
|
126
|
+
variant="secondary"
|
|
127
|
+
color="green"
|
|
128
|
+
leftIcon="play_arrow"
|
|
129
|
+
@click="toggleLoading"
|
|
130
|
+
/>
|
|
131
|
+
</URow>
|
|
132
|
+
`,
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
export const Block = DefaultTemplate.bind({});
|
|
136
|
+
Block.args = { block: true };
|
|
137
|
+
|
|
99
138
|
export const Disabled = EnumVariantTemplate.bind({});
|
|
100
139
|
Disabled.args = { enum: "variant", disabled: true };
|
|
101
140
|
|
|
@@ -105,43 +144,64 @@ NoRing.args = { noRing: true };
|
|
|
105
144
|
export const Colors = ColorTemplate.bind({});
|
|
106
145
|
Colors.args = {};
|
|
107
146
|
|
|
108
|
-
export const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
export const RightIcon = DefaultTemplate.bind({});
|
|
112
|
-
RightIcon.args = { rightIcon: "star" };
|
|
147
|
+
export const Square = DefaultTemplate.bind({});
|
|
148
|
+
Square.args = { square: true, icon: "filter_list" };
|
|
113
149
|
|
|
114
|
-
export const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
LeftSlot.args = {
|
|
125
|
-
slotTemplate: `
|
|
126
|
-
<template #left>
|
|
127
|
-
<UIcon
|
|
128
|
-
name="archive"
|
|
129
|
-
color="red"
|
|
130
|
-
size="sm"
|
|
150
|
+
export const IconProps = (args) => ({
|
|
151
|
+
components: { UButton, URow },
|
|
152
|
+
setup() {
|
|
153
|
+
return { args };
|
|
154
|
+
},
|
|
155
|
+
template: `
|
|
156
|
+
<URow no-mobile>
|
|
157
|
+
<UButton
|
|
158
|
+
leftIcon="download"
|
|
159
|
+
label="Download"
|
|
131
160
|
/>
|
|
132
|
-
|
|
161
|
+
<UButton
|
|
162
|
+
rightIcon="menu"
|
|
163
|
+
label="Menu"
|
|
164
|
+
/>
|
|
165
|
+
</URow>
|
|
133
166
|
`,
|
|
134
|
-
};
|
|
167
|
+
});
|
|
135
168
|
|
|
136
|
-
export const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
169
|
+
export const Slots = (args) => ({
|
|
170
|
+
components: { UButton, UIcon, URow },
|
|
171
|
+
setup() {
|
|
172
|
+
return { args };
|
|
173
|
+
},
|
|
174
|
+
template: `
|
|
175
|
+
<URow no-mobile>
|
|
176
|
+
<UButton v-bind="args" label="Add to favorite">
|
|
177
|
+
<template #left>
|
|
178
|
+
<UIcon
|
|
179
|
+
name="heart_plus"
|
|
180
|
+
color="green"
|
|
181
|
+
size="sm"
|
|
182
|
+
/>
|
|
183
|
+
</template>
|
|
184
|
+
</UButton>
|
|
185
|
+
|
|
186
|
+
<UButton v-bind="args" square>
|
|
187
|
+
<template #default>
|
|
188
|
+
<UIcon
|
|
189
|
+
name="settings"
|
|
190
|
+
color="green"
|
|
191
|
+
size="sm"
|
|
192
|
+
/>
|
|
193
|
+
</template>
|
|
194
|
+
</UButton>
|
|
195
|
+
|
|
196
|
+
<UButton v-bind="args" label="Delete">
|
|
197
|
+
<template #right>
|
|
198
|
+
<UIcon
|
|
199
|
+
name="delete"
|
|
200
|
+
color="green"
|
|
201
|
+
size="sm"
|
|
202
|
+
/>
|
|
203
|
+
</template>
|
|
204
|
+
</UButton>
|
|
205
|
+
</URow>
|
|
146
206
|
`,
|
|
147
|
-
};
|
|
207
|
+
});
|
|
@@ -50,7 +50,7 @@ const EnumVariantTemplate = (args, { argTypes }) => ({
|
|
|
50
50
|
return { args, options: argTypes[args.enum].options, prefixedOptions };
|
|
51
51
|
},
|
|
52
52
|
template: `
|
|
53
|
-
<URow>
|
|
53
|
+
<URow no-mobile>
|
|
54
54
|
<ULink
|
|
55
55
|
v-for="(option, index) in options"
|
|
56
56
|
:key="index"
|
|
@@ -71,26 +71,93 @@ Sizes.args = { enum: "size" };
|
|
|
71
71
|
export const Colors = EnumVariantTemplate.bind({});
|
|
72
72
|
Colors.args = { enum: "color" };
|
|
73
73
|
|
|
74
|
-
export const Types =
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
export const Types = (args) => ({
|
|
75
|
+
components: { ULink, URow },
|
|
76
|
+
setup() {
|
|
77
|
+
function getTypeLabel(type) {
|
|
78
|
+
switch (type) {
|
|
79
|
+
case "phone":
|
|
80
|
+
return "+1 (000) 123-4567";
|
|
81
|
+
case "email":
|
|
82
|
+
return "hello@vueless.com";
|
|
83
|
+
case "link":
|
|
84
|
+
return "Vueless.com";
|
|
85
|
+
}
|
|
86
|
+
}
|
|
79
87
|
|
|
80
|
-
|
|
81
|
-
|
|
88
|
+
function getTypeHref(type, label) {
|
|
89
|
+
switch (type) {
|
|
90
|
+
case "phone": {
|
|
91
|
+
const phoneNumber = label.replace(/\D/g, "");
|
|
92
|
+
|
|
93
|
+
return `+${phoneNumber}`;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
case "email":
|
|
97
|
+
return `${label}`;
|
|
98
|
+
case "link":
|
|
99
|
+
return "https://vueless.com/";
|
|
100
|
+
default:
|
|
101
|
+
return "#";
|
|
102
|
+
}
|
|
103
|
+
}
|
|
82
104
|
|
|
83
|
-
|
|
84
|
-
|
|
105
|
+
const options = ["phone", "email", "link"];
|
|
106
|
+
const links = options.map((type) => ({
|
|
107
|
+
type,
|
|
108
|
+
label: getTypeLabel(type),
|
|
109
|
+
href: getTypeHref(type, getTypeLabel(type)),
|
|
110
|
+
}));
|
|
85
111
|
|
|
86
|
-
|
|
87
|
-
|
|
112
|
+
return { args, links };
|
|
113
|
+
},
|
|
114
|
+
template: `
|
|
115
|
+
<URow>
|
|
116
|
+
<ULink
|
|
117
|
+
v-for="(link, index) in links"
|
|
118
|
+
:key="index"
|
|
119
|
+
v-bind="args"
|
|
120
|
+
:type="link.type"
|
|
121
|
+
:label="link.label"
|
|
122
|
+
:href="link.href"
|
|
123
|
+
target-blank
|
|
124
|
+
/>
|
|
125
|
+
</URow>
|
|
126
|
+
`,
|
|
127
|
+
});
|
|
88
128
|
|
|
89
|
-
export const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
129
|
+
export const UnderlineVariants = (args, { argTypes } = {}) => ({
|
|
130
|
+
components: { ULink, URow },
|
|
131
|
+
setup() {
|
|
132
|
+
const variants = [
|
|
133
|
+
{ name: "Default", props: {} },
|
|
134
|
+
{ name: "Underlined", props: { underlined: true } },
|
|
135
|
+
{ name: "Dashed", props: { dashed: true } },
|
|
136
|
+
];
|
|
137
|
+
|
|
138
|
+
const colors = argTypes.color.options;
|
|
139
|
+
|
|
140
|
+
return {
|
|
141
|
+
args,
|
|
142
|
+
variants,
|
|
143
|
+
colors,
|
|
144
|
+
};
|
|
145
|
+
},
|
|
146
|
+
template: `
|
|
147
|
+
<div v-for="variant in variants" :key="variant.name" class="mb-8">
|
|
148
|
+
<div class="text-sm font-medium mb-2">{{ variant.name }}</div>
|
|
149
|
+
<URow no-mobile>
|
|
150
|
+
<ULink
|
|
151
|
+
v-for="color in colors"
|
|
152
|
+
:key="color"
|
|
153
|
+
v-bind="variant.props"
|
|
154
|
+
:color="color"
|
|
155
|
+
:label="color"
|
|
156
|
+
/>
|
|
157
|
+
</URow>
|
|
158
|
+
</div>
|
|
159
|
+
`,
|
|
160
|
+
});
|
|
94
161
|
|
|
95
162
|
export const Disabled = DefaultTemplate.bind({});
|
|
96
163
|
Disabled.args = { disabled: true };
|
|
@@ -98,8 +165,11 @@ Disabled.args = { disabled: true };
|
|
|
98
165
|
export const NoRing = DefaultTemplate.bind({});
|
|
99
166
|
NoRing.args = { noRing: true };
|
|
100
167
|
|
|
101
|
-
export const
|
|
102
|
-
|
|
168
|
+
export const Block = DefaultTemplate.bind({});
|
|
169
|
+
Block.args = { block: true, config: { wrapper: "border-2 border-dashed border-green-500 p-2" } };
|
|
170
|
+
|
|
171
|
+
export const DefaultSlot = DefaultTemplate.bind({});
|
|
172
|
+
DefaultSlot.args = {
|
|
103
173
|
slotTemplate: `
|
|
104
174
|
<template #default>
|
|
105
175
|
<UButton label="Text" />
|
|
@@ -107,20 +177,24 @@ SlotDefault.args = {
|
|
|
107
177
|
`,
|
|
108
178
|
};
|
|
109
179
|
|
|
110
|
-
export const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
<
|
|
124
|
-
|
|
180
|
+
export const LeftAndRightSlots = (args) => ({
|
|
181
|
+
components: { ULink, UIcon, URow },
|
|
182
|
+
setup() {
|
|
183
|
+
return { args };
|
|
184
|
+
},
|
|
185
|
+
template: `
|
|
186
|
+
<URow no-mobile>
|
|
187
|
+
<ULink label="Download">
|
|
188
|
+
<template #left>
|
|
189
|
+
<UIcon name="download" size="xs" color="green" />
|
|
190
|
+
</template>
|
|
191
|
+
</ULink>
|
|
192
|
+
|
|
193
|
+
<ULink label="Open">
|
|
194
|
+
<template #right>
|
|
195
|
+
<UIcon name="open_in_new" size="xs" color="green" />
|
|
196
|
+
</template>
|
|
197
|
+
</ULink>
|
|
198
|
+
</URow>
|
|
125
199
|
`,
|
|
126
|
-
};
|
|
200
|
+
});
|