@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,8 +1,11 @@
1
1
  import type { Meta, StoryObj } from '@storybook/vue3'
2
+ import type { ModalContentType } from '../ModalContent/types'
2
3
  import Button from '../Button/index.vue'
3
4
  import Input from '../Input/index.vue'
4
5
  import Modal from './index.vue'
5
6
 
7
+ const types: ModalContentType[] = [ 'default', 'success', 'info', 'help', 'warn', 'danger', 'error' ]
8
+
6
9
  const meta = {
7
10
  title: 'UI/Modal',
8
11
  component: Modal,
@@ -15,109 +18,161 @@ const meta = {
15
18
  hideHeader: { control: 'boolean' },
16
19
  hideFooter: { control: 'boolean' },
17
20
  alignCenter: { control: 'boolean' },
21
+ type: { control: 'select', options: types },
22
+ title: { control: 'text' },
23
+ description: { control: 'text' },
24
+ confirmText: { control: 'text' },
25
+ cancelText: { control: 'text' },
18
26
  },
19
27
  args: {
20
28
  loading: false,
21
29
  disabled: false,
22
30
  confirmDisabled: false,
23
- showCancel: false,
31
+ showCancel: true,
24
32
  showClose: true,
25
33
  hideHeader: false,
26
34
  hideFooter: false,
27
35
  alignCenter: false,
36
+ type: 'default',
37
+ title: 'Modal Title',
38
+ description: '',
39
+ confirmText: 'OK',
40
+ cancelText: 'Cancel',
28
41
  },
29
- } satisfies Meta
42
+ render: args => ({
43
+ components: { Modal, Button, Input },
44
+ setup () {
45
+ const visible = ref(false)
46
+ return { args, visible }
47
+ },
48
+ template: `
49
+ <div>
50
+ <Button @click="visible = true">Open Modal</Button>
51
+ <Modal v-model:visible="visible" v-bind="args">
52
+ <p>This is the modal content.</p>
53
+ <Input class="mt-4" placeholder="Try interacting with this input" />
54
+ </Modal>
55
+ </div>
56
+ `,
57
+ }),
58
+ } satisfies Meta<typeof Modal>
30
59
 
31
60
  export default meta
32
61
  type Story = StoryObj<typeof meta>
33
62
 
