@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,61 @@
|
|
|
1
|
+
import { useMemo } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
SelectContent,
|
|
4
|
+
SelectOption,
|
|
5
|
+
SelectRoot,
|
|
6
|
+
SelectTrigger,
|
|
7
|
+
SelectValue,
|
|
8
|
+
SelectOptions,
|
|
9
|
+
SelectOptionText,
|
|
10
|
+
SelectIcon
|
|
11
|
+
} from '../controls/select'
|
|
12
|
+
import type { CalendarView } from './types/calendar-view'
|
|
13
|
+
import { useFullCalendar } from './calendar-root'
|
|
14
|
+
|
|
15
|
+
const views: Array<{ name: string; value: CalendarView }> = [
|
|
16
|
+
{ name: 'Mês', value: 'month' },
|
|
17
|
+
{ name: 'Semana', value: 'week' },
|
|
18
|
+
{ name: 'Dia', value: 'day' }
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
export function CalendarToggleView() {
|
|
22
|
+
const { calendarView, handleChangeView } = useFullCalendar()
|
|
23
|
+
|
|
24
|
+
const displayValue = useMemo(
|
|
25
|
+
() => views.find(view => view.value === calendarView)?.name,
|
|
26
|
+
[calendarView]
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div className="w-[94px]">
|
|
31
|
+
<SelectRoot>
|
|
32
|
+
<SelectTrigger>
|
|
33
|
+
<SelectValue
|
|
34
|
+
displayValue={displayValue}
|
|
35
|
+
name="calendar-toggle-view"
|
|
36
|
+
value={calendarView}
|
|
37
|
+
/>
|
|
38
|
+
<SelectIcon
|
|
39
|
+
className="text-icon-neutral-3"
|
|
40
|
+
name="keyboard_arrow_down"
|
|
41
|
+
/>
|
|
42
|
+
</SelectTrigger>
|
|
43
|
+
|
|
44
|
+
<SelectContent>
|
|
45
|
+
<SelectOptions>
|
|
46
|
+
{views.map(view => (
|
|
47
|
+
<SelectOption
|
|
48
|
+
isActive={calendarView === view.value}
|
|
49
|
+
key={view.value}
|
|
50
|
+
value={view.value}
|
|
51
|
+
onClick={() => handleChangeView(view.value)}
|
|
52
|
+
>
|
|
53
|
+
<SelectOptionText>{view.name}</SelectOptionText>
|
|
54
|
+
</SelectOption>
|
|
55
|
+
))}
|
|
56
|
+
</SelectOptions>
|
|
57
|
+
</SelectContent>
|
|
58
|
+
</SelectRoot>
|
|
59
|
+
</div>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useFullCalendar } from './calendar-root'
|
|
2
|
+
import { CalendarMonthView } from './calendar-month-view'
|
|
3
|
+
import { CalendarWeekView } from './calendar-week-view'
|
|
4
|
+
import { CalendarDayView } from './calendar-day-view'
|
|
5
|
+
|
|
6
|
+
export function CalendarViewRenderer() {
|
|
7
|
+
const { calendarView } = useFullCalendar()
|
|
8
|
+
|
|
9
|
+
switch (calendarView) {
|
|
10
|
+
case 'month':
|
|
11
|
+
return <CalendarMonthView />
|
|
12
|
+
case 'week':
|
|
13
|
+
return <CalendarWeekView />
|
|
14
|
+
case 'day':
|
|
15
|
+
return <CalendarDayView />
|
|
16
|
+
default:
|
|
17
|
+
return <CalendarMonthView />
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { cx } from '@xjur-ui/util'
|
|
2
|
+
import type { ComponentProps } from 'react'
|
|
3
|
+
import { Typography } from '../typography'
|
|
4
|
+
import { isToday, WEEKDAYS } from './helpers/calendar'
|
|
5
|
+
|
|
6
|
+
interface CalendarWeekDayProps extends ComponentProps<'div'> {
|
|
7
|
+
date: Date
|
|
8
|
+
className?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function CalendarWeekDay({
|
|
12
|
+
date,
|
|
13
|
+
className,
|
|
14
|
+
...props
|
|
15
|
+
}: CalendarWeekDayProps) {
|
|
16
|
+
const isCurrentDay = isToday(date)
|
|
17
|
+
const dayNumber = date.getDate()
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div
|
|
21
|
+
className={cx(
|
|
22
|
+
'p-small gap-small-1x flex w-full flex-1 flex-col items-center',
|
|
23
|
+
className
|
|
24
|
+
)}
|
|
25
|
+
data-slot="week-day"
|
|
26
|
+
key={date.toISOString()}
|
|
27
|
+
{...props}
|
|
28
|
+
>
|
|
29
|
+
<Typography size="sm" variant="label" weight="medium">
|
|
30
|
+
{WEEKDAYS[date.getDay()]}
|
|
31
|
+
</Typography>
|
|
32
|
+
<div
|
|
33
|
+
className={cx(
|
|
34
|
+
'size-large-2x rounded-circle flex items-center justify-center',
|
|
35
|
+
isCurrentDay && 'bg-primary-idle'
|
|
36
|
+
)}
|
|
37
|
+
>
|
|
38
|
+
<Typography
|
|
39
|
+
className={cx(isCurrentDay && 'text-neutral-label')}
|
|
40
|
+
size="sm-1x"
|
|
41
|
+
variant="label"
|
|
42
|
+
weight="medium"
|
|
43
|
+
>
|
|
44
|
+
{dayNumber}
|
|
45
|
+
</Typography>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { useCallback, useMemo } from 'react'
|
|
2
|
+
import { cx } from '@xjur-ui/util'
|
|
3
|
+
import { setHours } from 'date-fns'
|
|
4
|
+
import { Typography } from '../typography'
|
|
5
|
+
import {
|
|
6
|
+
WEEK_HOURS,
|
|
7
|
+
getWeekDaysInMonth,
|
|
8
|
+
getEventsForDayAndHour
|
|
9
|
+
} from './helpers/calendar'
|
|
10
|
+
import { useFullCalendar } from './calendar-root'
|
|
11
|
+
import { CalendarWeekDay } from './calendar-week-day'
|
|
12
|
+
import { CalendarCell } from './calendar-cell'
|
|
13
|
+
import type { ICalendarCell } from './types/calendar-cell'
|
|
14
|
+
|
|
15
|
+
export function CalendarWeekView() {
|
|
16
|
+
const { selectedDate, events } = useFullCalendar()
|
|
17
|
+
|
|
18
|
+
const monthWeekDaysCells = useMemo(
|
|
19
|
+
() => getWeekDaysInMonth(selectedDate),
|
|
20
|
+
[selectedDate]
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
const getEventsForDayAndHourCallback = useCallback(
|
|
24
|
+
(date: Date, hour: number) => {
|
|
25
|
+
return getEventsForDayAndHour(events, date, hour)
|
|
26
|
+
},
|
|
27
|
+
[events]
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
const cellsWithHour = useCallback((cell: ICalendarCell, hour: number) => {
|
|
31
|
+
return {
|
|
32
|
+
...cell,
|
|
33
|
+
date: setHours(cell.date, hour)
|
|
34
|
+
}
|
|
35
|
+
}, [])
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<div className="bg-layer-2-hover rounded-small-1x border-border-layer-2 scrollbar-hide h-full w-full border">
|
|
39
|
+
<div className="flex flex-1 flex-col">
|
|
40
|
+
<div
|
|
41
|
+
className={cx(
|
|
42
|
+
'bg-layer-2-hover sticky top-0 grid [grid-template-columns:64px_repeat(7,1fr)]',
|
|
43
|
+
'[&>*]:border-border-layer-2',
|
|
44
|
+
'[&>*]:border-l'
|
|
45
|
+
)}
|
|
46
|
+
data-slot="week-header"
|
|
47
|
+
>
|
|
48
|
+
{monthWeekDaysCells.map((cell, index) => (
|
|
49
|
+
<CalendarWeekDay
|
|
50
|
+
date={cell.date}
|
|
51
|
+
key={cell.date.getDay()}
|
|
52
|
+
style={{ gridColumnStart: index + 2 }}
|
|
53
|
+
/>
|
|
54
|
+
))}
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<div className="overflow-hidden">
|
|
58
|
+
{WEEK_HOURS.map(({ hour, label }) => (
|
|
59
|
+
<div className="flex items-start" key={hour}>
|
|
60
|
+
<div className="px-small flex h-full w-[64px] items-start justify-end">
|
|
61
|
+
<Typography size="sm-1x" variant="label" weight="medium">
|
|
62
|
+
{label}
|
|
63
|
+
</Typography>
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<div
|
|
67
|
+
className={cx(
|
|
68
|
+
'grid flex-1 grid-cols-7',
|
|
69
|
+
'[&>*]:border-border-layer-2',
|
|
70
|
+
'[&>*]:border-t',
|
|
71
|
+
'[&>*]:border-l'
|
|
72
|
+
)}
|
|
73
|
+
>
|
|
74
|
+
{monthWeekDaysCells.map(cell => (
|
|
75
|
+
<CalendarCell
|
|
76
|
+
cell={cellsWithHour(cell, hour)}
|
|
77
|
+
events={getEventsForDayAndHourCallback(cell.date, hour)}
|
|
78
|
+
key={cell.date.toISOString()}
|
|
79
|
+
/>
|
|
80
|
+
))}
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
))}
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import {
|
|
2
|
+
endOfMonth,
|
|
3
|
+
startOfMonth,
|
|
4
|
+
subMonths,
|
|
5
|
+
isToday as isTodayDateFns,
|
|
6
|
+
isSameDay,
|
|
7
|
+
endOfWeek,
|
|
8
|
+
startOfWeek,
|
|
9
|
+
eachDayOfInterval
|
|
10
|
+
} from 'date-fns'
|
|
11
|
+
import type { ICalendarEvent } from '../types/calendar-event'
|
|
12
|
+
import type { ICalendarCell } from '../types/calendar-cell'
|
|
13
|
+
import type { ICalendarWeekHour } from '../types/calendar-week-hour'
|
|
14
|
+
|
|
15
|
+
function arrayFromLength(length: number) {
|
|
16
|
+
return Array.from({ length }, (_, i) => i)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const WEEKDAYS = [
|
|
20
|
+
'Domingo',
|
|
21
|
+
'Segunda',
|
|
22
|
+
'Terça',
|
|
23
|
+
'Quarta',
|
|
24
|
+
'Quinta',
|
|
25
|
+
'Sexta',
|
|
26
|
+
'Sábado'
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
export const WEEK_HOURS: ICalendarWeekHour[] = Array.from(
|
|
30
|
+
{ length: 16 },
|
|
31
|
+
(_, i) => {
|
|
32
|
+
const hour = i + 8
|
|
33
|
+
return {
|
|
34
|
+
hour,
|
|
35
|
+
label: `${hour.toString().padStart(2, '0')}:00`
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
export function getDaysInMonth(date: Date): ICalendarCell[] {
|
|
41
|
+
const year = date.getFullYear()
|
|
42
|
+
const month = date.getMonth()
|
|
43
|
+
|
|
44
|
+
const firstWeekdayOfMonth = startOfMonth(date).getDay()
|
|
45
|
+
const daysInPrevMonth = endOfMonth(subMonths(date, 1)).getDate()
|
|
46
|
+
const daysInMonth = endOfMonth(date).getDate()
|
|
47
|
+
|
|
48
|
+
const prevMonthDays = arrayFromLength(firstWeekdayOfMonth).map<ICalendarCell>(
|
|
49
|
+
dayIndex => {
|
|
50
|
+
dayIndex += 1
|
|
51
|
+
const prevMonth = month - 1
|
|
52
|
+
const dayOfPrevMonth = daysInPrevMonth - firstWeekdayOfMonth
|
|
53
|
+
const day = dayOfPrevMonth + dayIndex
|
|
54
|
+
const date = new Date(year, prevMonth, day)
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
dayOfWeekNumber: date.getDay(),
|
|
58
|
+
date,
|
|
59
|
+
type: 'month'
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
const currentMonthDays = arrayFromLength(daysInMonth).map<ICalendarCell>(
|
|
65
|
+
dayIndex => {
|
|
66
|
+
const day = dayIndex + 1
|
|
67
|
+
const date = new Date(year, month, day)
|
|
68
|
+
return {
|
|
69
|
+
dayOfWeekNumber: date.getDay(),
|
|
70
|
+
date,
|
|
71
|
+
type: 'month'
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
const totalWeekdays = 7
|
|
77
|
+
const totalDays = firstWeekdayOfMonth + daysInMonth
|
|
78
|
+
const remainingDays =
|
|
79
|
+
totalWeekdays - ((totalDays % totalWeekdays) % totalWeekdays)
|
|
80
|
+
|
|
81
|
+
const nextMonthDays = arrayFromLength(remainingDays).map<ICalendarCell>(
|
|
82
|
+
dayIndex => {
|
|
83
|
+
const day = dayIndex + 1
|
|
84
|
+
const date = new Date(year, month + 1, day)
|
|
85
|
+
return {
|
|
86
|
+
dayOfWeekNumber: date.getDay(),
|
|
87
|
+
date,
|
|
88
|
+
type: 'month'
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
return [...prevMonthDays, ...currentMonthDays, ...nextMonthDays]
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function getEventsForDay(events: ICalendarEvent[], date: Date) {
|
|
97
|
+
return events.filter(event => isSameDay(event.eventDate, date))
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function isToday(date: Date) {
|
|
101
|
+
return isTodayDateFns(date)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Week view helpers
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
export function getWeekDaysInMonth(date: Date): ICalendarCell[] {
|
|
109
|
+
const weekStart = startOfWeek(date, { weekStartsOn: 0 }) // Domingo = 0
|
|
110
|
+
const weekEnd = endOfWeek(date, { weekStartsOn: 0 })
|
|
111
|
+
const weekDays = eachDayOfInterval({ start: weekStart, end: weekEnd })
|
|
112
|
+
|
|
113
|
+
const dayOfWeekNumber = weekStart.getDay()
|
|
114
|
+
const dayOfWeekName = WEEKDAYS[dayOfWeekNumber]
|
|
115
|
+
|
|
116
|
+
return weekDays.map(day => ({
|
|
117
|
+
date: day,
|
|
118
|
+
dayOfWeekNumber,
|
|
119
|
+
dayOfWeekName,
|
|
120
|
+
fullDate: day,
|
|
121
|
+
type: 'week'
|
|
122
|
+
}))
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export function getEventsForDayAndHour(
|
|
126
|
+
events: ICalendarEvent[],
|
|
127
|
+
date: Date,
|
|
128
|
+
hour: number
|
|
129
|
+
): ICalendarEvent[] {
|
|
130
|
+
return events.filter(event => {
|
|
131
|
+
return (
|
|
132
|
+
isSameDay(event.eventDate, date) && event.eventDate.getHours() === hour
|
|
133
|
+
)
|
|
134
|
+
})
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function isCurrentHour(date: Date, hour: number): boolean {
|
|
138
|
+
const now = new Date()
|
|
139
|
+
return isSameDay(now, date) && now.getHours() === hour
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export function getStartAndEndDateOfWeek(date: Date): {
|
|
143
|
+
start: Date
|
|
144
|
+
end: Date
|
|
145
|
+
} {
|
|
146
|
+
const start = startOfWeek(date, { weekStartsOn: 0 })
|
|
147
|
+
const end = endOfWeek(date, { weekStartsOn: 0 })
|
|
148
|
+
return { start, end }
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Day view helpers
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
export function getDaysInDay(date: Date): ICalendarCell[] {
|
|
156
|
+
const days = eachDayOfInterval({ start: date, end: date })
|
|
157
|
+
return days.map(day => ({ date: day, type: 'day' }))
|
|
158
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from './calendar-month-view'
|
|
2
|
+
export * from './calendar-week-view'
|
|
3
|
+
export * from './calendar-view-renderer'
|
|
4
|
+
export * from './calendar-navigator'
|
|
5
|
+
export * from './calendar-root'
|
|
6
|
+
export * from './calendar-toggle-view'
|
|
7
|
+
export * from './calendar-header'
|
|
8
|
+
export * from './calendar-body'
|
|
9
|
+
export * from './calendar-event'
|
|
10
|
+
export * from './calendar-today-button'
|
|
11
|
+
|
|
12
|
+
export type {
|
|
13
|
+
ICalendarEvent,
|
|
14
|
+
ICalendarEventStatus
|
|
15
|
+
} from './types/calendar-event'
|
|
16
|
+
export type { CalendarView } from './types/calendar-view'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type CalendarView = 'month' | 'week' | 'day'
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react'
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from 'react'
|
|
3
|
+
import { cx } from '@xjur-ui/util'
|
|
4
|
+
import { Button } from './controls/button'
|
|
5
|
+
import { Icon } from './icon'
|
|
6
|
+
|
|
7
|
+
export interface HorizontalScrollProps extends ComponentProps<'div'> {
|
|
8
|
+
children: ReactNode
|
|
9
|
+
gap?: 'small' | 'medium' | 'large'
|
|
10
|
+
scrollAmount?: number
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function HorizontalScroll({
|
|
14
|
+
children,
|
|
15
|
+
className,
|
|
16
|
+
gap = 'small',
|
|
17
|
+
scrollAmount = 200,
|
|
18
|
+
...props
|
|
19
|
+
}: HorizontalScrollProps) {
|
|
20
|
+
const scrollContainerRef = useRef<HTMLDivElement>(null)
|
|
21
|
+
const [canScrollLeft, setCanScrollLeft] = useState(false)
|
|
22
|
+
const [canScrollRight, setCanScrollRight] = useState(false)
|
|
23
|
+
const [isScrolling, setIsScrolling] = useState(false)
|
|
24
|
+
|
|
25
|
+
const checkScrollable = useCallback(() => {
|
|
26
|
+
const container = scrollContainerRef.current
|
|
27
|
+
if (!container) return
|
|
28
|
+
|
|
29
|
+
const { scrollLeft, scrollWidth, clientWidth } = container
|
|
30
|
+
setCanScrollLeft(scrollLeft > 0)
|
|
31
|
+
setCanScrollRight(scrollLeft < scrollWidth - clientWidth - 1)
|
|
32
|
+
}, [])
|
|
33
|
+
|
|
34
|
+
const handleScrollLeft = useCallback(() => {
|
|
35
|
+
const container = scrollContainerRef.current
|
|
36
|
+
if (!container) return
|
|
37
|
+
|
|
38
|
+
setIsScrolling(true)
|
|
39
|
+
container.scrollTo({
|
|
40
|
+
left: container.scrollLeft - scrollAmount,
|
|
41
|
+
behavior: 'smooth'
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
setTimeout(() => setIsScrolling(false), 300)
|
|
45
|
+
}, [scrollAmount])
|
|
46
|
+
|
|
47
|
+
const handleScrollRight = useCallback(() => {
|
|
48
|
+
const container = scrollContainerRef.current
|
|
49
|
+
if (!container) return
|
|
50
|
+
|
|
51
|
+
setIsScrolling(true)
|
|
52
|
+
container.scrollTo({
|
|
53
|
+
left: container.scrollLeft + scrollAmount,
|
|
54
|
+
behavior: 'smooth'
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
setTimeout(() => setIsScrolling(false), 300)
|
|
58
|
+
}, [scrollAmount])
|
|
59
|
+
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
const container = scrollContainerRef.current
|
|
62
|
+
if (!container) return
|
|
63
|
+
|
|
64
|
+
const handleScroll = () => {
|
|
65
|
+
checkScrollable()
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const handleResize = () => {
|
|
69
|
+
checkScrollable()
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
checkScrollable()
|
|
73
|
+
container.addEventListener('scroll', handleScroll, { passive: true })
|
|
74
|
+
window.addEventListener('resize', handleResize)
|
|
75
|
+
|
|
76
|
+
let resizeObserver: ResizeObserver | null = null
|
|
77
|
+
if (typeof ResizeObserver !== 'undefined') {
|
|
78
|
+
resizeObserver = new ResizeObserver(() => {
|
|
79
|
+
checkScrollable()
|
|
80
|
+
})
|
|
81
|
+
resizeObserver.observe(container)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return () => {
|
|
85
|
+
container.removeEventListener('scroll', handleScroll)
|
|
86
|
+
window.removeEventListener('resize', handleResize)
|
|
87
|
+
if (resizeObserver) {
|
|
88
|
+
resizeObserver.disconnect()
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}, [checkScrollable])
|
|
92
|
+
|
|
93
|
+
const gapClass = {
|
|
94
|
+
small: 'gap-small',
|
|
95
|
+
medium: 'gap-medium',
|
|
96
|
+
large: 'gap-large'
|
|
97
|
+
}[gap]
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<div className={cx('relative isolate', className)} {...props}>
|
|
101
|
+
{/* Left Arrow */}
|
|
102
|
+
{canScrollLeft && (
|
|
103
|
+
<div
|
|
104
|
+
className="absolute top-1/2 left-0 z-[3] flex h-full w-[80px] -translate-y-1/2 items-center"
|
|
105
|
+
style={{
|
|
106
|
+
background: `linear-gradient(to right, white 40%, transparent)`
|
|
107
|
+
}}
|
|
108
|
+
>
|
|
109
|
+
<Button
|
|
110
|
+
appearance="ghost"
|
|
111
|
+
aria-label="Scroll left"
|
|
112
|
+
className="ml-0"
|
|
113
|
+
disabled={isScrolling}
|
|
114
|
+
size="icon_md"
|
|
115
|
+
variant="secondary"
|
|
116
|
+
onClick={handleScrollLeft}
|
|
117
|
+
>
|
|
118
|
+
<Icon name="chevron_left" />
|
|
119
|
+
</Button>
|
|
120
|
+
</div>
|
|
121
|
+
)}
|
|
122
|
+
|
|
123
|
+
{/* Right Arrow */}
|
|
124
|
+
{canScrollRight && (
|
|
125
|
+
<div
|
|
126
|
+
className="absolute top-1/2 right-0 z-[2] flex h-full w-[80px] -translate-y-1/2 items-center justify-end"
|
|
127
|
+
style={{
|
|
128
|
+
background: `linear-gradient(to left, white 40%, transparent)`
|
|
129
|
+
}}
|
|
130
|
+
>
|
|
131
|
+
<Button
|
|
132
|
+
appearance="ghost"
|
|
133
|
+
aria-label="Scroll right"
|
|
134
|
+
className="mr-0"
|
|
135
|
+
disabled={isScrolling}
|
|
136
|
+
size="icon_md"
|
|
137
|
+
variant="secondary"
|
|
138
|
+
onClick={handleScrollRight}
|
|
139
|
+
>
|
|
140
|
+
<Icon name="chevron_right" />
|
|
141
|
+
</Button>
|
|
142
|
+
</div>
|
|
143
|
+
)}
|
|
144
|
+
|
|
145
|
+
{/* Scrollable Content */}
|
|
146
|
+
<div
|
|
147
|
+
className={cx(
|
|
148
|
+
'scrollbar-hide relative z-1 flex overflow-x-auto overflow-y-visible',
|
|
149
|
+
'min-w-0 [&>*]:flex-none [&>*]:whitespace-nowrap',
|
|
150
|
+
gapClass,
|
|
151
|
+
className
|
|
152
|
+
)}
|
|
153
|
+
ref={scrollContainerRef}
|
|
154
|
+
>
|
|
155
|
+
{children}
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
)
|
|
159
|
+
}
|
package/src/components/list.tsx
CHANGED
|
@@ -17,7 +17,7 @@ export function ListRoot({
|
|
|
17
17
|
{...props}
|
|
18
18
|
className={cx(
|
|
19
19
|
className,
|
|
20
|
-
'rounded-small scrollbar-hide bg-layer-2-idle border-border-layer-2 shadow-elevation-3 z-
|
|
20
|
+
'rounded-small scrollbar-hide bg-layer-2-idle border-border-layer-2 shadow-elevation-3 z-1000 max-h-[400px] list-none overflow-y-auto border'
|
|
21
21
|
)}
|
|
22
22
|
/>
|
|
23
23
|
)
|