@polymarbot/nuxt-layer-shadcn-ui 0.1.9 → 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 (103) hide show
  1. package/app/assets/styles/colors.css +10 -10
  2. package/app/assets/styles/globals.css +1 -0
  3. package/app/assets/styles/z-index.css +27 -0
  4. package/app/components/ui/Accordion/index.stories.ts +60 -56
  5. package/app/components/ui/Accordion/index.vue +1 -1
  6. package/app/components/ui/AdminLayout/SidebarMenus.vue +0 -2
  7. package/app/components/ui/AdminLayout/index.stories.ts +9 -8
  8. package/app/components/ui/Alert/index.stories.ts +28 -26
  9. package/app/components/ui/Alert/index.vue +6 -6
  10. package/app/components/ui/Alert/types.ts +2 -1
  11. package/app/components/ui/AlertDialog/index.stories.ts +85 -50
  12. package/app/components/ui/AsyncDataTable/index.stories.ts +53 -36
  13. package/app/components/ui/Avatar/index.stories.ts +56 -51
  14. package/app/components/ui/Avatar/index.vue +1 -1
  15. package/app/components/ui/Avatar/types.ts +5 -2
  16. package/app/components/ui/Badge/index.stories.ts +41 -41
  17. package/app/components/ui/Badge/index.vue +1 -1
  18. package/app/components/ui/Badge/types.ts +3 -1
  19. package/app/components/ui/Breadcrumb/index.stories.ts +48 -37
  20. package/app/components/ui/Breadcrumb/index.vue +1 -1
  21. package/app/components/ui/Button/index.stories.ts +94 -90
  22. package/app/components/ui/Button/index.vue +1 -1
  23. package/app/components/ui/Button/types.ts +4 -1
  24. package/app/components/ui/ButtonGroup/index.stories.ts +61 -49
  25. package/app/components/ui/Card/index.stories.ts +55 -47
  26. package/app/components/ui/Card/index.vue +1 -1
  27. package/app/components/ui/Checkbox/index.stories.ts +69 -46
  28. package/app/components/ui/Checkbox/index.vue +1 -1
  29. package/app/components/ui/CopyButton/index.stories.ts +89 -31
  30. package/app/components/ui/DataTable/index.stories.ts +218 -168
  31. package/app/components/ui/DataTable/index.vue +1 -1
  32. package/app/components/ui/DatePicker/index.stories.ts +131 -37
  33. package/app/components/ui/DateRangePicker/index.stories.ts +107 -33
  34. package/app/components/ui/Divider/index.stories.ts +46 -24
  35. package/app/components/ui/Divider/index.vue +1 -1
  36. package/app/components/ui/Drawer/index.stories.ts +131 -81
  37. package/app/components/ui/Drawer/index.vue +1 -7
  38. package/app/components/ui/Drawer/types.ts +1 -1
  39. package/app/components/ui/Dropdown/index.stories.ts +134 -89
  40. package/app/components/ui/Dropdown/index.vue +5 -1
  41. package/app/components/ui/Dropdown/types.ts +1 -1
  42. package/app/components/ui/FormItem/index.stories.ts +87 -43
  43. package/app/components/ui/FormItem/index.vue +1 -1
  44. package/app/components/ui/Help/index.stories.ts +46 -35
  45. package/app/components/ui/Icon/index.stories.ts +41 -43
  46. package/app/components/ui/Input/index.stories.ts +95 -41
  47. package/app/components/ui/Input/index.vue +1 -1
  48. package/app/components/ui/InputCurrency/index.stories.ts +89 -49
  49. package/app/components/ui/InputNumber/index.stories.ts +93 -29
  50. package/app/components/ui/InputNumber/index.vue +1 -1
  51. package/app/components/ui/InputOtp/index.stories.ts +6 -7
  52. package/app/components/ui/InputOtp/index.vue +1 -1
  53. package/app/components/ui/InputPercent/index.stories.ts +6 -7
  54. package/app/components/ui/InputRange/index.stories.ts +6 -7
  55. package/app/components/ui/Loading/index.stories.ts +19 -19
  56. package/app/components/ui/Markdown/index.stories.ts +7 -10
  57. package/app/components/ui/Modal/index.stories.ts +135 -80
  58. package/app/components/ui/Modal/index.vue +1 -6
  59. package/app/components/ui/Modal/types.ts +1 -1
  60. package/app/components/ui/ModalContent/index.stories.ts +54 -26
  61. package/app/components/ui/ModalContent/index.vue +2 -2
  62. package/app/components/ui/PageCard/index.stories.ts +177 -67
  63. package/app/components/ui/Pagination/index.stories.ts +68 -51
  64. package/app/components/ui/Pagination/index.vue +2 -2
  65. package/app/components/ui/Popover/index.stories.ts +47 -45
  66. package/app/components/ui/Popover/index.vue +1 -1
  67. package/app/components/ui/Qrcode/index.stories.ts +42 -34
  68. package/app/components/ui/RadioCardGroup/index.stories.ts +23 -32
  69. package/app/components/ui/RadioCardGroup/index.vue +1 -1
  70. package/app/components/ui/RadioGroup/index.stories.ts +123 -0
  71. package/app/components/ui/RadioGroup/index.vue +73 -0
  72. package/app/components/ui/RadioGroup/types.ts +13 -0
  73. package/app/components/ui/ScrollArea/index.stories.ts +69 -37
  74. package/app/components/ui/ScrollArea/index.vue +1 -1
  75. package/app/components/ui/SearchSelect/index.stories.ts +104 -66
  76. package/app/components/ui/Select/index.stories.ts +152 -98
  77. package/app/components/ui/Select/index.vue +3 -3
  78. package/app/components/ui/Skeleton/index.stories.ts +27 -30
  79. package/app/components/ui/Skeleton/index.vue +1 -1
  80. package/app/components/ui/Slider/index.stories.ts +73 -31
  81. package/app/components/ui/Slider/index.vue +1 -1
  82. package/app/components/ui/Surface/index.stories.ts +47 -21
  83. package/app/components/ui/Surface/index.vue +39 -28
  84. package/app/components/ui/Surface/types.ts +2 -2
  85. package/app/components/ui/Switch/index.stories.ts +6 -7
  86. package/app/components/ui/Switch/index.vue +1 -1
  87. package/app/components/ui/Tabs/index.stories.ts +103 -61
  88. package/app/components/ui/Tabs/index.vue +1 -1
  89. package/app/components/ui/Tag/index.stories.ts +42 -25
  90. package/app/components/ui/Tag/index.vue +39 -28
  91. package/app/components/ui/Tag/types.ts +2 -2
  92. package/app/components/ui/Textarea/index.stories.ts +73 -9
  93. package/app/components/ui/Textarea/index.vue +1 -1
  94. package/app/components/ui/Toast/index.stories.ts +71 -18
  95. package/app/components/ui/Toast/index.vue +1 -1
  96. package/app/components/ui/Tooltip/index.stories.ts +45 -38
  97. package/app/components/ui/Tooltip/index.vue +1 -1
  98. package/app/components/ui/WebLink/index.stories.ts +76 -41
  99. package/app/components/ui/WebLink/index.vue +1 -1
  100. package/package.json +2 -2
  101. package/app/components/ui/Radio/index.stories.ts +0 -71
  102. package/app/components/ui/Radio/index.vue +0 -10
  103. package/app/components/ui/Radio/types.ts +0 -3
