@xjur-ui/react 1.0.6 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +279 -68
- package/CHANGELOG.md +114 -0
- package/README.md +146 -0
- package/dist/chunk-2CM3SFOY.js +2 -0
- package/dist/chunk-2CM3SFOY.js.map +1 -0
- package/dist/chunk-2CTBH6VI.js +2 -0
- package/dist/chunk-2CTBH6VI.js.map +1 -0
- package/dist/chunk-4BGTC333.js +2 -0
- package/dist/chunk-4BGTC333.js.map +1 -0
- package/dist/chunk-5WLIDYZH.js +2 -0
- package/dist/chunk-5WLIDYZH.js.map +1 -0
- package/dist/chunk-6AD6O6II.js +2 -0
- package/dist/chunk-6AD6O6II.js.map +1 -0
- package/dist/chunk-AA6V5YEC.js +2 -0
- package/dist/chunk-AA6V5YEC.js.map +1 -0
- package/dist/chunk-BK6FP63A.js +2 -0
- package/dist/chunk-BK6FP63A.js.map +1 -0
- package/dist/chunk-BZDGWC5O.js +2 -0
- package/dist/chunk-BZDGWC5O.js.map +1 -0
- package/dist/chunk-CBFC4QME.js +2 -0
- package/dist/chunk-CBFC4QME.js.map +1 -0
- package/dist/chunk-CI3ZXWEX.js +2 -0
- package/dist/chunk-CI3ZXWEX.js.map +1 -0
- package/dist/chunk-DFXHNK5D.js +2 -0
- package/dist/chunk-DFXHNK5D.js.map +1 -0
- package/dist/chunk-EIG6CBTQ.js +2 -0
- package/dist/chunk-EIG6CBTQ.js.map +1 -0
- package/dist/chunk-EXC2XOL6.js +2 -0
- package/dist/chunk-EXC2XOL6.js.map +1 -0
- package/dist/chunk-F4DYKYWJ.js +2 -0
- package/dist/chunk-F4DYKYWJ.js.map +1 -0
- package/dist/chunk-F5ZLEQGN.js +2 -0
- package/dist/chunk-F5ZLEQGN.js.map +1 -0
- package/dist/chunk-IKL6PSXU.js +2 -0
- package/dist/chunk-IKL6PSXU.js.map +1 -0
- package/dist/chunk-IRHU7PDO.js +2 -0
- package/dist/chunk-IRHU7PDO.js.map +1 -0
- package/dist/chunk-J4X5RQTR.js +2 -0
- package/dist/chunk-J4X5RQTR.js.map +1 -0
- package/dist/chunk-KIFR5VIE.js +2 -0
- package/dist/chunk-KIFR5VIE.js.map +1 -0
- package/dist/chunk-KS6WGBHQ.js +2 -0
- package/dist/chunk-KS6WGBHQ.js.map +1 -0
- package/dist/chunk-L4ET6GIZ.js +2 -0
- package/dist/chunk-L4ET6GIZ.js.map +1 -0
- package/dist/chunk-MZSV4LNY.js +2 -0
- package/dist/chunk-MZSV4LNY.js.map +1 -0
- package/dist/chunk-NELCN6E2.js +2 -0
- package/dist/chunk-NELCN6E2.js.map +1 -0
- package/dist/chunk-OS53BV63.js +3 -0
- package/dist/chunk-OS53BV63.js.map +1 -0
- package/dist/chunk-PKCW37CJ.js +2 -0
- package/dist/chunk-PKCW37CJ.js.map +1 -0
- package/dist/chunk-RWMV7APX.js +2 -0
- package/dist/chunk-RWMV7APX.js.map +1 -0
- package/dist/chunk-SLAAEXWI.js +2 -0
- package/dist/chunk-SLAAEXWI.js.map +1 -0
- package/dist/chunk-SXGSWVMZ.js +2 -0
- package/dist/chunk-SXGSWVMZ.js.map +1 -0
- package/dist/chunk-TB6KI6CL.js +2 -0
- package/dist/chunk-TB6KI6CL.js.map +1 -0
- package/dist/chunk-TSVURBUY.js +2 -0
- package/dist/chunk-TSVURBUY.js.map +1 -0
- package/dist/chunk-UXIVZWLB.js +2 -0
- package/dist/chunk-UXIVZWLB.js.map +1 -0
- package/dist/chunk-WEBAXQID.js +2 -0
- package/dist/chunk-WEBAXQID.js.map +1 -0
- package/dist/chunk-WV7QV2PU.js +2 -0
- package/dist/chunk-WV7QV2PU.js.map +1 -0
- package/dist/chunk-Z47R2CIM.js +2 -0
- package/dist/chunk-Z47R2CIM.js.map +1 -0
- package/dist/chunk-ZVVPUP7V.js +2 -0
- package/dist/chunk-ZVVPUP7V.js.map +1 -0
- package/dist/components/avatar-group.js +2 -179
- package/dist/components/avatar-group.js.map +1 -0
- package/dist/components/avatar.js +2 -59
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/badge.js +2 -111
- package/dist/components/badge.js.map +1 -0
- package/dist/components/breadcrumb.d.ts +20 -0
- package/dist/components/breadcrumb.js +2 -0
- package/dist/components/breadcrumb.js.map +1 -0
- package/dist/components/chip.d.ts +5 -2
- package/dist/components/chip.js +2 -256
- package/dist/components/chip.js.map +1 -0
- package/dist/components/collapsible.js +2 -41
- package/dist/components/collapsible.js.map +1 -0
- package/dist/components/dialog.d.ts +51 -0
- package/dist/components/dialog.js +2 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/divider.js +2 -29
- package/dist/components/divider.js.map +1 -0
- package/dist/components/drag-and-drop/drag-handle.d.ts +15 -0
- package/dist/components/drag-and-drop/drag-handle.js +2 -0
- package/dist/components/drag-and-drop/drag-handle.js.map +1 -0
- package/dist/components/drag-and-drop/drag-list-item.d.ts +14 -0
- package/dist/components/drag-and-drop/drag-list-item.js +2 -0
- package/dist/components/drag-and-drop/drag-list-item.js.map +1 -0
- package/dist/components/drag-and-drop/drag-list.d.ts +14 -0
- package/dist/components/drag-and-drop/drag-list.js +2 -0
- package/dist/components/drag-and-drop/drag-list.js.map +1 -0
- package/dist/components/drag-and-drop/drag-root.d.ts +6 -0
- package/dist/components/drag-and-drop/drag-root.js +2 -0
- package/dist/components/drag-and-drop/drag-root.js.map +1 -0
- package/dist/components/drag-and-drop/index.d.ts +10 -0
- package/dist/components/drag-and-drop/index.js +2 -0
- package/dist/components/drag-and-drop/index.js.map +1 -0
- package/dist/components/drag-and-drop/types/drag-item.d.ts +9 -0
- package/dist/components/drag-and-drop/types/drag-item.js +2 -0
- package/dist/components/drag-and-drop/types/drag-item.js.map +1 -0
- package/dist/components/dropdown-menu.js +2 -295
- package/dist/components/dropdown-menu.js.map +1 -0
- package/dist/components/form/button.js +2 -0
- package/dist/components/form/button.js.map +1 -0
- package/dist/components/form/calendar.js +2 -0
- package/dist/components/form/calendar.js.map +1 -0
- package/dist/components/form/checkbox.js +2 -0
- package/dist/components/form/checkbox.js.map +1 -0
- package/dist/components/form/context/field.context.d.ts +15 -0
- package/dist/components/form/context/field.context.js +2 -0
- package/dist/components/form/context/field.context.js.map +1 -0
- package/dist/components/form/date-picker.d.ts +84 -0
- package/dist/components/form/date-picker.js +2 -0
- package/dist/components/form/date-picker.js.map +1 -0
- package/dist/components/form/floating-label.d.ts +6 -0
- package/dist/components/form/floating-label.js +2 -0
- package/dist/components/form/floating-label.js.map +1 -0
- package/dist/components/form/input.d.ts +95 -0
- package/dist/components/form/input.js +2 -0
- package/dist/components/form/input.js.map +1 -0
- package/dist/components/form/otp-input.js +2 -0
- package/dist/components/form/otp-input.js.map +1 -0
- package/dist/components/form/radio.js +2 -0
- package/dist/components/form/radio.js.map +1 -0
- package/dist/components/{rich-editor.d.ts → form/rich-editor.d.ts} +2 -1
- package/dist/components/form/rich-editor.js +2 -0
- package/dist/components/form/rich-editor.js.map +1 -0
- package/dist/components/form/search-input.js +2 -0
- package/dist/components/form/search-input.js.map +1 -0
- package/dist/components/form/select.d.ts +94 -0
- package/dist/components/form/select.js +2 -0
- package/dist/components/form/select.js.map +1 -0
- package/dist/components/form/switch.js +2 -0
- package/dist/components/form/switch.js.map +1 -0
- package/dist/components/full-calendar/calendar-add-event.d.ts +9 -0
- package/dist/components/full-calendar/calendar-add-event.js +2 -0
- package/dist/components/full-calendar/calendar-add-event.js.map +1 -0
- package/dist/components/full-calendar/calendar-body.d.ts +6 -0
- package/dist/components/full-calendar/calendar-body.js +2 -0
- package/dist/components/full-calendar/calendar-body.js.map +1 -0
- package/dist/components/full-calendar/calendar-cell.d.ts +11 -0
- package/dist/components/full-calendar/calendar-cell.js +2 -0
- package/dist/components/full-calendar/calendar-cell.js.map +1 -0
- package/dist/components/full-calendar/calendar-day-view.d.ts +5 -0
- package/dist/components/full-calendar/calendar-day-view.js +2 -0
- package/dist/components/full-calendar/calendar-day-view.js.map +1 -0
- package/dist/components/full-calendar/calendar-event.d.ts +18 -0
- package/dist/components/full-calendar/calendar-event.js +2 -0
- package/dist/components/full-calendar/calendar-event.js.map +1 -0
- package/dist/components/full-calendar/calendar-header.d.ts +6 -0
- package/dist/components/full-calendar/calendar-header.js +2 -0
- package/dist/components/full-calendar/calendar-header.js.map +1 -0
- package/dist/components/full-calendar/calendar-month-view.d.ts +5 -0
- package/dist/components/full-calendar/calendar-month-view.js +2 -0
- package/dist/components/full-calendar/calendar-month-view.js.map +1 -0
- package/dist/components/full-calendar/calendar-more-events-dropdown.d.ts +9 -0
- package/dist/components/full-calendar/calendar-more-events-dropdown.js +2 -0
- package/dist/components/full-calendar/calendar-more-events-dropdown.js.map +1 -0
- package/dist/components/full-calendar/calendar-navigator.d.ts +5 -0
- package/dist/components/full-calendar/calendar-navigator.js +2 -0
- package/dist/components/full-calendar/calendar-navigator.js.map +1 -0
- package/dist/components/full-calendar/calendar-root.d.ts +30 -0
- package/dist/components/full-calendar/calendar-root.js +2 -0
- package/dist/components/full-calendar/calendar-root.js.map +1 -0
- package/dist/components/full-calendar/calendar-today-button.d.ts +9 -0
- package/dist/components/full-calendar/calendar-today-button.js +2 -0
- package/dist/components/full-calendar/calendar-today-button.js.map +1 -0
- package/dist/components/full-calendar/calendar-toggle-view.d.ts +5 -0
- package/dist/components/full-calendar/calendar-toggle-view.js +2 -0
- package/dist/components/full-calendar/calendar-toggle-view.js.map +1 -0
- package/dist/components/full-calendar/calendar-view-renderer.d.ts +5 -0
- package/dist/components/full-calendar/calendar-view-renderer.js +2 -0
- package/dist/components/full-calendar/calendar-view-renderer.js.map +1 -0
- package/dist/components/full-calendar/calendar-week-day.d.ts +10 -0
- package/dist/components/full-calendar/calendar-week-day.js +2 -0
- package/dist/components/full-calendar/calendar-week-day.js.map +1 -0
- package/dist/components/full-calendar/calendar-week-view.d.ts +5 -0
- package/dist/components/full-calendar/calendar-week-view.js +2 -0
- package/dist/components/full-calendar/calendar-week-view.js.map +1 -0
- package/dist/components/full-calendar/helpers/calendar.d.ts +25 -0
- package/dist/components/full-calendar/helpers/calendar.js +2 -0
- package/dist/components/full-calendar/helpers/calendar.js.map +1 -0
- package/dist/components/full-calendar/index.d.ts +18 -0
- package/dist/components/full-calendar/index.js +2 -0
- package/dist/components/full-calendar/index.js.map +1 -0
- package/dist/components/full-calendar/types/calendar-cell.d.ts +6 -0
- package/dist/components/full-calendar/types/calendar-cell.js +2 -0
- package/dist/components/full-calendar/types/calendar-cell.js.map +1 -0
- package/dist/components/full-calendar/types/calendar-event.d.ts +8 -0
- package/dist/components/full-calendar/types/calendar-event.js +2 -0
- package/dist/components/full-calendar/types/calendar-event.js.map +1 -0
- package/dist/components/full-calendar/types/calendar-view.d.ts +3 -0
- package/dist/components/full-calendar/types/calendar-view.js +2 -0
- package/dist/components/full-calendar/types/calendar-view.js.map +1 -0
- package/dist/components/full-calendar/types/calendar-week-hour.d.ts +6 -0
- package/dist/components/full-calendar/types/calendar-week-hour.js +2 -0
- package/dist/components/full-calendar/types/calendar-week-hour.js.map +1 -0
- package/dist/components/horizontal-scroll.d.ts +11 -0
- package/dist/components/horizontal-scroll.js +2 -0
- package/dist/components/horizontal-scroll.js.map +1 -0
- package/dist/components/icon.d.ts +3 -4
- package/dist/components/icon.js +2 -177
- package/dist/components/icon.js.map +1 -0
- package/dist/components/list.js +2 -179
- package/dist/components/list.js.map +1 -0
- package/dist/components/logo.js +2 -324
- package/dist/components/logo.js.map +1 -0
- package/dist/components/selection-bar.d.ts +57 -0
- package/dist/components/selection-bar.js +2 -0
- package/dist/components/selection-bar.js.map +1 -0
- package/dist/components/sheet.d.ts +8 -8
- package/dist/components/sheet.js +2 -251
- package/dist/components/sheet.js.map +1 -0
- package/dist/components/skeleton.js +2 -16
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/status.js +2 -111
- package/dist/components/status.js.map +1 -0
- package/dist/components/table.js +2 -196
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.d.ts +9 -6
- package/dist/components/tabs.js +2 -54
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/tag.d.ts +5 -2
- package/dist/components/tag.js +2 -189
- package/dist/components/tag.js.map +1 -0
- package/dist/components/tooltip.js +2 -58
- package/dist/components/tooltip.js.map +1 -0
- package/dist/components/typography.js +2 -78
- package/dist/components/typography.js.map +1 -0
- package/dist/components/upload.d.ts +74 -0
- package/dist/components/upload.js +2 -0
- package/dist/components/upload.js.map +1 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/icons-CmDuL0gZ.d.ts +4 -0
- package/dist/index.css +2 -2322
- package/dist/index.css.map +1 -0
- package/dist/logo-PQRZORCS.js +3 -0
- package/dist/logo-PQRZORCS.js.map +1 -0
- package/package.json +60 -18
- package/src/components/breadcrumb.tsx +119 -0
- package/src/components/chip.tsx +11 -3
- package/src/components/dialog.tsx +242 -0
- package/src/components/drag-and-drop/drag-handle.tsx +46 -0
- package/src/components/drag-and-drop/drag-list-item.tsx +91 -0
- package/src/components/drag-and-drop/drag-list.tsx +47 -0
- package/src/components/drag-and-drop/drag-root.tsx +30 -0
- package/src/components/drag-and-drop/index.ts +39 -0
- package/src/components/drag-and-drop/types/drag-item.ts +7 -0
- package/src/components/{calendar.tsx → form/calendar.tsx} +9 -8
- package/src/components/{checkbox.tsx → form/checkbox.tsx} +2 -2
- package/src/components/form/context/field.context.ts +27 -0
- package/src/components/form/date-picker.tsx +199 -0
- package/src/components/form/floating-label.tsx +60 -0
- package/src/components/form/input.tsx +235 -0
- package/src/components/{radio.tsx → form/radio.tsx} +1 -1
- package/src/components/{rich-editor.tsx → form/rich-editor.tsx} +10 -9
- package/src/components/{search-input.tsx → form/search-input.tsx} +2 -2
- package/src/components/form/select.tsx +274 -0
- package/src/components/full-calendar/calendar-add-event.tsx +15 -0
- package/src/components/full-calendar/calendar-body.tsx +12 -0
- package/src/components/full-calendar/calendar-cell.tsx +120 -0
- package/src/components/full-calendar/calendar-day-view.tsx +76 -0
- package/src/components/full-calendar/calendar-event.tsx +178 -0
- package/src/components/full-calendar/calendar-header.tsx +14 -0
- package/src/components/full-calendar/calendar-month-view.tsx +69 -0
- package/src/components/full-calendar/calendar-more-events-dropdown.tsx +39 -0
- package/src/components/full-calendar/calendar-navigator.tsx +86 -0
- package/src/components/full-calendar/calendar-root.tsx +165 -0
- package/src/components/full-calendar/calendar-today-button.tsx +21 -0
- package/src/components/full-calendar/calendar-toggle-view.tsx +61 -0
- package/src/components/full-calendar/calendar-view-renderer.tsx +19 -0
- package/src/components/full-calendar/calendar-week-day.tsx +49 -0
- package/src/components/full-calendar/calendar-week-view.tsx +88 -0
- package/src/components/full-calendar/helpers/calendar.ts +158 -0
- package/src/components/full-calendar/index.ts +16 -0
- package/src/components/full-calendar/types/calendar-cell.ts +4 -0
- package/src/components/full-calendar/types/calendar-event.ts +7 -0
- package/src/components/full-calendar/types/calendar-view.ts +1 -0
- package/src/components/full-calendar/types/calendar-week-hour.ts +4 -0
- package/src/components/horizontal-scroll.tsx +159 -0
- package/src/components/icon.tsx +1 -1
- package/src/components/logo.tsx +25 -20
- package/src/components/selection-bar.tsx +273 -0
- package/src/components/sheet.tsx +2 -2
- package/src/components/tabs.tsx +56 -37
- package/src/components/tag.tsx +11 -3
- package/src/components/upload.tsx +647 -0
- package/src/index.css +2 -2
- package/src/resources/icons.ts +4 -1
- package/src/resources/logo/index.tsx +33 -0
- package/tsup.config.ts +23 -5
- package/dist/components/button.js +0 -98
- package/dist/components/calendar.js +0 -751
- package/dist/components/checkbox.js +0 -153
- package/dist/components/date-picker.d.ts +0 -20
- package/dist/components/date-picker.js +0 -232
- package/dist/components/input.d.ts +0 -32
- package/dist/components/input.js +0 -315
- package/dist/components/otp-input.js +0 -47
- package/dist/components/radio.js +0 -156
- package/dist/components/rich-editor.js +0 -723
- package/dist/components/search-input.js +0 -274
- package/dist/components/select.d.ts +0 -33
- package/dist/components/select.js +0 -550
- package/dist/components/switch.js +0 -36
- package/dist/components/test.d.ts +0 -5
- package/dist/components/test.js +0 -8
- package/dist/index.js +0 -0
- package/src/components/date-picker.tsx +0 -160
- package/src/components/input.tsx +0 -256
- package/src/components/select.tsx +0 -240
- package/src/components/test.tsx +0 -3
- package/src/index.ts +0 -1
- package/src/resources/logo/index.ts +0 -3
- /package/dist/components/{button.d.ts → form/button.d.ts} +0 -0
- /package/dist/components/{calendar.d.ts → form/calendar.d.ts} +0 -0
- /package/dist/components/{checkbox.d.ts → form/checkbox.d.ts} +0 -0
- /package/dist/components/{otp-input.d.ts → form/otp-input.d.ts} +0 -0
- /package/dist/components/{radio.d.ts → form/radio.d.ts} +0 -0
- /package/dist/components/{search-input.d.ts → form/search-input.d.ts} +0 -0
- /package/dist/components/{switch.d.ts → form/switch.d.ts} +0 -0
- /package/src/components/{button.tsx → form/button.tsx} +0 -0
- /package/src/components/{otp-input.tsx → form/otp-input.tsx} +0 -0
- /package/src/components/{switch.tsx → form/switch.tsx} +0 -0
|
@@ -0,0 +1,647 @@
|
|
|
1
|
+
import type { ComponentProps, DragEvent, ChangeEvent } from 'react'
|
|
2
|
+
import { useRef, useState, useCallback, createContext, useContext } from 'react'
|
|
3
|
+
import { cva, cx, type ClassVariantProps } from '@xjur-ui/util'
|
|
4
|
+
import { Icon, type IconType } from './icon'
|
|
5
|
+
import { Button } from './form/button'
|
|
6
|
+
import { Switch } from './form/switch'
|
|
7
|
+
import { InputRoot, InputContent, InputText } from './form/input'
|
|
8
|
+
import {
|
|
9
|
+
SelectRoot,
|
|
10
|
+
SelectTrigger,
|
|
11
|
+
SelectContent,
|
|
12
|
+
SelectOption
|
|
13
|
+
} from './form/select'
|
|
14
|
+
|
|
15
|
+
export interface FileFormat {
|
|
16
|
+
name: string
|
|
17
|
+
type: string
|
|
18
|
+
fileBinary: File
|
|
19
|
+
restrict?: boolean
|
|
20
|
+
description?: string
|
|
21
|
+
fileType?: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface FileTypeOption {
|
|
25
|
+
value: string
|
|
26
|
+
label: string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface UploadContextValue {
|
|
30
|
+
files: FileFormat[]
|
|
31
|
+
onFilesChange?: (files: FileFormat[]) => void
|
|
32
|
+
accept?: string
|
|
33
|
+
multiple?: boolean
|
|
34
|
+
disabled?: boolean
|
|
35
|
+
maxFiles?: number
|
|
36
|
+
maxSize?: number
|
|
37
|
+
acceptedFormats?: string[]
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const UploadContext = createContext<UploadContextValue | null>(null)
|
|
41
|
+
|
|
42
|
+
function useUploadContext() {
|
|
43
|
+
const context = useContext(UploadContext)
|
|
44
|
+
if (!context) {
|
|
45
|
+
throw new Error('Upload components must be used within UploadRoot')
|
|
46
|
+
}
|
|
47
|
+
return context
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface UploadRootProps extends ComponentProps<'div'> {
|
|
51
|
+
files: FileFormat[]
|
|
52
|
+
onFilesChange?: (files: FileFormat[]) => void
|
|
53
|
+
accept?: string
|
|
54
|
+
multiple?: boolean
|
|
55
|
+
disabled?: boolean
|
|
56
|
+
maxFiles?: number
|
|
57
|
+
maxSize?: number
|
|
58
|
+
acceptedFormats?: string[]
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function UploadRoot({
|
|
62
|
+
children,
|
|
63
|
+
className,
|
|
64
|
+
files,
|
|
65
|
+
onFilesChange,
|
|
66
|
+
accept,
|
|
67
|
+
multiple = false,
|
|
68
|
+
disabled = false,
|
|
69
|
+
maxFiles = 1,
|
|
70
|
+
maxSize,
|
|
71
|
+
acceptedFormats = ['.jpeg', '.png', '.webp'],
|
|
72
|
+
...props
|
|
73
|
+
}: UploadRootProps) {
|
|
74
|
+
return (
|
|
75
|
+
<UploadContext.Provider
|
|
76
|
+
value={{
|
|
77
|
+
files,
|
|
78
|
+
onFilesChange,
|
|
79
|
+
accept,
|
|
80
|
+
multiple,
|
|
81
|
+
disabled,
|
|
82
|
+
maxFiles,
|
|
83
|
+
maxSize,
|
|
84
|
+
acceptedFormats
|
|
85
|
+
}}
|
|
86
|
+
>
|
|
87
|
+
<div className={cx('flex flex-col gap-4', className)} {...props}>
|
|
88
|
+
{children}
|
|
89
|
+
</div>
|
|
90
|
+
</UploadContext.Provider>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const uploadAreaVariants = cva(
|
|
95
|
+
[
|
|
96
|
+
'flex flex-col items-center justify-center',
|
|
97
|
+
'relative border-2 border-dashed border-border-layer-2 rounded-lg transition-all duration-200 ease-in-out cursor-pointer',
|
|
98
|
+
'hover:border-border-layer-2 hover:bg-transparent',
|
|
99
|
+
'focus-within:border-primary-idle focus-within:ring-2 focus-within:ring-primary-idle/20',
|
|
100
|
+
'data-[drag-over=true]:border-primary-idle data-[drag-over=true]:bg-primary-alt-idle/10'
|
|
101
|
+
],
|
|
102
|
+
{
|
|
103
|
+
variants: {
|
|
104
|
+
size: {
|
|
105
|
+
large: 'p-6 min-h-[200px] ',
|
|
106
|
+
medium: 'p-6 min-h-[160px]',
|
|
107
|
+
small: 'p-6 min-h-[130px]',
|
|
108
|
+
oneLine: 'p-4 min-h-[18px]'
|
|
109
|
+
},
|
|
110
|
+
showButton: {
|
|
111
|
+
true: '',
|
|
112
|
+
false: ''
|
|
113
|
+
},
|
|
114
|
+
variant: {
|
|
115
|
+
default: 'bg-white',
|
|
116
|
+
transparent: 'bg-transparent',
|
|
117
|
+
minimal: 'bg-white',
|
|
118
|
+
oneLineWhite: 'bg-white',
|
|
119
|
+
oneLineTransparent: 'bg-transparent'
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
compoundVariants: [
|
|
123
|
+
{
|
|
124
|
+
size: 'large',
|
|
125
|
+
showButton: true
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
size: 'medium',
|
|
129
|
+
showButton: true
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
size: 'small',
|
|
133
|
+
showButton: true
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
variant: 'oneLineWhite',
|
|
137
|
+
showButton: false,
|
|
138
|
+
className: 'items-center flex flex-row justify-center'
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
variant: 'oneLineTransparent',
|
|
142
|
+
showButton: false,
|
|
143
|
+
className: 'items-center flex flex-row justify-center'
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
defaultVariants: {
|
|
147
|
+
size: 'large',
|
|
148
|
+
variant: 'default',
|
|
149
|
+
showButton: true
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
interface UploadAreaProps
|
|
155
|
+
extends Omit<ComponentProps<'div'>, 'onChange'>,
|
|
156
|
+
ClassVariantProps<typeof uploadAreaVariants> {
|
|
157
|
+
showAcceptedFormats?: boolean
|
|
158
|
+
buttonText?: string
|
|
159
|
+
description?: string
|
|
160
|
+
icon?: string
|
|
161
|
+
showButton?: boolean
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function UploadArea({
|
|
165
|
+
className,
|
|
166
|
+
size = 'large',
|
|
167
|
+
showButton = true,
|
|
168
|
+
variant = 'default',
|
|
169
|
+
showAcceptedFormats = true,
|
|
170
|
+
buttonText = 'Selecionar arquivo',
|
|
171
|
+
description = 'Clique ou solte os arquivos para fazer o upload',
|
|
172
|
+
icon = 'upload',
|
|
173
|
+
...props
|
|
174
|
+
}: UploadAreaProps) {
|
|
175
|
+
const {
|
|
176
|
+
onFilesChange,
|
|
177
|
+
accept,
|
|
178
|
+
multiple,
|
|
179
|
+
disabled,
|
|
180
|
+
maxFiles,
|
|
181
|
+
maxSize,
|
|
182
|
+
acceptedFormats
|
|
183
|
+
} = useUploadContext()
|
|
184
|
+
const [isDragOver, setIsDragOver] = useState(false)
|
|
185
|
+
const fileInputRef = useRef<HTMLInputElement>(null)
|
|
186
|
+
const [dragCounter, setDragCounter] = useState(0)
|
|
187
|
+
|
|
188
|
+
const validateFiles = useCallback(
|
|
189
|
+
(files: File[]): FileFormat[] => {
|
|
190
|
+
let validFiles = files
|
|
191
|
+
|
|
192
|
+
if (maxFiles && maxFiles > 0) {
|
|
193
|
+
validFiles = validFiles.slice(0, maxFiles)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (maxSize) {
|
|
197
|
+
validFiles = validFiles.filter(file => file.size <= maxSize)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (accept) {
|
|
201
|
+
validFiles = validFiles.filter(file => {
|
|
202
|
+
const fileExtension = `.${file.name.split('.').pop()?.toLowerCase()}`
|
|
203
|
+
return acceptedFormats?.some(format =>
|
|
204
|
+
format.startsWith('.')
|
|
205
|
+
? format === fileExtension
|
|
206
|
+
: file.type.includes(format)
|
|
207
|
+
)
|
|
208
|
+
})
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return validFiles.map(file => ({
|
|
212
|
+
name: file.name,
|
|
213
|
+
type: file.type,
|
|
214
|
+
fileBinary: file,
|
|
215
|
+
restrict: false
|
|
216
|
+
}))
|
|
217
|
+
},
|
|
218
|
+
[maxFiles, maxSize, accept, acceptedFormats]
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
const handleDragEnter = useCallback((e: DragEvent<HTMLDivElement>) => {
|
|
222
|
+
e.preventDefault()
|
|
223
|
+
e.stopPropagation()
|
|
224
|
+
setDragCounter(prev => prev + 1)
|
|
225
|
+
setIsDragOver(true)
|
|
226
|
+
}, [])
|
|
227
|
+
|
|
228
|
+
const handleDragLeave = useCallback(
|
|
229
|
+
(e: DragEvent<HTMLDivElement>) => {
|
|
230
|
+
e.preventDefault()
|
|
231
|
+
e.stopPropagation()
|
|
232
|
+
setDragCounter(prev => prev - 1)
|
|
233
|
+
if (dragCounter <= 1) {
|
|
234
|
+
setIsDragOver(false)
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
[dragCounter]
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
const handleDragOver = useCallback((e: DragEvent<HTMLDivElement>) => {
|
|
241
|
+
e.preventDefault()
|
|
242
|
+
e.stopPropagation()
|
|
243
|
+
}, [])
|
|
244
|
+
|
|
245
|
+
const handleDrop = useCallback(
|
|
246
|
+
(e: DragEvent<HTMLDivElement>) => {
|
|
247
|
+
e.preventDefault()
|
|
248
|
+
e.stopPropagation()
|
|
249
|
+
setIsDragOver(false)
|
|
250
|
+
setDragCounter(0)
|
|
251
|
+
|
|
252
|
+
if (disabled) return
|
|
253
|
+
|
|
254
|
+
const files = Array.from(e.dataTransfer.files)
|
|
255
|
+
const validFiles = validateFiles(files)
|
|
256
|
+
|
|
257
|
+
if (validFiles.length > 0) {
|
|
258
|
+
onFilesChange?.(validFiles)
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
[disabled, onFilesChange, validateFiles]
|
|
262
|
+
)
|
|
263
|
+
|
|
264
|
+
const handleFileSelect = useCallback(
|
|
265
|
+
(e: ChangeEvent<HTMLInputElement>) => {
|
|
266
|
+
if (disabled) return
|
|
267
|
+
|
|
268
|
+
const files = Array.from(e.target.files || [])
|
|
269
|
+
const validFiles = validateFiles(files)
|
|
270
|
+
|
|
271
|
+
if (validFiles.length > 0) {
|
|
272
|
+
onFilesChange?.(validFiles)
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
[disabled, onFilesChange, validateFiles]
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
return (
|
|
279
|
+
<UploadAreaTrigger
|
|
280
|
+
{...props}
|
|
281
|
+
aria-disabled={disabled}
|
|
282
|
+
aria-label={description}
|
|
283
|
+
className={cx(
|
|
284
|
+
uploadAreaVariants({ size, showButton, variant }),
|
|
285
|
+
className
|
|
286
|
+
)}
|
|
287
|
+
data-drag-over={isDragOver}
|
|
288
|
+
fileInputRef={fileInputRef}
|
|
289
|
+
onDragEnter={handleDragEnter}
|
|
290
|
+
onDragLeave={handleDragLeave}
|
|
291
|
+
onDragOver={handleDragOver}
|
|
292
|
+
onDrop={handleDrop}
|
|
293
|
+
>
|
|
294
|
+
<input
|
|
295
|
+
accept={accept}
|
|
296
|
+
className="hidden"
|
|
297
|
+
disabled={disabled}
|
|
298
|
+
multiple={multiple}
|
|
299
|
+
ref={fileInputRef}
|
|
300
|
+
type="file"
|
|
301
|
+
onChange={handleFileSelect}
|
|
302
|
+
/>
|
|
303
|
+
|
|
304
|
+
<UploadAreaContent
|
|
305
|
+
buttonText={buttonText}
|
|
306
|
+
description={description}
|
|
307
|
+
icon={icon}
|
|
308
|
+
showAcceptedFormats={showAcceptedFormats}
|
|
309
|
+
showButton={showButton}
|
|
310
|
+
variant={variant || 'default'}
|
|
311
|
+
onButtonClick={() => {
|
|
312
|
+
if (!disabled && fileInputRef.current) {
|
|
313
|
+
fileInputRef.current.click()
|
|
314
|
+
}
|
|
315
|
+
}}
|
|
316
|
+
/>
|
|
317
|
+
</UploadAreaTrigger>
|
|
318
|
+
)
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function UploadTitle({ children, className, ...props }: ComponentProps<'h3'>) {
|
|
322
|
+
return (
|
|
323
|
+
<h3
|
|
324
|
+
className={cx('text-neutral-dark text-lg font-semibold', className)}
|
|
325
|
+
{...props}
|
|
326
|
+
>
|
|
327
|
+
{children}
|
|
328
|
+
</h3>
|
|
329
|
+
)
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
interface UploadAreaContentProps extends ComponentProps<'div'> {
|
|
333
|
+
description?: string
|
|
334
|
+
icon?: string
|
|
335
|
+
showAcceptedFormats?: boolean
|
|
336
|
+
buttonText?: string
|
|
337
|
+
showButton?: boolean
|
|
338
|
+
onButtonClick?: () => void
|
|
339
|
+
variant?:
|
|
340
|
+
| 'default'
|
|
341
|
+
| 'transparent'
|
|
342
|
+
| 'minimal'
|
|
343
|
+
| 'oneLineWhite'
|
|
344
|
+
| 'oneLineTransparent'
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
function UploadAreaContent({
|
|
348
|
+
description = 'Clique ou solte os arquivos para fazer o upload',
|
|
349
|
+
icon = 'upload',
|
|
350
|
+
showAcceptedFormats = true,
|
|
351
|
+
buttonText = 'Selecionar arquivo',
|
|
352
|
+
showButton = true,
|
|
353
|
+
onButtonClick,
|
|
354
|
+
variant = 'default',
|
|
355
|
+
className,
|
|
356
|
+
...props
|
|
357
|
+
}: UploadAreaContentProps) {
|
|
358
|
+
const { acceptedFormats } = useUploadContext()
|
|
359
|
+
|
|
360
|
+
const formatAcceptedFormats = () => {
|
|
361
|
+
if (!showAcceptedFormats) return null
|
|
362
|
+
|
|
363
|
+
return (
|
|
364
|
+
<p className="text-neutral-secondary mt-2 text-sm">
|
|
365
|
+
Formatos aceitos: {acceptedFormats?.join(' ')}
|
|
366
|
+
</p>
|
|
367
|
+
)
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
const isOneLineVariant =
|
|
371
|
+
variant === 'oneLineWhite' || variant === 'oneLineTransparent'
|
|
372
|
+
|
|
373
|
+
if (isOneLineVariant) {
|
|
374
|
+
return (
|
|
375
|
+
<div
|
|
376
|
+
{...props}
|
|
377
|
+
className={cx(
|
|
378
|
+
'flex h-full items-center justify-center gap-4 text-center',
|
|
379
|
+
className
|
|
380
|
+
)}
|
|
381
|
+
>
|
|
382
|
+
<Icon
|
|
383
|
+
className="text-neutral-secondary text-4xl"
|
|
384
|
+
name={icon as IconType}
|
|
385
|
+
/>
|
|
386
|
+
<p className="text-neutral-dark text-base font-medium">{description}</p>
|
|
387
|
+
{formatAcceptedFormats()}
|
|
388
|
+
</div>
|
|
389
|
+
)
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
return (
|
|
393
|
+
<div
|
|
394
|
+
{...props}
|
|
395
|
+
className={cx(
|
|
396
|
+
'flex h-full w-full flex-col items-center gap-4 text-center',
|
|
397
|
+
className
|
|
398
|
+
)}
|
|
399
|
+
>
|
|
400
|
+
<div className="flex flex-col items-center">
|
|
401
|
+
<Icon
|
|
402
|
+
className="text-neutral-secondary mb-3 text-4xl"
|
|
403
|
+
name={icon as IconType}
|
|
404
|
+
/>
|
|
405
|
+
|
|
406
|
+
<p className="text-neutral-dark mb-2 text-base font-medium">
|
|
407
|
+
{description}
|
|
408
|
+
</p>
|
|
409
|
+
|
|
410
|
+
{formatAcceptedFormats()}
|
|
411
|
+
</div>
|
|
412
|
+
|
|
413
|
+
{showButton && (
|
|
414
|
+
<div>
|
|
415
|
+
<Button
|
|
416
|
+
size="md"
|
|
417
|
+
variant="primary"
|
|
418
|
+
onClick={e => {
|
|
419
|
+
e.stopPropagation()
|
|
420
|
+
onButtonClick?.()
|
|
421
|
+
}}
|
|
422
|
+
>
|
|
423
|
+
{buttonText}
|
|
424
|
+
</Button>
|
|
425
|
+
</div>
|
|
426
|
+
)}
|
|
427
|
+
</div>
|
|
428
|
+
)
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
interface UploadAreaTriggerProps extends ComponentProps<'div'> {
|
|
432
|
+
fileInputRef?: React.RefObject<HTMLInputElement | null>
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
function UploadAreaTrigger({
|
|
436
|
+
children,
|
|
437
|
+
fileInputRef,
|
|
438
|
+
...props
|
|
439
|
+
}: UploadAreaTriggerProps) {
|
|
440
|
+
const { disabled } = useUploadContext()
|
|
441
|
+
|
|
442
|
+
const handleClick = useCallback(() => {
|
|
443
|
+
if (!disabled && fileInputRef?.current) {
|
|
444
|
+
fileInputRef.current.click()
|
|
445
|
+
}
|
|
446
|
+
}, [disabled, fileInputRef])
|
|
447
|
+
|
|
448
|
+
return (
|
|
449
|
+
<div
|
|
450
|
+
role="button"
|
|
451
|
+
tabIndex={disabled ? -1 : 0}
|
|
452
|
+
onClick={handleClick}
|
|
453
|
+
onKeyDown={e => {
|
|
454
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
455
|
+
e.preventDefault()
|
|
456
|
+
handleClick()
|
|
457
|
+
}
|
|
458
|
+
}}
|
|
459
|
+
{...props}
|
|
460
|
+
>
|
|
461
|
+
{children}
|
|
462
|
+
</div>
|
|
463
|
+
)
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
interface EditableFilesListProps {
|
|
467
|
+
fileTypeOptions?: FileTypeOption[]
|
|
468
|
+
onUpdateFile?: (index: number, file: Partial<FileFormat>) => void
|
|
469
|
+
onDeleteFile?: (index: number) => void
|
|
470
|
+
onReorderFiles?: (fromIndex: number, toIndex: number) => void
|
|
471
|
+
className?: string
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
function EditableFilesList({
|
|
475
|
+
fileTypeOptions = [
|
|
476
|
+
{ value: 'document', label: 'Documento' },
|
|
477
|
+
{ value: 'image', label: 'Imagem' },
|
|
478
|
+
{ value: 'video', label: 'Vídeo' },
|
|
479
|
+
{ value: 'audio', label: 'Áudio' },
|
|
480
|
+
{ value: 'other', label: 'Outro' }
|
|
481
|
+
],
|
|
482
|
+
onUpdateFile,
|
|
483
|
+
onDeleteFile,
|
|
484
|
+
className,
|
|
485
|
+
...props
|
|
486
|
+
}: EditableFilesListProps) {
|
|
487
|
+
const { files, onFilesChange } = useUploadContext()
|
|
488
|
+
|
|
489
|
+
if (!files || files.length === 0) return null
|
|
490
|
+
|
|
491
|
+
const handleDescriptionChange = (index: number, description: string) => {
|
|
492
|
+
if (onUpdateFile) {
|
|
493
|
+
onUpdateFile(index, { description })
|
|
494
|
+
} else {
|
|
495
|
+
const updatedFiles = [...files]
|
|
496
|
+
updatedFiles[index] = { ...updatedFiles[index], description }
|
|
497
|
+
onFilesChange?.(updatedFiles)
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
const handleFileTypeChange = (index: number, fileType: string) => {
|
|
502
|
+
if (onUpdateFile) {
|
|
503
|
+
onUpdateFile(index, { fileType })
|
|
504
|
+
} else {
|
|
505
|
+
const updatedFiles = [...files]
|
|
506
|
+
updatedFiles[index] = { ...updatedFiles[index], fileType }
|
|
507
|
+
onFilesChange?.(updatedFiles)
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
const handleRestrictChange = (index: number, restrict: boolean) => {
|
|
512
|
+
if (onUpdateFile) {
|
|
513
|
+
onUpdateFile(index, { restrict })
|
|
514
|
+
} else {
|
|
515
|
+
const updatedFiles = [...files]
|
|
516
|
+
updatedFiles[index] = { ...updatedFiles[index], restrict }
|
|
517
|
+
onFilesChange?.(updatedFiles)
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
const handleDelete = (index: number) => {
|
|
522
|
+
if (onDeleteFile) {
|
|
523
|
+
onDeleteFile(index)
|
|
524
|
+
} else {
|
|
525
|
+
const updatedFiles = files.filter((_, i) => i !== index)
|
|
526
|
+
onFilesChange?.(updatedFiles)
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
return (
|
|
531
|
+
<div className={cx('space-y-2', className)} {...props}>
|
|
532
|
+
<div className="border-border-layer-2 p-4">
|
|
533
|
+
<div className="border-border-layer-2 mb-3 flex w-full flex-row items-center justify-between gap-4 border-b pb-2">
|
|
534
|
+
<div className="w-full">
|
|
535
|
+
<span className="text-sm font-medium text-gray-300">Descrição</span>
|
|
536
|
+
</div>
|
|
537
|
+
<div className="w-full">
|
|
538
|
+
<span className="text-sm font-medium text-gray-300">Tipo</span>
|
|
539
|
+
</div>
|
|
540
|
+
<div className="flex justify-end">
|
|
541
|
+
<span className="text-sm font-medium text-gray-300">Restrito</span>
|
|
542
|
+
</div>
|
|
543
|
+
</div>
|
|
544
|
+
|
|
545
|
+
<div className="space-y-3">
|
|
546
|
+
{files.map((file, index) => (
|
|
547
|
+
<div className="flex flex-row items-center gap-4 py-3" key={index}>
|
|
548
|
+
<div className="flex justify-start">
|
|
549
|
+
<Icon
|
|
550
|
+
className="text-neutral-secondary hover:text-neutral-dark cursor-grab"
|
|
551
|
+
name="drag_indicator"
|
|
552
|
+
/>
|
|
553
|
+
</div>
|
|
554
|
+
|
|
555
|
+
<div className="w-full">
|
|
556
|
+
<InputRoot>
|
|
557
|
+
<InputContent>
|
|
558
|
+
<InputText
|
|
559
|
+
placeholder="Nome do arquivo"
|
|
560
|
+
value={file.description || file.name}
|
|
561
|
+
onChange={e =>
|
|
562
|
+
handleDescriptionChange(index, e.target.value)
|
|
563
|
+
}
|
|
564
|
+
/>
|
|
565
|
+
</InputContent>
|
|
566
|
+
</InputRoot>
|
|
567
|
+
</div>
|
|
568
|
+
|
|
569
|
+
<div className="w-full">
|
|
570
|
+
<SelectRoot>
|
|
571
|
+
<SelectTrigger className="flex justify-between">
|
|
572
|
+
<span className="text-neutral-dark">
|
|
573
|
+
{fileTypeOptions.find(
|
|
574
|
+
option => option.value === file.fileType
|
|
575
|
+
)?.label || 'Tipo'}
|
|
576
|
+
</span>
|
|
577
|
+
<Icon
|
|
578
|
+
className="text-neutral-secondary"
|
|
579
|
+
name="keyboard_arrow_down"
|
|
580
|
+
/>
|
|
581
|
+
</SelectTrigger>
|
|
582
|
+
<SelectContent>
|
|
583
|
+
{fileTypeOptions.map(option => (
|
|
584
|
+
<SelectOption
|
|
585
|
+
key={option.value}
|
|
586
|
+
value={option.value}
|
|
587
|
+
onSelect={() =>
|
|
588
|
+
handleFileTypeChange(index, option.value)
|
|
589
|
+
}
|
|
590
|
+
>
|
|
591
|
+
{option.label}
|
|
592
|
+
</SelectOption>
|
|
593
|
+
))}
|
|
594
|
+
</SelectContent>
|
|
595
|
+
</SelectRoot>
|
|
596
|
+
</div>
|
|
597
|
+
|
|
598
|
+
<div className="flex justify-end">
|
|
599
|
+
<Switch
|
|
600
|
+
checked={file.restrict || false}
|
|
601
|
+
onCheckedChange={checked =>
|
|
602
|
+
handleRestrictChange(index, checked)
|
|
603
|
+
}
|
|
604
|
+
/>
|
|
605
|
+
</div>
|
|
606
|
+
|
|
607
|
+
<div className="flex justify-end">
|
|
608
|
+
<Button
|
|
609
|
+
appearance="ghost"
|
|
610
|
+
size="sm"
|
|
611
|
+
variant="destructive"
|
|
612
|
+
onClick={() => handleDelete(index)}
|
|
613
|
+
>
|
|
614
|
+
<Icon name="delete" />
|
|
615
|
+
</Button>
|
|
616
|
+
</div>
|
|
617
|
+
</div>
|
|
618
|
+
))}
|
|
619
|
+
</div>
|
|
620
|
+
</div>
|
|
621
|
+
</div>
|
|
622
|
+
)
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
export const Upload = {
|
|
626
|
+
Root: UploadRoot,
|
|
627
|
+
Area: UploadArea,
|
|
628
|
+
Title: UploadTitle,
|
|
629
|
+
AreaContent: UploadAreaContent,
|
|
630
|
+
AreaTrigger: UploadAreaTrigger,
|
|
631
|
+
EditableList: EditableFilesList
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
export { UploadRoot }
|
|
635
|
+
export { UploadArea }
|
|
636
|
+
export { UploadTitle }
|
|
637
|
+
export { UploadAreaContent }
|
|
638
|
+
export { UploadAreaTrigger }
|
|
639
|
+
export { EditableFilesList }
|
|
640
|
+
export { uploadAreaVariants }
|
|
641
|
+
export type {
|
|
642
|
+
UploadRootProps,
|
|
643
|
+
UploadAreaProps,
|
|
644
|
+
UploadAreaContentProps,
|
|
645
|
+
UploadAreaTriggerProps,
|
|
646
|
+
EditableFilesListProps
|
|
647
|
+
}
|
package/src/index.css
CHANGED
package/src/resources/icons.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export const icons = [
|
|
2
2
|
'account_balance',
|
|
3
|
+
'assignment',
|
|
4
|
+
'task',
|
|
3
5
|
'ad_units',
|
|
4
6
|
'add_a_photo',
|
|
5
7
|
'add',
|
|
@@ -144,7 +146,8 @@ export const icons = [
|
|
|
144
146
|
'format_underlined',
|
|
145
147
|
'format_list_bulleted',
|
|
146
148
|
'format_list_numbered',
|
|
147
|
-
'redo'
|
|
149
|
+
'redo',
|
|
150
|
+
'more_horiz'
|
|
148
151
|
] as const
|
|
149
152
|
|
|
150
153
|
export type IconType = (typeof icons)[number]
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Horizontal } from './horizontal'
|
|
2
|
+
import { Vertical } from './vertical'
|
|
3
|
+
import { Icon } from './icon'
|
|
4
|
+
|
|
5
|
+
interface LogoWrapperProps {
|
|
6
|
+
mode: 'horizontal' | 'vertical' | 'icon'
|
|
7
|
+
variant: 'colorful' | 'orange' | 'purple' | 'white' | 'gray'
|
|
8
|
+
color?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default function LogoWrapper({
|
|
12
|
+
mode,
|
|
13
|
+
variant,
|
|
14
|
+
color
|
|
15
|
+
}: LogoWrapperProps) {
|
|
16
|
+
switch (mode) {
|
|
17
|
+
case 'icon':
|
|
18
|
+
if (variant === 'colorful' || !color) {
|
|
19
|
+
return <Icon.Colorful />
|
|
20
|
+
}
|
|
21
|
+
return <Icon.Solid color={color} />
|
|
22
|
+
case 'vertical':
|
|
23
|
+
if (variant === 'colorful' || !color) {
|
|
24
|
+
return <Vertical.Colorful />
|
|
25
|
+
}
|
|
26
|
+
return <Vertical.Solid color={color} />
|
|
27
|
+
case 'horizontal':
|
|
28
|
+
if (variant === 'colorful' || !color) {
|
|
29
|
+
return <Horizontal.Colorful />
|
|
30
|
+
}
|
|
31
|
+
return <Horizontal.Solid color={color} />
|
|
32
|
+
}
|
|
33
|
+
}
|