@polymarbot/nuxt-layer-shadcn-ui 0.3.10 → 0.4.0

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.
Files changed (61) hide show
  1. package/app/components/ui/Accordion/index.stories.ts +43 -15
  2. package/app/components/ui/AdminLayout/index.stories.ts +6 -14
  3. package/app/components/ui/Alert/index.stories.ts +32 -2
  4. package/app/components/ui/AlertDialog/index.stories.ts +114 -5
  5. package/app/components/ui/AsyncDataTable/index.stories.ts +36 -2
  6. package/app/components/ui/Avatar/index.stories.ts +58 -4
  7. package/app/components/ui/Badge/index.stories.ts +48 -3
  8. package/app/components/ui/Breadcrumb/index.stories.ts +8 -19
  9. package/app/components/ui/Button/index.stories.ts +116 -7
  10. package/app/components/ui/ButtonGroup/index.stories.ts +63 -4
  11. package/app/components/ui/Card/index.stories.ts +40 -14
  12. package/app/components/ui/Checkbox/index.stories.ts +53 -3
  13. package/app/components/ui/CopyButton/index.stories.ts +77 -5
  14. package/app/components/ui/DataTable/index.stories.ts +184 -11
  15. package/app/components/ui/DatePicker/index.stories.ts +56 -7
  16. package/app/components/ui/DateRangePicker/index.stories.ts +40 -5
  17. package/app/components/ui/Divider/index.stories.ts +18 -15
  18. package/app/components/ui/Drawer/index.stories.ts +115 -16
  19. package/app/components/ui/Drawer/index.vue +27 -12
  20. package/app/components/ui/Dropdown/index.stories.ts +72 -54
  21. package/app/components/ui/Dropdown/index.vue +5 -8
  22. package/app/components/ui/Dropdown/types.ts +3 -8
  23. package/app/components/ui/FormItem/index.stories.ts +33 -45
  24. package/app/components/ui/Help/index.stories.ts +34 -2
  25. package/app/components/ui/Icon/index.stories.ts +41 -2
  26. package/app/components/ui/Input/index.stories.ts +73 -14
  27. package/app/components/ui/InputCurrency/index.stories.ts +20 -65
  28. package/app/components/ui/InputNumber/index.stories.ts +31 -58
  29. package/app/components/ui/InputOtp/index.stories.ts +41 -9
  30. package/app/components/ui/InputPercent/index.stories.ts +3 -7
  31. package/app/components/ui/InputRange/index.stories.ts +51 -4
  32. package/app/components/ui/Loading/index.stories.ts +16 -1
  33. package/app/components/ui/Markdown/index.stories.ts +9 -0
  34. package/app/components/ui/Modal/index.stories.ts +133 -16
  35. package/app/components/ui/Modal/index.vue +27 -12
  36. package/app/components/ui/ModalContent/index.stories.ts +35 -11
  37. package/app/components/ui/PageCard/index.stories.ts +154 -56
  38. package/app/components/ui/Pagination/index.stories.ts +79 -18
  39. package/app/components/ui/Pagination/index.vue +4 -1
  40. package/app/components/ui/Popover/index.stories.ts +73 -3
  41. package/app/components/ui/Popover/index.vue +67 -4
  42. package/app/components/ui/Popover/types.ts +5 -2
  43. package/app/components/ui/Qrcode/index.stories.ts +32 -2
  44. package/app/components/ui/RadioCardGroup/index.stories.ts +45 -6
  45. package/app/components/ui/RadioGroup/index.stories.ts +64 -35
  46. package/app/components/ui/ScrollArea/index.stories.ts +21 -23
  47. package/app/components/ui/SearchSelect/index.stories.ts +73 -24
  48. package/app/components/ui/Select/index.stories.ts +121 -6
  49. package/app/components/ui/Skeleton/index.stories.ts +34 -2
  50. package/app/components/ui/Slider/index.stories.ts +67 -4
  51. package/app/components/ui/Surface/index.stories.ts +86 -5
  52. package/app/components/ui/Surface/index.vue +115 -2
  53. package/app/components/ui/Surface/types.ts +2 -0
  54. package/app/components/ui/Switch/index.stories.ts +46 -0
  55. package/app/components/ui/Tabs/index.stories.ts +61 -47
  56. package/app/components/ui/Tag/index.stories.ts +45 -3
  57. package/app/components/ui/Textarea/index.stories.ts +61 -15
  58. package/app/components/ui/Toast/index.stories.ts +77 -3
  59. package/app/components/ui/Tooltip/index.stories.ts +60 -2
  60. package/app/components/ui/WebLink/index.stories.ts +53 -15
  61. package/package.json +2 -2
