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
package/package.json
CHANGED
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
} from "../../utils/storybook.ts";
|
|
8
8
|
|
|
9
9
|
import UCalendar from "../../ui.form-calendar/UCalendar.vue";
|
|
10
|
+
import URow from "../../ui.container-row/URow.vue";
|
|
11
|
+
import UDatePicker from "../../ui.form-date-picker/UDatePicker.vue";
|
|
10
12
|
|
|
11
13
|
import { COMPONENT_NAME } from "../constants.ts";
|
|
12
14
|
|
|
@@ -14,14 +16,16 @@ import type { DateValue, UCalendarProps } from "../types.ts";
|
|
|
14
16
|
|
|
15
17
|
interface UCalendarArgs extends UCalendarProps<DateValue> {
|
|
16
18
|
slotTemplate?: string;
|
|
17
|
-
enum: "
|
|
19
|
+
enum: "view";
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
export default {
|
|
21
23
|
id: "3165",
|
|
22
24
|
title: "Form Inputs & Controls / Calendar",
|
|
23
25
|
component: UCalendar,
|
|
24
|
-
args: {
|
|
26
|
+
args: {
|
|
27
|
+
modelValue: null,
|
|
28
|
+
},
|
|
25
29
|
argTypes: {
|
|
26
30
|
...getArgTypes(COMPONENT_NAME),
|
|
27
31
|
},
|
|
@@ -53,9 +57,52 @@ const DefaultTemplate: StoryFn<UCalendarArgs> = (args: UCalendarArgs) => ({
|
|
|
53
57
|
`,
|
|
54
58
|
});
|
|
55
59
|
|
|
60
|
+
const EnumVariantTemplate: StoryFn<UCalendarArgs> = (args: UCalendarArgs, { argTypes }) => ({
|
|
61
|
+
components: { UCalendar, URow },
|
|
62
|
+
setup() {
|
|
63
|
+
return {
|
|
64
|
+
args,
|
|
65
|
+
options: argTypes[args.enum]?.options,
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
template: `
|
|
69
|
+
<URow>
|
|
70
|
+
<UCalendar
|
|
71
|
+
v-for="(option, index) in options"
|
|
72
|
+
:key="index"
|
|
73
|
+
v-bind="args"
|
|
74
|
+
v-model="args.modelValue"
|
|
75
|
+
:[args.enum]="option"
|
|
76
|
+
/>
|
|
77
|
+
</URow>
|
|
78
|
+
`,
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const UserDateFormatTemplate: StoryFn<UCalendarArgs> = (args: UCalendarArgs) => ({
|
|
82
|
+
components: { UDatePicker },
|
|
83
|
+
setup() {
|
|
84
|
+
const slots = getSlotNames(COMPONENT_NAME);
|
|
85
|
+
|
|
86
|
+
return { args, slots };
|
|
87
|
+
},
|
|
88
|
+
template: `
|
|
89
|
+
<UDatePicker v-bind="args" v-model="args.modelValue" />
|
|
90
|
+
`,
|
|
91
|
+
});
|
|
92
|
+
|
|
56
93
|
export const Default = DefaultTemplate.bind({});
|
|
57
94
|
Default.args = { modelValue: null };
|
|
58
95
|
|
|
96
|
+
export const View = EnumVariantTemplate.bind({});
|
|
97
|
+
View.args = { enum: "view" };
|
|
98
|
+
View.parameters = {
|
|
99
|
+
docs: {
|
|
100
|
+
description: {
|
|
101
|
+
story: "Calendar view variant (`day`, `month`, `year`).",
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
|
|
59
106
|
export const Range = DefaultTemplate.bind({});
|
|
60
107
|
Range.args = {
|
|
61
108
|
range: true,
|
|
@@ -68,12 +115,56 @@ Range.args = {
|
|
|
68
115
|
export const Timepicker = DefaultTemplate.bind({});
|
|
69
116
|
Timepicker.args = { modelValue: new Date(2024, 2, 14, 12, 24, 14), timepicker: true };
|
|
70
117
|
|
|
118
|
+
export const DateFormat = DefaultTemplate.bind({});
|
|
119
|
+
DateFormat.args = { dateFormat: "Y-m-d" };
|
|
120
|
+
DateFormat.parameters = {
|
|
121
|
+
docs: {
|
|
122
|
+
description: {
|
|
123
|
+
story: "Date string format.",
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export const DateTimeFormat = DefaultTemplate.bind({});
|
|
129
|
+
DateTimeFormat.args = { timepicker: true, dateTimeFormat: "Y-m-d H:i:S" };
|
|
130
|
+
DateTimeFormat.parameters = {
|
|
131
|
+
docs: {
|
|
132
|
+
description: {
|
|
133
|
+
story: "Same as date format, but used when timepicker is enabled.",
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export const UserDateFormat = UserDateFormatTemplate.bind({});
|
|
139
|
+
UserDateFormat.args = { userDateFormat: "d/m/Y" };
|
|
140
|
+
UserDateFormat.parameters = {
|
|
141
|
+
docs: {
|
|
142
|
+
description: {
|
|
143
|
+
story: "User-friendly date format (it will be shown in UI).",
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export const UserDateTimeFormat = UserDateFormatTemplate.bind({});
|
|
149
|
+
UserDateTimeFormat.args = { timepicker: true, userDateTimeFormat: "d/m/Y H:i:S" };
|
|
150
|
+
UserDateTimeFormat.parameters = {
|
|
151
|
+
docs: {
|
|
152
|
+
description: {
|
|
153
|
+
story: "Same as user format, but used when timepicker is enabled.",
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
|
|
71
158
|
export const MinMax = DefaultTemplate.bind({});
|
|
72
159
|
MinMax.args = {
|
|
73
160
|
minDate: new Date(2022, 2, 22),
|
|
74
161
|
maxDate: new Date(2022, 2, 26),
|
|
75
162
|
modelValue: new Date(2022, 2, 24),
|
|
76
163
|
};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
164
|
+
MinMax.parameters = {
|
|
165
|
+
docs: {
|
|
166
|
+
description: {
|
|
167
|
+
story: "Use `minDate` and `maxDate` props to set the minimum and maximum date.",
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
};
|
|
@@ -9,6 +9,8 @@ import {
|
|
|
9
9
|
import UDatePicker from "../../ui.form-date-picker/UDatePicker.vue";
|
|
10
10
|
import UIcon from "../../ui.image-icon/UIcon.vue";
|
|
11
11
|
import URow from "../../ui.container-row/URow.vue";
|
|
12
|
+
import UCol from "../../ui.container-col/UCol.vue";
|
|
13
|
+
import UButton from "../../ui.button/UButton.vue";
|
|
12
14
|
|
|
13
15
|
import { COMPONENT_NAME } from "../constants.ts";
|
|
14
16
|
|
|
@@ -20,7 +22,7 @@ interface DefaultUDatePickerArgs extends Props<unknown> {
|
|
|
20
22
|
|
|
21
23
|
interface EnumUDatePickerArgs extends Props<unknown> {
|
|
22
24
|
slotTemplate?: string;
|
|
23
|
-
enum: "size";
|
|
25
|
+
enum: "size" | "labelAlign";
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
export default {
|
|
@@ -28,7 +30,7 @@ export default {
|
|
|
28
30
|
title: "Form Inputs & Controls / Date Picker",
|
|
29
31
|
component: UDatePicker,
|
|
30
32
|
args: {
|
|
31
|
-
label: "
|
|
33
|
+
label: "Select a date",
|
|
32
34
|
modelValue: null,
|
|
33
35
|
},
|
|
34
36
|
argTypes: {
|
|
@@ -66,7 +68,7 @@ const EnumVariantTemplate: StoryFn<EnumUDatePickerArgs> = (
|
|
|
66
68
|
args: EnumUDatePickerArgs,
|
|
67
69
|
{ argTypes },
|
|
68
70
|
) => ({
|
|
69
|
-
components: { UDatePicker,
|
|
71
|
+
components: { UDatePicker, UCol },
|
|
70
72
|
setup() {
|
|
71
73
|
return {
|
|
72
74
|
args,
|
|
@@ -74,16 +76,16 @@ const EnumVariantTemplate: StoryFn<EnumUDatePickerArgs> = (
|
|
|
74
76
|
};
|
|
75
77
|
},
|
|
76
78
|
template: `
|
|
77
|
-
<
|
|
79
|
+
<UCol>
|
|
78
80
|
<UDatePicker
|
|
79
81
|
v-for="(option, index) in options"
|
|
80
82
|
open-direction-y="bottom"
|
|
81
83
|
:key="index"
|
|
82
84
|
v-bind="args"
|
|
83
85
|
:[args.enum]="option"
|
|
84
|
-
:
|
|
86
|
+
:placeholder="option"
|
|
85
87
|
/>
|
|
86
|
-
</
|
|
88
|
+
</UCol>
|
|
87
89
|
`,
|
|
88
90
|
});
|
|
89
91
|
|
|
@@ -135,26 +137,35 @@ const OpenDirectionTemplate: StoryFn<DefaultUDatePickerArgs> = (args: DefaultUDa
|
|
|
135
137
|
export const Default = DefaultTemplate.bind({});
|
|
136
138
|
Default.args = { modelValue: new Date() };
|
|
137
139
|
|
|
138
|
-
export const
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
export const OpenDirection = OpenDirectionTemplate.bind({});
|
|
142
|
-
OpenDirection.args = {};
|
|
140
|
+
export const Placeholder = DefaultTemplate.bind({});
|
|
141
|
+
Placeholder.args = { placeholder: "MM/DD/YYYY" };
|
|
143
142
|
|
|
144
143
|
export const Description = DefaultTemplate.bind({});
|
|
145
|
-
Description.args = { description: "
|
|
144
|
+
Description.args = { description: "Please choose a date from the calendar." };
|
|
145
|
+
|
|
146
|
+
export const Error = DefaultTemplate.bind({});
|
|
147
|
+
Error.args = { error: "Please select a valid date." };
|
|
146
148
|
|
|
147
149
|
export const Disabled = DefaultTemplate.bind({});
|
|
148
150
|
Disabled.args = { disabled: true };
|
|
149
151
|
|
|
150
|
-
export const
|
|
151
|
-
|
|
152
|
+
export const LabelPlacement = EnumVariantTemplate.bind({});
|
|
153
|
+
LabelPlacement.args = { enum: "labelAlign" };
|
|
152
154
|
|
|
153
|
-
export const
|
|
154
|
-
|
|
155
|
+
export const Size = EnumVariantTemplate.bind({});
|
|
156
|
+
Size.args = { enum: "size" };
|
|
155
157
|
|
|
156
|
-
export const
|
|
157
|
-
|
|
158
|
+
export const OpenDirection = OpenDirectionTemplate.bind({});
|
|
159
|
+
OpenDirection.args = {};
|
|
160
|
+
OpenDirection.parameters = {
|
|
161
|
+
docs: {
|
|
162
|
+
description: {
|
|
163
|
+
story:
|
|
164
|
+
// eslint-disable-next-line vue/max-len
|
|
165
|
+
"Control the direction in which the datepicker opens along the x- and y-axes using the `openDirectionX` and `openDirectionY` props.",
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
};
|
|
158
169
|
|
|
159
170
|
export const Timepicker = DefaultTemplate.bind({});
|
|
160
171
|
Timepicker.args = {
|
|
@@ -162,19 +173,110 @@ Timepicker.args = {
|
|
|
162
173
|
modelValue: new Date(2024, 2, 14, 12, 24, 14),
|
|
163
174
|
};
|
|
164
175
|
|
|
176
|
+
export const DateFormat = DefaultTemplate.bind({});
|
|
177
|
+
DateFormat.args = { dateFormat: "Y-m-d" };
|
|
178
|
+
DateFormat.parameters = {
|
|
179
|
+
docs: {
|
|
180
|
+
description: {
|
|
181
|
+
story: "Date string format.",
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
export const DateTimeFormat = DefaultTemplate.bind({});
|
|
187
|
+
DateTimeFormat.args = { timepicker: true, dateTimeFormat: "Y-m-d H:i:S" };
|
|
188
|
+
DateTimeFormat.parameters = {
|
|
189
|
+
docs: {
|
|
190
|
+
description: {
|
|
191
|
+
story: "Same as date format, but used when timepicker is enabled.",
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export const UserDateFormat = DefaultTemplate.bind({});
|
|
197
|
+
UserDateFormat.args = { userDateFormat: "d/m/Y" };
|
|
198
|
+
UserDateFormat.parameters = {
|
|
199
|
+
docs: {
|
|
200
|
+
description: {
|
|
201
|
+
story: "User-friendly date format (it will be shown in UI).",
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
export const UserDateTimeFormat = DefaultTemplate.bind({});
|
|
207
|
+
UserDateTimeFormat.args = { timepicker: true, userDateTimeFormat: "d/m/Y H:i:S" };
|
|
208
|
+
UserDateTimeFormat.parameters = {
|
|
209
|
+
docs: {
|
|
210
|
+
description: {
|
|
211
|
+
story: "Same as user format, but used when timepicker is enabled.",
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
|
|
165
216
|
export const MinMax = DefaultTemplate.bind({});
|
|
166
217
|
MinMax.args = {
|
|
167
218
|
minDate: new Date(2022, 2, 22),
|
|
168
219
|
maxDate: new Date(2022, 2, 26),
|
|
169
220
|
modelValue: new Date(2022, 2, 24),
|
|
170
221
|
};
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
222
|
+
MinMax.parameters = {
|
|
223
|
+
docs: {
|
|
224
|
+
description: {
|
|
225
|
+
story: "Use `minDate` and `maxDate` props to set the minimum and maximum date.",
|
|
226
|
+
},
|
|
227
|
+
},
|
|
175
228
|
};
|
|
176
229
|
|
|
177
|
-
export const
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
};
|
|
230
|
+
export const IconProps: StoryFn<DefaultUDatePickerArgs> = (args) => ({
|
|
231
|
+
components: { UDatePicker, URow },
|
|
232
|
+
setup() {
|
|
233
|
+
return { args };
|
|
234
|
+
},
|
|
235
|
+
template: `
|
|
236
|
+
<URow>
|
|
237
|
+
<UDatePicker
|
|
238
|
+
v-bind="args"
|
|
239
|
+
v-model="args.modelValue"
|
|
240
|
+
left-icon="update"
|
|
241
|
+
class="w-full"
|
|
242
|
+
/>
|
|
243
|
+
<UDatePicker
|
|
244
|
+
v-bind="args"
|
|
245
|
+
v-model="args.modelValue"
|
|
246
|
+
right-icon="edit_calendar"
|
|
247
|
+
class="w-full"
|
|
248
|
+
/>
|
|
249
|
+
</URow>
|
|
250
|
+
`,
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
export const Slots: StoryFn<DefaultUDatePickerArgs> = (args) => ({
|
|
254
|
+
components: { UDatePicker, URow, UButton },
|
|
255
|
+
setup() {
|
|
256
|
+
return { args };
|
|
257
|
+
},
|
|
258
|
+
template: `
|
|
259
|
+
<URow justify="stretch">
|
|
260
|
+
<UDatePicker
|
|
261
|
+
v-bind="args"
|
|
262
|
+
v-model="args.modelValue"
|
|
263
|
+
class="w-full"
|
|
264
|
+
:config="{ datepickerInput: { leftSlot: 'pl-0' } }"
|
|
265
|
+
>
|
|
266
|
+
<template #left>
|
|
267
|
+
<UButton label="Export" size="xs" class="h-full rounded-r-none" />
|
|
268
|
+
</template>
|
|
269
|
+
</UDatePicker>
|
|
270
|
+
<UDatePicker
|
|
271
|
+
v-bind="args"
|
|
272
|
+
v-model="args.modelValue"
|
|
273
|
+
class="w-full"
|
|
274
|
+
:config="{ datepickerInput: { rightSlot: 'pr-0' } }"
|
|
275
|
+
>
|
|
276
|
+
<template #right>
|
|
277
|
+
<UButton label="Schedule" size="xs" class="h-full rounded-l-none" />
|
|
278
|
+
</template>
|
|
279
|
+
</UDatePicker>
|
|
280
|
+
</URow>
|
|
281
|
+
`,
|
|
282
|
+
});
|
|
@@ -36,6 +36,11 @@ export interface Props<TModelValue> {
|
|
|
36
36
|
*/
|
|
37
37
|
error?: string;
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Make datepicker disabled.
|
|
41
|
+
*/
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
|
|
39
44
|
/**
|
|
40
45
|
* Datepicker size.
|
|
41
46
|
*/
|
|
@@ -98,11 +103,6 @@ export interface Props<TModelValue> {
|
|
|
98
103
|
*/
|
|
99
104
|
rightIcon?: string;
|
|
100
105
|
|
|
101
|
-
/**
|
|
102
|
-
* Make datepicker disabled.
|
|
103
|
-
*/
|
|
104
|
-
disabled?: boolean;
|
|
105
|
-
|
|
106
106
|
/**
|
|
107
107
|
* Unique element id.
|
|
108
108
|
*/
|
|
@@ -157,6 +157,7 @@ const rangePeriodMenuAttrs = computed(() => ({
|
|
|
157
157
|
rangeSwitchButtonAttrs,
|
|
158
158
|
rangeSwitchTitleAttrs,
|
|
159
159
|
rangeSwitchWrapperAttrs,
|
|
160
|
+
customRangeButtonAttrs,
|
|
160
161
|
customRangeDescriptionAttrs,
|
|
161
162
|
}));
|
|
162
163
|
|
|
@@ -538,6 +539,7 @@ const mutatedProps = computed(() => ({
|
|
|
538
539
|
month: isPeriod.value.month,
|
|
539
540
|
quarter: isPeriod.value.quarter,
|
|
540
541
|
year: isPeriod.value.year,
|
|
542
|
+
customRangeButtonDescription: Boolean(props.customRangeButton.description),
|
|
541
543
|
}));
|
|
542
544
|
|
|
543
545
|
const {
|
|
@@ -566,6 +568,7 @@ const {
|
|
|
566
568
|
rangeSwitchButtonAttrs,
|
|
567
569
|
rangeSwitchTitleAttrs,
|
|
568
570
|
rangeSwitchWrapperAttrs,
|
|
571
|
+
customRangeButtonAttrs,
|
|
569
572
|
customRangeDescriptionAttrs,
|
|
570
573
|
} = useUI<Config>(defaultConfig, mutatedProps);
|
|
571
574
|
|
|
@@ -169,7 +169,7 @@ function getDatePeriodState(date: DatePeriodRange) {
|
|
|
169
169
|
size="xs"
|
|
170
170
|
color="grayscale"
|
|
171
171
|
variant="thirdary"
|
|
172
|
-
v-bind="attrs.
|
|
172
|
+
v-bind="attrs.customRangeButtonAttrs.value"
|
|
173
173
|
@click="onClickCustomRangeButton"
|
|
174
174
|
>
|
|
175
175
|
{{ customRangeButton.label }}
|
|
@@ -187,7 +187,7 @@ function getDatePeriodState(date: DatePeriodRange) {
|
|
|
187
187
|
size="xs"
|
|
188
188
|
color="grayscale"
|
|
189
189
|
variant="thirdary"
|
|
190
|
-
v-bind="attrs.
|
|
190
|
+
v-bind="attrs.customRangeButtonAttrs.value"
|
|
191
191
|
@click="onClickCustomRangeButton"
|
|
192
192
|
>
|
|
193
193
|
{{ customRangeButton.label }}
|
|
@@ -78,6 +78,14 @@ export default /*tw*/ {
|
|
|
78
78
|
periodDateSelected: "{>periodDate}",
|
|
79
79
|
periodDateCurrent: "{>periodDate} border-2 border-brand-600",
|
|
80
80
|
periodDateCurrentSelected: "{>periodDate} {>periodDateSelected} {>periodDateCurrent}",
|
|
81
|
+
customRangeButton: {
|
|
82
|
+
base: "{>periodButton}",
|
|
83
|
+
variants: {
|
|
84
|
+
customRangeButtonDescription: {
|
|
85
|
+
true: "flex-col",
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
81
89
|
customRangeDescription: "",
|
|
82
90
|
rangeInputWrapper: "flex mt-4 -space-x-px group/range-input-wrapper",
|
|
83
91
|
rangeInput: {
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
|
|
9
9
|
import UDatePickerRange from "../UDatePickerRange.vue";
|
|
10
10
|
import URow from "../../ui.container-row/URow.vue";
|
|
11
|
+
import UCol from "../../ui.container-col/UCol.vue";
|
|
11
12
|
import UIcon from "../../ui.image-icon/UIcon.vue";
|
|
12
13
|
import UButton from "../../ui.button/UButton.vue";
|
|
13
14
|
|
|
@@ -23,7 +24,7 @@ interface DefaultUDatePickerRangeArgs extends UDatePickerRangeProps<unknown> {
|
|
|
23
24
|
|
|
24
25
|
interface EnumUDatePickerRangeArgs extends UDatePickerRangeProps<unknown> {
|
|
25
26
|
slotTemplate?: string;
|
|
26
|
-
enum: "size" | "variant";
|
|
27
|
+
enum: "size" | "variant" | "labelAlign";
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export default {
|
|
@@ -31,7 +32,7 @@ export default {
|
|
|
31
32
|
title: "Form Inputs & Controls / Date Picker Range",
|
|
32
33
|
component: UDatePickerRange,
|
|
33
34
|
args: {
|
|
34
|
-
label: "
|
|
35
|
+
label: "Select a date",
|
|
35
36
|
modelValue: {
|
|
36
37
|
from: new Date(2022, 1, 14),
|
|
37
38
|
to: new Date(2022, 2, 20),
|
|
@@ -74,7 +75,7 @@ const EnumVariantTemplate: StoryFn<EnumUDatePickerRangeArgs> = (
|
|
|
74
75
|
args: EnumUDatePickerRangeArgs,
|
|
75
76
|
{ argTypes },
|
|
76
77
|
) => ({
|
|
77
|
-
components: { UDatePickerRange,
|
|
78
|
+
components: { UDatePickerRange, UCol },
|
|
78
79
|
setup() {
|
|
79
80
|
return {
|
|
80
81
|
args,
|
|
@@ -82,7 +83,7 @@ const EnumVariantTemplate: StoryFn<EnumUDatePickerRangeArgs> = (
|
|
|
82
83
|
};
|
|
83
84
|
},
|
|
84
85
|
template: `
|
|
85
|
-
<
|
|
86
|
+
<UCol>
|
|
86
87
|
<UDatePickerRange
|
|
87
88
|
v-for="(option, index) in options"
|
|
88
89
|
:key="index"
|
|
@@ -90,8 +91,10 @@ const EnumVariantTemplate: StoryFn<EnumUDatePickerRangeArgs> = (
|
|
|
90
91
|
v-bind="args"
|
|
91
92
|
v-model="args.modelValue"
|
|
92
93
|
:[args.enum]="option"
|
|
94
|
+
:placeholder="option"
|
|
95
|
+
class="w-full"
|
|
93
96
|
/>
|
|
94
|
-
</
|
|
97
|
+
</UCol>
|
|
95
98
|
`,
|
|
96
99
|
});
|
|
97
100
|
|
|
@@ -143,23 +146,72 @@ const OpenDirectionTemplate: StoryFn<DefaultUDatePickerRangeArgs> = (
|
|
|
143
146
|
export const Default = DefaultTemplate.bind({});
|
|
144
147
|
Default.args = {};
|
|
145
148
|
|
|
149
|
+
export const Placeholder = DefaultTemplate.bind({});
|
|
150
|
+
Placeholder.args = {
|
|
151
|
+
variant: "input",
|
|
152
|
+
placeholder: "MM/DD/YYYY",
|
|
153
|
+
modelValue: { from: null, to: null },
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export const Description = DefaultTemplate.bind({});
|
|
157
|
+
Description.args = {
|
|
158
|
+
variant: "input",
|
|
159
|
+
description: "Please choose a date range from the calendar.",
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export const Error = DefaultTemplate.bind({});
|
|
163
|
+
Error.args = { variant: "input", error: "Please select a valid date." };
|
|
164
|
+
|
|
165
|
+
export const Disabled = DefaultTemplate.bind({});
|
|
166
|
+
Disabled.args = { disabled: true };
|
|
167
|
+
|
|
146
168
|
export const Variants = EnumVariantTemplate.bind({});
|
|
147
169
|
Variants.args = { enum: "variant" };
|
|
148
170
|
|
|
149
|
-
export const
|
|
150
|
-
|
|
171
|
+
export const LabelPlacement = EnumVariantTemplate.bind({});
|
|
172
|
+
LabelPlacement.args = {
|
|
173
|
+
variant: "input",
|
|
174
|
+
enum: "labelAlign",
|
|
175
|
+
modelValue: { from: null, to: null },
|
|
176
|
+
};
|
|
151
177
|
|
|
152
|
-
export const
|
|
153
|
-
|
|
178
|
+
export const Size = EnumVariantTemplate.bind({});
|
|
179
|
+
Size.args = {
|
|
180
|
+
variant: "input",
|
|
181
|
+
enum: "size",
|
|
182
|
+
modelValue: { from: null, to: null },
|
|
183
|
+
};
|
|
154
184
|
|
|
155
|
-
export const
|
|
156
|
-
|
|
185
|
+
export const OpenDirection = OpenDirectionTemplate.bind({});
|
|
186
|
+
OpenDirection.args = { variant: "input" };
|
|
157
187
|
|
|
158
|
-
export const
|
|
159
|
-
|
|
188
|
+
export const DateFormat = DefaultTemplate.bind({});
|
|
189
|
+
DateFormat.args = {
|
|
190
|
+
modelValue: { from: null, to: null },
|
|
191
|
+
variant: "input",
|
|
192
|
+
dateFormat: "Y-m-d",
|
|
193
|
+
};
|
|
194
|
+
DateFormat.parameters = {
|
|
195
|
+
docs: {
|
|
196
|
+
description: {
|
|
197
|
+
story: "Date string format.",
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
};
|
|
160
201
|
|
|
161
|
-
export const
|
|
162
|
-
|
|
202
|
+
export const UserDateFormat = DefaultTemplate.bind({});
|
|
203
|
+
UserDateFormat.args = {
|
|
204
|
+
modelValue: { from: null, to: null },
|
|
205
|
+
variant: "input",
|
|
206
|
+
userDateFormat: "d/m/Y",
|
|
207
|
+
};
|
|
208
|
+
UserDateFormat.parameters = {
|
|
209
|
+
docs: {
|
|
210
|
+
description: {
|
|
211
|
+
story: "User-friendly date format (it will be shown in UI).",
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
};
|
|
163
215
|
|
|
164
216
|
export const MinMax = DefaultTemplate.bind({});
|
|
165
217
|
MinMax.args = {
|
|
@@ -167,12 +219,12 @@ MinMax.args = {
|
|
|
167
219
|
maxDate: new Date(2022, 2, 26),
|
|
168
220
|
modelValue: { from: new Date(2022, 2, 24), to: new Date(2022, 2, 25) },
|
|
169
221
|
};
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
222
|
+
MinMax.parameters = {
|
|
223
|
+
docs: {
|
|
224
|
+
description: {
|
|
225
|
+
story: "Use `minDate` and `maxDate` props to set the minimum and maximum date.",
|
|
226
|
+
},
|
|
227
|
+
},
|
|
176
228
|
};
|
|
177
229
|
|
|
178
230
|
export const CustomRangeButton = DefaultTemplate.bind({});
|
|
@@ -183,33 +235,65 @@ CustomRangeButton.args = {
|
|
|
183
235
|
to: addDays(new Date(), 2),
|
|
184
236
|
},
|
|
185
237
|
label: "Next 2 days",
|
|
186
|
-
description: "
|
|
238
|
+
description: "Select next couple days",
|
|
187
239
|
},
|
|
188
240
|
modelValue: { from: null, to: null },
|
|
189
241
|
};
|
|
190
242
|
|
|
191
|
-
export const
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
243
|
+
export const IconProps: StoryFn<DefaultUDatePickerRangeArgs> = (args) => ({
|
|
244
|
+
components: { UDatePickerRange, URow },
|
|
245
|
+
setup() {
|
|
246
|
+
return { args };
|
|
247
|
+
},
|
|
248
|
+
template: `
|
|
249
|
+
<URow>
|
|
250
|
+
<UDatePickerRange
|
|
251
|
+
v-bind="args"
|
|
252
|
+
v-model="args.modelValue"
|
|
253
|
+
variant="input"
|
|
254
|
+
left-icon="update"
|
|
255
|
+
class="w-full"
|
|
256
|
+
/>
|
|
257
|
+
<UDatePickerRange
|
|
258
|
+
v-bind="args"
|
|
259
|
+
v-model="args.modelValue"
|
|
260
|
+
variant="input"
|
|
261
|
+
right-icon="edit_calendar"
|
|
262
|
+
class="w-full"
|
|
263
|
+
/>
|
|
264
|
+
</URow>
|
|
204
265
|
`,
|
|
205
|
-
};
|
|
266
|
+
});
|
|
206
267
|
|
|
207
|
-
export const
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
268
|
+
export const Slots: StoryFn<DefaultUDatePickerRangeArgs> = (args) => ({
|
|
269
|
+
components: { UDatePickerRange, URow, UButton },
|
|
270
|
+
setup() {
|
|
271
|
+
return { args };
|
|
272
|
+
},
|
|
273
|
+
template: `
|
|
274
|
+
<URow justify="stretch">
|
|
275
|
+
<UDatePickerRange
|
|
276
|
+
v-bind="args"
|
|
277
|
+
v-model="args.modelValue"
|
|
278
|
+
variant="input"
|
|
279
|
+
class="w-full"
|
|
280
|
+
:config="{ datepickerInput: { leftSlot: 'pl-0' } }"
|
|
281
|
+
>
|
|
282
|
+
<template #left>
|
|
283
|
+
<UButton label="Export" size="xs" class="h-full rounded-r-none" />
|
|
284
|
+
</template>
|
|
285
|
+
</UDatePickerRange>
|
|
286
|
+
<UDatePickerRange
|
|
287
|
+
v-bind="args"
|
|
288
|
+
v-model="args.modelValue"
|
|
289
|
+
variant="input"
|
|
290
|
+
class="w-full"
|
|
291
|
+
:config="{ datepickerInput: { rightSlot: 'pr-0' } }"
|
|
292
|
+
>
|
|
293
|
+
<template #right>
|
|
294
|
+
<UButton label="Schedule" size="xs" class="h-full rounded-l-none" />
|
|
295
|
+
</template>
|
|
296
|
+
</UDatePickerRange>
|
|
297
|
+
</URow>
|
|
214
298
|
`,
|
|
215
|
-
};
|
|
299
|
+
});
|