@@ -1,69 +1,163 @@
1
1
  import type { Meta, StoryObj } from '@storybook/vue3'
2
+ import type { DatePickerType } from './types'
2
3
  import DatePicker from './index.vue'
3
4
 
5
+ const types: DatePickerType[] = [ 'date', 'month', 'year' ]
6
+
4
7
  const meta = {
5
8
  title: 'UI/DatePicker',
6
9
  component: DatePicker,
7
10
  argTypes: {
11
+ modelValue: { control: 'date' },
12
+ type: { control: 'select', options: types },
8
13
  showTime: { control: 'boolean' },
9
14
  disabled: { control: 'boolean' },
15
+ readonly: { control: 'boolean' },
16
+ placeholder: { control: 'text' },
17
+ minDate: { control: 'date' },
18
+ maxDate: { control: 'date' },
19
+ valueFormat: { control: 'text' },
20
+ autoApply: { control: 'boolean' },
21
+ class: { control: 'text' },
10
22
  },
11
23
  args: {
24
+ modelValue: null,
25
+ type: 'date',
12
26
  showTime: false,
13
27
  disabled: false,
28
+ readonly: false,
29
+ placeholder: '',
30
+ minDate: undefined,
31
+ maxDate: undefined,
32
+ valueFormat: '',
33
+ autoApply: false,
34
+ class: '',
14
35
  },
36
+ render: args => ({
37
+ components: { DatePicker },
38
+ setup () {
39
+ const value = ref<Date | string | null>(null)
40
+ return { args, value }
41
+ },
42
+ template: `
43
+ <div class="max-w-xs">
44
+ <DatePicker v-model="value" v-bind="args" />
45
+ <div class="mt-2 text-sm text-muted-foreground">Value: {{ value }}</div>
46
+ </div>
47
+ `,
48
+ }),
15
49
  } satisfies Meta<typeof DatePicker>
