@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,169 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
4
|
+
import {
|
|
5
|
+
CheckIcon,
|
|
6
|
+
ChevronRightIcon,
|
|
7
|
+
DotFilledIcon
|
|
8
|
+
} from "@radix-ui/react-icons";
|
|
9
|
+
import { cn } from "../../lib/utils.js";
|
|
10
|
+
const DropdownMenu = DropdownMenuPrimitive.Root;
|
|
11
|
+
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
12
|
+
const DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
13
|
+
const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
14
|
+
const DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
15
|
+
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
16
|
+
const DropdownMenuSubTrigger = React.forwardRef(
|
|
17
|
+
({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
18
|
+
DropdownMenuPrimitive.SubTrigger,
|
|
19
|
+
{
|
|
20
|
+
ref,
|
|
21
|
+
className: cn(
|
|
22
|
+
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
|
|
23
|
+
inset && "pl-8",
|
|
24
|
+
className
|
|
25
|
+
),
|
|
26
|
+
...props,
|
|
27
|
+
children: [
|
|
28
|
+
children,
|
|
29
|
+
/* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto h-4 w-4" })
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
);
|
|
34
|
+
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
35
|
+
const DropdownMenuSubContent = React.forwardRef(
|
|
36
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
37
|
+
DropdownMenuPrimitive.SubContent,
|
|
38
|
+
{
|
|
39
|
+
ref,
|
|
40
|
+
className: cn(
|
|
41
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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",
|
|
42
|
+
className
|
|
43
|
+
),
|
|
44
|
+
...props
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
);
|
|
48
|
+
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
49
|
+
const DropdownMenuContent = React.forwardRef(
|
|
50
|
+
({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
51
|
+
DropdownMenuPrimitive.Content,
|
|
52
|
+
{
|
|
53
|
+
ref,
|
|
54
|
+
sideOffset,
|
|
55
|
+
className: cn(
|
|
56
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
|
|
57
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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",
|
|
58
|
+
className
|
|
59
|
+
),
|
|
60
|
+
...props
|
|
61
|
+
}
|
|
62
|
+
) })
|
|
63
|
+
);
|
|
64
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
65
|
+
const DropdownMenuItem = React.forwardRef(
|
|
66
|
+
({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
67
|
+
DropdownMenuPrimitive.Item,
|
|
68
|
+
{
|
|
69
|
+
ref,
|
|
70
|
+
className: cn(
|
|
71
|
+
"relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
72
|
+
inset && "pl-8",
|
|
73
|
+
className
|
|
74
|
+
),
|
|
75
|
+
...props
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
);
|
|
79
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
80
|
+
const DropdownMenuCheckboxItem = React.forwardRef(
|
|
81
|
+
({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
82
|
+
DropdownMenuPrimitive.CheckboxItem,
|
|
83
|
+
{
|
|
84
|
+
ref,
|
|
85
|
+
className: cn(
|
|
86
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
87
|
+
className
|
|
88
|
+
),
|
|
89
|
+
checked,
|
|
90
|
+
...props,
|
|
91
|
+
children: [
|
|
92
|
+
/* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "h-4 w-4" }) }) }),
|
|
93
|
+
children
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
);
|
|
98
|
+
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
99
|
+
const DropdownMenuRadioItem = React.forwardRef(
|
|
100
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
101
|
+
DropdownMenuPrimitive.RadioItem,
|
|
102
|
+
{
|
|
103
|
+
ref,
|
|
104
|
+
className: cn(
|
|
105
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
106
|
+
className
|
|
107
|
+
),
|
|
108
|
+
...props,
|
|
109
|
+
children: [
|
|
110
|
+
/* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(DotFilledIcon, { className: "h-4 w-4 fill-current" }) }) }),
|
|
111
|
+
children
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
);
|
|
116
|
+
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
117
|
+
const DropdownMenuLabel = React.forwardRef(
|
|
118
|
+
({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
119
|
+
DropdownMenuPrimitive.Label,
|
|
120
|
+
{
|
|
121
|
+
ref,
|
|
122
|
+
className: cn(
|
|
123
|
+
"px-2 py-1.5 text-sm font-semibold",
|
|
124
|
+
inset && "pl-8",
|
|
125
|
+
className
|
|
126
|
+
),
|
|
127
|
+
...props
|
|
128
|
+
}
|
|
129
|
+
)
|
|
130
|
+
);
|
|
131
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
132
|
+
const DropdownMenuSeparator = React.forwardRef(
|
|
133
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
134
|
+
DropdownMenuPrimitive.Separator,
|
|
135
|
+
{
|
|
136
|
+
ref,
|
|
137
|
+
className: cn("-mx-1 my-1 h-px bg-muted", className),
|
|
138
|
+
...props
|
|
139
|
+
}
|
|
140
|
+
)
|
|
141
|
+
);
|
|
142
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
143
|
+
const DropdownMenuShortcut = ({ className, ...props }) => {
|
|
144
|
+
return /* @__PURE__ */ jsx(
|
|
145
|
+
"span",
|
|
146
|
+
{
|
|
147
|
+
className: cn("ml-auto text-xs tracking-widest opacity-60", className),
|
|
148
|
+
...props
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
153
|
+
export {
|
|
154
|
+
DropdownMenu,
|
|
155
|
+
DropdownMenuCheckboxItem,
|
|
156
|
+
DropdownMenuContent,
|
|
157
|
+
DropdownMenuGroup,
|
|
158
|
+
DropdownMenuItem,
|
|
159
|
+
DropdownMenuLabel,
|
|
160
|
+
DropdownMenuPortal,
|
|
161
|
+
DropdownMenuRadioGroup,
|
|
162
|
+
DropdownMenuRadioItem,
|
|
163
|
+
DropdownMenuSeparator,
|
|
164
|
+
DropdownMenuShortcut,
|
|
165
|
+
DropdownMenuSub,
|
|
166
|
+
DropdownMenuSubContent,
|
|
167
|
+
DropdownMenuSubTrigger,
|
|
168
|
+
DropdownMenuTrigger
|
|
169
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Controller, FormProvider, useFormContext } from "react-hook-form";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
import { Label } from "../custom/label.js";
|
|
6
|
+
const Form = FormProvider;
|
|
7
|
+
const FormFieldContext = React.createContext({});
|
|
8
|
+
const FormField = ({ ...props }) => {
|
|
9
|
+
return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
|
|
10
|
+
};
|
|
11
|
+
const useFormField = () => {
|
|
12
|
+
const fieldContext = React.useContext(FormFieldContext);
|
|
13
|
+
const itemContext = React.useContext(FormItemContext);
|
|
14
|
+
const { getFieldState, formState } = useFormContext();
|
|
15
|
+
const fieldState = getFieldState(fieldContext.name, formState);
|
|
16
|
+
if (!fieldContext) {
|
|
17
|
+
throw new Error("useFormField should be used within <FormField>");
|
|
18
|
+
}
|
|
19
|
+
const { id } = itemContext;
|
|
20
|
+
return {
|
|
21
|
+
id,
|
|
22
|
+
name: fieldContext.name,
|
|
23
|
+
formItemId: `${id}-form-item`,
|
|
24
|
+
formDescriptionId: `${id}-form-item-description`,
|
|
25
|
+
formMessageId: `${id}-form-item-message`,
|
|
26
|
+
...fieldState
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
const FormItemContext = React.createContext({});
|
|
30
|
+
const FormItem = React.forwardRef(({ className, ...props }, ref) => {
|
|
31
|
+
const id = React.useId();
|
|
32
|
+
return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx("div", { ref, className: cn("space-y-2", className), ...props }) });
|
|
33
|
+
});
|
|
34
|
+
FormItem.displayName = "FormItem";
|
|
35
|
+
const FormLabel = React.forwardRef(({ className, ...props }, ref) => {
|
|
36
|
+
const { formItemId } = useFormField();
|
|
37
|
+
return /* @__PURE__ */ jsx(
|
|
38
|
+
Label,
|
|
39
|
+
{
|
|
40
|
+
ref,
|
|
41
|
+
className: cn(className),
|
|
42
|
+
htmlFor: formItemId,
|
|
43
|
+
...props
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
FormLabel.displayName = "FormLabel";
|
|
48
|
+
const FormControl = React.forwardRef(({ ...props }, ref) => {
|
|
49
|
+
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
50
|
+
return /* @__PURE__ */ jsx(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
ref,
|
|
54
|
+
id: formItemId,
|
|
55
|
+
"aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
|
|
56
|
+
"aria-invalid": !!error,
|
|
57
|
+
...props
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
FormControl.displayName = "FormControl";
|
|
62
|
+
const FormDescription = React.forwardRef(({ className, ...props }, ref) => {
|
|
63
|
+
const { formDescriptionId } = useFormField();
|
|
64
|
+
return /* @__PURE__ */ jsx(
|
|
65
|
+
"p",
|
|
66
|
+
{
|
|
67
|
+
ref,
|
|
68
|
+
id: formDescriptionId,
|
|
69
|
+
className: cn("text-[0.8rem] text-muted-foreground", className),
|
|
70
|
+
...props
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
});
|
|
74
|
+
FormDescription.displayName = "FormDescription";
|
|
75
|
+
const FormMessage = React.forwardRef(
|
|
76
|
+
({ className, children, ...props }, ref) => {
|
|
77
|
+
const { error, formMessageId } = useFormField();
|
|
78
|
+
const body = error && error?.message ? String(error.message) : children;
|
|
79
|
+
if (!body) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
return /* @__PURE__ */ jsx(
|
|
83
|
+
"p",
|
|
84
|
+
{
|
|
85
|
+
ref,
|
|
86
|
+
id: formMessageId,
|
|
87
|
+
className: cn("text-[0.8rem] text-destructive", className),
|
|
88
|
+
...props,
|
|
89
|
+
children: body
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
FormMessage.displayName = "FormMessage";
|
|
95
|
+
export {
|
|
96
|
+
Form,
|
|
97
|
+
FormControl,
|
|
98
|
+
FormDescription,
|
|
99
|
+
FormField,
|
|
100
|
+
FormItem,
|
|
101
|
+
FormLabel,
|
|
102
|
+
FormMessage,
|
|
103
|
+
useFormField
|
|
104
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { jsx, jsxs } 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 Input = React.forwardRef(({ className, type, size, ...props }, ref) => {
|
|
17
|
+
const uncontrolledTypes = ["file", "checkbox", "radio"];
|
|
18
|
+
if (uncontrolledTypes.includes(type) || !Object.prototype.hasOwnProperty.call(props, "value")) {
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
"input",
|
|
21
|
+
{
|
|
22
|
+
type,
|
|
23
|
+
className: cn(
|
|
24
|
+
"flex h-9 w-full rounded-md border border-input bg-card px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:bg-muted",
|
|
25
|
+
fieldVariants({ size }),
|
|
26
|
+
className
|
|
27
|
+
),
|
|
28
|
+
ref,
|
|
29
|
+
...props
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
const normalizedValue = props.value === void 0 ? "" : props.value;
|
|
34
|
+
const { value: _, ...restProps } = props;
|
|
35
|
+
return /* @__PURE__ */ jsx(
|
|
36
|
+
"input",
|
|
37
|
+
{
|
|
38
|
+
type,
|
|
39
|
+
className: cn(
|
|
40
|
+
"flex h-9 w-full rounded-md border border-input bg-card px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:bg-muted",
|
|
41
|
+
fieldVariants({ size }),
|
|
42
|
+
className,
|
|
43
|
+
restProps.error && "border border-[--label-red-foreground] focus-visible:border-[--label-red-foreground] focus-visible:ring-0"
|
|
44
|
+
),
|
|
45
|
+
value: normalizedValue,
|
|
46
|
+
ref,
|
|
47
|
+
...restProps
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
Input.displayName = "Input";
|
|
52
|
+
const InputHightlight = React.forwardRef(
|
|
53
|
+
({ className, type, onChange, ...props }, ref) => {
|
|
54
|
+
const [value, setValue] = React.useState("");
|
|
55
|
+
const internalRef = React.useRef();
|
|
56
|
+
const inputRef = ref || internalRef;
|
|
57
|
+
const highlightText = (text) => {
|
|
58
|
+
const parts = [];
|
|
59
|
+
let lastIndex = 0;
|
|
60
|
+
const regex = /@\S+/g;
|
|
61
|
+
let match;
|
|
62
|
+
while ((match = regex.exec(text)) !== null) {
|
|
63
|
+
if (match.index > lastIndex) {
|
|
64
|
+
parts.push(text.slice(lastIndex, match.index));
|
|
65
|
+
}
|
|
66
|
+
parts.push(
|
|
67
|
+
/* @__PURE__ */ jsx("span", { className: "text-primary", children: match[0] }, match.index)
|
|
68
|
+
);
|
|
69
|
+
lastIndex = match.index + match[0].length;
|
|
70
|
+
}
|
|
71
|
+
if (lastIndex < text.length) {
|
|
72
|
+
parts.push(text.slice(lastIndex));
|
|
73
|
+
}
|
|
74
|
+
return parts;
|
|
75
|
+
};
|
|
76
|
+
const handleChange = (e) => {
|
|
77
|
+
console.log(e);
|
|
78
|
+
setValue(e.target.value);
|
|
79
|
+
if (onChange) {
|
|
80
|
+
onChange(e);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("relative w-full", className), children: [
|
|
84
|
+
/* @__PURE__ */ jsx(
|
|
85
|
+
"div",
|
|
86
|
+
{
|
|
87
|
+
className: cn(
|
|
88
|
+
"pointer-events-none absolute inset-0 whitespace-pre-wrap px-3 py-1 text-sm",
|
|
89
|
+
"flex items-center"
|
|
90
|
+
),
|
|
91
|
+
children: highlightText(value)
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
/* @__PURE__ */ jsx(
|
|
95
|
+
"input",
|
|
96
|
+
{
|
|
97
|
+
type,
|
|
98
|
+
ref: inputRef,
|
|
99
|
+
value,
|
|
100
|
+
onChange: handleChange,
|
|
101
|
+
className: cn(
|
|
102
|
+
"flex h-9 w-full rounded-md border border-input bg-card bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:bg-muted"
|
|
103
|
+
),
|
|
104
|
+
...props
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
] });
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
Input.displayName = "Input";
|
|
111
|
+
InputHightlight.displayName = "InputHightlight";
|
|
112
|
+
export {
|
|
113
|
+
Input,
|
|
114
|
+
InputHightlight
|
|
115
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
const labelVariants = cva(
|
|
7
|
+
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
8
|
+
);
|
|
9
|
+
const Label = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
10
|
+
LabelPrimitive.Root,
|
|
11
|
+
{
|
|
12
|
+
ref,
|
|
13
|
+
className: cn(labelVariants(), className),
|
|
14
|
+
...props
|
|
15
|
+
}
|
|
16
|
+
));
|
|
17
|
+
Label.displayName = LabelPrimitive.Root.displayName;
|
|
18
|
+
export {
|
|
19
|
+
Label
|
|
20
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
const Popover = PopoverPrimitive.Root;
|
|
6
|
+
const PopoverTrigger = PopoverPrimitive.Trigger;
|
|
7
|
+
const PopoverAnchor = PopoverPrimitive.Anchor;
|
|
8
|
+
const PopoverContent = React.forwardRef(
|
|
9
|
+
({ className, align = "center", sideOffset = 4, container, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { container, children: /* @__PURE__ */ jsx(
|
|
10
|
+
PopoverPrimitive.Content,
|
|
11
|
+
{
|
|
12
|
+
ref,
|
|
13
|
+
align,
|
|
14
|
+
sideOffset,
|
|
15
|
+
className: cn(
|
|
16
|
+
"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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",
|
|
17
|
+
className
|
|
18
|
+
),
|
|
19
|
+
...props
|
|
20
|
+
}
|
|
21
|
+
) })
|
|
22
|
+
);
|
|
23
|
+
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
24
|
+
export {
|
|
25
|
+
Popover,
|
|
26
|
+
PopoverAnchor,
|
|
27
|
+
PopoverContent,
|
|
28
|
+
PopoverTrigger
|
|
29
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Check } from "lucide-react";
|
|
4
|
+
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
const RadioCtx = React.createContext(null);
|
|
7
|
+
const RadioGroup = React.forwardRef(
|
|
8
|
+
({ className, value, onValueChange, ...props }, ref) => {
|
|
9
|
+
return /* @__PURE__ */ jsx(RadioCtx.Provider, { value: { value: value ?? "", onValueChange }, children: /* @__PURE__ */ jsx(
|
|
10
|
+
RadioGroupPrimitive.Root,
|
|
11
|
+
{
|
|
12
|
+
ref,
|
|
13
|
+
value: value ?? "",
|
|
14
|
+
onValueChange,
|
|
15
|
+
className: cn("grid gap-2", className),
|
|
16
|
+
...props
|
|
17
|
+
}
|
|
18
|
+
) });
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
|
|
22
|
+
const RadioGroupItem = React.forwardRef(
|
|
23
|
+
({ className, value, ...props }, ref) => {
|
|
24
|
+
const ctx = React.useContext(RadioCtx);
|
|
25
|
+
return /* @__PURE__ */ jsx(
|
|
26
|
+
RadioGroupPrimitive.Item,
|
|
27
|
+
{
|
|
28
|
+
ref,
|
|
29
|
+
value,
|
|
30
|
+
onPointerDown: (e) => {
|
|
31
|
+
if (ctx && ctx.value === value && !props.disabled) {
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
ctx.onValueChange?.("");
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
className: cn(
|
|
37
|
+
"aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow",
|
|
38
|
+
"data-[state=checked]:bg-primary",
|
|
39
|
+
"focus:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
40
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
41
|
+
className
|
|
42
|
+
),
|
|
43
|
+
...props,
|
|
44
|
+
children: /* @__PURE__ */ jsx(RadioGroupPrimitive.Indicator, { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx(Check, { className: "h-3 w-3 stroke-primary-foreground stroke-[3]" }) })
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
50
|
+
export {
|
|
51
|
+
RadioGroup,
|
|
52
|
+
RadioGroupItem
|
|
53
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
const ScrollArea = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
6
|
+
ScrollAreaPrimitive.Root,
|
|
7
|
+
{
|
|
8
|
+
ref,
|
|
9
|
+
className: cn("relative overflow-hidden", className),
|
|
10
|
+
...props,
|
|
11
|
+
children: [
|
|
12
|
+
/* @__PURE__ */ jsx(ScrollAreaPrimitive.Viewport, { className: "h-full w-full rounded-[inherit]", children }),
|
|
13
|
+
/* @__PURE__ */ jsx(ScrollBar, {}),
|
|
14
|
+
/* @__PURE__ */ jsx(ScrollAreaPrimitive.Corner, {})
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
));
|
|
18
|
+
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
19
|
+
const ScrollBar = React.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx(
|
|
20
|
+
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
21
|
+
{
|
|
22
|
+
ref,
|
|
23
|
+
orientation,
|
|
24
|
+
className: cn(
|
|
25
|
+
"flex touch-none select-none transition-colors",
|
|
26
|
+
orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
|
|
27
|
+
orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
|
|
28
|
+
className
|
|
29
|
+
),
|
|
30
|
+
...props,
|
|
31
|
+
children: /* @__PURE__ */ jsx(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
|
|
32
|
+
}
|
|
33
|
+
));
|
|
34
|
+
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
35
|
+
export {
|
|
36
|
+
ScrollArea,
|
|
37
|
+
ScrollBar
|
|
38
|
+
};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import {
|
|
4
|
+
CaretSortIcon,
|
|
5
|
+
CheckIcon,
|
|
6
|
+
ChevronDownIcon,
|
|
7
|
+
ChevronUpIcon
|
|
8
|
+
} from "@radix-ui/react-icons";
|
|
9
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
10
|
+
import { cn } from "../../lib/utils.js";
|
|
11
|
+
const Select = React.forwardRef(({ ...props }, ref) => {
|
|
12
|
+
if (!Object.prototype.hasOwnProperty.call(props, "value")) {
|
|
13
|
+
return /* @__PURE__ */ jsx(SelectPrimitive.Root, { ref, ...props });
|
|
14
|
+
}
|
|
15
|
+
const normalizedValue = props.value === void 0 ? "" : props.value;
|
|
16
|
+
return /* @__PURE__ */ jsx(SelectPrimitive.Root, { ref, value: normalizedValue, ...props });
|
|
17
|
+
});
|
|
18
|
+
Select.displayName = "Select";
|
|
19
|
+
const SelectGroup = SelectPrimitive.Group;
|
|
20
|
+
const SelectValue = SelectPrimitive.Value;
|
|
21
|
+
const SelectTrigger = React.forwardRef(
|
|
22
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
23
|
+
SelectPrimitive.Trigger,
|
|
24
|
+
{
|
|
25
|
+
ref,
|
|
26
|
+
className: cn(
|
|
27
|
+
"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-card px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-0 focus:ring-ring disabled:cursor-not-allowed disabled:bg-muted [&>span]:line-clamp-1",
|
|
28
|
+
className
|
|
29
|
+
),
|
|
30
|
+
...props,
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 truncate text-left", children }),
|
|
33
|
+
/* @__PURE__ */ jsx(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx(CaretSortIcon, { className: "h-4 w-4 flex-shrink-0 opacity-50" }) })
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
);
|
|
38
|
+
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
39
|
+
const SelectScrollUpButton = React.forwardRef(
|
|
40
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
41
|
+
SelectPrimitive.ScrollUpButton,
|
|
42
|
+
{
|
|
43
|
+
ref,
|
|
44
|
+
className: cn(
|
|
45
|
+
"flex cursor-default items-center justify-center py-1",
|
|
46
|
+
className
|
|
47
|
+
),
|
|
48
|
+
...props,
|
|
49
|
+
children: /* @__PURE__ */ jsx(ChevronUpIcon, {})
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
);
|
|
53
|
+
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
54
|
+
const SelectScrollDownButton = React.forwardRef(
|
|
55
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
56
|
+
SelectPrimitive.ScrollDownButton,
|
|
57
|
+
{
|
|
58
|
+
ref,
|
|
59
|
+
className: cn(
|
|
60
|
+
"flex cursor-default items-center justify-center py-1",
|
|
61
|
+
className
|
|
62
|
+
),
|
|
63
|
+
...props,
|
|
64
|
+
children: /* @__PURE__ */ jsx(ChevronDownIcon, {})
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
);
|
|
68
|
+
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
69
|
+
const SelectContent = React.forwardRef(
|
|
70
|
+
({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
71
|
+
SelectPrimitive.Content,
|
|
72
|
+
{
|
|
73
|
+
ref,
|
|
74
|
+
className: cn(
|
|
75
|
+
"relative z-50 max-h-96 w-[var(--radix-select-trigger-width)] min-w-[8rem] max-w-[var(--radix-select-trigger-width)] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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",
|
|
76
|
+
position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
77
|
+
className
|
|
78
|
+
),
|
|
79
|
+
position,
|
|
80
|
+
...props,
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
|
|
83
|
+
/* @__PURE__ */ jsx(
|
|
84
|
+
SelectPrimitive.Viewport,
|
|
85
|
+
{
|
|
86
|
+
className: cn(
|
|
87
|
+
"overflow-x-hidden p-1",
|
|
88
|
+
position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
|
89
|
+
),
|
|
90
|
+
children
|
|
91
|
+
}
|
|
92
|
+
),
|
|
93
|
+
/* @__PURE__ */ jsx(SelectScrollDownButton, {})
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
) })
|
|
97
|
+
);
|
|
98
|
+
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
99
|
+
const SelectLabel = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
100
|
+
SelectPrimitive.Label,
|
|
101
|
+
{
|
|
102
|
+
ref,
|
|
103
|
+
className: cn("px-2 py-1.5 text-sm font-semibold", className),
|
|
104
|
+
...props
|
|
105
|
+
}
|
|
106
|
+
));
|
|
107
|
+
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
108
|
+
const SelectItem = React.forwardRef(
|
|
109
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
110
|
+
SelectPrimitive.Item,
|
|
111
|
+
{
|
|
112
|
+
ref,
|
|
113
|
+
title: typeof children === "string" ? children : void 0,
|
|
114
|
+
className: cn(
|
|
115
|
+
"relative flex w-full min-w-0 max-w-full cursor-default select-none items-center overflow-hidden rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
116
|
+
className
|
|
117
|
+
),
|
|
118
|
+
...props,
|
|
119
|
+
children: [
|
|
120
|
+
/* @__PURE__ */ jsx("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "h-4 w-4" }) }) }),
|
|
121
|
+
/* @__PURE__ */ jsx(SelectPrimitive.ItemText, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "block min-w-0 flex-1 truncate", children }) })
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
);
|
|
126
|
+
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
127
|
+
const SelectSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
128
|
+
SelectPrimitive.Separator,
|
|
129
|
+
{
|
|
130
|
+
ref,
|
|
131
|
+
className: cn("-mx-1 my-1 h-px bg-muted", className),
|
|
132
|
+
...props
|
|
133
|
+
}
|
|
134
|
+
));
|
|
135
|
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
136
|
+
export {
|
|
137
|
+
Select,
|
|
138
|
+
SelectContent,
|
|
139
|
+
SelectGroup,
|
|
140
|
+
SelectItem,
|
|
141
|
+
SelectLabel,
|
|
142
|
+
SelectScrollDownButton,
|
|
143
|
+
SelectScrollUpButton,
|
|
144
|
+
SelectSeparator,
|
|
145
|
+
SelectTrigger,
|
|
146
|
+
SelectValue
|
|
147
|
+
};
|