vueless 0.0.813 → 0.0.815
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/storybook/stories.ts +96 -5
- package/ui.form-date-picker/storybook/stories.ts +128 -26
- package/ui.form-date-picker/types.ts +5 -5
- package/ui.form-date-picker-range/UDatePickerRange.vue +3 -0
- package/ui.form-date-picker-range/UDatePickerRangePeriodMenu.vue +2 -2
- package/ui.form-date-picker-range/config.ts +8 -0
- package/ui.form-date-picker-range/storybook/stories.ts +128 -44
- package/ui.form-date-picker-range/types.ts +30 -29
- package/ui.navigation-breadcrumbs/storybook/stories.ts +64 -46
- package/ui.navigation-pagination/UPagination.vue +18 -6
- package/ui.navigation-pagination/config.ts +2 -2
- package/ui.navigation-pagination/storybook/stories.ts +126 -10
- package/ui.navigation-progress/UProgress.vue +0 -1
- package/ui.navigation-progress/storybook/stories.ts +59 -28
- package/ui.navigation-tab/UTab.vue +1 -1
- package/ui.navigation-tab/storybook/stories.ts +53 -9
- package/ui.navigation-tabs/config.ts +1 -0
- package/ui.navigation-tabs/storybook/stories.ts +65 -22
|
@@ -45,6 +45,7 @@ export interface UDatePickerRangePeriodMenuAttrs {
|
|
|
45
45
|
rangeSwitchButtonAttrs: Ref<UnknownObject>;
|
|
46
46
|
rangeSwitchTitleAttrs: Ref<UnknownObject>;
|
|
47
47
|
rangeSwitchWrapperAttrs: Ref<UnknownObject>;
|
|
48
|
+
customRangeButtonAttrs: Ref<UnknownObject>;
|
|
48
49
|
customRangeDescriptionAttrs: Ref<UnknownObject>;
|
|
49
50
|
}
|
|
50
51
|
|
|
@@ -89,6 +90,31 @@ export interface UDatePickerRangeProps<TModelValue> {
|
|
|
89
90
|
*/
|
|
90
91
|
modelValue: TModelValue;
|
|
91
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Datepicker label.
|
|
95
|
+
*/
|
|
96
|
+
label?: string;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Datepicker placeholder.
|
|
100
|
+
*/
|
|
101
|
+
placeholder?: string;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Datepicker description.
|
|
105
|
+
*/
|
|
106
|
+
description?: string;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Datepicker error message.
|
|
110
|
+
*/
|
|
111
|
+
error?: string;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Make datepicker disabled.
|
|
115
|
+
*/
|
|
116
|
+
disabled?: boolean;
|
|
117
|
+
|
|
92
118
|
/**
|
|
93
119
|
* Custom range button.
|
|
94
120
|
*/
|
|
@@ -136,45 +162,20 @@ export interface UDatePickerRangeProps<TModelValue> {
|
|
|
136
162
|
*/
|
|
137
163
|
size?: "sm" | "md" | "lg";
|
|
138
164
|
|
|
139
|
-
/**
|
|
140
|
-
* Left icon name.
|
|
141
|
-
*/
|
|
142
|
-
leftIcon?: string;
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Right icon name.
|
|
146
|
-
*/
|
|
147
|
-
rightIcon?: string;
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Datepicker label.
|
|
151
|
-
*/
|
|
152
|
-
label?: string;
|
|
153
|
-
|
|
154
165
|
/**
|
|
155
166
|
* Datepicker label placement.
|
|
156
167
|
*/
|
|
157
168
|
labelAlign?: "top" | "topInside" | "topWithDesc" | "left" | "right";
|
|
158
169
|
|
|
159
170
|
/**
|
|
160
|
-
*
|
|
161
|
-
*/
|
|
162
|
-
placeholder?: string;
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Datepicker description.
|
|
166
|
-
*/
|
|
167
|
-
description?: string;
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Datepicker error message.
|
|
171
|
+
* Left icon name.
|
|
171
172
|
*/
|
|
172
|
-
|
|
173
|
+
leftIcon?: string;
|
|
173
174
|
|
|
174
175
|
/**
|
|
175
|
-
*
|
|
176
|
+
* Right icon name.
|
|
176
177
|
*/
|
|
177
|
-
|
|
178
|
+
rightIcon?: string;
|
|
178
179
|
|
|
179
180
|
/**
|
|
180
181
|
* Unique element id.
|
|
@@ -4,13 +4,16 @@ import UBreadcrumbs from "../../ui.navigation-breadcrumbs/UBreadcrumbs.vue";
|
|
|
4
4
|
import UCol from "../../ui.container-col/UCol.vue";
|
|
5
5
|
import UBadge from "../../ui.text-badge/UBadge.vue";
|
|
6
6
|
import UButton from "../../ui.button/UButton.vue";
|
|
7
|
+
import URow from "../../ui.container-row/URow.vue";
|
|
8
|
+
import UIcon from "../../ui.image-icon/UIcon.vue";
|
|
9
|
+
import ULabel from "../../ui.form-label/ULabel.vue";
|
|
7
10
|
|
|
8
11
|
import type { Meta, StoryFn } from "@storybook/vue3";
|
|
9
12
|
import type { Props } from "../types.ts";
|
|
10
13
|
|
|
11
14
|
interface UBreadcrumbsArgs extends Props {
|
|
12
15
|
slotTemplate?: string;
|
|
13
|
-
enum: "size";
|
|
16
|
+
enum: "size" | "color";
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
interface UBreadcrumbsArgs extends Props {
|
|
@@ -35,7 +38,7 @@ export default {
|
|
|
35
38
|
} as Meta;
|
|
36
39
|
|
|
37
40
|
const DefaultTemplate: StoryFn<UBreadcrumbsArgs> = (args: UBreadcrumbsArgs) => ({
|
|
38
|
-
components: { UBreadcrumbs },
|
|
41
|
+
components: { UBreadcrumbs, UButton, UBadge, UIcon },
|
|
39
42
|
setup() {
|
|
40
43
|
const slots = getSlotNames(UBreadcrumbs.__name);
|
|
41
44
|
|
|
@@ -49,7 +52,7 @@ const DefaultTemplate: StoryFn<UBreadcrumbsArgs> = (args: UBreadcrumbsArgs) => (
|
|
|
49
52
|
});
|
|
50
53
|
|
|
51
54
|
const EnumVariantTemplate: StoryFn<UBreadcrumbsArgs> = (args: UBreadcrumbsArgs, { argTypes }) => ({
|
|
52
|
-
components: { UBreadcrumbs, UCol },
|
|
55
|
+
components: { UBreadcrumbs, UCol, URow, ULabel },
|
|
53
56
|
setup() {
|
|
54
57
|
return {
|
|
55
58
|
args,
|
|
@@ -58,12 +61,11 @@ const EnumVariantTemplate: StoryFn<UBreadcrumbsArgs> = (args: UBreadcrumbsArgs,
|
|
|
58
61
|
},
|
|
59
62
|
template: `
|
|
60
63
|
<UCol>
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
/>
|
|
64
|
+
<URow v-for="(option, index) in options" :key="index" align="center">
|
|
65
|
+
<ULabel :label="option">
|
|
66
|
+
<UBreadcrumbs v-bind="args" :[args.enum]="option" />
|
|
67
|
+
</ULabel>
|
|
68
|
+
</URow>
|
|
67
69
|
</UCol>
|
|
68
70
|
`,
|
|
69
71
|
});
|
|
@@ -74,16 +76,31 @@ Default.args = {};
|
|
|
74
76
|
export const Sizes = EnumVariantTemplate.bind({});
|
|
75
77
|
Sizes.args = { enum: "size" };
|
|
76
78
|
|
|
77
|
-
export const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
export const Colors = EnumVariantTemplate.bind({});
|
|
80
|
+
Colors.args = { enum: "color" };
|
|
81
|
+
|
|
82
|
+
export const UnderlineVariants: StoryFn<UBreadcrumbsArgs> = (args: UBreadcrumbsArgs) => ({
|
|
83
|
+
components: { UBreadcrumbs },
|
|
84
|
+
setup() {
|
|
85
|
+
const variants = [
|
|
86
|
+
{ name: "Default", props: {} },
|
|
87
|
+
{ name: "Dashed", props: { dashed: true } },
|
|
88
|
+
{ name: "Underlined", props: { underlined: true } },
|
|
89
|
+
{ name: "No underline", props: { underlined: false } },
|
|
90
|
+
];
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
args,
|
|
94
|
+
variants,
|
|
95
|
+
};
|
|
85
96
|
},
|
|
86
|
-
|
|
97
|
+
template: `
|
|
98
|
+
<div v-for="variant in variants" :key="variant.name" class="mb-8">
|
|
99
|
+
<div class="text-sm font-medium mb-2">{{ variant.name }}</div>
|
|
100
|
+
<UBreadcrumbs v-bind="variant.props" :links="args.links" />
|
|
101
|
+
</div>
|
|
102
|
+
`,
|
|
103
|
+
});
|
|
87
104
|
|
|
88
105
|
export const LinkStates = DefaultTemplate.bind({});
|
|
89
106
|
LinkStates.args = {
|
|
@@ -102,7 +119,7 @@ LinkStates.parameters = {
|
|
|
102
119
|
description: {
|
|
103
120
|
story:
|
|
104
121
|
// eslint-disable-next-line vue/max-len
|
|
105
|
-
"A breadcrumb is automatically disabled, if: <br /> - it does not have both `route` and `href` properties; <br /> - it has `disabled` property set to `true
|
|
122
|
+
"A breadcrumb is automatically disabled, if: <br /> - it does not have both `route` and `href` properties; <br /> - it has `disabled` property set to `true`.",
|
|
106
123
|
},
|
|
107
124
|
},
|
|
108
125
|
};
|
|
@@ -124,33 +141,34 @@ LinkIcon.parameters = {
|
|
|
124
141
|
},
|
|
125
142
|
};
|
|
126
143
|
|
|
127
|
-
export const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
/>
|
|
141
|
-
</template>
|
|
142
|
-
</UBreadcrumbs>
|
|
144
|
+
export const SlotIcon = DefaultTemplate.bind({});
|
|
145
|
+
SlotIcon.args = {
|
|
146
|
+
slotTemplate: `
|
|
147
|
+
<template #icon="{ index }">
|
|
148
|
+
<UBadge
|
|
149
|
+
v-if="index === 1"
|
|
150
|
+
label="Info"
|
|
151
|
+
color="green"
|
|
152
|
+
size="sm"
|
|
153
|
+
/>
|
|
154
|
+
</template>
|
|
155
|
+
`,
|
|
156
|
+
};
|
|
143
157
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
158
|
+
export const SlotLabel = DefaultTemplate.bind({});
|
|
159
|
+
SlotLabel.args = {
|
|
160
|
+
slotTemplate: `
|
|
161
|
+
<template #label="{ label, index }">
|
|
162
|
+
<UButton v-if="index === 0" :label="label" size="2xs" />
|
|
163
|
+
</template>
|
|
164
|
+
`,
|
|
165
|
+
};
|
|
149
166
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
167
|
+
export const SlotDivider = DefaultTemplate.bind({});
|
|
168
|
+
SlotDivider.args = {
|
|
169
|
+
slotTemplate: `
|
|
170
|
+
<template #divider="{ index }">
|
|
171
|
+
<UIcon v-if="index === 1" name="double_arrow" size="xs" />
|
|
172
|
+
</template>
|
|
155
173
|
`,
|
|
156
|
-
}
|
|
174
|
+
};
|
|
@@ -133,8 +133,11 @@ const {
|
|
|
133
133
|
:data-test="getDataTest('first')"
|
|
134
134
|
@click="goToFirstPage"
|
|
135
135
|
>
|
|
136
|
-
<!--
|
|
137
|
-
|
|
136
|
+
<!--
|
|
137
|
+
@slot Use it to add something instead of the "first" label.
|
|
138
|
+
@binding {string} icon-name
|
|
139
|
+
-->
|
|
140
|
+
<slot name="first" :icon-name="config.defaults.firstIcon">
|
|
138
141
|
<UIcon
|
|
139
142
|
v-if="!firstLabel"
|
|
140
143
|
internal
|
|
@@ -154,8 +157,11 @@ const {
|
|
|
154
157
|
:data-test="getDataTest('prev')"
|
|
155
158
|
@click="goToPrevPage"
|
|
156
159
|
>
|
|
157
|
-
<!--
|
|
158
|
-
|
|
160
|
+
<!--
|
|
161
|
+
@slot Use it to add something instead of the "prev" label.
|
|
162
|
+
@binding {string} icon-name
|
|
163
|
+
-->
|
|
164
|
+
<slot name="prev" :icon-name="config.defaults.prevIcon">
|
|
159
165
|
<UIcon
|
|
160
166
|
v-if="!prevLabel"
|
|
161
167
|
internal
|
|
@@ -208,7 +214,10 @@ const {
|
|
|
208
214
|
:data-test="getDataTest('next')"
|
|
209
215
|
@click="goToNextPage"
|
|
210
216
|
>
|
|
211
|
-
<!--
|
|
217
|
+
<!--
|
|
218
|
+
@slot Use it to add something instead of the "next" label.
|
|
219
|
+
@binding {string} icon-name
|
|
220
|
+
-->
|
|
212
221
|
<slot name="next">
|
|
213
222
|
<UIcon
|
|
214
223
|
v-if="!nextLabel"
|
|
@@ -230,7 +239,10 @@ const {
|
|
|
230
239
|
:data-test="getDataTest('last')"
|
|
231
240
|
@click="goToLastPage"
|
|
232
241
|
>
|
|
233
|
-
<!--
|
|
242
|
+
<!--
|
|
243
|
+
@slot Use it to add something instead of the "last" label.
|
|
244
|
+
@binding {string} icon-name
|
|
245
|
+
-->
|
|
234
246
|
<slot name="last">
|
|
235
247
|
<UIcon
|
|
236
248
|
v-if="!lastLabel"
|
|
@@ -6,12 +6,18 @@ import {
|
|
|
6
6
|
} from "../../utils/storybook.ts";
|
|
7
7
|
|
|
8
8
|
import UPagination from "../../ui.navigation-pagination/UPagination.vue";
|
|
9
|
+
import UCol from "../../ui.container-col/UCol.vue";
|
|
10
|
+
import URow from "../../ui.container-row/URow.vue";
|
|
11
|
+
import UBadge from "../../ui.text-badge/UBadge.vue";
|
|
12
|
+
import UIcon from "../../ui.image-icon/UIcon.vue";
|
|
13
|
+
import ULabel from "../../ui.form-label/ULabel.vue";
|
|
9
14
|
|
|
10
15
|
import type { Meta, StoryFn } from "@storybook/vue3";
|
|
11
16
|
import type { Props } from "../types.ts";
|
|
12
17
|
|
|
13
18
|
interface UPaginationArgs extends Props {
|
|
14
19
|
slotTemplate?: string;
|
|
20
|
+
enum: "variant" | "size";
|
|
15
21
|
}
|
|
16
22
|
|
|
17
23
|
export default {
|
|
@@ -44,23 +50,60 @@ const DefaultTemplate: StoryFn<UPaginationArgs> = (args: UPaginationArgs) => ({
|
|
|
44
50
|
`,
|
|
45
51
|
});
|
|
46
52
|
|
|
53
|
+
const EnumVariantTemplate: StoryFn<UPaginationArgs> = (args: UPaginationArgs, { argTypes }) => ({
|
|
54
|
+
components: { UPagination, UCol, URow, ULabel },
|
|
55
|
+
setup() {
|
|
56
|
+
return {
|
|
57
|
+
args,
|
|
58
|
+
options: argTypes?.[args.enum]?.options,
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
template: `
|
|
62
|
+
<UCol>
|
|
63
|
+
<URow
|
|
64
|
+
v-for="(option, index) in options"
|
|
65
|
+
:key="index"
|
|
66
|
+
align="center"
|
|
67
|
+
>
|
|
68
|
+
<ULabel :label="option">
|
|
69
|
+
<UPagination v-bind="args" :[args.enum]="option" />
|
|
70
|
+
</ULabel>
|
|
71
|
+
</URow>
|
|
72
|
+
</UCol>
|
|
73
|
+
`,
|
|
74
|
+
});
|
|
75
|
+
|
|
47
76
|
export const Default = DefaultTemplate.bind({});
|
|
48
77
|
Default.args = {};
|
|
49
78
|
|
|
50
|
-
export const
|
|
51
|
-
|
|
79
|
+
export const Disabled = DefaultTemplate.bind({});
|
|
80
|
+
Disabled.args = { disabled: true };
|
|
52
81
|
|
|
53
|
-
export const
|
|
54
|
-
|
|
82
|
+
export const PerPage = DefaultTemplate.bind({});
|
|
83
|
+
PerPage.args = { perPage: 100 };
|
|
84
|
+
PerPage.parameters = {
|
|
85
|
+
docs: {
|
|
86
|
+
description: {
|
|
87
|
+
story: "Use `perPage` prop to control number of items shown per page.",
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
};
|
|
55
91
|
|
|
56
|
-
export const
|
|
57
|
-
|
|
92
|
+
export const Limit = DefaultTemplate.bind({});
|
|
93
|
+
Limit.args = { limit: 11 };
|
|
94
|
+
Limit.parameters = {
|
|
95
|
+
docs: {
|
|
96
|
+
description: {
|
|
97
|
+
story: "`limit` prop controls the limit of visible pages.",
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
};
|
|
58
101
|
|
|
59
|
-
export const
|
|
60
|
-
|
|
102
|
+
export const Variant = EnumVariantTemplate.bind({});
|
|
103
|
+
Variant.args = { enum: "variant" };
|
|
61
104
|
|
|
62
|
-
export const
|
|
63
|
-
|
|
105
|
+
export const Size = EnumVariantTemplate.bind({});
|
|
106
|
+
Size.args = { enum: "size" };
|
|
64
107
|
|
|
65
108
|
export const SetCustomNavigationLabel = DefaultTemplate.bind({});
|
|
66
109
|
SetCustomNavigationLabel.args = {
|
|
@@ -69,3 +112,76 @@ SetCustomNavigationLabel.args = {
|
|
|
69
112
|
lastLabel: "⏩",
|
|
70
113
|
firstLabel: "⏪",
|
|
71
114
|
};
|
|
115
|
+
SetCustomNavigationLabel.parameters = {
|
|
116
|
+
docs: {
|
|
117
|
+
description: {
|
|
118
|
+
story:
|
|
119
|
+
// eslint-disable-next-line vue/max-len
|
|
120
|
+
"Feel free to customize each navigation button via the respective prop (`firstLabel`, `prevLabel`, `nextLabel`, `lastLabel`).",
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export const HideEllipsis = DefaultTemplate.bind({});
|
|
126
|
+
HideEllipsis.args = { ellipsis: false };
|
|
127
|
+
HideEllipsis.parameters = {
|
|
128
|
+
docs: {
|
|
129
|
+
description: {
|
|
130
|
+
story: "You can hide ellipsis by setting `ellipsis` prop to `false`.",
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export const HideNavButtons = DefaultTemplate.bind({});
|
|
136
|
+
HideNavButtons.args = { showLast: false, showFirst: false };
|
|
137
|
+
HideNavButtons.parameters = {
|
|
138
|
+
docs: {
|
|
139
|
+
description: {
|
|
140
|
+
story:
|
|
141
|
+
"If you need to hide first / last navigation buttons - set `showFirst` / `showLast` props to `false`.",
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export const Slots: StoryFn<UPaginationArgs> = (args) => ({
|
|
147
|
+
components: { UPagination, UBadge, UCol, URow, UIcon },
|
|
148
|
+
setup() {
|
|
149
|
+
return { args };
|
|
150
|
+
},
|
|
151
|
+
template: `
|
|
152
|
+
<UCol>
|
|
153
|
+
<UPagination v-bind="args" v-model="args.modelValue">
|
|
154
|
+
<template #first>
|
|
155
|
+
<UBadge label="Slot First" size="sm" />
|
|
156
|
+
</template>
|
|
157
|
+
</UPagination>
|
|
158
|
+
|
|
159
|
+
<UPagination v-bind="args" v-model="args.modelValue">
|
|
160
|
+
<template #prev>
|
|
161
|
+
<UBadge label="Slot Prev" size="sm" />
|
|
162
|
+
</template>
|
|
163
|
+
</UPagination>
|
|
164
|
+
|
|
165
|
+
<URow align="center">
|
|
166
|
+
<UPagination v-bind="args" v-model="args.modelValue">
|
|
167
|
+
<template #ellipsis>
|
|
168
|
+
<UIcon name="more_horiz" size="sm" />
|
|
169
|
+
</template>
|
|
170
|
+
</UPagination>
|
|
171
|
+
<span class="text-sm">Slot Ellipsis</span>
|
|
172
|
+
</URow>
|
|
173
|
+
|
|
174
|
+
<UPagination v-bind="args" v-model="args.modelValue">
|
|
175
|
+
<template #next>
|
|
176
|
+
<UBadge label="Slot Next" size="sm" />
|
|
177
|
+
</template>
|
|
178
|
+
</UPagination>
|
|
179
|
+
|
|
180
|
+
<UPagination v-bind="args" v-model="args.modelValue">
|
|
181
|
+
<template #last>
|
|
182
|
+
<UBadge label="Slot Last" size="sm" />
|
|
183
|
+
</template>
|
|
184
|
+
</UPagination>
|
|
185
|
+
</UCol>
|
|
186
|
+
`,
|
|
187
|
+
});
|
|
@@ -9,6 +9,7 @@ import UProgress from "../../ui.navigation-progress/UProgress.vue";
|
|
|
9
9
|
import UCol from "../../ui.container-col/UCol.vue";
|
|
10
10
|
import UButton from "../../ui.button/UButton.vue";
|
|
11
11
|
import UIcon from "../../ui.image-icon/UIcon.vue";
|
|
12
|
+
import UBadge from "../../ui.text-badge/UBadge.vue";
|
|
12
13
|
|
|
13
14
|
import type { Meta, StoryFn } from "@storybook/vue3";
|
|
14
15
|
import type { UProgressProps } from "../types.ts";
|
|
@@ -35,11 +36,11 @@ export default {
|
|
|
35
36
|
} as Meta;
|
|
36
37
|
|
|
37
38
|
const DefaultTemplate: StoryFn<UProgressArgs> = (args: UProgressArgs) => ({
|
|
38
|
-
components: { UCol, UProgress, UButton, UIcon },
|
|
39
|
+
components: { UCol, UProgress, UButton, UIcon, UBadge },
|
|
39
40
|
setup() {
|
|
40
41
|
const slots = getSlotNames(UProgress.__name);
|
|
41
42
|
|
|
42
|
-
args.value = args.max ?
|
|
43
|
+
args.value = args.max ? 0 : 10;
|
|
43
44
|
args.iterator = args.max ? 1 : 10;
|
|
44
45
|
|
|
45
46
|
function updateProgress() {
|
|
@@ -53,7 +54,7 @@ const DefaultTemplate: StoryFn<UProgressArgs> = (args: UProgressArgs) => ({
|
|
|
53
54
|
template: `
|
|
54
55
|
<UCol>
|
|
55
56
|
<UProgress v-bind="args">${args.slotTemplate || getSlotsFragment("")}</UProgress>
|
|
56
|
-
<UButton label="Next
|
|
57
|
+
<UButton label="Next Step" size="sm" variant="thirdary" filled @click="updateProgress" />
|
|
57
58
|
</UCol>
|
|
58
59
|
`,
|
|
59
60
|
});
|
|
@@ -77,8 +78,13 @@ const EnumVariantTemplate: StoryFn<UProgressArgs> = (args: UProgressArgs, { argT
|
|
|
77
78
|
v-bind="args"
|
|
78
79
|
:[args.enum]="option"
|
|
79
80
|
:value="args.progress"
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
indicator
|
|
82
|
+
>
|
|
83
|
+
<template #indicator>
|
|
84
|
+
{{ option }}
|
|
85
|
+
</template>
|
|
86
|
+
</UProgress>
|
|
87
|
+
<UButton label="Next Step" size="sm" variant="thirdary" filled @click="updateProgress" />
|
|
82
88
|
</UCol>
|
|
83
89
|
`,
|
|
84
90
|
});
|
|
@@ -86,46 +92,71 @@ const EnumVariantTemplate: StoryFn<UProgressArgs> = (args: UProgressArgs, { argT
|
|
|
86
92
|
export const Default = DefaultTemplate.bind({});
|
|
87
93
|
Default.args = {};
|
|
88
94
|
|
|
95
|
+
export const Max = DefaultTemplate.bind({});
|
|
96
|
+
Max.args = { max: ["Step 0", "Step 1", "Step 2"] };
|
|
97
|
+
Max.parameters = {
|
|
98
|
+
docs: {
|
|
99
|
+
description: {
|
|
100
|
+
story: "Control Progress max amount of steps using the `max` prop.",
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
|
|
89
105
|
export const VariantStepper = DefaultTemplate.bind({});
|
|
90
|
-
VariantStepper.args = {
|
|
106
|
+
VariantStepper.args = {
|
|
107
|
+
variant: "stepper",
|
|
108
|
+
max: ["Introduction", "Personal Information", "Shipment Address"],
|
|
109
|
+
};
|
|
91
110
|
|
|
92
111
|
export const Indicator = DefaultTemplate.bind({});
|
|
93
112
|
Indicator.args = { indicator: true };
|
|
113
|
+
Indicator.parameters = {
|
|
114
|
+
docs: {
|
|
115
|
+
description: {
|
|
116
|
+
story: "This prop controls Progress indicator visibility.",
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
};
|
|
94
120
|
|
|
95
|
-
export const
|
|
96
|
-
|
|
121
|
+
export const Sizes = EnumVariantTemplate.bind({});
|
|
122
|
+
Sizes.args = { enum: "size" };
|
|
97
123
|
|
|
98
124
|
export const Colors = EnumVariantTemplate.bind({});
|
|
99
125
|
Colors.args = { enum: "color" };
|
|
100
126
|
|
|
101
|
-
export const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
export const IndicatorSlot = DefaultTemplate.bind({});
|
|
105
|
-
IndicatorSlot.args = {
|
|
127
|
+
export const SlotIndicator = DefaultTemplate.bind({});
|
|
128
|
+
SlotIndicator.args = {
|
|
106
129
|
indicator: true,
|
|
107
130
|
slotTemplate: `
|
|
108
|
-
<template #indicator>
|
|
109
|
-
<
|
|
110
|
-
name="star"
|
|
111
|
-
color="black"
|
|
112
|
-
/>
|
|
131
|
+
<template #indicator="{ percent }">
|
|
132
|
+
<UBadge :label="'Current percent is: ' + percent" />
|
|
113
133
|
</template>
|
|
114
134
|
`,
|
|
115
135
|
};
|
|
116
136
|
|
|
117
|
-
export const
|
|
118
|
-
|
|
119
|
-
max: ["
|
|
137
|
+
export const SlotStep = DefaultTemplate.bind({});
|
|
138
|
+
SlotStep.args = {
|
|
139
|
+
max: ["Order Placed", "Processing", "Shipped", "Delivered"],
|
|
120
140
|
slotTemplate: `
|
|
121
|
-
<template #step-0>
|
|
122
|
-
|
|
141
|
+
<template #step-0="{ step, value, max }">
|
|
142
|
+
<div class="flex items-center gap-2">
|
|
143
|
+
📦 <span>Step: {{ step }} ({{ value + 1 }} / {{ max.length }})</span>
|
|
144
|
+
</div>
|
|
123
145
|
</template>
|
|
124
|
-
<template #step-1>
|
|
125
|
-
|
|
146
|
+
<template #step-1="{ step, value, max }">
|
|
147
|
+
<div class="flex items-center gap-2">
|
|
148
|
+
⚙️ <span>Step: {{ step }} ({{ value + 1 }} / {{ max.length }})</span>
|
|
149
|
+
</div>
|
|
126
150
|
</template>
|
|
127
|
-
<template #step-2>
|
|
128
|
-
|
|
151
|
+
<template #step-2="{ step, value, max }">
|
|
152
|
+
<div class="flex items-center gap-2">
|
|
153
|
+
🚚 <span>Step: {{ step }} ({{ value + 1 }} / {{ max.length }})</span>
|
|
154
|
+
</div>
|
|
129
155
|
</template>
|
|
130
|
-
|
|
156
|
+
<template #step-3="{ step, value, max }">
|
|
157
|
+
<div class="flex items-center gap-2">
|
|
158
|
+
🏠 <span>Step: {{ step }} ({{ value + 1 }} / {{ max.length }})</span>
|
|
159
|
+
</div>
|
|
160
|
+
</template>
|
|
161
|
+
`,
|
|
131
162
|
};
|
|
@@ -86,7 +86,7 @@ const { getDataTest, tabButtonAttrs, tabButtonActiveAttrs } = useUI<Config>(
|
|
|
86
86
|
@binding {boolean} active
|
|
87
87
|
@binding {string} icon-name
|
|
88
88
|
-->
|
|
89
|
-
<slot :label="label" :active="isActive" :icon-name="iconName" />
|
|
89
|
+
<slot name="label" :label="label" :active="isActive" :icon-name="iconName" />
|
|
90
90
|
</template>
|
|
91
91
|
|
|
92
92
|
<template #right="{ iconName }">
|