@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,127 +1,181 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
2
|
import Select from './index.vue'
|
|
3
3
|
|
|
4
|
+
const frameworks = [
|
|
5
|
+
{ label: 'React', value: 'react' },
|
|
6
|
+
{ label: 'Vue', value: 'vue' },
|
|
7
|
+
{ label: 'Angular', value: 'angular' },
|
|
8
|
+
{ label: 'Svelte', value: 'svelte' },
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
const withDisabled = [
|
|
12
|
+
{ label: 'React', value: 'react' },
|
|
13
|
+
{ label: 'Vue', value: 'vue' },
|
|
14
|
+
{ label: 'Angular', value: 'angular', disabled: true },
|
|
15
|
+
{ label: 'Svelte', value: 'svelte' },
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
const manyOptions = Array.from({ length: 50 }, (_, i) => ({
|
|
19
|
+
label: `Option ${i + 1}`,
|
|
20
|
+
value: `option-${i + 1}`,
|
|
21
|
+
}))
|
|
22
|
+
|
|
23
|
+
const withGroups = [
|
|
24
|
+
{ label: 'React', value: 'react', group: 'Frontend' },
|
|
25
|
+
{ label: 'Vue', value: 'vue', group: 'Frontend' },
|
|
26
|
+
{ label: 'Angular', value: 'angular', group: 'Frontend' },
|
|
27
|
+
{ label: 'Node.js', value: 'node', group: 'Backend' },
|
|
28
|
+
{ label: 'Django', value: 'django', group: 'Backend' },
|
|
29
|
+
{ label: 'Rails', value: 'rails', group: 'Backend' },
|
|
30
|
+
]
|
|
31
|
+
|
|
4
32
|
const meta = {
|
|
5
33
|
title: 'UI/Select',
|
|
6
34
|
component: Select as any,
|
|
7
35
|
argTypes: {
|
|
36
|
+
placeholder: { control: 'text' },
|
|
8
37
|
disabled: { control: 'boolean' },
|
|
38
|
+
filter: { control: 'boolean' },
|
|
39
|
+
multiple: { control: 'boolean' },
|
|
40
|
+
searchPlaceholder: { control: 'text' },
|
|
41
|
+
emptyText: { control: 'text' },
|
|
9
42
|
},
|
|
10
43
|
args: {
|
|
44
|
+
placeholder: 'Select an option',
|
|
11
45
|
disabled: false,
|
|
46
|
+
filter: false,
|
|
47
|
+
multiple: false,
|
|
48
|
+
searchPlaceholder: '',
|
|
49
|
+
emptyText: '',
|
|
12
50
|
},
|
|
51
|
+
render: args => ({
|
|
52
|
+
components: { Select },
|
|
53
|
+
setup () {
|
|
54
|
+
const value = ref<string>()
|
|
55
|
+
return { args, value, frameworks }
|
|
56
|
+
},
|
|
57
|
+
template: `
|
|
58
|
+
<div class="max-w-sm">
|
|
59
|
+
<Select v-model="value" :options="frameworks" v-bind="args" />
|
|
60
|
+
<div class="mt-2 text-sm text-muted-foreground">Selected: {{ value ?? 'none' }}</div>
|
|
61
|
+
</div>
|
|
62
|
+
`,
|
|
63
|
+
}),
|
|
13
64
|
} satisfies Meta
|
|
14
65
|
|
|
15
66
|
export default meta
|
|
16
67
|
type Story = StoryObj<typeof meta>
|
|
17
68
|
|
|
18
|
-
export const Default: Story = {
|
|
19
|
-
|
|
69
|
+
export const Default: Story = {}
|
|
70
|
+
|
|
71
|
+
export const WithFilter: Story = {
|
|
72
|
+
render: () => ({
|
|
20
73
|
components: { Select },
|
|
21
74
|
setup () {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const multiple = ref<string[]>([])
|
|
25
|
-
const scrollable = ref<string>()
|
|
26
|
-
const grouped = ref<string>()
|
|
27
|
-
|
|
28
|
-
const frameworks = [
|
|
29
|
-
{ label: 'React', value: 'react' },
|
|
30
|
-
{ label: 'Vue', value: 'vue' },
|
|
31
|
-
{ label: 'Angular', value: 'angular' },
|
|
32
|
-
{ label: 'Svelte', value: 'svelte' },
|
|
33
|
-
]
|
|
34
|
-
|
|
35
|
-
const withDisabled = [
|
|
36
|
-
{ label: 'React', value: 'react' },
|
|
37
|
-
{ label: 'Vue', value: 'vue' },
|
|
38
|
-
{ label: 'Angular', value: 'angular', disabled: true },
|
|
39
|
-
{ label: 'Svelte', value: 'svelte' },
|
|
40
|
-
]
|
|
41
|
-
|
|
42
|
-
const manyOptions = Array.from({ length: 50 }, (_, i) => ({
|
|
43
|
-
label: `Option ${i + 1}`,
|
|
44
|
-
value: `option-${i + 1}`,
|
|
45
|
-
}))
|
|
46
|
-
|
|
47
|
-
const withGroups = [
|
|
48
|
-
{ label: 'React', value: 'react', group: 'Frontend' },
|
|
49
|
-
{ label: 'Vue', value: 'vue', group: 'Frontend' },
|
|
50
|
-
{ label: 'Angular', value: 'angular', group: 'Frontend' },
|
|
51
|
-
{ label: 'Node.js', value: 'node', group: 'Backend' },
|
|
52
|
-
{ label: 'Django', value: 'django', group: 'Backend' },
|
|
53
|
-
{ label: 'Rails', value: 'rails', group: 'Backend' },
|
|
54
|
-
]
|
|
55
|
-
|
|
56
|
-
return { args, selected, filtered, multiple, scrollable, grouped, frameworks, withDisabled, manyOptions, withGroups }
|
|
75
|
+
const value = ref<string>()
|
|
76
|
+
return { value, manyOptions }
|
|
57
77
|
},
|
|
58
78
|
template: `
|
|
59
|
-
<div class="
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
79
|
+
<div class="max-w-sm">
|
|
80
|
+
<Select
|
|
81
|
+
v-model="value"
|
|
82
|
+
:options="manyOptions"
|
|
83
|
+
placeholder="Search and select"
|
|
84
|
+
filter
|
|
85
|
+
/>
|
|
86
|
+
<div class="mt-2 text-sm text-muted-foreground">Selected: {{ value ?? 'none' }}</div>
|
|
87
|
+
</div>
|
|
88
|
+
`,
|
|
89
|
+
}),
|
|
90
|
+
}
|
|
70
91
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
92
|
+
export const Multiple: Story = {
|
|
93
|
+
render: () => ({
|
|
94
|
+
components: { Select },
|
|
95
|
+
setup () {
|
|
96
|
+
const value = ref<string[]>([])
|
|
97
|
+
return { value, frameworks }
|
|
98
|
+
},
|
|
99
|
+
template: `
|
|
100
|
+
<div class="max-w-sm">
|
|
101
|
+
<Select
|
|
102
|
+
v-model="value"
|
|
103
|
+
:options="frameworks"
|
|
104
|
+
placeholder="Select frameworks"
|
|
105
|
+
multiple
|
|
106
|
+
/>
|
|
107
|
+
<div class="mt-2 text-sm text-muted-foreground">Selected: {{ value.length > 0 ? value.join(', ') : 'none' }}</div>
|
|
108
|
+
</div>
|
|
109
|
+
`,
|
|
110
|
+
}),
|
|
111
|
+
}
|
|
82
112
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
113
|
+
export const WithDisabledOptions: Story = {
|
|
114
|
+
render: () => ({
|
|
115
|
+
components: { Select },
|
|
116
|
+
setup () {
|
|
117
|
+
return { withDisabled }
|
|
118
|
+
},
|
|
119
|
+
template: `
|
|
120
|
+
<div class="max-w-sm">
|
|
121
|
+
<Select
|
|
122
|
+
:options="withDisabled"
|
|
123
|
+
placeholder="Select a framework"
|
|
124
|
+
/>
|
|
125
|
+
</div>
|
|
126
|
+
`,
|
|
127
|
+
}),
|
|
128
|
+
}
|
|
94
129
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
130
|
+
export const Scrollable: Story = {
|
|
131
|
+
render: () => ({
|
|
132
|
+
components: { Select },
|
|
133
|
+
setup () {
|
|
134
|
+
const value = ref<string>()
|
|
135
|
+
return { value, manyOptions }
|
|
136
|
+
},
|
|
137
|
+
template: `
|
|
138
|
+
<div class="max-w-sm">
|
|
139
|
+
<Select
|
|
140
|
+
v-model="value"
|
|
141
|
+
:options="manyOptions"
|
|
142
|
+
placeholder="Select an option"
|
|
143
|
+
/>
|
|
144
|
+
<div class="mt-2 text-sm text-muted-foreground">Selected: {{ value ?? 'none' }}</div>
|
|
145
|
+
</div>
|
|
146
|
+
`,
|
|
147
|
+
}),
|
|
148
|
+
}
|
|
103
149
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
150
|
+
export const Grouped: Story = {
|
|
151
|
+
render: () => ({
|
|
152
|
+
components: { Select },
|
|
153
|
+
setup () {
|
|
154
|
+
const value = ref<string>()
|
|
155
|
+
return { value, withGroups }
|
|
156
|
+
},
|
|
157
|
+
template: `
|
|
158
|
+
<div class="max-w-sm">
|
|
159
|
+
<Select
|
|
160
|
+
v-model="value"
|
|
161
|
+
:options="withGroups"
|
|
162
|
+
placeholder="Select a framework"
|
|
163
|
+
/>
|
|
164
|
+
<div class="mt-2 text-sm text-muted-foreground">Selected: {{ value ?? 'none' }}</div>
|
|
165
|
+
</div>
|
|
166
|
+
`,
|
|
167
|
+
}),
|
|
168
|
+
}
|
|
114
169
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
</section>
|
|
170
|
+
export const Disabled: Story = {
|
|
171
|
+
render: () => ({
|
|
172
|
+
components: { Select },
|
|
173
|
+
setup () {
|
|
174
|
+
return { frameworks }
|
|
175
|
+
},
|
|
176
|
+
template: `
|
|
177
|
+
<div class="max-w-sm">
|
|
178
|
+
<Select :options="frameworks" placeholder="Disabled select" disabled />
|
|
125
179
|
</div>
|
|
126
180
|
`,
|
|
127
181
|
}),
|
|
@@ -7,17 +7,17 @@ import {
|
|
|
7
7
|
CommandItem,
|
|
8
8
|
CommandList,
|
|
9
9
|
CommandSeparator,
|
|
10
|
-
} from '
|
|
10
|
+
} from '../../shadcn/command'
|
|
11
11
|
import {
|
|
12
12
|
InputGroup,
|
|
13
13
|
InputGroupAddon,
|
|
14
14
|
InputGroupButton,
|
|
15
|
-
} from '
|
|
15
|
+
} from '../../shadcn/input-group'
|
|
16
16
|
import {
|
|
17
17
|
Popover as ShadcnPopover,
|
|
18
18
|
PopoverContent,
|
|
19
19
|
PopoverTrigger,
|
|
20
|
-
} from '
|
|
20
|
+
} from '../../shadcn/popover'
|
|
21
21
|
import type { SelectOption, SelectProps } from './types'
|
|
22
22
|
|
|
23
23
|
type Option = SelectOption<TValue, TMeta>
|
|
@@ -12,44 +12,41 @@ const meta = {
|
|
|
12
12
|
width: '200px',
|
|
13
13
|
height: '20px',
|
|
14
14
|
},
|
|
15
|
+
render: args => ({
|
|
16
|
+
components: { Skeleton },
|
|
17
|
+
setup: () => ({ args }),
|
|
18
|
+
template: '<Skeleton v-bind="args" />',
|
|
19
|
+
}),
|
|
15
20
|
} satisfies Meta<typeof Skeleton>
|
|
16
21
|
|
|
17
22
|
export default meta
|
|
18
23
|
type Story = StoryObj<typeof meta>
|
|
19
24
|
|
|
20
|
-
export const Default: Story = {
|
|
21
|
-
|
|
25
|
+
export const Default: Story = {}
|
|
26
|
+
|
|
27
|
+
export const VariousSizes: Story = {
|
|
28
|
+
render: () => ({
|
|
22
29
|
components: { Skeleton },
|
|
23
|
-
setup: () => ({ args }),
|
|
24
30
|
template: `
|
|
25
|
-
<div class="space-y-
|
|
26
|
-
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<section>
|
|
34
|
-
<h3 class="mb-4 text-lg font-medium">Various Sizes</h3>
|
|
35
|
-
<div class="space-y-3">
|
|
36
|
-
<Skeleton width="100%" height="12px" />
|
|
37
|
-
<Skeleton width="80%" height="12px" />
|
|
38
|
-
<Skeleton width="60%" height="12px" />
|
|
39
|
-
</div>
|
|
40
|
-
</section>
|
|
31
|
+
<div class="space-y-3">
|
|
32
|
+
<Skeleton width="100%" height="12px" />
|
|
33
|
+
<Skeleton width="80%" height="12px" />
|
|
34
|
+
<Skeleton width="60%" height="12px" />
|
|
35
|
+
</div>
|
|
36
|
+
`,
|
|
37
|
+
}),
|
|
38
|
+
}
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
</section>
|
|
40
|
+
export const CardSkeleton: Story = {
|
|
41
|
+
render: () => ({
|
|
42
|
+
components: { Skeleton },
|
|
43
|
+
template: `
|
|
44
|
+
<div class="flex items-center gap-4">
|
|
45
|
+
<Skeleton width="48px" height="48px" class="rounded-full" />
|
|
46
|
+
<div class="space-y-2">
|
|
47
|
+
<Skeleton width="160px" height="16px" />
|
|
48
|
+
<Skeleton width="120px" height="12px" />
|
|
49
|
+
</div>
|
|
53
50
|
</div>
|
|
54
51
|
`,
|
|
55
52
|
}),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { Skeleton as ShadcnSkeleton } from '
|
|
2
|
+
import { Skeleton as ShadcnSkeleton } from '../../shadcn/skeleton'
|
|
3
3
|
import type { SkeletonProps } from './types'
|
|
4
4
|
|
|
5
5
|
defineProps<SkeletonProps>()
|
|
@@ -5,55 +5,97 @@ const meta = {
|
|
|
5
5
|
title: 'UI/Slider',
|
|
6
6
|
component: Slider,
|
|
7
7
|
argTypes: {
|
|
8
|
+
min: { control: 'number' },
|
|
9
|
+
max: { control: 'number' },
|
|
10
|
+
step: { control: 'number' },
|
|
8
11
|
disabled: { control: 'boolean' },
|
|
12
|
+
orientation: { control: 'select', options: [ 'horizontal', 'vertical' ]},
|
|
9
13
|
},
|
|
10
14
|
args: {
|
|
15
|
+
min: 0,
|
|
16
|
+
max: 100,
|
|
17
|
+
step: 1,
|
|
11
18
|
disabled: false,
|
|
19
|
+
orientation: 'horizontal',
|
|
12
20
|
},
|
|
21
|
+
render: args => ({
|
|
22
|
+
components: { Slider },
|
|
23
|
+
setup () {
|
|
24
|
+
const value = ref(50)
|
|
25
|
+
return { args, value }
|
|
26
|
+
},
|
|
27
|
+
template: `
|
|
28
|
+
<div class="max-w-sm">
|
|
29
|
+
<Slider v-model="value" v-bind="args" />
|
|
30
|
+
<div class="mt-2 text-sm text-muted-foreground">Value: {{ value }}</div>
|
|
31
|
+
</div>
|
|
32
|
+
`,
|
|
33
|
+
}),
|
|
13
34
|
} satisfies Meta<typeof Slider>
|
|
14
35
|
|
|
15
36
|
export default meta
|
|
16
37
|
type Story = StoryObj<typeof meta>
|
|
17
38
|
|
|
18
|
-
export const Default: Story = {
|
|
19
|
-
|
|
39
|
+
export const Default: Story = {}
|
|
40
|
+
|
|
41
|
+
export const Range: Story = {
|
|
42
|
+
render: () => ({
|
|
20
43
|
components: { Slider },
|
|
21
44
|
setup () {
|
|
22
|
-
const single = ref(50)
|
|
23
45
|
const range = ref([ 20, 80 ])
|
|
24
|
-
|
|
25
|
-
const custom = ref(500)
|
|
26
|
-
return { args, single, range, stepped, custom }
|
|
46
|
+
return { range }
|
|
27
47
|
},
|
|
28
48
|
template: `
|
|
29
|
-
<div class="
|
|
30
|
-
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
49
|
+
<div class="max-w-sm">
|
|
50
|
+
<Slider v-model="range" />
|
|
51
|
+
<div class="mt-2 text-sm text-muted-foreground">Value: {{ range }}</div>
|
|
52
|
+
</div>
|
|
53
|
+
`,
|
|
54
|
+
}),
|
|
55
|
+
}
|
|
36
56
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
57
|
+
export const WithStep: Story = {
|
|
58
|
+
render: () => ({
|
|
59
|
+
components: { Slider },
|
|
60
|
+
setup () {
|
|
61
|
+
const stepped = ref(50)
|
|
62
|
+
return { stepped }
|
|
63
|
+
},
|
|
64
|
+
template: `
|
|
65
|
+
<div class="max-w-sm">
|
|
66
|
+
<Slider v-model="stepped" :step="25" />
|
|
67
|
+
<div class="mt-2 text-sm text-muted-foreground">Value: {{ stepped }}</div>
|
|
68
|
+
</div>
|
|
69
|
+
`,
|
|
70
|
+
}),
|
|
71
|
+
}
|
|
43
72
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
73
|
+
export const CustomMinMax: Story = {
|
|
74
|
+
render: () => ({
|
|
75
|
+
components: { Slider },
|
|
76
|
+
setup () {
|
|
77
|
+
const custom = ref(500)
|
|
78
|
+
return { custom }
|
|
79
|
+
},
|
|
80
|
+
template: `
|
|
81
|
+
<div class="max-w-sm">
|
|
82
|
+
<Slider v-model="custom" :min="0" :max="1000" />
|
|
83
|
+
<div class="mt-2 text-sm text-muted-foreground">Value: {{ custom }}</div>
|
|
84
|
+
</div>
|
|
85
|
+
`,
|
|
86
|
+
}),
|
|
87
|
+
}
|
|
50
88
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
89
|
+
export const Disabled: Story = {
|
|
90
|
+
render: () => ({
|
|
91
|
+
components: { Slider },
|
|
92
|
+
setup () {
|
|
93
|
+
const value = ref(50)
|
|
94
|
+
return { value }
|
|
95
|
+
},
|
|
96
|
+
template: `
|
|
97
|
+
<div class="max-w-sm">
|
|
98
|
+
<Slider v-model="value" disabled />
|
|
57
99
|
</div>
|
|
58
100
|
`,
|
|
59
101
|
}),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { Slider as ShadcnSlider } from '
|
|
2
|
+
import { Slider as ShadcnSlider } from '../../shadcn/slider'
|
|
3
3
|
import type { SliderProps } from './types'
|
|
4
4
|
|
|
5
5
|
const props = withDefaults(defineProps<SliderProps>(), {
|
|
@@ -1,49 +1,75 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import type { SurfaceColor, SurfaceVariant } from './types'
|
|
2
3
|
import Surface from './index.vue'
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
type SurfaceVariant = 'solid' | 'soft' | 'bordered' | 'flat'
|
|
6
|
-
|
|
7
|
-
const types: SurfaceType[] = [ 'default', 'success', 'info', 'help', 'warn', 'danger' ]
|
|
5
|
+
const colors: SurfaceColor[] = [ 'default', 'primary', 'success', 'info', 'help', 'warn', 'danger' ]
|
|
8
6
|
const variants: SurfaceVariant[] = [ 'solid', 'soft', 'bordered', 'flat' ]
|
|
9
7
|
|
|
10
8
|
const meta = {
|
|
11
9
|
title: 'UI/Surface',
|
|
12
10
|
component: Surface,
|
|
13
11
|
argTypes: {
|
|
14
|
-
|
|
12
|
+
color: { control: 'select', options: colors },
|
|
15
13
|
variant: { control: 'select', options: variants },
|
|
16
14
|
},
|
|
17
15
|
args: {
|
|
18
|
-
|
|
16
|
+
color: 'default',
|
|
19
17
|
variant: 'soft',
|
|
20
18
|
},
|
|
19
|
+
render: args => ({
|
|
20
|
+
components: { Surface },
|
|
21
|
+
setup: () => ({ args }),
|
|
22
|
+
template: '<Surface v-bind="args" class="p-4">This is a surface.</Surface>',
|
|
23
|
+
}),
|
|
21
24
|
} satisfies Meta<typeof Surface>
|
|
22
25
|
|
|
23
26
|
export default meta
|
|
24
27
|
type Story = StoryObj<typeof meta>
|
|
25
28
|
|
|
26
|
-
export const Default: Story = {
|
|
27
|
-
|
|
29
|
+
export const Default: Story = {}
|
|
30
|
+
|
|
31
|
+
export const Colors: Story = {
|
|
32
|
+
render: () => ({
|
|
28
33
|
components: { Surface },
|
|
29
|
-
setup: () => ({
|
|
34
|
+
setup: () => ({ colors }),
|
|
30
35
|
template: `
|
|
31
|
-
<div class="
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
<div class="grid grid-cols-2 gap-3 md:grid-cols-3">
|
|
37
|
+
<Surface v-for="c in colors" :key="c" :color="c" class="p-4">
|
|
38
|
+
<strong>{{ c }}</strong> surface
|
|
39
|
+
</Surface>
|
|
40
|
+
</div>
|
|
41
|
+
`,
|
|
42
|
+
}),
|
|
43
|
+
}
|
|
37
44
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
export const Variants: Story = {
|
|
46
|
+
render: () => ({
|
|
47
|
+
components: { Surface },
|
|
48
|
+
setup: () => ({ variants }),
|
|
49
|
+
template: `
|
|
50
|
+
<div class="grid grid-cols-2 gap-3 md:grid-cols-4">
|
|
51
|
+
<Surface v-for="v in variants" :key="v" :variant="v" class="p-4">
|
|
52
|
+
<strong>{{ v }}</strong> surface
|
|
53
|
+
</Surface>
|
|
54
|
+
</div>
|
|
55
|
+
`,
|
|
56
|
+
}),
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const VariantColorMatrix: Story = {
|
|
60
|
+
render: () => ({
|
|
61
|
+
components: { Surface },
|
|
62
|
+
setup: () => ({ colors, variants }),
|
|
63
|
+
template: `
|
|
64
|
+
<div class="space-y-6">
|
|
65
|
+
<div v-for="v in variants" :key="v">
|
|
66
|
+
<div class="mb-2 text-sm text-muted-foreground">{{ v }}</div>
|
|
41
67
|
<div class="grid grid-cols-2 gap-3 md:grid-cols-3">
|
|
42
|
-
<Surface v-for="
|
|
43
|
-
<strong>{{
|
|
68
|
+
<Surface v-for="c in colors" :key="c" :variant="v" :color="c" class="p-4">
|
|
69
|
+
<strong>{{ c }}</strong> surface
|
|
44
70
|
</Surface>
|
|
45
71
|
</div>
|
|
46
|
-
</
|
|
72
|
+
</div>
|
|
47
73
|
</div>
|
|
48
74
|
`,
|
|
49
75
|
}),
|