@polymarbot/nuxt-layer-shadcn-ui 0.1.9 → 0.2.0-w
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/app/assets/styles/colors.css +10 -10
- package/app/assets/styles/globals.css +1 -0
- package/app/assets/styles/z-index.css +27 -0
- package/app/components/ui/Accordion/index.stories.ts +60 -56
- package/app/components/ui/Accordion/index.vue +1 -1
- package/app/components/ui/AdminLayout/SidebarMenus.vue +0 -2
- package/app/components/ui/AdminLayout/index.stories.ts +9 -8
- package/app/components/ui/Alert/index.stories.ts +28 -26
- package/app/components/ui/Alert/index.vue +6 -6
- package/app/components/ui/Alert/types.ts +2 -1
- package/app/components/ui/AlertDialog/index.stories.ts +85 -50
- package/app/components/ui/AsyncDataTable/index.stories.ts +53 -36
- package/app/components/ui/Avatar/index.stories.ts +56 -51
- package/app/components/ui/Avatar/index.vue +1 -1
- package/app/components/ui/Avatar/types.ts +5 -2
- package/app/components/ui/Badge/index.stories.ts +41 -41
- package/app/components/ui/Badge/index.vue +1 -1
- package/app/components/ui/Badge/types.ts +3 -1
- package/app/components/ui/Breadcrumb/index.stories.ts +48 -37
- package/app/components/ui/Breadcrumb/index.vue +1 -1
- package/app/components/ui/Button/index.stories.ts +94 -90
- package/app/components/ui/Button/index.vue +1 -1
- package/app/components/ui/Button/types.ts +4 -1
- package/app/components/ui/ButtonGroup/index.stories.ts +61 -49
- package/app/components/ui/Card/index.stories.ts +55 -47
- package/app/components/ui/Card/index.vue +1 -1
- package/app/components/ui/Checkbox/index.stories.ts +69 -46
- package/app/components/ui/Checkbox/index.vue +1 -1
- package/app/components/ui/CopyButton/index.stories.ts +89 -31
- package/app/components/ui/DataTable/index.stories.ts +218 -168
- package/app/components/ui/DataTable/index.vue +1 -1
- package/app/components/ui/DatePicker/index.stories.ts +131 -37
- package/app/components/ui/DateRangePicker/index.stories.ts +107 -33
- package/app/components/ui/Divider/index.stories.ts +46 -24
- package/app/components/ui/Divider/index.vue +1 -1
- package/app/components/ui/Drawer/index.stories.ts +131 -81
- package/app/components/ui/Drawer/index.vue +1 -7
- package/app/components/ui/Drawer/types.ts +1 -1
- package/app/components/ui/Dropdown/index.stories.ts +134 -89
- package/app/components/ui/Dropdown/index.vue +5 -1
- package/app/components/ui/Dropdown/types.ts +1 -1
- package/app/components/ui/FormItem/index.stories.ts +87 -43
- package/app/components/ui/FormItem/index.vue +1 -1
- package/app/components/ui/Help/index.stories.ts +46 -35
- package/app/components/ui/Icon/index.stories.ts +41 -43
- package/app/components/ui/Input/index.stories.ts +95 -41
- package/app/components/ui/Input/index.vue +1 -1
- package/app/components/ui/InputCurrency/index.stories.ts +89 -49
- package/app/components/ui/InputNumber/index.stories.ts +93 -29
- package/app/components/ui/InputNumber/index.vue +1 -1
- package/app/components/ui/InputOtp/index.stories.ts +6 -7
- package/app/components/ui/InputOtp/index.vue +1 -1
- package/app/components/ui/InputPercent/index.stories.ts +6 -7
- package/app/components/ui/InputRange/index.stories.ts +6 -7
- package/app/components/ui/Loading/index.stories.ts +19 -19
- package/app/components/ui/Markdown/index.stories.ts +7 -10
- package/app/components/ui/Modal/index.stories.ts +135 -80
- package/app/components/ui/Modal/index.vue +1 -6
- package/app/components/ui/Modal/types.ts +1 -1
- package/app/components/ui/ModalContent/index.stories.ts +54 -26
- package/app/components/ui/ModalContent/index.vue +2 -2
- package/app/components/ui/PageCard/index.stories.ts +177 -67
- package/app/components/ui/Pagination/index.stories.ts +68 -51
- package/app/components/ui/Pagination/index.vue +2 -2
- package/app/components/ui/Popover/index.stories.ts +47 -45
- package/app/components/ui/Popover/index.vue +1 -1
- package/app/components/ui/Qrcode/index.stories.ts +42 -34
- package/app/components/ui/RadioCardGroup/index.stories.ts +23 -32
- package/app/components/ui/RadioCardGroup/index.vue +1 -1
- package/app/components/ui/RadioGroup/index.stories.ts +123 -0
- package/app/components/ui/RadioGroup/index.vue +73 -0
- package/app/components/ui/RadioGroup/types.ts +13 -0
- package/app/components/ui/ScrollArea/index.stories.ts +69 -37
- package/app/components/ui/ScrollArea/index.vue +1 -1
- package/app/components/ui/SearchSelect/index.stories.ts +104 -66
- package/app/components/ui/Select/index.stories.ts +152 -98
- package/app/components/ui/Select/index.vue +3 -3
- package/app/components/ui/Skeleton/index.stories.ts +27 -30
- package/app/components/ui/Skeleton/index.vue +1 -1
- package/app/components/ui/Slider/index.stories.ts +73 -31
- package/app/components/ui/Slider/index.vue +1 -1
- package/app/components/ui/Surface/index.stories.ts +47 -21
- package/app/components/ui/Surface/index.vue +39 -28
- package/app/components/ui/Surface/types.ts +2 -2
- package/app/components/ui/Switch/index.stories.ts +6 -7
- package/app/components/ui/Switch/index.vue +1 -1
- package/app/components/ui/Tabs/index.stories.ts +103 -61
- package/app/components/ui/Tabs/index.vue +1 -1
- package/app/components/ui/Tag/index.stories.ts +42 -25
- package/app/components/ui/Tag/index.vue +39 -28
- package/app/components/ui/Tag/types.ts +2 -2
- package/app/components/ui/Textarea/index.stories.ts +73 -9
- package/app/components/ui/Textarea/index.vue +1 -1
- package/app/components/ui/Toast/index.stories.ts +71 -18
- package/app/components/ui/Toast/index.vue +1 -1
- package/app/components/ui/Tooltip/index.stories.ts +45 -38
- package/app/components/ui/Tooltip/index.vue +1 -1
- package/app/components/ui/WebLink/index.stories.ts +76 -41
- package/app/components/ui/WebLink/index.vue +1 -1
- package/package.json +2 -2
- package/app/components/ui/Radio/index.stories.ts +0 -71
- package/app/components/ui/Radio/index.vue +0 -10
- package/app/components/ui/Radio/types.ts +0 -3
|
@@ -22,85 +22,195 @@ const meta = {
|
|
|
22
22
|
disabled: false,
|
|
23
23
|
variant: 'paper',
|
|
24
24
|
},
|
|
25
|
+
render: args => ({
|
|
26
|
+
components: { PageCard },
|
|
27
|
+
setup: () => ({ args }),
|
|
28
|
+
template: `
|
|
29
|
+
<PageCard v-bind="args" class="max-w-2xl">
|
|
30
|
+
<p>Page card content goes here.</p>
|
|
31
|
+
</PageCard>
|
|
32
|
+
`,
|
|
33
|
+
}),
|
|
25
34
|
} satisfies Meta<typeof PageCard>
|
|
26
35
|
|
|
27
36
|
export default meta
|
|
28
37
|
type Story = StoryObj<typeof meta>
|
|
29
38
|
|
|
30
|
-
export const Default: Story = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
39
|
+
export const Default: Story = {}
|
|
40
|
+
|
|
41
|
+
export const NoTitle: Story = {
|
|
42
|
+
render: () => ({
|
|
43
|
+
components: { PageCard },
|
|
34
44
|
template: `
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
</PageCard>
|
|
42
|
-
</section>
|
|
45
|
+
<PageCard class="max-w-2xl">
|
|
46
|
+
<p>A page card without a title — just content.</p>
|
|
47
|
+
</PageCard>
|
|
48
|
+
`,
|
|
49
|
+
}),
|
|
50
|
+
}
|
|
43
51
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
export const WithSubtitle: Story = {
|
|
53
|
+
render: () => ({
|
|
54
|
+
components: { PageCard },
|
|
55
|
+
template: `
|
|
56
|
+
<PageCard
|
|
57
|
+
title="Bot Details"
|
|
58
|
+
subtitle="View and edit your bot configuration."
|
|
59
|
+
class="max-w-2xl"
|
|
60
|
+
>
|
|
61
|
+
<p>Title combined with subtitle.</p>
|
|
62
|
+
</PageCard>
|
|
63
|
+
`,
|
|
64
|
+
}),
|
|
65
|
+
}
|
|
51
66
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
67
|
+
export const WithBackButton: Story = {
|
|
68
|
+
render: () => ({
|
|
69
|
+
components: { PageCard },
|
|
70
|
+
template: `
|
|
71
|
+
<PageCard title="Edit Profile" :back="{ action: () => {} }" class="max-w-2xl">
|
|
72
|
+
<p>A page card with a back button in the header.</p>
|
|
73
|
+
</PageCard>
|
|
74
|
+
`,
|
|
75
|
+
}),
|
|
76
|
+
}
|
|
59
77
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
78
|
+
export const BackWithSubtitle: Story = {
|
|
79
|
+
render: () => ({
|
|
80
|
+
components: { PageCard },
|
|
81
|
+
template: `
|
|
82
|
+
<PageCard
|
|
83
|
+
title="Bot Details"
|
|
84
|
+
subtitle="View and edit your bot configuration."
|
|
85
|
+
:back="{ action: () => {} }"
|
|
86
|
+
class="max-w-2xl"
|
|
87
|
+
>
|
|
88
|
+
<p>Back button combined with title and subtitle.</p>
|
|
89
|
+
</PageCard>
|
|
90
|
+
`,
|
|
91
|
+
}),
|
|
92
|
+
}
|
|
71
93
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
>
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
</section>
|
|
94
|
+
export const WithActions: Story = {
|
|
95
|
+
render: () => ({
|
|
96
|
+
components: { PageCard, Button },
|
|
97
|
+
template: `
|
|
98
|
+
<PageCard title="API Keys" class="max-w-2xl">
|
|
99
|
+
<template #actions>
|
|
100
|
+
<Button variant="outline" size="sm">Export</Button>
|
|
101
|
+
<Button size="sm">Create</Button>
|
|
102
|
+
</template>
|
|
103
|
+
<p>Action buttons rendered on the right side of the title.</p>
|
|
104
|
+
</PageCard>
|
|
105
|
+
`,
|
|
106
|
+
}),
|
|
107
|
+
}
|
|
87
108
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
109
|
+
export const ActionsSubtitleBack: Story = {
|
|
110
|
+
render: () => ({
|
|
111
|
+
components: { PageCard, WebLink },
|
|
112
|
+
template: `
|
|
113
|
+
<PageCard
|
|
114
|
+
title="Developer Settings"
|
|
115
|
+
subtitle="Manage API keys and webhooks for your organization."
|
|
116
|
+
:back="{ action: () => {} }"
|
|
117
|
+
class="max-w-2xl"
|
|
118
|
+
>
|
|
119
|
+
<template #actions>
|
|
120
|
+
<WebLink href="#" target="_blank" class="text-sm">Docs</WebLink>
|
|
121
|
+
<WebLink href="#" target="_blank" class="text-sm">API Reference</WebLink>
|
|
122
|
+
</template>
|
|
123
|
+
<p>Back button, title, subtitle, and trailing action slot working together.</p>
|
|
124
|
+
</PageCard>
|
|
125
|
+
`,
|
|
126
|
+
}),
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export const CustomTitleSlot: Story = {
|
|
130
|
+
render: () => ({
|
|
131
|
+
components: { PageCard },
|
|
132
|
+
template: `
|
|
133
|
+
<PageCard class="max-w-2xl">
|
|
134
|
+
<template #title>
|
|
135
|
+
<span class="flex items-center gap-2">
|
|
136
|
+
<span class="inline-block size-2 rounded-full bg-success" />
|
|
137
|
+
<span>Active Workspace</span>
|
|
138
|
+
</span>
|
|
139
|
+
</template>
|
|
140
|
+
<template #subtitle>
|
|
141
|
+
<span class="text-success">All systems operational</span>
|
|
142
|
+
</template>
|
|
143
|
+
<p>Title and subtitle rendered via slots.</p>
|
|
144
|
+
</PageCard>
|
|
145
|
+
`,
|
|
146
|
+
}),
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export const WithFooter: Story = {
|
|
150
|
+
render: () => ({
|
|
151
|
+
components: { PageCard, Button },
|
|
152
|
+
template: `
|
|
153
|
+
<PageCard title="Profile" class="max-w-2xl">
|
|
154
|
+
<p>Edit your profile information and save the changes.</p>
|
|
155
|
+
<template #footer>
|
|
156
|
+
<div class="flex w-full justify-end gap-2">
|
|
157
|
+
<Button variant="outline">Cancel</Button>
|
|
158
|
+
<Button>Save</Button>
|
|
159
|
+
</div>
|
|
160
|
+
</template>
|
|
161
|
+
</PageCard>
|
|
162
|
+
`,
|
|
163
|
+
}),
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export const CardVariant: Story = {
|
|
167
|
+
render: () => ({
|
|
168
|
+
components: { PageCard },
|
|
169
|
+
template: `
|
|
170
|
+
<PageCard
|
|
171
|
+
title="Profile"
|
|
172
|
+
subtitle="Rounded corners and a visible border."
|
|
173
|
+
variant="card"
|
|
174
|
+
class="max-w-2xl"
|
|
175
|
+
>
|
|
176
|
+
<p>Use variant="card" for widget-style panels; default "paper" is edge-to-edge.</p>
|
|
177
|
+
</PageCard>
|
|
178
|
+
`,
|
|
179
|
+
}),
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export const Loading: Story = {
|
|
183
|
+
render: () => ({
|
|
184
|
+
components: { PageCard },
|
|
185
|
+
template: `
|
|
186
|
+
<PageCard title="Saving…" loading class="max-w-2xl">
|
|
187
|
+
<p>Content is covered by a centered loading overlay while <code>loading</code> is true.</p>
|
|
188
|
+
</PageCard>
|
|
189
|
+
`,
|
|
190
|
+
}),
|
|
191
|
+
}
|
|
95
192
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
193
|
+
export const NotReady: Story = {
|
|
194
|
+
render: () => ({
|
|
195
|
+
components: { PageCard },
|
|
196
|
+
template: `
|
|
197
|
+
<PageCard :ready="false" class="max-w-2xl">
|
|
198
|
+
<p>This content would be replaced by skeleton placeholders while data is loading.</p>
|
|
199
|
+
</PageCard>
|
|
200
|
+
`,
|
|
201
|
+
}),
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export const Disabled: Story = {
|
|
205
|
+
render: () => ({
|
|
206
|
+
components: { PageCard, Button },
|
|
207
|
+
template: `
|
|
208
|
+
<PageCard title="Read-only" disabled class="max-w-2xl">
|
|
209
|
+
<div class="flex flex-col gap-3">
|
|
210
|
+
<p>When <code>disabled</code> is true, content becomes non-interactive and dimmed.</p>
|
|
211
|
+
<Button>Disabled action</Button>
|
|
212
|
+
</div>
|
|
213
|
+
</PageCard>
|
|
104
214
|
`,
|
|
105
215
|
}),
|
|
106
216
|
}
|
|
@@ -1,81 +1,98 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
2
|
import Pagination from './index.vue'
|
|
3
3
|
|
|
4
|
+
const sizes = [ 'default', 'sm' ] as const
|
|
5
|
+
|
|
4
6
|
const meta = {
|
|
5
7
|
title: 'UI/Pagination',
|
|
6
8
|
component: Pagination,
|
|
7
9
|
argTypes: {
|
|
10
|
+
page: { control: { type: 'number', min: 1 }},
|
|
11
|
+
total: { control: { type: 'number', min: 0 }},
|
|
12
|
+
pageSize: { control: { type: 'number', min: 1 }},
|
|
13
|
+
pageSizeOptions: { control: 'object' },
|
|
8
14
|
simple: { control: 'boolean' },
|
|
9
|
-
size: { control: 'select', options: [ 'default', 'sm' ]},
|
|
10
15
|
siblingCount: { control: { type: 'number', min: 0 }},
|
|
16
|
+
size: { control: 'select', options: sizes },
|
|
11
17
|
},
|
|
12
18
|
args: {
|
|
19
|
+
page: 1,
|
|
20
|
+
total: 85,
|
|
21
|
+
pageSize: 10,
|
|
22
|
+
pageSizeOptions: [ 10, 20, 50 ],
|
|
13
23
|
simple: false,
|
|
14
|
-
size: 'default',
|
|
15
24
|
siblingCount: 1,
|
|
25
|
+
size: 'default',
|
|
16
26
|
},
|
|
27
|
+
render: args => ({
|
|
28
|
+
components: { Pagination },
|
|
29
|
+
setup: () => ({ args }),
|
|
30
|
+
template: '<Pagination v-bind="args" />',
|
|
31
|
+
}),
|
|
17
32
|
} satisfies Meta<typeof Pagination>
|
|
18
33
|
|
|
19
34
|
export default meta
|
|
20
35
|
type Story = StoryObj<typeof meta>
|
|
21
36
|
|
|
22
|
-
export const Default: Story = {
|
|
23
|
-
|
|
37
|
+
export const Default: Story = {}
|
|
38
|
+
|
|
39
|
+
export const Controlled: Story = {
|
|
40
|
+
render: () => ({
|
|
24
41
|
components: { Pagination },
|
|
25
42
|
setup () {
|
|
26
43
|
const page = ref(1)
|
|
27
44
|
const pageSize = ref(10)
|
|
28
|
-
|
|
29
|
-
return { args, page, pageSize }
|
|
45
|
+
return { page, pageSize }
|
|
30
46
|
},
|
|
31
47
|
template: `
|
|
32
|
-
<div
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
</section>
|
|
48
|
+
<div>
|
|
49
|
+
<Pagination
|
|
50
|
+
:page="page"
|
|
51
|
+
:total="85"
|
|
52
|
+
:pageSize="pageSize"
|
|
53
|
+
:pageSizeOptions="[10, 20, 50]"
|
|
54
|
+
@update:page="page = $event"
|
|
55
|
+
@update:pageSize="v => { pageSize = v; page = 1 }"
|
|
56
|
+
/>
|
|
57
|
+
<div class="mt-2 text-sm text-muted-foreground">
|
|
58
|
+
Page: {{ page }}, Size: {{ pageSize }}
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
`,
|
|
62
|
+
}),
|
|
63
|
+
}
|
|
49
64
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
export const Sizes: Story = {
|
|
66
|
+
render: () => ({
|
|
67
|
+
components: { Pagination },
|
|
68
|
+
template: `
|
|
69
|
+
<div class="space-y-4">
|
|
70
|
+
<div>
|
|
71
|
+
<span class="mb-2 block text-sm font-medium">default</span>
|
|
72
|
+
<Pagination :page="3" :total="85" :pageSize="10" />
|
|
73
|
+
</div>
|
|
74
|
+
<div>
|
|
75
|
+
<span class="mb-2 block text-sm font-medium">sm</span>
|
|
76
|
+
<Pagination :page="3" :total="85" :pageSize="10" size="sm" />
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
`,
|
|
80
|
+
}),
|
|
81
|
+
}
|
|
64
82
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
</section>
|
|
83
|
+
export const Simple: Story = {
|
|
84
|
+
render: () => ({
|
|
85
|
+
components: { Pagination },
|
|
86
|
+
template: `
|
|
87
|
+
<div class="space-y-4">
|
|
88
|
+
<div>
|
|
89
|
+
<span class="mb-2 block text-sm font-medium">default</span>
|
|
90
|
+
<Pagination :page="3" :total="85" :pageSize="10" simple />
|
|
91
|
+
</div>
|
|
92
|
+
<div>
|
|
93
|
+
<span class="mb-2 block text-sm font-medium">sm</span>
|
|
94
|
+
<Pagination :page="3" :total="85" :pageSize="10" simple size="sm" />
|
|
95
|
+
</div>
|
|
79
96
|
</div>
|
|
80
97
|
`,
|
|
81
98
|
}),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { DropdownItem } from '@polymarbot/nuxt-layer-shadcn-ui/app/components/ui/Dropdown/types'
|
|
3
|
-
import { buttonVariants } from '
|
|
3
|
+
import { buttonVariants } from '../../shadcn/button'
|
|
4
4
|
import {
|
|
5
5
|
Pagination as ShadcnPagination,
|
|
6
6
|
PaginationContent,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
PaginationLast,
|
|
11
11
|
PaginationNext,
|
|
12
12
|
PaginationPrevious,
|
|
13
|
-
} from '
|
|
13
|
+
} from '../../shadcn/pagination'
|
|
14
14
|
import type { PaginationProps } from './types'
|
|
15
15
|
|
|
16
16
|
const props = withDefaults(defineProps<PaginationProps>(), {
|
|
@@ -6,61 +6,63 @@ import Popover from './index.vue'
|
|
|
6
6
|
const meta = {
|
|
7
7
|
title: 'UI/Popover',
|
|
8
8
|
component: Popover,
|
|
9
|
+
render: () => ({
|
|
10
|
+
components: { Popover, Button },
|
|
11
|
+
template: `
|
|
12
|
+
<Popover>
|
|
13
|
+
<template #trigger>
|
|
14
|
+
<Button variant="outline">Open Popover</Button>
|
|
15
|
+
</template>
|
|
16
|
+
<div class="space-y-2">
|
|
17
|
+
<h4 class="font-medium">Popover Content</h4>
|
|
18
|
+
<p class="text-sm text-muted-foreground">This is the popover body with some informational content.</p>
|
|
19
|
+
</div>
|
|
20
|
+
</Popover>
|
|
21
|
+
`,
|
|
22
|
+
}),
|
|
9
23
|
} satisfies Meta<typeof Popover>
|
|
10
24
|
|
|
11
25
|
export default meta
|
|
12
26
|
type Story = StoryObj<typeof meta>
|
|
13
27
|
|
|
14
|
-
export const Default: Story = {
|
|
28
|
+
export const Default: Story = {}
|
|
29
|
+
|
|
30
|
+
export const WithForm: Story = {
|
|
15
31
|
render: () => ({
|
|
16
32
|
components: { Popover, Button, Input },
|
|
33
|
+
template: `
|
|
34
|
+
<Popover>
|
|
35
|
+
<template #trigger>
|
|
36
|
+
<Button variant="outline">Edit Name</Button>
|
|
37
|
+
</template>
|
|
38
|
+
<div class="space-y-3">
|
|
39
|
+
<h4 class="font-medium">Update Name</h4>
|
|
40
|
+
<Input placeholder="Enter new name" />
|
|
41
|
+
<Button size="sm" class="w-full">Save</Button>
|
|
42
|
+
</div>
|
|
43
|
+
</Popover>
|
|
44
|
+
`,
|
|
45
|
+
}),
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const Controlled: Story = {
|
|
49
|
+
render: () => ({
|
|
50
|
+
components: { Popover, Button },
|
|
17
51
|
setup () {
|
|
18
|
-
const
|
|
19
|
-
return {
|
|
52
|
+
const open = ref(false)
|
|
53
|
+
return { open }
|
|
20
54
|
},
|
|
21
55
|
template: `
|
|
22
|
-
<div class="
|
|
23
|
-
<
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
</div>
|
|
33
|
-
</Popover>
|
|
34
|
-
</section>
|
|
35
|
-
|
|
36
|
-
<section>
|
|
37
|
-
<h3 class="mb-4 text-lg font-medium">With Form</h3>
|
|
38
|
-
<Popover>
|
|
39
|
-
<template #trigger>
|
|
40
|
-
<Button variant="outline">Edit Name</Button>
|
|
41
|
-
</template>
|
|
42
|
-
<div class="space-y-3">
|
|
43
|
-
<h4 class="font-medium">Update Name</h4>
|
|
44
|
-
<Input placeholder="Enter new name" />
|
|
45
|
-
<Button size="sm" class="w-full">Save</Button>
|
|
46
|
-
</div>
|
|
47
|
-
</Popover>
|
|
48
|
-
</section>
|
|
49
|
-
|
|
50
|
-
<section>
|
|
51
|
-
<h3 class="mb-4 text-lg font-medium">Controlled</h3>
|
|
52
|
-
<div class="flex items-center gap-2">
|
|
53
|
-
<Popover v-model:open="controlled">
|
|
54
|
-
<template #trigger>
|
|
55
|
-
<Button variant="outline">Controlled Popover</Button>
|
|
56
|
-
</template>
|
|
57
|
-
<p class="text-sm">This popover is controlled externally.</p>
|
|
58
|
-
</Popover>
|
|
59
|
-
<Button variant="ghost" size="sm" @click="controlled = !controlled">
|
|
60
|
-
Toggle ({{ controlled ? 'Open' : 'Closed' }})
|
|
61
|
-
</Button>
|
|
62
|
-
</div>
|
|
63
|
-
</section>
|
|
56
|
+
<div class="flex items-center gap-2">
|
|
57
|
+
<Popover v-model:open="open">
|
|
58
|
+
<template #trigger>
|
|
59
|
+
<Button variant="outline">Controlled Popover</Button>
|
|
60
|
+
</template>
|
|
61
|
+
<p class="text-sm">This popover is controlled externally.</p>
|
|
62
|
+
</Popover>
|
|
63
|
+
<Button variant="ghost" size="sm" @click="open = !open">
|
|
64
|
+
Toggle ({{ open ? 'Open' : 'Closed' }})
|
|
65
|
+
</Button>
|
|
64
66
|
</div>
|
|
65
67
|
`,
|
|
66
68
|
}),
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
Popover as ShadcnPopover,
|
|
4
4
|
PopoverContent,
|
|
5
5
|
PopoverTrigger,
|
|
6
|
-
} from '
|
|
6
|
+
} from '../../shadcn/popover'
|
|
7
7
|
import type { PopoverProps } from './types'
|
|
8
8
|
|
|
9
9
|
const props = defineProps<PopoverProps>()
|
|
@@ -4,13 +4,29 @@ import Qrcode from './index.vue'
|
|
|
4
4
|
const meta = {
|
|
5
5
|
title: 'UI/Qrcode',
|
|
6
6
|
component: Qrcode,
|
|
7
|
+
argTypes: {
|
|
8
|
+
content: { control: 'text' },
|
|
9
|
+
},
|
|
10
|
+
args: {
|
|
11
|
+
content: 'https://example.com',
|
|
12
|
+
},
|
|
13
|
+
render: args => ({
|
|
14
|
+
components: { Qrcode },
|
|
15
|
+
setup: () => ({ args }),
|
|
16
|
+
template: `
|
|
17
|
+
<div class="size-48">
|
|
18
|
+
<Qrcode v-bind="args" />
|
|
19
|
+
</div>
|
|
20
|
+
`,
|
|
21
|
+
}),
|
|
7
22
|
} satisfies Meta<typeof Qrcode>
|
|
8
23
|
|
|
9
24
|
export default meta
|
|
10
25
|
type Story = StoryObj<typeof meta>
|
|
11
26
|
|
|
12
|
-
export const Default: Story = {
|
|
13
|
-
|
|
27
|
+
export const Default: Story = {}
|
|
28
|
+
|
|
29
|
+
export const DynamicContent: Story = {
|
|
14
30
|
render: () => ({
|
|
15
31
|
components: { Qrcode },
|
|
16
32
|
setup () {
|
|
@@ -18,39 +34,31 @@ export const Default: Story = {
|
|
|
18
34
|
return { url }
|
|
19
35
|
},
|
|
20
36
|
template: `
|
|
21
|
-
<div class="space-y-
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
class="w-full rounded border border-input px-3 py-2 text-sm"
|
|
35
|
-
placeholder="Enter URL or text"
|
|
36
|
-
/>
|
|
37
|
-
<div class="size-48">
|
|
38
|
-
<Qrcode :content="url" />
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
</section>
|
|
37
|
+
<div class="space-y-3 max-w-sm">
|
|
38
|
+
<input
|
|
39
|
+
v-model="url"
|
|
40
|
+
class="w-full rounded border border-input px-3 py-2 text-sm"
|
|
41
|
+
placeholder="Enter URL or text"
|
|
42
|
+
/>
|
|
43
|
+
<div class="size-48">
|
|
44
|
+
<Qrcode :content="url" />
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
`,
|
|
48
|
+
}),
|
|
49
|
+
}
|
|
42
50
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
</
|
|
51
|
+
export const Sizes: Story = {
|
|
52
|
+
render: () => ({
|
|
53
|
+
components: { Qrcode },
|
|
54
|
+
template: `
|
|
55
|
+
<div class="flex items-end gap-6">
|
|
56
|
+
<div class="size-24">
|
|
57
|
+
<Qrcode content="https://example.com/small" />
|
|
58
|
+
</div>
|
|
59
|
+
<div class="size-48">
|
|
60
|
+
<Qrcode content="https://example.com/medium" />
|
|
61
|
+
</div>
|
|
54
62
|
</div>
|
|
55
63
|
`,
|
|
56
64
|
}),
|