@xjur-ui/react 2.1.0 → 2.2.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/CHANGELOG.md +18 -0
- package/dist/{chunk-IRHU7PDO.js → chunk-2JQVYVAT.js} +2 -2
- package/dist/chunk-2JQVYVAT.js.map +1 -0
- package/dist/chunk-2JU3PFV2.js +2 -0
- package/dist/chunk-2JU3PFV2.js.map +1 -0
- package/dist/chunk-3H75F4Y2.js +2 -0
- package/dist/chunk-3H75F4Y2.js.map +1 -0
- package/dist/{chunk-Z47R2CIM.js → chunk-3L772WC6.js} +2 -2
- package/dist/chunk-3L772WC6.js.map +1 -0
- package/dist/chunk-43DUEHUA.js +2 -0
- package/dist/chunk-43DUEHUA.js.map +1 -0
- package/dist/chunk-4BGAERSD.js +2 -0
- package/dist/chunk-4BGAERSD.js.map +1 -0
- package/dist/{chunk-5WLIDYZH.js → chunk-4PTFZTVU.js} +2 -2
- package/dist/{chunk-5WLIDYZH.js.map → chunk-4PTFZTVU.js.map} +1 -1
- package/dist/chunk-6PHXO2YA.js +2 -0
- package/dist/{chunk-RWMV7APX.js.map → chunk-6PHXO2YA.js.map} +1 -1
- package/dist/{chunk-2CTBH6VI.js → chunk-7HG6Y3VV.js} +2 -2
- package/dist/{chunk-2CTBH6VI.js.map → chunk-7HG6Y3VV.js.map} +1 -1
- package/dist/chunk-7HMMMRDA.js +2 -0
- package/dist/chunk-7HMMMRDA.js.map +1 -0
- package/dist/chunk-7QGN6XFA.js +2 -0
- package/dist/chunk-7QGN6XFA.js.map +1 -0
- package/dist/chunk-AKR2BJRB.js +2 -0
- package/dist/chunk-AKR2BJRB.js.map +1 -0
- package/dist/{chunk-BK6FP63A.js → chunk-ASZAHSU5.js} +2 -2
- package/dist/{chunk-BK6FP63A.js.map → chunk-ASZAHSU5.js.map} +1 -1
- package/dist/chunk-DOC3XTYC.js +2 -0
- package/dist/chunk-DOC3XTYC.js.map +1 -0
- package/dist/{chunk-IKL6PSXU.js → chunk-DT44JTXB.js} +2 -2
- package/dist/{chunk-IKL6PSXU.js.map → chunk-DT44JTXB.js.map} +1 -1
- package/dist/chunk-DVDHTP4C.js +2 -0
- package/dist/chunk-DVDHTP4C.js.map +1 -0
- package/dist/chunk-EITO7GZX.js +2 -0
- package/dist/chunk-EITO7GZX.js.map +1 -0
- package/dist/chunk-F7ANJ4HD.js +2 -0
- package/dist/chunk-F7ANJ4HD.js.map +1 -0
- package/dist/chunk-FQTUN47L.js +2 -0
- package/dist/chunk-FQTUN47L.js.map +1 -0
- package/dist/chunk-FUHASFGU.js +2 -0
- package/dist/chunk-FUHASFGU.js.map +1 -0
- package/dist/{chunk-CI3ZXWEX.js → chunk-G6NSC3FL.js} +2 -2
- package/dist/{chunk-CI3ZXWEX.js.map → chunk-G6NSC3FL.js.map} +1 -1
- package/dist/{chunk-6AD6O6II.js → chunk-GKILN5HI.js} +2 -2
- package/dist/chunk-GKILN5HI.js.map +1 -0
- package/dist/chunk-GVKH2BG2.js +2 -0
- package/dist/chunk-GVKH2BG2.js.map +1 -0
- package/dist/chunk-JF7JKJES.js +2 -0
- package/dist/chunk-JF7JKJES.js.map +1 -0
- package/dist/{chunk-TSVURBUY.js → chunk-JGPHBUVM.js} +2 -2
- package/dist/chunk-JGPHBUVM.js.map +1 -0
- package/dist/{chunk-PKCW37CJ.js → chunk-M6ZI7M3R.js} +2 -2
- package/dist/chunk-M6ZI7M3R.js.map +1 -0
- package/dist/{chunk-UXIVZWLB.js → chunk-MQ7YTZBI.js} +2 -2
- package/dist/{chunk-UXIVZWLB.js.map → chunk-MQ7YTZBI.js.map} +1 -1
- package/dist/chunk-O3JK6QF6.js +2 -0
- package/dist/chunk-O3JK6QF6.js.map +1 -0
- package/dist/{chunk-L4ET6GIZ.js → chunk-OKSGVAQQ.js} +2 -2
- package/dist/chunk-OKSGVAQQ.js.map +1 -0
- package/dist/chunk-OLWYBKQR.js +2 -0
- package/dist/chunk-OLWYBKQR.js.map +1 -0
- package/dist/chunk-PBR7SFWY.js +2 -0
- package/dist/chunk-PBR7SFWY.js.map +1 -0
- package/dist/chunk-Q2BZSHS2.js +2 -0
- package/dist/chunk-Q2BZSHS2.js.map +1 -0
- package/dist/{chunk-OS53BV63.js → chunk-RGKXZJJS.js} +3 -3
- package/dist/{chunk-OS53BV63.js.map → chunk-RGKXZJJS.js.map} +1 -1
- package/dist/chunk-SSTXFHNX.js +2 -0
- package/dist/chunk-SSTXFHNX.js.map +1 -0
- package/dist/chunk-TORICLEW.js +2 -0
- package/dist/chunk-TORICLEW.js.map +1 -0
- package/dist/chunk-TYWCS7GS.js +2 -0
- package/dist/chunk-TYWCS7GS.js.map +1 -0
- package/dist/chunk-URDL5OKH.js +2 -0
- package/dist/chunk-URDL5OKH.js.map +1 -0
- package/dist/chunk-V2FCP4FA.js +2 -0
- package/dist/chunk-V2FCP4FA.js.map +1 -0
- package/dist/chunk-VCNKCHFF.js +2 -0
- package/dist/chunk-VCNKCHFF.js.map +1 -0
- package/dist/chunk-WEGFAS5P.js +2 -0
- package/dist/chunk-WEGFAS5P.js.map +1 -0
- package/dist/chunk-X6SOSTUN.js +2 -0
- package/dist/chunk-X6SOSTUN.js.map +1 -0
- package/dist/chunk-XGPKBYDY.js +2 -0
- package/dist/chunk-XGPKBYDY.js.map +1 -0
- package/dist/chunk-YOLTIAFT.js +2 -0
- package/dist/{chunk-KIFR5VIE.js.map → chunk-YOLTIAFT.js.map} +1 -1
- package/dist/chunk-ZPQPJJQJ.js +2 -0
- package/dist/chunk-ZPQPJJQJ.js.map +1 -0
- package/dist/components/breadcrumb.js +1 -1
- package/dist/components/chip.d.ts +1 -1
- package/dist/components/chip.js +1 -1
- package/dist/components/controls/button.js +2 -0
- package/dist/components/{form → controls}/calendar.js +1 -1
- package/dist/components/controls/calendar.js.map +1 -0
- package/dist/components/{form → controls}/checkbox.js +1 -1
- package/dist/components/controls/checkbox.js.map +1 -0
- package/dist/components/{form → controls}/context/field.context.d.ts +1 -2
- package/dist/components/controls/context/field.context.js +2 -0
- package/dist/components/{form → controls}/date-picker.d.ts +2 -1
- package/dist/components/{form → controls}/date-picker.js +1 -1
- package/dist/components/controls/date-picker.js.map +1 -0
- package/dist/components/controls/floating-label.js +2 -0
- package/dist/components/{form → controls}/input.d.ts +3 -2
- package/dist/components/controls/input.js +2 -0
- package/dist/components/controls/otp-input.js.map +1 -0
- package/dist/components/controls/radio.js.map +1 -0
- package/dist/components/{form → controls}/rich-editor.js +1 -1
- package/dist/components/controls/rich-editor.js.map +1 -0
- package/dist/components/{form → controls}/search-input.d.ts +9 -1
- package/dist/components/controls/search-input.js +2 -0
- package/dist/components/controls/search-input.js.map +1 -0
- package/dist/components/controls/search-selector.d.ts +19 -0
- package/dist/components/controls/search-selector.js +2 -0
- package/dist/components/controls/search-selector.js.map +1 -0
- package/dist/components/{form → controls}/select.d.ts +2 -1
- package/dist/components/{form → controls}/select.js +1 -1
- package/dist/components/controls/switch.js +2 -0
- package/dist/components/custom/pessoa/index.d.ts +16 -0
- package/dist/components/custom/pessoa/index.js +2 -0
- package/dist/components/custom/pessoa/index.js.map +1 -0
- package/dist/components/custom/pessoa/pessoa-add-button.d.ts +9 -0
- package/dist/components/custom/pessoa/pessoa-add-button.js +2 -0
- package/dist/components/custom/pessoa/pessoa-add-button.js.map +1 -0
- package/dist/components/custom/pessoa/pessoa-body.d.ts +8 -0
- package/dist/components/custom/pessoa/pessoa-body.js +2 -0
- package/dist/components/custom/pessoa/pessoa-body.js.map +1 -0
- package/dist/components/custom/pessoa/pessoa-close-button.d.ts +8 -0
- package/dist/components/custom/pessoa/pessoa-close-button.js +2 -0
- package/dist/components/custom/pessoa/pessoa-close-button.js.map +1 -0
- package/dist/components/custom/pessoa/pessoa-content.d.ts +8 -0
- package/dist/components/custom/pessoa/pessoa-content.js +2 -0
- package/dist/components/custom/pessoa/pessoa-content.js.map +1 -0
- package/dist/components/custom/pessoa/pessoa-footer.d.ts +8 -0
- package/dist/components/custom/pessoa/pessoa-footer.js +2 -0
- package/dist/components/custom/pessoa/pessoa-footer.js.map +1 -0
- package/dist/components/custom/pessoa/pessoa-header.d.ts +10 -0
- package/dist/components/custom/pessoa/pessoa-header.js +2 -0
- package/dist/components/custom/pessoa/pessoa-header.js.map +1 -0
- package/dist/components/custom/pessoa/pessoa-trigger.d.ts +8 -0
- package/dist/components/custom/pessoa/pessoa-trigger.js +2 -0
- package/dist/components/custom/pessoa/pessoa-trigger.js.map +1 -0
- package/dist/components/custom/pessoa/pessoa.context.d.ts +25 -0
- package/dist/components/custom/pessoa/pessoa.context.js +2 -0
- package/dist/components/custom/pessoa/pessoa.context.js.map +1 -0
- package/dist/components/custom/pessoa/pessoa.d.ts +11 -0
- package/dist/components/custom/pessoa/pessoa.js +2 -0
- package/dist/components/custom/pessoa/pessoa.js.map +1 -0
- package/dist/components/dialog.js +1 -1
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/drag-and-drop/index.js +1 -1
- package/dist/components/dropdown-menu.js +1 -1
- package/dist/components/full-calendar/calendar-add-event.js +1 -1
- package/dist/components/full-calendar/calendar-add-event.js.map +1 -1
- package/dist/components/full-calendar/calendar-cell.js +1 -1
- package/dist/components/full-calendar/calendar-day-view.js +1 -1
- package/dist/components/full-calendar/calendar-month-view.js +1 -1
- package/dist/components/full-calendar/calendar-more-events-dropdown.js +1 -1
- package/dist/components/full-calendar/calendar-navigator.js +1 -1
- package/dist/components/full-calendar/calendar-today-button.d.ts +1 -1
- package/dist/components/full-calendar/calendar-today-button.js +1 -1
- package/dist/components/full-calendar/calendar-toggle-view.js +1 -1
- package/dist/components/full-calendar/calendar-view-renderer.js +1 -1
- package/dist/components/full-calendar/calendar-week-view.js +1 -1
- package/dist/components/full-calendar/index.d.ts +1 -1
- package/dist/components/full-calendar/index.js +1 -1
- package/dist/components/horizontal-scroll.js +1 -1
- package/dist/components/horizontal-scroll.js.map +1 -1
- package/dist/components/icon.d.ts +2 -2
- package/dist/components/icon.js +1 -1
- package/dist/components/list.js +1 -1
- package/dist/components/selection-bar.d.ts +1 -1
- package/dist/components/selection-bar.js +1 -1
- package/dist/components/selection-bar.js.map +1 -1
- package/dist/components/sheet.js +1 -1
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/steps/index.d.ts +11 -0
- package/dist/components/steps/index.js +2 -0
- package/dist/components/steps/index.js.map +1 -0
- package/dist/components/steps/step.d.ts +8 -0
- package/dist/components/steps/step.js +2 -0
- package/dist/components/steps/step.js.map +1 -0
- package/dist/components/steps/steps-action.d.ts +12 -0
- package/dist/components/steps/steps-action.js +2 -0
- package/dist/components/steps/steps-action.js.map +1 -0
- package/dist/components/steps/steps-content.d.ts +6 -0
- package/dist/components/steps/steps-content.js +2 -0
- package/dist/components/steps/steps-content.js.map +1 -0
- package/dist/components/steps/steps-context.d.ts +22 -0
- package/dist/components/steps/steps-context.js +2 -0
- package/dist/components/steps/steps-context.js.map +1 -0
- package/dist/components/steps/steps-navigation.d.ts +6 -0
- package/dist/components/steps/steps-navigation.js +2 -0
- package/dist/components/steps/steps-navigation.js.map +1 -0
- package/dist/components/steps/steps-root.d.ts +7 -0
- package/dist/components/steps/steps-root.js +2 -0
- package/dist/components/steps/steps-root.js.map +1 -0
- package/dist/components/table/index.d.ts +9 -0
- package/dist/components/table/index.js +2 -0
- package/dist/components/table/index.js.map +1 -0
- package/dist/components/table/table-body.d.ts +5 -0
- package/dist/components/table/table-body.js +2 -0
- package/dist/components/table/table-body.js.map +1 -0
- package/dist/components/table/table-cell.d.ts +5 -0
- package/dist/components/table/table-cell.js +2 -0
- package/dist/components/table/table-cell.js.map +1 -0
- package/dist/components/table/table-footer.d.ts +5 -0
- package/dist/components/table/table-footer.js +2 -0
- package/dist/components/table/table-footer.js.map +1 -0
- package/dist/components/table/table-head.d.ts +6 -0
- package/dist/components/table/table-head.js +2 -0
- package/dist/components/table/table-head.js.map +1 -0
- package/dist/components/table/table-header.d.ts +5 -0
- package/dist/components/table/table-header.js +2 -0
- package/dist/components/table/table-header.js.map +1 -0
- package/dist/components/table/table-row.d.ts +7 -0
- package/dist/components/table/table-row.js +2 -0
- package/dist/components/table/table-row.js.map +1 -0
- package/dist/components/table/table-sort.d.ts +7 -0
- package/dist/components/table/table-sort.js +2 -0
- package/dist/components/table/table-sort.js.map +1 -0
- package/dist/components/table/table.d.ts +5 -0
- package/dist/components/table/table.js +2 -0
- package/dist/components/table/table.js.map +1 -0
- package/dist/components/tag.d.ts +1 -1
- package/dist/components/tag.js +1 -1
- package/dist/components/upload.js +1 -1
- package/dist/components/upload.js.map +1 -1
- package/dist/icons-C-hGI45d.d.ts +4 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/input-mask-DhbtCxF7.d.ts +3 -0
- package/package.json +22 -16
- package/.turbo/turbo-build.log +0 -288
- package/dist/chunk-2CM3SFOY.js +0 -2
- package/dist/chunk-2CM3SFOY.js.map +0 -1
- package/dist/chunk-6AD6O6II.js.map +0 -1
- package/dist/chunk-AA6V5YEC.js +0 -2
- package/dist/chunk-AA6V5YEC.js.map +0 -1
- package/dist/chunk-IRHU7PDO.js.map +0 -1
- package/dist/chunk-KIFR5VIE.js +0 -2
- package/dist/chunk-L4ET6GIZ.js.map +0 -1
- package/dist/chunk-PKCW37CJ.js.map +0 -1
- package/dist/chunk-RWMV7APX.js +0 -2
- package/dist/chunk-TSVURBUY.js.map +0 -1
- package/dist/chunk-WV7QV2PU.js +0 -2
- package/dist/chunk-WV7QV2PU.js.map +0 -1
- package/dist/chunk-Z47R2CIM.js.map +0 -1
- package/dist/components/form/button.js +0 -2
- package/dist/components/form/calendar.js.map +0 -1
- package/dist/components/form/checkbox.js.map +0 -1
- package/dist/components/form/context/field.context.js +0 -2
- package/dist/components/form/date-picker.js.map +0 -1
- package/dist/components/form/floating-label.js +0 -2
- package/dist/components/form/input.js +0 -2
- package/dist/components/form/otp-input.js.map +0 -1
- package/dist/components/form/radio.js.map +0 -1
- package/dist/components/form/rich-editor.js.map +0 -1
- package/dist/components/form/search-input.js +0 -2
- package/dist/components/form/search-input.js.map +0 -1
- package/dist/components/form/switch.js +0 -2
- package/dist/components/table.d.ts +0 -17
- package/dist/components/table.js +0 -2
- package/dist/components/table.js.map +0 -1
- package/dist/icons-CmDuL0gZ.d.ts +0 -4
- package/eslint.config.js +0 -10
- package/postcss.config.js +0 -5
- package/prettier.config.js +0 -7
- package/src/components/avatar-group.tsx +0 -76
- package/src/components/avatar.tsx +0 -54
- package/src/components/badge.tsx +0 -40
- package/src/components/breadcrumb.tsx +0 -119
- package/src/components/chip.tsx +0 -117
- package/src/components/collapsible.tsx +0 -35
- package/src/components/dialog.tsx +0 -242
- package/src/components/divider.tsx +0 -24
- package/src/components/drag-and-drop/drag-handle.tsx +0 -46
- package/src/components/drag-and-drop/drag-list-item.tsx +0 -91
- package/src/components/drag-and-drop/drag-list.tsx +0 -47
- package/src/components/drag-and-drop/drag-root.tsx +0 -30
- package/src/components/drag-and-drop/index.ts +0 -39
- package/src/components/drag-and-drop/types/drag-item.ts +0 -7
- package/src/components/dropdown-menu.tsx +0 -101
- package/src/components/form/button.tsx +0 -107
- package/src/components/form/calendar.tsx +0 -124
- package/src/components/form/checkbox.tsx +0 -57
- package/src/components/form/context/field.context.ts +0 -27
- package/src/components/form/date-picker.tsx +0 -199
- package/src/components/form/floating-label.tsx +0 -60
- package/src/components/form/input.tsx +0 -235
- package/src/components/form/otp-input.tsx +0 -45
- package/src/components/form/radio.tsx +0 -74
- package/src/components/form/rich-editor.tsx +0 -372
- package/src/components/form/search-input.tsx +0 -111
- package/src/components/form/select.tsx +0 -274
- package/src/components/form/switch.tsx +0 -31
- package/src/components/full-calendar/calendar-add-event.tsx +0 -15
- package/src/components/full-calendar/calendar-body.tsx +0 -12
- package/src/components/full-calendar/calendar-cell.tsx +0 -120
- package/src/components/full-calendar/calendar-day-view.tsx +0 -76
- package/src/components/full-calendar/calendar-event.tsx +0 -178
- package/src/components/full-calendar/calendar-header.tsx +0 -14
- package/src/components/full-calendar/calendar-month-view.tsx +0 -69
- package/src/components/full-calendar/calendar-more-events-dropdown.tsx +0 -39
- package/src/components/full-calendar/calendar-navigator.tsx +0 -86
- package/src/components/full-calendar/calendar-root.tsx +0 -165
- package/src/components/full-calendar/calendar-today-button.tsx +0 -21
- package/src/components/full-calendar/calendar-toggle-view.tsx +0 -61
- package/src/components/full-calendar/calendar-view-renderer.tsx +0 -19
- package/src/components/full-calendar/calendar-week-day.tsx +0 -49
- package/src/components/full-calendar/calendar-week-view.tsx +0 -88
- package/src/components/full-calendar/helpers/calendar.ts +0 -158
- package/src/components/full-calendar/index.ts +0 -16
- package/src/components/full-calendar/types/calendar-cell.ts +0 -4
- package/src/components/full-calendar/types/calendar-event.ts +0 -7
- package/src/components/full-calendar/types/calendar-view.ts +0 -1
- package/src/components/full-calendar/types/calendar-week-hour.ts +0 -4
- package/src/components/horizontal-scroll.tsx +0 -159
- package/src/components/icon.tsx +0 -29
- package/src/components/list.tsx +0 -111
- package/src/components/logo.tsx +0 -44
- package/src/components/selection-bar.tsx +0 -273
- package/src/components/sheet.tsx +0 -141
- package/src/components/skeleton.tsx +0 -12
- package/src/components/status.tsx +0 -43
- package/src/components/table.tsx +0 -160
- package/src/components/tabs.tsx +0 -72
- package/src/components/tag.tsx +0 -99
- package/src/components/tooltip.tsx +0 -63
- package/src/components/typography.tsx +0 -85
- package/src/components/upload.tsx +0 -647
- package/src/hooks/index.ts +0 -1
- package/src/hooks/use-os.ts +0 -32
- package/src/index.css +0 -5
- package/src/resources/icons.ts +0 -153
- package/src/resources/input-mask.ts +0 -91
- package/src/resources/logo/horizontal.tsx +0 -70
- package/src/resources/logo/icon.tsx +0 -54
- package/src/resources/logo/index.tsx +0 -33
- package/src/resources/logo/vertical.tsx +0 -70
- package/src/types.d.ts +0 -4
- package/tsconfig.json +0 -4
- package/tsup.config.ts +0 -30
- /package/dist/components/{form → controls}/button.d.ts +0 -0
- /package/dist/components/{form → controls}/button.js.map +0 -0
- /package/dist/components/{form → controls}/calendar.d.ts +0 -0
- /package/dist/components/{form → controls}/checkbox.d.ts +0 -0
- /package/dist/components/{form → controls}/context/field.context.js.map +0 -0
- /package/dist/components/{form → controls}/floating-label.d.ts +0 -0
- /package/dist/components/{form → controls}/floating-label.js.map +0 -0
- /package/dist/components/{form → controls}/input.js.map +0 -0
- /package/dist/components/{form → controls}/otp-input.d.ts +0 -0
- /package/dist/components/{form → controls}/otp-input.js +0 -0
- /package/dist/components/{form → controls}/radio.d.ts +0 -0
- /package/dist/components/{form → controls}/radio.js +0 -0
- /package/dist/components/{form → controls}/rich-editor.d.ts +0 -0
- /package/dist/components/{form → controls}/select.js.map +0 -0
- /package/dist/components/{form → controls}/switch.d.ts +0 -0
- /package/dist/components/{form → controls}/switch.js.map +0 -0
|
@@ -1,647 +0,0 @@
|
|
|
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/hooks/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useOS } from './use-os'
|
package/src/hooks/use-os.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react'
|
|
2
|
-
|
|
3
|
-
export type OS = 'ios' | 'macos' | 'windows' | 'android' | 'linux' | 'unknown'
|
|
4
|
-
|
|
5
|
-
export function useOS() {
|
|
6
|
-
const [os, setOs] = useState<OS>('unknown')
|
|
7
|
-
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
if (typeof window === 'undefined') return
|
|
10
|
-
|
|
11
|
-
const userAgent = window.navigator.userAgent
|
|
12
|
-
|
|
13
|
-
if (/iPad|iPhone|iPod/.test(userAgent)) {
|
|
14
|
-
setOs('ios')
|
|
15
|
-
} else if (/Mac/.test(userAgent)) {
|
|
16
|
-
setOs('macos')
|
|
17
|
-
} else if (/Win/.test(userAgent)) {
|
|
18
|
-
setOs('windows')
|
|
19
|
-
} else if (/Android/.test(userAgent)) {
|
|
20
|
-
setOs('android')
|
|
21
|
-
} else if (/Linux/.test(userAgent)) {
|
|
22
|
-
setOs('linux')
|
|
23
|
-
} else {
|
|
24
|
-
setOs('unknown')
|
|
25
|
-
}
|
|
26
|
-
}, [])
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
os,
|
|
30
|
-
shortcut: ['macos', 'ios'].includes(os) ? '⌘' : 'Ctrl'
|
|
31
|
-
}
|
|
32
|
-
}
|