@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,6 +1,15 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
2
|
import Icon from './index.vue'
|
|
3
3
|
|
|
4
|
+
const commonIcons = [
|
|
5
|
+
'house', 'search', 'settings', 'user', 'mail', 'bell',
|
|
6
|
+
'heart', 'star', 'plus', 'minus', 'check', 'x',
|
|
7
|
+
'chevron-left', 'chevron-right', 'chevron-up', 'chevron-down',
|
|
8
|
+
'arrow-left', 'arrow-right', 'arrow-up', 'arrow-down',
|
|
9
|
+
'eye', 'eye-off', 'trash-2', 'pencil', 'copy', 'download',
|
|
10
|
+
'upload', 'share', 'link', 'external-link', 'info', 'triangle-alert',
|
|
11
|
+
]
|
|
12
|
+
|
|
4
13
|
const meta = {
|
|
5
14
|
title: 'UI/Icon',
|
|
6
15
|
component: Icon,
|
|
@@ -10,58 +19,47 @@ const meta = {
|
|
|
10
19
|
args: {
|
|
11
20
|
name: 'house',
|
|
12
21
|
},
|
|
22
|
+
render: args => ({
|
|
23
|
+
components: { Icon },
|
|
24
|
+
setup: () => ({ args }),
|
|
25
|
+
template: '<Icon v-bind="args" />',
|
|
26
|
+
}),
|
|
13
27
|
} satisfies Meta<typeof Icon>
|
|
14
28
|
|
|
15
29
|
export default meta
|
|
16
30
|
type Story = StoryObj<typeof meta>
|
|
17
31
|
|
|
18
|
-
const
|
|
19
|
-
'house', 'search', 'settings', 'user', 'mail', 'bell',
|
|
20
|
-
'heart', 'star', 'plus', 'minus', 'check', 'x',
|
|
21
|
-
'chevron-left', 'chevron-right', 'chevron-up', 'chevron-down',
|
|
22
|
-
'arrow-left', 'arrow-right', 'arrow-up', 'arrow-down',
|
|
23
|
-
'eye', 'eye-off', 'trash-2', 'pencil', 'copy', 'download',
|
|
24
|
-
'upload', 'share', 'link', 'external-link', 'info', 'triangle-alert',
|
|
25
|
-
]
|
|
32
|
+
export const Default: Story = {}
|
|
26
33
|
|
|
27
|
-
export const
|
|
28
|
-
render:
|
|
34
|
+
export const CommonIcons: Story = {
|
|
35
|
+
render: () => ({
|
|
29
36
|
components: { Icon },
|
|
30
|
-
setup: () => ({
|
|
37
|
+
setup: () => ({ commonIcons }),
|
|
31
38
|
template: `
|
|
32
|
-
<div class="
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
:key="name"
|
|
46
|
-
class="flex flex-col items-center gap-2 rounded-md border p-3"
|
|
47
|
-
>
|
|
48
|
-
<Icon :name="name" class="size-5" />
|
|
49
|
-
<span class="text-xs text-muted-foreground">{{ name }}</span>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
</section>
|
|
39
|
+
<div class="grid grid-cols-8 gap-4">
|
|
40
|
+
<div
|
|
41
|
+
v-for="name in commonIcons"
|
|
42
|
+
:key="name"
|
|
43
|
+
class="flex flex-col items-center gap-2 rounded-md border p-3"
|
|
44
|
+
>
|
|
45
|
+
<Icon :name="name" class="size-5" />
|
|
46
|
+
<span class="text-xs text-muted-foreground">{{ name }}</span>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
`,
|
|
50
|
+
}),
|
|
51
|
+
}
|
|
53
52
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
</section>
|
|
53
|
+
export const Sizes: Story = {
|
|
54
|
+
render: () => ({
|
|
55
|
+
components: { Icon },
|
|
56
|
+
template: `
|
|
57
|
+
<div class="flex items-end gap-4">
|
|
58
|
+
<Icon name="star" class="size-3" />
|
|
59
|
+
<Icon name="star" class="size-4" />
|
|
60
|
+
<Icon name="star" class="size-5" />
|
|
61
|
+
<Icon name="star" class="size-6" />
|
|
62
|
+
<Icon name="star" class="size-8" />
|
|
65
63
|
</div>
|
|
66
64
|
`,
|
|
67
65
|
}),
|
|
@@ -6,68 +6,122 @@ const meta = {
|
|
|
6
6
|
title: 'UI/Input',
|
|
7
7
|
component: Input,
|
|
8
8
|
argTypes: {
|
|
9
|
+
modelValue: { control: 'text' },
|
|
10
|
+
autocomplete: { control: 'text' },
|
|
9
11
|
disabled: { control: 'boolean' },
|
|
10
12
|
readonly: { control: 'boolean' },
|
|
11
13
|
invalid: { control: 'boolean' },
|
|
12
14
|
},
|
|
13
15
|
args: {
|
|
16
|
+
modelValue: '',
|
|
17
|
+
autocomplete: 'off',
|
|
14
18
|
disabled: false,
|
|
15
19
|
readonly: false,
|
|
16
20
|
invalid: false,
|
|
17
21
|
},
|
|
18
|
-
|
|
22
|
+
render: args => ({
|
|
23
|
+
components: { Input },
|
|
24
|
+
setup: () => ({ args }),
|
|
25
|
+
template: `
|
|
26
|
+
<Input v-bind="args" placeholder="Type something..." class="max-w-sm" />
|
|
27
|
+
`,
|
|
28
|
+
}),
|
|
29
|
+
} satisfies Meta<typeof Input>
|
|
19
30
|
|
|
20
31
|
export default meta
|
|
21
32
|
type Story = StoryObj<typeof meta>
|
|
22
33
|
|
|
23
|
-
export const Default: Story = {
|
|
24
|
-
|
|
25
|
-
|
|
34
|
+
export const Default: Story = {}
|
|
35
|
+
|
|
36
|
+
export const Controlled: Story = {
|
|
37
|
+
render: () => ({
|
|
38
|
+
components: { Input },
|
|
26
39
|
setup () {
|
|
27
40
|
const value = ref('')
|
|
28
|
-
|
|
29
|
-
const withSuffix = ref('')
|
|
30
|
-
const password = ref('')
|
|
31
|
-
return { args, value, withPrefix, withSuffix, password }
|
|
41
|
+
return { value }
|
|
32
42
|
},
|
|
33
43
|
template: `
|
|
34
|
-
<div class="
|
|
35
|
-
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
<div class="max-w-sm space-y-2">
|
|
45
|
+
<Input v-model="value" placeholder="Enter your name..." />
|
|
46
|
+
<div class="text-sm text-muted-foreground">Value: {{ value }}</div>
|
|
47
|
+
</div>
|
|
48
|
+
`,
|
|
49
|
+
}),
|
|
50
|
+
}
|
|
41
51
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
export const WithPrefix: Story = {
|
|
53
|
+
render: () => ({
|
|
54
|
+
components: { Input, Icon },
|
|
55
|
+
setup () {
|
|
56
|
+
const value = ref('')
|
|
57
|
+
return { value }
|
|
58
|
+
},
|
|
59
|
+
template: `
|
|
60
|
+
<div class="max-w-sm space-y-2">
|
|
61
|
+
<Input v-model="value" placeholder="Search...">
|
|
62
|
+
<template #prefix>
|
|
63
|
+
<Icon name="search" />
|
|
64
|
+
</template>
|
|
65
|
+
</Input>
|
|
66
|
+
<div class="text-sm text-muted-foreground">Value: {{ value }}</div>
|
|
67
|
+
</div>
|
|
68
|
+
`,
|
|
69
|
+
}),
|
|
70
|
+
}
|
|
52
71
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
72
|
+
export const WithSuffix: Story = {
|
|
73
|
+
render: () => ({
|
|
74
|
+
components: { Input, Icon },
|
|
75
|
+
setup () {
|
|
76
|
+
const value = ref('')
|
|
77
|
+
return { value }
|
|
78
|
+
},
|
|
79
|
+
template: `
|
|
80
|
+
<div class="max-w-sm space-y-2">
|
|
81
|
+
<Input v-model="value" placeholder="Email">
|
|
82
|
+
<template #suffix>
|
|
83
|
+
<Icon name="mail" />
|
|
84
|
+
</template>
|
|
85
|
+
</Input>
|
|
86
|
+
<div class="text-sm text-muted-foreground">Value: {{ value }}</div>
|
|
87
|
+
</div>
|
|
88
|
+
`,
|
|
89
|
+
}),
|
|
90
|
+
}
|
|
63
91
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
92
|
+
export const Password: Story = {
|
|
93
|
+
render: () => ({
|
|
94
|
+
components: { Input },
|
|
95
|
+
setup () {
|
|
96
|
+
const value = ref('')
|
|
97
|
+
return { value }
|
|
98
|
+
},
|
|
99
|
+
template: `
|
|
100
|
+
<div class="max-w-sm space-y-2">
|
|
101
|
+
<Input v-model="value" type="password" placeholder="Password" />
|
|
102
|
+
<div class="text-sm text-muted-foreground">Value: {{ value }}</div>
|
|
70
103
|
</div>
|
|
71
104
|
`,
|
|
72
105
|
}),
|
|
73
106
|
}
|
|
107
|
+
|
|
108
|
+
export const Disabled: Story = {
|
|
109
|
+
render: () => ({
|
|
110
|
+
components: { Input },
|
|
111
|
+
template: '<Input disabled placeholder="Disabled input" class="max-w-sm" />',
|
|
112
|
+
}),
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export const Readonly: Story = {
|
|
116
|
+
render: () => ({
|
|
117
|
+
components: { Input },
|
|
118
|
+
template: '<Input readonly modelValue="Read-only value" class="max-w-sm" />',
|
|
119
|
+
}),
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export const Invalid: Story = {
|
|
123
|
+
render: () => ({
|
|
124
|
+
components: { Input },
|
|
125
|
+
template: '<Input invalid modelValue="Invalid value" class="max-w-sm" />',
|
|
126
|
+
}),
|
|
127
|
+
}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
InputGroupAddon,
|
|
5
5
|
InputGroupButton,
|
|
6
6
|
InputGroupInput,
|
|
7
|
-
} from '
|
|
7
|
+
} from '../../shadcn/input-group'
|
|
8
8
|
import type { InputProps } from './types'
|
|
9
9
|
|
|
10
10
|
defineOptions({ inheritAttrs: false })
|
|
@@ -1,74 +1,114 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
2
|
import InputCurrency from './index.vue'
|
|
3
3
|
|
|
4
|
+
const currencyDisplays = [ 'symbol', 'narrowSymbol', 'code', 'name' ] as const
|
|
5
|
+
|
|
4
6
|
const meta = {
|
|
5
7
|
title: 'UI/InputCurrency',
|
|
6
8
|
component: InputCurrency,
|
|
7
9
|
argTypes: {
|
|
8
|
-
|
|
10
|
+
currency: { control: 'text' },
|
|
11
|
+
currencyDisplay: { control: 'select', options: currencyDisplays },
|
|
9
12
|
},
|
|
10
13
|
args: {
|
|
11
|
-
|
|
14
|
+
currency: 'JPY',
|
|
15
|
+
currencyDisplay: 'symbol',
|
|
12
16
|
},
|
|
13
|
-
|
|
17
|
+
render: args => ({
|
|
18
|
+
components: { InputCurrency },
|
|
19
|
+
setup () {
|
|
20
|
+
const value = ref(1000)
|
|
21
|
+
return { args, value }
|
|
22
|
+
},
|
|
23
|
+
template: `
|
|
24
|
+
<div class="max-w-xs">
|
|
25
|
+
<InputCurrency v-model="value" v-bind="args" />
|
|
26
|
+
<div class="mt-2 text-sm text-muted-foreground">Value: {{ value }}</div>
|
|
27
|
+
</div>
|
|
28
|
+
`,
|
|
29
|
+
}),
|
|
30
|
+
} satisfies Meta<typeof InputCurrency>
|
|
14
31
|
|
|
15
32
|
export default meta
|
|
16
33
|
type Story = StoryObj<typeof meta>
|
|
17
34
|
|
|
18
|
-
export const Default: Story = {
|
|
19
|
-
|
|
35
|
+
export const Default: Story = {}
|
|
36
|
+
|
|
37
|
+
export const UsdSymbol: Story = {
|
|
38
|
+
render: () => ({
|
|
20
39
|
components: { InputCurrency },
|
|
21
40
|
setup () {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const eurCode = ref(29.99)
|
|
25
|
-
const cadSymbol = ref(79.99)
|
|
26
|
-
const cadNarrow = ref(79.99)
|
|
27
|
-
const jpyName = ref(5000)
|
|
28
|
-
return { args, jpy, usd, eurCode, cadSymbol, cadNarrow, jpyName }
|
|
41
|
+
const value = ref(49.99)
|
|
42
|
+
return { value }
|
|
29
43
|
},
|
|
30
44
|
template: `
|
|
31
|
-
<div class="
|
|
32
|
-
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<!-- USD (symbol) -->
|
|
40
|
-
<section>
|
|
41
|
-
<h3 class="mb-4 text-lg font-medium">USD (symbol)</h3>
|
|
42
|
-
<InputCurrency v-model="usd" currency="USD" />
|
|
43
|
-
<div class="mt-2 text-sm text-muted-foreground">Value: {{ usd }}</div>
|
|
44
|
-
</section>
|
|
45
|
+
<div class="max-w-xs">
|
|
46
|
+
<InputCurrency v-model="value" currency="USD" />
|
|
47
|
+
<div class="mt-2 text-sm text-muted-foreground">Value: {{ value }}</div>
|
|
48
|
+
</div>
|
|
49
|
+
`,
|
|
50
|
+
}),
|
|
51
|
+
}
|
|
45
52
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
export const EurCodeDisplay: Story = {
|
|
54
|
+
render: () => ({
|
|
55
|
+
components: { InputCurrency },
|
|
56
|
+
setup () {
|
|
57
|
+
const value = ref(29.99)
|
|
58
|
+
return { value }
|
|
59
|
+
},
|
|
60
|
+
template: `
|
|
61
|
+
<div class="max-w-xs">
|
|
62
|
+
<InputCurrency v-model="value" currency="EUR" currencyDisplay="code" />
|
|
63
|
+
<div class="mt-2 text-sm text-muted-foreground">Value: {{ value }}</div>
|
|
64
|
+
</div>
|
|
65
|
+
`,
|
|
66
|
+
}),
|
|
67
|
+
}
|
|
52
68
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
69
|
+
export const CadSymbol: Story = {
|
|
70
|
+
render: () => ({
|
|
71
|
+
components: { InputCurrency },
|
|
72
|
+
setup () {
|
|
73
|
+
const value = ref(79.99)
|
|
74
|
+
return { value }
|
|
75
|
+
},
|
|
76
|
+
template: `
|
|
77
|
+
<div class="max-w-xs">
|
|
78
|
+
<InputCurrency v-model="value" currency="CAD" currencyDisplay="symbol" />
|
|
79
|
+
<div class="mt-2 text-sm text-muted-foreground">Value: {{ value }}</div>
|
|
80
|
+
</div>
|
|
81
|
+
`,
|
|
82
|
+
}),
|
|
83
|
+
}
|
|
59
84
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
85
|
+
export const CadNarrowSymbol: Story = {
|
|
86
|
+
render: () => ({
|
|
87
|
+
components: { InputCurrency },
|
|
88
|
+
setup () {
|
|
89
|
+
const value = ref(79.99)
|
|
90
|
+
return { value }
|
|
91
|
+
},
|
|
92
|
+
template: `
|
|
93
|
+
<div class="max-w-xs">
|
|
94
|
+
<InputCurrency v-model="value" currency="CAD" currencyDisplay="narrowSymbol" />
|
|
95
|
+
<div class="mt-2 text-sm text-muted-foreground">Value: {{ value }}</div>
|
|
96
|
+
</div>
|
|
97
|
+
`,
|
|
98
|
+
}),
|
|
99
|
+
}
|
|
65
100
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
101
|
+
export const JpyNameDisplay: Story = {
|
|
102
|
+
render: () => ({
|
|
103
|
+
components: { InputCurrency },
|
|
104
|
+
setup () {
|
|
105
|
+
const value = ref(5000)
|
|
106
|
+
return { value }
|
|
107
|
+
},
|
|
108
|
+
template: `
|
|
109
|
+
<div class="max-w-xs">
|
|
110
|
+
<InputCurrency v-model="value" currencyDisplay="name" />
|
|
111
|
+
<div class="mt-2 text-sm text-muted-foreground">Value: {{ value }}</div>
|
|
72
112
|
</div>
|
|
73
113
|
`,
|
|
74
114
|
}),
|
|
@@ -5,51 +5,115 @@ const meta = {
|
|
|
5
5
|
title: 'UI/InputNumber',
|
|
6
6
|
component: InputNumber,
|
|
7
7
|
argTypes: {
|
|
8
|
+
min: { control: 'number' },
|
|
9
|
+
max: { control: 'number' },
|
|
10
|
+
step: { control: 'number' },
|
|
11
|
+
placeholder: { control: 'text' },
|
|
12
|
+
showButtons: { control: 'boolean' },
|
|
8
13
|
disabled: { control: 'boolean' },
|
|
9
14
|
invalid: { control: 'boolean' },
|
|
10
|
-
showButtons: { control: 'boolean' },
|
|
11
15
|
},
|
|
12
16
|
args: {
|
|
17
|
+
min: undefined,
|
|
18
|
+
max: undefined,
|
|
19
|
+
step: 1,
|
|
20
|
+
placeholder: '',
|
|
21
|
+
showButtons: true,
|
|
13
22
|
disabled: false,
|
|
14
23
|
invalid: false,
|
|
15
|
-
showButtons: true,
|
|
16
24
|
},
|
|
25
|
+
render: args => ({
|
|
26
|
+
components: { InputNumber },
|
|
27
|
+
setup () {
|
|
28
|
+
const value = ref(0)
|
|
29
|
+
return { args, value }
|
|
30
|
+
},
|
|
31
|
+
template: `
|
|
32
|
+
<div class="max-w-xs">
|
|
33
|
+
<InputNumber v-model="value" v-bind="args" />
|
|
34
|
+
<div class="mt-2 text-sm text-muted-foreground">Value: {{ value }}</div>
|
|
35
|
+
</div>
|
|
36
|
+
`,
|
|
37
|
+
}),
|
|
17
38
|
} satisfies Meta<typeof InputNumber>
|
|
18
39
|
|
|
19
40
|
export default meta
|
|
20
41
|
type Story = StoryObj<typeof meta>
|
|
21
42
|
|
|
22
|
-
export const Default: Story = {
|
|
23
|
-
|
|
43
|
+
export const Default: Story = {}
|
|
44
|
+
|
|
45
|
+
export const WithMinMax: Story = {
|
|
46
|
+
render: () => ({
|
|
47
|
+
components: { InputNumber },
|
|
48
|
+
setup () {
|
|
49
|
+
const value = ref(5)
|
|
50
|
+
return { value }
|
|
51
|
+
},
|
|
52
|
+
template: `
|
|
53
|
+
<div class="max-w-xs">
|
|
54
|
+
<InputNumber v-model="value" :min="0" :max="10" />
|
|
55
|
+
<div class="mt-2 text-sm text-muted-foreground">Value: {{ value }}</div>
|
|
56
|
+
</div>
|
|
57
|
+
`,
|
|
58
|
+
}),
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const CustomStep: Story = {
|
|
62
|
+
render: () => ({
|
|
63
|
+
components: { InputNumber },
|
|
64
|
+
setup () {
|
|
65
|
+
const value = ref(0)
|
|
66
|
+
return { value }
|
|
67
|
+
},
|
|
68
|
+
template: `
|
|
69
|
+
<div class="max-w-xs">
|
|
70
|
+
<InputNumber v-model="value" :step="5" />
|
|
71
|
+
<div class="mt-2 text-sm text-muted-foreground">Value: {{ value }}</div>
|
|
72
|
+
</div>
|
|
73
|
+
`,
|
|
74
|
+
}),
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export const WithoutButtons: Story = {
|
|
78
|
+
render: () => ({
|
|
79
|
+
components: { InputNumber },
|
|
80
|
+
setup () {
|
|
81
|
+
const value = ref(0)
|
|
82
|
+
return { value }
|
|
83
|
+
},
|
|
84
|
+
template: `
|
|
85
|
+
<div class="max-w-xs">
|
|
86
|
+
<InputNumber v-model="value" :showButtons="false" />
|
|
87
|
+
</div>
|
|
88
|
+
`,
|
|
89
|
+
}),
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export const Disabled: Story = {
|
|
93
|
+
render: () => ({
|
|
94
|
+
components: { InputNumber },
|
|
95
|
+
setup () {
|
|
96
|
+
const value = ref(0)
|
|
97
|
+
return { value }
|
|
98
|
+
},
|
|
99
|
+
template: `
|
|
100
|
+
<div class="max-w-xs">
|
|
101
|
+
<InputNumber v-model="value" disabled />
|
|
102
|
+
</div>
|
|
103
|
+
`,
|
|
104
|
+
}),
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export const Invalid: Story = {
|
|
108
|
+
render: () => ({
|
|
24
109
|
components: { InputNumber },
|
|
25
110
|
setup () {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
const stepped = ref(0)
|
|
29
|
-
return { args, basic, minMax, stepped }
|
|
111
|
+
const value = ref(0)
|
|
112
|
+
return { value }
|
|
30
113
|
},
|
|
31
114
|
template: `
|
|
32
|
-
<div class="
|
|
33
|
-
|
|
34
|
-
<section>
|
|
35
|
-
<h3 class="mb-4 text-lg font-medium">Controlled</h3>
|
|
36
|
-
<InputNumber v-model="basic" v-bind="args" />
|
|
37
|
-
<div class="mt-2 text-sm text-muted-foreground">Value: {{ basic }}</div>
|
|
38
|
-
</section>
|
|
39
|
-
|
|
40
|
-
<!-- With Min / Max -->
|
|
41
|
-
<section>
|
|
42
|
-
<h3 class="mb-4 text-lg font-medium">With Min / Max (0 - 10)</h3>
|
|
43
|
-
<InputNumber v-model="minMax" :min="0" :max="10" />
|
|
44
|
-
<div class="mt-2 text-sm text-muted-foreground">Value: {{ minMax }}</div>
|
|
45
|
-
</section>
|
|
46
|
-
|
|
47
|
-
<!-- Custom Step -->
|
|
48
|
-
<section>
|
|
49
|
-
<h3 class="mb-4 text-lg font-medium">Custom Step (5)</h3>
|
|
50
|
-
<InputNumber v-model="stepped" :step="5" />
|
|
51
|
-
<div class="mt-2 text-sm text-muted-foreground">Value: {{ stepped }}</div>
|
|
52
|
-
</section>
|
|
115
|
+
<div class="max-w-xs">
|
|
116
|
+
<InputNumber v-model="value" invalid />
|
|
53
117
|
</div>
|
|
54
118
|
`,
|
|
55
119
|
}),
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
NumberFieldDecrement,
|
|
6
6
|
NumberFieldIncrement,
|
|
7
7
|
NumberFieldInput,
|
|
8
|
-
} from '
|
|
8
|
+
} from '../../shadcn/number-field'
|
|
9
9
|
import type { InputNumberProps } from './types'
|
|
10
10
|
|
|
11
11
|
const props = withDefaults(defineProps<InputNumberProps>(), {
|
|
@@ -12,12 +12,6 @@ const meta = {
|
|
|
12
12
|
disabled: false,
|
|
13
13
|
length: 6,
|
|
14
14
|
},
|
|
15
|
-
} satisfies Meta<typeof InputOtp>
|
|
16
|
-
|
|
17
|
-
export default meta
|
|
18
|
-
type Story = StoryObj<typeof meta>
|
|
19
|
-
|
|
20
|
-
export const Default: Story = {
|
|
21
15
|
render: args => ({
|
|
22
16
|
components: { InputOtp },
|
|
23
17
|
setup () {
|
|
@@ -36,4 +30,9 @@ export const Default: Story = {
|
|
|
36
30
|
</div>
|
|
37
31
|
`,
|
|
38
32
|
}),
|
|
39
|
-
}
|
|
33
|
+
} satisfies Meta<typeof InputOtp>
|
|
34
|
+
|
|
35
|
+
export default meta
|
|
36
|
+
type Story = StoryObj<typeof meta>
|
|
37
|
+
|
|
38
|
+
export const Default: Story = {}
|
|
@@ -10,12 +10,6 @@ const meta = {
|
|
|
10
10
|
args: {
|
|
11
11
|
disabled: false,
|
|
12
12
|
},
|
|
13
|
-
} satisfies Meta
|
|
14
|
-
|
|
15
|
-
export default meta
|
|
16
|
-
type Story = StoryObj<typeof meta>
|
|
17
|
-
|
|
18
|
-
export const Default: Story = {
|
|
19
13
|
render: args => ({
|
|
20
14
|
components: { InputPercent },
|
|
21
15
|
setup () {
|
|
@@ -29,4 +23,9 @@ export const Default: Story = {
|
|
|
29
23
|
</div>
|
|
30
24
|
`,
|
|
31
25
|
}),
|
|
32
|
-
}
|
|
26
|
+
} satisfies Meta
|
|
27
|
+
|
|
28
|
+
export default meta
|
|
29
|
+
type Story = StoryObj<typeof meta>
|
|
30
|
+
|
|
31
|
+
export const Default: Story = {}
|