@mohou/ui 1.0.20
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/README.md +10 -0
- package/lib/types/blocks/activity-feed.d.ts +12 -0
- package/lib/types/blocks/activity-feed.d.ts.map +1 -0
- package/lib/types/blocks/app-shell.d.ts +17 -0
- package/lib/types/blocks/app-shell.d.ts.map +1 -0
- package/lib/types/blocks/attachment-gallery.d.ts +15 -0
- package/lib/types/blocks/attachment-gallery.d.ts.map +1 -0
- package/lib/types/blocks/bar-chart.d.ts +19 -0
- package/lib/types/blocks/bar-chart.d.ts.map +1 -0
- package/lib/types/blocks/comment-thread.d.ts +17 -0
- package/lib/types/blocks/comment-thread.d.ts.map +1 -0
- package/lib/types/blocks/dashboard-shell.d.ts +35 -0
- package/lib/types/blocks/dashboard-shell.d.ts.map +1 -0
- package/lib/types/blocks/description-list.d.ts +14 -0
- package/lib/types/blocks/description-list.d.ts.map +1 -0
- package/lib/types/blocks/detail-panel.d.ts +16 -0
- package/lib/types/blocks/detail-panel.d.ts.map +1 -0
- package/lib/types/blocks/donut-chart.d.ts +21 -0
- package/lib/types/blocks/donut-chart.d.ts.map +1 -0
- package/lib/types/blocks/env-badge.d.ts +11 -0
- package/lib/types/blocks/env-badge.d.ts.map +1 -0
- package/lib/types/blocks/env-table.d.ts +29 -0
- package/lib/types/blocks/env-table.d.ts.map +1 -0
- package/lib/types/blocks/file-tree.d.ts +12 -0
- package/lib/types/blocks/file-tree.d.ts.map +1 -0
- package/lib/types/blocks/filter-bar.d.ts +15 -0
- package/lib/types/blocks/filter-bar.d.ts.map +1 -0
- package/lib/types/blocks/form-sheet.d.ts +47 -0
- package/lib/types/blocks/form-sheet.d.ts.map +1 -0
- package/lib/types/blocks/gauge.d.ts +14 -0
- package/lib/types/blocks/gauge.d.ts.map +1 -0
- package/lib/types/blocks/list-detail.d.ts +42 -0
- package/lib/types/blocks/list-detail.d.ts.map +1 -0
- package/lib/types/blocks/notification-center.d.ts +16 -0
- package/lib/types/blocks/notification-center.d.ts.map +1 -0
- package/lib/types/blocks/page-header.d.ts +15 -0
- package/lib/types/blocks/page-header.d.ts.map +1 -0
- package/lib/types/blocks/progress-ring.d.ts +13 -0
- package/lib/types/blocks/progress-ring.d.ts.map +1 -0
- package/lib/types/blocks/radar-chart.d.ts +19 -0
- package/lib/types/blocks/radar-chart.d.ts.map +1 -0
- package/lib/types/blocks/request-inspector.d.ts +14 -0
- package/lib/types/blocks/request-inspector.d.ts.map +1 -0
- package/lib/types/blocks/reveal.d.ts +30 -0
- package/lib/types/blocks/reveal.d.ts.map +1 -0
- package/lib/types/blocks/run-timeline.d.ts +12 -0
- package/lib/types/blocks/run-timeline.d.ts.map +1 -0
- package/lib/types/blocks/scrollspy.d.ts +15 -0
- package/lib/types/blocks/scrollspy.d.ts.map +1 -0
- package/lib/types/blocks/settings-split.d.ts +47 -0
- package/lib/types/blocks/settings-split.d.ts.map +1 -0
- package/lib/types/blocks/severity-chip.d.ts +23 -0
- package/lib/types/blocks/severity-chip.d.ts.map +1 -0
- package/lib/types/blocks/sparkline.d.ts +14 -0
- package/lib/types/blocks/sparkline.d.ts.map +1 -0
- package/lib/types/blocks/stat-card.d.ts +17 -0
- package/lib/types/blocks/stat-card.d.ts.map +1 -0
- package/lib/types/blocks/status-badge.d.ts +21 -0
- package/lib/types/blocks/status-badge.d.ts.map +1 -0
- package/lib/types/blocks/table-page.d.ts +35 -0
- package/lib/types/blocks/table-page.d.ts.map +1 -0
- package/lib/types/blocks/terminal.d.ts +12 -0
- package/lib/types/blocks/terminal.d.ts.map +1 -0
- package/lib/types/blocks/test-step-list.d.ts +17 -0
- package/lib/types/blocks/test-step-list.d.ts.map +1 -0
- package/lib/types/blocks/trend-card.d.ts +20 -0
- package/lib/types/blocks/trend-card.d.ts.map +1 -0
- package/lib/types/blocks/wizard-shell.d.ts +47 -0
- package/lib/types/blocks/wizard-shell.d.ts.map +1 -0
- package/lib/types/components/accordion.d.ts +14 -0
- package/lib/types/components/accordion.d.ts.map +1 -0
- package/lib/types/components/alert-dialog.d.ts +26 -0
- package/lib/types/components/alert-dialog.d.ts.map +1 -0
- package/lib/types/components/alert.d.ts +18 -0
- package/lib/types/components/alert.d.ts.map +1 -0
- package/lib/types/components/aspect-ratio.d.ts +9 -0
- package/lib/types/components/aspect-ratio.d.ts.map +1 -0
- package/lib/types/components/attachment.d.ts +28 -0
- package/lib/types/components/attachment.d.ts.map +1 -0
- package/lib/types/components/avatar.d.ts +16 -0
- package/lib/types/components/avatar.d.ts.map +1 -0
- package/lib/types/components/badge.d.ts +15 -0
- package/lib/types/components/badge.d.ts.map +1 -0
- package/lib/types/components/breadcrumb.d.ts +15 -0
- package/lib/types/components/breadcrumb.d.ts.map +1 -0
- package/lib/types/components/bubble.d.ts +21 -0
- package/lib/types/components/bubble.d.ts.map +1 -0
- package/lib/types/components/button-group.d.ts +17 -0
- package/lib/types/components/button-group.d.ts.map +1 -0
- package/lib/types/components/button.d.ts +16 -0
- package/lib/types/components/button.d.ts.map +1 -0
- package/lib/types/components/calendar.d.ts +15 -0
- package/lib/types/components/calendar.d.ts.map +1 -0
- package/lib/types/components/card.d.ts +19 -0
- package/lib/types/components/card.d.ts.map +1 -0
- package/lib/types/components/chart.d.ts +52 -0
- package/lib/types/components/chart.d.ts.map +1 -0
- package/lib/types/components/checkbox.d.ts +9 -0
- package/lib/types/components/checkbox.d.ts.map +1 -0
- package/lib/types/components/collapsible.d.ts +10 -0
- package/lib/types/components/collapsible.d.ts.map +1 -0
- package/lib/types/components/combobox.d.ts +29 -0
- package/lib/types/components/combobox.d.ts.map +1 -0
- package/lib/types/components/command.d.ts +26 -0
- package/lib/types/components/command.d.ts.map +1 -0
- package/lib/types/components/context-menu.d.ts +34 -0
- package/lib/types/components/context-menu.d.ts.map +1 -0
- package/lib/types/components/dialog.d.ts +30 -0
- package/lib/types/components/dialog.d.ts.map +1 -0
- package/lib/types/components/drawer.d.ts +21 -0
- package/lib/types/components/drawer.d.ts.map +1 -0
- package/lib/types/components/dropdown-menu.d.ts +37 -0
- package/lib/types/components/dropdown-menu.d.ts.map +1 -0
- package/lib/types/components/empty.d.ts +24 -0
- package/lib/types/components/empty.d.ts.map +1 -0
- package/lib/types/components/field.d.ts +31 -0
- package/lib/types/components/field.d.ts.map +1 -0
- package/lib/types/components/hover-card.d.ts +10 -0
- package/lib/types/components/hover-card.d.ts.map +1 -0
- package/lib/types/components/input-group.d.ts +23 -0
- package/lib/types/components/input-group.d.ts.map +1 -0
- package/lib/types/components/input.d.ts +11 -0
- package/lib/types/components/input.d.ts.map +1 -0
- package/lib/types/components/item.d.ts +27 -0
- package/lib/types/components/item.d.ts.map +1 -0
- package/lib/types/components/kbd.d.ts +8 -0
- package/lib/types/components/kbd.d.ts.map +1 -0
- package/lib/types/components/label.d.ts +11 -0
- package/lib/types/components/label.d.ts.map +1 -0
- package/lib/types/components/marker.d.ts +15 -0
- package/lib/types/components/marker.d.ts.map +1 -0
- package/lib/types/components/menubar.d.ts +34 -0
- package/lib/types/components/menubar.d.ts.map +1 -0
- package/lib/types/components/message-scroller.d.ts +15 -0
- package/lib/types/components/message-scroller.d.ts.map +1 -0
- package/lib/types/components/message.d.ts +15 -0
- package/lib/types/components/message.d.ts.map +1 -0
- package/lib/types/components/native-select.d.ts +13 -0
- package/lib/types/components/native-select.d.ts.map +1 -0
- package/lib/types/components/navigation-menu.d.ts +16 -0
- package/lib/types/components/navigation-menu.d.ts.map +1 -0
- package/lib/types/components/pagination.d.ts +22 -0
- package/lib/types/components/pagination.d.ts.map +1 -0
- package/lib/types/components/popover.d.ts +17 -0
- package/lib/types/components/popover.d.ts.map +1 -0
- package/lib/types/components/progress.d.ts +15 -0
- package/lib/types/components/progress.d.ts.map +1 -0
- package/lib/types/components/questionnaire.d.ts +24 -0
- package/lib/types/components/questionnaire.d.ts.map +1 -0
- package/lib/types/components/radio-group.d.ts +10 -0
- package/lib/types/components/radio-group.d.ts.map +1 -0
- package/lib/types/components/resizable.d.ts +15 -0
- package/lib/types/components/resizable.d.ts.map +1 -0
- package/lib/types/components/scroll-area.d.ts +9 -0
- package/lib/types/components/scroll-area.d.ts.map +1 -0
- package/lib/types/components/select.d.ts +23 -0
- package/lib/types/components/select.d.ts.map +1 -0
- package/lib/types/components/separator.d.ts +9 -0
- package/lib/types/components/separator.d.ts.map +1 -0
- package/lib/types/components/sheet.d.ts +28 -0
- package/lib/types/components/sheet.d.ts.map +1 -0
- package/lib/types/components/sidebar.d.ts +68 -0
- package/lib/types/components/sidebar.d.ts.map +1 -0
- package/lib/types/components/skeleton.d.ts +10 -0
- package/lib/types/components/skeleton.d.ts.map +1 -0
- package/lib/types/components/slider.d.ts +8 -0
- package/lib/types/components/slider.d.ts.map +1 -0
- package/lib/types/components/spinner.d.ts +9 -0
- package/lib/types/components/spinner.d.ts.map +1 -0
- package/lib/types/components/switch.d.ts +13 -0
- package/lib/types/components/switch.d.ts.map +1 -0
- package/lib/types/components/table.d.ts +18 -0
- package/lib/types/components/table.d.ts.map +1 -0
- package/lib/types/components/tabs.d.ts +18 -0
- package/lib/types/components/tabs.d.ts.map +1 -0
- package/lib/types/components/textarea.d.ts +11 -0
- package/lib/types/components/textarea.d.ts.map +1 -0
- package/lib/types/components/toast.d.ts +35 -0
- package/lib/types/components/toast.d.ts.map +1 -0
- package/lib/types/components/toggle-group.d.ts +16 -0
- package/lib/types/components/toggle-group.d.ts.map +1 -0
- package/lib/types/components/toggle.d.ts +13 -0
- package/lib/types/components/toggle.d.ts.map +1 -0
- package/lib/types/components/tooltip.d.ts +14 -0
- package/lib/types/components/tooltip.d.ts.map +1 -0
- package/lib/types/composites/autocomplete.d.ts +15 -0
- package/lib/types/composites/autocomplete.d.ts.map +1 -0
- package/lib/types/composites/cascader.d.ts +18 -0
- package/lib/types/composites/cascader.d.ts.map +1 -0
- package/lib/types/composites/color-picker.d.ts +12 -0
- package/lib/types/composites/color-picker.d.ts.map +1 -0
- package/lib/types/composites/confirm-dialog.d.ts +17 -0
- package/lib/types/composites/confirm-dialog.d.ts.map +1 -0
- package/lib/types/composites/copyable.d.ts +12 -0
- package/lib/types/composites/copyable.d.ts.map +1 -0
- package/lib/types/composites/currency-input.d.ts +13 -0
- package/lib/types/composites/currency-input.d.ts.map +1 -0
- package/lib/types/composites/date-chrome.d.ts +8 -0
- package/lib/types/composites/date-chrome.d.ts.map +1 -0
- package/lib/types/composites/date-picker.d.ts +17 -0
- package/lib/types/composites/date-picker.d.ts.map +1 -0
- package/lib/types/composites/date-range-picker.d.ts +18 -0
- package/lib/types/composites/date-range-picker.d.ts.map +1 -0
- package/lib/types/composites/date-time-picker.d.ts +18 -0
- package/lib/types/composites/date-time-picker.d.ts.map +1 -0
- package/lib/types/composites/date-time-range-picker.d.ts +17 -0
- package/lib/types/composites/date-time-range-picker.d.ts.map +1 -0
- package/lib/types/composites/duration-input.d.ts +14 -0
- package/lib/types/composites/duration-input.d.ts.map +1 -0
- package/lib/types/composites/live-refresh.d.ts +46 -0
- package/lib/types/composites/live-refresh.d.ts.map +1 -0
- package/lib/types/composites/mini-calendar.d.ts +13 -0
- package/lib/types/composites/mini-calendar.d.ts.map +1 -0
- package/lib/types/composites/number-field.d.ts +15 -0
- package/lib/types/composites/number-field.d.ts.map +1 -0
- package/lib/types/composites/password-field.d.ts +13 -0
- package/lib/types/composites/password-field.d.ts.map +1 -0
- package/lib/types/composites/phone-input.d.ts +12 -0
- package/lib/types/composites/phone-input.d.ts.map +1 -0
- package/lib/types/composites/rating.d.ts +13 -0
- package/lib/types/composites/rating.d.ts.map +1 -0
- package/lib/types/composites/relative-date-picker.d.ts +16 -0
- package/lib/types/composites/relative-date-picker.d.ts.map +1 -0
- package/lib/types/composites/search-input.d.ts +16 -0
- package/lib/types/composites/search-input.d.ts.map +1 -0
- package/lib/types/composites/slider-range.d.ts +14 -0
- package/lib/types/composites/slider-range.d.ts.map +1 -0
- package/lib/types/composites/tag-input.d.ts +14 -0
- package/lib/types/composites/tag-input.d.ts.map +1 -0
- package/lib/types/composites/time-picker.d.ts +28 -0
- package/lib/types/composites/time-picker.d.ts.map +1 -0
- package/lib/types/composites/time-range-picker.d.ts +16 -0
- package/lib/types/composites/time-range-picker.d.ts.map +1 -0
- package/lib/types/composites/timezone-select.d.ts +22 -0
- package/lib/types/composites/timezone-select.d.ts.map +1 -0
- package/lib/types/composites/transfer.d.ts +17 -0
- package/lib/types/composites/transfer.d.ts.map +1 -0
- package/lib/types/composites/user-picker.d.ts +17 -0
- package/lib/types/composites/user-picker.d.ts.map +1 -0
- package/lib/types/hooks/use-html-dark.d.ts +4 -0
- package/lib/types/hooks/use-html-dark.d.ts.map +1 -0
- package/lib/types/hooks/use-mobile.d.ts +2 -0
- package/lib/types/hooks/use-mobile.d.ts.map +1 -0
- package/lib/types/i18n/context.d.ts +310 -0
- package/lib/types/i18n/context.d.ts.map +1 -0
- package/lib/types/i18n/en.d.ts +290 -0
- package/lib/types/i18n/en.d.ts.map +1 -0
- package/lib/types/i18n/zh.d.ts +3 -0
- package/lib/types/i18n/zh.d.ts.map +1 -0
- package/lib/types/index.d.ts +151 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/lib/clipboard.d.ts +3 -0
- package/lib/types/lib/clipboard.d.ts.map +1 -0
- package/lib/types/lib/defined.d.ts +3 -0
- package/lib/types/lib/defined.d.ts.map +1 -0
- package/lib/types/lib/icons.d.ts +16 -0
- package/lib/types/lib/icons.d.ts.map +1 -0
- package/lib/types/lib/illustrations.d.ts +18 -0
- package/lib/types/lib/illustrations.d.ts.map +1 -0
- package/lib/types/lib/utils.d.ts +3 -0
- package/lib/types/lib/utils.d.ts.map +1 -0
- package/lib/types/products/cells.d.ts +13 -0
- package/lib/types/products/cells.d.ts.map +1 -0
- package/lib/types/products/code-block.d.ts +14 -0
- package/lib/types/products/code-block.d.ts.map +1 -0
- package/lib/types/products/code-editor.d.ts +21 -0
- package/lib/types/products/code-editor.d.ts.map +1 -0
- package/lib/types/products/commit-graph.d.ts +38 -0
- package/lib/types/products/commit-graph.d.ts.map +1 -0
- package/lib/types/products/data-grid.d.ts +79 -0
- package/lib/types/products/data-grid.d.ts.map +1 -0
- package/lib/types/products/diff-viewer.d.ts +15 -0
- package/lib/types/products/diff-viewer.d.ts.map +1 -0
- package/lib/types/products/event-calendar.d.ts +23 -0
- package/lib/types/products/event-calendar.d.ts.map +1 -0
- package/lib/types/products/export-csv.d.ts +2 -0
- package/lib/types/products/export-csv.d.ts.map +1 -0
- package/lib/types/products/file-dropzone.d.ts +12 -0
- package/lib/types/products/file-dropzone.d.ts.map +1 -0
- package/lib/types/products/full-calendar/animations.d.ts +12 -0
- package/lib/types/products/full-calendar/animations.d.ts.map +1 -0
- package/lib/types/products/full-calendar/calendar-body.d.ts +2 -0
- package/lib/types/products/full-calendar/calendar-body.d.ts.map +1 -0
- package/lib/types/products/full-calendar/constants.d.ts +3 -0
- package/lib/types/products/full-calendar/constants.d.ts.map +1 -0
- package/lib/types/products/full-calendar/contexts/calendar-context.d.ts +42 -0
- package/lib/types/products/full-calendar/contexts/calendar-context.d.ts.map +1 -0
- package/lib/types/products/full-calendar/contexts/dnd-context.d.ts +16 -0
- package/lib/types/products/full-calendar/contexts/dnd-context.d.ts.map +1 -0
- package/lib/types/products/full-calendar/dialogs/add-edit-event-dialog.d.ts +21 -0
- package/lib/types/products/full-calendar/dialogs/add-edit-event-dialog.d.ts.map +1 -0
- package/lib/types/products/full-calendar/dialogs/delete-event-dialog.d.ts +4 -0
- package/lib/types/products/full-calendar/dialogs/delete-event-dialog.d.ts.map +1 -0
- package/lib/types/products/full-calendar/dialogs/event-details-dialog.d.ts +7 -0
- package/lib/types/products/full-calendar/dialogs/event-details-dialog.d.ts.map +1 -0
- package/lib/types/products/full-calendar/dialogs/events-list-dialog.d.ts +9 -0
- package/lib/types/products/full-calendar/dialogs/events-list-dialog.d.ts.map +1 -0
- package/lib/types/products/full-calendar/dnd/draggable-event.d.ts +11 -0
- package/lib/types/products/full-calendar/dnd/draggable-event.d.ts.map +1 -0
- package/lib/types/products/full-calendar/dnd/droppable-area.d.ts +11 -0
- package/lib/types/products/full-calendar/dnd/droppable-area.d.ts.map +1 -0
- package/lib/types/products/full-calendar/dnd/resizable-event.d.ts +10 -0
- package/lib/types/products/full-calendar/dnd/resizable-event.d.ts.map +1 -0
- package/lib/types/products/full-calendar/header/calendar-header.d.ts +2 -0
- package/lib/types/products/full-calendar/header/calendar-header.d.ts.map +1 -0
- package/lib/types/products/full-calendar/header/date-navigator.d.ts +9 -0
- package/lib/types/products/full-calendar/header/date-navigator.d.ts.map +1 -0
- package/lib/types/products/full-calendar/header/filter.d.ts +2 -0
- package/lib/types/products/full-calendar/header/filter.d.ts.map +1 -0
- package/lib/types/products/full-calendar/header/today-button.d.ts +2 -0
- package/lib/types/products/full-calendar/header/today-button.d.ts.map +1 -0
- package/lib/types/products/full-calendar/header/user-select.d.ts +2 -0
- package/lib/types/products/full-calendar/header/user-select.d.ts.map +1 -0
- package/lib/types/products/full-calendar/header/view-tabs.d.ts +4 -0
- package/lib/types/products/full-calendar/header/view-tabs.d.ts.map +1 -0
- package/lib/types/products/full-calendar/helpers.d.ts +42 -0
- package/lib/types/products/full-calendar/helpers.d.ts.map +1 -0
- package/lib/types/products/full-calendar/hooks/use-time-range-create.d.ts +25 -0
- package/lib/types/products/full-calendar/hooks/use-time-range-create.d.ts.map +1 -0
- package/lib/types/products/full-calendar/hooks.d.ts +11 -0
- package/lib/types/products/full-calendar/hooks.d.ts.map +1 -0
- package/lib/types/products/full-calendar/interfaces.d.ts +21 -0
- package/lib/types/products/full-calendar/interfaces.d.ts.map +1 -0
- package/lib/types/products/full-calendar/settings/settings.d.ts +2 -0
- package/lib/types/products/full-calendar/settings/settings.d.ts.map +1 -0
- package/lib/types/products/full-calendar/shims/avatar-group.d.ts +7 -0
- package/lib/types/products/full-calendar/shims/avatar-group.d.ts.map +1 -0
- package/lib/types/products/full-calendar/shims/day-picker.d.ts +2 -0
- package/lib/types/products/full-calendar/shims/day-picker.d.ts.map +1 -0
- package/lib/types/products/full-calendar/shims/motion.d.ts +32 -0
- package/lib/types/products/full-calendar/shims/motion.d.ts.map +1 -0
- package/lib/types/products/full-calendar/shims/next-themes.d.ts +5 -0
- package/lib/types/products/full-calendar/shims/next-themes.d.ts.map +1 -0
- package/lib/types/products/full-calendar/shims/re-resizable.d.ts +19 -0
- package/lib/types/products/full-calendar/shims/re-resizable.d.ts.map +1 -0
- package/lib/types/products/full-calendar/shims/sonner.d.ts +5 -0
- package/lib/types/products/full-calendar/shims/sonner.d.ts.map +1 -0
- package/lib/types/products/full-calendar/types.d.ts +3 -0
- package/lib/types/products/full-calendar/types.d.ts.map +1 -0
- package/lib/types/products/full-calendar/views/agenda-view/agenda-events.d.ts +3 -0
- package/lib/types/products/full-calendar/views/agenda-view/agenda-events.d.ts.map +1 -0
- package/lib/types/products/full-calendar/views/month-view/calendar-month-view.d.ts +8 -0
- package/lib/types/products/full-calendar/views/month-view/calendar-month-view.d.ts.map +1 -0
- package/lib/types/products/full-calendar/views/month-view/day-cell.d.ts +12 -0
- package/lib/types/products/full-calendar/views/month-view/day-cell.d.ts.map +1 -0
- package/lib/types/products/full-calendar/views/month-view/event-bullet.d.ts +6 -0
- package/lib/types/products/full-calendar/views/month-view/event-bullet.d.ts.map +1 -0
- package/lib/types/products/full-calendar/views/month-view/month-event-badge.d.ts +17 -0
- package/lib/types/products/full-calendar/views/month-view/month-event-badge.d.ts.map +1 -0
- package/lib/types/products/full-calendar/views/week-and-day-view/calendar-day-view.d.ts +8 -0
- package/lib/types/products/full-calendar/views/week-and-day-view/calendar-day-view.d.ts.map +1 -0
- package/lib/types/products/full-calendar/views/week-and-day-view/calendar-time-line.d.ts +2 -0
- package/lib/types/products/full-calendar/views/week-and-day-view/calendar-time-line.d.ts.map +1 -0
- package/lib/types/products/full-calendar/views/week-and-day-view/calendar-week-view.d.ts +8 -0
- package/lib/types/products/full-calendar/views/week-and-day-view/calendar-week-view.d.ts.map +1 -0
- package/lib/types/products/full-calendar/views/week-and-day-view/day-view-multi-day-events-row.d.ts +8 -0
- package/lib/types/products/full-calendar/views/week-and-day-view/day-view-multi-day-events-row.d.ts.map +1 -0
- package/lib/types/products/full-calendar/views/week-and-day-view/event-block.d.ts +12 -0
- package/lib/types/products/full-calendar/views/week-and-day-view/event-block.d.ts.map +1 -0
- package/lib/types/products/full-calendar/views/week-and-day-view/render-grouped-events.d.ts +8 -0
- package/lib/types/products/full-calendar/views/week-and-day-view/render-grouped-events.d.ts.map +1 -0
- package/lib/types/products/full-calendar/views/week-and-day-view/week-view-multi-day-events-row.d.ts +8 -0
- package/lib/types/products/full-calendar/views/week-and-day-view/week-view-multi-day-events-row.d.ts.map +1 -0
- package/lib/types/products/full-calendar/views/year-view/calendar-year-view.d.ts +8 -0
- package/lib/types/products/full-calendar/views/year-view/calendar-year-view.d.ts.map +1 -0
- package/lib/types/products/gantt.d.ts +17 -0
- package/lib/types/products/gantt.d.ts.map +1 -0
- package/lib/types/products/jira-wiki-parse.d.ts +55 -0
- package/lib/types/products/jira-wiki-parse.d.ts.map +1 -0
- package/lib/types/products/jira-wiki.d.ts +39 -0
- package/lib/types/products/jira-wiki.d.ts.map +1 -0
- package/lib/types/products/jql-input.d.ts +22 -0
- package/lib/types/products/jql-input.d.ts.map +1 -0
- package/lib/types/products/json-viewer.d.ts +12 -0
- package/lib/types/products/json-viewer.d.ts.map +1 -0
- package/lib/types/products/kanban-issue-panel.d.ts +15 -0
- package/lib/types/products/kanban-issue-panel.d.ts.map +1 -0
- package/lib/types/products/kanban.d.ts +43 -0
- package/lib/types/products/kanban.d.ts.map +1 -0
- package/lib/types/products/log-viewer.d.ts +25 -0
- package/lib/types/products/log-viewer.d.ts.map +1 -0
- package/lib/types/products/markdown-editor.d.ts +16 -0
- package/lib/types/products/markdown-editor.d.ts.map +1 -0
- package/lib/types/products/markdown.d.ts +13 -0
- package/lib/types/products/markdown.d.ts.map +1 -0
- package/lib/types/products/rich-text-editor.d.ts +13 -0
- package/lib/types/products/rich-text-editor.d.ts.map +1 -0
- package/lib/types/products/sortable-list.d.ts +16 -0
- package/lib/types/products/sortable-list.d.ts.map +1 -0
- package/lib/types/products/stepper.d.ts +39 -0
- package/lib/types/products/stepper.d.ts.map +1 -0
- package/lib/types/products/timeline.d.ts +17 -0
- package/lib/types/products/timeline.d.ts.map +1 -0
- package/lib/types/products/tree-view.d.ts +17 -0
- package/lib/types/products/tree-view.d.ts.map +1 -0
- package/lib/types/sdk/app-error-boundary.d.ts +33 -0
- package/lib/types/sdk/app-error-boundary.d.ts.map +1 -0
- package/lib/types/sdk/app-id.d.ts +6 -0
- package/lib/types/sdk/app-id.d.ts.map +1 -0
- package/lib/types/sdk/use-app.d.ts +32 -0
- package/lib/types/sdk/use-app.d.ts.map +1 -0
- package/package.json +67 -0
- package/src/blocks/activity-feed.tsx +16 -0
- package/src/blocks/app-shell.tsx +38 -0
- package/src/blocks/attachment-gallery.tsx +36 -0
- package/src/blocks/bar-chart.tsx +46 -0
- package/src/blocks/comment-thread.tsx +37 -0
- package/src/blocks/dashboard-shell.tsx +108 -0
- package/src/blocks/description-list.tsx +23 -0
- package/src/blocks/detail-panel.tsx +43 -0
- package/src/blocks/donut-chart.tsx +54 -0
- package/src/blocks/env-badge.tsx +30 -0
- package/src/blocks/env-table.tsx +315 -0
- package/src/blocks/file-tree.tsx +12 -0
- package/src/blocks/filter-bar.tsx +22 -0
- package/src/blocks/form-sheet.tsx +159 -0
- package/src/blocks/gauge.tsx +36 -0
- package/src/blocks/list-detail.tsx +120 -0
- package/src/blocks/notification-center.tsx +29 -0
- package/src/blocks/page-header.tsx +31 -0
- package/src/blocks/progress-ring.tsx +43 -0
- package/src/blocks/radar-chart.tsx +47 -0
- package/src/blocks/request-inspector.tsx +41 -0
- package/src/blocks/reveal.tsx +56 -0
- package/src/blocks/run-timeline.tsx +12 -0
- package/src/blocks/scrollspy.tsx +48 -0
- package/src/blocks/settings-split.tsx +153 -0
- package/src/blocks/severity-chip.tsx +34 -0
- package/src/blocks/sparkline.tsx +27 -0
- package/src/blocks/stat-card.tsx +50 -0
- package/src/blocks/status-badge.tsx +40 -0
- package/src/blocks/table-page.tsx +82 -0
- package/src/blocks/terminal.tsx +28 -0
- package/src/blocks/test-step-list.tsx +26 -0
- package/src/blocks/trend-card.tsx +57 -0
- package/src/blocks/wizard-shell.tsx +131 -0
- package/src/cdn-modules.d.ts +5 -0
- package/src/components/accordion.tsx +79 -0
- package/src/components/alert-dialog.tsx +192 -0
- package/src/components/alert.tsx +83 -0
- package/src/components/aspect-ratio.tsx +26 -0
- package/src/components/attachment.tsx +211 -0
- package/src/components/avatar.tsx +111 -0
- package/src/components/badge.tsx +59 -0
- package/src/components/breadcrumb.tsx +129 -0
- package/src/components/bubble.tsx +132 -0
- package/src/components/button-group.tsx +93 -0
- package/src/components/button.tsx +65 -0
- package/src/components/calendar.tsx +224 -0
- package/src/components/card.tsx +110 -0
- package/src/components/chart.tsx +378 -0
- package/src/components/checkbox.tsx +33 -0
- package/src/components/collapsible.tsx +23 -0
- package/src/components/combobox.tsx +299 -0
- package/src/components/command.tsx +201 -0
- package/src/components/context-menu.tsx +274 -0
- package/src/components/dialog.tsx +179 -0
- package/src/components/drawer.tsx +230 -0
- package/src/components/dropdown-menu.tsx +274 -0
- package/src/components/empty.tsx +130 -0
- package/src/components/field.tsx +242 -0
- package/src/components/hover-card.tsx +53 -0
- package/src/components/input-group.tsx +161 -0
- package/src/components/input.tsx +27 -0
- package/src/components/item.tsx +205 -0
- package/src/components/kbd.tsx +30 -0
- package/src/components/label.tsx +26 -0
- package/src/components/marker.tsx +75 -0
- package/src/components/menubar.tsx +283 -0
- package/src/components/message-scroller.tsx +133 -0
- package/src/components/message.tsx +96 -0
- package/src/components/native-select.tsx +65 -0
- package/src/components/navigation-menu.tsx +172 -0
- package/src/components/pagination.tsx +138 -0
- package/src/components/popover.tsx +95 -0
- package/src/components/progress.tsx +89 -0
- package/src/components/questionnaire.tsx +332 -0
- package/src/components/radio-group.tsx +40 -0
- package/src/components/resizable.tsx +56 -0
- package/src/components/scroll-area.tsx +56 -0
- package/src/components/select.tsx +207 -0
- package/src/components/separator.tsx +28 -0
- package/src/components/sheet.tsx +158 -0
- package/src/components/sidebar.tsx +725 -0
- package/src/components/skeleton.tsx +20 -0
- package/src/components/slider.tsx +56 -0
- package/src/components/spinner.tsx +16 -0
- package/src/components/switch.tsx +38 -0
- package/src/components/table.tsx +121 -0
- package/src/components/tabs.tsx +88 -0
- package/src/components/textarea.tsx +25 -0
- package/src/components/toast.tsx +273 -0
- package/src/components/toggle-group.tsx +92 -0
- package/src/components/toggle.tsx +47 -0
- package/src/components/tooltip.tsx +72 -0
- package/src/composites/autocomplete.tsx +61 -0
- package/src/composites/cascader.tsx +52 -0
- package/src/composites/color-picker.tsx +25 -0
- package/src/composites/confirm-dialog.tsx +62 -0
- package/src/composites/copyable.tsx +44 -0
- package/src/composites/currency-input.tsx +37 -0
- package/src/composites/date-chrome.tsx +156 -0
- package/src/composites/date-picker.tsx +97 -0
- package/src/composites/date-range-picker.tsx +99 -0
- package/src/composites/date-time-picker.tsx +121 -0
- package/src/composites/date-time-range-picker.tsx +57 -0
- package/src/composites/duration-input.tsx +128 -0
- package/src/composites/live-refresh.tsx +348 -0
- package/src/composites/mini-calendar.tsx +30 -0
- package/src/composites/number-field.tsx +59 -0
- package/src/composites/password-field.tsx +50 -0
- package/src/composites/phone-input.tsx +28 -0
- package/src/composites/rating.tsx +45 -0
- package/src/composites/relative-date-picker.tsx +68 -0
- package/src/composites/search-input.tsx +55 -0
- package/src/composites/slider-range.tsx +36 -0
- package/src/composites/tag-input.tsx +62 -0
- package/src/composites/time-picker.tsx +208 -0
- package/src/composites/time-range-picker.tsx +31 -0
- package/src/composites/timezone-select.tsx +257 -0
- package/src/composites/transfer.tsx +58 -0
- package/src/composites/user-picker.tsx +46 -0
- package/src/hooks/use-html-dark.ts +36 -0
- package/src/hooks/use-mobile.ts +22 -0
- package/src/i18n/context.tsx +71 -0
- package/src/i18n/en.ts +308 -0
- package/src/i18n/zh.ts +290 -0
- package/src/index.ts +151 -0
- package/src/lib/clipboard.ts +10 -0
- package/src/lib/defined.ts +8 -0
- package/src/lib/icons.tsx +16 -0
- package/src/lib/illustrations.tsx +573 -0
- package/src/lib/utils.ts +6 -0
- package/src/products/cells.tsx +18 -0
- package/src/products/code-block.tsx +91 -0
- package/src/products/code-editor.tsx +271 -0
- package/src/products/column-meta.d.ts +9 -0
- package/src/products/commit-graph.tsx +643 -0
- package/src/products/data-grid.tsx +692 -0
- package/src/products/diff-viewer.tsx +224 -0
- package/src/products/event-calendar.tsx +49 -0
- package/src/products/export-csv.ts +26 -0
- package/src/products/file-dropzone.tsx +47 -0
- package/src/products/full-calendar/animations.ts +38 -0
- package/src/products/full-calendar/calendar-body.tsx +76 -0
- package/src/products/full-calendar/constants.ts +10 -0
- package/src/products/full-calendar/contexts/calendar-context.tsx +254 -0
- package/src/products/full-calendar/contexts/dnd-context.tsx +156 -0
- package/src/products/full-calendar/dialogs/add-edit-event-dialog.tsx +186 -0
- package/src/products/full-calendar/dialogs/delete-event-dialog.tsx +39 -0
- package/src/products/full-calendar/dialogs/event-details-dialog.tsx +99 -0
- package/src/products/full-calendar/dialogs/events-list-dialog.tsx +86 -0
- package/src/products/full-calendar/dnd/draggable-event.tsx +45 -0
- package/src/products/full-calendar/dnd/droppable-area.tsx +45 -0
- package/src/products/full-calendar/dnd/resizable-event.tsx +178 -0
- package/src/products/full-calendar/header/calendar-header.tsx +64 -0
- package/src/products/full-calendar/header/date-navigator.tsx +110 -0
- package/src/products/full-calendar/header/filter.tsx +58 -0
- package/src/products/full-calendar/header/today-button.tsx +45 -0
- package/src/products/full-calendar/header/user-select.tsx +64 -0
- package/src/products/full-calendar/header/view-tabs.tsx +36 -0
- package/src/products/full-calendar/helpers.ts +463 -0
- package/src/products/full-calendar/hooks/use-time-range-create.ts +152 -0
- package/src/products/full-calendar/hooks.ts +70 -0
- package/src/products/full-calendar/interfaces.ts +23 -0
- package/src/products/full-calendar/settings/settings.tsx +80 -0
- package/src/products/full-calendar/shims/avatar-group.tsx +16 -0
- package/src/products/full-calendar/shims/day-picker.tsx +1 -0
- package/src/products/full-calendar/shims/motion.tsx +97 -0
- package/src/products/full-calendar/shims/next-themes.ts +6 -0
- package/src/products/full-calendar/shims/re-resizable.tsx +25 -0
- package/src/products/full-calendar/shims/sonner.ts +4 -0
- package/src/products/full-calendar/types.ts +8 -0
- package/src/products/full-calendar/views/agenda-view/agenda-events.tsx +140 -0
- package/src/products/full-calendar/views/month-view/calendar-month-view.tsx +69 -0
- package/src/products/full-calendar/views/month-view/day-cell.tsx +200 -0
- package/src/products/full-calendar/views/month-view/event-bullet.tsx +40 -0
- package/src/products/full-calendar/views/month-view/month-event-badge.tsx +143 -0
- package/src/products/full-calendar/views/week-and-day-view/calendar-day-view.tsx +295 -0
- package/src/products/full-calendar/views/week-and-day-view/calendar-time-line.tsx +35 -0
- package/src/products/full-calendar/views/week-and-day-view/calendar-week-view.tsx +251 -0
- package/src/products/full-calendar/views/week-and-day-view/day-view-multi-day-events-row.tsx +73 -0
- package/src/products/full-calendar/views/week-and-day-view/event-block.tsx +114 -0
- package/src/products/full-calendar/views/week-and-day-view/render-grouped-events.tsx +49 -0
- package/src/products/full-calendar/views/week-and-day-view/week-view-multi-day-events-row.tsx +145 -0
- package/src/products/full-calendar/views/year-view/calendar-year-view.tsx +161 -0
- package/src/products/gantt.tsx +47 -0
- package/src/products/jira-wiki-parse.ts +197 -0
- package/src/products/jira-wiki.tsx +287 -0
- package/src/products/jql-input.tsx +391 -0
- package/src/products/json-viewer.tsx +43 -0
- package/src/products/kanban-issue-panel.tsx +104 -0
- package/src/products/kanban.tsx +245 -0
- package/src/products/log-viewer.tsx +404 -0
- package/src/products/markdown-editor.tsx +77 -0
- package/src/products/markdown.tsx +50 -0
- package/src/products/rich-text-editor.tsx +89 -0
- package/src/products/sortable-list.tsx +67 -0
- package/src/products/stepper.tsx +237 -0
- package/src/products/timeline.tsx +39 -0
- package/src/products/tree-view.tsx +62 -0
- package/src/sdk/app-error-boundary.tsx +240 -0
- package/src/sdk/app-id.ts +7 -0
- package/src/sdk/use-app.ts +43 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { formatDate } from 'date-fns';
|
|
2
|
+
import { motion } from '../shims/motion';
|
|
3
|
+
import { Button } from '@mohou/ui/components/button';
|
|
4
|
+
import { useDateLocale } from '@mohou/ui/i18n/context';
|
|
5
|
+
import { buttonHover, transition } from '../animations';
|
|
6
|
+
import { useCalendar } from '../contexts/calendar-context';
|
|
7
|
+
|
|
8
|
+
const MotionButton = motion.create(Button)
|
|
9
|
+
|
|
10
|
+
export function TodayButton() {
|
|
11
|
+
const { setSelectedDate } = useCalendar()
|
|
12
|
+
const dateLocale = useDateLocale()
|
|
13
|
+
|
|
14
|
+
const today = new Date()
|
|
15
|
+
const handleClick = () => setSelectedDate(today)
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<MotionButton
|
|
19
|
+
variant="outline"
|
|
20
|
+
className="flex h-14 w-14 flex-col items-center justify-center p-0 text-center"
|
|
21
|
+
onClick={handleClick}
|
|
22
|
+
variants={buttonHover}
|
|
23
|
+
whileHover="hover"
|
|
24
|
+
whileTap="tap"
|
|
25
|
+
transition={transition}
|
|
26
|
+
>
|
|
27
|
+
<motion.span
|
|
28
|
+
className="w-full bg-primary py-1 text-xs font-semibold text-primary-foreground"
|
|
29
|
+
initial={{ y: -10, opacity: 0 }}
|
|
30
|
+
animate={{ y: 0, opacity: 1 }}
|
|
31
|
+
transition={{ delay: 0.1, ...transition }}
|
|
32
|
+
>
|
|
33
|
+
{formatDate(today, 'MMM', { locale: dateLocale }).toUpperCase()}
|
|
34
|
+
</motion.span>
|
|
35
|
+
<motion.span
|
|
36
|
+
className="text-lg font-bold"
|
|
37
|
+
initial={{ y: 10, opacity: 0 }}
|
|
38
|
+
animate={{ y: 0, opacity: 1 }}
|
|
39
|
+
transition={{ delay: 0.2, ...transition }}
|
|
40
|
+
>
|
|
41
|
+
{today.getDate()}
|
|
42
|
+
</motion.span>
|
|
43
|
+
</MotionButton>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Avatar, AvatarFallback, AvatarImage } from '@mohou/ui/components/avatar';
|
|
2
|
+
import { AvatarGroup } from '../shims/avatar-group';
|
|
3
|
+
import {
|
|
4
|
+
Select,
|
|
5
|
+
SelectContent,
|
|
6
|
+
SelectItem,
|
|
7
|
+
SelectTrigger,
|
|
8
|
+
SelectValue,
|
|
9
|
+
} from '@mohou/ui/components/select';
|
|
10
|
+
import { useLabels } from '@mohou/ui/i18n/context';
|
|
11
|
+
import { useCalendar } from '../contexts/calendar-context';
|
|
12
|
+
|
|
13
|
+
export function UserSelect() {
|
|
14
|
+
const { users, selectedUserId, filterEventsBySelectedUser } = useCalendar()
|
|
15
|
+
const t = useLabels('eventCalendar');
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Select value={selectedUserId!} onValueChange={value => value && filterEventsBySelectedUser(value)}>
|
|
19
|
+
<SelectTrigger className="w-full">
|
|
20
|
+
<SelectValue placeholder={t.selectUser} />
|
|
21
|
+
</SelectTrigger>
|
|
22
|
+
<SelectContent align="end">
|
|
23
|
+
<SelectItem value="all">
|
|
24
|
+
<AvatarGroup className="mx-2 flex items-center" max={3}>
|
|
25
|
+
{users.map(user => (
|
|
26
|
+
<Avatar key={user.id} className="size-6 text-xxs">
|
|
27
|
+
<AvatarImage
|
|
28
|
+
src={user.picturePath ?? undefined}
|
|
29
|
+
alt={user.name}
|
|
30
|
+
/>
|
|
31
|
+
<AvatarFallback className="text-xxs">
|
|
32
|
+
{user.name[0]}
|
|
33
|
+
</AvatarFallback>
|
|
34
|
+
</Avatar>
|
|
35
|
+
))}
|
|
36
|
+
</AvatarGroup>
|
|
37
|
+
{t.allUsers}
|
|
38
|
+
</SelectItem>
|
|
39
|
+
|
|
40
|
+
{users.map(user => (
|
|
41
|
+
<SelectItem
|
|
42
|
+
key={user.id}
|
|
43
|
+
value={user.id}
|
|
44
|
+
className="flex-1 cursor-pointer"
|
|
45
|
+
>
|
|
46
|
+
<div className="flex items-center gap-2">
|
|
47
|
+
<Avatar key={user.id} className="size-6">
|
|
48
|
+
<AvatarImage
|
|
49
|
+
src={user.picturePath ?? undefined}
|
|
50
|
+
alt={user.name}
|
|
51
|
+
/>
|
|
52
|
+
<AvatarFallback className="text-xxs">
|
|
53
|
+
{user.name[0]}
|
|
54
|
+
</AvatarFallback>
|
|
55
|
+
</Avatar>
|
|
56
|
+
|
|
57
|
+
<p className="truncate">{user.name}</p>
|
|
58
|
+
</div>
|
|
59
|
+
</SelectItem>
|
|
60
|
+
))}
|
|
61
|
+
</SelectContent>
|
|
62
|
+
</Select>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { memo } from 'react'
|
|
2
|
+
|
|
3
|
+
import { Button } from '@mohou/ui/components/button'
|
|
4
|
+
import { useLabels } from '@mohou/ui/i18n/context'
|
|
5
|
+
|
|
6
|
+
import { useCalendar } from '../contexts/calendar-context'
|
|
7
|
+
import type { TCalendarView } from '../types'
|
|
8
|
+
|
|
9
|
+
function Views() {
|
|
10
|
+
const { view, setView } = useCalendar()
|
|
11
|
+
const t = useLabels('eventCalendar')
|
|
12
|
+
const tabs: { name: string; value: TCalendarView }[] = [
|
|
13
|
+
{ name: t.agenda, value: 'agenda' },
|
|
14
|
+
{ name: t.day, value: 'day' },
|
|
15
|
+
{ name: t.week, value: 'week' },
|
|
16
|
+
{ name: t.month, value: 'month' },
|
|
17
|
+
{ name: t.year, value: 'year' },
|
|
18
|
+
]
|
|
19
|
+
return (
|
|
20
|
+
<div className="flex flex-wrap gap-1">
|
|
21
|
+
{tabs.map(({ name, value }) => (
|
|
22
|
+
<Button
|
|
23
|
+
key={value}
|
|
24
|
+
size="sm"
|
|
25
|
+
variant={view === value ? 'default' : 'outline'}
|
|
26
|
+
data-testid={`calendar-view-${value}`}
|
|
27
|
+
onClick={() => setView(value)}
|
|
28
|
+
>
|
|
29
|
+
{name}
|
|
30
|
+
</Button>
|
|
31
|
+
))}
|
|
32
|
+
</div>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default memo(Views)
|
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
import {
|
|
2
|
+
addDays,
|
|
3
|
+
addMonths,
|
|
4
|
+
addWeeks,
|
|
5
|
+
addYears,
|
|
6
|
+
differenceInDays,
|
|
7
|
+
differenceInMinutes,
|
|
8
|
+
eachDayOfInterval,
|
|
9
|
+
endOfMonth,
|
|
10
|
+
endOfWeek,
|
|
11
|
+
endOfYear,
|
|
12
|
+
format,
|
|
13
|
+
isSameDay,
|
|
14
|
+
isSameMonth,
|
|
15
|
+
isSameWeek,
|
|
16
|
+
isSameYear,
|
|
17
|
+
isValid,
|
|
18
|
+
parseISO,
|
|
19
|
+
startOfDay,
|
|
20
|
+
startOfMonth,
|
|
21
|
+
startOfWeek,
|
|
22
|
+
startOfYear,
|
|
23
|
+
subDays,
|
|
24
|
+
subMonths,
|
|
25
|
+
subWeeks,
|
|
26
|
+
subYears,
|
|
27
|
+
} from 'date-fns';
|
|
28
|
+
import type { Locale } from 'date-fns';
|
|
29
|
+
import { useCalendar } from './contexts/calendar-context';
|
|
30
|
+
import type {
|
|
31
|
+
ICalendarCell,
|
|
32
|
+
IEvent,
|
|
33
|
+
} from './interfaces';
|
|
34
|
+
import type {
|
|
35
|
+
TCalendarView,
|
|
36
|
+
TEventColor,
|
|
37
|
+
} from './types';
|
|
38
|
+
|
|
39
|
+
const FORMAT_STRING = 'MMM d, yyyy';
|
|
40
|
+
export const HOUR_HEIGHT_PX = 96
|
|
41
|
+
|
|
42
|
+
export function rangeText(
|
|
43
|
+
view: TCalendarView,
|
|
44
|
+
date: Date,
|
|
45
|
+
opts?: { locale?: Locale; formatError?: string } | undefined,
|
|
46
|
+
): string {
|
|
47
|
+
const { locale, formatError = 'Error while formatting' } = opts ?? {}
|
|
48
|
+
let start: Date
|
|
49
|
+
let end: Date
|
|
50
|
+
|
|
51
|
+
switch (view) {
|
|
52
|
+
case 'month':
|
|
53
|
+
start = startOfMonth(date)
|
|
54
|
+
end = endOfMonth(date)
|
|
55
|
+
break;
|
|
56
|
+
case 'week':
|
|
57
|
+
start = startOfWeek(date)
|
|
58
|
+
end = endOfWeek(date)
|
|
59
|
+
break;
|
|
60
|
+
case 'day':
|
|
61
|
+
return locale === undefined ? format(date, FORMAT_STRING) : format(date, FORMAT_STRING, { locale })
|
|
62
|
+
case 'year':
|
|
63
|
+
start = startOfYear(date)
|
|
64
|
+
end = endOfYear(date)
|
|
65
|
+
break;
|
|
66
|
+
case 'agenda':
|
|
67
|
+
start = startOfMonth(date)
|
|
68
|
+
end = endOfMonth(date)
|
|
69
|
+
break;
|
|
70
|
+
default:
|
|
71
|
+
return formatError
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const startText = locale === undefined ? format(start, FORMAT_STRING) : format(start, FORMAT_STRING, { locale })
|
|
75
|
+
const endText = locale === undefined ? format(end, FORMAT_STRING) : format(end, FORMAT_STRING, { locale })
|
|
76
|
+
return `${startText} - ${endText}`
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function navigateDate(
|
|
80
|
+
date: Date,
|
|
81
|
+
view: TCalendarView,
|
|
82
|
+
direction: 'previous' | 'next',
|
|
83
|
+
): Date {
|
|
84
|
+
const operations: Record<TCalendarView, (d: Date, n: number) => Date> = {
|
|
85
|
+
month: direction === 'next' ? addMonths : subMonths,
|
|
86
|
+
week: direction === 'next' ? addWeeks : subWeeks,
|
|
87
|
+
day: direction === 'next' ? addDays : subDays,
|
|
88
|
+
year: direction === 'next' ? addYears : subYears,
|
|
89
|
+
agenda: direction === 'next' ? addMonths : subMonths,
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
return operations[view](date, 1)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function getEventsCount(
|
|
96
|
+
events: IEvent[],
|
|
97
|
+
date: Date,
|
|
98
|
+
view: TCalendarView,
|
|
99
|
+
): number {
|
|
100
|
+
const compareFns: Record<TCalendarView, (d1: Date, d2: Date) => boolean> = {
|
|
101
|
+
day: isSameDay,
|
|
102
|
+
week: isSameWeek,
|
|
103
|
+
month: isSameMonth,
|
|
104
|
+
year: isSameYear,
|
|
105
|
+
agenda: isSameMonth,
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const compareFn = compareFns[view]
|
|
109
|
+
return events.filter(event => compareFn(parseISO(event.startDate), date))
|
|
110
|
+
.length
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function groupEvents(dayEvents: IEvent[]): IEvent[][] {
|
|
114
|
+
const sortedEvents = dayEvents.sort(
|
|
115
|
+
(a, b) => parseISO(a.startDate).getTime() - parseISO(b.startDate).getTime(),
|
|
116
|
+
);
|
|
117
|
+
const groups: IEvent[][] = []
|
|
118
|
+
|
|
119
|
+
for (const event of sortedEvents) {
|
|
120
|
+
const eventStart = parseISO(event.startDate)
|
|
121
|
+
let placed = false
|
|
122
|
+
|
|
123
|
+
for (const group of groups) {
|
|
124
|
+
const lastEventInGroup = group[group.length - 1]
|
|
125
|
+
if (lastEventInGroup === undefined) continue
|
|
126
|
+
const lastEventEnd = parseISO(lastEventInGroup.endDate)
|
|
127
|
+
|
|
128
|
+
if (eventStart >= lastEventEnd) {
|
|
129
|
+
group.push(event)
|
|
130
|
+
placed = true
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (!placed) groups.push([event])
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return groups
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export function getEventBlockStyle(
|
|
142
|
+
event: IEvent,
|
|
143
|
+
day: Date,
|
|
144
|
+
groupIndex: number,
|
|
145
|
+
groupSize: number,
|
|
146
|
+
) {
|
|
147
|
+
const startDate = parseISO(event.startDate)
|
|
148
|
+
const dayStart = startOfDay(day) // Use startOfDay instead of manual reset
|
|
149
|
+
const eventStart = startDate < dayStart ? dayStart : startDate
|
|
150
|
+
const startMinutes = differenceInMinutes(eventStart, dayStart)
|
|
151
|
+
|
|
152
|
+
const top = (startMinutes / 1440) * 100 // 1440 minutes in a day
|
|
153
|
+
const width = 100 / groupSize
|
|
154
|
+
const left = groupIndex * width
|
|
155
|
+
|
|
156
|
+
return { top: `${top}%`, width: `${width}%`, left: `${left}%` }
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export function getCalendarCells(selectedDate: Date): ICalendarCell[] {
|
|
160
|
+
const year = selectedDate.getFullYear()
|
|
161
|
+
const month = selectedDate.getMonth()
|
|
162
|
+
|
|
163
|
+
const daysInMonth = endOfMonth(selectedDate).getDate() // Faster than new Date(year, month + 1, 0)
|
|
164
|
+
const firstDayOfMonth = startOfMonth(selectedDate).getDay()
|
|
165
|
+
const daysInPrevMonth = endOfMonth(new Date(year, month - 1)).getDate()
|
|
166
|
+
const totalDays = firstDayOfMonth + daysInMonth
|
|
167
|
+
|
|
168
|
+
const prevMonthCells = Array.from({ length: firstDayOfMonth }, (_, i) => ({
|
|
169
|
+
day: daysInPrevMonth - firstDayOfMonth + i + 1,
|
|
170
|
+
currentMonth: false,
|
|
171
|
+
date: new Date(year, month - 1, daysInPrevMonth - firstDayOfMonth + i + 1),
|
|
172
|
+
}))
|
|
173
|
+
|
|
174
|
+
const currentMonthCells = Array.from({ length: daysInMonth }, (_, i) => ({
|
|
175
|
+
day: i + 1,
|
|
176
|
+
currentMonth: true,
|
|
177
|
+
date: new Date(year, month, i + 1),
|
|
178
|
+
}))
|
|
179
|
+
|
|
180
|
+
const nextMonthCells = Array.from(
|
|
181
|
+
{ length: (7 - (totalDays % 7)) % 7 },
|
|
182
|
+
(_, i) => ({
|
|
183
|
+
day: i + 1,
|
|
184
|
+
currentMonth: false,
|
|
185
|
+
date: new Date(year, month + 1, i + 1),
|
|
186
|
+
}),
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
return [...prevMonthCells, ...currentMonthCells, ...nextMonthCells]
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export function calculateMonthEventPositions(
|
|
193
|
+
multiDayEvents: IEvent[],
|
|
194
|
+
singleDayEvents: IEvent[],
|
|
195
|
+
selectedDate: Date,
|
|
196
|
+
): Record<string, number> {
|
|
197
|
+
const monthStart = startOfMonth(selectedDate)
|
|
198
|
+
const monthEnd = endOfMonth(selectedDate)
|
|
199
|
+
|
|
200
|
+
const eventPositions: Record<string, number> = {}
|
|
201
|
+
const occupiedPositions: Record<string, boolean[]> = {}
|
|
202
|
+
|
|
203
|
+
eachDayOfInterval({ start: monthStart, end: monthEnd }).forEach((day) => {
|
|
204
|
+
occupiedPositions[day.toISOString()] = [false, false, false]
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
const sortedEvents = [
|
|
208
|
+
...multiDayEvents.sort((a, b) => {
|
|
209
|
+
const aDuration = differenceInDays(
|
|
210
|
+
parseISO(a.endDate),
|
|
211
|
+
parseISO(a.startDate),
|
|
212
|
+
);
|
|
213
|
+
const bDuration = differenceInDays(
|
|
214
|
+
parseISO(b.endDate),
|
|
215
|
+
parseISO(b.startDate),
|
|
216
|
+
);
|
|
217
|
+
return (
|
|
218
|
+
bDuration - aDuration ||
|
|
219
|
+
parseISO(a.startDate).getTime() - parseISO(b.startDate).getTime()
|
|
220
|
+
);
|
|
221
|
+
}),
|
|
222
|
+
...singleDayEvents.sort(
|
|
223
|
+
(a, b) =>
|
|
224
|
+
parseISO(a.startDate).getTime() - parseISO(b.startDate).getTime(),
|
|
225
|
+
),
|
|
226
|
+
];
|
|
227
|
+
|
|
228
|
+
sortedEvents.forEach((event) => {
|
|
229
|
+
const eventStart = parseISO(event.startDate)
|
|
230
|
+
const eventEnd = parseISO(event.endDate)
|
|
231
|
+
const eventDays = eachDayOfInterval({
|
|
232
|
+
start: eventStart < monthStart ? monthStart : eventStart,
|
|
233
|
+
end: eventEnd > monthEnd ? monthEnd : eventEnd,
|
|
234
|
+
})
|
|
235
|
+
|
|
236
|
+
let position = -1
|
|
237
|
+
|
|
238
|
+
for (let i = 0; i < 3; i++) {
|
|
239
|
+
if (
|
|
240
|
+
eventDays.every((day) => {
|
|
241
|
+
const dayPositions = occupiedPositions[startOfDay(day).toISOString()]
|
|
242
|
+
return dayPositions && !dayPositions[i]
|
|
243
|
+
})
|
|
244
|
+
) {
|
|
245
|
+
position = i
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (position !== -1) {
|
|
251
|
+
eventDays.forEach((day) => {
|
|
252
|
+
const dayKey = startOfDay(day).toISOString()
|
|
253
|
+
const slots = occupiedPositions[dayKey] ?? [false, false, false]
|
|
254
|
+
slots[position] = true
|
|
255
|
+
occupiedPositions[dayKey] = slots
|
|
256
|
+
});
|
|
257
|
+
eventPositions[event.id] = position
|
|
258
|
+
}
|
|
259
|
+
})
|
|
260
|
+
|
|
261
|
+
return eventPositions
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export function getMonthCellEvents(
|
|
265
|
+
date: Date,
|
|
266
|
+
events: IEvent[],
|
|
267
|
+
eventPositions: Record<string, number>,
|
|
268
|
+
) {
|
|
269
|
+
const dayStart = startOfDay(date)
|
|
270
|
+
const eventsForDate = events.filter((event) => {
|
|
271
|
+
const eventStart = parseISO(event.startDate)
|
|
272
|
+
const eventEnd = parseISO(event.endDate)
|
|
273
|
+
return (
|
|
274
|
+
(dayStart >= eventStart && dayStart <= eventEnd) ||
|
|
275
|
+
isSameDay(dayStart, eventStart) ||
|
|
276
|
+
isSameDay(dayStart, eventEnd)
|
|
277
|
+
);
|
|
278
|
+
})
|
|
279
|
+
|
|
280
|
+
return eventsForDate
|
|
281
|
+
.map(event => ({
|
|
282
|
+
...event,
|
|
283
|
+
position: eventPositions[event.id] ?? -1,
|
|
284
|
+
isMultiDay: event.startDate !== event.endDate,
|
|
285
|
+
}))
|
|
286
|
+
.sort((a, b) => {
|
|
287
|
+
if (a.isMultiDay && !b.isMultiDay) return -1
|
|
288
|
+
if (!a.isMultiDay && b.isMultiDay) return 1
|
|
289
|
+
return a.position - b.position
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export function formatTime(
|
|
294
|
+
date: Date | string,
|
|
295
|
+
use24HourFormat: boolean,
|
|
296
|
+
): string {
|
|
297
|
+
const parsedDate = typeof date === 'string' ? parseISO(date) : date
|
|
298
|
+
if (!isValid(parsedDate)) return '';
|
|
299
|
+
return format(parsedDate, use24HourFormat ? 'HH:mm' : 'h:mm a');
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export const getFirstLetters = (str: string): string => {
|
|
303
|
+
if (!str) return '';
|
|
304
|
+
const words = str.split(' ');
|
|
305
|
+
const first = words[0]
|
|
306
|
+
if (first === undefined) return '';
|
|
307
|
+
if (words.length === 1) return first.charAt(0).toUpperCase()
|
|
308
|
+
const second = words[1]
|
|
309
|
+
if (second === undefined) return first.charAt(0).toUpperCase()
|
|
310
|
+
return `${first.charAt(0).toUpperCase()}${second.charAt(0).toUpperCase()}`
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
export const getEventsForDay = (
|
|
314
|
+
events: IEvent[],
|
|
315
|
+
date: Date,
|
|
316
|
+
isWeek = false,
|
|
317
|
+
): IEvent[] => {
|
|
318
|
+
const targetDate = startOfDay(date)
|
|
319
|
+
return events
|
|
320
|
+
.filter((event) => {
|
|
321
|
+
const startOfDayForEventStart = startOfDay(parseISO(event.startDate))
|
|
322
|
+
const startOfDayForEventEnd = startOfDay(parseISO(event.endDate))
|
|
323
|
+
if (isWeek) {
|
|
324
|
+
return (
|
|
325
|
+
event.startDate !== event.endDate &&
|
|
326
|
+
startOfDayForEventStart <= targetDate &&
|
|
327
|
+
startOfDayForEventEnd >= targetDate
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
return (
|
|
331
|
+
startOfDayForEventStart <= targetDate &&
|
|
332
|
+
startOfDayForEventEnd >= targetDate
|
|
333
|
+
);
|
|
334
|
+
})
|
|
335
|
+
.map((event) => {
|
|
336
|
+
const eventStart = startOfDay(parseISO(event.startDate))
|
|
337
|
+
const eventEnd = startOfDay(parseISO(event.endDate))
|
|
338
|
+
let point: 'start' | 'end' | 'none' | undefined
|
|
339
|
+
|
|
340
|
+
if (isSameDay(eventStart, eventEnd)) {
|
|
341
|
+
point = 'none';
|
|
342
|
+
} else if (isSameDay(eventStart, targetDate)) {
|
|
343
|
+
point = 'start';
|
|
344
|
+
} else if (isSameDay(eventEnd, targetDate)) {
|
|
345
|
+
point = 'end';
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
return { ...event, point }
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
export const getWeekDates = (date: Date): Date[] => {
|
|
353
|
+
const startDate = startOfWeek(date, { weekStartsOn: 1 })
|
|
354
|
+
return Array.from({ length: 7 }, (_, i) => addDays(startDate, i))
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
export const getEventsForWeek = (events: IEvent[], date: Date): IEvent[] => {
|
|
358
|
+
const weekDates = getWeekDates(date)
|
|
359
|
+
const startOfWeekDate = weekDates[0]
|
|
360
|
+
const endOfWeekDate = weekDates[6]
|
|
361
|
+
if (startOfWeekDate === undefined || endOfWeekDate === undefined) return []
|
|
362
|
+
|
|
363
|
+
return events.filter((event) => {
|
|
364
|
+
const eventStart = parseISO(event.startDate)
|
|
365
|
+
const eventEnd = parseISO(event.endDate)
|
|
366
|
+
return (
|
|
367
|
+
isValid(eventStart) &&
|
|
368
|
+
isValid(eventEnd) &&
|
|
369
|
+
eventStart <= endOfWeekDate &&
|
|
370
|
+
eventEnd >= startOfWeekDate
|
|
371
|
+
);
|
|
372
|
+
})
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
export const getEventsForMonth = (events: IEvent[], date: Date): IEvent[] => {
|
|
376
|
+
const startOfMonthDate = startOfMonth(date)
|
|
377
|
+
const endOfMonthDate = endOfMonth(date)
|
|
378
|
+
|
|
379
|
+
return events.filter((event) => {
|
|
380
|
+
const eventStart = parseISO(event.startDate)
|
|
381
|
+
const eventEnd = parseISO(event.endDate)
|
|
382
|
+
return (
|
|
383
|
+
isValid(eventStart) &&
|
|
384
|
+
isValid(eventEnd) &&
|
|
385
|
+
eventStart <= endOfMonthDate &&
|
|
386
|
+
eventEnd >= startOfMonthDate
|
|
387
|
+
);
|
|
388
|
+
})
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
export const getEventsForYear = (events: IEvent[], date: Date): IEvent[] => {
|
|
392
|
+
if (!events || !Array.isArray(events) || !isValid(date)) return []
|
|
393
|
+
|
|
394
|
+
const startOfYearDate = startOfYear(date)
|
|
395
|
+
const endOfYearDate = endOfYear(date)
|
|
396
|
+
|
|
397
|
+
return events.filter((event) => {
|
|
398
|
+
const eventStart = parseISO(event.startDate)
|
|
399
|
+
const eventEnd = parseISO(event.endDate)
|
|
400
|
+
return (
|
|
401
|
+
isValid(eventStart) &&
|
|
402
|
+
isValid(eventEnd) &&
|
|
403
|
+
eventStart <= endOfYearDate &&
|
|
404
|
+
eventEnd >= startOfYearDate
|
|
405
|
+
);
|
|
406
|
+
})
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
export const getColorClass = (color: string): string => {
|
|
410
|
+
const colorClasses: Record<TEventColor, string> = {
|
|
411
|
+
red: 'border-red-200 bg-red-50 text-red-700 dark:border-red-800 dark:bg-red-950 dark:text-red-300',
|
|
412
|
+
yellow:
|
|
413
|
+
'border-yellow-200 bg-yellow-50 text-yellow-700 dark:border-yellow-800 dark:bg-yellow-950 dark:text-yellow-300',
|
|
414
|
+
green:
|
|
415
|
+
'border-green-200 bg-green-50 text-green-700 dark:border-green-800 dark:bg-green-950 dark:text-green-300',
|
|
416
|
+
blue: 'border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-300',
|
|
417
|
+
orange:
|
|
418
|
+
'border-orange-200 bg-orange-50 text-orange-700 dark:border-orange-800 dark:bg-orange-950 dark:text-orange-300',
|
|
419
|
+
purple:
|
|
420
|
+
'border-purple-200 bg-purple-50 text-purple-700 dark:border-purple-800 dark:bg-purple-950 dark:text-purple-300',
|
|
421
|
+
};
|
|
422
|
+
return colorClasses[color as TEventColor] || '';
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
export const getBgColor = (color: string): string => {
|
|
426
|
+
const colorClasses: Record<TEventColor, string> = {
|
|
427
|
+
red: 'bg-red-400 dark:bg-red-600',
|
|
428
|
+
yellow: 'bg-yellow-400 dark:bg-yellow-600',
|
|
429
|
+
green: 'bg-green-400 dark:bg-green-600',
|
|
430
|
+
blue: 'bg-blue-400 dark:bg-blue-600',
|
|
431
|
+
orange: 'bg-orange-400 dark:bg-orange-600',
|
|
432
|
+
purple: 'bg-purple-400 dark:bg-purple-600',
|
|
433
|
+
};
|
|
434
|
+
return colorClasses[color as TEventColor] || '';
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
export const useGetEventsByMode = (events: IEvent[]) => {
|
|
438
|
+
const { view, selectedDate } = useCalendar()
|
|
439
|
+
|
|
440
|
+
switch (view) {
|
|
441
|
+
case 'day':
|
|
442
|
+
return getEventsForDay(events, selectedDate)
|
|
443
|
+
case 'week':
|
|
444
|
+
return getEventsForWeek(events, selectedDate)
|
|
445
|
+
case 'agenda':
|
|
446
|
+
case 'month':
|
|
447
|
+
return getEventsForMonth(events, selectedDate)
|
|
448
|
+
case 'year':
|
|
449
|
+
return getEventsForYear(events, selectedDate)
|
|
450
|
+
default:
|
|
451
|
+
return []
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
export const toCapitalize = (str: string): string => {
|
|
456
|
+
if (!str) return '';
|
|
457
|
+
return str.charAt(0).toUpperCase() + str.slice(1)
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
export const useScrollPosition = () => {
|
|
461
|
+
const { startOfDayHour } = useCalendar()
|
|
462
|
+
return startOfDayHour * HOUR_HEIGHT_PX
|
|
463
|
+
};
|