@gentleduck/registry-ui 0.2.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 (175) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/index.css +3 -0
  3. package/package.json +59 -0
  4. package/src/_old/_table/index.ts +5 -0
  5. package/src/_old/_table/table-advanced.constants.tsx +24 -0
  6. package/src/_old/_table/table-advanced.tsx +311 -0
  7. package/src/_old/_table/table-advanced.types.ts +272 -0
  8. package/src/_old/_table/table.constants.ts +2 -0
  9. package/src/_old/_table/table.hook.tsx +115 -0
  10. package/src/_old/_table/table.lib.ts +85 -0
  11. package/src/_old/_table/table.tsx +916 -0
  12. package/src/_old/_table/table.types.ts +118 -0
  13. package/src/_old/_table/todo.md +11 -0
  14. package/src/_old/_upload/index.ts +9 -0
  15. package/src/_old/_upload/todo.md +38 -0
  16. package/src/_old/_upload/upload-advanced-chunks.tsx +1624 -0
  17. package/src/_old/_upload/upload-advanced.tsx +507 -0
  18. package/src/_old/_upload/upload-sonner.tsx +58 -0
  19. package/src/_old/_upload/upload.assets.tsx +239 -0
  20. package/src/_old/_upload/upload.constants.tsx +75 -0
  21. package/src/_old/_upload/upload.dto.ts +19 -0
  22. package/src/_old/_upload/upload.lib.tsx +630 -0
  23. package/src/_old/_upload/upload.tsx +491 -0
  24. package/src/_old/_upload/upload.types.ts +436 -0
  25. package/src/accordion/accordion.tsx +247 -0
  26. package/src/accordion/index.ts +1 -0
  27. package/src/alert/alert.constants.ts +17 -0
  28. package/src/alert/alert.tsx +52 -0
  29. package/src/alert/index.ts +2 -0
  30. package/src/alert-dialog/alert-dialog.tsx +107 -0
  31. package/src/alert-dialog/index.ts +1 -0
  32. package/src/aspect-ratio/aspect-ratio.tsx +33 -0
  33. package/src/aspect-ratio/index.ts +1 -0
  34. package/src/audio/audio-record.tsx +776 -0
  35. package/src/audio/audio-visualizer.tsx +377 -0
  36. package/src/audio/audio.libs.ts +5 -0
  37. package/src/audio/audio.types.ts +50 -0
  38. package/src/audio/index.ts +2 -0
  39. package/src/avatar/avatar.tsx +78 -0
  40. package/src/avatar/index.ts +1 -0
  41. package/src/badge/badge.constants.ts +38 -0
  42. package/src/badge/badge.tsx +19 -0
  43. package/src/badge/index.ts +2 -0
  44. package/src/breadcrumb/breadcrumb.tsx +119 -0
  45. package/src/breadcrumb/index.ts +1 -0
  46. package/src/button/button.constants.ts +44 -0
  47. package/src/button/button.tsx +79 -0
  48. package/src/button/button.types.ts +38 -0
  49. package/src/button/index.ts +3 -0
  50. package/src/button-group/button-group.constants.ts +26 -0
  51. package/src/button-group/button-group.tsx +65 -0
  52. package/src/button-group/index.ts +2 -0
  53. package/src/calendar/calendar.tsx +191 -0
  54. package/src/calendar/index.ts +1 -0
  55. package/src/card/card.tsx +81 -0
  56. package/src/card/index.ts +1 -0
  57. package/src/carousel/carousel.tsx +211 -0
  58. package/src/carousel/carousel.types.ts +23 -0
  59. package/src/carousel/index.ts +2 -0
  60. package/src/chart/chart.libs.ts +27 -0
  61. package/src/chart/chart.tsx +260 -0
  62. package/src/chart/chart.types.ts +38 -0
  63. package/src/chart/index.ts +3 -0
  64. package/src/checkbox/checkbox.tsx +144 -0
  65. package/src/checkbox/checkbox.types.ts +24 -0
  66. package/src/checkbox/index.ts +2 -0
  67. package/src/collapsible/collapsible.tsx +151 -0
  68. package/src/collapsible/index.ts +1 -0
  69. package/src/combobox/combobox.tsx +132 -0
  70. package/src/combobox/index.ts +1 -0
  71. package/src/command/command.tsx +192 -0
  72. package/src/command/command.types.ts +11 -0
  73. package/src/command/index.ts +2 -0
  74. package/src/context-menu/context-menu.tsx +178 -0
  75. package/src/context-menu/index.ts +1 -0
  76. package/src/dialog/dialog-responsive.tsx +137 -0
  77. package/src/dialog/dialog.tsx +97 -0
  78. package/src/dialog/index.ts +2 -0
  79. package/src/direction/direction.tsx +13 -0
  80. package/src/direction/index.ts +1 -0
  81. package/src/drawer/drawer.tsx +185 -0
  82. package/src/drawer/index.ts +1 -0
  83. package/src/dropdown-menu/dropdown-menu.tsx +181 -0
  84. package/src/dropdown-menu/index.ts +1 -0
  85. package/src/empty/empty.constants.ts +15 -0
  86. package/src/empty/empty.tsx +73 -0
  87. package/src/empty/index.ts +2 -0
  88. package/src/field/field.constants.ts +22 -0
  89. package/src/field/field.tsx +203 -0
  90. package/src/field/index.ts +2 -0
  91. package/src/hover-card/hover-card.tsx +79 -0
  92. package/src/hover-card/index.ts +1 -0
  93. package/src/input/index.ts +1 -0
  94. package/src/input/input.tsx +45 -0
  95. package/src/input-group/index.ts +1 -0
  96. package/src/input-group/input-group.tsx +170 -0
  97. package/src/input-otp/index.ts +1 -0
  98. package/src/input-otp/input-otp.tsx +66 -0
  99. package/src/item/index.ts +2 -0
  100. package/src/item/item.constants.ts +22 -0
  101. package/src/item/item.tsx +185 -0
  102. package/src/json-editor/index.ts +4 -0
  103. package/src/json-editor/json-editor.hooks.ts +21 -0
  104. package/src/json-editor/json-editor.libs.ts +34 -0
  105. package/src/json-editor/json-editor.tsx +425 -0
  106. package/src/json-editor/json-editor.types.ts +80 -0
  107. package/src/json-editor/json-editor.view.tsx +110 -0
  108. package/src/json-editor/json-text-area.tsx +7 -0
  109. package/src/kbd/index.ts +1 -0
  110. package/src/kbd/kbd.tsx +39 -0
  111. package/src/label/index.ts +1 -0
  112. package/src/label/label.tsx +28 -0
  113. package/src/menubar/index.ts +1 -0
  114. package/src/menubar/menubar.tsx +213 -0
  115. package/src/navigation-menu/index.ts +1 -0
  116. package/src/navigation-menu/navigation-menu.tsx +152 -0
  117. package/src/pagination/index.ts +2 -0
  118. package/src/pagination/pagination.tsx +191 -0
  119. package/src/pagination/pagination.types.ts +17 -0
  120. package/src/popover/index.ts +1 -0
  121. package/src/popover/popover.tsx +35 -0
  122. package/src/preview-panel/index.ts +3 -0
  123. package/src/preview-panel/preview-panel-dialog.tsx +99 -0
  124. package/src/preview-panel/preview-panel.tsx +389 -0
  125. package/src/preview-panel/preview-panel.types.ts +49 -0
  126. package/src/progress/index.ts +1 -0
  127. package/src/progress/progress.tsx +32 -0
  128. package/src/radio-group/index.ts +1 -0
  129. package/src/radio-group/radio-group.tsx +92 -0
  130. package/src/resizable/index.ts +1 -0
  131. package/src/resizable/resizable.tsx +52 -0
  132. package/src/scroll-area/index.ts +1 -0
  133. package/src/scroll-area/scroll-area.tsx +30 -0
  134. package/src/select/index.ts +1 -0
  135. package/src/select/select.tsx +138 -0
  136. package/src/separator/index.ts +1 -0
  137. package/src/separator/separator.tsx +28 -0
  138. package/src/sheet/index.ts +2 -0
  139. package/src/sheet/sheet.constants.tsx +20 -0
  140. package/src/sheet/sheet.tsx +92 -0
  141. package/src/sidebar/index.ts +4 -0
  142. package/src/sidebar/sidebar.constants.ts +30 -0
  143. package/src/sidebar/sidebar.hooks.ts +13 -0
  144. package/src/sidebar/sidebar.tsx +676 -0
  145. package/src/sidebar/sidebar.types.ts +28 -0
  146. package/src/skeleton/index.ts +1 -0
  147. package/src/skeleton/skeleton.tsx +22 -0
  148. package/src/slider/index.ts +1 -0
  149. package/src/slider/slider.tsx +57 -0
  150. package/src/sonner/index.ts +4 -0
  151. package/src/sonner/sonner.chunks.tsx +80 -0
  152. package/src/sonner/sonner.libs.ts +13 -0
  153. package/src/sonner/sonner.tsx +31 -0
  154. package/src/sonner/sonner.types.ts +9 -0
  155. package/src/switch/index.ts +1 -0
  156. package/src/switch/switch.tsx +63 -0
  157. package/src/table/index.ts +1 -0
  158. package/src/table/table.tsx +95 -0
  159. package/src/tabs/index.ts +1 -0
  160. package/src/tabs/tabs.tsx +151 -0
  161. package/src/textarea/index.ts +1 -0
  162. package/src/textarea/textarea.tsx +24 -0
  163. package/src/toggle/index.ts +2 -0
  164. package/src/toggle/toggle.constants.ts +22 -0
  165. package/src/toggle/toggle.tsx +24 -0
  166. package/src/toggle-group/index.ts +1 -0
  167. package/src/toggle-group/toggle-group.tsx +69 -0
  168. package/src/tooltip/index.ts +1 -0
  169. package/src/tooltip/tooltip.tsx +32 -0
  170. package/src/upload/index.ts +1 -0
  171. package/src/upload/upload.constants.tsx +19 -0
  172. package/src/upload/upload.libs.ts +97 -0
  173. package/src/upload/upload.tsx +340 -0
  174. package/src/upload/upload.types.ts +44 -0
  175. package/tsconfig.json +25 -0
