@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,81 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
import { useTranslation } from "react-i18next";
|
|
4
|
+
const tagColors = [
|
|
5
|
+
"#6366F1",
|
|
6
|
+
// Indigo - trẻ trung, chuyên nghiệp
|
|
7
|
+
"#10B981",
|
|
8
|
+
// Emerald - nhẹ nhàng, tươi sáng
|
|
9
|
+
"#F59E0B",
|
|
10
|
+
// Amber - nổi bật, thu hút
|
|
11
|
+
"#EF4444",
|
|
12
|
+
// Red - mạnh mẽ, dễ nhận biết
|
|
13
|
+
"#3B82F6",
|
|
14
|
+
// Blue - phổ biến, dễ nhìn
|
|
15
|
+
"#8B5CF6",
|
|
16
|
+
// Violet - cá tính, thời thượng
|
|
17
|
+
"#EC4899",
|
|
18
|
+
// Pink - trẻ trung, nổi bật
|
|
19
|
+
"#F97316",
|
|
20
|
+
// Orange - năng động, bắt mắt
|
|
21
|
+
"#14B8A6",
|
|
22
|
+
// Teal - dịu mắt, tinh tế
|
|
23
|
+
"#A855F7",
|
|
24
|
+
// Purple - sáng tạo, nổi bật
|
|
25
|
+
"#0F172A",
|
|
26
|
+
// Slate - tối giản, chuyên nghiệp
|
|
27
|
+
"#1E293B",
|
|
28
|
+
// Dark Blue Gray - hiện đại, sâu sắc
|
|
29
|
+
"#64748B",
|
|
30
|
+
// Cool Gray - trung tính, dễ phối
|
|
31
|
+
"#6B7280",
|
|
32
|
+
// Gray - thanh lịch, cân bằng
|
|
33
|
+
"#4B5563",
|
|
34
|
+
// Charcoal - sang trọng, nam tính
|
|
35
|
+
"#334155",
|
|
36
|
+
// Steel - lạnh, chuyên nghiệp
|
|
37
|
+
"#2563EB",
|
|
38
|
+
// Royal Blue - tự tin, chuyên sâu
|
|
39
|
+
"#16A34A",
|
|
40
|
+
// Forest Green - tin cậy, bền vững
|
|
41
|
+
"#B45309",
|
|
42
|
+
// Bronze - cổ điển, đẳng cấp
|
|
43
|
+
"#DB2777"
|
|
44
|
+
// Raspberry - sáng tạo, phá cách
|
|
45
|
+
];
|
|
46
|
+
const getRandomColor = () => {
|
|
47
|
+
return tagColors[Math.floor(Math.random() * tagColors.length)];
|
|
48
|
+
};
|
|
49
|
+
function CustomColorPicker({ color, setColor, className }) {
|
|
50
|
+
const { t } = useTranslation();
|
|
51
|
+
return /* @__PURE__ */ jsx("div", { className: cn("ml-2", className), children: /* @__PURE__ */ jsxs("label", { className: "relative block h-[36px] w-[36px] overflow-hidden rounded-lg border border-gray-400 bg-white p-1", children: [
|
|
52
|
+
/* @__PURE__ */ jsx(
|
|
53
|
+
"div",
|
|
54
|
+
{
|
|
55
|
+
className: "h-full w-full rounded-lg",
|
|
56
|
+
style: { backgroundColor: color }
|
|
57
|
+
}
|
|
58
|
+
),
|
|
59
|
+
/* @__PURE__ */ jsx(
|
|
60
|
+
"input",
|
|
61
|
+
{
|
|
62
|
+
disabled: !setColor,
|
|
63
|
+
type: "color",
|
|
64
|
+
value: color,
|
|
65
|
+
onChange: (e) => {
|
|
66
|
+
if (setColor) {
|
|
67
|
+
setColor(e.target.value);
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
className: "absolute inset-0 h-full w-full cursor-pointer opacity-0",
|
|
71
|
+
"aria-label": t("common:action.selectColor", {
|
|
72
|
+
defaultValue: "Ch\u1ECDn m\xE0u"
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
] }) });
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
CustomColorPicker,
|
|
80
|
+
getRandomColor
|
|
81
|
+
};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useRef, useState } from "react";
|
|
3
|
+
import {
|
|
4
|
+
CaretSortIcon,
|
|
5
|
+
CheckIcon,
|
|
6
|
+
MagnifyingGlassIcon
|
|
7
|
+
} from "@radix-ui/react-icons";
|
|
8
|
+
import { LoaderCircle } from "lucide-react";
|
|
9
|
+
import { cn } from "../../lib/utils.js";
|
|
10
|
+
import {
|
|
11
|
+
Command,
|
|
12
|
+
CommandEmpty,
|
|
13
|
+
CommandGroup,
|
|
14
|
+
CommandItem,
|
|
15
|
+
CommandList
|
|
16
|
+
} from "../ui/command.js";
|
|
17
|
+
import {
|
|
18
|
+
Popover,
|
|
19
|
+
PopoverContent,
|
|
20
|
+
PopoverTrigger
|
|
21
|
+
} from "../ui/popover.js";
|
|
22
|
+
import useDebounce from "../../hooks/use-debounce.js";
|
|
23
|
+
import { useQuery } from "@tanstack/react-query";
|
|
24
|
+
import { maskData } from "@zenify-omni/chat-js/utils/data.js";
|
|
25
|
+
import { cva } from "class-variance-authority";
|
|
26
|
+
import { useTranslation } from "react-i18next";
|
|
27
|
+
const Combobox = forwardRef(function Combobox2({
|
|
28
|
+
className,
|
|
29
|
+
value,
|
|
30
|
+
onChange,
|
|
31
|
+
onSearch,
|
|
32
|
+
placeholder = "",
|
|
33
|
+
searchKey = "",
|
|
34
|
+
searchDelay = 500,
|
|
35
|
+
disabled = false,
|
|
36
|
+
size = "default",
|
|
37
|
+
buildOption = (option) => option
|
|
38
|
+
}, ref) {
|
|
39
|
+
const { t } = useTranslation();
|
|
40
|
+
const [open, setOpen] = useState(false);
|
|
41
|
+
const [searchText, setSearchText] = useState("");
|
|
42
|
+
const debounceSearchText = useDebounce(searchText, searchDelay);
|
|
43
|
+
const prevDebounceSearchTextRef = useRef(void 0);
|
|
44
|
+
const {
|
|
45
|
+
isLoading,
|
|
46
|
+
data: options,
|
|
47
|
+
refetch
|
|
48
|
+
} = useQuery({
|
|
49
|
+
enabled: false,
|
|
50
|
+
initialData: [],
|
|
51
|
+
queryKey: [searchKey, { keyword: debounceSearchText }],
|
|
52
|
+
queryFn: async () => {
|
|
53
|
+
const options2 = await onSearch(debounceSearchText);
|
|
54
|
+
return options2.map(buildOption);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
if (prevDebounceSearchTextRef.current === debounceSearchText) return;
|
|
59
|
+
prevDebounceSearchTextRef.current = debounceSearchText;
|
|
60
|
+
refetch();
|
|
61
|
+
}, [debounceSearchText, refetch]);
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (!value) {
|
|
64
|
+
setSearchText("");
|
|
65
|
+
}
|
|
66
|
+
}, [value]);
|
|
67
|
+
const textVariants = cva("", {
|
|
68
|
+
variants: {
|
|
69
|
+
size: {
|
|
70
|
+
small: "text-xs",
|
|
71
|
+
default: "text-sm"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
defaultVariants: {
|
|
75
|
+
size: "default"
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, modal: true, children: [
|
|
79
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
ref,
|
|
83
|
+
tabIndex: -1,
|
|
84
|
+
className: cn(
|
|
85
|
+
"flex h-9 items-center justify-between whitespace-nowrap rounded-md border border-input bg-card px-3 py-2 text-sm shadow-sm focus-visible:ring-1 focus-visible:ring-ring",
|
|
86
|
+
!value && "text-muted-foreground",
|
|
87
|
+
disabled && "cursor-not-allowed bg-muted",
|
|
88
|
+
textVariants({ size }),
|
|
89
|
+
className
|
|
90
|
+
),
|
|
91
|
+
onClick: (e) => {
|
|
92
|
+
if (!disabled) return;
|
|
93
|
+
e.preventDefault();
|
|
94
|
+
},
|
|
95
|
+
children: [
|
|
96
|
+
/* @__PURE__ */ jsx("div", { className: "max-w-[calc(100%-1.5rem)] truncate", children: value && value.label ? maskData(value.label) : /* @__PURE__ */ jsx(
|
|
97
|
+
"span",
|
|
98
|
+
{
|
|
99
|
+
className: cn(
|
|
100
|
+
"text-sm text-muted-foreground",
|
|
101
|
+
textVariants({ size })
|
|
102
|
+
),
|
|
103
|
+
children: placeholder
|
|
104
|
+
}
|
|
105
|
+
) }),
|
|
106
|
+
/* @__PURE__ */ jsx(CaretSortIcon, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
) }),
|
|
110
|
+
/* @__PURE__ */ jsx(PopoverContent, { className: "max-h-[--radix-popover-content-available-height] w-[--radix-popover-trigger-width] overflow-auto p-0", children: /* @__PURE__ */ jsxs(Command, { shouldFilter: false, children: [
|
|
111
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center border-b px-3", children: [
|
|
112
|
+
isLoading ? /* @__PURE__ */ jsx(LoaderCircle, { className: "mr-2 h-4 w-4 shrink-0 animate-spin" }) : /* @__PURE__ */ jsx(MagnifyingGlassIcon, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
113
|
+
/* @__PURE__ */ jsx(
|
|
114
|
+
"input",
|
|
115
|
+
{
|
|
116
|
+
className: cn(
|
|
117
|
+
"flex h-9 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
118
|
+
textVariants({ size })
|
|
119
|
+
),
|
|
120
|
+
placeholder: t("common:placeholder.typeToSearch", {
|
|
121
|
+
defaultValue: "Nh\u1EADp \u0111\u1EC3 t\xECm ki\u1EBFm"
|
|
122
|
+
}),
|
|
123
|
+
value: searchText,
|
|
124
|
+
onChange: (e) => {
|
|
125
|
+
setSearchText(e.target.value);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
] }),
|
|
130
|
+
/* @__PURE__ */ jsxs(CommandList, { children: [
|
|
131
|
+
!isLoading && options.length === 0 && /* @__PURE__ */ jsx(CommandEmpty, { children: t("common:empty.noData", { defaultValue: "Kh\xF4ng c\xF3 d\u1EEF li\u1EC7u" }) }),
|
|
132
|
+
/* @__PURE__ */ jsx(CommandGroup, { children: options.filter(
|
|
133
|
+
(option) => option?.value !== void 0 && option?.value !== null
|
|
134
|
+
).map((option) => {
|
|
135
|
+
const optionValue = String(option.value);
|
|
136
|
+
const currentValue = value?.value !== void 0 && value?.value !== null ? String(value.value) : "";
|
|
137
|
+
return /* @__PURE__ */ jsxs(
|
|
138
|
+
CommandItem,
|
|
139
|
+
{
|
|
140
|
+
className: cn(textVariants({ size })),
|
|
141
|
+
value: optionValue,
|
|
142
|
+
onSelect: (valueText) => {
|
|
143
|
+
onChange(valueText === currentValue ? null : option);
|
|
144
|
+
setOpen(false);
|
|
145
|
+
},
|
|
146
|
+
children: [
|
|
147
|
+
option.label,
|
|
148
|
+
/* @__PURE__ */ jsx(
|
|
149
|
+
CheckIcon,
|
|
150
|
+
{
|
|
151
|
+
className: cn(
|
|
152
|
+
"ml-auto h-4 w-4",
|
|
153
|
+
currentValue === optionValue ? "opacity-100" : "opacity-0"
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
)
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
optionValue
|
|
160
|
+
);
|
|
161
|
+
}) })
|
|
162
|
+
] })
|
|
163
|
+
] }) })
|
|
164
|
+
] });
|
|
165
|
+
});
|
|
166
|
+
export {
|
|
167
|
+
Combobox
|
|
168
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Cross2Icon } from "@radix-ui/react-icons";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
const CustomDialog = ({
|
|
5
|
+
className,
|
|
6
|
+
isOpen,
|
|
7
|
+
onOpenChange,
|
|
8
|
+
title,
|
|
9
|
+
trigger,
|
|
10
|
+
children,
|
|
11
|
+
footer
|
|
12
|
+
}) => {
|
|
13
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
14
|
+
/* @__PURE__ */ jsx("div", { onClick: () => onOpenChange(true), children: trigger }),
|
|
15
|
+
isOpen && /* @__PURE__ */ jsx("div", { className: "fixed inset-0 z-50 !ml-0 flex items-center justify-center bg-black/80", children: /* @__PURE__ */ jsxs(
|
|
16
|
+
"div",
|
|
17
|
+
{
|
|
18
|
+
className: cn(
|
|
19
|
+
"w-full rounded-lg bg-background p-6 shadow-lg",
|
|
20
|
+
className
|
|
21
|
+
),
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-foreground", children: [
|
|
24
|
+
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold leading-none tracking-tight", children: title }),
|
|
25
|
+
/* @__PURE__ */ jsx(
|
|
26
|
+
"button",
|
|
27
|
+
{
|
|
28
|
+
onClick: () => onOpenChange(false),
|
|
29
|
+
className: "text-foreground opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",
|
|
30
|
+
children: /* @__PURE__ */ jsx(Cross2Icon, { className: "h-4 w-4" })
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
] }),
|
|
34
|
+
/* @__PURE__ */ jsx("div", { children }),
|
|
35
|
+
footer && /* @__PURE__ */ jsx("div", { className: "mt-6 text-right", children: footer })
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
) })
|
|
39
|
+
] });
|
|
40
|
+
};
|
|
41
|
+
var custom_dialog_default = CustomDialog;
|
|
42
|
+
export {
|
|
43
|
+
custom_dialog_default as default
|
|
44
|
+
};
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useState, useEffect, useRef, useCallback } from "react";
|
|
3
|
+
import {
|
|
4
|
+
Select,
|
|
5
|
+
SelectContent,
|
|
6
|
+
SelectItem,
|
|
7
|
+
SelectTrigger,
|
|
8
|
+
SelectValue
|
|
9
|
+
} from "../ui/select.js";
|
|
10
|
+
import { Skeleton } from "../ui/skeleton.js";
|
|
11
|
+
import { cn } from "../../lib/utils.js";
|
|
12
|
+
import { Input } from "../ui/input.js";
|
|
13
|
+
import { Search, LoaderCircle } from "lucide-react";
|
|
14
|
+
import { normalizeText } from "@zenify-omni/chat-js/utils/data.js";
|
|
15
|
+
import { cva } from "class-variance-authority";
|
|
16
|
+
import { useTranslation } from "react-i18next";
|
|
17
|
+
const fieldVariants = cva("", {
|
|
18
|
+
variants: {
|
|
19
|
+
size: {
|
|
20
|
+
small: "text-xs",
|
|
21
|
+
default: "text-sm"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: {
|
|
25
|
+
size: "default"
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
function transToGroupOption(options, groupBy) {
|
|
29
|
+
if (options.length === 0) {
|
|
30
|
+
return /* @__PURE__ */ new Map();
|
|
31
|
+
}
|
|
32
|
+
if (!groupBy) {
|
|
33
|
+
return /* @__PURE__ */ new Map([["", options]]);
|
|
34
|
+
}
|
|
35
|
+
const groupOption = /* @__PURE__ */ new Map();
|
|
36
|
+
options.forEach((option) => {
|
|
37
|
+
const key = option[groupBy] || "";
|
|
38
|
+
if (!groupOption.has(key)) {
|
|
39
|
+
groupOption.set(key, []);
|
|
40
|
+
}
|
|
41
|
+
groupOption.get(key).push(option);
|
|
42
|
+
});
|
|
43
|
+
return groupOption;
|
|
44
|
+
}
|
|
45
|
+
const CustomSelect = React.forwardRef(
|
|
46
|
+
({
|
|
47
|
+
disabled,
|
|
48
|
+
options = [],
|
|
49
|
+
onChange,
|
|
50
|
+
checkItemDisabled,
|
|
51
|
+
isNullValue,
|
|
52
|
+
isSearch,
|
|
53
|
+
isLoading = false,
|
|
54
|
+
size,
|
|
55
|
+
groupBy,
|
|
56
|
+
onLoadMore,
|
|
57
|
+
hasNextPage,
|
|
58
|
+
isFetchingNextPage,
|
|
59
|
+
onItemPointerDown,
|
|
60
|
+
onItemKeyDown,
|
|
61
|
+
onSearchOptions,
|
|
62
|
+
...props
|
|
63
|
+
}, ref) => {
|
|
64
|
+
const { t } = useTranslation();
|
|
65
|
+
const [search, setSearch] = useState("");
|
|
66
|
+
const [filteredData, setFilteredData] = useState(options);
|
|
67
|
+
const inputRef = useRef(null);
|
|
68
|
+
const scrollContainerRef = useRef(null);
|
|
69
|
+
const observerRef = useRef(null);
|
|
70
|
+
const sentinelRef = useCallback(
|
|
71
|
+
(node) => {
|
|
72
|
+
if (isFetchingNextPage) return;
|
|
73
|
+
if (observerRef.current) observerRef.current.disconnect();
|
|
74
|
+
observerRef.current = new IntersectionObserver(
|
|
75
|
+
(entries) => {
|
|
76
|
+
if (entries[0].isIntersecting && hasNextPage) {
|
|
77
|
+
onLoadMore?.();
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
{ root: scrollContainerRef.current }
|
|
81
|
+
);
|
|
82
|
+
if (node) observerRef.current.observe(node);
|
|
83
|
+
},
|
|
84
|
+
[isFetchingNextPage, hasNextPage, onLoadMore]
|
|
85
|
+
);
|
|
86
|
+
const handleChange = (value) => {
|
|
87
|
+
if (!options || !options.length) return;
|
|
88
|
+
const option = options.find((x) => String(x.value) === String(value));
|
|
89
|
+
onChange?.(option ? option.value : value, option);
|
|
90
|
+
};
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
const keyword = search.trim().toLowerCase();
|
|
93
|
+
if (!keyword) {
|
|
94
|
+
setFilteredData(options);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const value = props?.option?.value ?? props.value;
|
|
98
|
+
let data = onSearchOptions ? onSearchOptions(options, keyword) : options.filter((item) => {
|
|
99
|
+
const label = normalizeText(item.label);
|
|
100
|
+
const key = normalizeText(keyword);
|
|
101
|
+
return label?.includes(key);
|
|
102
|
+
});
|
|
103
|
+
if (value) {
|
|
104
|
+
const selected = options.find((e) => e.value == value);
|
|
105
|
+
if (selected && !data.some((d) => d.value === selected.value)) {
|
|
106
|
+
data = [selected, ...data];
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
setFilteredData(data);
|
|
110
|
+
}, [search, options, props.value, props?.option?.value, onSearchOptions]);
|
|
111
|
+
const groupedOptions = transToGroupOption(filteredData, groupBy);
|
|
112
|
+
return /* @__PURE__ */ jsxs(
|
|
113
|
+
Select,
|
|
114
|
+
{
|
|
115
|
+
...props,
|
|
116
|
+
disabled,
|
|
117
|
+
defaultValue: props.defaultValue,
|
|
118
|
+
value: props?.option?.value ?? props.value,
|
|
119
|
+
onValueChange: handleChange,
|
|
120
|
+
children: [
|
|
121
|
+
/* @__PURE__ */ jsx(
|
|
122
|
+
SelectTrigger,
|
|
123
|
+
{
|
|
124
|
+
ref,
|
|
125
|
+
onClick: () => {
|
|
126
|
+
setTimeout(() => {
|
|
127
|
+
setSearch("");
|
|
128
|
+
inputRef.current?.focus();
|
|
129
|
+
}, 1);
|
|
130
|
+
},
|
|
131
|
+
className: cn(
|
|
132
|
+
!props.value && "text-muted-foreground",
|
|
133
|
+
props.triggerClassName,
|
|
134
|
+
props.SelectTriggerOptions?.className,
|
|
135
|
+
props.error && "border border-[--label-red-foreground]",
|
|
136
|
+
fieldVariants({ size })
|
|
137
|
+
),
|
|
138
|
+
disabled: props.SelectTriggerOptions?.disabled,
|
|
139
|
+
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: props.placeholder ?? "Ch\u1ECDn" })
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
isLoading && /* @__PURE__ */ jsx(SelectContent, { children: /* @__PURE__ */ jsx("div", { className: "max-h-[200px] space-y-2 overflow-y-auto", children: Array.from({ length: 5 }).map((_, index) => /* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-full" }, index)) }) }),
|
|
143
|
+
!isLoading && /* @__PURE__ */ jsxs(SelectContent, { onCloseAutoFocus: (e) => e.preventDefault(), children: [
|
|
144
|
+
isSearch && /* @__PURE__ */ jsxs("div", { className: "sticky top-0 z-10 flex items-center bg-popover px-2 pb-2", children: [
|
|
145
|
+
/* @__PURE__ */ jsx(Search, { size: 16, className: "text-muted-foreground" }),
|
|
146
|
+
/* @__PURE__ */ jsx(
|
|
147
|
+
Input,
|
|
148
|
+
{
|
|
149
|
+
ref: inputRef,
|
|
150
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
151
|
+
placeholder: t("common:placeholder.typeToSearch", {
|
|
152
|
+
defaultValue: "Nh\u1EADp \u0111\u1EC3 t\xECm ki\u1EBFm"
|
|
153
|
+
}),
|
|
154
|
+
value: search,
|
|
155
|
+
onChange: (e) => setSearch(e.target.value),
|
|
156
|
+
className: cn(
|
|
157
|
+
"h-7 border-none pl-1 text-sm shadow-none !outline-none focus:outline-none focus-visible:ring-0 focus-visible:ring-offset-0",
|
|
158
|
+
props.SelectItemOptions?.className,
|
|
159
|
+
fieldVariants({ size })
|
|
160
|
+
),
|
|
161
|
+
onClick: (e) => e.stopPropagation(),
|
|
162
|
+
onFocus: (e) => e.stopPropagation()
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
] }),
|
|
166
|
+
/* @__PURE__ */ jsxs(
|
|
167
|
+
"div",
|
|
168
|
+
{
|
|
169
|
+
ref: scrollContainerRef,
|
|
170
|
+
className: "max-h-[200px] overflow-y-auto",
|
|
171
|
+
children: [
|
|
172
|
+
props.defaultValue && /* @__PURE__ */ jsx(
|
|
173
|
+
SelectItem,
|
|
174
|
+
{
|
|
175
|
+
className: cn(fieldVariants({ size })),
|
|
176
|
+
value: props.defaultValue,
|
|
177
|
+
children: props.defaultValueLabel ?? "Ch\u1ECDn"
|
|
178
|
+
},
|
|
179
|
+
"item_0"
|
|
180
|
+
),
|
|
181
|
+
isNullValue && /* @__PURE__ */ jsx(
|
|
182
|
+
SelectItem,
|
|
183
|
+
{
|
|
184
|
+
className: cn(
|
|
185
|
+
props.SelectItemOptions?.className,
|
|
186
|
+
fieldVariants({ size })
|
|
187
|
+
),
|
|
188
|
+
value: null,
|
|
189
|
+
children: t("common:placeholder.selectDefault", {
|
|
190
|
+
defaultValue: "--Ch\u1ECDn--"
|
|
191
|
+
})
|
|
192
|
+
}
|
|
193
|
+
),
|
|
194
|
+
Array.from(groupedOptions.entries()).map(
|
|
195
|
+
([groupKey, groupOptions]) => {
|
|
196
|
+
return /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
197
|
+
groupKey && /* @__PURE__ */ jsx(
|
|
198
|
+
"div",
|
|
199
|
+
{
|
|
200
|
+
className: cn(
|
|
201
|
+
fieldVariants({ size }),
|
|
202
|
+
"p-[6px] px-2 py-1.5 text-xs font-medium text-muted-foreground"
|
|
203
|
+
),
|
|
204
|
+
children: props.renderGroupHeading?.(groupKey) || groupKey
|
|
205
|
+
}
|
|
206
|
+
),
|
|
207
|
+
groupOptions.map((option, index) => /* @__PURE__ */ jsx(
|
|
208
|
+
SelectItem,
|
|
209
|
+
{
|
|
210
|
+
className: cn(
|
|
211
|
+
props.SelectItemOptions?.className,
|
|
212
|
+
fieldVariants({ size })
|
|
213
|
+
),
|
|
214
|
+
value: option.value,
|
|
215
|
+
disabled: (checkItemDisabled?.(option) || option.disabled) ?? false,
|
|
216
|
+
onPointerDown: onItemPointerDown ? () => onItemPointerDown(option.value, option) : void 0,
|
|
217
|
+
onKeyDown: onItemKeyDown ? (e) => onItemKeyDown(e, option.value, option) : void 0,
|
|
218
|
+
children: option.label
|
|
219
|
+
},
|
|
220
|
+
`item_${groupKey}_${index}`
|
|
221
|
+
))
|
|
222
|
+
] }, groupKey);
|
|
223
|
+
}
|
|
224
|
+
),
|
|
225
|
+
!filteredData.length && /* @__PURE__ */ jsx(
|
|
226
|
+
"div",
|
|
227
|
+
{
|
|
228
|
+
className: cn(
|
|
229
|
+
"py-2 text-center text-xs text-muted-foreground",
|
|
230
|
+
fieldVariants({ size })
|
|
231
|
+
),
|
|
232
|
+
children: t("common:empty.noResults", {
|
|
233
|
+
defaultValue: "Kh\xF4ng t\xECm th\u1EA5y k\u1EBFt qu\u1EA3"
|
|
234
|
+
})
|
|
235
|
+
}
|
|
236
|
+
),
|
|
237
|
+
isFetchingNextPage && /* @__PURE__ */ jsxs("div", { className: "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm text-muted-foreground outline-none", children: [
|
|
238
|
+
/* @__PURE__ */ jsx(LoaderCircle, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
239
|
+
t("common:status.loadingMore", {
|
|
240
|
+
defaultValue: "\u0110ang t\u1EA3i th\xEAm..."
|
|
241
|
+
})
|
|
242
|
+
] }),
|
|
243
|
+
onLoadMore && /* @__PURE__ */ jsx("div", { ref: sentinelRef, "aria-hidden": true, className: "h-px" })
|
|
244
|
+
]
|
|
245
|
+
}
|
|
246
|
+
)
|
|
247
|
+
] })
|
|
248
|
+
]
|
|
249
|
+
}
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
);
|
|
253
|
+
CustomSelect.displayName = "CustomSelect";
|
|
254
|
+
export {
|
|
255
|
+
CustomSelect
|
|
256
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CYCLE_PRESETS } from "@zenify-omni/chat-js/constants/advance-filter.js";
|
|
2
|
+
function applyPresetDefaults(value, presetKey) {
|
|
3
|
+
return {
|
|
4
|
+
...value,
|
|
5
|
+
preset: presetKey,
|
|
6
|
+
tolerance: CYCLE_PRESETS[presetKey]?.tolerance ?? null
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
applyPresetDefaults
|
|
11
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Input } from "../ui/input.js";
|
|
4
|
+
import {
|
|
5
|
+
Select,
|
|
6
|
+
SelectContent,
|
|
7
|
+
SelectItem,
|
|
8
|
+
SelectTrigger,
|
|
9
|
+
SelectValue
|
|
10
|
+
} from "../ui/select.js";
|
|
11
|
+
import FieldGenerator from "./field-generator.js";
|
|
12
|
+
import { CYCLE_PRESET_OPTIONS } from "@zenify-omni/chat-js/constants/advance-filter.js";
|
|
13
|
+
import { cn } from "../../lib/utils.js";
|
|
14
|
+
import { applyPresetDefaults } from "./cycle-value-helpers.js";
|
|
15
|
+
import { useTranslation } from "react-i18next";
|
|
16
|
+
const CycleValue = React.forwardRef(({ value, onChange, error }, ref) => {
|
|
17
|
+
const { t } = useTranslation();
|
|
18
|
+
const current = value || {};
|
|
19
|
+
return /* @__PURE__ */ jsxs("div", { ref, className: "flex flex-col gap-2", children: [
|
|
20
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
21
|
+
/* @__PURE__ */ jsxs(
|
|
22
|
+
Select,
|
|
23
|
+
{
|
|
24
|
+
value: current.preset || "",
|
|
25
|
+
onValueChange: (presetKey) => onChange(applyPresetDefaults(current, presetKey)),
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ jsx(
|
|
28
|
+
SelectTrigger,
|
|
29
|
+
{
|
|
30
|
+
className: cn("w-full", error && "border-[--label-red-foreground]"),
|
|
31
|
+
children: /* @__PURE__ */ jsx(
|
|
32
|
+
SelectValue,
|
|
33
|
+
{
|
|
34
|
+
placeholder: t("settings:smartView.selectCycle", {
|
|
35
|
+
defaultValue: "Ch\u1ECDn chu k\u1EF3"
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
/* @__PURE__ */ jsx(SelectContent, { children: CYCLE_PRESET_OPTIONS.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value, children: option.label }, option.value)) })
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
error && /* @__PURE__ */ jsx("span", { className: "mt-1 block text-xs text-[--label-red-foreground]", children: error })
|
|
46
|
+
] }),
|
|
47
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
48
|
+
/* @__PURE__ */ jsx("span", { className: "mb-1 block text-xs text-muted-foreground", children: t("settings:smartView.toleranceDays", {
|
|
49
|
+
defaultValue: "Sai s\u1ED1 (ng\xE0y)"
|
|
50
|
+
}) }),
|
|
51
|
+
/* @__PURE__ */ jsx(
|
|
52
|
+
Input,
|
|
53
|
+
{
|
|
54
|
+
type: "number",
|
|
55
|
+
min: 0,
|
|
56
|
+
step: 1,
|
|
57
|
+
className: "w-full",
|
|
58
|
+
placeholder: t("settings:smartView.plusMinusDays", {
|
|
59
|
+
defaultValue: "\xB1 ng\xE0y"
|
|
60
|
+
}),
|
|
61
|
+
value: current.tolerance ?? "",
|
|
62
|
+
onChange: (e) => {
|
|
63
|
+
const raw = e.target.value;
|
|
64
|
+
const parsed = Math.floor(Number(raw));
|
|
65
|
+
onChange({
|
|
66
|
+
...current,
|
|
67
|
+
tolerance: raw === "" || Number.isNaN(parsed) ? null : Math.max(0, parsed)
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
] }),
|
|
73
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
74
|
+
/* @__PURE__ */ jsx("span", { className: "mb-1 block text-xs text-muted-foreground", children: t("settings:smartView.anchorDate", { defaultValue: "Ng\xE0y m\u1ED1c" }) }),
|
|
75
|
+
/* @__PURE__ */ jsx(
|
|
76
|
+
FieldGenerator,
|
|
77
|
+
{
|
|
78
|
+
type: "date",
|
|
79
|
+
value: current.anchor ?? null,
|
|
80
|
+
onChange: (anchor) => onChange({ ...current, anchor })
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
/* @__PURE__ */ jsx("span", { className: "mt-1 block text-xs text-muted-foreground", children: t("settings:smartView.emptyMeansTodayHint", {
|
|
84
|
+
defaultValue: "\u0110\u1EC3 tr\u1ED1ng = t\xEDnh theo ng\xE0y hi\u1EC7n t\u1EA1i, t\u1EF1 c\u1EADp nh\u1EADt m\u1ED7i ng\xE0y"
|
|
85
|
+
}) })
|
|
86
|
+
] })
|
|
87
|
+
] });
|
|
88
|
+
});
|
|
89
|
+
CycleValue.displayName = "CycleValue";
|
|
90
|
+
var cycle_value_default = CycleValue;
|
|
91
|
+
export {
|
|
92
|
+
cycle_value_default as default
|
|
93
|
+
};
|