@xjur-ui/react 2.0.0 → 2.1.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.
- package/.turbo/turbo-build.log +409 -119
- package/CHANGELOG.md +76 -0
- package/dist/chunk-2JQVYVAT.js +2 -0
- 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/{components/switch.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-4BGTC333.js +2 -0
- package/dist/chunk-4BGTC333.js.map +1 -0
- package/dist/chunk-4PTFZTVU.js +2 -0
- package/dist/chunk-4PTFZTVU.js.map +1 -0
- package/dist/chunk-6PHXO2YA.js +2 -0
- package/dist/{chunk-RWMV7APX.js.map → chunk-6PHXO2YA.js.map} +1 -1
- package/dist/chunk-7HG6Y3VV.js +2 -0
- package/dist/chunk-7HG6Y3VV.js.map +1 -0
- 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-ASZAHSU5.js +2 -0
- package/dist/chunk-ASZAHSU5.js.map +1 -0
- package/dist/chunk-BZDGWC5O.js +2 -0
- package/dist/chunk-BZDGWC5O.js.map +1 -0
- package/dist/chunk-DFXHNK5D.js +2 -0
- package/dist/chunk-DFXHNK5D.js.map +1 -0
- package/dist/chunk-DOC3XTYC.js +2 -0
- package/dist/chunk-DOC3XTYC.js.map +1 -0
- package/dist/chunk-DT44JTXB.js +2 -0
- package/dist/chunk-DT44JTXB.js.map +1 -0
- 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-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-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-G6NSC3FL.js +2 -0
- package/dist/chunk-G6NSC3FL.js.map +1 -0
- package/dist/chunk-GKILN5HI.js +2 -0
- 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-J4X5RQTR.js +2 -0
- package/dist/chunk-J4X5RQTR.js.map +1 -0
- package/dist/chunk-JF7JKJES.js +2 -0
- package/dist/chunk-JF7JKJES.js.map +1 -0
- package/dist/chunk-JGPHBUVM.js +2 -0
- package/dist/chunk-JGPHBUVM.js.map +1 -0
- package/dist/{chunk-FASEHVMD.js → chunk-M6ZI7M3R.js} +2 -2
- package/dist/chunk-M6ZI7M3R.js.map +1 -0
- package/dist/chunk-MQ7YTZBI.js +2 -0
- package/dist/chunk-MQ7YTZBI.js.map +1 -0
- package/dist/chunk-MZSV4LNY.js +2 -0
- package/dist/chunk-MZSV4LNY.js.map +1 -0
- package/dist/chunk-O3JK6QF6.js +2 -0
- package/dist/chunk-O3JK6QF6.js.map +1 -0
- package/dist/chunk-OKSGVAQQ.js +2 -0
- 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-RGKXZJJS.js +3 -0
- package/dist/chunk-RGKXZJJS.js.map +1 -0
- package/dist/chunk-SLAAEXWI.js +2 -0
- package/dist/chunk-SLAAEXWI.js.map +1 -0
- package/dist/chunk-SSTXFHNX.js +2 -0
- package/dist/chunk-SSTXFHNX.js.map +1 -0
- package/dist/chunk-SXGSWVMZ.js +2 -0
- package/dist/chunk-SXGSWVMZ.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-WEBAXQID.js +2 -0
- package/dist/chunk-WEBAXQID.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/chunk-ZVVPUP7V.js +2 -0
- package/dist/chunk-ZVVPUP7V.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 +2 -1
- package/dist/components/chip.js +1 -1
- package/dist/components/controls/button.js +2 -0
- package/dist/components/controls/calendar.js +2 -0
- package/dist/components/controls/calendar.js.map +1 -0
- package/dist/components/controls/checkbox.js +2 -0
- package/dist/components/controls/checkbox.js.map +1 -0
- package/dist/components/controls/context/field.context.d.ts +14 -0
- package/dist/components/controls/context/field.context.js +2 -0
- package/dist/components/controls/context/field.context.js.map +1 -0
- package/dist/components/controls/date-picker.d.ts +85 -0
- package/dist/components/controls/date-picker.js +2 -0
- package/dist/components/controls/date-picker.js.map +1 -0
- package/dist/components/controls/floating-label.d.ts +6 -0
- package/dist/components/controls/floating-label.js +2 -0
- package/dist/components/controls/floating-label.js.map +1 -0
- package/dist/components/controls/input.d.ts +96 -0
- package/dist/components/controls/input.js +2 -0
- package/dist/components/controls/input.js.map +1 -0
- package/dist/components/controls/otp-input.js.map +1 -0
- package/dist/components/controls/radio.js +2 -0
- package/dist/components/controls/radio.js.map +1 -0
- package/dist/components/controls/rich-editor.js +2 -0
- package/dist/components/controls/rich-editor.js.map +1 -0
- package/dist/components/{search-input.d.ts → controls/search-input.d.ts} +9 -1
- package/dist/components/controls/search-input.js +2 -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/controls/select.d.ts +95 -0
- package/dist/components/controls/select.js +2 -0
- package/dist/components/controls/select.js.map +1 -0
- package/dist/components/controls/switch.js +2 -0
- package/dist/components/controls/switch.js.map +1 -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.d.ts +51 -0
- package/dist/components/dialog.js +2 -0
- package/dist/components/dialog.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 +1 -1
- 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 +1 -1
- package/dist/components/list.js +1 -1
- 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 +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 +2 -1
- package/dist/components/tag.js +1 -1
- 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/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 +26 -14
- package/src/components/breadcrumb.tsx +119 -0
- package/src/components/{calendar.tsx → controls/calendar.tsx} +1 -1
- package/src/components/{checkbox.tsx → controls/checkbox.tsx} +2 -2
- package/src/components/controls/context/field.context.ts +27 -0
- package/src/components/controls/date-picker.tsx +199 -0
- package/src/components/controls/floating-label.tsx +60 -0
- package/src/components/controls/input.tsx +237 -0
- package/src/components/{radio.tsx → controls/radio.tsx} +1 -1
- package/src/components/{rich-editor.tsx → controls/rich-editor.tsx} +5 -5
- package/src/components/{search-input.tsx → controls/search-input.tsx} +46 -3
- package/src/components/controls/search-selector.tsx +98 -0
- package/src/components/controls/select.tsx +274 -0
- package/src/components/custom/pessoa/index.ts +9 -0
- package/src/components/custom/pessoa/pessoa-add-button.tsx +35 -0
- package/src/components/custom/pessoa/pessoa-body.tsx +22 -0
- package/src/components/custom/pessoa/pessoa-close-button.tsx +13 -0
- package/src/components/custom/pessoa/pessoa-content.tsx +25 -0
- package/src/components/custom/pessoa/pessoa-footer.tsx +15 -0
- package/src/components/custom/pessoa/pessoa-header.tsx +35 -0
- package/src/components/custom/pessoa/pessoa-trigger.tsx +25 -0
- package/src/components/custom/pessoa/pessoa.context.tsx +73 -0
- package/src/components/custom/pessoa/pessoa.tsx +35 -0
- 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/dropdown-menu.tsx +1 -1
- 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/list.tsx +1 -1
- package/src/components/selection-bar.tsx +273 -0
- package/src/components/sheet.tsx +26 -17
- package/src/components/steps/index.ts +6 -0
- package/src/components/steps/step.tsx +23 -0
- package/src/components/steps/steps-action.tsx +65 -0
- package/src/components/steps/steps-content.tsx +12 -0
- package/src/components/steps/steps-context.tsx +121 -0
- package/src/components/steps/steps-navigation.tsx +80 -0
- package/src/components/steps/steps-root.tsx +9 -0
- package/src/components/table/index.ts +8 -0
- package/src/components/table/table-body.tsx +17 -0
- package/src/components/table/table-cell.tsx +14 -0
- package/src/components/table/table-footer.tsx +17 -0
- package/src/components/table/table-head.tsx +31 -0
- package/src/components/table/table-header.tsx +17 -0
- package/src/components/table/table-row.tsx +21 -0
- package/src/components/table/table-sort.tsx +34 -0
- package/src/components/table/table.tsx +16 -0
- package/src/components/upload.tsx +647 -0
- package/src/resources/icons.ts +5 -1
- package/dist/chunk-FASEHVMD.js.map +0 -1
- package/dist/chunk-KIFR5VIE.js +0 -2
- package/dist/chunk-NPTLORW5.js +0 -2
- package/dist/chunk-NPTLORW5.js.map +0 -1
- package/dist/chunk-RWMV7APX.js +0 -2
- package/dist/chunk-SHHXKVVR.js +0 -2
- package/dist/chunk-SHHXKVVR.js.map +0 -1
- package/dist/components/button.js +0 -2
- package/dist/components/calendar.js +0 -2
- package/dist/components/calendar.js.map +0 -1
- package/dist/components/checkbox.js +0 -2
- package/dist/components/checkbox.js.map +0 -1
- package/dist/components/date-picker.d.ts +0 -25
- package/dist/components/date-picker.js +0 -2
- package/dist/components/date-picker.js.map +0 -1
- package/dist/components/input.d.ts +0 -37
- package/dist/components/input.js +0 -2
- package/dist/components/input.js.map +0 -1
- package/dist/components/otp-input.js.map +0 -1
- package/dist/components/radio.js +0 -2
- package/dist/components/radio.js.map +0 -1
- package/dist/components/rich-editor.js +0 -2
- package/dist/components/rich-editor.js.map +0 -1
- package/dist/components/search-input.js +0 -2
- package/dist/components/select.d.ts +0 -36
- package/dist/components/select.js +0 -2
- package/dist/components/select.js.map +0 -1
- package/dist/components/switch.js.map +0 -1
- package/dist/components/table.d.ts +0 -17
- package/dist/components/table.js +0 -2
- package/dist/components/table.js.map +0 -1
- package/src/components/date-picker.tsx +0 -263
- package/src/components/input.tsx +0 -320
- package/src/components/select.tsx +0 -318
- package/src/components/table.tsx +0 -160
- /package/dist/components/{button.d.ts → controls/button.d.ts} +0 -0
- /package/dist/components/{button.js.map → controls/button.js.map} +0 -0
- /package/dist/components/{calendar.d.ts → controls/calendar.d.ts} +0 -0
- /package/dist/components/{checkbox.d.ts → controls/checkbox.d.ts} +0 -0
- /package/dist/components/{otp-input.d.ts → controls/otp-input.d.ts} +0 -0
- /package/dist/components/{otp-input.js → controls/otp-input.js} +0 -0
- /package/dist/components/{radio.d.ts → controls/radio.d.ts} +0 -0
- /package/dist/components/{rich-editor.d.ts → controls/rich-editor.d.ts} +0 -0
- /package/dist/components/{search-input.js.map → controls/search-input.js.map} +0 -0
- /package/dist/components/{switch.d.ts → controls/switch.d.ts} +0 -0
- /package/src/components/{button.tsx → controls/button.tsx} +0 -0
- /package/src/components/{otp-input.tsx → controls/otp-input.tsx} +0 -0
- /package/src/components/{switch.tsx → controls/switch.tsx} +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { useCallback } from 'react'
|
|
2
|
+
import { cx } from '@xjur-ui/util'
|
|
3
|
+
import { setHours } from 'date-fns'
|
|
4
|
+
import { Typography } from '../typography'
|
|
5
|
+
import { WEEK_HOURS, getEventsForDayAndHour } from './helpers/calendar'
|
|
6
|
+
import { useFullCalendar } from './calendar-root'
|
|
7
|
+
import { CalendarWeekDay } from './calendar-week-day'
|
|
8
|
+
import { CalendarCell } from './calendar-cell'
|
|
9
|
+
import type { ICalendarCell } from './types/calendar-cell'
|
|
10
|
+
|
|
11
|
+
export function CalendarDayView() {
|
|
12
|
+
const { selectedDate, events } = useFullCalendar()
|
|
13
|
+
|
|
14
|
+
const getEventsForDayAndHourCallback = useCallback(
|
|
15
|
+
(date: Date, hour: number) => {
|
|
16
|
+
return getEventsForDayAndHour(events, date, hour)
|
|
17
|
+
},
|
|
18
|
+
[events]
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
const cellsWithHour = useCallback((cell: ICalendarCell, hour: number) => {
|
|
22
|
+
return {
|
|
23
|
+
...cell,
|
|
24
|
+
date: setHours(cell.date, hour)
|
|
25
|
+
}
|
|
26
|
+
}, [])
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div className="bg-layer-2-hover rounded-small-1x border-border-layer-2 scrollbar-hide h-full w-full border">
|
|
30
|
+
<div className="flex flex-1 flex-col">
|
|
31
|
+
<div
|
|
32
|
+
className="bg-layer-2-hover sticky top-0 z-10 flex w-full"
|
|
33
|
+
data-slot="week-header"
|
|
34
|
+
>
|
|
35
|
+
<div className="w-[64px]" />
|
|
36
|
+
<CalendarWeekDay
|
|
37
|
+
className="border-border-layer-2 items-start border-l"
|
|
38
|
+
date={selectedDate}
|
|
39
|
+
/>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div className="overflow-hidden">
|
|
43
|
+
{WEEK_HOURS.map(({ hour, label }) => (
|
|
44
|
+
<div className="flex items-start" key={hour}>
|
|
45
|
+
<div className="px-small flex h-full w-[64px] items-start justify-end">
|
|
46
|
+
<Typography size="sm-1x" variant="label" weight="medium">
|
|
47
|
+
{label}
|
|
48
|
+
</Typography>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<div
|
|
52
|
+
className={cx(
|
|
53
|
+
'flex flex-1',
|
|
54
|
+
'[&>*]:border-border-layer-2',
|
|
55
|
+
'[&>*]:border-t',
|
|
56
|
+
'[&>*]:border-l'
|
|
57
|
+
)}
|
|
58
|
+
>
|
|
59
|
+
<CalendarCell
|
|
60
|
+
cell={cellsWithHour(
|
|
61
|
+
{
|
|
62
|
+
date: selectedDate,
|
|
63
|
+
type: 'day'
|
|
64
|
+
},
|
|
65
|
+
hour
|
|
66
|
+
)}
|
|
67
|
+
events={getEventsForDayAndHourCallback(selectedDate, hour)}
|
|
68
|
+
/>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
))}
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { cx, tv } from '@xjur-ui/util'
|
|
2
|
+
import type { ComponentProps } from 'react'
|
|
3
|
+
import { useDraggable } from '@dnd-kit/core'
|
|
4
|
+
import { Typography } from '../typography'
|
|
5
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from '../tooltip'
|
|
6
|
+
import type {
|
|
7
|
+
ICalendarEvent,
|
|
8
|
+
ICalendarEventStatus
|
|
9
|
+
} from './types/calendar-event'
|
|
10
|
+
import { useFullCalendar } from './calendar-root'
|
|
11
|
+
|
|
12
|
+
const eventVariants = tv({
|
|
13
|
+
base: 'py-small_1x-alt pr-small pl-medium rounded-small-2x transition-colors duration-100 ease-out',
|
|
14
|
+
variants: {
|
|
15
|
+
status: {
|
|
16
|
+
pending:
|
|
17
|
+
'bg-layer-2-hover border-l-2 border-border-layer-4 hover:bg-layer-2-pressed active:bg-layer-2-active',
|
|
18
|
+
completed:
|
|
19
|
+
'bg-success-alt-idle border-l-2 border-success-idle hover:bg-success-alt-hover active:bg-success-alt-pressed',
|
|
20
|
+
cancelled:
|
|
21
|
+
'bg-danger-alt-idle border-l-2 border-danger-idle hover:bg-danger-alt-hover active:bg-danger-alt-pressed'
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: {
|
|
25
|
+
status: 'pending'
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
interface CalendarEventProps extends ComponentProps<'div'> {
|
|
30
|
+
event: ICalendarEvent
|
|
31
|
+
disabled?: boolean
|
|
32
|
+
status?: ICalendarEventStatus
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function CalendarEvent({
|
|
36
|
+
event,
|
|
37
|
+
disabled = false,
|
|
38
|
+
status = 'pending',
|
|
39
|
+
className,
|
|
40
|
+
children,
|
|
41
|
+
...props
|
|
42
|
+
}: CalendarEventProps) {
|
|
43
|
+
const { onEventMove } = useFullCalendar()
|
|
44
|
+
const isDraggingDisabled = disabled || !onEventMove
|
|
45
|
+
|
|
46
|
+
const { attributes, listeners, setNodeRef, transform, isDragging } =
|
|
47
|
+
useDraggable({
|
|
48
|
+
id: event.id,
|
|
49
|
+
disabled: isDraggingDisabled,
|
|
50
|
+
data: {
|
|
51
|
+
event,
|
|
52
|
+
type: 'calendar-event'
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
const style = transform
|
|
57
|
+
? {
|
|
58
|
+
transform: `translate3d(${transform.x}px, ${transform.y}px, 0)`
|
|
59
|
+
}
|
|
60
|
+
: undefined
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<div
|
|
64
|
+
className={cx(
|
|
65
|
+
disabled && 'pointer-events-none',
|
|
66
|
+
'cursor-pointer active:cursor-grabbing',
|
|
67
|
+
isDragging && 'z-1000 -rotate-2',
|
|
68
|
+
eventVariants({ status }),
|
|
69
|
+
className
|
|
70
|
+
)}
|
|
71
|
+
data-draggable-event-id={event.id}
|
|
72
|
+
data-slot="calendar-event"
|
|
73
|
+
ref={setNodeRef}
|
|
74
|
+
style={style}
|
|
75
|
+
{...listeners}
|
|
76
|
+
{...attributes}
|
|
77
|
+
{...props}
|
|
78
|
+
>
|
|
79
|
+
{children}
|
|
80
|
+
</div>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function CalendarEventTitle({
|
|
85
|
+
size = 'sm',
|
|
86
|
+
variant = 'label',
|
|
87
|
+
weight = 'medium',
|
|
88
|
+
className,
|
|
89
|
+
...props
|
|
90
|
+
}: ComponentProps<typeof Typography>) {
|
|
91
|
+
const { activeEventId } = useFullCalendar()
|
|
92
|
+
|
|
93
|
+
if (activeEventId !== null) {
|
|
94
|
+
return (
|
|
95
|
+
<Typography
|
|
96
|
+
className={cx(className, 'text-title-neutral truncate')}
|
|
97
|
+
size={size}
|
|
98
|
+
variant={variant}
|
|
99
|
+
weight={weight}
|
|
100
|
+
{...props}
|
|
101
|
+
/>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<Tooltip delayDuration={500}>
|
|
107
|
+
<TooltipTrigger asChild={true}>
|
|
108
|
+
<Typography
|
|
109
|
+
className={cx(className, 'text-title-neutral truncate')}
|
|
110
|
+
size={size}
|
|
111
|
+
variant={variant}
|
|
112
|
+
weight={weight}
|
|
113
|
+
{...props}
|
|
114
|
+
/>
|
|
115
|
+
</TooltipTrigger>
|
|
116
|
+
<TooltipContent className="max-w-[320px]">
|
|
117
|
+
{props.children}
|
|
118
|
+
</TooltipContent>
|
|
119
|
+
</Tooltip>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function CalendarEventDescription({
|
|
124
|
+
size = 'sm-1x',
|
|
125
|
+
variant = 'body',
|
|
126
|
+
weight = 'normal',
|
|
127
|
+
className,
|
|
128
|
+
...props
|
|
129
|
+
}: ComponentProps<typeof Typography>) {
|
|
130
|
+
const { activeEventId } = useFullCalendar()
|
|
131
|
+
|
|
132
|
+
if (activeEventId !== null) {
|
|
133
|
+
return (
|
|
134
|
+
<Typography
|
|
135
|
+
className={cx(className, 'truncate')}
|
|
136
|
+
size={size}
|
|
137
|
+
variant={variant}
|
|
138
|
+
weight={weight}
|
|
139
|
+
{...props}
|
|
140
|
+
/>
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<Tooltip delayDuration={500}>
|
|
146
|
+
<TooltipTrigger asChild={true}>
|
|
147
|
+
<Typography
|
|
148
|
+
className={cx(className, 'truncate')}
|
|
149
|
+
size={size}
|
|
150
|
+
variant={variant}
|
|
151
|
+
weight={weight}
|
|
152
|
+
{...props}
|
|
153
|
+
/>
|
|
154
|
+
</TooltipTrigger>
|
|
155
|
+
<TooltipContent className="max-w-[320px]">
|
|
156
|
+
{props.children}
|
|
157
|
+
</TooltipContent>
|
|
158
|
+
</Tooltip>
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export function CalendarEventStatus({
|
|
163
|
+
variant = 'body',
|
|
164
|
+
size = 'sm-1x',
|
|
165
|
+
weight = 'normal',
|
|
166
|
+
className,
|
|
167
|
+
...props
|
|
168
|
+
}: ComponentProps<typeof Typography>) {
|
|
169
|
+
return (
|
|
170
|
+
<Typography
|
|
171
|
+
className={cx(className, 'truncate')}
|
|
172
|
+
size={size}
|
|
173
|
+
variant={variant}
|
|
174
|
+
weight={weight}
|
|
175
|
+
{...props}
|
|
176
|
+
/>
|
|
177
|
+
)
|
|
178
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { cx } from '@xjur-ui/util'
|
|
2
|
+
import type { ComponentProps } from 'react'
|
|
3
|
+
|
|
4
|
+
export function CalendarHeader({ className, ...props }: ComponentProps<'div'>) {
|
|
5
|
+
return (
|
|
6
|
+
<div
|
|
7
|
+
{...props}
|
|
8
|
+
className={cx(
|
|
9
|
+
className,
|
|
10
|
+
'gap-medium h-large-4x flex w-full items-center'
|
|
11
|
+
)}
|
|
12
|
+
/>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { useCallback, useMemo } from 'react'
|
|
2
|
+
import { cx } from '@xjur-ui/util'
|
|
3
|
+
import { Typography } from '../typography'
|
|
4
|
+
import { getDaysInMonth, getEventsForDay, WEEKDAYS } from './helpers/calendar'
|
|
5
|
+
import { useFullCalendar } from './calendar-root'
|
|
6
|
+
import { CalendarCell } from './calendar-cell'
|
|
7
|
+
import type { ICalendarCell } from './types/calendar-cell'
|
|
8
|
+
|
|
9
|
+
export function CalendarMonthView() {
|
|
10
|
+
const { selectedDate, events } = useFullCalendar()
|
|
11
|
+
|
|
12
|
+
const monthDaysCells = useMemo(
|
|
13
|
+
() => getDaysInMonth(selectedDate),
|
|
14
|
+
[selectedDate]
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
const getEventsForDayCell = useCallback(
|
|
18
|
+
(cell: ICalendarCell) => {
|
|
19
|
+
return getEventsForDay(events, cell.date)
|
|
20
|
+
},
|
|
21
|
+
[events]
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div className="rounded-small-1x scrollbar-hide border-border-layer-2 h-full w-full border">
|
|
26
|
+
<div
|
|
27
|
+
className="bg-layer-2-hover h-large-4x rounded-t-small-1x sticky top-0 grid grid-cols-7"
|
|
28
|
+
data-slot="month-header"
|
|
29
|
+
>
|
|
30
|
+
{WEEKDAYS.map(weekday => (
|
|
31
|
+
<div
|
|
32
|
+
className={cx(
|
|
33
|
+
'p-small b border-border-layer-2 flex items-center justify-center border-r last:border-r-0'
|
|
34
|
+
)}
|
|
35
|
+
data-slot="month-header-weekday"
|
|
36
|
+
key={weekday}
|
|
37
|
+
>
|
|
38
|
+
<Typography size="sm" variant="label" weight="medium">
|
|
39
|
+
{weekday}
|
|
40
|
+
</Typography>
|
|
41
|
+
</div>
|
|
42
|
+
))}
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<div
|
|
46
|
+
className="grid h-full grid-cols-7 overflow-hidden"
|
|
47
|
+
data-slot="month-day-cells"
|
|
48
|
+
>
|
|
49
|
+
{monthDaysCells.map((cell, index) => {
|
|
50
|
+
const isLastColumn = (index + 1) % 7 === 0
|
|
51
|
+
const isFirstColumn = (index + 1) % 7 === 1
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<div
|
|
55
|
+
className={cx(
|
|
56
|
+
'border-border-layer-2 border-t border-r',
|
|
57
|
+
isLastColumn && 'pr-small-2x border-r-0',
|
|
58
|
+
isFirstColumn && 'pl-small-2x'
|
|
59
|
+
)}
|
|
60
|
+
key={`${cell.date.toISOString()}-${index}`}
|
|
61
|
+
>
|
|
62
|
+
<CalendarCell cell={cell} events={getEventsForDayCell(cell)} />
|
|
63
|
+
</div>
|
|
64
|
+
)
|
|
65
|
+
})}
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Fragment } from 'react/jsx-runtime'
|
|
2
|
+
import { Button } from '../controls/button'
|
|
3
|
+
import {
|
|
4
|
+
DropdownMenuRoot,
|
|
5
|
+
DropdownMenuList,
|
|
6
|
+
DropdownMenuTrigger,
|
|
7
|
+
DropdownMenuContent
|
|
8
|
+
} from '../dropdown-menu'
|
|
9
|
+
import { useFullCalendar } from './calendar-root'
|
|
10
|
+
import type { ICalendarEvent } from './types/calendar-event'
|
|
11
|
+
|
|
12
|
+
interface CalendarMoreEventsDropdownProps {
|
|
13
|
+
events: ICalendarEvent[]
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function CalendarMoreEventsDropdown({
|
|
17
|
+
events
|
|
18
|
+
}: CalendarMoreEventsDropdownProps) {
|
|
19
|
+
const { renderEvent } = useFullCalendar()
|
|
20
|
+
return (
|
|
21
|
+
<DropdownMenuRoot>
|
|
22
|
+
<DropdownMenuTrigger asChild={true}>
|
|
23
|
+
<Button size="sm" variant="outlined">
|
|
24
|
+
Mais {events.length}
|
|
25
|
+
</Button>
|
|
26
|
+
</DropdownMenuTrigger>
|
|
27
|
+
|
|
28
|
+
<DropdownMenuContent className="w-[240px]">
|
|
29
|
+
<DropdownMenuList>
|
|
30
|
+
{events.map(event => (
|
|
31
|
+
<Fragment key={event.eventDate.toISOString()}>
|
|
32
|
+
{renderEvent?.(event)}
|
|
33
|
+
</Fragment>
|
|
34
|
+
))}
|
|
35
|
+
</DropdownMenuList>
|
|
36
|
+
</DropdownMenuContent>
|
|
37
|
+
</DropdownMenuRoot>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { useCallback, useMemo } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
addDays,
|
|
4
|
+
addMonths,
|
|
5
|
+
addWeeks,
|
|
6
|
+
format,
|
|
7
|
+
startOfWeek,
|
|
8
|
+
subDays,
|
|
9
|
+
subMonths,
|
|
10
|
+
subWeeks
|
|
11
|
+
} from 'date-fns'
|
|
12
|
+
import { ptBR } from 'date-fns/locale'
|
|
13
|
+
import { capitalize } from '@xjur-ui/util'
|
|
14
|
+
import { Typography } from '../typography'
|
|
15
|
+
import { Button } from '../controls/button'
|
|
16
|
+
import { Icon } from '../icon'
|
|
17
|
+
import { useFullCalendar } from './calendar-root'
|
|
18
|
+
import { getStartAndEndDateOfWeek } from './helpers/calendar'
|
|
19
|
+
|
|
20
|
+
export function CalendarNavigator() {
|
|
21
|
+
const { selectedDate, calendarView, setSelectedDate } = useFullCalendar()
|
|
22
|
+
|
|
23
|
+
const viewLabel = useMemo(() => {
|
|
24
|
+
if (calendarView === 'month') {
|
|
25
|
+
return capitalize(
|
|
26
|
+
format(selectedDate, "MMMM 'de' yyyy", { locale: ptBR })
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (calendarView === 'week') {
|
|
31
|
+
const { start, end } = getStartAndEndDateOfWeek(selectedDate)
|
|
32
|
+
const month = format(end, 'MMMM', { locale: ptBR })
|
|
33
|
+
const year = format(end, 'yyyy', { locale: ptBR })
|
|
34
|
+
return `${start.getDate()} - ${end.getDate()} de ${month} de ${year}`
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return format(selectedDate, "dd 'de' MMMM 'de' yyyy", { locale: ptBR })
|
|
38
|
+
}, [selectedDate, calendarView])
|
|
39
|
+
|
|
40
|
+
const handleNextDate = useCallback(() => {
|
|
41
|
+
if (calendarView === 'month') {
|
|
42
|
+
setSelectedDate(addMonths(selectedDate, 1))
|
|
43
|
+
return
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (calendarView === 'week') {
|
|
47
|
+
const nextWeek = startOfWeek(addWeeks(selectedDate, 1))
|
|
48
|
+
setSelectedDate(nextWeek)
|
|
49
|
+
return
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const nextDay = addDays(selectedDate, 1)
|
|
53
|
+
setSelectedDate(nextDay)
|
|
54
|
+
}, [selectedDate, setSelectedDate, calendarView])
|
|
55
|
+
|
|
56
|
+
const handlePreviousDate = useCallback(() => {
|
|
57
|
+
if (calendarView === 'month') {
|
|
58
|
+
setSelectedDate(subMonths(selectedDate, 1))
|
|
59
|
+
return
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (calendarView === 'week') {
|
|
63
|
+
setSelectedDate(subWeeks(selectedDate, 1))
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
setSelectedDate(subDays(selectedDate, 1))
|
|
67
|
+
}, [selectedDate, setSelectedDate, calendarView])
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<div className="gap-large flex items-center">
|
|
71
|
+
<Typography className="text-title-neutral" size="lg" variant="title">
|
|
72
|
+
{viewLabel}
|
|
73
|
+
</Typography>
|
|
74
|
+
|
|
75
|
+
<div className="gap-small flex items-center">
|
|
76
|
+
<Button size="icon_md" variant="tertiary" onClick={handlePreviousDate}>
|
|
77
|
+
<Icon className="text-icon-neutral-3" name="chevron_left" />
|
|
78
|
+
</Button>
|
|
79
|
+
|
|
80
|
+
<Button size="icon_md" variant="tertiary" onClick={handleNextDate}>
|
|
81
|
+
<Icon className="text-icon-neutral-3" name="chevron_right" />
|
|
82
|
+
</Button>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
createContext,
|
|
3
|
+
use,
|
|
4
|
+
useCallback,
|
|
5
|
+
useMemo,
|
|
6
|
+
useState
|
|
7
|
+
} from 'react'
|
|
8
|
+
import {
|
|
9
|
+
DndContext,
|
|
10
|
+
closestCenter,
|
|
11
|
+
useSensor,
|
|
12
|
+
useSensors,
|
|
13
|
+
PointerSensor,
|
|
14
|
+
KeyboardSensor,
|
|
15
|
+
type DragEndEvent,
|
|
16
|
+
type DragStartEvent,
|
|
17
|
+
MouseSensor
|
|
18
|
+
} from '@dnd-kit/core'
|
|
19
|
+
import { sortableKeyboardCoordinates } from '@dnd-kit/sortable'
|
|
20
|
+
import type { ICalendarEvent } from './types/calendar-event'
|
|
21
|
+
import type { CalendarView } from './types/calendar-view'
|
|
22
|
+
|
|
23
|
+
interface CalendarContextType {
|
|
24
|
+
events: ICalendarEvent[]
|
|
25
|
+
selectedDate: Date
|
|
26
|
+
calendarView?: CalendarView
|
|
27
|
+
activeEventId: string | null
|
|
28
|
+
disableEventCreationInPast?: boolean
|
|
29
|
+
renderEvent: (event: ICalendarEvent) => React.ReactNode
|
|
30
|
+
handleChangeView: (view: CalendarView) => void
|
|
31
|
+
setSelectedDate: React.Dispatch<React.SetStateAction<Date>>
|
|
32
|
+
onEventMove?: (eventId: string, newDate: Date) => void
|
|
33
|
+
onAddEvent?: (date: Date) => void
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const CalendarContext = createContext<CalendarContextType>({
|
|
37
|
+
events: [],
|
|
38
|
+
calendarView: 'month',
|
|
39
|
+
selectedDate: new Date(),
|
|
40
|
+
activeEventId: null,
|
|
41
|
+
disableEventCreationInPast: true,
|
|
42
|
+
renderEvent: () => null,
|
|
43
|
+
setSelectedDate: () => {},
|
|
44
|
+
handleChangeView: () => {},
|
|
45
|
+
onEventMove: () => {},
|
|
46
|
+
onAddEvent: () => {}
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
export function CalendarRoot({
|
|
50
|
+
children,
|
|
51
|
+
events,
|
|
52
|
+
calendarView: calendarViewProp = 'month',
|
|
53
|
+
selectedDate: selectedDateProp = new Date(),
|
|
54
|
+
disableEventCreationInPast = true,
|
|
55
|
+
renderEvent,
|
|
56
|
+
onEventMove,
|
|
57
|
+
onAddEvent
|
|
58
|
+
}: {
|
|
59
|
+
children: React.ReactNode
|
|
60
|
+
events: ICalendarEvent[]
|
|
61
|
+
selectedDate?: Date
|
|
62
|
+
calendarView?: CalendarView
|
|
63
|
+
disableEventCreationInPast?: boolean
|
|
64
|
+
renderEvent: (event: ICalendarEvent) => React.ReactNode
|
|
65
|
+
onEventMove?: (eventId: string, newDate: Date) => void
|
|
66
|
+
onAddEvent?: (date: Date) => void
|
|
67
|
+
}) {
|
|
68
|
+
const [selectedDate, setSelectedDate] = useState(selectedDateProp)
|
|
69
|
+
const [calendarView, setCalendarView] = useState(calendarViewProp)
|
|
70
|
+
const [activeEventId, setActiveEventId] = useState<string | null>(null)
|
|
71
|
+
|
|
72
|
+
const handleChangeView = useCallback((view: CalendarView) => {
|
|
73
|
+
setSelectedDate(new Date())
|
|
74
|
+
setCalendarView(view)
|
|
75
|
+
}, [])
|
|
76
|
+
|
|
77
|
+
const sensors = useSensors(
|
|
78
|
+
useSensor(PointerSensor, {
|
|
79
|
+
activationConstraint: {
|
|
80
|
+
distance: 8
|
|
81
|
+
}
|
|
82
|
+
}),
|
|
83
|
+
useSensor(KeyboardSensor, {
|
|
84
|
+
coordinateGetter: sortableKeyboardCoordinates
|
|
85
|
+
}),
|
|
86
|
+
useSensor(MouseSensor, {
|
|
87
|
+
activationConstraint: {
|
|
88
|
+
distance: 5,
|
|
89
|
+
delay: 250
|
|
90
|
+
}
|
|
91
|
+
})
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
const handleDragStart = useCallback((event: DragStartEvent) => {
|
|
95
|
+
const eventId = event.active.id.toString()
|
|
96
|
+
setActiveEventId(eventId)
|
|
97
|
+
}, [])
|
|
98
|
+
|
|
99
|
+
const handleDragEnd = useCallback(
|
|
100
|
+
(event: DragEndEvent) => {
|
|
101
|
+
const { active, over } = event
|
|
102
|
+
setActiveEventId(null)
|
|
103
|
+
|
|
104
|
+
if (!active || !over || !onEventMove) return
|
|
105
|
+
|
|
106
|
+
const eventId = active.id.toString()
|
|
107
|
+
const cellDate = over.data.current?.date as Date
|
|
108
|
+
|
|
109
|
+
console.log(cellDate)
|
|
110
|
+
|
|
111
|
+
if (cellDate) {
|
|
112
|
+
onEventMove(eventId, cellDate)
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
[onEventMove]
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
const providerValue = useMemo(
|
|
119
|
+
() => ({
|
|
120
|
+
events,
|
|
121
|
+
renderEvent,
|
|
122
|
+
activeEventId,
|
|
123
|
+
disableEventCreationInPast,
|
|
124
|
+
selectedDate,
|
|
125
|
+
setSelectedDate,
|
|
126
|
+
|
|
127
|
+
calendarView,
|
|
128
|
+
handleChangeView,
|
|
129
|
+
onEventMove,
|
|
130
|
+
onAddEvent
|
|
131
|
+
}),
|
|
132
|
+
[
|
|
133
|
+
events,
|
|
134
|
+
renderEvent,
|
|
135
|
+
activeEventId,
|
|
136
|
+
disableEventCreationInPast,
|
|
137
|
+
selectedDate,
|
|
138
|
+
calendarView,
|
|
139
|
+
handleChangeView,
|
|
140
|
+
onEventMove,
|
|
141
|
+
onAddEvent
|
|
142
|
+
]
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
return (
|
|
146
|
+
<CalendarContext.Provider value={providerValue}>
|
|
147
|
+
<DndContext
|
|
148
|
+
collisionDetection={closestCenter}
|
|
149
|
+
sensors={sensors}
|
|
150
|
+
onDragEnd={handleDragEnd}
|
|
151
|
+
onDragStart={handleDragStart}
|
|
152
|
+
>
|
|
153
|
+
{children}
|
|
154
|
+
</DndContext>
|
|
155
|
+
</CalendarContext.Provider>
|
|
156
|
+
)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export function useFullCalendar() {
|
|
160
|
+
const context = use(CalendarContext)
|
|
161
|
+
if (!context) {
|
|
162
|
+
throw new Error('useFullCalendar must be used within a CalendarRoot')
|
|
163
|
+
}
|
|
164
|
+
return context
|
|
165
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useCallback } from 'react'
|
|
2
|
+
import { Button, type ButtonProps } from '../controls/button'
|
|
3
|
+
import { useFullCalendar } from './calendar-root'
|
|
4
|
+
|
|
5
|
+
export function CalendarTodayButton({
|
|
6
|
+
children = 'Hoje',
|
|
7
|
+
variant = 'tertiary',
|
|
8
|
+
...props
|
|
9
|
+
}: ButtonProps) {
|
|
10
|
+
const { setSelectedDate } = useFullCalendar()
|
|
11
|
+
|
|
12
|
+
const handleToday = useCallback(() => {
|
|
13
|
+
setSelectedDate(new Date())
|
|
14
|
+
}, [setSelectedDate])
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<Button variant={variant} onClick={handleToday} {...props}>
|
|
18
|
+
{children}
|
|
19
|
+
</Button>
|
|
20
|
+
)
|
|
21
|
+
}
|