@@ -0,0 +1,491 @@
1
+ // 'use client'
2
+ //
3
+ // import React from 'react'
4
+ // import {
5
+ // AlertDialogSheet,
6
+ // Avatar,
7
+ // AvatarFallback,
8
+ // AvatarImage,
9
+ // DropdownMenuView,
10
+ // } from '@/registry/default/ui'
11
+ // import { ContextMenu, ContextMenuTrigger } from '@/registry/default/ui'
12
+ // import { Input } from '@/registry/default/ui'
13
+ // import { ScrollArea } from '@/registry/default/ui'
14
+ // import { filesize } from 'filesize'
15
+ // import { Button, buttonVariants } from '../button'
16
+ // import { Download, Ellipsis, Trash, Upload as UploadIcon } from 'lucide-react'
17
+ // import {
18
+ // FileType,
19
+ // FolderType,
20
+ // UploadContentProps,
21
+ // UploadContextType,
22
+ // UploadInputProps,
23
+ // UploadItemProps,
24
+ // UploadProps,
25
+ // UploadtItemRemoveProps,
26
+ // UploadTriggerProps,
27
+ // } from './upload.types'
28
+ // import { FILE_TYPE_ICONS } from './upload.constants'
29
+ // import { getAttachmentsToState } from './upload.lib'
30
+ // import { cn } from '@/lib/utils'
31
+ // import { X } from 'lucide-react'
32
+ // import { downloadAttachment } from '@/registry/default/ui/comment'
33
+ // import { uuidv7 } from 'uuidv7'
34
+ //
35
+ // const UploadContext = React.createContext<UploadContextType<
36
+ // FileType | FolderType
37
+ // > | null>(null)
38
+ //
39
+ // /**
40
+ // * Hook for accessing the context of the UploadProvider.
41
+ // *
42
+ // * @returns {UploadContextType<FileType> | null} The context object.
43
+ // * @throws {Error} If the hook is used outside of an UploadProvider.
44
+ // */
45
+ // export const useUploadContext = (): UploadContextType<FileType> => {
46
+ // const context = React.useContext(UploadContext)
47
+ // if (!context) {
48
+ // throw new Error('useUploadContext must be used within an UploadProvider')
49
+ // }
50
+ // return context
51
+ // }
52
+ //
53
+ // /**
54
+ // * Provides the context for managing attachments.
55
+ // *
56
+ // * @example
57
+ // * <UploadProvider>
58
+ // * <Upload />
59
+ // * </UploadProvider>
60
+ // *
61
+ // * @param {React.ReactNode} children The children components.
62
+ // * @returns {JSX.Element} The rendered component.
63
+ // */
64
+ // export const UploadProvider = ({
65
+ // children,
66
+ // }: { children: React.ReactNode }): JSX.Element => {
67
+ // const [attachments, setAttachments] = React.useState<FileType[]>([])
68
+ // const [attachmentsState, setAttachmentsState] = React.useState<FileType[]>([])
69
+ //
70
+ // return (
71
+ // <UploadContext.Provider
72
+ // value={{
73
+ // attachments,
74
+ // setAttachments,
75
+ // attachmentsState,
76
+ // setAttachmentsState,
77
+ // }}
78
+ // >
79
+ // {children}
80
+ // </UploadContext.Provider>
81
+ // )
82
+ // }
83
+ //
84
+ // /**
85
+ // * The Upload component provides a user interface for uploading attachments.
86
+ // * It utilizes the UploadProvider context to manage the state of attachments
87
+ // * and allows users to submit their selected files.
88
+ // *
89
+ // * @param {UploadProps} props - The props for the Upload component.
90
+ // * @param {React.ReactNode} [props.children] - Optional children to render within the component.
91
+ // * @param {React.ReactNode} [props.trigger] - The UI element that triggers the upload dialog.
92
+ // * @param {React.ReactNode} [props.content] - The content to be displayed inside the upload dialog.
93
+ // *
94
+ // * @returns {JSX.Element} The rendered Upload component.
95
+ // */
96
+ // export const Upload = ({
97
+ // children,
98
+ // trigger,
99
+ // content,
100
+ // }: UploadProps): JSX.Element => {
101
+ // const { setAttachments, attachmentsState, setAttachmentsState } =
102
+ // useUploadContext()
103
+ // return (
104
+ // <>
105
+ // {children ? (
106
+ // children
107
+ // ) : (
108
+ // <AlertDialogSheet
109
+ // header={{
110
+ // head: 'Upload',
111
+ // description: 'upload your attahment here and submit.',
112
+ // }}
113
+ // actions={{
114
+ // continue: () => {
115
+ // setAttachments([])
116
+ // setAttachmentsState([])
117
+ // },
118
+ // }}
119
+ // footer={{
120
+ // submit: {
121
+ // children: (
122
+ // <Button
123
+ // disabled={attachmentsState.length === 0}
124
+ // className="px-6"
125
+ // onClick={() => {
126
+ // setAttachments((prev) => [...prev, ...attachmentsState])
127
+ // setAttachmentsState([])
128
+ // }}
129
+ // >
130
+ // Submit
131
+ // </Button>
132
+ // ),
133
+ // },
134
+ // cancel: {
135
+ // children: (
136
+ // <Button variant="outline" className="px-6">
137
+ // Cancel
138
+ // </Button>
139
+ // ),
140
+ // },
141
+ // }}
142
+ // state={attachmentsState.length > 0}
143
+ // trigger={{ children: trigger }}
144
+ // content={{ children: content }}
145
+ // />
146
+ // )}
147
+ // </>
148
+ // )
149
+ // }
150
+ //
151
+ // /**
152
+ // * UploadTrigger component renders a trigger for the upload action.
153
+ // *
154
+ // * @param {Object} props - The properties passed to the component.
155
+ // * @param {string} [props.className] - Optional additional class names.
156
+ // * @param {React.ReactNode} props.children - The children elements to be rendered inside the trigger.
157
+ // * @param {React.Ref} ref - The ref forwarded to the underlying div element.
158
+ // *
159
+ // * @returns {React.Element} The rendered component.
160
+ // */
161
+ // export const UploadTrigger = React.forwardRef<
162
+ // HTMLDivElement,
163
+ // UploadTriggerProps
164
+ // >(({ className, children, ...props }, ref) => (
165
+ // <div className={cn(className)} ref={ref} {...props}>
166
+ // {children}
167
+ // </div>
168
+ // ))
169
+ //
170
+ // /**
171
+ // * UploadInput component renders an input area where users can drag or click to upload files.
172
+ // * It also includes a file filter and context menu for options.
173
+ // *
174
+ // * @param {Object} props - The properties passed to the component.
175
+ // * @param {string} [props.className] - Optional additional class names.
176
+ // * @param {React.ReactNode} props.children - The children elements to be rendered inside the input.
177
+ // * @param {React.Ref} ref - The ref forwarded to the underlying div element.
178
+ // *
179
+ // * @returns {React.Element} The rendered component.
180
+ // */
181
+ // export const UploadInput = React.forwardRef<HTMLDivElement, UploadInputProps>(
182
+ // ({ className, children, ...props }, ref) => {
183
+ // const { setAttachmentsState } = useUploadContext()
184
+ //
185
+ // return (
186
+ // <div className={cn(className)} ref={ref} {...props}>
187
+ // <ContextMenu>
188
+ // <ContextMenuTrigger className="relative flex flex-col items-center justify-center w-full h-64 rounded-md border border-dashed border-border text-sm leading-5 transition-colors duration-100 ease-in-out hover:bg-muted/10">
189
+ // <div className="grid place-items-center gap-4">
190
+ // <UploadIcon className="size-[30px]" />
191
+ // <span>Click or Drag to Upload</span>
192
+ // </div>
193
+ // <Input
194
+ // placeholder="Filter files..."
195
+ // type="file"
196
+ // className="absolute w-full h-full opacity-0 cursor-pointer"
197
+ // multiple={true}
198
+ // onChange={(e) =>
199
+ // UploadManager.getAttachmentsToState({ e, setAttachmentsState })
200
+ // }
201
+ // />
202
+ // </ContextMenuTrigger>
203
+ // </ContextMenu>
204
+ // <p className="mt-2 text-muted-foreground text-[.9rem]">
205
+ // supports all types of files.
206
+ // </p>
207
+ // </div>
208
+ // )
209
+ // },
210
+ // )
211
+ //
212
+ // /**
213
+ // * UploadContent component renders the content area for the uploaded files,
214
+ // * showing a scrollable list of uploaded items with an option to remove them.
215
+ // *
216
+ // * @param {Object} props - The properties passed to the component.
217
+ // * @param {string} [props.className] - Optional additional class names.
218
+ // * @param {React.ReactNode} props.children - The children elements to be rendered inside the content area.
219
+ // * @param {React.Ref} ref - The ref forwarded to the underlying div element.
220
+ // *
221
+ // * @returns {React.Element} The rendered component.
222
+ // */
223
+ // export const UploadContent = React.forwardRef<
224
+ // HTMLDivElement,
225
+ // UploadContentProps
226
+ // >(({ className, children, ...props }, ref) => {
227
+ // const { attachmentsState, setAttachmentsState } = useUploadContext()
228
+ //
229
+ // return (
230
+ // <ScrollArea
231
+ // className={cn(
232
+ // 'flex flex-col gap-2 max-h-[39ch] md:max-h-[43ch]',
233
+ // className,
234
+ // )}
235
+ // ref={ref}
236
+ // {...props}
237
+ // >
238
+ // {children}
239
+ // <div className="flex flex-col gap-2">
240
+ // {attachmentsState.map((attachment) => {
241
+ // return (
242
+ // <UploadItem key={attachment.id} attachment={attachment}>
243
+ // <UploadtItemRemove
244
+ // className="absolute top-1/2 -translate-y-1/2 right-2"
245
+ // onClick={() => {
246
+ // setAttachmentsState((prev) =>
247
+ // prev.filter((item) => item.id !== attachment.id),
248
+ // )
249
+ // }}
250
+ // />
251
+ // </UploadItem>
252
+ // )
253
+ // })}
254
+ // </div>
255
+ // </ScrollArea>
256
+ // )
257
+ // })
258
+ //
259
+ // /**
260
+ // * UploadItem component represents an individual file in the upload list.
261
+ // * It displays the file's name, type, size, and provides an option to remove it.
262
+ // *
263
+ // * @param {Object} props - The properties passed to the component.
264
+ // * @param {Attachment} props.attachment - The attachment object containing file details.
265
+ // * @param {string} [props.className] - Optional additional class names.
266
+ // * @param {React.ReactNode} props.children - The children elements to be rendered inside the item.
267
+ // * @param {React.Ref} ref - The ref forwarded to the underlying div element.
268
+ // *
269
+ // * @returns {React.Element} The rendered component.
270
+ // */
271
+ // export const UploadItem = React.forwardRef<HTMLDivElement, UploadItemProps>(
272
+ // ({ attachment, children, className, ...props }, ref) => {
273
+ // const fileType = UploadManager.getFileType(attachment.file)
274
+ //
275
+ // return (
276
+ // <div
277
+ // className={cn(
278
+ // 'relative flex items-center gap-4 bg-secondary/20 rounded-md p-2',
279
+ // className,
280
+ // )}
281
+ // ref={ref}
282
+ // {...props}
283
+ // >
284
+ // <div className="flex items-center gap-4">
285
+ // <div className="relative">{FILE_TYPE_ICONS[fileType]}</div>
286
+ // <div className="grid items-start">
287
+ // <h3 className="inline-block text-[.9rem] truncate max-w-[200px]">
288
+ // {attachment.name || 'Empty File'}
289
+ // </h3>
290
+ // <p className="inline-block truncate text-semibold text-[.8rem] max-w-[300px]">
291
+ // {filesize(attachment.file ? +attachment.file.size : 0, {
292
+ // round: 0,
293
+ // })}
294
+ // </p>
295
+ // </div>
296
+ // </div>
297
+ // {children}
298
+ // </div>
299
+ // )
300
+ // },
301
+ // )
302
+ //
303
+ // /**
304
+ // * UploadtItemRemove component represents a remove button for an uploaded file item.
305
+ // * It is typically used for removing a file from the upload list.
306
+ // *
307
+ // * @param {Object} props - The properties passed to the component.
308
+ // * @param {string} [props.className] - Optional additional class names.
309
+ // * @param {React.Ref} ref - The ref forwarded to the underlying div element.
310
+ // *
311
+ // * @returns {React.Element} The rendered component.
312
+ // */
313
+ // export const UploadtItemRemove = React.forwardRef<
314
+ // HTMLDivElement,
315
+ // UploadtItemRemoveProps
316
+ // >(({ className, ...props }, ref) => {
317
+ // return (
318
+ // <div
319
+ // className={cn(
320
+ // 'size-4 rounded-md focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 cursor-pointer',
321
+ // className,
322
+ // )}
323
+ // ref={ref}
324
+ // {...props}
325
+ // >
326
+ // <X className="w-4 h-4" />
327
+ // </div>
328
+ // )
329
+ // })
330
+ //
331
+ // /**
332
+ // * UploadItemsPreview component displays a preview of all uploaded items.
333
+ // * If there are no items uploaded, a message will be shown instead.
334
+ // *
335
+ // * @returns {React.Element} The rendered component, showing uploaded items or a message if none are uploaded.
336
+ // */
337
+ // export const UploadItemsPreview = () => {
338
+ // const { attachments } = useUploadContext()
339
+ //
340
+ // return attachments.length > 0 ? (
341
+ // <div className="grid grid-cols-6 justify-start items-start place-content-start gap-2 w-full border border-border min-h-[400px] p-4 rounded-lg">
342
+ // {attachments.map((attachment) => {
343
+ // const fileType = UploadManager.getFileType(attachment.file)
344
+ //
345
+ // // If the file is a File object, generate a URL for preview
346
+ // const src =
347
+ // typeof attachment.file === 'string'
348
+ // ? attachment.file
349
+ // : URL.createObjectURL(attachment.file as Blob)
350
+ //
351
+ // return (
352
+ // <div
353
+ // className={cn(
354
+ // 'relative bg-secondary/20 rounded-md overflow-hidden w-full flex flex-col place-content-center gap-4 h-[100px] border border-border',
355
+ // )}
356
+ // >
357
+ // <div>
358
+ // <div className="relative [&_svg]:size-12 [&_svg]:mx-auto w-full">
359
+ // {FILE_TYPE_ICONS[fileType]}
360
+ // </div>
361
+ // </div>
362
+ // <DropdownMenuView
363
+ // trigger={{
364
+ // icon: { children: Ellipsis, className: 'h-4 w-4 rounded-sm' },
365
+ // variant: 'outline',
366
+ // size: 'icon',
367
+ // className: 'h-4 w-6 absolute bottom-2 right-2',
368
+ // }}
369
+ // content={{
370
+ // options: {
371
+ // itemType: 'label',
372
+ // optionsData: [
373
+ // {
374
+ // children: 'Download',
375
+ // icon: {
376
+ // children: Download,
377
+ // className: 'h-4 w-4 rounded-sm' ,
378
+ // },
379
+ // onClick: () => {
380
+ // downloadAttachment({ attachment: attachment! })
381
+ // },
382
+ // },
383
+ // {
384
+ // children: 'Delete',
385
+ // className: 'text-red-500 bg-red-500/10',
386
+ // icon: { children: Trash, className: 'h-4 w-4 rounded-sm' },
387
+ // onClick: () => { },
388
+ // },
389
+ // ],
390
+ // },
391
+ // }}
392
+ // />
393
+ // </div>
394
+ // )
395
+ // })}
396
+ // </div>
397
+ // ) : (
398
+ // <div className="flex items-center w-full border border-border min-h-[400px] p-4 rounded-lg">
399
+ // <p className="text-center w-full">There's no attachments yet uploaded.</p>
400
+ // </div>
401
+ // )
402
+ // }
403
+ //
404
+ // /**
405
+ // * UploadProfile component renders a profile avatar with the ability to upload a profile picture.
406
+ // *
407
+ // * @returns {React.Element} The rendered component, including the avatar and upload functionality.
408
+ // */
409
+ // export const UploadProfile = () => {
410
+ // const { attachments, setAttachments } = useUploadContext() ?? {}
411
+ // const src =
412
+ // attachments.length > 0
413
+ // ? typeof attachments[0].file === 'string'
414
+ // ? attachments[0].file
415
+ // : URL.createObjectURL(attachments[0].file as Blob)
416
+ // : null
417
+ //
418
+ // return (
419
+ // <Button
420
+ // className="relative cursor-pointer w-16 h-16 rounded-full"
421
+ // variant={'outline'}
422
+ // >
423
+ // <Input
424
+ // placeholder="Filter files..."
425
+ // type="file"
426
+ // className="absolute w-full h-full opacity-0 cursor-pointer"
427
+ // multiple={false}
428
+ // onChange={(e) => {
429
+ // const file = e.currentTarget.files?.[0]
430
+ // if (file) {
431
+ // setAttachments([
432
+ // {
433
+ // id: uuidv7(),
434
+ // file: file,
435
+ // name: file.name,
436
+ // url: null,
437
+ // type: file.type,
438
+ // size: file.size.toString(),
439
+ // createdAt: new Date(),
440
+ // updated_at: new Date(),
441
+ // },
442
+ // ])
443
+ // }
444
+ // }}
445
+ // />
446
+ // <Avatar className="w-16 h-16 pointer-events-none">
447
+ // <AvatarImage src={src ?? ''} className="object-cover" />
448
+ // <AvatarFallback>
449
+ // <img src="/avatars/02.png" />
450
+ // </AvatarFallback>
451
+ // </Avatar>
452
+ // <span
453
+ // className={cn(
454
+ // buttonVariants({ variant: 'outline' }),
455
+ // 'absolute rounded-full p-2 -bottom-1 -left-1 hover:bg-background h-fit pointer-events-none',
456
+ // )}
457
+ // >
458
+ // <UploadIcon className="!size-3" />
459
+ // </span>
460
+ // </Button>
461
+ // )
462
+ // }
463
+ //
464
+ // /**
465
+ // * UploadDirectButton component renders a button that triggers a file upload directly.
466
+ // *
467
+ // * @returns {React.Element} The rendered component, including the upload button and file input.
468
+ // */
469
+ // export const UploadDirectButton = () => {
470
+ // const { setAttachments } = useUploadContext() ?? {}
471
+ //
472
+ // return (
473
+ // <Button
474
+ // className="relative"
475
+ // variant={'outline'}
476
+ // size={'sm'}
477
+ // icon={{ children: UploadIcon }}
478
+ // >
479
+ // <Input
480
+ // placeholder="Filter files..."
481
+ // type="file"
482
+ // className="absolute w-full h-full opacity-0 cursor-pointer"
483
+ // multiple={true}
484
+ // onChange={(e) =>
485
+ // getAttachmentsToState({ e, setAttachmentsState: setAttachments })
486
+ // }
487
+ // />
488
+ // Upload file
489
+ // </Button>
490
+ // )
491
+ // }