vueless 1.2.10-beta.2 → 1.2.10-beta.4
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/constants.d.ts +1 -0
- package/constants.js +1 -0
- package/icons/storybook/arrow_forward_ios.svg +1 -0
- package/index.d.ts +1 -0
- package/index.ts +1 -0
- package/package.json +1 -1
- package/types.ts +2 -0
- package/ui.button/UButton.vue +2 -6
- package/ui.button/config.ts +5 -0
- package/ui.button/tests/UButton.test.ts +1 -1
- package/ui.container-drawer/UDrawer.vue +365 -0
- package/ui.container-drawer/config.ts +128 -0
- package/ui.container-drawer/constants.ts +5 -0
- package/ui.container-drawer/storybook/docs.mdx +16 -0
- package/ui.container-drawer/storybook/stories.ts +255 -0
- package/ui.container-drawer/tests/UDrawer.test.ts +680 -0
- package/ui.container-drawer/types.ts +67 -0
- package/ui.form-calendar/tests/UCalendar.test.ts +4 -4
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getArgs,
|
|
3
|
+
getArgTypes,
|
|
4
|
+
getSlotNames,
|
|
5
|
+
getSlotsFragment,
|
|
6
|
+
getDocsDescription,
|
|
7
|
+
} from "../../utils/storybook";
|
|
8
|
+
|
|
9
|
+
import UDrawer from "../../ui.container-drawer/UDrawer.vue";
|
|
10
|
+
import UButton from "../../ui.button/UButton.vue";
|
|
11
|
+
import UIcon from "../../ui.image-icon/UIcon.vue";
|
|
12
|
+
import URow from "../../ui.container-row/URow.vue";
|
|
13
|
+
import UCol from "../../ui.container-col/UCol.vue";
|
|
14
|
+
import UHeader from "../../ui.text-header/UHeader.vue";
|
|
15
|
+
import USkeleton from "../../ui.skeleton/USkeleton.vue";
|
|
16
|
+
import USkeletonText from "../../ui.skeleton-text/USkeletonText.vue";
|
|
17
|
+
import USkeletonInput from "../../ui.skeleton-input/USkeletonInput.vue";
|
|
18
|
+
|
|
19
|
+
import type { Meta, StoryFn } from "@storybook/vue3-vite";
|
|
20
|
+
import type { Props } from "../types";
|
|
21
|
+
import type { UnknownObject } from "../../types";
|
|
22
|
+
|
|
23
|
+
interface UDrawerArgs extends Props {
|
|
24
|
+
slotTemplate?: string;
|
|
25
|
+
enum: "variant" | "position";
|
|
26
|
+
modelValues?: UnknownObject;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default {
|
|
30
|
+
id: "5000",
|
|
31
|
+
title: "Containers / Drawer",
|
|
32
|
+
component: UDrawer,
|
|
33
|
+
args: {
|
|
34
|
+
title: "Sign Up",
|
|
35
|
+
modelValue: false,
|
|
36
|
+
},
|
|
37
|
+
argTypes: {
|
|
38
|
+
...getArgTypes(UDrawer.__name),
|
|
39
|
+
},
|
|
40
|
+
parameters: {
|
|
41
|
+
docs: {
|
|
42
|
+
...getDocsDescription(UDrawer.__name),
|
|
43
|
+
story: {
|
|
44
|
+
height: "550px",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
} as Meta;
|
|
49
|
+
|
|
50
|
+
const defaultTemplate = `
|
|
51
|
+
<UCol
|
|
52
|
+
justify="between"
|
|
53
|
+
align="stretch"
|
|
54
|
+
class="h-full min-w-96"
|
|
55
|
+
gap="xl"
|
|
56
|
+
>
|
|
57
|
+
<USkeletonText />
|
|
58
|
+
|
|
59
|
+
<URow
|
|
60
|
+
align="center"
|
|
61
|
+
justify="between"
|
|
62
|
+
gap="sm"
|
|
63
|
+
>
|
|
64
|
+
<USkeleton class="h-12" />
|
|
65
|
+
<USkeleton class="h-12" />
|
|
66
|
+
</URow>
|
|
67
|
+
|
|
68
|
+
<UCol gap="sm" block>
|
|
69
|
+
<USkeletonInput label label-align="top" />
|
|
70
|
+
<USkeletonInput label label-align="top" />
|
|
71
|
+
</UCol>
|
|
72
|
+
</UCol>
|
|
73
|
+
`;
|
|
74
|
+
|
|
75
|
+
const DefaultTemplate: StoryFn<UDrawerArgs> = (args: UDrawerArgs) => ({
|
|
76
|
+
components: {
|
|
77
|
+
UDrawer,
|
|
78
|
+
URow,
|
|
79
|
+
UCol,
|
|
80
|
+
UButton,
|
|
81
|
+
UIcon,
|
|
82
|
+
UHeader,
|
|
83
|
+
USkeleton,
|
|
84
|
+
USkeletonText,
|
|
85
|
+
USkeletonInput,
|
|
86
|
+
},
|
|
87
|
+
setup() {
|
|
88
|
+
function onClick() {
|
|
89
|
+
args.modelValue = true;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const slots = getSlotNames(UDrawer.__name);
|
|
93
|
+
|
|
94
|
+
return { args, slots, onClick };
|
|
95
|
+
},
|
|
96
|
+
template: `
|
|
97
|
+
<UCol>
|
|
98
|
+
<UDrawer v-bind="args" v-model="args.modelValue">
|
|
99
|
+
${args.slotTemplate || getSlotsFragment(defaultTemplate)}
|
|
100
|
+
</UDrawer>
|
|
101
|
+
|
|
102
|
+
<UButton label="Show drawer" @click="onClick" />
|
|
103
|
+
</UCol>
|
|
104
|
+
`,
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
const EnumTemplate: StoryFn<UDrawerArgs> = (args: UDrawerArgs, { argTypes }) => ({
|
|
108
|
+
components: {
|
|
109
|
+
UDrawer,
|
|
110
|
+
UButton,
|
|
111
|
+
URow,
|
|
112
|
+
UCol,
|
|
113
|
+
USkeleton,
|
|
114
|
+
USkeletonText,
|
|
115
|
+
USkeletonInput,
|
|
116
|
+
},
|
|
117
|
+
setup: () => ({ args, argTypes, getArgs }),
|
|
118
|
+
template: `
|
|
119
|
+
<URow>
|
|
120
|
+
<UButton
|
|
121
|
+
v-for="option in argTypes?.[args.enum]?.options"
|
|
122
|
+
:key="option"
|
|
123
|
+
:label="option"
|
|
124
|
+
@click="args.modelValues[option] = !args.modelValues[option]"
|
|
125
|
+
/>
|
|
126
|
+
|
|
127
|
+
<UDrawer
|
|
128
|
+
v-for="option in argTypes?.[args.enum]?.options"
|
|
129
|
+
:key="option"
|
|
130
|
+
v-bind="getArgs(args, option)"
|
|
131
|
+
v-model="args.modelValues[option]"
|
|
132
|
+
>
|
|
133
|
+
${defaultTemplate}
|
|
134
|
+
</UDrawer>
|
|
135
|
+
</URow>
|
|
136
|
+
`,
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
export const Default = DefaultTemplate.bind({});
|
|
140
|
+
Default.args = {};
|
|
141
|
+
|
|
142
|
+
export const Description = DefaultTemplate.bind({});
|
|
143
|
+
Description.args = {
|
|
144
|
+
description: "Enter your email below to get started and create your account.",
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export const NoHandle = DefaultTemplate.bind({});
|
|
148
|
+
NoHandle.args = { handle: false };
|
|
149
|
+
|
|
150
|
+
export const Inset = DefaultTemplate.bind({});
|
|
151
|
+
Inset.args = { inset: true };
|
|
152
|
+
|
|
153
|
+
export const NoCloseOnEscAndOverlay = DefaultTemplate.bind({});
|
|
154
|
+
NoCloseOnEscAndOverlay.args = {
|
|
155
|
+
closeOnEsc: false,
|
|
156
|
+
closeOnOverlay: false,
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export const Position = EnumTemplate.bind({});
|
|
160
|
+
Position.args = { enum: "position", modelValues: {} };
|
|
161
|
+
|
|
162
|
+
export const Variant = EnumTemplate.bind({});
|
|
163
|
+
Variant.args = { enum: "variant", modelValues: {} };
|
|
164
|
+
|
|
165
|
+
export const BeforeTitleSlot = DefaultTemplate.bind({});
|
|
166
|
+
BeforeTitleSlot.args = {
|
|
167
|
+
slotTemplate: `
|
|
168
|
+
<template #before-title>
|
|
169
|
+
<UIcon name="account_circle" size="sm" color="primary" />
|
|
170
|
+
</template>
|
|
171
|
+
<template #default>
|
|
172
|
+
${defaultTemplate}
|
|
173
|
+
</template>
|
|
174
|
+
`,
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export const TitleSlot = DefaultTemplate.bind({});
|
|
178
|
+
TitleSlot.args = {
|
|
179
|
+
slotTemplate: `
|
|
180
|
+
<template #title="{ title }">
|
|
181
|
+
<UHeader :label="title" color="primary" />
|
|
182
|
+
</template>
|
|
183
|
+
<template #default>
|
|
184
|
+
${defaultTemplate}
|
|
185
|
+
</template>
|
|
186
|
+
`,
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export const AfterTitleSlot = DefaultTemplate.bind({});
|
|
190
|
+
AfterTitleSlot.args = {
|
|
191
|
+
slotTemplate: `
|
|
192
|
+
<template #after-title>
|
|
193
|
+
<UIcon name="verified" size="sm" color="primary" />
|
|
194
|
+
</template>
|
|
195
|
+
<template #default>
|
|
196
|
+
${defaultTemplate}
|
|
197
|
+
</template>
|
|
198
|
+
`,
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
export const ActionsSlot = DefaultTemplate.bind({});
|
|
202
|
+
ActionsSlot.args = {
|
|
203
|
+
slotTemplate: `
|
|
204
|
+
<template #actions="{ close }">
|
|
205
|
+
<UButton
|
|
206
|
+
label="Close"
|
|
207
|
+
size="sm"
|
|
208
|
+
color="grayscale"
|
|
209
|
+
variant="subtle"
|
|
210
|
+
@click="close"
|
|
211
|
+
/>
|
|
212
|
+
</template>
|
|
213
|
+
<template #default>
|
|
214
|
+
${defaultTemplate}
|
|
215
|
+
</template>
|
|
216
|
+
`,
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
export const HandleSlot = DefaultTemplate.bind({});
|
|
220
|
+
HandleSlot.args = {
|
|
221
|
+
slotTemplate: `
|
|
222
|
+
<template #default>
|
|
223
|
+
${defaultTemplate}
|
|
224
|
+
</template>
|
|
225
|
+
<template #handle>
|
|
226
|
+
<UIcon name="arrow_forward_ios" size="sm" color="neutral" />
|
|
227
|
+
</template>
|
|
228
|
+
`,
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
export const FooterLeftSlot = DefaultTemplate.bind({});
|
|
232
|
+
FooterLeftSlot.args = {
|
|
233
|
+
slotTemplate: `
|
|
234
|
+
<template #default>
|
|
235
|
+
${defaultTemplate}
|
|
236
|
+
</template>
|
|
237
|
+
|
|
238
|
+
<template #footer-left>
|
|
239
|
+
<UButton label="Back" variant="subtle" color="neutral" />
|
|
240
|
+
</template>
|
|
241
|
+
`,
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
export const FooterRightSlot = DefaultTemplate.bind({});
|
|
245
|
+
FooterRightSlot.args = {
|
|
246
|
+
slotTemplate: `
|
|
247
|
+
<template #default>
|
|
248
|
+
${defaultTemplate}
|
|
249
|
+
</template>
|
|
250
|
+
|
|
251
|
+
<template #footer-right>
|
|
252
|
+
<UButton label="Submit" variant="subtle" />
|
|
253
|
+
</template>
|
|
254
|
+
`,
|
|
255
|
+
};
|