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

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
@@ -92,7 +92,23 @@ const noControls = { controls: { disable: true }} satisfies Story['parameters']
92
92
  export const Default: Story = {}
93
93
 
94
94
  export const SingleSelection: Story = {
95
- parameters: noControls,
95
+ parameters: {
96
+ ...noControls,
97
+ docs: {
98
+ source: {
99
+ code: `
100
+ <template>
101
+ <DataTable
102
+ :data="data"
103
+ :columns="columns"
104
+ selectionMode="single"
105
+ v-model:selection="selection"
106
+ />
107
+ </template>
108
+ `.trim(),
109
+ },
110
+ },
111
+ },
96
112
  render: () => ({
97
113
  components: { DataTable: DataTable as any },
98
114
  setup () {
@@ -116,7 +132,23 @@ export const SingleSelection: Story = {
116
132
  }
117
133
 
118
134
  export const MultipleSelection: Story = {
119
- parameters: noControls,
135
+ parameters: {
136
+ ...noControls,
137
+ docs: {
138
+ source: {
139
+ code: `
140
+ <template>
141
+ <DataTable
142
+ :data="data"
143
+ :columns="columns"
144
+ selectionMode="multiple"
145
+ v-model:selection="selection"
146
+ />
147
+ </template>
148
+ `.trim(),
149
+ },
150
+ },
151
+ },
120
152
  render: () => ({
121
153
  components: { DataTable: DataTable as any },
122
154
  setup () {
@@ -140,7 +172,23 @@ export const MultipleSelection: Story = {
140
172
  }
141
173
 
142
174
  export const Sortable: Story = {
143
- parameters: noControls,
175
+ parameters: {
176
+ ...noControls,
177
+ docs: {
178
+ source: {
179
+ code: `
180
+ <template>
181
+ <DataTable
182
+ :data="sortedData"
183
+ :columns="sortableColumns"
184
+ v-model:sortBy="sortBy"
185
+ v-model:sortOrder="sortOrder"
186
+ />
187
+ </template>
188
+ `.trim(),
189
+ },
190
+ },
191
+ },
144
192
  render: () => ({
145
193
  components: { DataTable: DataTable as any },
146
194
  setup () {
@@ -177,7 +225,18 @@ export const Sortable: Story = {
177
225
  }
178
226
 
179
227
  export const ColumnTypes: Story = {
180
- parameters: noControls,
228
+ parameters: {
229
+ ...noControls,
230
+ docs: {
231
+ source: {
232
+ code: `
233
+ <template>
234
+ <DataTable :data="data" :columns="typeColumns" />
235
+ </template>
236
+ `.trim(),
237
+ },
238
+ },
239
+ },
181
240
  render: () => ({
182
241
  components: { DataTable: DataTable as any },
183
242
  setup: () => ({ data: sampleData, typeColumns }),
@@ -190,7 +249,27 @@ export const ColumnTypes: Story = {
190
249
  }
191
250
 
192
251
  export const CustomSlots: Story = {
193
- parameters: noControls,
252
+ parameters: {
253
+ ...noControls,
254
+ docs: {
255
+ source: {
256
+ code: `
257
+ <template>
258
+ <DataTable :data="data" :columns="columns">
259
+ <template #status="{ value }">
260
+ <Tag :color="value === 'active' ? 'success' : 'default'">
261
+ {{ value }}
262
+ </Tag>
263
+ </template>
264
+ <template #amount="{ value }">
265
+ <span class="font-mono font-medium">\${{ Number(value).toFixed(2) }}</span>
266
+ </template>
267
+ </DataTable>
268
+ </template>
269
+ `.trim(),
270
+ },
271
+ },
272
+ },
194
273
  render: () => ({
195
274
  components: { DataTable: DataTable as any, Tag },
196
275
  setup: () => ({ data: sampleData, slotColumns }),
@@ -212,7 +291,32 @@ export const CustomSlots: Story = {
212
291
  }
213
292
 
214
293
  export const SlotEmptyFallback: Story = {
215
- parameters: noControls,
294
+ parameters: {
295
+ ...noControls,
296
+ docs: {
297
+ source: {
298
+ code: `
299
+ <template>
300
+ <DataTable :data="data" :columns="columns">
301
+ <template #status="{ value }">
302
+ <Tag
303
+ v-if="value === 'active' || value === 'inactive'"
304
+ :color="value === 'active' ? 'success' : 'default'"
305
+ >
306
+ {{ value }}
307
+ </Tag>
308
+ </template>
309
+ <template #action="{ value }">
310
+ <button v-if="value" class="text-sm text-primary underline">
311
+ {{ value }}
312
+ </button>
313
+ </template>
314
+ </DataTable>
315
+ </template>
316
+ `.trim(),
317
+ },
318
+ },
319
+ },
216
320
  render: () => ({
217
321
  components: { DataTable: DataTable as any, Tag },
218
322
  setup () {
@@ -252,7 +356,14 @@ export const SlotEmptyFallback: Story = {
252
356
  }
253
357
 
254
358
  export const EmptyState: Story = {
255
- parameters: noControls,
359
+ parameters: {
360
+ ...noControls,
361
+ docs: {
362
+ source: {
363
+ code: '<DataTable :data="[]" :columns="columns" />',
364
+ },
365
+ },
366
+ },
256
367
  render: () => ({
257
368
  components: { DataTable: DataTable as any },
258
369
  setup: () => ({ basicColumns }),
@@ -265,7 +376,26 @@ export const EmptyState: Story = {
265
376
  }
266
377
 
267
378
  export const FooterSlot: Story = {
268
- parameters: noControls,
379
+ parameters: {
380
+ ...noControls,
381
+ docs: {
382
+ source: {
383
+ code: `
384
+ <template>
385
+ <DataTable :data="data" :columns="columns">
386
+ <template #footer>
387
+ <tr class="h-12 border-t text-sm font-medium">
388
+ <td class="px-4">Total</td>
389
+ <td class="px-4" colspan="2"></td>
390
+ <td class="px-4 font-mono">\${{ data.reduce((sum, r) => sum + r.amount, 0).toFixed(2) }}</td>
391
+ </tr>
392
+ </template>
393
+ </DataTable>
394
+ </template>
395
+ `.trim(),
396
+ },
397
+ },
398
+ },
269
399
  render: () => ({
270
400
  components: { DataTable: DataTable as any, Tag },
271
401
  setup: () => ({ data: sampleData, slotColumns }),
@@ -286,7 +416,27 @@ export const FooterSlot: Story = {
286
416
  }
287
417
 
288
418
  export const FrozenColumns: Story = {
289
- parameters: noControls,
419
+ parameters: {
420
+ ...noControls,
421
+ docs: {
422
+ source: {
423
+ code: `
424
+ <template>
425
+ <DataTable
426
+ :data="data"
427
+ :columns="frozenColumns"
428
+ selectionMode="multiple"
429
+ v-model:selection="selection"
430
+ >
431
+ <template #id>
432
+ <button class="text-sm text-primary underline">Edit</button>
433
+ </template>
434
+ </DataTable>
435
+ </template>
436
+ `.trim(),
437
+ },
438
+ },
439
+ },
290
440
  render: () => ({
291
441
  components: { DataTable: DataTable as any },
292
442
  setup () {
@@ -311,7 +461,14 @@ export const FrozenColumns: Story = {
311
461
  }
312
462
 
313
463
  export const Loading: Story = {
314
- parameters: noControls,
464
+ parameters: {
465
+ ...noControls,
466
+ docs: {
467
+ source: {
468
+ code: '<DataTable :data="data" :columns="columns" loading />',
469
+ },
470
+ },
471
+ },
315
472
  render: () => ({
316
473
  components: { DataTable: DataTable as any },
317
474
  setup: () => ({ data: sampleData, basicColumns }),
@@ -324,7 +481,23 @@ export const Loading: Story = {
324
481
  }
325
482
 
326
483
  export const RowClick: Story = {
327
- parameters: noControls,
484
+ parameters: {
485
+ ...noControls,
486
+ docs: {
487
+ source: {
488
+ code: `
489
+ <template>
490
+ <DataTable
491
+ :data="data"
492
+ :columns="columns"
493
+ clickable
494
+ @rowClick="row => lastClicked = row"
495
+ />
496
+ </template>
497
+ `.trim(),
498
+ },
499
+ },
500
+ },
328
501
  render: () => ({
329
502
  components: { DataTable: DataTable as any },
330
503
  setup () {
@@ -56,7 +56,14 @@ const noControls = { controls: { disable: true }} satisfies Story['parameters']
56
56
  export const Default: Story = {}
57
57
 
58
58
  export const MonthPicker: Story = {
59
- parameters: noControls,
59
+ parameters: {
60
+ ...noControls,
61
+ docs: {
62
+ source: {
63
+ code: '<DatePicker v-model="month" type="month" placeholder="Pick a month" />',
64
+ },
65
+ },
66
+ },
60
67
  render: () => ({
61
68
  components: { DatePicker },
62
69
  setup () {
@@ -73,7 +80,14 @@ export const MonthPicker: Story = {
73
80
  }
74
81
 
75
82
  export const YearPicker: Story = {
76
- parameters: noControls,
83
+ parameters: {
84
+ ...noControls,
85
+ docs: {
86
+ source: {
87
+ code: '<DatePicker v-model="year" type="year" placeholder="Pick a year" />',
88
+ },
89
+ },
90
+ },
77
91
  render: () => ({
78
92
  components: { DatePicker },
79
93
  setup () {
@@ -90,7 +104,14 @@ export const YearPicker: Story = {
90
104
  }
91
105
 
92
106
  export const WithTime: Story = {
93
- parameters: noControls,
107
+ parameters: {
108
+ ...noControls,
109
+ docs: {
110
+ source: {
111
+ code: '<DatePicker v-model="date" showTime />',
112
+ },
113
+ },
114
+ },
94
115
  render: () => ({
95
116
  components: { DatePicker },
96
117
  setup () {
@@ -107,7 +128,14 @@ export const WithTime: Story = {
107
128
  }
108
129
 
109
130
  export const Preselected: Story = {
110
- parameters: noControls,
131
+ parameters: {
132
+ ...noControls,
133
+ docs: {
134
+ source: {
135
+ code: '<DatePicker v-model="preselected" />',
136
+ },
137
+ },
138
+ },
111
139
  render: () => ({
112
140
  components: { DatePicker },
113
141
  setup () {
@@ -124,7 +152,14 @@ export const Preselected: Story = {
124
152
  }
125
153
 
126
154
  export const ValueFormat: Story = {
127
- parameters: noControls,
155
+ parameters: {
156
+ ...noControls,
157
+ docs: {
158
+ source: {
159
+ code: '<DatePicker v-model="formatted" valueFormat="yyyy-MM-dd" placeholder="Pick a date" />',
160
+ },
161
+ },
162
+ },
128
163
  render: () => ({
129
164
  components: { DatePicker },
130
165
  setup () {
@@ -141,7 +176,14 @@ export const ValueFormat: Story = {
141
176
  }
142
177
 
143
178
  export const Disabled: Story = {
144
- parameters: noControls,
179
+ parameters: {
180
+ ...noControls,
181
+ docs: {
182
+ source: {
183
+ code: '<DatePicker v-model="date" disabled />',
184
+ },
185
+ },
186
+ },
145
187
  render: () => ({
146
188
  components: { DatePicker },
147
189
  setup () {
@@ -157,7 +199,14 @@ export const Disabled: Story = {
157
199
  }
158
200
 
159
201
  export const Readonly: Story = {
160
- parameters: noControls,
202
+ parameters: {
203
+ ...noControls,
204
+ docs: {
205
+ source: {
206
+ code: '<DatePicker v-model="date" readonly />',
207
+ },
208
+ },
209
+ },
161
210
  render: () => ({
162
211
  components: { DatePicker },
163
212
  setup () {
@@ -56,7 +56,14 @@ const noControls = { controls: { disable: true }} satisfies Story['parameters']
56
56
  export const Default: Story = {}
57
57
 
58
58
  export const WithTime: Story = {
59
- parameters: noControls,
59
+ parameters: {
60
+ ...noControls,
61
+ docs: {
62
+ source: {
63
+ code: '<DateRangePicker v-model="withTime" showTime />',
64
+ },
65
+ },
66
+ },
60
67
  render: () => ({
61
68
  components: { DateRangePicker },
62
69
  setup () {
@@ -73,7 +80,14 @@ export const WithTime: Story = {
73
80
  }
74
81
 
75
82
  export const MaxSpanDays: Story = {
76
- parameters: noControls,
83
+ parameters: {
84
+ ...noControls,
85
+ docs: {
86
+ source: {
87
+ code: '<DateRangePicker v-model="maxSpan" :maxSpanDays="7" />',
88
+ },
89
+ },
90
+ },
77
91
  render: () => ({
78
92
  components: { DateRangePicker },
79
93
  setup () {
@@ -90,7 +104,14 @@ export const MaxSpanDays: Story = {
90
104
  }
91
105
 
92
106
  export const Preselected: Story = {
93
- parameters: noControls,
107
+ parameters: {
108
+ ...noControls,
109
+ docs: {
110
+ source: {
111
+ code: '<DateRangePicker v-model="preselected" />',
112
+ },
113
+ },
114
+ },
94
115
  render: () => ({
95
116
  components: { DateRangePicker },
96
117
  setup () {
@@ -110,7 +131,14 @@ export const Preselected: Story = {
110
131
  }
111
132
 
112
133
  export const Disabled: Story = {
113
- parameters: noControls,
134
+ parameters: {
135
+ ...noControls,
136
+ docs: {
137
+ source: {
138
+ code: '<DateRangePicker v-model="range" disabled />',
139
+ },
140
+ },
141
+ },
114
142
  render: () => ({
115
143
  components: { DateRangePicker },
116
144
  setup () {
@@ -129,7 +157,14 @@ export const Disabled: Story = {
129
157
  }
130
158
 
131
159
  export const Readonly: Story = {
132
- parameters: noControls,
160
+ parameters: {
161
+ ...noControls,
162
+ docs: {
163
+ source: {
164
+ code: '<DateRangePicker v-model="range" readonly />',
165
+ },
166
+ },
167
+ },
133
168
  render: () => ({
134
169
  components: { DateRangePicker },
135
170
  setup () {
@@ -37,22 +37,25 @@ const noControls = { controls: { disable: true }} satisfies Story['parameters']
37
37
 
38
38
  export const Default: Story = {}
39
39
 
40
- export const Horizontal: Story = {
41
- parameters: noControls,
42
- render: () => ({
43
- components: { Divider },
44
- template: `
45
- <div class="space-y-4">
46
- <p>Content above</p>
47
- <Divider />
48
- <p>Content below</p>
49
- </div>
50
- `,
51
- }),
52
- }
53
-
54
40
  export const Vertical: Story = {
55
- parameters: noControls,
41
+ parameters: {
42
+ ...noControls,
43
+ docs: {
44
+ source: {
45
+ code: `
46
+ <template>
47
+ <div class="flex h-8 items-center gap-4">
48
+ <span>Left</span>
49
+ <Divider type="vertical" />
50
+ <span>Center</span>
51
+ <Divider type="vertical" />
52
+ <span>Right</span>
53
+ </div>
54
+ </template>
55
+ `.trim(),
56
+ },
57
+ },
58
+ },
56
59
  render: () => ({
57
60
  components: { Divider },
58
61
  template: `
@@ -1,10 +1,13 @@
1
1
  import type { Meta, StoryObj } from '@storybook/vue3'
2
+ import EventLog from '#storybook/EventLog.vue'
2
3
  import Button from '../Button/index.vue'
3
4
  import Input from '../Input/index.vue'
5
+ import type { ButtonVariant } from '../Button/types'
4
6
  import type { DrawerSide } from './types'
5
7
  import Drawer from './index.vue'
6
8
 
7
9
  const sides: DrawerSide[] = [ 'top', 'right', 'bottom', 'left' ]
10
+ const buttonVariants: ButtonVariant[] = [ 'default', 'destructive', 'outline', 'secondary', 'ghost', 'link' ]
8
11
 
9
12
  const meta = {
10
13
  title: 'UI/Drawer',
@@ -23,6 +26,9 @@ const meta = {
23
26
  description: { control: 'text' },
24
27
  confirmText: { control: 'text' },
25
28
  cancelText: { control: 'text' },
29
+ confirmVariant: { control: 'select', options: buttonVariants },
30
+ cancelVariant: { control: 'select', options: buttonVariants },
31
+ class: { control: 'text' },
26
32
  },
27
33
  args: {
28
34
  loading: false,
@@ -38,6 +44,9 @@ const meta = {
38
44
  description: '',
39
45
  confirmText: 'OK',
40
46
  cancelText: 'Cancel',
47
+ confirmVariant: 'default',
48
+ cancelVariant: 'outline',
49
+ class: '',
41
50
  },
42
51
  render: args => ({
43
52
  components: { Drawer, Button, Input },
@@ -65,7 +74,29 @@ const noControls = { controls: { disable: true }} satisfies Story['parameters']
65
74
  export const Default: Story = {}
66
75
 
67
76
  export const WithDescription: Story = {
68
- parameters: noControls,
77
+ parameters: {
78
+ ...noControls,
79
+ docs: {
80
+ source: {
81
+ code: `
82
+ <template>
83
+ <Drawer
84
+ v-model:visible="visible"
85
+ title="Edit Profile"
86
+ description="Update your personal information. Changes will be visible to other users immediately."
87
+ showCancel
88
+ confirmText="Save"
89
+ >
90
+ <div class="space-y-3">
91
+ <Input placeholder="Name" />
92
+ <Input placeholder="Email" />
93
+ </div>
94
+ </Drawer>
95
+ </template>
96
+ `.trim(),
97
+ },
98
+ },
99
+ },
69
100
  render: () => ({
70
101
  components: { Drawer, Button, Input },
71
102
  setup () {
@@ -93,7 +124,24 @@ export const WithDescription: Story = {
93
124
  }
94
125
 
95
126
  export const ScrollableContent: Story = {
96
- parameters: noControls,
127
+ parameters: {
128
+ ...noControls,
129
+ docs: {
130
+ source: {
131
+ code: `
132
+ <template>
133
+ <Drawer v-model:visible="visible" title="Terms of Service" showCancel confirmText="Accept">
134
+ <div class="space-y-4">
135
+ <p v-for="i in 20" :key="i">
136
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit...
137
+ </p>
138
+ </div>
139
+ </Drawer>
140
+ </template>
141
+ `.trim(),
142
+ },
143
+ },
144
+ },
97
145
  render: () => ({
98
146
  components: { Drawer, Button },
99
147
  setup () {
@@ -116,7 +164,29 @@ export const ScrollableContent: Story = {
116
164
  }
117
165
 
118
166
  export const Sides: Story = {
119
- parameters: noControls,
167
+ parameters: {
168
+ ...noControls,
169
+ docs: {
170
+ source: {
171
+ code: `
172
+ <template>
173
+ <Drawer v-model:visible="sideTop" side="top" title="Top Drawer">
174
+ <p>Slides in from the top.</p>
175
+ </Drawer>
176
+ <Drawer v-model:visible="sideRight" side="right" title="Right Drawer">
177
+ <p>Slides in from the right.</p>
178
+ </Drawer>
179
+ <Drawer v-model:visible="sideBottom" side="bottom" title="Bottom Drawer">
180
+ <p>Slides in from the bottom.</p>
181
+ </Drawer>
182
+ <Drawer v-model:visible="sideLeft" side="left" title="Left Drawer">
183
+ <p>Slides in from the left.</p>
184
+ </Drawer>
185
+ </template>
186
+ `.trim(),
187
+ },
188
+ },
189
+ },
120
190
  render: () => ({
121
191
  components: { Drawer, Button },
122
192
  setup () {
@@ -151,32 +221,61 @@ export const Sides: Story = {
151
221
  }),
152
222
  }
153
223
 
224
+ export const WithTrigger: Story = {
225
+ parameters: {
226
+ ...noControls,
227
+ docs: {
228
+ source: {
229
+ code: `
230
+ <template>
231
+ <Drawer title="Drawer with Trigger">
232
+ <template #trigger>
233
+ <Button>Open Drawer</Button>
234
+ </template>
235
+ <p>The trigger slot lets the consumer place the open button directly inside the Drawer, without managing visible state.</p>
236
+ </Drawer>
237
+ </template>
238
+ `.trim(),
239
+ },
240
+ },
241
+ },
242
+ render: () => ({
243
+ components: { Drawer, Button },
244
+ template: `
245
+ <Drawer title="Drawer with Trigger">
246
+ <template #trigger>
247
+ <Button>Open Drawer</Button>
248
+ </template>
249
+ <p>The trigger slot lets the consumer place the open button directly inside the Drawer, without managing visible state.</p>
250
+ </Drawer>
251
+ `,
252
+ }),
253
+ }
254
+
154
255
  export const EventHandling: Story = {
155
256
  parameters: noControls,
156
257
  render: () => ({
157
- components: { Drawer, Button },
158
- setup () {
159
- const visible = ref(false)
160
- return { visible }
161
- },
258
+ components: { Drawer, Button, EventLog },
259
+ setup: () => ({ visible: ref(false) }),
162
260
  template: `
163
- <div>
261
+ <EventLog v-slot="{ record }">
164
262
  <Button @click="visible = true">Open Drawer</Button>
165
263
  <Drawer
166
264
  v-model:visible="visible"
167
265
  title="Event Demo"
168
- description="Open the Actions panel to see emitted events."
266
+ description="Each emitted event will be appended to the log below."
169
267
  showCancel
170
268
  confirmText="Confirm"
171
- @open="() => {}"
172
- @close="() => {}"
173
- @closed="() => {}"
174
- @confirm="() => {}"
175
- @cancel="() => {}"
269
+ @open="record('open')"
270
+ @close="record('close')"
271
+ @closed="record('closed')"
272
+ @confirm="record('confirm')"
273
+ @cancel="record('cancel')"
274
+ @update:visible="(v) => record('update:visible', v)"
176
275
  >
177
276
  <p>Click Confirm, Cancel, or the close button to see events fire.</p>
178
277
  </Drawer>
179
- </div>
278
+ </EventLog>
180
279
  `,
181
280
  }),
182
281
  }