@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
|
@@ -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
|
|
@@ -7,12 +7,45 @@ import ButtonGroup from './index.vue'
|
|
|
7
7
|
const meta = {
|
|
8
8
|
title: 'UI/ButtonGroup',
|
|
9
9
|
component: ButtonGroup,
|
|
10
|
+
argTypes: {
|
|
11
|
+
class: { control: 'text' },
|
|
12
|
+
},
|
|
13
|
+
args: {
|
|
14
|
+
class: '',
|
|
15
|
+
},
|
|
16
|
+
render: args => ({
|
|
17
|
+
components: { ButtonGroup, Button },
|
|
18
|
+
setup: () => ({ args }),
|
|
19
|
+
template: `
|
|
20
|
+
<ButtonGroup v-bind="args">
|
|
21
|
+
<Button variant="outline">Left</Button>
|
|
22
|
+
<Button variant="outline">Center</Button>
|
|
23
|
+
<Button variant="outline">Right</Button>
|
|
24
|
+
</ButtonGroup>
|
|
25
|
+
`,
|
|
26
|
+
}),
|
|
10
27
|
} satisfies Meta<typeof ButtonGroup>
|
|
11
28
|
|
|
12
29
|
export default meta
|
|
13
30
|
type Story = StoryObj<typeof meta>
|
|
14
31
|
|
|
15
|
-
export const Default: Story = {
|
|
32
|
+
export const Default: Story = {}
|
|
33
|
+
|
|
34
|
+
export const WithIcons: Story = {
|
|
35
|
+
render: () => ({
|
|
36
|
+
components: { ButtonGroup, Button, Icon },
|
|
37
|
+
template: `
|
|
38
|
+
<ButtonGroup>
|
|
39
|
+
<Button variant="outline" size="icon"><Icon name="bold" /></Button>
|
|
40
|
+
<Button variant="outline" size="icon"><Icon name="italic" /></Button>
|
|
41
|
+
<Button variant="outline" size="icon"><Icon name="underline" /></Button>
|
|
42
|
+
<Button variant="outline" size="icon"><Icon name="strikethrough" /></Button>
|
|
43
|
+
</ButtonGroup>
|
|
44
|
+
`,
|
|
45
|
+
}),
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const InputWithButton: Story = {
|
|
16
49
|
render: () => ({
|
|
17
50
|
components: { ButtonGroup, Button, Input, Icon },
|
|
18
51
|
setup () {
|
|
@@ -20,56 +53,35 @@ export const Default: Story = {
|
|
|
20
53
|
return { search }
|
|
21
54
|
},
|
|
22
55
|
template: `
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<Button variant="outline">Right</Button>
|
|
31
|
-
</ButtonGroup>
|
|
32
|
-
</section>
|
|
33
|
-
|
|
34
|
-
<!-- With Icons -->
|
|
35
|
-
<section>
|
|
36
|
-
<h3 class="mb-4 text-lg font-medium">With Icons</h3>
|
|
37
|
-
<ButtonGroup>
|
|
38
|
-
<Button variant="outline" size="icon"><Icon name="bold" /></Button>
|
|
39
|
-
<Button variant="outline" size="icon"><Icon name="italic" /></Button>
|
|
40
|
-
<Button variant="outline" size="icon"><Icon name="underline" /></Button>
|
|
41
|
-
<Button variant="outline" size="icon"><Icon name="strikethrough" /></Button>
|
|
42
|
-
</ButtonGroup>
|
|
43
|
-
</section>
|
|
44
|
-
|
|
45
|
-
<!-- Input + Button -->
|
|
46
|
-
<section>
|
|
47
|
-
<h3 class="mb-4 text-lg font-medium">Input + Button</h3>
|
|
48
|
-
<ButtonGroup>
|
|
49
|
-
<Input v-model="search" placeholder="Search..." />
|
|
50
|
-
<Button variant="outline"><Icon name="search" /></Button>
|
|
51
|
-
</ButtonGroup>
|
|
52
|
-
</section>
|
|
56
|
+
<ButtonGroup>
|
|
57
|
+
<Input v-model="search" placeholder="Search..." />
|
|
58
|
+
<Button variant="outline"><Icon name="search" /></Button>
|
|
59
|
+
</ButtonGroup>
|
|
60
|
+
`,
|
|
61
|
+
}),
|
|
62
|
+
}
|
|
53
63
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
export const ButtonWithInputWithButton: Story = {
|
|
65
|
+
render: () => ({
|
|
66
|
+
components: { ButtonGroup, Button, Input, Icon },
|
|
67
|
+
template: `
|
|
68
|
+
<ButtonGroup>
|
|
69
|
+
<Button variant="outline" size="icon"><Icon name="minus" /></Button>
|
|
70
|
+
<Input class="w-20 text-center" model-value="5" />
|
|
71
|
+
<Button variant="outline" size="icon"><Icon name="plus" /></Button>
|
|
72
|
+
</ButtonGroup>
|
|
73
|
+
`,
|
|
74
|
+
}),
|
|
75
|
+
}
|
|
63
76
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
</div>
|
|
77
|
+
export const MixedVariants: Story = {
|
|
78
|
+
render: () => ({
|
|
79
|
+
components: { ButtonGroup, Button },
|
|
80
|
+
template: `
|
|
81
|
+
<ButtonGroup>
|
|
82
|
+
<Button variant="outline">Save</Button>
|
|
83
|
+
<Button>Submit</Button>
|
|
84
|
+
</ButtonGroup>
|
|
73
85
|
`,
|
|
74
86
|
}),
|
|
75
87
|
}
|
|
@@ -5,61 +5,69 @@ import Card from './index.vue'
|
|
|
5
5
|
const meta = {
|
|
6
6
|
title: 'UI/Card',
|
|
7
7
|
component: Card,
|
|
8
|
+
argTypes: {
|
|
9
|
+
title: { control: 'text' },
|
|
10
|
+
},
|
|
11
|
+
args: {
|
|
12
|
+
title: 'Card Title',
|
|
13
|
+
},
|
|
14
|
+
render: args => ({
|
|
15
|
+
components: { Card },
|
|
16
|
+
setup: () => ({ args }),
|
|
17
|
+
template: `
|
|
18
|
+
<Card v-bind="args" class="max-w-md">
|
|
19
|
+
<p>This card has a title prop set.</p>
|
|
20
|
+
</Card>
|
|
21
|
+
`,
|
|
22
|
+
}),
|
|
8
23
|
} satisfies Meta<typeof Card>
|
|
9
24
|
|
|
10
25
|
export default meta
|
|
11
26
|
type Story = StoryObj<typeof meta>
|
|
12
27
|
|
|
13
|
-
export const Default: Story = {
|
|
14
|
-
render: args => ({
|
|
15
|
-
components: { Card, Button },
|
|
16
|
-
setup: () => ({ args }),
|
|
17
|
-
template: `
|
|
18
|
-
<div class="space-y-10 max-w-md">
|
|
19
|
-
<!-- Basic Card -->
|
|
20
|
-
<section>
|
|
21
|
-
<h3 class="mb-4 text-lg font-medium">Basic Card</h3>
|
|
22
|
-
<Card>
|
|
23
|
-
<p>This is a basic card with default content only.</p>
|
|
24
|
-
</Card>
|
|
25
|
-
</section>
|
|
28
|
+
export const Default: Story = {}
|
|
26
29
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
export const WithTitle: Story = {
|
|
31
|
+
render: () => ({
|
|
32
|
+
components: { Card },
|
|
33
|
+
template: `
|
|
34
|
+
<Card title="Card Title" class="max-w-md">
|
|
35
|
+
<p>This card has a title prop set.</p>
|
|
36
|
+
</Card>
|
|
37
|
+
`,
|
|
38
|
+
}),
|
|
39
|
+
}
|
|
34
40
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
export const CustomHeader: Story = {
|
|
42
|
+
render: () => ({
|
|
43
|
+
components: { Card, Button },
|
|
44
|
+
template: `
|
|
45
|
+
<Card class="max-w-md">
|
|
46
|
+
<template #header>
|
|
47
|
+
<div class="flex items-center justify-between">
|
|
48
|
+
<span class="text-lg font-semibold">Custom Header</span>
|
|
49
|
+
<Button variant="ghost" size="sm">Action</Button>
|
|
50
|
+
</div>
|
|
51
|
+
</template>
|
|
52
|
+
<p>This card uses the header slot for a custom layout.</p>
|
|
53
|
+
</Card>
|
|
54
|
+
`,
|
|
55
|
+
}),
|
|
56
|
+
}
|
|
48
57
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
</div>
|
|
58
|
+
export const WithFooter: Story = {
|
|
59
|
+
render: () => ({
|
|
60
|
+
components: { Card, Button },
|
|
61
|
+
template: `
|
|
62
|
+
<Card title="Settings" class="max-w-md">
|
|
63
|
+
<p>Update your account settings here.</p>
|
|
64
|
+
<template #footer>
|
|
65
|
+
<div class="w-full flex justify-end gap-2">
|
|
66
|
+
<Button variant="outline">Cancel</Button>
|
|
67
|
+
<Button>Save</Button>
|
|
68
|
+
</div>
|
|
69
|
+
</template>
|
|
70
|
+
</Card>
|
|
63
71
|
`,
|
|
64
72
|
}),
|
|
65
73
|
}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
CardFooter as ShadcnCardFooter,
|
|
6
6
|
CardHeader as ShadcnCardHeader,
|
|
7
7
|
CardTitle as ShadcnCardTitle,
|
|
8
|
-
} from '
|
|
8
|
+
} from '../../shadcn/card'
|
|
9
9
|
import type { CardProps } from './types'
|
|
10
10
|
|
|
11
11
|
defineProps<CardProps>()
|
|
@@ -4,64 +4,87 @@ import Checkbox from './index.vue'
|
|
|
4
4
|
const meta = {
|
|
5
5
|
title: 'UI/Checkbox',
|
|
6
6
|
component: Checkbox,
|
|
7
|
+
argTypes: {
|
|
8
|
+
modelValue: { control: 'select', options: [ true, false, 'indeterminate' ]},
|
|
9
|
+
defaultValue: { control: 'select', options: [ true, false, 'indeterminate' ]},
|
|
10
|
+
disabled: { control: 'boolean' },
|
|
11
|
+
required: { control: 'boolean' },
|
|
12
|
+
name: { control: 'text' },
|
|
13
|
+
value: { control: 'text' },
|
|
14
|
+
},
|
|
15
|
+
args: {
|
|
16
|
+
modelValue: false,
|
|
17
|
+
defaultValue: false,
|
|
18
|
+
disabled: false,
|
|
19
|
+
required: false,
|
|
20
|
+
name: '',
|
|
21
|
+
value: '',
|
|
22
|
+
},
|
|
23
|
+
render: args => ({
|
|
24
|
+
components: { Checkbox },
|
|
25
|
+
setup: () => ({ args }),
|
|
26
|
+
template: `
|
|
27
|
+
<label class="flex items-center gap-2 cursor-pointer">
|
|
28
|
+
<Checkbox v-bind="args" />
|
|
29
|
+
<span class="text-sm">Accept terms and conditions</span>
|
|
30
|
+
</label>
|
|
31
|
+
`,
|
|
32
|
+
}),
|
|
7
33
|
} satisfies Meta<typeof Checkbox>
|
|
8
34
|
|
|
9
35
|
export default meta
|
|
10
36
|
type Story = StoryObj<typeof meta>
|
|
11
37
|
|
|
12
|
-
export const Default: Story = {
|
|
38
|
+
export const Default: Story = {}
|
|
39
|
+
|
|
40
|
+
export const Checked: Story = {
|
|
13
41
|
render: () => ({
|
|
14
42
|
components: { Checkbox },
|
|
15
43
|
setup () {
|
|
16
|
-
const checked = ref(
|
|
17
|
-
|
|
18
|
-
return { checked, checkedOn }
|
|
44
|
+
const checked = ref(true)
|
|
45
|
+
return { checked }
|
|
19
46
|
},
|
|
20
47
|
template: `
|
|
21
|
-
<div
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
<section>
|
|
32
|
-
<h3 class="mb-4 text-lg font-medium">Checked</h3>
|
|
33
|
-
<label class="flex items-center gap-2 cursor-pointer">
|
|
34
|
-
<Checkbox v-model="checkedOn" />
|
|
35
|
-
<span class="text-sm">Enable notifications</span>
|
|
36
|
-
</label>
|
|
37
|
-
<div class="mt-2 text-sm text-muted-foreground">Value: {{ checkedOn }}</div>
|
|
38
|
-
</section>
|
|
48
|
+
<div>
|
|
49
|
+
<label class="flex items-center gap-2 cursor-pointer">
|
|
50
|
+
<Checkbox v-model="checked" />
|
|
51
|
+
<span class="text-sm">Enable notifications</span>
|
|
52
|
+
</label>
|
|
53
|
+
<div class="mt-2 text-sm text-muted-foreground">Value: {{ checked }}</div>
|
|
54
|
+
</div>
|
|
55
|
+
`,
|
|
56
|
+
}),
|
|
57
|
+
}
|
|
39
58
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
</
|
|
59
|
+
export const Indeterminate: Story = {
|
|
60
|
+
render: () => ({
|
|
61
|
+
components: { Checkbox },
|
|
62
|
+
template: `
|
|
63
|
+
<label class="flex items-center gap-2 cursor-pointer">
|
|
64
|
+
<Checkbox model-value="indeterminate" />
|
|
65
|
+
<span class="text-sm">Select all items</span>
|
|
66
|
+
</label>
|
|
67
|
+
`,
|
|
68
|
+
}),
|
|
69
|
+
}
|
|
47
70
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
</
|
|
64
|
-
</
|
|
71
|
+
export const Disabled: Story = {
|
|
72
|
+
render: () => ({
|
|
73
|
+
components: { Checkbox },
|
|
74
|
+
template: `
|
|
75
|
+
<div class="flex flex-col gap-3">
|
|
76
|
+
<label class="flex items-center gap-2 cursor-not-allowed opacity-50">
|
|
77
|
+
<Checkbox :model-value="false" disabled />
|
|
78
|
+
<span class="text-sm">Unchecked disabled</span>
|
|
79
|
+
</label>
|
|
80
|
+
<label class="flex items-center gap-2 cursor-not-allowed opacity-50">
|
|
81
|
+
<Checkbox :model-value="true" disabled />
|
|
82
|
+
<span class="text-sm">Checked disabled</span>
|
|
83
|
+
</label>
|
|
84
|
+
<label class="flex items-center gap-2 cursor-not-allowed opacity-50">
|
|
85
|
+
<Checkbox model-value="indeterminate" disabled />
|
|
86
|
+
<span class="text-sm">Indeterminate disabled</span>
|
|
87
|
+
</label>
|
|
65
88
|
</div>
|
|
66
89
|
`,
|
|
67
90
|
}),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { Checkbox as ShadcnCheckbox } from '
|
|
2
|
+
import { Checkbox as ShadcnCheckbox } from '../../shadcn/checkbox'
|
|
3
3
|
import type { CheckboxProps } from './types'
|
|
4
4
|
|
|
5
5
|
defineProps<CheckboxProps>()
|