34
- export const Default: Story = {
35
- render: args => ({
36
- components: { Modal, Button, Input },
63
+ export const Default: Story = {}
64
+
65
+ export const WithDescription: Story = {
66
+ render: () => ({
67
+ components: { Modal, Button },
68
+ setup () {
69
+ const visible = ref(false)
70
+ return { visible }
71
+ },
72
+ template: `
73
+ <div>
74
+ <Button @click="visible = true">Open Modal</Button>
75
+ <Modal
76
+ v-model:visible="visible"
77
+ title="Delete Project"
78
+ description="This will permanently remove the project and all its data. This action cannot be undone."
79
+ showCancel
80
+ confirmVariant="destructive"
81
+ confirmText="Delete"
82
+ >
83
+ <p>Are you sure you want to continue?</p>
84
+ </Modal>
85
+ </div>
86
+ `,
87
+ }),
88
+ }
89
+
90
+ export const ScrollableContent: Story = {
91
+ render: () => ({
92
+ components: { Modal, Button },
93
+ setup () {
94
+ const visible = ref(false)
95
+ return { visible }
96
+ },
97
+ template: `
98
+ <div>
99
+ <Button @click="visible = true">Open Modal</Button>
100
+ <Modal v-model:visible="visible" title="Terms of Service" showCancel confirmText="Accept">
101
+ <div class="space-y-4">
102
+ <p v-for="i in 20" :key="i">
103
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.
104
+ </p>
105
+ </div>
106
+ </Modal>
107
+ </div>
108
+ `,
109
+ }),
110
+ }
111
+
112
+ export const Types: Story = {
113
+ render: () => ({
114
+ components: { Modal, Button },
37
115
  setup () {
38
- const controlled = ref(false)
39
- const withDescription = ref(false)
40
116
  const typeInfo = ref(false)
41
117
  const typeSuccess = ref(false)
42
118
  const typeHelp = ref(false)
43
119
  const typeWarn = ref(false)
44
120
  const typeDanger = ref(false)
45
- const scrollable = ref(false)
46
- return { args, controlled, withDescription, typeInfo, typeSuccess, typeHelp, typeWarn, typeDanger, scrollable }
121
+ return { typeInfo, typeSuccess, typeHelp, typeWarn, typeDanger }
47
122
  },
48
123
  template: `
49
- <div class="space-y-10">
50
- <!-- Controlled -->
51
- <section>
52
- <h3 class="mb-4 text-lg font-medium">Controlled</h3>
53
- <Button @click="controlled = true">Open Modal</Button>
54
- <Modal
55
- v-model:visible="controlled"
56
- v-bind="args"
57
- title="Modal Title"
58
- confirmText="OK"
59
- cancelText="Cancel"
60
- >
61
- <p>This is the modal content.</p>
62
- <Input class="mt-4" placeholder="Try interacting with this input" />
63
- </Modal>
64
- </section>
65
-
66
- <!-- With Description -->
67
- <section>
68
- <h3 class="mb-4 text-lg font-medium">With Description</h3>
69
- <Button @click="withDescription = true">Open Modal</Button>
70
- <Modal
71
- v-model:visible="withDescription"
72
- title="Delete Project"
73
- description="This will permanently remove the project and all its data. This action cannot be undone."
74
- showCancel
75
- confirmVariant="destructive"
76
- confirmText="Delete"
77
- >
78
- <p>Are you sure you want to continue?</p>
79
- </Modal>
80
- </section>
81
-
82
- <!-- Scrollable Content -->
83
- <section>
84
- <h3 class="mb-4 text-lg font-medium">Scrollable Content</h3>
85
- <Button @click="scrollable = true">Open Modal</Button>
86
- <Modal v-model:visible="scrollable" title="Terms of Service" showCancel confirmText="Accept">
87
- <div class="space-y-4">
88
- <p v-for="i in 20" :key="i">
89
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.
90
- </p>
91
- </div>
92
- </Modal>
93
- </section>
124
+ <div>
125
+ <div class="flex gap-2">
126
+ <Button variant="outline" @click="typeInfo = true">Info</Button>
127
+ <Button variant="outline" @click="typeSuccess = true">Success</Button>
128
+ <Button variant="outline" @click="typeHelp = true">Help</Button>
129
+ <Button variant="outline" @click="typeWarn = true">Warn</Button>
130
+ <Button variant="outline" @click="typeDanger = true">Danger</Button>
131
+ </div>
132
+ <Modal v-model:visible="typeInfo" title="Information" type="info" showCancel>
133
+ <p>Your session will expire in 5 minutes.</p>
134
+ </Modal>
135
+ <Modal v-model:visible="typeSuccess" title="Success" type="success">
136
+ <p>Your payment has been processed successfully.</p>
137
+ </Modal>
138
+ <Modal v-model:visible="typeHelp" title="Help" type="help" showCancel>
139
+ <p>Need assistance? Check our documentation or contact support.</p>
140
+ </Modal>
141
+ <Modal v-model:visible="typeWarn" title="Warning" type="warn" showCancel confirmVariant="destructive">
142
+ <p>This operation may affect your existing data.</p>
143
+ </Modal>
144
+ <Modal v-model:visible="typeDanger" title="Delete Account" type="danger" showCancel confirmVariant="destructive" confirmText="Delete">
145
+ <p>All data will be permanently removed. This action cannot be undone.</p>
146
+ </Modal>
147
+ </div>
148
+ `,
149
+ }),
150
+ }
94
151
 
95
- <!-- With Type -->
96
- <section>
97
- <h3 class="mb-4 text-lg font-medium">With Type</h3>
98
- <div class="flex gap-2">
99
- <Button variant="outline" @click="typeInfo = true">Info</Button>
100
- <Button variant="outline" @click="typeSuccess = true">Success</Button>
101
- <Button variant="outline" @click="typeHelp = true">Help</Button>
102
- <Button variant="outline" @click="typeWarn = true">Warn</Button>
103
- <Button variant="outline" @click="typeDanger = true">Danger</Button>
104
- </div>
105
- <Modal v-model:visible="typeInfo" title="Information" type="info" showCancel>
106
- <p>Your session will expire in 5 minutes.</p>
107
- </Modal>
108
- <Modal v-model:visible="typeSuccess" title="Success" type="success">
109
- <p>Your payment has been processed successfully.</p>
110
- </Modal>
111
- <Modal v-model:visible="typeHelp" title="Help" type="help" showCancel>
112
- <p>Need assistance? Check our documentation or contact support.</p>
113
- </Modal>
114
- <Modal v-model:visible="typeWarn" title="Warning" type="warn" showCancel confirmVariant="destructive">
115
- <p>This operation may affect your existing data.</p>
116
- </Modal>
117
- <Modal v-model:visible="typeDanger" title="Delete Account" type="danger" showCancel confirmVariant="destructive" confirmText="Delete">
118
- <p>All data will be permanently removed. This action cannot be undone.</p>
119
- </Modal>
120
- </section>
152
+ export const EventHandling: Story = {
153
+ render: () => ({
154
+ components: { Modal, Button },
155
+ setup () {
156
+ const visible = ref(false)
157
+ return { visible }
158
+ },
159
+ template: `
160
+ <div>
161
+ <Button @click="visible = true">Open Modal</Button>
162
+ <Modal
163
+ v-model:visible="visible"
164
+ title="Event Demo"
165
+ description="Open the Actions panel to see emitted events."
166
+ showCancel
167
+ confirmText="Confirm"
168
+ @open="() => {}"
169
+ @close="() => {}"
170
+ @closed="() => {}"
171
+ @confirm="() => {}"
172
+ @cancel="() => {}"
173
+ >
174
+ <p>Click Confirm, Cancel, or the close button to see events fire.</p>
175
+ </Modal>
121
176
  </div>
122
177
  `,
123
178
  }),
@@ -7,7 +7,7 @@ import {
7
7
  DialogFooter,
8
8
  DialogHeader,
9
9
  DialogTitle,
10
- } from '@polymarbot/nuxt-layer-shadcn-ui/app/components/shadcn/dialog'
10
+ } from '../../shadcn/dialog'
11
11
  import type { ModalProps } from './types'
12
12
 
13
13
  const props = withDefaults(defineProps<ModalProps>(), {
@@ -187,7 +187,6 @@ const contentClass = computed(() =>
187
187
  /* Translucent blur backdrop. DialogOverlay is rendered inside DialogPortal
188
188
  (outside component scope), so use a non-scoped style. */
189
189
  [data-slot='dialog-overlay'] {
190
- z-index: 200;
191
190
  background-color: rgba(252, 252, 252, 0.3);
192
191
  backdrop-filter: blur(2px);
193
192
  -webkit-backdrop-filter: blur(2px);
@@ -195,8 +194,4 @@ const contentClass = computed(() =>
195
194
  .dark [data-slot='dialog-overlay'] {
196
195
  background-color: rgba(25, 25, 25, 0.3);
197
196
  }
198
- /* Raise above layout header (z-100) so the dialog covers it. */
199
- [data-slot='dialog-content'] {
200
- z-index: 200;
201
- }
202
197
  </style>
@@ -1,4 +1,4 @@
1
- import type { ButtonVariants } from '@polymarbot/nuxt-layer-shadcn-ui/app/components/shadcn/button'
1
+ import type { ButtonVariants } from '../../shadcn/button'
2
2
  import type { ModalContentProps } from '../ModalContent/types'
3
3
 
4
4
  export interface ModalProps {
@@ -1,46 +1,74 @@
1
1
  import type { Meta, StoryObj } from '@storybook/vue3'
2
+ import type { ModalContentType } from './types'
2
3
  import ModalContent from './index.vue'
3
4
 
5
+ const types: ModalContentType[] = [ 'default', 'success', 'info', 'help', 'warn', 'danger', 'error' ]
6
+
4
7
  const meta = {
5
8
  title: 'UI/ModalContent',
6
9
  component: ModalContent,
10
+ argTypes: {
11
+ type: { control: 'select', options: types },
12
+ icon: { control: 'text' },
13
+ content: { control: 'text' },
14
+ },
15
+ args: {
16
+ type: 'default',
17
+ icon: '',
18
+ content: 'This is a message.',
19
+ },
20
+ render: args => ({
21
+ components: { ModalContent },
22
+ setup: () => ({ args }),
23
+ template: `
24
+ <div class="max-w-md">
25
+ <ModalContent v-bind="args" />
26
+ </div>
27
+ `,
28
+ }),
7
29
  } satisfies Meta<typeof ModalContent>
8
30
 
9
31
  export default meta
10
32
  type Story = StoryObj<typeof meta>
11
33
 
12
- export const Default: Story = {
34
+ export const Default: Story = {}
35
+
36
+ export const Types: Story = {
13
37
  render: () => ({
14
38
  components: { ModalContent },
39
+ setup: () => ({ types }),
15
40
  template: `
16
41
  <div class="space-y-4 max-w-md">
17
- <!-- Types -->
18
- <section>
19
- <h3 class="mb-4 text-lg font-medium">Types</h3>
20
- <div class="space-y-4">
21
- <ModalContent type="default" content="This is a default message." />
22
- <ModalContent type="success" content="Operation completed successfully." />
23
- <ModalContent type="info" content="Your changes have been saved." />
24
- <ModalContent type="help" content="Need help? Check the documentation." />
25
- <ModalContent type="warn" content="This operation will affect all users." />
26
- <ModalContent type="danger" content="Are you sure you want to delete this item? This action cannot be undone." />
27
- </div>
28
- </section>
42
+ <ModalContent type="default" content="This is a default message." />
43
+ <ModalContent type="success" content="Operation completed successfully." />
44
+ <ModalContent type="info" content="Your changes have been saved." />
45
+ <ModalContent type="help" content="Need help? Check the documentation." />
46
+ <ModalContent type="warn" content="This operation will affect all users." />
47
+ <ModalContent type="danger" content="Are you sure you want to delete this item? This action cannot be undone." />
48
+ <ModalContent type="error" content="An error occurred while processing your request." />
49
+ </div>
50
+ `,
51
+ }),
52
+ }
29
53
 
30
- <!-- Custom Icon -->
31
- <section>
32
- <h3 class="mb-4 text-lg font-medium">Custom Icon</h3>
33
- <div class="space-y-4">
34
- <ModalContent icon="shield-alert" content="Your session is about to expire." />
35
- <ModalContent type="warn" icon="shield-alert" content="Security warning: unusual login detected." />
36
- </div>
37
- </section>
54
+ export const WithCustomIcon: Story = {
55
+ render: () => ({
56
+ components: { ModalContent },
57
+ template: `
58
+ <div class="space-y-4 max-w-md">
59
+ <ModalContent icon="shield-alert" content="Your session is about to expire." />
60
+ <ModalContent type="warn" icon="shield-alert" content="Security warning: unusual login detected." />
61
+ </div>
62
+ `,
63
+ }),
64
+ }
38
65
 
39
- <!-- Multiline Text -->
40
- <section>
41
- <h3 class="mb-4 text-lg font-medium">Multiline Text</h3>
42
- <ModalContent type="warn" content="Warning: This operation will affect all users.\nPlease review the changes before proceeding." />
43
- </section>
66
+ export const MultilineText: Story = {
67
+ render: () => ({
68
+ components: { ModalContent },
69
+ template: `
70
+ <div class="max-w-md">
71
+ <ModalContent type="warn" content="Warning: This operation will affect all users.\nPlease review the changes before proceeding." />
44
72
  </div>
45
73
  `,
46
74
  }),
@@ -12,12 +12,12 @@ const typeIconNameMap: Partial<Record<ModalContentType, string>> = {
12
12
  }
13
13
 
14
14
  const typeIconClasses: Record<ModalContentType, string> = {
15
- default: 'text-primary',
15
+ default: 'text-secondary-foreground',
16
16
  success: 'text-success',
17
17
  info: 'text-info',
18
18
  help: 'text-help',
19
19
  warn: 'text-warn',
20
- danger: 'text-destructive',
20
+ danger: 'text-danger',
21
21
  error: 'text-destructive',
22
22
  }
23
23