16
50
 
17
51
  export default meta
18
52
  type Story = StoryObj<typeof meta>
19
53
 
20
- export const Default: Story = {
21
- render: args => ({
54
+ export const Default: Story = {}
55
+
56
+ export const MonthPicker: Story = {
57
+ render: () => ({
22
58
  components: { DatePicker },
23
59
  setup () {
24
- const date = ref<Date | null>(null)
25
- const preselected = ref<Date>(new Date(2025, 5, 15))
26
- const formatted = ref<string | null>(null)
27
60
  const month = ref<Date | null>(null)
61
+ return { month }
62
+ },
63
+ template: `
64
+ <div class="max-w-xs">
65
+ <DatePicker v-model="month" type="month" placeholder="Pick a month" />
66
+ <div class="mt-2 text-sm text-muted-foreground">Value: {{ month }}</div>
67
+ </div>
68
+ `,
69
+ }),
70
+ }
71
+
72
+ export const YearPicker: Story = {
73
+ render: () => ({
74
+ components: { DatePicker },
75
+ setup () {
28
76
  const year = ref<Date | null>(null)
29
- return { args, date, month, year, preselected, formatted }
77
+ return { year }
30
78
  },
31
79
  template: `
32
- <div class="space-y-10 max-w-xs">
33
- <!-- Controlled -->
34
- <section>
35
- <h3 class="mb-4 text-lg font-medium">Controlled</h3>
36
- <DatePicker v-model="date" v-bind="args" />
37
- <div class="mt-2 text-sm text-muted-foreground">Value: {{ date }}</div>
38
- </section>
80
+ <div class="max-w-xs">
81
+ <DatePicker v-model="year" type="year" placeholder="Pick a year" />
82
+ <div class="mt-2 text-sm text-muted-foreground">Value: {{ year }}</div>
83
+ </div>
84
+ `,
85
+ }),
86
+ }
39
87
 
40
- <!-- Month Picker -->
41
- <section>
42
- <h3 class="mb-4 text-lg font-medium">Month Picker</h3>
43
- <DatePicker v-model="month" type="month" placeholder="Pick a month" />
44
- <div class="mt-2 text-sm text-muted-foreground">Value: {{ month }}</div>
45
- </section>
88
+ export const WithTime: Story = {
89
+ render: () => ({
90
+ components: { DatePicker },
91
+ setup () {
92
+ const date = ref<Date | null>(null)
93
+ return { date }
94
+ },
95
+ template: `
96
+ <div class="max-w-xs">
97
+ <DatePicker v-model="date" showTime />
98
+ <div class="mt-2 text-sm text-muted-foreground">Value: {{ date }}</div>
99
+ </div>
100
+ `,
101
+ }),
102
+ }
46
103
 
47
- <!-- Year Picker -->
48
- <section>
49
- <h3 class="mb-4 text-lg font-medium">Year Picker</h3>
50
- <DatePicker v-model="year" type="year" placeholder="Pick a year" />
51
- <div class="mt-2 text-sm text-muted-foreground">Value: {{ year }}</div>
52
- </section>
104
+ export const Preselected: Story = {
105
+ render: () => ({
106
+ components: { DatePicker },
107
+ setup () {
108
+ const preselected = ref<Date>(new Date(2025, 5, 15))
109
+ return { preselected }
110
+ },
111
+ template: `
112
+ <div class="max-w-xs">
113
+ <DatePicker v-model="preselected" />
114
+ <div class="mt-2 text-sm text-muted-foreground">Value: {{ preselected }}</div>
115
+ </div>
116
+ `,
117
+ }),
118
+ }
53
119
 
54
- <!-- Preselected -->
55
- <section>
56
- <h3 class="mb-4 text-lg font-medium">Preselected</h3>
57
- <DatePicker v-model="preselected" />
58
- <div class="mt-2 text-sm text-muted-foreground">Value: {{ preselected }}</div>
59
- </section>
120
+ export const ValueFormat: Story = {
121
+ render: () => ({
122
+ components: { DatePicker },
123
+ setup () {
124
+ const formatted = ref<string | null>(null)
125
+ return { formatted }
126
+ },
127
+ template: `
128
+ <div class="max-w-xs">
129
+ <DatePicker v-model="formatted" valueFormat="yyyy-MM-dd" placeholder="Pick a date" />
130
+ <div class="mt-2 text-sm text-muted-foreground">Value: {{ formatted }}</div>
131
+ </div>
132
+ `,
133
+ }),
134
+ }
135
+
136
+ export const Disabled: Story = {
137
+ render: () => ({
138
+ components: { DatePicker },
139
+ setup () {
140
+ const date = ref<Date>(new Date(2025, 5, 15))
141
+ return { date }
142
+ },
143
+ template: `
144
+ <div class="max-w-xs">
145
+ <DatePicker v-model="date" disabled />
146
+ </div>
147
+ `,
148
+ }),
149
+ }
60
150
 
61
- <!-- Value Format -->
62
- <section>
63
- <h3 class="mb-4 text-lg font-medium">Value Format (yyyy-MM-dd)</h3>
64
- <DatePicker v-model="formatted" valueFormat="yyyy-MM-dd" placeholder="Pick a date" />
65
- <div class="mt-2 text-sm text-muted-foreground">Value: {{ formatted }}</div>
66
- </section>
151
+ export const Readonly: Story = {
152
+ render: () => ({
153
+ components: { DatePicker },
154
+ setup () {
155
+ const date = ref<Date>(new Date(2025, 5, 15))
156
+ return { date }
157
+ },
158
+ template: `
159
+ <div class="max-w-xs">
160
+ <DatePicker v-model="date" readonly />
67
161
  </div>
68
162
  `,
69
163
  }),
@@ -1,66 +1,140 @@
1
1
  import type { Meta, StoryObj } from '@storybook/vue3'
2
+ import type { DateRangePickerValue } from './types'
2
3
  import DateRangePicker from './index.vue'
3
4
 
4
5
  const meta = {
5
6
  title: 'UI/DateRangePicker',
6
7
  component: DateRangePicker,
7
8
  argTypes: {
9
+ modelValue: { control: 'object' },
8
10
  showTime: { control: 'boolean' },
9
11
  disabled: { control: 'boolean' },
12
+ readonly: { control: 'boolean' },
13
+ startPlaceholder: { control: 'text' },
14
+ endPlaceholder: { control: 'text' },
15
+ minDate: { control: 'date' },
16
+ maxDate: { control: 'date' },
10
17
  maxSpanDays: { control: 'number' },
18
+ valueFormat: { control: 'text' },
19
+ autoApply: { control: 'boolean' },
20
+ class: { control: 'text' },
11
21
  },
12
22
  args: {
23
+ modelValue: { start: null, end: null },
13
24
  showTime: false,
14
25
  disabled: false,
26
+ readonly: false,
27
+ startPlaceholder: '',
28
+ endPlaceholder: '',
29
+ minDate: undefined,
30
+ maxDate: undefined,
15
31
  maxSpanDays: undefined,
32
+ valueFormat: '',
33
+ autoApply: false,
34
+ class: '',
16
35
  },
36
+ render: args => ({
37
+ components: { DateRangePicker },
38
+ setup () {
39
+ const range = ref<DateRangePickerValue>({ start: null, end: null })
40
+ return { args, range }
41
+ },
42
+ template: `
43
+ <div class="max-w-lg">
44
+ <DateRangePicker v-model="range" v-bind="args" />
45
+ <div class="mt-2 text-sm text-muted-foreground">Value: {{ range }}</div>
46
+ </div>
47
+ `,
48
+ }),
17
49
  } satisfies Meta<typeof DateRangePicker>
18
50
 
19
51
  export default meta
20
52
  type Story = StoryObj<typeof meta>
21
53
 
22
- export const Default: Story = {
23
- render: args => ({
54
+ export const Default: Story = {}
55
+
56
+ export const WithTime: Story = {
57
+ render: () => ({
58
+ components: { DateRangePicker },
59
+ setup () {
60
+ const withTime = ref<DateRangePickerValue>({ start: null, end: null })
61
+ return { withTime }
62
+ },
63
+ template: `
64
+ <div class="max-w-lg">
65
+ <DateRangePicker v-model="withTime" showTime />
66
+ <div class="mt-2 text-sm text-muted-foreground">Value: {{ withTime }}</div>
67
+ </div>
68
+ `,
69
+ }),
70
+ }
71
+
72
+ export const MaxSpanDays: Story = {
73
+ render: () => ({
24
74
  components: { DateRangePicker },
25
75
  setup () {
26
- const range = ref({ start: null, end: null })
27
- const withTime = ref({ start: null, end: null })
28
- const maxSpan = ref({ start: null, end: null })
29
- const preselected = ref({
76
+ const maxSpan = ref<DateRangePickerValue>({ start: null, end: null })
77
+ return { maxSpan }
78
+ },
79
+ template: `
80
+ <div class="max-w-lg">
81
+ <DateRangePicker v-model="maxSpan" :maxSpanDays="7" />
82
+ <div class="mt-2 text-sm text-muted-foreground">Value: {{ maxSpan }}</div>
83
+ </div>
84
+ `,
85
+ }),
86
+ }
87
+
88
+ export const Preselected: Story = {
89
+ render: () => ({
90
+ components: { DateRangePicker },
91
+ setup () {
92
+ const preselected = ref<DateRangePickerValue>({
30
93
  start: new Date(2025, 5, 1),
31
94
  end: new Date(2025, 5, 15),
32
95
  })
33
- return { args, range, withTime, maxSpan, preselected }
96
+ return { preselected }
34
97
  },
35
98
  template: `
36
- <div class="max-w-lg space-y-10">
37
- <!-- Controlled -->
38
- <section>
39
- <h3 class="mb-4 text-lg font-medium">Controlled</h3>
40
- <DateRangePicker v-model="range" v-bind="args" />
41
- <div class="mt-2 text-sm text-muted-foreground">Value: {{ range }}</div>
42
- </section>
43
-
44
- <!-- With Time -->
45
- <section>
46
- <h3 class="mb-4 text-lg font-medium">With Time</h3>
47
- <DateRangePicker v-model="withTime" showTime />
48
- <div class="mt-2 text-sm text-muted-foreground">Value: {{ withTime }}</div>
49
- </section>
99
+ <div class="max-w-lg">
100
+ <DateRangePicker v-model="preselected" />
101
+ <div class="mt-2 text-sm text-muted-foreground">Value: {{ preselected }}</div>
102
+ </div>
103
+ `,
104
+ }),
105
+ }
50
106
 
51
- <!-- Max Span (7 days) -->
52
- <section>
53
- <h3 class="mb-4 text-lg font-medium">Max Span (7 days)</h3>
54
- <DateRangePicker v-model="maxSpan" :maxSpanDays="7" />
55
- <div class="mt-2 text-sm text-muted-foreground">Value: {{ maxSpan }}</div>
56
- </section>
107
+ export const Disabled: Story = {
108
+ render: () => ({
109
+ components: { DateRangePicker },
110
+ setup () {
111
+ const range = ref<DateRangePickerValue>({
112
+ start: new Date(2025, 5, 1),
113
+ end: new Date(2025, 5, 15),
114
+ })
115
+ return { range }
116
+ },
117
+ template: `
118
+ <div class="max-w-lg">
119
+ <DateRangePicker v-model="range" disabled />
120
+ </div>
121
+ `,
122
+ }),
123
+ }
57
124
 
58
- <!-- Preselected -->
59
- <section>
60
- <h3 class="mb-4 text-lg font-medium">Preselected</h3>
61
- <DateRangePicker v-model="preselected" />
62
- <div class="mt-2 text-sm text-muted-foreground">Value: {{ preselected }}</div>
63
- </section>
125
+ export const Readonly: Story = {
126
+ render: () => ({
127
+ components: { DateRangePicker },
128
+ setup () {
129
+ const range = ref<DateRangePickerValue>({
130
+ start: new Date(2025, 5, 1),
131
+ end: new Date(2025, 5, 15),
132
+ })
133
+ return { range }
134
+ },
135
+ template: `
136
+ <div class="max-w-lg">
137
+ <DateRangePicker v-model="range" readonly />
64
138
  </div>
65
139
  `,
66
140
  }),
@@ -1,41 +1,63 @@
1
1
  import type { Meta, StoryObj } from '@storybook/vue3'
2
2
  import Divider from './index.vue'
3
3
 
4
+ const types = [ 'horizontal', 'vertical' ] as const
5
+
4
6
  const meta = {
5
7
  title: 'UI/Divider',
6
8
  component: Divider,
9
+ argTypes: {
10
+ type: { control: 'select', options: types },
11
+ },
12
+ args: {
13
+ type: 'horizontal',
14
+ },
15
+ render: args => ({
16
+ components: { Divider },
17
+ setup: () => ({ args }),
18
+ template: `
19
+ <div v-if="args.type === 'vertical'" class="flex h-8 items-center gap-4">
20
+ <span>Left</span>
21
+ <Divider v-bind="args" />
22
+ <span>Right</span>
23
+ </div>
24
+ <div v-else class="space-y-4">
25
+ <p>Content above</p>
26
+ <Divider v-bind="args" />
27
+ <p>Content below</p>
28
+ </div>
29
+ `,
30
+ }),
7
31
  } satisfies Meta<typeof Divider>
8
32
 
9
33
  export default meta
10
34
  type Story = StoryObj<typeof meta>
11
35
 
12
- export const Default: Story = {
13
- render: args => ({
36
+ export const Default: Story = {}
37
+
38
+ export const Horizontal: Story = {
39
+ render: () => ({
14
40
  components: { Divider },
15
- setup: () => ({ args }),
16
41
  template: `
17
- <div class="space-y-10">
18
- <!-- Horizontal -->
19
- <section>
20
- <h3 class="mb-4 text-lg font-medium">Horizontal</h3>
21
- <div class="space-y-4">
22
- <p>Content above</p>
23
- <Divider />
24
- <p>Content below</p>
25
- </div>
26
- </section>
42
+ <div class="space-y-4">
43
+ <p>Content above</p>
44
+ <Divider />
45
+ <p>Content below</p>
46
+ </div>
47
+ `,
48
+ }),
49
+ }
27
50
 
28
- <!-- Vertical -->
29
- <section>
30
- <h3 class="mb-4 text-lg font-medium">Vertical</h3>
31
- <div class="flex h-8 items-center gap-4">
32
- <span>Left</span>
33
- <Divider type="vertical" />
34
- <span>Center</span>
35
- <Divider type="vertical" />
36
- <span>Right</span>
37
- </div>
38
- </section>
51
+ export const Vertical: Story = {
52
+ render: () => ({
53
+ components: { Divider },
54
+ template: `
55
+ <div class="flex h-8 items-center gap-4">
56
+ <span>Left</span>
57
+ <Divider type="vertical" />
58
+ <span>Center</span>
59
+ <Divider type="vertical" />
60
+ <span>Right</span>
39
61
  </div>
40
62
  `,
41
63
  }),
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { Separator } from '@polymarbot/nuxt-layer-shadcn-ui/app/components/shadcn/separator'
2
+ import { Separator } from '../../shadcn/separator'
3
3
  import type { DividerProps } from './types'
4
4
 
5
5
  withDefaults(defineProps<DividerProps>(), {