@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.
Files changed (101) hide show
  1. package/app/assets/styles/colors.css +10 -10
  2. package/app/components/ui/Accordion/index.stories.ts +60 -56
  3. package/app/components/ui/Accordion/index.vue +1 -1
  4. package/app/components/ui/AdminLayout/SidebarMenus.vue +0 -2
  5. package/app/components/ui/AdminLayout/index.stories.ts +9 -8
  6. package/app/components/ui/Alert/index.stories.ts +28 -26
  7. package/app/components/ui/Alert/index.vue +6 -6
  8. package/app/components/ui/Alert/types.ts +2 -1
  9. package/app/components/ui/AlertDialog/index.stories.ts +85 -50
  10. package/app/components/ui/AsyncDataTable/index.stories.ts +53 -36
  11. package/app/components/ui/Avatar/index.stories.ts +56 -51
  12. package/app/components/ui/Avatar/index.vue +1 -1
  13. package/app/components/ui/Avatar/types.ts +5 -2
  14. package/app/components/ui/Badge/index.stories.ts +41 -41
  15. package/app/components/ui/Badge/index.vue +1 -1
  16. package/app/components/ui/Badge/types.ts +3 -1
  17. package/app/components/ui/Breadcrumb/index.stories.ts +48 -37
  18. package/app/components/ui/Breadcrumb/index.vue +1 -1
  19. package/app/components/ui/Button/index.stories.ts +94 -90
  20. package/app/components/ui/Button/index.vue +1 -1
  21. package/app/components/ui/Button/types.ts +4 -1
  22. package/app/components/ui/ButtonGroup/index.stories.ts +61 -49
  23. package/app/components/ui/Card/index.stories.ts +55 -47
  24. package/app/components/ui/Card/index.vue +1 -1
  25. package/app/components/ui/Checkbox/index.stories.ts +69 -46
  26. package/app/components/ui/Checkbox/index.vue +1 -1
  27. package/app/components/ui/CopyButton/index.stories.ts +89 -31
  28. package/app/components/ui/DataTable/index.stories.ts +218 -168
  29. package/app/components/ui/DataTable/index.vue +1 -1
  30. package/app/components/ui/DatePicker/index.stories.ts +131 -37
  31. package/app/components/ui/DateRangePicker/index.stories.ts +107 -33
  32. package/app/components/ui/Divider/index.stories.ts +46 -24
  33. package/app/components/ui/Divider/index.vue +1 -1
  34. package/app/components/ui/Drawer/index.stories.ts +131 -81
  35. package/app/components/ui/Drawer/index.vue +1 -1
  36. package/app/components/ui/Drawer/types.ts +1 -1
  37. package/app/components/ui/Dropdown/index.stories.ts +134 -89
  38. package/app/components/ui/Dropdown/index.vue +5 -1
  39. package/app/components/ui/Dropdown/types.ts +1 -1
  40. package/app/components/ui/FormItem/index.stories.ts +87 -43
  41. package/app/components/ui/FormItem/index.vue +1 -1
  42. package/app/components/ui/Help/index.stories.ts +46 -35
  43. package/app/components/ui/Icon/index.stories.ts +41 -43
  44. package/app/components/ui/Input/index.stories.ts +95 -41
  45. package/app/components/ui/Input/index.vue +1 -1
  46. package/app/components/ui/InputCurrency/index.stories.ts +89 -49
  47. package/app/components/ui/InputNumber/index.stories.ts +93 -29
  48. package/app/components/ui/InputNumber/index.vue +1 -1
  49. package/app/components/ui/InputOtp/index.stories.ts +6 -7
  50. package/app/components/ui/InputOtp/index.vue +1 -1
  51. package/app/components/ui/InputPercent/index.stories.ts +6 -7
  52. package/app/components/ui/InputRange/index.stories.ts +6 -7
  53. package/app/components/ui/Loading/index.stories.ts +19 -19
  54. package/app/components/ui/Markdown/index.stories.ts +7 -10
  55. package/app/components/ui/Modal/index.stories.ts +135 -80
  56. package/app/components/ui/Modal/index.vue +1 -1
  57. package/app/components/ui/Modal/types.ts +1 -1
  58. package/app/components/ui/ModalContent/index.stories.ts +54 -26
  59. package/app/components/ui/ModalContent/index.vue +2 -2
  60. package/app/components/ui/PageCard/index.stories.ts +177 -67
  61. package/app/components/ui/Pagination/index.stories.ts +68 -51
  62. package/app/components/ui/Pagination/index.vue +2 -2
  63. package/app/components/ui/Popover/index.stories.ts +47 -45
  64. package/app/components/ui/Popover/index.vue +1 -1
  65. package/app/components/ui/Qrcode/index.stories.ts +42 -34
  66. package/app/components/ui/RadioCardGroup/index.stories.ts +23 -32
  67. package/app/components/ui/RadioCardGroup/index.vue +1 -1
  68. package/app/components/ui/RadioGroup/index.stories.ts +123 -0
  69. package/app/components/ui/RadioGroup/index.vue +73 -0
  70. package/app/components/ui/RadioGroup/types.ts +13 -0
  71. package/app/components/ui/ScrollArea/index.stories.ts +69 -37
  72. package/app/components/ui/ScrollArea/index.vue +1 -1
  73. package/app/components/ui/SearchSelect/index.stories.ts +104 -66
  74. package/app/components/ui/Select/index.stories.ts +152 -98
  75. package/app/components/ui/Select/index.vue +3 -3
  76. package/app/components/ui/Skeleton/index.stories.ts +27 -30
  77. package/app/components/ui/Skeleton/index.vue +1 -1
  78. package/app/components/ui/Slider/index.stories.ts +73 -31
  79. package/app/components/ui/Slider/index.vue +1 -1
  80. package/app/components/ui/Surface/index.stories.ts +47 -21
  81. package/app/components/ui/Surface/index.vue +39 -28
  82. package/app/components/ui/Surface/types.ts +2 -2
  83. package/app/components/ui/Switch/index.stories.ts +6 -7
  84. package/app/components/ui/Switch/index.vue +1 -1
  85. package/app/components/ui/Tabs/index.stories.ts +103 -61
  86. package/app/components/ui/Tabs/index.vue +1 -1
  87. package/app/components/ui/Tag/index.stories.ts +42 -25
  88. package/app/components/ui/Tag/index.vue +39 -28
  89. package/app/components/ui/Tag/types.ts +2 -2
  90. package/app/components/ui/Textarea/index.stories.ts +73 -9
  91. package/app/components/ui/Textarea/index.vue +1 -1
  92. package/app/components/ui/Toast/index.stories.ts +71 -18
  93. package/app/components/ui/Toast/index.vue +1 -1
  94. package/app/components/ui/Tooltip/index.stories.ts +45 -38
  95. package/app/components/ui/Tooltip/index.vue +1 -1
  96. package/app/components/ui/WebLink/index.stories.ts +76 -41
  97. package/app/components/ui/WebLink/index.vue +1 -1
  98. package/package.json +2 -2
  99. package/app/components/ui/Radio/index.stories.ts +0 -71
  100. package/app/components/ui/Radio/index.vue +0 -10
  101. 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
