@polymarbot/nuxt-layer-shadcn-ui 0.1.10 → 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/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 -1
- 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 -1
- 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
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import type { AvatarShape, AvatarSize } from './types'
|
|
2
3
|
import Avatar from './index.vue'
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const sizes: AvatarSize[] = [ 'small', 'normal', 'large', 'xlarge' ]
|
|
8
|
-
const shapes: AvatarShape[] = [ 'circle', 'square' ]
|
|
5
|
+
const sizes = [ 'small', 'normal', 'large', 'xlarge' ] as const satisfies readonly AvatarSize[]
|
|
6
|
+
const shapes = [ 'circle', 'square' ] as const satisfies readonly AvatarShape[]
|
|
9
7
|
|
|
10
8
|
const meta = {
|
|
11
9
|
title: 'UI/Avatar',
|
|
@@ -20,64 +18,71 @@ const meta = {
|
|
|
20
18
|
args: {
|
|
21
19
|
size: 'normal',
|
|
22
20
|
shape: 'circle',
|
|
21
|
+
image: '',
|
|
23
22
|
label: 'AB',
|
|
23
|
+
fallbackLabel: '',
|
|
24
24
|
},
|
|
25
|
+
render: args => ({
|
|
26
|
+
components: { Avatar },
|
|
27
|
+
setup: () => ({ args }),
|
|
28
|
+
template: '<Avatar v-bind="args" />',
|
|
29
|
+
}),
|
|
25
30
|
} satisfies Meta<typeof Avatar>
|
|
26
31
|
|
|
27
32
|
export default meta
|
|
28
33
|
type Story = StoryObj<typeof meta>
|
|
29
34
|
|
|
30
|
-
export const Default: Story = {
|
|
31
|
-
|
|
35
|
+
export const Default: Story = {}
|
|
36
|
+
|
|
37
|
+
export const Sizes: Story = {
|
|
38
|
+
render: () => ({
|
|
32
39
|
components: { Avatar },
|
|
33
|
-
setup: () => ({
|
|
40
|
+
setup: () => ({ sizes }),
|
|
34
41
|
template: `
|
|
35
|
-
<div class="
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<h3 class="mb-4 text-lg font-medium">Sizes</h3>
|
|
45
|
-
<div class="flex items-end gap-4">
|
|
46
|
-
<div v-for="s in sizes" :key="s" class="flex flex-col items-center gap-2">
|
|
47
|
-
<Avatar :size="s" label="AB" />
|
|
48
|
-
<span class="text-xs text-muted-foreground">{{ s }}</span>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
</section>
|
|
42
|
+
<div class="flex items-end gap-4">
|
|
43
|
+
<div v-for="s in sizes" :key="s" class="flex flex-col items-center gap-2">
|
|
44
|
+
<Avatar :size="s" label="AB" />
|
|
45
|
+
<span class="text-xs text-muted-foreground">{{ s }}</span>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
`,
|
|
49
|
+
}),
|
|
50
|
+
}
|
|
52
51
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
</
|
|
62
|
-
</
|
|
52
|
+
export const Shapes: Story = {
|
|
53
|
+
render: () => ({
|
|
54
|
+
components: { Avatar },
|
|
55
|
+
setup: () => ({ shapes }),
|
|
56
|
+
template: `
|
|
57
|
+
<div class="flex items-center gap-4">
|
|
58
|
+
<div v-for="sh in shapes" :key="sh" class="flex flex-col items-center gap-2">
|
|
59
|
+
<Avatar :shape="sh" label="AB" size="large" />
|
|
60
|
+
<span class="text-xs text-muted-foreground">{{ sh }}</span>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
`,
|
|
64
|
+
}),
|
|
65
|
+
}
|
|
63
66
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
export const WithImage: Story = {
|
|
68
|
+
render: () => ({
|
|
69
|
+
components: { Avatar },
|
|
70
|
+
template: `
|
|
71
|
+
<div class="flex items-center gap-4">
|
|
72
|
+
<Avatar image="https://i.pravatar.cc/150?u=1" size="large" />
|
|
73
|
+
<Avatar image="https://i.pravatar.cc/150?u=2" size="large" shape="square" />
|
|
74
|
+
</div>
|
|
75
|
+
`,
|
|
76
|
+
}),
|
|
77
|
+
}
|
|
72
78
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
</section>
|
|
79
|
+
export const FallbackLabel: Story = {
|
|
80
|
+
render: () => ({
|
|
81
|
+
components: { Avatar },
|
|
82
|
+
template: `
|
|
83
|
+
<div class="flex items-center gap-4">
|
|
84
|
+
<Avatar label="John Doe" fallback-label="JD" />
|
|
85
|
+
<Avatar fallback-label="??" />
|
|
81
86
|
</div>
|
|
82
87
|
`,
|
|
83
88
|
}),
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
Avatar as ShadcnAvatar,
|
|
4
4
|
AvatarFallback,
|
|
5
5
|
AvatarImage,
|
|
6
|
-
} from '
|
|
6
|
+
} from '../../shadcn/avatar'
|
|
7
7
|
import type { AvatarProps } from './types'
|
|
8
8
|
|
|
9
9
|
const props = withDefaults(defineProps<AvatarProps>(), {
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
export type AvatarSize = 'small' | 'normal' | 'large' | 'xlarge'
|
|
2
|
+
export type AvatarShape = 'circle' | 'square'
|
|
3
|
+
|
|
1
4
|
export interface AvatarProps {
|
|
2
5
|
image?: string
|
|
3
6
|
label?: string
|
|
4
7
|
fallbackLabel?: string
|
|
5
|
-
size?:
|
|
6
|
-
shape?:
|
|
8
|
+
size?: AvatarSize
|
|
9
|
+
shape?: AvatarShape
|
|
7
10
|
class?: ClassValue
|
|
8
11
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import type { BadgeVariant } from './types'
|
|
2
3
|
import Icon from '../Icon/index.vue'
|
|
3
4
|
import Badge from './index.vue'
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const variants: BadgeVariant[] = [ 'default', 'secondary', 'outline', 'destructive' ]
|
|
6
|
+
const variants = [ 'default', 'secondary', 'outline', 'destructive' ] as const satisfies readonly BadgeVariant[]
|
|
8
7
|
|
|
9
8
|
const meta = {
|
|
10
9
|
title: 'UI/Badge',
|
|
@@ -15,52 +14,53 @@ const meta = {
|
|
|
15
14
|
args: {
|
|
16
15
|
variant: 'default',
|
|
17
16
|
},
|
|
17
|
+
render: args => ({
|
|
18
|
+
components: { Badge },
|
|
19
|
+
setup: () => ({ args }),
|
|
20
|
+
template: '<Badge v-bind="args">Badge</Badge>',
|
|
21
|
+
}),
|
|
18
22
|
} satisfies Meta<typeof Badge>
|
|
19
23
|
|
|
20
24
|
export default meta
|
|
21
25
|
type Story = StoryObj<typeof meta>
|
|
22
26
|
|
|
23
|
-
export const Default: Story = {
|
|
24
|
-
render: args => ({
|
|
25
|
-
components: { Badge, Icon },
|
|
26
|
-
setup: () => ({ args, variants }),
|
|
27
|
-
template: `
|
|
28
|
-
<div class="space-y-10">
|
|
29
|
-
<!-- Controlled -->
|
|
30
|
-
<section>
|
|
31
|
-
<h3 class="mb-4 text-lg font-medium">Controlled</h3>
|
|
32
|
-
<Badge v-bind="args">Badge</Badge>
|
|
33
|
-
</section>
|
|
27
|
+
export const Default: Story = {}
|
|
34
28
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
</
|
|
29
|
+
export const Variants: Story = {
|
|
30
|
+
render: () => ({
|
|
31
|
+
components: { Badge },
|
|
32
|
+
setup: () => ({ variants }),
|
|
33
|
+
template: `
|
|
34
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
35
|
+
<Badge v-for="v in variants" :key="v" :variant="v">{{ v }}</Badge>
|
|
36
|
+
</div>
|
|
37
|
+
`,
|
|
38
|
+
}),
|
|
39
|
+
}
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
export const Numeric: Story = {
|
|
42
|
+
render: () => ({
|
|
43
|
+
components: { Badge },
|
|
44
|
+
template: `
|
|
45
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
46
|
+
<Badge>1</Badge>
|
|
47
|
+
<Badge variant="secondary">42</Badge>
|
|
48
|
+
<Badge variant="destructive">99+</Badge>
|
|
49
|
+
<Badge variant="outline">0</Badge>
|
|
50
|
+
</div>
|
|
51
|
+
`,
|
|
52
|
+
}),
|
|
53
|
+
}
|
|
53
54
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
</section>
|
|
55
|
+
export const WithIcons: Story = {
|
|
56
|
+
render: () => ({
|
|
57
|
+
components: { Badge, Icon },
|
|
58
|
+
template: `
|
|
59
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
60
|
+
<Badge><Icon name="check" /> Approved</Badge>
|
|
61
|
+
<Badge variant="secondary"><Icon name="clock" /> Pending</Badge>
|
|
62
|
+
<Badge variant="destructive"><Icon name="x" /> Rejected</Badge>
|
|
63
|
+
<Badge variant="outline"><Icon name="star" /> Featured</Badge>
|
|
64
64
|
</div>
|
|
65
65
|
`,
|
|
66
66
|
}),
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import type { BadgeVariants } from '
|
|
1
|
+
import type { BadgeVariants } from '../../shadcn/badge'
|
|
2
|
+
|
|
3
|
+
export type BadgeVariant = NonNullable<BadgeVariants['variant']>
|
|
2
4
|
|
|
3
5
|
export interface BadgeProps extends /* @vue-ignore */ BadgeVariants {}
|
|
@@ -1,52 +1,63 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import type { BreadcrumbItem } from './types'
|
|
2
3
|
import Breadcrumb from './index.vue'
|
|
3
4
|
|
|
5
|
+
const home: BreadcrumbItem = { label: 'Home', icon: 'house', href: '/' }
|
|
6
|
+
|
|
7
|
+
const basicItems: BreadcrumbItem[] = [
|
|
8
|
+
{ label: 'Products', href: '/products' },
|
|
9
|
+
{ label: 'Electronics', href: '/products/electronics' },
|
|
10
|
+
{ label: 'Laptops' },
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
const withIconItems: BreadcrumbItem[] = [
|
|
14
|
+
{ label: 'Settings', icon: 'settings', href: '/settings' },
|
|
15
|
+
{ label: 'Profile' },
|
|
16
|
+
]
|
|
17
|
+
|
|
4
18
|
const meta = {
|
|
5
19
|
title: 'UI/Breadcrumb',
|
|
6
20
|
component: Breadcrumb,
|
|
21
|
+
argTypes: {
|
|
22
|
+
model: { control: 'object' },
|
|
23
|
+
home: { control: 'object' },
|
|
24
|
+
},
|
|
25
|
+
args: {
|
|
26
|
+
model: basicItems,
|
|
27
|
+
home,
|
|
28
|
+
},
|
|
29
|
+
render: args => ({
|
|
30
|
+
components: { Breadcrumb },
|
|
31
|
+
setup: () => ({ args }),
|
|
32
|
+
template: '<Breadcrumb v-bind="args" />',
|
|
33
|
+
}),
|
|
7
34
|
} satisfies Meta<typeof Breadcrumb>
|
|
8
35
|
|
|
9
36
|
export default meta
|
|
10
37
|
type Story = StoryObj<typeof meta>
|
|
11
38
|
|
|
12
|
-
export const Default: Story = {
|
|
39
|
+
export const Default: Story = {}
|
|
40
|
+
|
|
41
|
+
export const WithHome: Story = {
|
|
42
|
+
render: () => ({
|
|
43
|
+
components: { Breadcrumb },
|
|
44
|
+
setup: () => ({ home, basicItems }),
|
|
45
|
+
template: '<Breadcrumb :home="home" :model="basicItems" />',
|
|
46
|
+
}),
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const WithIcons: Story = {
|
|
50
|
+
render: () => ({
|
|
51
|
+
components: { Breadcrumb },
|
|
52
|
+
setup: () => ({ home, withIconItems }),
|
|
53
|
+
template: '<Breadcrumb :home="home" :model="withIconItems" />',
|
|
54
|
+
}),
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const SingleItem: Story = {
|
|
13
58
|
render: () => ({
|
|
14
59
|
components: { Breadcrumb },
|
|
15
|
-
setup () {
|
|
16
|
-
|
|
17
|
-
const basicItems = [
|
|
18
|
-
{ label: 'Products', href: '/products' },
|
|
19
|
-
{ label: 'Electronics', href: '/products/electronics' },
|
|
20
|
-
{ label: 'Laptops' },
|
|
21
|
-
]
|
|
22
|
-
const withIcons = [
|
|
23
|
-
{ label: 'Settings', icon: 'settings', href: '/settings' },
|
|
24
|
-
{ label: 'Profile' },
|
|
25
|
-
]
|
|
26
|
-
return { home, basicItems, withIcons }
|
|
27
|
-
},
|
|
28
|
-
template: `
|
|
29
|
-
<div class="space-y-10">
|
|
30
|
-
<section>
|
|
31
|
-
<h3 class="mb-4 text-lg font-medium">Basic</h3>
|
|
32
|
-
<Breadcrumb :model="basicItems" />
|
|
33
|
-
</section>
|
|
34
|
-
|
|
35
|
-
<section>
|
|
36
|
-
<h3 class="mb-4 text-lg font-medium">With Home</h3>
|
|
37
|
-
<Breadcrumb :home="home" :model="basicItems" />
|
|
38
|
-
</section>
|
|
39
|
-
|
|
40
|
-
<section>
|
|
41
|
-
<h3 class="mb-4 text-lg font-medium">With Icons</h3>
|
|
42
|
-
<Breadcrumb :home="home" :model="withIcons" />
|
|
43
|
-
</section>
|
|
44
|
-
|
|
45
|
-
<section>
|
|
46
|
-
<h3 class="mb-4 text-lg font-medium">Single Item</h3>
|
|
47
|
-
<Breadcrumb :home="home" />
|
|
48
|
-
</section>
|
|
49
|
-
</div>
|
|
50
|
-
`,
|
|
60
|
+
setup: () => ({ home }),
|
|
61
|
+
template: '<Breadcrumb :home="home" />',
|
|
51
62
|
}),
|
|
52
63
|
}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
BreadcrumbList,
|
|
7
7
|
BreadcrumbPage,
|
|
8
8
|
BreadcrumbSeparator,
|
|
9
|
-
} from '
|
|
9
|
+
} from '../../shadcn/breadcrumb'
|
|
10
10
|
import type { BreadcrumbItem as BreadcrumbItemType, BreadcrumbProps } from './types'
|
|
11
11
|
|
|
12
12
|
const props = defineProps<BreadcrumbProps>()
|
|
@@ -1,32 +1,25 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import type { ButtonSize, ButtonVariant } from './types'
|
|
2
3
|
import Icon from '../Icon/index.vue'
|
|
3
4
|
import Button from './index.vue'
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
= | 'default'
|
|
7
|
-
| 'destructive'
|
|
8
|
-
| 'outline'
|
|
9
|
-
| 'secondary'
|
|
10
|
-
| 'ghost'
|
|
11
|
-
| 'link'
|
|
12
|
-
type ButtonSize = 'default' | 'sm' | 'lg' | 'icon' | 'icon-sm' | 'icon-lg'
|
|
13
|
-
|
|
14
|
-
const variants: ButtonVariant[] = [
|
|
6
|
+
const variants = [
|
|
15
7
|
'default',
|
|
16
8
|
'destructive',
|
|
17
9
|
'outline',
|
|
18
10
|
'secondary',
|
|
19
11
|
'ghost',
|
|
20
12
|
'link',
|
|
21
|
-
]
|
|
22
|
-
|
|
13
|
+
] as const satisfies readonly ButtonVariant[]
|
|
14
|
+
|
|
15
|
+
const sizes = [
|
|
23
16
|
'sm',
|
|
24
17
|
'default',
|
|
25
18
|
'lg',
|
|
26
19
|
'icon-sm',
|
|
27
20
|
'icon',
|
|
28
21
|
'icon-lg',
|
|
29
|
-
]
|
|
22
|
+
] as const satisfies readonly ButtonSize[]
|
|
30
23
|
|
|
31
24
|
const meta = {
|
|
32
25
|
title: 'UI/Button',
|
|
@@ -49,96 +42,107 @@ const meta = {
|
|
|
49
42
|
loading: false,
|
|
50
43
|
disabled: false,
|
|
51
44
|
},
|
|
45
|
+
render: args => ({
|
|
46
|
+
components: { Button },
|
|
47
|
+
setup: () => ({ args }),
|
|
48
|
+
template: '<Button v-bind="args">Button</Button>',
|
|
49
|
+
}),
|
|
52
50
|
} satisfies Meta<typeof Button>
|
|
53
51
|
|
|
54
52
|
export default meta
|
|
55
53
|
type Story = StoryObj<typeof meta>
|
|
56
54
|
|
|
57
|
-
export const Default: Story = {
|
|
58
|
-
args: {
|
|
59
|
-
loading: false,
|
|
60
|
-
},
|
|
55
|
+
export const Default: Story = {}
|
|
61
56
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
export const Variants: Story = {
|
|
58
|
+
render: () => ({
|
|
59
|
+
components: { Button },
|
|
60
|
+
setup: () => ({ variants }),
|
|
65
61
|
template: `
|
|
66
|
-
<div class="
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
<!-- Variants -->
|
|
74
|
-
<section>
|
|
75
|
-
<h3 class="mb-4 text-lg font-medium">Variants</h3>
|
|
76
|
-
<div class="flex flex-wrap items-center gap-3">
|
|
77
|
-
<Button v-for="v in variants" :key="v" :variant="v">{{ v }}</Button>
|
|
78
|
-
</div>
|
|
79
|
-
</section>
|
|
62
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
63
|
+
<Button v-for="v in variants" :key="v" :variant="v">{{ v }}</Button>
|
|
64
|
+
</div>
|
|
65
|
+
`,
|
|
66
|
+
}),
|
|
67
|
+
}
|
|
80
68
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
</
|
|
90
|
-
</
|
|
69
|
+
export const Sizes: Story = {
|
|
70
|
+
render: () => ({
|
|
71
|
+
components: { Button, Icon },
|
|
72
|
+
setup: () => ({ sizes }),
|
|
73
|
+
template: `
|
|
74
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
75
|
+
<Button v-for="s in sizes" :key="s" :size="s">
|
|
76
|
+
<Icon v-if="s.startsWith('icon')" name="plus" />
|
|
77
|
+
<template v-else>{{ s }}</template>
|
|
78
|
+
</Button>
|
|
79
|
+
</div>
|
|
80
|
+
`,
|
|
81
|
+
}),
|
|
82
|
+
}
|
|
91
83
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
84
|
+
export const WithIcons: Story = {
|
|
85
|
+
render: () => ({
|
|
86
|
+
components: { Button },
|
|
87
|
+
template: `
|
|
88
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
89
|
+
<Button icon="mail">Login with Email</Button>
|
|
90
|
+
<Button icon="chevron-right" iconPosition="end" variant="secondary">Next</Button>
|
|
91
|
+
<Button icon="trash-2" variant="destructive">Delete</Button>
|
|
92
|
+
<Button icon="plus" size="icon" variant="outline" />
|
|
93
|
+
</div>
|
|
94
|
+
`,
|
|
95
|
+
}),
|
|
96
|
+
}
|
|
102
97
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
98
|
+
export const Loading: Story = {
|
|
99
|
+
render: () => ({
|
|
100
|
+
components: { Button },
|
|
101
|
+
template: `
|
|
102
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
103
|
+
<Button loading icon="mail">Login with Email</Button>
|
|
104
|
+
<Button loading icon="chevron-right" iconPosition="end" variant="secondary">Next</Button>
|
|
105
|
+
<Button loading icon="trash-2" variant="destructive">Delete</Button>
|
|
106
|
+
<Button loading icon="plus" size="icon" variant="outline" />
|
|
107
|
+
</div>
|
|
108
|
+
`,
|
|
109
|
+
}),
|
|
110
|
+
}
|
|
113
111
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
</
|
|
112
|
+
export const Disabled: Story = {
|
|
113
|
+
render: () => ({
|
|
114
|
+
components: { Button },
|
|
115
|
+
setup: () => ({ variants }),
|
|
116
|
+
template: `
|
|
117
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
118
|
+
<Button v-for="v in variants" :key="v" :variant="v" disabled>{{ v }}</Button>
|
|
119
|
+
</div>
|
|
120
|
+
`,
|
|
121
|
+
}),
|
|
122
|
+
}
|
|
121
123
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
124
|
+
export const Rounded: Story = {
|
|
125
|
+
render: () => ({
|
|
126
|
+
components: { Button },
|
|
127
|
+
template: `
|
|
128
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
129
|
+
<Button rounded>Rounded</Button>
|
|
130
|
+
<Button rounded variant="outline">Outline</Button>
|
|
131
|
+
<Button rounded variant="secondary">Secondary</Button>
|
|
132
|
+
<Button rounded size="icon" variant="outline" icon="plus" />
|
|
133
|
+
<Button rounded size="icon" variant="secondary" icon="sun" />
|
|
134
|
+
</div>
|
|
135
|
+
`,
|
|
136
|
+
}),
|
|
137
|
+
}
|
|
133
138
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
</section>
|
|
139
|
+
export const LinkButtons: Story = {
|
|
140
|
+
render: () => ({
|
|
141
|
+
components: { Button },
|
|
142
|
+
template: `
|
|
143
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
144
|
+
<Button href="/dialog" variant="outline">Internal Link</Button>
|
|
145
|
+
<Button href="https://example.com" icon="external-link" iconPosition="end">External Link</Button>
|
|
142
146
|
</div>
|
|
143
147
|
`,
|
|
144
148
|
}),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { Button as ShadcnButton } from '
|
|
2
|
+
import { Button as ShadcnButton } from '../../shadcn/button'
|
|
3
3
|
import WebLink from '@polymarbot/nuxt-layer-shadcn-ui/app/components/ui/WebLink/index.vue'
|
|
4
4
|
import type { ButtonProps } from './types'
|
|
5
5
|
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type { ButtonVariants } from '
|
|
1
|
+
import type { ButtonVariants } from '../../shadcn/button'
|
|
2
2
|
import type { RouteLocationRaw } from 'vue-router'
|
|
3
3
|
|
|
4
|
+
export type ButtonVariant = NonNullable<ButtonVariants['variant']>
|
|
5
|
+
export type ButtonSize = NonNullable<ButtonVariants['size']>
|
|
6
|
+
|
|
4
7
|
export interface ButtonProps extends /* @vue-ignore */ ButtonVariants {
|
|
5
8
|
loading?: boolean
|
|
6
9
|
disabled?: boolean
|