@zenify-omni/chat-ui-react-js 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +92 -0
- package/assets/asset-url.js +6 -0
- package/assets/icons/chatter_agent.js +27 -0
- package/assets/icons/chatter_chatbot.js +43 -0
- package/assets/icons/chatter_contact.js +36 -0
- package/assets/icons/email_icon.png +0 -0
- package/assets/icons/emoji/angry.svg +56 -0
- package/assets/icons/emoji/haha.svg +20 -0
- package/assets/icons/emoji/like.svg +10 -0
- package/assets/icons/emoji/like_out_line.png +0 -0
- package/assets/icons/emoji/love.svg +10 -0
- package/assets/icons/emoji/sad.svg +46 -0
- package/assets/icons/emoji/wow.svg +51 -0
- package/assets/icons/instagram.js +29 -0
- package/assets/icons/not_found.png +0 -0
- package/assets/icons/not_found_template.svg +9 -0
- package/assets/icons/phone_icon.png +0 -0
- package/assets/icons/shopee.js +17 -0
- package/assets/icons/sms_icon.png +0 -0
- package/assets/icons/tiktok.js +17 -0
- package/assets/icons/whatsapp.js +28 -0
- package/assets/icons/zalo.js +17 -0
- package/assets/icons/zalo_icon.png +0 -0
- package/assets/icons/zns_icon.png +0 -0
- package/assets/images/emoji.webp +0 -0
- package/assets/images/error.png +0 -0
- package/assets/images/menu.png +0 -0
- package/assets/images/money.png +0 -0
- package/assets/images/success.png +0 -0
- package/assets/public-urls.js +78 -0
- package/components/campaign-detail-route/select/group.js +38 -0
- package/components/campaign-detail-route/select/multi-groups.js +43 -0
- package/components/chat-route/chat-box/ads-context-card.js +143 -0
- package/components/chat-route/chat-box/chat-drop-file.js +18 -0
- package/components/chat-route/chat-box/chat-feedback/chat-insight.js +214 -0
- package/components/chat-route/chat-box/chat-feedback/index.js +127 -0
- package/components/chat-route/chat-box/chat-header-actions-inline.js +1055 -0
- package/components/chat-route/chat-box/chat-header.js +465 -0
- package/components/chat-route/chat-box/chat-input.js +1164 -0
- package/components/chat-route/chat-box/chat-message-action.js +399 -0
- package/components/chat-route/chat-box/chat-message-list.js +995 -0
- package/components/chat-route/chat-box/chat-message.js +2099 -0
- package/components/chat-route/chat-box/chat-reply-preview.js +317 -0
- package/components/chat-route/chat-box/common-groups-modal.js +430 -0
- package/components/chat-route/chat-box/constants.js +29 -0
- package/components/chat-route/chat-box/contact-card/index.js +87 -0
- package/components/chat-route/chat-box/edit-customer-alias-dialog.js +197 -0
- package/components/chat-route/chat-box/emoji-picker-combined.js +91 -0
- package/components/chat-route/chat-box/emoji-sprite.js +45 -0
- package/components/chat-route/chat-box/emojiMap.js +92 -0
- package/components/chat-route/chat-box/facebook-reconnect-notice.js +49 -0
- package/components/chat-route/chat-box/forward-message-modal.js +659 -0
- package/components/chat-route/chat-box/index.js +165 -0
- package/components/chat-route/chat-box/message-time.js +44 -0
- package/components/chat-route/chat-box/message-viewers.js +114 -0
- package/components/chat-route/chat-box/pasted-file-preview.js +138 -0
- package/components/chat-route/chat-box/pinned-messages.js +255 -0
- package/components/chat-route/chat-box/react-message/react-preview.js +83 -0
- package/components/chat-route/chat-box/react-message/reaction-button.js +200 -0
- package/components/chat-route/chat-box/right-side/chat-history.js +142 -0
- package/components/chat-route/chat-box/right-side/chat-tag-selector.js +232 -0
- package/components/chat-route/chat-box/right-side/create-personal-tag-modal.js +458 -0
- package/components/chat-route/chat-box/right-side/customer/customer-info-item.js +60 -0
- package/components/chat-route/chat-box/right-side/in-room-dialog.js +225 -0
- package/components/chat-route/chat-box/right-side/zalo-group/add-friend-dialog.js +154 -0
- package/components/chat-route/chat-box/right-side/zalo-group/send-message-dialog.js +165 -0
- package/components/chat-route/chat-box/send-contact-card-modal.js +102 -0
- package/components/chat-route/chat-box/send-contact-card.js +80 -0
- package/components/chat-route/chat-box/text-content.js +400 -0
- package/components/chat-route/chat-box/use-facebook-page-invalid.js +22 -0
- package/components/chat-route/chat-box/zalo-emoji-decoration.js +98 -0
- package/components/chat-route/chat-box/zalo-emoji-picker.js +74 -0
- package/components/chat-route/chat-box/zalo-personal-editor.js +590 -0
- package/components/chat-route/chat-box/zalo-reminder/create-zalo-reminder.js +868 -0
- package/components/chat-route/chat-box/zalo-reminder/use-send-zalo-reminder.js +98 -0
- package/components/chat-route/chat-box/zalo-reminder/zalo-reminder-content.js +294 -0
- package/components/chat-route/chat-box/zalo-rtf-utils.js +422 -0
- package/components/chat-route/chat-list/action-chat-item.js +116 -0
- package/components/chat-route/chat-list/assign-agent-dialog.js +170 -0
- package/components/chat-route/chat-list/assign-tag-dialog.js +242 -0
- package/components/chat-route/chat-list/chat-item-tags.js +105 -0
- package/components/chat-route/chat-list/chat-item.js +749 -0
- package/components/chat-route/chat-list/chat-list-item.js +370 -0
- package/components/chat-route/chat-list/chat-list-selection-bar.js +426 -0
- package/components/chat-route/chat-list/chat-search-preview.js +48 -0
- package/components/chat-route/chat-list/chat-sort-menu.js +89 -0
- package/components/chat-route/chat-list/edit-filter-modal.js +468 -0
- package/components/chat-route/chat-list/filter-chat-sources.js +222 -0
- package/components/chat-route/chat-list/filter-chat.js +501 -0
- package/components/chat-route/chat-list/filter-criteria-rows.js +845 -0
- package/components/chat-route/chat-list/filter-group-select.js +66 -0
- package/components/chat-route/chat-list/filter-pin-menu.js +165 -0
- package/components/chat-route/chat-list/friend-request/list-friend-request.js +287 -0
- package/components/chat-route/chat-list/index.js +243 -0
- package/components/chat-route/chat-list/inline-search-results.js +178 -0
- package/components/chat-route/chat-list/post-ids-field.js +104 -0
- package/components/chat-route/chat-list/quick-filter-bar.js +391 -0
- package/components/chat-route/chat-list/save-filter-popover.js +258 -0
- package/components/chat-route/chat-list/search-messages/index.js +225 -0
- package/components/chat-route/chat-list/search-result-header.js +51 -0
- package/components/chat-route/chat-list/util.js +604 -0
- package/components/chat-route/chat-toolbar.js +108 -0
- package/components/chat-route/hooks/use-reassign.js +111 -0
- package/components/chat-route/shared/close-conversation-dialog.js +111 -0
- package/components/chat-route/shared/force-transfer-dialog.js +109 -0
- package/components/chat-route/shared/in-queue-confirm-dialog.js +40 -0
- package/components/chat-route/util.js +146 -0
- package/components/chat-route/zalo/modal-action-zalo.js +76 -0
- package/components/chat-route/zalo/modal-add-friend-zalo.js +277 -0
- package/components/custom/SafeHTML.js +45 -0
- package/components/custom/audio-player.js +81 -0
- package/components/custom/avatar.js +95 -0
- package/components/custom/between-date-picker/index.js +86 -0
- package/components/custom/button-close.js +28 -0
- package/components/custom/button.js +80 -0
- package/components/custom/color-picker.js +81 -0
- package/components/custom/combobox.js +168 -0
- package/components/custom/custom-dialog.js +44 -0
- package/components/custom/custom-select.js +256 -0
- package/components/custom/cycle-value-helpers.js +11 -0
- package/components/custom/cycle-value.js +93 -0
- package/components/custom/date-time-picker/components/date-time-group.js +44 -0
- package/components/custom/date-time-picker/components/date-time-input.js +383 -0
- package/components/custom/date-time-picker/components/date-time-unit-input.js +138 -0
- package/components/custom/date-time-picker/components/month-year-picker.js +232 -0
- package/components/custom/date-time-picker/hooks/use-merge-refs.js +18 -0
- package/components/custom/date-time-picker/hooks/use-scroll-to-center.js +18 -0
- package/components/custom/date-time-picker/index.js +348 -0
- package/components/custom/field-file-upload/files-upload.js +87 -0
- package/components/custom/field-file-upload/image-upload.js +115 -0
- package/components/custom/field-file-upload/preview-images-modal.js +284 -0
- package/components/custom/field-file-upload/preview-list-file.js +134 -0
- package/components/custom/field-file-upload/preview-list-image.js +108 -0
- package/components/custom/field-file-upload/upload-custom.js +222 -0
- package/components/custom/field-generator.js +639 -0
- package/components/custom/field-layout-popover.js +304 -0
- package/components/custom/file-preview-modal.js +351 -0
- package/components/custom/html-edtior.js +100 -0
- package/components/custom/icon.js +49 -0
- package/components/custom/infinite-scroll-combobox.js +253 -0
- package/components/custom/inline-edit-popover.js +90 -0
- package/components/custom/inputs/calendar-input.js +0 -0
- package/components/custom/inputs/chip-input.js +136 -0
- package/components/custom/inputs/file-input.js +71 -0
- package/components/custom/inputs/mask-data/mask-data-input.js +80 -0
- package/components/custom/inputs/mask-data/mask-data-select.js +78 -0
- package/components/custom/inputs/mask-data/mask-data-textarea.js +75 -0
- package/components/custom/inputs/mask-data/reconcile-masked-edit.js +20 -0
- package/components/custom/jxl-decode.js +34 -0
- package/components/custom/jxl-image.js +68 -0
- package/components/custom/jxl-worker.js +12 -0
- package/components/custom/label.js +55 -0
- package/components/custom/layout.js +30 -0
- package/components/custom/multi-select-search-cc.js +179 -0
- package/components/custom/multiple-select-setting-tags.js +404 -0
- package/components/custom/multiple-selector.js +821 -0
- package/components/custom/pagination.js +95 -0
- package/components/custom/popup-confirm.js +120 -0
- package/components/custom/previews/facebook/facebook-appointment-booking-preview.js +83 -0
- package/components/custom/previews/facebook/facebook-audio-preview.js +130 -0
- package/components/custom/previews/facebook/facebook-event-preview.js +72 -0
- package/components/custom/previews/facebook/facebook-file-preview.js +95 -0
- package/components/custom/previews/facebook/facebook-group-preview.js +103 -0
- package/components/custom/previews/facebook/facebook-image-preview.js +81 -0
- package/components/custom/previews/facebook/facebook-page-preview.js +85 -0
- package/components/custom/previews/facebook/facebook-post-preview.js +77 -0
- package/components/custom/previews/facebook/facebook-reel-preview.js +83 -0
- package/components/custom/previews/facebook/facebook-sticker-preview.js +23 -0
- package/components/custom/previews/facebook/facebook-video-preview.js +114 -0
- package/components/custom/previews/facebook/index.js +24 -0
- package/components/custom/previews/file-preview.js +747 -0
- package/components/custom/previews/image-preview.js +288 -0
- package/components/custom/previews/instagram/index.js +4 -0
- package/components/custom/previews/instagram/instagram-share-post-preview.js +77 -0
- package/components/custom/previews/link-preview.js +166 -0
- package/components/custom/previews/product-preview.js +334 -0
- package/components/custom/previews/tiktok-order-preview.js +278 -0
- package/components/custom/previews/tiktok-product-preview.js +321 -0
- package/components/custom/previews/tiktok-voucher-preview.js +151 -0
- package/components/custom/previews/whatsapp/index.js +10 -0
- package/components/custom/previews/whatsapp/whatsapp-contact-card-preview.js +150 -0
- package/components/custom/previews/whatsapp/whatsapp-order-preview.js +38 -0
- package/components/custom/previews/whatsapp/whatsapp-poll-preview.js +29 -0
- package/components/custom/previews/whatsapp/whatsapp-product-preview.js +29 -0
- package/components/custom/retry-image.js +44 -0
- package/components/custom/search-input.js +26 -0
- package/components/custom/separator-with-text.js +14 -0
- package/components/custom/showToast.js +21 -0
- package/components/custom/sortable-header.js +62 -0
- package/components/custom/table-resize-line.js +92 -0
- package/components/custom/time-picker/index.js +73 -0
- package/components/custom/time-picker/time-picker-input.js +159 -0
- package/components/custom/time-picker/time-picker-utils.js +152 -0
- package/components/custom/viewers/audio-player.js +192 -0
- package/components/custom/viewers/code-viewer.js +140 -0
- package/components/custom/viewers/csv-viewer.js +174 -0
- package/components/custom/viewers/docx-viewer.js +145 -0
- package/components/custom/viewers/image-viewer.js +104 -0
- package/components/custom/viewers/markdown-viewer.js +124 -0
- package/components/custom/viewers/pdf-viewer.js +333 -0
- package/components/custom/viewers/spreadsheet-viewer.js +232 -0
- package/components/custom/viewers/unsupported-viewer.js +85 -0
- package/components/custom/viewers/video-player.js +241 -0
- package/components/customers-route/change-owner-modal.js +430 -0
- package/components/customers-route/contact-note-button.js +212 -0
- package/components/customers-route/customer-source.js +37 -0
- package/components/customers-route/table/columns.js +675 -0
- package/components/customers-route/table/edit-fields.js +125 -0
- package/components/customers-route/table/editable-cell.js +218 -0
- package/components/customers-route/table/note-cell.js +77 -0
- package/components/dialogs/invite-agent.js +677 -0
- package/components/error-boundary.js +53 -0
- package/components/leads-route/duplicate-phone-warning-toast.js +96 -0
- package/components/leads-route/table/columns.js +523 -0
- package/components/leads-route/table/contact-cell-name.js +82 -0
- package/components/leads-route/table/edit-fields.js +142 -0
- package/components/leads-route/table/editable-cell.js +228 -0
- package/components/org-tree/group-name-display.js +36 -0
- package/components/org-tree/group-tree-multi-select.js +208 -0
- package/components/org-tree/group-tree-select.js +220 -0
- package/components/posts-route/dialog-select-posts.js +284 -0
- package/components/reports-route/agents/multi-select-agents.js +55 -0
- package/components/reports-route/agents/multi-select-search-agents.js +43 -0
- package/components/settings-route/chat-layout/detail/constants.js +353 -0
- package/components/settings-route/chat-layout/detail/form.js +43 -0
- package/components/settings-route/chat-timeout/channel-multi-select.js +119 -0
- package/components/settings-route/multi-channel/facebook/hooks/use-facebook-sdk.js +3 -0
- package/components/settings-route/object-rule/util.js +79 -0
- package/components/settings-route/routing/settings-dialog.js +561 -0
- package/components/settings-route/switchboard/queue-new/constant.js +9 -0
- package/components/shared/linked-customer-fields/LinkedCustomerFields.js +91 -0
- package/components/shared/linked-customer-fields/use-linked-customer-fields.js +123 -0
- package/components/smartqc-route/qc-form/controls/multi-select-search-agents.js +50 -0
- package/components/ui/alert-dialog.js +112 -0
- package/components/ui/avatar.js +44 -0
- package/components/ui/badge.js +54 -0
- package/components/ui/button.js +48 -0
- package/components/ui/calendar.js +70 -0
- package/components/ui/card.js +58 -0
- package/components/ui/carousel.js +238 -0
- package/components/ui/checkbox.js +27 -0
- package/components/ui/command.js +111 -0
- package/components/ui/context-menu.js +154 -0
- package/components/ui/dialog.js +104 -0
- package/components/ui/dropdown-menu.js +169 -0
- package/components/ui/form.js +104 -0
- package/components/ui/input.js +115 -0
- package/components/ui/label.js +20 -0
- package/components/ui/popover.js +29 -0
- package/components/ui/radio-group.js +53 -0
- package/components/ui/scroll-area.js +38 -0
- package/components/ui/select.js +147 -0
- package/components/ui/separator.js +24 -0
- package/components/ui/sheet.js +113 -0
- package/components/ui/skeleton.js +17 -0
- package/components/ui/slider.js +26 -0
- package/components/ui/sonner.js +76 -0
- package/components/ui/switch.js +54 -0
- package/components/ui/table-v2.js +269 -0
- package/components/ui/table.js +245 -0
- package/components/ui/tabs.js +89 -0
- package/components/ui/textarea.js +33 -0
- package/components/ui/tooltip.js +40 -0
- package/components/workflow-editor/nodes/ticket/picker-field.js +233 -0
- package/components/zalo-login-qr.js +237 -0
- package/components/zalo-login-status-modal.js +45 -0
- package/config/env.js +27 -0
- package/config/hmr.js +8 -0
- package/config/navigation.js +54 -0
- package/config/runtime.js +46 -0
- package/config/theme.js +274 -0
- package/constants/brand-colors.js +32 -0
- package/constants/chat-icon.js +34 -0
- package/dist/chat.css +1 -0
- package/exceptions/throw-exception.js +15 -0
- package/hooks/use-chat-attachments.js +106 -0
- package/hooks/use-chat-configs.js +62 -0
- package/hooks/use-chat-customer.js +33 -0
- package/hooks/use-chat-display-config-sync.js +72 -0
- package/hooks/use-chat-permission.js +68 -0
- package/hooks/use-chat-room-detail.js +44 -0
- package/hooks/use-chat-selection.js +26 -0
- package/hooks/use-chat-sort.js +69 -0
- package/hooks/use-chat-surface.js +8 -0
- package/hooks/use-common-filter-options.js +70 -0
- package/hooks/use-crm-organization-filter-options.js +0 -0
- package/hooks/use-crm-organizations-data.js +23 -0
- package/hooks/use-debounce.js +14 -0
- package/hooks/use-dynamic-fields.js +7 -0
- package/hooks/use-facebook-notice.js +24 -0
- package/hooks/use-feature-flags.js +6 -0
- package/hooks/use-field-layout-override.js +46 -0
- package/hooks/use-file-upload.js +119 -0
- package/hooks/use-file-viewer.js +93 -0
- package/hooks/use-frozen-columns.js +29 -0
- package/hooks/use-horizontal-scroll.js +41 -0
- package/hooks/use-image-preview-queue.js +101 -0
- package/hooks/use-inline-editable-cell.js +97 -0
- package/hooks/use-intersection-observer.js +24 -0
- package/hooks/use-interval.js +20 -0
- package/hooks/use-latest-message-id.js +13 -0
- package/hooks/use-lead-filter-options.js +0 -0
- package/hooks/use-logout-listener.js +43 -0
- package/hooks/use-org-tree.js +43 -0
- package/hooks/use-permission.js +33 -0
- package/hooks/use-quick-filters.js +175 -0
- package/hooks/use-resizable-table.js +0 -0
- package/hooks/use-setting-common.js +389 -0
- package/hooks/use-settings.js +41 -0
- package/hooks/use-sort-bindings.js +24 -0
- package/hooks/use-table-display-config.js +0 -0
- package/hooks/use-tenant-config.js +99 -0
- package/hooks/use-update-user-config.js +150 -0
- package/hooks/use-zalo-connection.js +57 -0
- package/hooks/use-zalo-mention-list.js +31 -0
- package/index.css +624 -0
- package/index.js +100 -0
- package/lib/deal-name.js +27 -0
- package/lib/i18n/react.js +7 -0
- package/lib/i18n/use-language.js +0 -0
- package/lib/query-client.js +34 -0
- package/lib/utils.js +25 -0
- package/package.json +108 -0
- package/provider/chat-context.js +9 -0
- package/provider/chat-provider.js +177 -0
- package/provider/chat-room-context.js +9 -0
- package/provider/chat-room-hooks.js +8 -0
- package/provider/chat-room-provider.js +84 -0
- package/provider/hooks.js +22 -0
- package/provider/index.js +42 -0
- package/public/contact-card-user.svg +25 -0
- package/public/images/icons/facebook.svg +1 -0
- package/public/images/icons/instagram.svg +1 -0
- package/public/images/icons/shopee.svg +1 -0
- package/public/images/icons/whatsapp.svg +1 -0
- package/public/images/icons/zalo.png +0 -0
- package/public/images/images.jpg +0 -0
- package/public/images/ticket_sources/api.png +0 -0
- package/public/images/ticket_sources/email.png +0 -0
- package/public/images/ticket_sources/facebook.png +0 -0
- package/public/images/ticket_sources/hand.png +0 -0
- package/public/images/ticket_sources/instagram.png +0 -0
- package/public/images/ticket_sources/livechat.png +0 -0
- package/public/images/ticket_sources/shopee.svg +1 -0
- package/public/images/ticket_sources/sms.png +0 -0
- package/public/images/ticket_sources/telephone-call-in.png +0 -0
- package/public/images/ticket_sources/telephone-call-out.png +0 -0
- package/public/images/ticket_sources/tiktok.png +0 -0
- package/public/images/ticket_sources/tiktok_shop.png +0 -0
- package/public/images/ticket_sources/whatsapp.png +0 -0
- package/public/images/ticket_sources/whatsapp.svg +1 -0
- package/public/images/ticket_sources/zalo.png +0 -0
- package/public/placeholder.svg +13 -0
- package/store/app-status-store.js +17 -0
- package/store/chat-display-config-store.js +182 -0
- package/store/chat-display-config.resolvers.js +88 -0
- package/store/chat-store-helpers.js +62 -0
- package/store/chat-store.js +931 -0
- package/store/crm-organization-list-filter-store.js +126 -0
- package/store/customer-list-filter-store.js +139 -0
- package/store/devtools.js +9 -0
- package/store/duplicate-phone-warning-store.js +18 -0
- package/store/entity-extract-store.js +72 -0
- package/store/file-preview-store.js +27 -0
- package/store/filter-store.js +289 -0
- package/store/index.js +22 -0
- package/store/knowledge-crawl-store.js +53 -0
- package/store/lead-list-filter-store.js +142 -0
- package/store/list-pagination-state.js +44 -0
- package/store/lumi-learn-from-chat-store.js +69 -0
- package/store/merge-suggestion-store.js +27 -0
- package/store/notification-store.js +63 -0
- package/store/preview-image-store.js +22 -0
- package/store/settings-store/multi-channel/email-list-store.js +20 -0
- package/store/settings-store/multi-channel/facebook-list-store.js +22 -0
- package/store/settings-store/multi-channel/google-list-store.js +20 -0
- package/store/settings-store/multi-channel/instagram-list-store.js +20 -0
- package/store/settings-store/multi-channel/misa-list-store.js +20 -0
- package/store/settings-store/multi-channel/nhanhvn-list-store.js +20 -0
- package/store/settings-store/multi-channel/shopee-list-store.js +20 -0
- package/store/settings-store/multi-channel/shopee-order-list-store.js +20 -0
- package/store/settings-store/multi-channel/sms-list-store.js +20 -0
- package/store/settings-store/multi-channel/tiktok-business-list-store.js +20 -0
- package/store/settings-store/multi-channel/tiktok-list-store.js +20 -0
- package/store/settings-store/multi-channel/zalo-list-store.js +22 -0
- package/store/settings-store/multi-channel/zalo-user-list-store.js +25 -0
- package/store/smart-qc-store/smart-qc-list-filter-store.js +70 -0
- package/store/tenant-config-store.js +21 -0
- package/store/user-detail-store.js +17 -0
- package/store/user-status-store.js +33 -0
- package/store/workflow-store.js +24 -0
- package/store/workspace-store.js +32 -0
- package/tailwind-preset.js +129 -0
- package/utils/chat-actions.js +414 -0
- package/utils/chat_socket.js +1225 -0
- package/utils/extra-columns.js +108 -0
- package/utils/file.js +316 -0
- package/utils/html-to-plain-text.js +12 -0
- package/utils/notification.js +71 -0
- package/utils/replaceZaloSprite.js +64 -0
- package/utils/show-be-error.js +17 -0
- package/utils/typing_socket.js +101 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import {
|
|
4
|
+
Select,
|
|
5
|
+
SelectContent,
|
|
6
|
+
SelectItem,
|
|
7
|
+
SelectTrigger,
|
|
8
|
+
SelectValue
|
|
9
|
+
} from "./select.js";
|
|
10
|
+
import {
|
|
11
|
+
ChevronLeftIcon,
|
|
12
|
+
ChevronRightIcon,
|
|
13
|
+
DoubleArrowLeftIcon,
|
|
14
|
+
DoubleArrowRightIcon
|
|
15
|
+
} from "@radix-ui/react-icons";
|
|
16
|
+
import { Button } from "../custom/button.js";
|
|
17
|
+
import { cn } from "../../lib/utils.js";
|
|
18
|
+
import { useTranslation } from "react-i18next";
|
|
19
|
+
const Table = React.forwardRef(
|
|
20
|
+
({ className, containerClassName, scrollContainerRef, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
21
|
+
"div",
|
|
22
|
+
{
|
|
23
|
+
className: cn(
|
|
24
|
+
"relative w-full overflow-auto",
|
|
25
|
+
className,
|
|
26
|
+
containerClassName
|
|
27
|
+
),
|
|
28
|
+
ref: scrollContainerRef,
|
|
29
|
+
children: /* @__PURE__ */ jsx(
|
|
30
|
+
"table",
|
|
31
|
+
{
|
|
32
|
+
ref,
|
|
33
|
+
className: cn("w-full caption-bottom text-sm", className),
|
|
34
|
+
...props
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
);
|
|
40
|
+
Table.displayName = "Table";
|
|
41
|
+
const TableHeader = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
|
|
42
|
+
TableHeader.displayName = "TableHeader";
|
|
43
|
+
const TableBody = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
44
|
+
"tbody",
|
|
45
|
+
{
|
|
46
|
+
ref,
|
|
47
|
+
className: cn("[&_tr:last-child]:border-0", className),
|
|
48
|
+
...props
|
|
49
|
+
}
|
|
50
|
+
));
|
|
51
|
+
TableBody.displayName = "TableBody";
|
|
52
|
+
const TableFooter = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
53
|
+
"tfoot",
|
|
54
|
+
{
|
|
55
|
+
ref,
|
|
56
|
+
className: cn(
|
|
57
|
+
"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
|
|
58
|
+
className
|
|
59
|
+
),
|
|
60
|
+
...props
|
|
61
|
+
}
|
|
62
|
+
));
|
|
63
|
+
TableFooter.displayName = "TableFooter";
|
|
64
|
+
const TableRow = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
65
|
+
"tr",
|
|
66
|
+
{
|
|
67
|
+
ref,
|
|
68
|
+
className: cn(
|
|
69
|
+
"border-b transition-colors hover:bg-accent data-[state=selected]:bg-muted",
|
|
70
|
+
className
|
|
71
|
+
),
|
|
72
|
+
...props
|
|
73
|
+
}
|
|
74
|
+
));
|
|
75
|
+
TableRow.displayName = "TableRow";
|
|
76
|
+
const TableHead = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
77
|
+
"th",
|
|
78
|
+
{
|
|
79
|
+
ref,
|
|
80
|
+
className: cn(
|
|
81
|
+
"h-10 px-2 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
82
|
+
className
|
|
83
|
+
),
|
|
84
|
+
...props
|
|
85
|
+
}
|
|
86
|
+
));
|
|
87
|
+
TableHead.displayName = "TableHead";
|
|
88
|
+
const TableCell = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
89
|
+
"td",
|
|
90
|
+
{
|
|
91
|
+
ref,
|
|
92
|
+
className: cn(
|
|
93
|
+
"w-auto whitespace-nowrap p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
94
|
+
className
|
|
95
|
+
),
|
|
96
|
+
...props
|
|
97
|
+
}
|
|
98
|
+
));
|
|
99
|
+
TableCell.displayName = "TableCell";
|
|
100
|
+
const TableCaption = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
101
|
+
"caption",
|
|
102
|
+
{
|
|
103
|
+
ref,
|
|
104
|
+
className: cn("mt-4 text-sm text-muted-foreground", className),
|
|
105
|
+
...props
|
|
106
|
+
}
|
|
107
|
+
));
|
|
108
|
+
TableCaption.displayName = "TableCaption";
|
|
109
|
+
const Pagination = ({
|
|
110
|
+
className,
|
|
111
|
+
totalRecords,
|
|
112
|
+
page,
|
|
113
|
+
pageSize,
|
|
114
|
+
setPage,
|
|
115
|
+
setPageSize,
|
|
116
|
+
allowPageInput = false,
|
|
117
|
+
pageSizeOptions = [10, 20, 30, 40, 50, 100]
|
|
118
|
+
}) => {
|
|
119
|
+
const { t } = useTranslation();
|
|
120
|
+
const pageCount = Math.ceil(totalRecords / pageSize) || 1;
|
|
121
|
+
const [inputPage, setInputPage] = React.useState(String(page));
|
|
122
|
+
React.useEffect(() => {
|
|
123
|
+
setInputPage(String(page));
|
|
124
|
+
}, [page]);
|
|
125
|
+
const handlePageInputCommit = () => {
|
|
126
|
+
const num = parseInt(inputPage, 10);
|
|
127
|
+
if (!num || num < 1 || num > pageCount || num === page) {
|
|
128
|
+
setInputPage(String(page));
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
setPage(num);
|
|
132
|
+
};
|
|
133
|
+
return /* @__PURE__ */ jsxs(
|
|
134
|
+
"div",
|
|
135
|
+
{
|
|
136
|
+
className: cn(
|
|
137
|
+
"mt-4 flex items-center justify-between overflow-auto px-2",
|
|
138
|
+
className
|
|
139
|
+
),
|
|
140
|
+
children: [
|
|
141
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
142
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: t("common:label.show", { defaultValue: "Hi\u1EC3n th\u1ECB" }) }),
|
|
143
|
+
/* @__PURE__ */ jsxs(
|
|
144
|
+
Select,
|
|
145
|
+
{
|
|
146
|
+
value: `${pageSize}`,
|
|
147
|
+
onValueChange: (value) => {
|
|
148
|
+
setPageSize(Number(value));
|
|
149
|
+
},
|
|
150
|
+
children: [
|
|
151
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 w-[70px]", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: pageSize }) }),
|
|
152
|
+
/* @__PURE__ */ jsx(SelectContent, { side: "top", children: pageSizeOptions.map((size) => /* @__PURE__ */ jsx(SelectItem, { value: `${size}`, children: size }, size)) })
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
),
|
|
156
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: t("common:table.ofTotalRecords", { totalRecords }) })
|
|
157
|
+
] }),
|
|
158
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-6 p-1", children: [
|
|
159
|
+
allowPageInput ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-1 text-sm font-medium", children: [
|
|
160
|
+
/* @__PURE__ */ jsx("span", { children: t("common:label.page") }),
|
|
161
|
+
/* @__PURE__ */ jsx(
|
|
162
|
+
"input",
|
|
163
|
+
{
|
|
164
|
+
type: "text",
|
|
165
|
+
inputMode: "numeric",
|
|
166
|
+
value: inputPage,
|
|
167
|
+
onChange: (e) => {
|
|
168
|
+
const val = e.target.value;
|
|
169
|
+
if (val === "" || /^[1-9]\d*$/.test(val)) {
|
|
170
|
+
setInputPage(val);
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
onBlur: handlePageInputCommit,
|
|
174
|
+
onKeyDown: (e) => {
|
|
175
|
+
if (e.key === "Enter") {
|
|
176
|
+
handlePageInputCommit();
|
|
177
|
+
e.target.blur();
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
className: "h-8 w-12 rounded-md !border bg-background px-2 text-center text-sm focus:outline-none focus:ring-1 focus:ring-ring"
|
|
181
|
+
}
|
|
182
|
+
),
|
|
183
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
184
|
+
"/ ",
|
|
185
|
+
pageCount
|
|
186
|
+
] })
|
|
187
|
+
] }) : /* @__PURE__ */ jsx("div", { className: "flex w-[100px] items-center justify-center text-sm font-medium", children: t("common:table.pageOfCount", { page, pageCount }) }),
|
|
188
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
189
|
+
/* @__PURE__ */ jsx(
|
|
190
|
+
Button,
|
|
191
|
+
{
|
|
192
|
+
variant: "outline",
|
|
193
|
+
className: "hidden h-8 w-8 p-0 lg:flex",
|
|
194
|
+
onClick: () => setPage(1),
|
|
195
|
+
disabled: page === 1,
|
|
196
|
+
children: /* @__PURE__ */ jsx(DoubleArrowLeftIcon, { className: "h-4 w-4" })
|
|
197
|
+
}
|
|
198
|
+
),
|
|
199
|
+
/* @__PURE__ */ jsx(
|
|
200
|
+
Button,
|
|
201
|
+
{
|
|
202
|
+
variant: "outline",
|
|
203
|
+
className: "h-8 w-8 p-0",
|
|
204
|
+
onClick: () => setPage(page - 1),
|
|
205
|
+
disabled: page === 1,
|
|
206
|
+
children: /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "h-4 w-4" })
|
|
207
|
+
}
|
|
208
|
+
),
|
|
209
|
+
/* @__PURE__ */ jsx(
|
|
210
|
+
Button,
|
|
211
|
+
{
|
|
212
|
+
variant: "outline",
|
|
213
|
+
className: "h-8 w-8 p-0",
|
|
214
|
+
onClick: () => setPage(page + 1),
|
|
215
|
+
disabled: page === pageCount,
|
|
216
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-4 w-4" })
|
|
217
|
+
}
|
|
218
|
+
),
|
|
219
|
+
/* @__PURE__ */ jsx(
|
|
220
|
+
Button,
|
|
221
|
+
{
|
|
222
|
+
variant: "outline",
|
|
223
|
+
className: "hidden h-8 w-8 p-0 lg:flex",
|
|
224
|
+
onClick: () => setPage(pageCount),
|
|
225
|
+
disabled: page === pageCount,
|
|
226
|
+
children: /* @__PURE__ */ jsx(DoubleArrowRightIcon, { className: "h-4 w-4" })
|
|
227
|
+
}
|
|
228
|
+
)
|
|
229
|
+
] })
|
|
230
|
+
] })
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
};
|
|
235
|
+
export {
|
|
236
|
+
Pagination,
|
|
237
|
+
Table,
|
|
238
|
+
TableBody,
|
|
239
|
+
TableCaption,
|
|
240
|
+
TableCell,
|
|
241
|
+
TableFooter,
|
|
242
|
+
TableHead,
|
|
243
|
+
TableHeader,
|
|
244
|
+
TableRow
|
|
245
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
const Tabs = TabsPrimitive.Root;
|
|
7
|
+
const tabListVariants = cva(
|
|
8
|
+
"inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default: "",
|
|
13
|
+
zenify: "space-x-2 bg-transparent",
|
|
14
|
+
underline: "h-auto rounded-none bg-transparent p-0 border-b border-border-subtle space-x-4",
|
|
15
|
+
pill: "inline-flex flex-wrap items-center gap-2 h-auto rounded-lg bg-surface-subtle p-2"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
variant: "default"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
const tabTriggerVariants = cva(
|
|
24
|
+
"relative inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow",
|
|
25
|
+
{
|
|
26
|
+
variants: {
|
|
27
|
+
variant: {
|
|
28
|
+
default: "data-[state=active]:bg-background data-[state=active]:text-foreground",
|
|
29
|
+
zenify: "border border-border bg-card px-4 py-2 font-normal data-[state=active]:bg-secondary data-[state=active]:text-secondary-foreground data-[state=active]:border-secondary-foreground",
|
|
30
|
+
underline: "rounded-none px-0 py-2 border-0 border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:text-primary data-[state=active]:font-semibold data-[state=active]:shadow-none",
|
|
31
|
+
pill: "gap-2 rounded-lg border border-transparent px-3 py-0 h-10 font-medium text-muted-foreground shadow-none data-[state=active]:border-primary/20 data-[state=active]:bg-card data-[state=active]:text-foreground data-[state=active]:shadow-sm"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
defaultVariants: {
|
|
35
|
+
variant: "default"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
const TabsList = React.forwardRef(({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
40
|
+
TabsPrimitive.List,
|
|
41
|
+
{
|
|
42
|
+
ref,
|
|
43
|
+
className: cn(tabListVariants({ variant, className })),
|
|
44
|
+
...props
|
|
45
|
+
}
|
|
46
|
+
));
|
|
47
|
+
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
48
|
+
const TabsTrigger = React.forwardRef(
|
|
49
|
+
({ className, variant, badge, badgeClassName, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
50
|
+
TabsPrimitive.Trigger,
|
|
51
|
+
{
|
|
52
|
+
ref,
|
|
53
|
+
className: cn(tabTriggerVariants({ variant, className })),
|
|
54
|
+
...props,
|
|
55
|
+
children: [
|
|
56
|
+
props?.children,
|
|
57
|
+
badge && /* @__PURE__ */ jsx(
|
|
58
|
+
"span",
|
|
59
|
+
{
|
|
60
|
+
className: cn(
|
|
61
|
+
"absolute right-3 top-[50%] flex h-5 w-5 -translate-y-1/2 translate-x-2 transform items-center justify-center rounded-full bg-destructive text-xs font-bold text-white",
|
|
62
|
+
badgeClassName
|
|
63
|
+
),
|
|
64
|
+
children: badge
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
);
|
|
71
|
+
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
72
|
+
const TabsContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
73
|
+
TabsPrimitive.Content,
|
|
74
|
+
{
|
|
75
|
+
ref,
|
|
76
|
+
className: cn(
|
|
77
|
+
"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
78
|
+
className
|
|
79
|
+
),
|
|
80
|
+
...props
|
|
81
|
+
}
|
|
82
|
+
));
|
|
83
|
+
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
84
|
+
export {
|
|
85
|
+
Tabs,
|
|
86
|
+
TabsContent,
|
|
87
|
+
TabsList,
|
|
88
|
+
TabsTrigger
|
|
89
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
const fieldVariants = cva("", {
|
|
6
|
+
variants: {
|
|
7
|
+
size: {
|
|
8
|
+
small: "text-xs",
|
|
9
|
+
default: "text-sm"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
defaultVariants: {
|
|
13
|
+
size: "default"
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
const Textarea = React.forwardRef(({ className, size, ...props }, ref) => {
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
|
+
"textarea",
|
|
19
|
+
{
|
|
20
|
+
className: cn(
|
|
21
|
+
"flex min-h-[60px] w-full rounded-md border border-input bg-card px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:bg-muted",
|
|
22
|
+
className,
|
|
23
|
+
fieldVariants({ size })
|
|
24
|
+
),
|
|
25
|
+
ref,
|
|
26
|
+
...props
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
Textarea.displayName = "Textarea";
|
|
31
|
+
export {
|
|
32
|
+
Textarea
|
|
33
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
const TooltipProvider = TooltipPrimitive.Provider;
|
|
6
|
+
const Tooltip = TooltipPrimitive.Root;
|
|
7
|
+
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
8
|
+
const TooltipContent = React.forwardRef(
|
|
9
|
+
({ className, sideOffset = 4, variant = "default", ...props }, ref) => {
|
|
10
|
+
const variantStyles = {
|
|
11
|
+
default: "bg-primary text-primary-foreground",
|
|
12
|
+
dark: "bg-foreground text-background",
|
|
13
|
+
light: "bg-surface-subtle text-foreground border border-border-subtle",
|
|
14
|
+
error: "bg-destructive text-destructive-foreground",
|
|
15
|
+
success: "bg-success text-success-foreground",
|
|
16
|
+
warning: "bg-warning text-warning-foreground"
|
|
17
|
+
};
|
|
18
|
+
return /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
19
|
+
TooltipPrimitive.Content,
|
|
20
|
+
{
|
|
21
|
+
ref,
|
|
22
|
+
sideOffset,
|
|
23
|
+
className: cn(
|
|
24
|
+
"z-[999999] overflow-hidden rounded-md px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
25
|
+
"max-w-[400px] whitespace-normal break-words",
|
|
26
|
+
variantStyles[variant],
|
|
27
|
+
className
|
|
28
|
+
),
|
|
29
|
+
...props
|
|
30
|
+
}
|
|
31
|
+
) });
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
35
|
+
export {
|
|
36
|
+
Tooltip,
|
|
37
|
+
TooltipContent,
|
|
38
|
+
TooltipProvider,
|
|
39
|
+
TooltipTrigger
|
|
40
|
+
};
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback, forwardRef } from "react";
|
|
3
|
+
import { MentionsInput, Mention } from "react-mentions";
|
|
4
|
+
import { cn } from "../../../../lib/utils.js";
|
|
5
|
+
import { Skeleton } from "../../../ui/skeleton.js";
|
|
6
|
+
import { ChevronRight, ChevronDown } from "lucide-react";
|
|
7
|
+
function LoadingContainer() {
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
9
|
+
"div",
|
|
10
|
+
{
|
|
11
|
+
className: cn(
|
|
12
|
+
"relative flex cursor-pointer flex-col gap-2 truncate px-2 py-1.5 text-sm outline-none transition-colors"
|
|
13
|
+
),
|
|
14
|
+
children: Array.from({ length: 10 }).map((_, index) => /* @__PURE__ */ jsx(Skeleton, { className: "h-6" }, index))
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
const PickerField = forwardRef(function PickerField2({
|
|
19
|
+
value,
|
|
20
|
+
onChange,
|
|
21
|
+
placeholder,
|
|
22
|
+
isLoading,
|
|
23
|
+
options,
|
|
24
|
+
singleLineStyleProps = {},
|
|
25
|
+
suggestionStyle = {},
|
|
26
|
+
singleLine = true,
|
|
27
|
+
disabled = false,
|
|
28
|
+
...props
|
|
29
|
+
}, ref) {
|
|
30
|
+
const [expandedGroups, setExpandedGroups] = useState(/* @__PURE__ */ new Set());
|
|
31
|
+
const toggleGroup = useCallback((key) => {
|
|
32
|
+
setExpandedGroups((prev) => {
|
|
33
|
+
const next = new Set(prev);
|
|
34
|
+
if (next.has(key)) next.delete(key);
|
|
35
|
+
else next.add(key);
|
|
36
|
+
return next;
|
|
37
|
+
});
|
|
38
|
+
}, []);
|
|
39
|
+
const getFilterOptions = (query, callback) => {
|
|
40
|
+
const filterOptions = options.filter(
|
|
41
|
+
(option) => option.display.toLowerCase().includes(query.trim().toLowerCase())
|
|
42
|
+
);
|
|
43
|
+
callback(filterOptions);
|
|
44
|
+
};
|
|
45
|
+
return /* @__PURE__ */ jsx(
|
|
46
|
+
MentionsInput,
|
|
47
|
+
{
|
|
48
|
+
inputRef: ref,
|
|
49
|
+
value: value ?? "",
|
|
50
|
+
singleLine,
|
|
51
|
+
disabled,
|
|
52
|
+
ignoreAccents: true,
|
|
53
|
+
className: cn(
|
|
54
|
+
`text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`
|
|
55
|
+
),
|
|
56
|
+
style: {
|
|
57
|
+
width: "100%",
|
|
58
|
+
minWidth: 0,
|
|
59
|
+
overflow: "visible",
|
|
60
|
+
control: {
|
|
61
|
+
padding: "4px 12px",
|
|
62
|
+
overflow: "hidden"
|
|
63
|
+
},
|
|
64
|
+
highlighter: {
|
|
65
|
+
padding: "4px 12px"
|
|
66
|
+
},
|
|
67
|
+
"&singleLine": {
|
|
68
|
+
input: {
|
|
69
|
+
height: "36px",
|
|
70
|
+
padding: "4px 12px",
|
|
71
|
+
borderWidth: "1px",
|
|
72
|
+
"--borderColor": "214.3 31.8% 91.4%",
|
|
73
|
+
borderColor: "hsl(var(--borderColor))",
|
|
74
|
+
"--backgroundColor": "0 0% 100%",
|
|
75
|
+
backgroundColor: "hsl(var(--backgroundColor))",
|
|
76
|
+
borderRadius: "6px",
|
|
77
|
+
outline: "none",
|
|
78
|
+
...singleLineStyleProps,
|
|
79
|
+
...disabled && {
|
|
80
|
+
backgroundColor: "hsl(var(--muted))",
|
|
81
|
+
cursor: "not-allowed"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"&multiLine": {
|
|
86
|
+
highlighter: {
|
|
87
|
+
padding: "4px 12px",
|
|
88
|
+
minHeight: "120px"
|
|
89
|
+
},
|
|
90
|
+
input: {
|
|
91
|
+
height: "120px",
|
|
92
|
+
padding: "4px 12px",
|
|
93
|
+
borderWidth: "1px",
|
|
94
|
+
"--borderColor": "214.3 31.8% 91.4%",
|
|
95
|
+
borderColor: "hsl(var(--borderColor))",
|
|
96
|
+
"--backgroundColor": "0 0% 100%",
|
|
97
|
+
backgroundColor: "hsl(var(--backgroundColor))",
|
|
98
|
+
borderRadius: "6px",
|
|
99
|
+
outline: "none"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
suggestions: {
|
|
103
|
+
list: {
|
|
104
|
+
maxHeight: "350px",
|
|
105
|
+
overflow: "auto",
|
|
106
|
+
transition: "all 0.2s ease",
|
|
107
|
+
listStyle: "none",
|
|
108
|
+
padding: 0,
|
|
109
|
+
margin: 0
|
|
110
|
+
},
|
|
111
|
+
item: {
|
|
112
|
+
listStyle: "none",
|
|
113
|
+
"&focused": {
|
|
114
|
+
background: "#F0F4F4"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
...suggestionStyle
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
onChange: (event, newValue, newPlainTextValue, mentions) => {
|
|
121
|
+
onChange({
|
|
122
|
+
event,
|
|
123
|
+
newValue,
|
|
124
|
+
newPlainTextValue,
|
|
125
|
+
mentions
|
|
126
|
+
});
|
|
127
|
+
},
|
|
128
|
+
placeholder,
|
|
129
|
+
onBlur: props?.onBlur,
|
|
130
|
+
customSuggestionsContainer: (children) => {
|
|
131
|
+
const buildTree = (elements) => {
|
|
132
|
+
const tree2 = {};
|
|
133
|
+
elements.forEach((element) => {
|
|
134
|
+
if (element && element.props && element.props.suggestion) {
|
|
135
|
+
const { groups = [] } = element.props.suggestion;
|
|
136
|
+
if (!groups || groups.length === 0) {
|
|
137
|
+
if (!tree2["__root__"]) {
|
|
138
|
+
tree2["__root__"] = { items: [], children: {} };
|
|
139
|
+
}
|
|
140
|
+
tree2["__root__"].items.push(element);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
let currentLevel = tree2;
|
|
144
|
+
groups.forEach((groupName, index) => {
|
|
145
|
+
if (!currentLevel[groupName]) {
|
|
146
|
+
currentLevel[groupName] = { items: [], children: {} };
|
|
147
|
+
}
|
|
148
|
+
if (index === groups.length - 1) {
|
|
149
|
+
currentLevel[groupName].items.push(element);
|
|
150
|
+
} else {
|
|
151
|
+
currentLevel = currentLevel[groupName].children;
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
return tree2;
|
|
157
|
+
};
|
|
158
|
+
const renderTree = (tree2, level = 0) => {
|
|
159
|
+
return Object.keys(tree2).map((key) => {
|
|
160
|
+
if (key === "__root__") {
|
|
161
|
+
return tree2[key].items;
|
|
162
|
+
}
|
|
163
|
+
const { items, children: children2 } = tree2[key];
|
|
164
|
+
const hasChildren = Object.keys(children2).length > 0;
|
|
165
|
+
const isCollapsible = level > 0;
|
|
166
|
+
const isExpanded = !isCollapsible || expandedGroups.has(key);
|
|
167
|
+
return /* @__PURE__ */ jsxs("div", { style: { marginLeft: level > 0 ? "2px" : "0" }, children: [
|
|
168
|
+
/* @__PURE__ */ jsxs(
|
|
169
|
+
"p",
|
|
170
|
+
{
|
|
171
|
+
className: cn(
|
|
172
|
+
"border-b px-1 py-1.5 font-semibold",
|
|
173
|
+
level === 0 && "text-sm",
|
|
174
|
+
level > 0 && "flex cursor-pointer items-center gap-1 text-muted-foreground hover:text-foreground"
|
|
175
|
+
),
|
|
176
|
+
style: level > 0 ? { fontSize: "0.85em" } : {},
|
|
177
|
+
onClick: isCollapsible ? (e) => {
|
|
178
|
+
e.stopPropagation();
|
|
179
|
+
toggleGroup(key);
|
|
180
|
+
} : void 0,
|
|
181
|
+
children: [
|
|
182
|
+
isCollapsible && (isExpanded ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-3 w-3" })),
|
|
183
|
+
key
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
),
|
|
187
|
+
isExpanded && /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: items }),
|
|
188
|
+
isExpanded && hasChildren && /* @__PURE__ */ jsx("div", { children: renderTree(children2, level + 1) })
|
|
189
|
+
] }, key);
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
const tree = buildTree(children.props.children);
|
|
193
|
+
return /* @__PURE__ */ jsxs("div", { className: "z-50 min-w-[8rem] max-w-[15rem] overflow-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md", children: [
|
|
194
|
+
isLoading && /* @__PURE__ */ jsx(LoadingContainer, {}),
|
|
195
|
+
!isLoading && /* @__PURE__ */ jsx("div", { className: "max-h-72 [&_li]:list-none [&_ul]:m-0 [&_ul]:list-none [&_ul]:p-0", children: renderTree(tree) })
|
|
196
|
+
] });
|
|
197
|
+
},
|
|
198
|
+
children: /* @__PURE__ */ jsx(
|
|
199
|
+
Mention,
|
|
200
|
+
{
|
|
201
|
+
trigger: new RegExp("(@([^\\s@]*))$"),
|
|
202
|
+
data: getFilterOptions,
|
|
203
|
+
markup: props?.markup ?? "{{$target.__id__}}",
|
|
204
|
+
displayTransform: (id, key) => props.displayTransform?.(id, key) || `{{${key}}}`,
|
|
205
|
+
allowSpaceInQuery: true,
|
|
206
|
+
renderSuggestion: (entry, search, highlightedDisplay, index, focused) => {
|
|
207
|
+
const isDisabled = entry.disabled === true;
|
|
208
|
+
return /* @__PURE__ */ jsxs(
|
|
209
|
+
"div",
|
|
210
|
+
{
|
|
211
|
+
"data-mention-item": true,
|
|
212
|
+
"data-mention-focused": focused ? "true" : "false",
|
|
213
|
+
className: cn(
|
|
214
|
+
"relative my-0.5 flex select-none items-center gap-2 truncate rounded-sm px-2 py-1.5 text-xs outline-none transition-colors",
|
|
215
|
+
isDisabled ? "cursor-not-allowed bg-muted text-muted-foreground" : "cursor-pointer hover:bg-[#F0F4F4]"
|
|
216
|
+
),
|
|
217
|
+
children: [
|
|
218
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children: highlightedDisplay }),
|
|
219
|
+
isDisabled && /* @__PURE__ */ jsx("span", { className: "ml-auto text-[10px]", children: "(disabled)" })
|
|
220
|
+
]
|
|
221
|
+
},
|
|
222
|
+
index
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
)
|
|
227
|
+
}
|
|
228
|
+
);
|
|
229
|
+
});
|
|
230
|
+
var picker_field_default = PickerField;
|
|
231
|
+
export {
|
|
232
|
+
picker_field_default as default
|
|
233
|
+
};
|