- render: args => ({
69
+ export const Default: Story = {}
70
+
71
+ export const WithFilter: Story = {
72
+ render: () => ({
20
73
  components: { Select },
21
74
  setup () {
22
- const selected = ref<string>()
23
- const filtered = ref<string>()
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="space-y-10 max-w-sm">
60
- <!-- Controlled -->
61
- <section>
62
- <h3 class="mb-4 text-lg font-medium">Controlled</h3>
63
- <Select
64
- v-model="selected"
65
- :options="frameworks"
66
- v-bind="args"
67
- />
68
- <div class="mt-2 text-sm text-muted-foreground">Selected: {{ selected ?? 'none' }}</div>
69
- </section>
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
- <!-- With Filter -->
72
- <section>
73
- <h3 class="mb-4 text-lg font-medium">With Filter</h3>
74
- <Select
75
- v-model="filtered"
76
- :options="manyOptions"
77
- placeholder="Search and select"
78
- filter
79
- />
80
- <div class="mt-2 text-sm text-muted-foreground">Selected: {{ filtered ?? 'none' }}</div>
81
- </section>
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
- <!-- Multiple -->
84
- <section>
85
- <h3 class="mb-4 text-lg font-medium">Multiple</h3>
86
- <Select
87
- v-model="multiple"
88
- :options="frameworks"
89
- placeholder="Select frameworks"
90
- multiple
91
- />
92
- <div class="mt-2 text-sm text-muted-foreground">Selected: {{ multiple.length > 0 ? multiple.join(', ') : 'none' }}</div>
93
- </section>
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
- <!-- With Disabled Options -->
96
- <section>
97
- <h3 class="mb-4 text-lg font-medium">With Disabled Options</h3>
98
- <Select
99
- :options="withDisabled"
100
- placeholder="Select a framework"
101
- />
102
- </section>
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
- <!-- Scrollable (50 items) -->
105
- <section>
106
- <h3 class="mb-4 text-lg font-medium">Scrollable (50 items)</h3>
107
- <Select
108
- v-model="scrollable"
109
- :options="manyOptions"
110
- placeholder="Select an option"
111
- />
112
- <div class="mt-2 text-sm text-muted-foreground">Selected: {{ scrollable ?? 'none' }}</div>
113
- </section>
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
- <!-- Grouped -->
116
- <section>
117
- <h3 class="mb-4 text-lg font-medium">Grouped</h3>
118
- <Select
119
- v-model="grouped"
120
- :options="withGroups"
121
- placeholder="Select a framework"
122
- />
123
- <div class="mt-2 text-sm text-muted-foreground">Selected: {{ grouped ?? 'none' }}</div>
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 '@polymarbot/nuxt-layer-shadcn-ui/app/components/shadcn/command'
10
+ } from '../../shadcn/command'
11
11
  import {
12
12
  InputGroup,
13
13
  InputGroupAddon,
14
14
  InputGroupButton,
15
- } from '@polymarbot/nuxt-layer-shadcn-ui/app/components/shadcn/input-group'
15
+ } from '../../shadcn/input-group'
16
16
  import {
17
17
  Popover as ShadcnPopover,
18
18
  PopoverContent,
19
19
  PopoverTrigger,
20
- } from '@polymarbot/nuxt-layer-shadcn-ui/app/components/shadcn/popover'
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
- render: args => ({
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-10">
26
- <!-- Controlled -->
27
- <section>
28
- <h3 class="mb-4 text-lg font-medium">Controlled</h3>
29
- <Skeleton v-bind="args" />
30
- </section>
31
-
32
- <!-- Various Sizes -->
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
- <!-- Card Skeleton -->
43
- <section>
44
- <h3 class="mb-4 text-lg font-medium">Card Skeleton</h3>
45
- <div class="flex items-center gap-4">
46
- <Skeleton width="48px" height="48px" class="rounded-full" />
47
- <div class="space-y-2">
48
- <Skeleton width="160px" height="16px" />
49
- <Skeleton width="120px" height="12px" />
50
- </div>
51
- </div>
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 '@polymarbot/nuxt-layer-shadcn-ui/app/components/shadcn/skeleton'
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
- render: args => ({
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
- const stepped = ref(50)
25
- const custom = ref(500)
26
- return { args, single, range, stepped, custom }
46
+ return { range }
27
47
  },
28
48
  template: `
29
- <div class="space-y-10 max-w-sm">
30
- <!-- Controlled -->
31
- <section>
32
- <h3 class="mb-4 text-lg font-medium">Controlled</h3>
33
- <Slider v-model="single" v-bind="args" />
34
- <div class="mt-2 text-sm text-muted-foreground">Value: {{ single }}</div>
35
- </section>
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
- <!-- Range (Two Thumbs) -->
38
- <section>
39
- <h3 class="mb-4 text-lg font-medium">Range (Two Thumbs)</h3>
40
- <Slider v-model="range" />
41
- <div class="mt-2 text-sm text-muted-foreground">Value: {{ range }}</div>
42
- </section>
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
- <!-- With Step -->
45
- <section>
46
- <h3 class="mb-4 text-lg font-medium">With Step (25)</h3>
47
- <Slider v-model="stepped" :step="25" />
48
- <div class="mt-2 text-sm text-muted-foreground">Value: {{ stepped }}</div>
49
- </section>
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
- <!-- Custom Min / Max -->
52
- <section>
53
- <h3 class="mb-4 text-lg font-medium">Custom Min / Max (0 - 1000)</h3>
54
- <Slider v-model="custom" :min="0" :max="1000" />
55
- <div class="mt-2 text-sm text-muted-foreground">Value: {{ custom }}</div>
56
- </section>
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 '@polymarbot/nuxt-layer-shadcn-ui/app/components/shadcn/slider'
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
- type SurfaceType = 'default' | 'success' | 'info' | 'help' | 'warn' | 'danger'
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
- type: { control: 'select', options: types },
12
+ color: { control: 'select', options: colors },
15
13
  variant: { control: 'select', options: variants },
16
14
  },
17
15
  args: {
18
- type: 'default',
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
- render: args => ({
29
+ export const Default: Story = {}
30
+
31
+ export const Colors: Story = {
32
+ render: () => ({
28
33
  components: { Surface },
29
- setup: () => ({ args, types, variants }),
34
+ setup: () => ({ colors }),
30
35
  template: `
31
- <div class="space-y-10">
32
- <!-- Controlled -->
33
- <section>
34
- <h3 class="mb-4 text-lg font-medium">Controlled</h3>
35
- <Surface v-bind="args" class="p-4">This is a controlled surface.</Surface>
36
- </section>
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
- <!-- All Variants × All Types -->
39
- <section v-for="v in variants" :key="v">
40
- <h3 class="mb-4 text-lg font-medium">Variant: {{ v }}</h3>
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="t in types" :key="t" :variant="v" :type="t" class="p-4">
43
- <strong>{{ t }}</strong> surface
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
- </section>
72
+ </div>
47
73
  </div>
48
74
  `,
49
75
  }),