@@ -56,8 +56,26 @@ const noControls = { controls: { disable: true }} satisfies Story['parameters']
56
56
 
57
57
  export const Default: Story = {}
58
58
 
59
- export const Multiple: Story = {
59
+ export const Disabled: Story = {
60
60
  parameters: noControls,
61
+ args: {
62
+ disabled: true,
63
+ },
64
+ }
65
+
66
+ export const Multiple: Story = {
67
+ parameters: {
68
+ ...noControls,
69
+ docs: {
70
+ source: {
71
+ code: `
72
+ <template>
73
+ <Accordion v-model="value" type="multiple" :items="items" />
74
+ </template>
75
+ `.trim(),
76
+ },
77
+ },
78
+ },
61
79
  render: () => ({
62
80
  components: { Accordion, Surface },
63
81
  setup () {
@@ -75,21 +93,31 @@ export const Multiple: Story = {
75
93
  }),
76
94
  }
77
95
 
78
- export const Disabled: Story = {
79
- parameters: noControls,
80
- render: () => ({
81
- components: { Accordion, Surface },
82
- setup: () => ({ items }),
83
- template: `
84
- <Surface variant="bordered" class="max-w-md px-4">
85
- <Accordion disabled :items="items" default-value="shipping" />
86
- </Surface>
87
- `,
88
- }),
89
- }
90
-
91
96
  export const CustomSlots: Story = {
92
- parameters: noControls,
97
+ parameters: {
98
+ ...noControls,
99
+ docs: {
100
+ source: {
101
+ code: `
102
+ <template>
103
+ <Accordion v-model="value" :items="items">
104
+ <template #title="{ item, open }">
105
+ <span class="flex items-center gap-2">
106
+ <span class="inline-flex size-5 items-center justify-center rounded-full bg-primary/15 text-primary">
107
+ <Icon :name="open ? 'minus' : 'plus'" class="size-3" />
108
+ </span>
109
+ {{ item.title }}
110
+ </span>
111
+ </template>
112
+ <template #content="{ item }">
113
+ <p class="text-muted-foreground">{{ item.content }}</p>
114
+ </template>
115
+ </Accordion>
116
+ </template>
117
+ `.trim(),
118
+ },
119
+ },
120
+ },
93
121
  render: () => ({
94
122
  components: { Accordion, Surface, Icon },
95
123
  setup () {
@@ -191,26 +191,18 @@ type Story = StoryObj<typeof meta>
191
191
 
192
192
  const noControls = { controls: { disable: true }} satisfies Story['parameters']
193
193
 
194
- const renderAdminLayoutVariant = (variant: 'floating' | 'inset') => () => ({
195
- components: { AdminLayout, Avatar, Breadcrumb, Button, Card },
196
- setup () {
197
- const breadcrumb = [
198
- { label: 'Dashboard', href: '#' },
199
- { label: 'Overview' },
200
- ]
201
- return { menus, footerDropdown: { profile, menuItems }, breadcrumb, variant }
202
- },
203
- template: `<AdminLayout :variant="variant" collapsible="icon" :menus="menus" :footer-dropdown="footerDropdown">${layoutContent}</AdminLayout>`,
204
- })
205
-
206
194
  export const Default: Story = {}
207
195
 
208
196
  export const Floating: Story = {
209
197
  parameters: noControls,
210
- render: renderAdminLayoutVariant('floating'),
198
+ args: {
199
+ variant: 'floating',
200
+ },
211
201
  }
212
202
 
213
203
  export const Inset: Story = {
214
204
  parameters: noControls,
215
- render: renderAdminLayoutVariant('inset'),
205
+ args: {
206
+ variant: 'inset',
207
+ },
216
208
  }
@@ -30,7 +30,22 @@ const noControls = { controls: { disable: true }} satisfies Story['parameters']
30
30
  export const Default: Story = {}
31
31
 
32
32
  export const Types: Story = {
33
- parameters: noControls,
33
+ parameters: {
34
+ ...noControls,
35
+ docs: {
36
+ source: {
37
+ code: `
38
+ <template>
39
+ <div class="space-y-3">
40
+ <Alert v-for="t in types" :key="t" :type="t">
41
+ This is a <strong>{{ t }}</strong> alert message.
42
+ </Alert>
43
+ </div>
44
+ </template>
45
+ `.trim(),
46
+ },
47
+ },
48
+ },
34
49
  render: () => ({
35
50
  components: { Alert },
36
51
  setup: () => ({ types }),
@@ -45,7 +60,22 @@ export const Types: Story = {
45
60
  }
46
61
 
47
62
  export const WithIcons: Story = {
48
- parameters: noControls,
63
+ parameters: {
64
+ ...noControls,
65
+ docs: {
66
+ source: {
67
+ code: `
68
+ <template>
69
+ <div class="space-y-3">
70
+ <Alert type="info" icon="bell">Alert with a custom bell icon.</Alert>
71
+ <Alert type="success" icon="sparkles">Alert with a custom sparkles icon.</Alert>
72
+ <Alert type="warn" icon="flag">Alert with a custom flag icon.</Alert>
73
+ </div>
74
+ </template>
75
+ `.trim(),
76
+ },
77
+ },
78
+ },
49
79
  render: () => ({
50
80
  components: { Alert },
51
81
  template: `
@@ -37,10 +37,55 @@ type Story = StoryObj<typeof meta>
37
37
 
38
38
  const noControls = { controls: { disable: true }} satisfies Story['parameters']
39
39
 
40
- export const Default: Story = {}
40
+ export const Default: Story = {
41
+ parameters: {
42
+ docs: {
43
+ source: {
44
+ code: `
45
+ <script setup lang="ts">
46
+ const { confirm } = useDialog()
47
+ const result = ref('')
48
+
49
+ async function handleConfirm () {
50
+ const ok = await confirm({ title: 'Confirm', message: 'Do you want to proceed?' })
51
+ result.value = \`confirm → \${ok}\`
52
+ }
53
+ </script>
54
+
55
+ <template>
56
+ <Button @click="handleConfirm">Confirm</Button>
57
+ <div v-if="result">Result: {{ result }}</div>
58
+ </template>
59
+ `.trim(),
60
+ },
61
+ },
62
+ },
63
+ }
41
64
 
42
65
  export const Alert: Story = {
43
- parameters: noControls,
66
+ parameters: {
67
+ ...noControls,
68
+ docs: {
69
+ source: {
70
+ code: `
71
+ <script setup lang="ts">
72
+ const { alert } = useDialog()
73
+ const result = ref('')
74
+
75
+ async function handleAlert () {
76
+ await alert({ title: 'Error', type: 'error', message: 'Something went wrong.' })
77
+ result.value = 'alert → closed'
78
+ }
79
+ </script>
80
+
81
+ <template>
82
+ <Button variant="outline" @click="handleAlert">Alert</Button>
83
+ <div v-if="result">Result: {{ result }}</div>
84
+ </template>
85
+ `.trim(),
86
+ },
87
+ },
88
+ },
44
89
  render: () => ({
45
90
  components: { Button },
46
91
  setup () {
@@ -62,7 +107,29 @@ export const Alert: Story = {
62
107
  }
63
108
 
64
109
  export const Destroy: Story = {
65
- parameters: noControls,
110
+ parameters: {
111
+ ...noControls,
112
+ docs: {
113
+ source: {
114
+ code: `
115
+ <script setup lang="ts">
116
+ const { destroy } = useDialog()
117
+ const result = ref('')
118
+
119
+ async function handleDestroy () {
120
+ const ok = await destroy({ title: 'Delete Item', message: 'This action cannot be undone.' })
121
+ result.value = \`destroy → \${ok}\`
122
+ }
123
+ </script>
124
+
125
+ <template>
126
+ <Button variant="destructive" @click="handleDestroy">Destroy</Button>
127
+ <div v-if="result">Result: {{ result }}</div>
128
+ </template>
129
+ `.trim(),
130
+ },
131
+ },
132
+ },
66
133
  render: () => ({
67
134
  components: { Button },
68
135
  setup () {
@@ -84,7 +151,33 @@ export const Destroy: Story = {
84
151
  }
85
152
 
86
153
  export const MultiDialog: Story = {
87
- parameters: noControls,
154
+ parameters: {
155
+ ...noControls,
156
+ docs: {
157
+ source: {
158
+ code: `
159
+ <script setup lang="ts">
160
+ const { confirm, alert, destroy } = useDialog()
161
+ const result = ref('')
162
+
163
+ async function handleMulti () {
164
+ result.value = 'waiting...'
165
+ const r1 = confirm({ title: 'Dialog 1', message: 'First confirm dialog' })
166
+ const r2 = alert({ title: 'Dialog 2', message: 'Second alert dialog' })
167
+ const r3 = destroy({ title: 'Dialog 3', message: 'Third destroy dialog' })
168
+ const [ v1, , v3 ] = await Promise.all([ r1, r2, r3 ])
169
+ result.value = \`multi → confirm: \${v1}, alert: done, destroy: \${v3}\`
170
+ }
171
+ </script>
172
+
173
+ <template>
174
+ <Button variant="secondary" @click="handleMulti">Multi Dialog</Button>
175
+ <div v-if="result">Result: {{ result }}</div>
176
+ </template>
177
+ `.trim(),
178
+ },
179
+ },
180
+ },
88
181
  render: () => ({
89
182
  components: { Button },
90
183
  setup () {
@@ -110,7 +203,23 @@ export const MultiDialog: Story = {
110
203
  }
111
204
 
112
205
  export const WithTypes: Story = {
113
- parameters: noControls,
206
+ parameters: {
207
+ ...noControls,
208
+ docs: {
209
+ source: {
210
+ code: `
211
+ <script setup lang="ts">
212
+ const { confirm, alert, destroy } = useDialog()
213
+
214
+ confirm({ title: 'Warning', type: 'warn', message: 'This operation may affect your data.' })
215
+ alert({ title: 'Information', type: 'info', message: 'Your changes have been saved.' })
216
+ alert({ title: 'Success', type: 'success', message: 'Payment completed successfully.' })
217
+ destroy({ title: 'Delete Account', message: 'All data will be permanently removed.' })
218
+ </script>
219
+ `.trim(),
220
+ },
221
+ },
222
+ },
114
223
  render: () => ({
115
224
  components: { Button },
116
225
  setup () {
@@ -120,7 +120,24 @@ export const Default: Story = {}
120
120
 
121
121
  /** Batch actions with row selection and dual toolbars */
122
122
  export const WithBatchActions: Story = {
123
- parameters: noControls,
123
+ parameters: {
124
+ ...noControls,
125
+ docs: {
126
+ source: {
127
+ code: `
128
+ <template>
129
+ <AsyncDataTable
130
+ :columns="columns"
131
+ :fetchMethod="mockFetch"
132
+ :batchActions="batchActions"
133
+ v-model:selection="selection"
134
+ showTopToolbar
135
+ />
136
+ </template>
137
+ `.trim(),
138
+ },
139
+ },
140
+ },
124
141
  render: () => ({
125
142
  components: { AsyncDataTable },
126
143
  setup () {
@@ -144,7 +161,24 @@ export const WithBatchActions: Story = {
144
161
 
145
162
  /** Custom toolbar slot with action button */
146
163
  export const WithCustomToolbar: Story = {
147
- parameters: noControls,
164
+ parameters: {
165
+ ...noControls,
166
+ docs: {
167
+ source: {
168
+ code: `
169
+ <template>
170
+ <AsyncDataTable :columns="columns" :fetchMethod="mockFetch" showTopToolbar>
171
+ <template #toolbar>
172
+ <button class="rounded-md bg-primary px-3 py-1.5 text-sm text-primary-foreground">
173
+ + Add User
174
+ </button>
175
+ </template>
176
+ </AsyncDataTable>
177
+ </template>
178
+ `.trim(),
179
+ },
180
+ },
181
+ },
148
182
  render: () => ({
149
183
  components: { AsyncDataTable },
150
184
  setup: () => ({ columns, mockFetch }),
@@ -37,7 +37,20 @@ const noControls = { controls: { disable: true }} satisfies Story['parameters']
37
37
  export const Default: Story = {}
38
38
 
39
39
  export const Sizes: Story = {
40
- parameters: noControls,
40
+ parameters: {
41
+ ...noControls,
42
+ docs: {
43
+ source: {
44
+ code: `
45
+ <template>
46
+ <div class="flex items-end gap-4">
47
+ <Avatar v-for="s in sizes" :key="s" :size="s" label="AB" />
48
+ </div>
49
+ </template>
50
+ `.trim(),
51
+ },
52
+ },
53
+ },
41
54
  render: () => ({
42
55
  components: { Avatar },
43
56
  setup: () => ({ sizes }),
@@ -53,7 +66,20 @@ export const Sizes: Story = {
53
66
  }
54
67
 
55
68
  export const Shapes: Story = {
56
- parameters: noControls,
69
+ parameters: {
70
+ ...noControls,
71
+ docs: {
72
+ source: {
73
+ code: `
74
+ <template>
75
+ <div class="flex items-center gap-4">
76
+ <Avatar v-for="sh in shapes" :key="sh" :shape="sh" label="AB" size="large" />
77
+ </div>
78
+ </template>
79
+ `.trim(),
80
+ },
81
+ },
82
+ },
57
83
  render: () => ({
58
84
  components: { Avatar },
59
85
  setup: () => ({ shapes }),
@@ -69,7 +95,21 @@ export const Shapes: Story = {
69
95
  }
70
96
 
71
97
  export const WithImage: Story = {
72
- parameters: noControls,
98
+ parameters: {
99
+ ...noControls,
100
+ docs: {
101
+ source: {
102
+ code: `
103
+ <template>
104
+ <div class="flex items-center gap-4">
105
+ <Avatar image="https://i.pravatar.cc/150?u=1" size="large" />
106
+ <Avatar image="https://i.pravatar.cc/150?u=2" size="large" shape="square" />
107
+ </div>
108
+ </template>
109
+ `.trim(),
110
+ },
111
+ },
112
+ },
73
113
  render: () => ({
74
114
  components: { Avatar },
75
115
  template: `
@@ -82,7 +122,21 @@ export const WithImage: Story = {
82
122
  }
83
123
 
84
124
  export const FallbackLabel: Story = {
85
- parameters: noControls,
125
+ parameters: {
126
+ ...noControls,
127
+ docs: {
128
+ source: {
129
+ code: `
130
+ <template>
131
+ <div class="flex items-center gap-4">
132
+ <Avatar label="John Doe" fallback-label="JD" />
133
+ <Avatar fallback-label="??" />
134
+ </div>
135
+ </template>
136
+ `.trim(),
137
+ },
138
+ },
139
+ },
86
140
  render: () => ({
87
141
  components: { Avatar },
88
142
  template: `
@@ -29,7 +29,20 @@ const noControls = { controls: { disable: true }} satisfies Story['parameters']
29
29
  export const Default: Story = {}
30
30
 
31
31
  export const Variants: Story = {
32
- parameters: noControls,
32
+ parameters: {
33
+ ...noControls,
34
+ docs: {
35
+ source: {
36
+ code: `
37
+ <template>
38
+ <div class="flex flex-wrap items-center gap-3">
39
+ <Badge v-for="v in variants" :key="v" :variant="v">{{ v }}</Badge>
40
+ </div>
41
+ </template>
42
+ `.trim(),
43
+ },
44
+ },
45
+ },
33
46
  render: () => ({
34
47
  components: { Badge },
35
48
  setup: () => ({ variants }),
@@ -42,7 +55,23 @@ export const Variants: Story = {
42
55
  }
43
56
 
44
57
  export const Numeric: Story = {
45
- parameters: noControls,
58
+ parameters: {
59
+ ...noControls,
60
+ docs: {
61
+ source: {
62
+ code: `
63
+ <template>
64
+ <div class="flex flex-wrap items-center gap-3">
65
+ <Badge>1</Badge>
66
+ <Badge variant="secondary">42</Badge>
67
+ <Badge variant="destructive">99+</Badge>
68
+ <Badge variant="outline">0</Badge>
69
+ </div>
70
+ </template>
71
+ `.trim(),
72
+ },
73
+ },
74
+ },
46
75
  render: () => ({
47
76
  components: { Badge },
48
77
  template: `
@@ -57,7 +86,23 @@ export const Numeric: Story = {
57
86
  }
58
87
 
59
88
  export const WithIcons: Story = {
60
- parameters: noControls,
89
+ parameters: {
90
+ ...noControls,
91
+ docs: {
92
+ source: {
93
+ code: `
94
+ <template>
95
+ <div class="flex flex-wrap items-center gap-3">
96
+ <Badge><Icon name="check" /> Approved</Badge>
97
+ <Badge variant="secondary"><Icon name="clock" /> Pending</Badge>
98
+ <Badge variant="destructive"><Icon name="x" /> Rejected</Badge>
99
+ <Badge variant="outline"><Icon name="star" /> Featured</Badge>
100
+ </div>
101
+ </template>
102
+ `.trim(),
103
+ },
104
+ },
105
+ },
61
106
  render: () => ({
62
107
  components: { Badge, Icon },
63
108
  template: `
@@ -40,29 +40,18 @@ const noControls = { controls: { disable: true }} satisfies Story['parameters']
40
40
 
41
41
  export const Default: Story = {}
42
42
 
43
- export const WithHome: Story = {
44
- parameters: noControls,
45
- render: () => ({
46
- components: { Breadcrumb },
47
- setup: () => ({ home, basicItems }),
48
- template: '<Breadcrumb :home="home" :model="basicItems" />',
49
- }),
50
- }
51
-
52
43
  export const WithIcons: Story = {
53
44
  parameters: noControls,
54
- render: () => ({
55
- components: { Breadcrumb },
56
- setup: () => ({ home, withIconItems }),
57
- template: '<Breadcrumb :home="home" :model="withIconItems" />',
58
- }),
45
+ args: {
46
+ home,
47
+ model: withIconItems,
48
+ },
59
49
  }
60
50
 
61
51
  export const SingleItem: Story = {
62
52
  parameters: noControls,
63
- render: () => ({
64
- components: { Breadcrumb },
65
- setup: () => ({ home }),
66
- template: '<Breadcrumb :home="home" />',
67
- }),
53
+ args: {
54
+ home,
55
+ model: undefined,
56
+ },
68
57
  }