@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,348 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
|
|
3
|
+
import { Popover, PopoverContent, PopoverTrigger } from '@mohou/ui/components/popover'
|
|
4
|
+
import { useLabels } from '@mohou/ui/i18n/context'
|
|
5
|
+
import type { UiMessages } from '@mohou/ui/i18n/en'
|
|
6
|
+
import { cn } from '@mohou/ui/lib/utils'
|
|
7
|
+
|
|
8
|
+
/** Default interval chips (ms). */
|
|
9
|
+
export const liveRefreshDefaultIntervals = [10_000, 30_000, 60_000, 300_000] as const
|
|
10
|
+
|
|
11
|
+
const MIN_MS = 6_000
|
|
12
|
+
const MAX_MS = 5_994_000
|
|
13
|
+
const DEFAULT_MS = 30_000
|
|
14
|
+
|
|
15
|
+
export type LiveRefreshState = {
|
|
16
|
+
enabled: boolean
|
|
17
|
+
intervalMs: number
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type LiveRefreshLabels = Partial<{
|
|
21
|
+
live: string
|
|
22
|
+
off: string
|
|
23
|
+
paused: string
|
|
24
|
+
refreshing: string
|
|
25
|
+
failed: string
|
|
26
|
+
turnOff: string
|
|
27
|
+
custom: string
|
|
28
|
+
customUnit: string
|
|
29
|
+
customInvalid: string
|
|
30
|
+
}>
|
|
31
|
+
|
|
32
|
+
export type LiveRefreshProps = {
|
|
33
|
+
onTick: () => void | Promise<void | { status?: string }>
|
|
34
|
+
defaultEnabled?: boolean
|
|
35
|
+
defaultIntervalMs?: number
|
|
36
|
+
enabled?: boolean
|
|
37
|
+
intervalMs?: number
|
|
38
|
+
onEnabledChange?: (enabled: boolean) => void
|
|
39
|
+
onIntervalChange?: (intervalMs: number) => void
|
|
40
|
+
/** Persist enabled + interval. Pause stays in memory only. */
|
|
41
|
+
persistState?: (state: LiveRefreshState) => boolean | void | Promise<boolean | void>
|
|
42
|
+
/** Override preset list (ms). Custom minutes stay available. */
|
|
43
|
+
intervals?: readonly number[]
|
|
44
|
+
/** Optional partial chrome copy override. */
|
|
45
|
+
labels?: LiveRefreshLabels
|
|
46
|
+
className?: string
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Compact live-refresh chrome: ring + LIVE · status · every N.
|
|
51
|
+
* App owns `onTick` data merge. No host/panel protocol.
|
|
52
|
+
* @when Dashboards / workbenches that need periodic soft refresh inside the iframe.
|
|
53
|
+
* @example
|
|
54
|
+
* <LiveRefresh onTick={async () => { await load() }} />
|
|
55
|
+
* @family Discovery & inspect
|
|
56
|
+
*/
|
|
57
|
+
export function LiveRefresh({
|
|
58
|
+
onTick,
|
|
59
|
+
defaultEnabled = false,
|
|
60
|
+
defaultIntervalMs = DEFAULT_MS,
|
|
61
|
+
enabled: enabledProp,
|
|
62
|
+
intervalMs: intervalProp,
|
|
63
|
+
onEnabledChange,
|
|
64
|
+
onIntervalChange,
|
|
65
|
+
persistState,
|
|
66
|
+
intervals = liveRefreshDefaultIntervals,
|
|
67
|
+
labels: labelOverride,
|
|
68
|
+
className,
|
|
69
|
+
}: LiveRefreshProps) {
|
|
70
|
+
const kit = useLabels('liveRefresh', labelOverride as Partial<UiMessages['liveRefresh']> | undefined)
|
|
71
|
+
const onTickRef = React.useRef(onTick)
|
|
72
|
+
onTickRef.current = onTick
|
|
73
|
+
|
|
74
|
+
const [enabledUncontrolled, setEnabledUncontrolled] = React.useState(defaultEnabled)
|
|
75
|
+
const [intervalUncontrolled, setIntervalUncontrolled] = React.useState(
|
|
76
|
+
normalizeInterval(defaultIntervalMs, intervals),
|
|
77
|
+
)
|
|
78
|
+
const enabled = enabledProp ?? enabledUncontrolled
|
|
79
|
+
const intervalMs = intervalProp ?? intervalUncontrolled
|
|
80
|
+
|
|
81
|
+
const [paused, setPaused] = React.useState(false)
|
|
82
|
+
const [busy, setBusy] = React.useState(false)
|
|
83
|
+
const [menuOpen, setMenuOpen] = React.useState(false)
|
|
84
|
+
const [custom, setCustom] = React.useState('')
|
|
85
|
+
const [customError, setCustomError] = React.useState('')
|
|
86
|
+
const [now, setNow] = React.useState(() => Date.now())
|
|
87
|
+
const [lastAt, setLastAt] = React.useState(() => Date.now())
|
|
88
|
+
const [dueAt, setDueAt] = React.useState(() => Date.now() + intervalMs)
|
|
89
|
+
const [lastError, setLastError] = React.useState<string | undefined>(undefined)
|
|
90
|
+
const [lastStatus, setLastStatus] = React.useState<string | undefined>(undefined)
|
|
91
|
+
const busyRef = React.useRef(false)
|
|
92
|
+
|
|
93
|
+
React.useEffect(() => {
|
|
94
|
+
const id = window.setInterval(() => setNow(Date.now()), 250)
|
|
95
|
+
return () => window.clearInterval(id)
|
|
96
|
+
}, [])
|
|
97
|
+
|
|
98
|
+
React.useEffect(() => {
|
|
99
|
+
if (!enabled || paused) return
|
|
100
|
+
const id = window.setInterval(() => {
|
|
101
|
+
if (busyRef.current) return
|
|
102
|
+
if (Date.now() < dueAt) return
|
|
103
|
+
void runTick()
|
|
104
|
+
}, 400)
|
|
105
|
+
return () => window.clearInterval(id)
|
|
106
|
+
}, [enabled, paused, dueAt, intervalMs])
|
|
107
|
+
|
|
108
|
+
function setEnabled(next: boolean) {
|
|
109
|
+
if (enabledProp === undefined) setEnabledUncontrolled(next)
|
|
110
|
+
onEnabledChange?.(next)
|
|
111
|
+
void persist({ enabled: next, intervalMs })
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function setIntervalMs(next: number) {
|
|
115
|
+
const ms = normalizeInterval(next, intervals)
|
|
116
|
+
if (intervalProp === undefined) setIntervalUncontrolled(ms)
|
|
117
|
+
onIntervalChange?.(ms)
|
|
118
|
+
if (!enabled) {
|
|
119
|
+
if (enabledProp === undefined) setEnabledUncontrolled(true)
|
|
120
|
+
onEnabledChange?.(true)
|
|
121
|
+
}
|
|
122
|
+
void persist({ enabled: true, intervalMs: ms })
|
|
123
|
+
// Anchor on lastAt: next due = last success + new period (or now if already past).
|
|
124
|
+
const stamp = Date.now()
|
|
125
|
+
setDueAt(Math.max(lastAt + ms, stamp))
|
|
126
|
+
setPaused(false)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
async function persist(state: LiveRefreshState) {
|
|
130
|
+
if (persistState === undefined) return
|
|
131
|
+
try {
|
|
132
|
+
const ok = await persistState(state)
|
|
133
|
+
if (ok === false) setLastError(kit.failed)
|
|
134
|
+
} catch {
|
|
135
|
+
setLastError(kit.failed)
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
async function runTick() {
|
|
140
|
+
if (busyRef.current) return
|
|
141
|
+
busyRef.current = true
|
|
142
|
+
setBusy(true)
|
|
143
|
+
const nextDue = Date.now() + intervalMs
|
|
144
|
+
setDueAt(nextDue)
|
|
145
|
+
try {
|
|
146
|
+
const result = await onTickRef.current()
|
|
147
|
+
setLastAt(Date.now())
|
|
148
|
+
setLastError(undefined)
|
|
149
|
+
if (typeof result === 'object' && result !== null && typeof result.status === 'string') {
|
|
150
|
+
setLastStatus(result.status)
|
|
151
|
+
} else {
|
|
152
|
+
setLastStatus(undefined)
|
|
153
|
+
}
|
|
154
|
+
} catch (error) {
|
|
155
|
+
setLastError(error instanceof Error && error.message.length > 0 ? error.message : kit.failed)
|
|
156
|
+
} finally {
|
|
157
|
+
busyRef.current = false
|
|
158
|
+
setBusy(false)
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function onMainClick() {
|
|
163
|
+
if (!enabled) {
|
|
164
|
+
const stamp = Date.now()
|
|
165
|
+
setEnabled(true)
|
|
166
|
+
setPaused(false)
|
|
167
|
+
setLastAt(stamp)
|
|
168
|
+
setDueAt(stamp + intervalMs)
|
|
169
|
+
setLastError(undefined)
|
|
170
|
+
return
|
|
171
|
+
}
|
|
172
|
+
if (paused) {
|
|
173
|
+
setPaused(false)
|
|
174
|
+
setDueAt(Date.now() + intervalMs)
|
|
175
|
+
return
|
|
176
|
+
}
|
|
177
|
+
setPaused(true)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function applyCustom() {
|
|
181
|
+
const ms = parseMinutes(custom)
|
|
182
|
+
if (ms === undefined) {
|
|
183
|
+
setCustomError(kit.customInvalid)
|
|
184
|
+
return
|
|
185
|
+
}
|
|
186
|
+
setCustomError('')
|
|
187
|
+
setCustom('')
|
|
188
|
+
setMenuOpen(false)
|
|
189
|
+
setIntervalMs(ms)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const progress = (() => {
|
|
193
|
+
if (!enabled || paused) return 0
|
|
194
|
+
if (intervalMs <= 0) return 0
|
|
195
|
+
const started = dueAt - intervalMs
|
|
196
|
+
return Math.max(0, Math.min(100, ((now - started) / intervalMs) * 100))
|
|
197
|
+
})()
|
|
198
|
+
|
|
199
|
+
const mainText = (() => {
|
|
200
|
+
const prefix = kit.live
|
|
201
|
+
if (!enabled) return `${prefix} · ${kit.off}`
|
|
202
|
+
if (paused) return `${prefix} · ${kit.paused}`
|
|
203
|
+
if (busy) return `${prefix} · ${kit.refreshing}`
|
|
204
|
+
return `${prefix} · ${formatAgo(now - lastAt, kit)}`
|
|
205
|
+
})()
|
|
206
|
+
|
|
207
|
+
const everyText = formatEvery(intervalMs, kit)
|
|
208
|
+
const note = lastError ?? lastStatus
|
|
209
|
+
|
|
210
|
+
return (
|
|
211
|
+
<div
|
|
212
|
+
data-testid="live-refresh"
|
|
213
|
+
data-enabled={enabled ? '1' : '0'}
|
|
214
|
+
data-paused={paused ? '1' : '0'}
|
|
215
|
+
className={cn(
|
|
216
|
+
'inline-flex items-center gap-2 text-[10px] font-semibold tracking-[0.12em] text-muted-foreground uppercase',
|
|
217
|
+
className,
|
|
218
|
+
)}
|
|
219
|
+
>
|
|
220
|
+
<span
|
|
221
|
+
aria-hidden
|
|
222
|
+
className="size-2.5 shrink-0 rounded-full"
|
|
223
|
+
style={
|
|
224
|
+
enabled && !paused
|
|
225
|
+
? {
|
|
226
|
+
background: `conic-gradient(var(--primary) ${progress}%, color-mix(in oklch, var(--foreground) 12%, transparent) 0)`,
|
|
227
|
+
WebkitMask:
|
|
228
|
+
'radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px))',
|
|
229
|
+
mask: 'radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px))',
|
|
230
|
+
}
|
|
231
|
+
: { background: 'color-mix(in oklch, var(--foreground) 22%, transparent)' }
|
|
232
|
+
}
|
|
233
|
+
/>
|
|
234
|
+
<button
|
|
235
|
+
type="button"
|
|
236
|
+
className="hover:text-foreground cursor-pointer border-0 bg-transparent p-0 font-inherit tracking-inherit text-inherit uppercase"
|
|
237
|
+
onClick={onMainClick}
|
|
238
|
+
>
|
|
239
|
+
{mainText}
|
|
240
|
+
</button>
|
|
241
|
+
{enabled ? (
|
|
242
|
+
<>
|
|
243
|
+
<span className="text-foreground/25">·</span>
|
|
244
|
+
<Popover open={menuOpen} onOpenChange={setMenuOpen}>
|
|
245
|
+
<PopoverTrigger
|
|
246
|
+
render={
|
|
247
|
+
<button
|
|
248
|
+
type="button"
|
|
249
|
+
className="hover:text-foreground cursor-pointer border-0 bg-transparent p-0 font-inherit tracking-inherit text-inherit uppercase"
|
|
250
|
+
/>
|
|
251
|
+
}
|
|
252
|
+
>
|
|
253
|
+
{everyText}
|
|
254
|
+
</PopoverTrigger>
|
|
255
|
+
<PopoverContent align="end" className="w-44 p-1.5 tracking-normal normal-case">
|
|
256
|
+
<button
|
|
257
|
+
type="button"
|
|
258
|
+
className="hover:bg-muted flex h-8 w-full items-center rounded-md px-2.5 text-left text-xs font-semibold"
|
|
259
|
+
onClick={() => {
|
|
260
|
+
setEnabled(false)
|
|
261
|
+
setPaused(false)
|
|
262
|
+
setMenuOpen(false)
|
|
263
|
+
}}
|
|
264
|
+
>
|
|
265
|
+
{kit.turnOff}
|
|
266
|
+
</button>
|
|
267
|
+
{intervals.map((ms) => (
|
|
268
|
+
<button
|
|
269
|
+
key={ms}
|
|
270
|
+
type="button"
|
|
271
|
+
data-on={intervalMs === ms ? '1' : '0'}
|
|
272
|
+
className={cn(
|
|
273
|
+
'hover:bg-muted flex h-8 w-full items-center rounded-md px-2.5 text-left text-xs font-semibold',
|
|
274
|
+
intervalMs === ms && 'bg-muted',
|
|
275
|
+
)}
|
|
276
|
+
onClick={() => {
|
|
277
|
+
setIntervalMs(ms)
|
|
278
|
+
setMenuOpen(false)
|
|
279
|
+
}}
|
|
280
|
+
>
|
|
281
|
+
{formatEvery(ms, kit)}
|
|
282
|
+
</button>
|
|
283
|
+
))}
|
|
284
|
+
<div className="text-muted-foreground flex items-center gap-1.5 px-2.5 pt-1.5 pb-1 text-[11px] font-semibold">
|
|
285
|
+
<span>{kit.custom}</span>
|
|
286
|
+
<input
|
|
287
|
+
value={custom}
|
|
288
|
+
inputMode="decimal"
|
|
289
|
+
placeholder="1.5"
|
|
290
|
+
className="border-border bg-background text-foreground h-7 w-14 rounded-md border px-2 text-xs font-semibold outline-none"
|
|
291
|
+
onChange={(event) => setCustom(event.target.value)}
|
|
292
|
+
onKeyDown={(event) => {
|
|
293
|
+
if (event.key === 'Enter') applyCustom()
|
|
294
|
+
}}
|
|
295
|
+
/>
|
|
296
|
+
<span>{kit.customUnit}</span>
|
|
297
|
+
</div>
|
|
298
|
+
{customError ? (
|
|
299
|
+
<div className="text-destructive px-2.5 pb-1 text-[11px]">{customError}</div>
|
|
300
|
+
) : null}
|
|
301
|
+
</PopoverContent>
|
|
302
|
+
</Popover>
|
|
303
|
+
</>
|
|
304
|
+
) : null}
|
|
305
|
+
{note ? (
|
|
306
|
+
<span
|
|
307
|
+
className={cn(
|
|
308
|
+
'max-w-[12rem] truncate text-[10px] font-semibold tracking-normal normal-case',
|
|
309
|
+
lastError ? 'text-destructive' : 'text-muted-foreground',
|
|
310
|
+
)}
|
|
311
|
+
>
|
|
312
|
+
{note}
|
|
313
|
+
</span>
|
|
314
|
+
) : null}
|
|
315
|
+
</div>
|
|
316
|
+
)
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
function normalizeInterval(ms: number, _intervals: readonly number[]): number {
|
|
320
|
+
if (!Number.isFinite(ms) || ms < MIN_MS) return DEFAULT_MS
|
|
321
|
+
if (ms > MAX_MS) return MAX_MS
|
|
322
|
+
return Math.round(ms)
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function parseMinutes(raw: string): number | undefined {
|
|
326
|
+
const text = raw.trim()
|
|
327
|
+
if (!/^\d+(\.\d)?$/.test(text)) return undefined
|
|
328
|
+
const min = Number(text)
|
|
329
|
+
if (!Number.isFinite(min) || min < 0.1 || min > 99.9) return undefined
|
|
330
|
+
const ms = Math.round(min * 60_000)
|
|
331
|
+
if (ms < MIN_MS || ms > MAX_MS) return undefined
|
|
332
|
+
return ms
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function formatAgo(ms: number, kit: UiMessages['liveRefresh']): string {
|
|
336
|
+
if (ms < 1500) return kit.justNow
|
|
337
|
+
if (ms < 60_000) return kit.secondsAgo(Math.floor(ms / 1000))
|
|
338
|
+
return kit.minutesAgo(Math.floor(ms / 60_000))
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
function formatEvery(intervalMs: number, kit: UiMessages['liveRefresh']): string {
|
|
342
|
+
if (intervalMs < 60_000 && intervalMs % 1000 === 0) {
|
|
343
|
+
return kit.everySeconds(intervalMs / 1000)
|
|
344
|
+
}
|
|
345
|
+
const min = intervalMs / 60_000
|
|
346
|
+
if (Number.isInteger(min)) return kit.everyMinutes(min)
|
|
347
|
+
return kit.everyMinutes(Number(min.toFixed(1)))
|
|
348
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
import { Calendar } from '@mohou/ui/components/calendar'
|
|
3
|
+
import { cn } from '@mohou/ui/lib/utils'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Compact month grid, day cell only.
|
|
7
|
+
* @when Inside a popover or sidebar. Full page with events → `EventCalendar`.
|
|
8
|
+
* @example
|
|
9
|
+
* <MiniCalendar value={d} onChange={(v) => set(v)} />
|
|
10
|
+
* @family Calendar & date
|
|
11
|
+
*/
|
|
12
|
+
export function MiniCalendar({
|
|
13
|
+
value,
|
|
14
|
+
onChange,
|
|
15
|
+
className,
|
|
16
|
+
}: {
|
|
17
|
+
value?: Date
|
|
18
|
+
onChange?: (date: Date | undefined) => void
|
|
19
|
+
className?: string
|
|
20
|
+
}) {
|
|
21
|
+
return (
|
|
22
|
+
<Calendar
|
|
23
|
+
mode="single"
|
|
24
|
+
{...value === undefined ? {} : { selected: value }}
|
|
25
|
+
{...onChange === undefined ? {} : { onSelect: onChange }}
|
|
26
|
+
data-testid="mini-calendar"
|
|
27
|
+
className={cn('rounded-xl border [--cell-size:--spacing(7)]', className)}
|
|
28
|
+
/>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
|
|
2
|
+
import { Button } from '@mohou/ui/components/button'
|
|
3
|
+
import { Input } from '@mohou/ui/components/input'
|
|
4
|
+
import { Minus, Plus } from 'lucide-react'
|
|
5
|
+
import { useLabels } from '@mohou/ui/i18n/context'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Numeric input with min/max/step + steppers.
|
|
9
|
+
* @when Any number the user edits — keeps NaN out of your state.
|
|
10
|
+
* @example
|
|
11
|
+
* <NumberField min={0} max={100} value={n} onChange={(v) => set(v)} />
|
|
12
|
+
* @family Form
|
|
13
|
+
*/
|
|
14
|
+
export function NumberField({
|
|
15
|
+
value = 0,
|
|
16
|
+
onChange,
|
|
17
|
+
min,
|
|
18
|
+
max,
|
|
19
|
+
step = 1,
|
|
20
|
+
}: {
|
|
21
|
+
value?: number
|
|
22
|
+
onChange?: (value: number) => void
|
|
23
|
+
min?: number
|
|
24
|
+
max?: number
|
|
25
|
+
step?: number
|
|
26
|
+
}) {
|
|
27
|
+
const clamp = (next: number) => {
|
|
28
|
+
if (min != null) next = Math.max(min, next)
|
|
29
|
+
if (max != null) next = Math.min(max, next)
|
|
30
|
+
return next
|
|
31
|
+
}
|
|
32
|
+
const t = useLabels('numberField')
|
|
33
|
+
return (
|
|
34
|
+
<div className="flex items-center gap-1" data-testid="number-field">
|
|
35
|
+
<Button
|
|
36
|
+
variant="outline"
|
|
37
|
+
size="icon-xs"
|
|
38
|
+
aria-label={t.decrease}
|
|
39
|
+
onClick={() => onChange?.(clamp(value - step))}
|
|
40
|
+
>
|
|
41
|
+
<Minus />
|
|
42
|
+
</Button>
|
|
43
|
+
<Input
|
|
44
|
+
type="number"
|
|
45
|
+
value={value}
|
|
46
|
+
onChange={event => onChange?.(clamp(Number(event.target.value)))}
|
|
47
|
+
className="w-20 text-center"
|
|
48
|
+
/>
|
|
49
|
+
<Button
|
|
50
|
+
variant="outline"
|
|
51
|
+
size="icon-xs"
|
|
52
|
+
aria-label={t.increase}
|
|
53
|
+
onClick={() => onChange?.(clamp(value + step))}
|
|
54
|
+
>
|
|
55
|
+
<Plus />
|
|
56
|
+
</Button>
|
|
57
|
+
</div>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
import { Eye, EyeOff } from 'lucide-react'
|
|
4
|
+
|
|
5
|
+
import { Button } from '@mohou/ui/components/button'
|
|
6
|
+
import {
|
|
7
|
+
InputGroup,
|
|
8
|
+
InputGroupAddon,
|
|
9
|
+
InputGroupInput,
|
|
10
|
+
} from '@mohou/ui/components/input-group'
|
|
11
|
+
import { useLabels } from '@mohou/ui/i18n/context'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Secret input with reveal toggle.
|
|
15
|
+
* @when Typing a token/password into your own state. **Never** persist it to storage.
|
|
16
|
+
* @example
|
|
17
|
+
* <PasswordField value={p} onChange={(v) => set(v)} />
|
|
18
|
+
* @family Form
|
|
19
|
+
*/
|
|
20
|
+
export function PasswordField({
|
|
21
|
+
value,
|
|
22
|
+
onChange,
|
|
23
|
+
}: {
|
|
24
|
+
value?: string
|
|
25
|
+
onChange?: (value: string) => void
|
|
26
|
+
}) {
|
|
27
|
+
const t = useLabels('passwordField')
|
|
28
|
+
const [visible, setVisible] = React.useState(false)
|
|
29
|
+
return (
|
|
30
|
+
<InputGroup data-testid="password-field">
|
|
31
|
+
<InputGroupInput
|
|
32
|
+
type={visible ? 'text' : 'password'}
|
|
33
|
+
value={value ?? ''}
|
|
34
|
+
onChange={event => onChange?.(event.target.value)}
|
|
35
|
+
autoComplete="current-password"
|
|
36
|
+
/>
|
|
37
|
+
<InputGroupAddon align="inline-end">
|
|
38
|
+
<Button
|
|
39
|
+
variant="ghost"
|
|
40
|
+
size="icon-xs"
|
|
41
|
+
type="button"
|
|
42
|
+
aria-label={visible ? t.hide : t.show}
|
|
43
|
+
onClick={() => setVisible(v => !v)}
|
|
44
|
+
>
|
|
45
|
+
{visible ? <EyeOff /> : <Eye />}
|
|
46
|
+
</Button>
|
|
47
|
+
</InputGroupAddon>
|
|
48
|
+
</InputGroup>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
import { Input } from '@mohou/ui/components/input'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Phone number input with formatting.
|
|
6
|
+
* @when CN/mobile numbers.
|
|
7
|
+
* @example
|
|
8
|
+
* <PhoneInput value={t} onChange={(v) => set(v)} />
|
|
9
|
+
* @family Form
|
|
10
|
+
*/
|
|
11
|
+
export function PhoneInput({
|
|
12
|
+
value,
|
|
13
|
+
onChange,
|
|
14
|
+
}: {
|
|
15
|
+
value?: string
|
|
16
|
+
onChange?: (value: string) => void
|
|
17
|
+
}) {
|
|
18
|
+
return (
|
|
19
|
+
<Input
|
|
20
|
+
data-testid="phone-input"
|
|
21
|
+
type="tel"
|
|
22
|
+
inputMode="tel"
|
|
23
|
+
placeholder="+86 138 0000 0000"
|
|
24
|
+
value={value ?? ''}
|
|
25
|
+
onChange={event => onChange?.(event.target.value)}
|
|
26
|
+
/>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
import { Star } from 'lucide-react'
|
|
3
|
+
|
|
4
|
+
import { cn } from '@mohou/ui/lib/utils'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Star rating.
|
|
8
|
+
* @when Feedback/score capture, 1–max.
|
|
9
|
+
* @example
|
|
10
|
+
* <Rating value={r} onChange={(v) => set(v)} />
|
|
11
|
+
* @family Form
|
|
12
|
+
*/
|
|
13
|
+
export function Rating({
|
|
14
|
+
value = 0,
|
|
15
|
+
onChange,
|
|
16
|
+
max = 5,
|
|
17
|
+
}: {
|
|
18
|
+
value?: number
|
|
19
|
+
onChange?: (value: number) => void
|
|
20
|
+
max?: number
|
|
21
|
+
}) {
|
|
22
|
+
return (
|
|
23
|
+
<div className="flex items-center gap-0.5" data-testid="rating">
|
|
24
|
+
{Array.from({ length: max }, (_, index) => {
|
|
25
|
+
const score = index + 1
|
|
26
|
+
return (
|
|
27
|
+
<button
|
|
28
|
+
key={score}
|
|
29
|
+
type="button"
|
|
30
|
+
aria-label={`${score} star`}
|
|
31
|
+
onClick={() => onChange?.(score)}
|
|
32
|
+
className="text-muted-foreground hover:text-foreground"
|
|
33
|
+
>
|
|
34
|
+
<Star
|
|
35
|
+
className={cn(
|
|
36
|
+
'size-4',
|
|
37
|
+
score <= value && 'fill-amber-400 text-amber-400'
|
|
38
|
+
)}
|
|
39
|
+
/>
|
|
40
|
+
</button>
|
|
41
|
+
)
|
|
42
|
+
})}
|
|
43
|
+
</div>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
|
|
2
|
+
import { subDays } from 'date-fns'
|
|
3
|
+
import type { DateRange } from 'react-day-picker'
|
|
4
|
+
|
|
5
|
+
import { Button } from '@mohou/ui/components/button'
|
|
6
|
+
import { DateRangePicker } from '@mohou/ui/composites/date-range-picker'
|
|
7
|
+
import { useLabels } from '@mohou/ui/i18n/context'
|
|
8
|
+
|
|
9
|
+
export type RelativePreset = 'today' | '7d' | '30d' | 'sprint' | 'custom'
|
|
10
|
+
|
|
11
|
+
function rangeFor(id: RelativePreset): DateRange | undefined {
|
|
12
|
+
const now = new Date()
|
|
13
|
+
if (id === 'today') return { from: now, to: now }
|
|
14
|
+
if (id === '7d') return { from: subDays(now, 6), to: now }
|
|
15
|
+
if (id === '30d') return { from: subDays(now, 29), to: now }
|
|
16
|
+
if (id === 'sprint') return { from: subDays(now, 13), to: now }
|
|
17
|
+
return undefined
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Preset ranges (today / last 7 days) → a concrete date range.
|
|
22
|
+
* @when Dashboard filters where “last 7 days” beats two calendars.
|
|
23
|
+
* @example
|
|
24
|
+
* <RelativeDatePicker onChange={(range, preset) => set(range)} />
|
|
25
|
+
* @family Calendar & date
|
|
26
|
+
*/
|
|
27
|
+
export function RelativeDatePicker({
|
|
28
|
+
preset = '7d',
|
|
29
|
+
value,
|
|
30
|
+
onPresetChange,
|
|
31
|
+
onChange,
|
|
32
|
+
}: {
|
|
33
|
+
preset?: RelativePreset | undefined
|
|
34
|
+
value?: DateRange | undefined
|
|
35
|
+
onPresetChange?: (preset: RelativePreset) => void
|
|
36
|
+
onChange?: ((range: DateRange | undefined) => void) | undefined
|
|
37
|
+
}) {
|
|
38
|
+
const t = useLabels('relativeDate')
|
|
39
|
+
const presets: { id: RelativePreset; label: string }[] = [
|
|
40
|
+
{ id: 'today', label: t.today },
|
|
41
|
+
{ id: '7d', label: t.last7d },
|
|
42
|
+
{ id: '30d', label: t.last30d },
|
|
43
|
+
{ id: 'sprint', label: t.sprint },
|
|
44
|
+
{ id: 'custom', label: t.custom },
|
|
45
|
+
]
|
|
46
|
+
return (
|
|
47
|
+
<div className="flex flex-col gap-2" data-testid="relative-date-picker">
|
|
48
|
+
<div className="flex flex-wrap gap-1">
|
|
49
|
+
{presets.map(item => (
|
|
50
|
+
<Button
|
|
51
|
+
key={item.id}
|
|
52
|
+
size="sm"
|
|
53
|
+
variant={preset === item.id ? 'default' : 'outline'}
|
|
54
|
+
onClick={() => {
|
|
55
|
+
onPresetChange?.(item.id)
|
|
56
|
+
if (item.id !== 'custom') onChange?.(rangeFor(item.id))
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
{item.label}
|
|
60
|
+
</Button>
|
|
61
|
+
))}
|
|
62
|
+
</div>
|
|
63
|
+
{preset === 'custom' ? (
|
|
64
|
+
<DateRangePicker value={value} onChange={onChange} />
|
|
65
|
+
) : null}
|
|
66
|
+
</div>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
import { Search } from 'lucide-react'
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
InputGroup,
|
|
7
|
+
InputGroupAddon,
|
|
8
|
+
InputGroupInput,
|
|
9
|
+
} from '@mohou/ui/components/input-group'
|
|
10
|
+
import { useLabels } from '@mohou/ui/i18n/context'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Search box with debounce.
|
|
14
|
+
* @when Filter-as-you-type against `DataGrid`/lists — use `onDebouncedChange` for network calls.
|
|
15
|
+
* @example
|
|
16
|
+
* <SearchInput onDebouncedChange={(q) => call("list", { q })} />
|
|
17
|
+
* @family Form
|
|
18
|
+
*/
|
|
19
|
+
export function SearchInput({
|
|
20
|
+
value,
|
|
21
|
+
onChange,
|
|
22
|
+
onDebouncedChange,
|
|
23
|
+
delay = 250,
|
|
24
|
+
placeholder,
|
|
25
|
+
}: {
|
|
26
|
+
value?: string
|
|
27
|
+
onChange?: (value: string) => void
|
|
28
|
+
onDebouncedChange?: (value: string) => void
|
|
29
|
+
delay?: number
|
|
30
|
+
placeholder?: string
|
|
31
|
+
}) {
|
|
32
|
+
const t = useLabels('searchInput')
|
|
33
|
+
const [inner, setInner] = React.useState(value ?? '')
|
|
34
|
+
React.useEffect(() => setInner(value ?? ''), [value])
|
|
35
|
+
React.useEffect(() => {
|
|
36
|
+
const id = window.setTimeout(() => onDebouncedChange?.(inner), delay)
|
|
37
|
+
return () => window.clearTimeout(id)
|
|
38
|
+
}, [inner, delay, onDebouncedChange])
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<InputGroup className="max-w-sm" data-testid="search-input">
|
|
42
|
+
<InputGroupAddon>
|
|
43
|
+
<Search className="size-3.5" />
|
|
44
|
+
</InputGroupAddon>
|
|
45
|
+
<InputGroupInput
|
|
46
|
+
value={inner}
|
|
47
|
+
placeholder={placeholder ?? t.placeholder}
|
|
48
|
+
onChange={(event) => {
|
|
49
|
+
setInner(event.target.value)
|
|
50
|
+
onChange?.(event.target.value)
|
|
51
|
+
}}
|
|
52
|
+
/>
|
|
53
|
+
</InputGroup>
|
|
54
|
+
)
|
|
55
|
+
}
|