@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
@@ -31,7 +31,20 @@ const noControls = { controls: { disable: true }} satisfies Story['parameters']
31
31
  export const Default: Story = {}
32
32
 
33
33
  export const Colors: Story = {
34
- parameters: noControls,
34
+ parameters: {
35
+ ...noControls,
36
+ docs: {
37
+ source: {
38
+ code: `
39
+ <template>
40
+ <div class="flex flex-wrap items-center gap-3">
41
+ <Tag v-for="c in colors" :key="c" :color="c">{{ c }}</Tag>
42
+ </div>
43
+ </template>
44
+ `.trim(),
45
+ },
46
+ },
47
+ },
35
48
  render: () => ({
36
49
  components: { Tag },
37
50
  setup: () => ({ colors }),
@@ -44,7 +57,20 @@ export const Colors: Story = {
44
57
  }
45
58
 
46
59
  export const Variants: Story = {
47
- parameters: noControls,
60
+ parameters: {
61
+ ...noControls,
62
+ docs: {
63
+ source: {
64
+ code: `
65
+ <template>
66
+ <div class="flex flex-wrap items-center gap-3">
67
+ <Tag v-for="v in variants" :key="v" :variant="v">{{ v }}</Tag>
68
+ </div>
69
+ </template>
70
+ `.trim(),
71
+ },
72
+ },
73
+ },
48
74
  render: () => ({
49
75
  components: { Tag },
50
76
  setup: () => ({ variants }),
@@ -57,7 +83,23 @@ export const Variants: Story = {
57
83
  }
58
84
 
59
85
  export const VariantColorMatrix: Story = {
60
- parameters: noControls,
86
+ parameters: {
87
+ ...noControls,
88
+ docs: {
89
+ source: {
90
+ code: `
91
+ <template>
92
+ <div class="space-y-3">
93
+ <div v-for="v in variants" :key="v" class="flex flex-wrap items-center gap-3">
94
+ <span class="w-20 text-sm text-muted-foreground">{{ v }}</span>
95
+ <Tag v-for="c in colors" :key="c" :color="c" :variant="v">{{ c }}</Tag>
96
+ </div>
97
+ </div>
98
+ </template>
99
+ `.trim(),
100
+ },
101
+ },
102
+ },
61
103
  render: () => ({
62
104
  components: { Tag },
63
105
  setup: () => ({ colors, variants }),
@@ -1,4 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/vue3'
2
+ import EventLog from '#storybook/EventLog.vue'
2
3
  import Textarea from './index.vue'
3
4
 
4
5
  const meta = {
@@ -10,8 +11,6 @@ const meta = {
10
11
  rows: { control: 'number' },
11
12
  invalid: { control: 'boolean' },
12
13
  class: { control: 'text' },
13
- disabled: { control: 'boolean' },
14
- readonly: { control: 'boolean' },
15
14
  },
16
15
  args: {
17
16
  modelValue: '',
@@ -19,8 +18,6 @@ const meta = {
19
18
  rows: undefined,
20
19
  invalid: false,
21
20
  class: '',
22
- disabled: false,
23
- readonly: false,
24
21
  },
25
22
  render: args => ({
26
23
  components: { Textarea },
@@ -31,7 +28,7 @@ const meta = {
31
28
  </div>
32
29
  `,
33
30
  }),
34
- } satisfies Meta
31
+ } satisfies Meta<typeof Textarea>
35
32
 
36
33
  export default meta
37
34
  type Story = StoryObj<typeof meta>
@@ -41,7 +38,18 @@ const noControls = { controls: { disable: true }} satisfies Story['parameters']
41
38
  export const Default: Story = {}
42
39
 
43
40
  export const WithRows: Story = {
44
- parameters: noControls,
41
+ parameters: {
42
+ ...noControls,
43
+ docs: {
44
+ source: {
45
+ code: `
46
+ <template>
47
+ <Textarea :rows="6" placeholder="6 rows of height" />
48
+ </template>
49
+ `.trim(),
50
+ },
51
+ },
52
+ },
45
53
  render: () => ({
46
54
  components: { Textarea },
47
55
  template: `
@@ -54,36 +62,74 @@ export const WithRows: Story = {
54
62
 
55
63
  export const Invalid: Story = {
56
64
  parameters: noControls,
65
+ args: {
66
+ invalid: true,
67
+ modelValue: 'Invalid content',
68
+ },
69
+ }
70
+
71
+ export const Disabled: Story = {
72
+ parameters: {
73
+ ...noControls,
74
+ docs: {
75
+ source: {
76
+ code: `
77
+ <template>
78
+ <Textarea disabled model-value="Disabled textarea" />
79
+ </template>
80
+ `.trim(),
81
+ },
82
+ },
83
+ },
57
84
  render: () => ({
58
85
  components: { Textarea },
59
86
  template: `
60
87
  <div class="max-w-sm">
61
- <Textarea invalid model-value="Invalid content" />
88
+ <Textarea disabled model-value="Disabled textarea" />
62
89
  </div>
63
90
  `,
64
91
  }),
65
92
  }
66
93
 
67
- export const Disabled: Story = {
68
- parameters: noControls,
94
+ export const Readonly: Story = {
95
+ parameters: {
96
+ ...noControls,
97
+ docs: {
98
+ source: {
99
+ code: `
100
+ <template>
101
+ <Textarea readonly model-value="Readonly content" />
102
+ </template>
103
+ `.trim(),
104
+ },
105
+ },
106
+ },
69
107
  render: () => ({
70
108
  components: { Textarea },
71
109
  template: `
72
110
  <div class="max-w-sm">
73
- <Textarea disabled model-value="Disabled textarea" />
111
+ <Textarea readonly model-value="Readonly content" />
74
112
  </div>
75
113
  `,
76
114
  }),
77
115
  }
78
116
 
79
- export const Readonly: Story = {
117
+ export const EventHandling: Story = {
80
118
  parameters: noControls,
81
119
  render: () => ({
82
- components: { Textarea },
120
+ components: { Textarea, EventLog },
121
+ setup: () => ({ value: ref('') }),
83
122
  template: `
84
- <div class="max-w-sm">
85
- <Textarea readonly model-value="Readonly content" />
86
- </div>
123
+ <EventLog v-slot="{ record }">
124
+ <div class="max-w-sm">
125
+ <Textarea
126
+ v-model="value"
127
+ placeholder="Type to see events"
128
+ @update:modelValue="(v) => record('update:modelValue', v)"
129
+ @change="(v) => record('change', v)"
130
+ />
131
+ </div>
132
+ </EventLog>
87
133
  `,
88
134
  }),
89
135
  }
@@ -37,7 +37,35 @@ const noControls = { controls: { disable: true }} satisfies Story['parameters']
37
37
  export const Default: Story = {}
38
38
 
39
39
  export const Types: Story = {
40
- parameters: noControls,
40
+ parameters: {
41
+ ...noControls,
42
+ docs: {
43
+ source: {
44
+ code: `
45
+ <script setup lang="ts">
46
+ import { toast } from 'vue-sonner'
47
+
48
+ const showDefault = () => toast('This is a default toast')
49
+ const showSuccess = () => toast.success('Operation completed successfully')
50
+ const showError = () => toast.error('Something went wrong')
51
+ const showInfo = () => toast.info('Here is some information')
52
+ const showWarning = () => toast.warning('Please be careful')
53
+ </script>
54
+
55
+ <template>
56
+ <Toast position="bottom-right" />
57
+ <div class="flex flex-wrap gap-3">
58
+ <Button variant="outline" @click="showDefault">Default</Button>
59
+ <Button variant="outline" @click="showSuccess">Success</Button>
60
+ <Button variant="outline" @click="showError">Error</Button>
61
+ <Button variant="outline" @click="showInfo">Info</Button>
62
+ <Button variant="outline" @click="showWarning">Warning</Button>
63
+ </div>
64
+ </template>
65
+ `.trim(),
66
+ },
67
+ },
68
+ },
41
69
  render: () => ({
42
70
  components: { Toast, Button },
43
71
  setup () {
@@ -64,7 +92,27 @@ export const Types: Story = {
64
92
  }
65
93
 
66
94
  export const WithDescription: Story = {
67
- parameters: noControls,
95
+ parameters: {
96
+ ...noControls,
97
+ docs: {
98
+ source: {
99
+ code: `
100
+ <script setup lang="ts">
101
+ import { toast } from 'vue-sonner'
102
+
103
+ const show = () => toast('Event created', {
104
+ description: 'Your event has been scheduled for tomorrow at 3:00 PM.',
105
+ })
106
+ </script>
107
+
108
+ <template>
109
+ <Toast position="bottom-right" />
110
+ <Button variant="outline" @click="show">Show Toast with Description</Button>
111
+ </template>
112
+ `.trim(),
113
+ },
114
+ },
115
+ },
68
116
  render: () => ({
69
117
  components: { Toast, Button },
70
118
  setup () {
@@ -83,7 +131,33 @@ export const WithDescription: Story = {
83
131
  }
84
132
 
85
133
  export const Positions: Story = {
86
- parameters: noControls,
134
+ parameters: {
135
+ ...noControls,
136
+ docs: {
137
+ source: {
138
+ code: `
139
+ <script setup lang="ts">
140
+ import { toast } from 'vue-sonner'
141
+
142
+ const positions = [ 'top-left', 'top-right', 'bottom-left', 'bottom-right', 'top-center', 'bottom-center' ] as const
143
+ const current = ref<typeof positions[number]>('bottom-right')
144
+
145
+ const show = (pos: typeof positions[number]) => {
146
+ current.value = pos
147
+ nextTick(() => toast(\`Toast at \${pos}\`))
148
+ }
149
+ </script>
150
+
151
+ <template>
152
+ <Toast :position="current" />
153
+ <div class="flex flex-wrap gap-3">
154
+ <Button v-for="p in positions" :key="p" variant="outline" @click="show(p)">{{ p }}</Button>
155
+ </div>
156
+ </template>
157
+ `.trim(),
158
+ },
159
+ },
160
+ },
87
161
  render: () => ({
88
162
  components: { Toast, Button },
89
163
  setup () {
@@ -1,4 +1,5 @@
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 Tooltip from './index.vue'
4
5
 
@@ -12,12 +13,14 @@ const meta = {
12
13
  position: { control: 'select', options: positions },
13
14
  disabled: { control: 'boolean' },
14
15
  disableClosingTrigger: { control: 'boolean' },
16
+ class: { control: 'text' },
15
17
  },
16
18
  args: {
17
19
  text: 'This is a tooltip',
18
20
  position: 'top',
19
21
  disabled: false,
20
22
  disableClosingTrigger: false,
23
+ class: '',
21
24
  },
22
25
  render: args => ({
23
26
  components: { Tooltip, Button },
@@ -38,7 +41,31 @@ const noControls = { controls: { disable: true }} satisfies Story['parameters']
38
41
  export const Default: Story = {}
39
42
 
40
43
  export const Positions: Story = {
41
- parameters: noControls,
44
+ parameters: {
45
+ ...noControls,
46
+ docs: {
47
+ source: {
48
+ code: `
49
+ <template>
50
+ <div class="flex flex-wrap items-center gap-4 py-10 justify-center">
51
+ <Tooltip text="Top tooltip" position="top">
52
+ <Button variant="outline">Top</Button>
53
+ </Tooltip>
54
+ <Tooltip text="Bottom tooltip" position="bottom">
55
+ <Button variant="outline">Bottom</Button>
56
+ </Tooltip>
57
+ <Tooltip text="Left tooltip" position="left">
58
+ <Button variant="outline">Left</Button>
59
+ </Tooltip>
60
+ <Tooltip text="Right tooltip" position="right">
61
+ <Button variant="outline">Right</Button>
62
+ </Tooltip>
63
+ </div>
64
+ </template>
65
+ `.trim(),
66
+ },
67
+ },
68
+ },
42
69
  render: () => ({
43
70
  components: { Tooltip, Button },
44
71
  template: `
@@ -61,7 +88,20 @@ export const Positions: Story = {
61
88
  }
62
89
 
63
90
  export const LongText: Story = {
64
- parameters: noControls,
91
+ parameters: {
92
+ ...noControls,
93
+ docs: {
94
+ source: {
95
+ code: `
96
+ <template>
97
+ <Tooltip text="This is a longer tooltip message that demonstrates how the tooltip handles multi-line content and wraps properly within its container.">
98
+ <Button variant="outline">Long Tooltip</Button>
99
+ </Tooltip>
100
+ </template>
101
+ `.trim(),
102
+ },
103
+ },
104
+ },
65
105
  render: () => ({
66
106
  components: { Tooltip, Button },
67
107
  template: `
@@ -71,3 +111,21 @@ export const LongText: Story = {
71
111
  `,
72
112
  }),
73
113
  }
114
+
115
+ export const EventHandling: Story = {
116
+ parameters: noControls,
117
+ render: () => ({
118
+ components: { Tooltip, Button, EventLog },
119
+ template: `
120
+ <EventLog v-slot="{ record }">
121
+ <Tooltip
122
+ text="Hover or focus to fire events"
123
+ @open="record('open')"
124
+ @close="record('close')"
125
+ >
126
+ <Button variant="outline">Hover me</Button>
127
+ </Tooltip>
128
+ </EventLog>
129
+ `,
130
+ }),
131
+ }
@@ -39,7 +39,18 @@ const noControls = { controls: { disable: true }} satisfies Story['parameters']
39
39
  export const Default: Story = {}
40
40
 
41
41
  export const ExternalLink: Story = {
42
- parameters: noControls,
42
+ parameters: {
43
+ ...noControls,
44
+ docs: {
45
+ source: {
46
+ code: `
47
+ <template>
48
+ <WebLink href="https://example.com">Visit Example.com</WebLink>
49
+ </template>
50
+ `.trim(),
51
+ },
52
+ },
53
+ },
43
54
  render: () => ({
44
55
  components: { WebLink },
45
56
  template: `
@@ -53,26 +64,36 @@ export const ExternalLink: Story = {
53
64
 
54
65
  export const ExternalWithoutIcon: Story = {
55
66
  parameters: noControls,
56
- render: () => ({
57
- components: { WebLink },
58
- template: `
59
- <WebLink href="https://example.com" :externalIcon="false">No trailing icon</WebLink>
60
- `,
61
- }),
67
+ args: {
68
+ href: 'https://example.com',
69
+ externalIcon: false,
70
+ },
62
71
  }
63
72
 
64
73
  export const WithExplicitTarget: Story = {
65
74
  parameters: noControls,
66
- render: () => ({
67
- components: { WebLink },
68
- template: `
69
- <WebLink href="https://example.com" target="_self">Same Tab External Link</WebLink>
70
- `,
71
- }),
75
+ args: {
76
+ href: 'https://example.com',
77
+ target: '_self',
78
+ },
72
79
  }
73
80
 
74
81
  export const Unstyled: Story = {
75
- parameters: noControls,
82
+ parameters: {
83
+ ...noControls,
84
+ docs: {
85
+ source: {
86
+ code: `
87
+ <template>
88
+ <div class="flex flex-col gap-2">
89
+ <WebLink href="/settings" unstyled>Unstyled internal link (no color or underline)</WebLink>
90
+ <WebLink href="https://example.com" unstyled>Unstyled external link (icon still shows)</WebLink>
91
+ </div>
92
+ </template>
93
+ `.trim(),
94
+ },
95
+ },
96
+ },
76
97
  render: () => ({
77
98
  components: { WebLink },
78
99
  template: `
@@ -85,7 +106,24 @@ export const Unstyled: Story = {
85
106
  }
86
107
 
87
108
  export const InlineUsage: Story = {
88
- parameters: noControls,
109
+ parameters: {
110
+ ...noControls,
111
+ docs: {
112
+ source: {
113
+ code: `
114
+ <template>
115
+ <p class="text-sm">
116
+ Please read our
117
+ <WebLink href="https://example.com/terms">Terms of Service</WebLink>
118
+ and
119
+ <WebLink href="https://example.com/privacy">Privacy Policy</WebLink>
120
+ before continuing.
121
+ </p>
122
+ </template>
123
+ `.trim(),
124
+ },
125
+ },
126
+ },
89
127
  render: () => ({
90
128
  components: { WebLink },
91
129
  template: `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polymarbot/nuxt-layer-shadcn-ui",
3
- "version": "0.3.10",
3
+ "version": "0.4.0",
4
4
  "description": "Nuxt layer providing shadcn-vue based UI components",
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",
@@ -42,5 +42,5 @@
42
42
  "vue-i18n": "^11",
43
43
  "vue-router": "^4 || ^5"
44
44
  },
45
- "gitHead": "aba25283d8cf93bf3223b3b59da5ff8016615f98"
45
+ "gitHead": "7002e8d3028a6ac324296d4657cb313d7ed888e7"
46
46
  }