@adatechnology/conversations-ui 0.19.0 → 0.20.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/README.md CHANGED
@@ -569,3 +569,9 @@ pública e não mudam sem nova versão maior.
569
569
  `ConversationChannel` agora inclui `'app'` e `'portal'`. Quem tem um `switch` exaustivo sobre o tipo (sem
570
570
  `default`) passa a ter erro de compilação até tratar os dois novos valores. Quem só escreve o tipo não é
571
571
  afetado.
572
+
573
+ ## Seletor de data próprio (`renderDateInput`)
574
+
575
+ O filtro por período de `DocumentsWorkspace` usa `<input type="date">` por padrão. Passe
576
+ `renderDateInput` para usar o seletor do seu design system; recebe `{ label, value, onChange }`, com
577
+ valor `YYYY-MM-DD` ou vazio, e é chamado uma vez para a data inicial e outra para a final.
package/dist/index.d.ts CHANGED
@@ -1118,12 +1118,22 @@ interface DocumentsWorkspaceProps {
1118
1118
  readonly classNames?: Partial<DocumentsWorkspaceClassNames>;
1119
1119
  /** Espelhar filtros e paginação na URL. Desligado em preview, onde não há rota de verdade. */
1120
1120
  readonly syncUrl?: boolean;
1121
+ /** Seletor de data do host para o recorte por período. Padrão: `<input type="date">`. */
1122
+ readonly renderDateInput?: RenderDateInput;
1121
1123
  }
1124
+ interface DateInputProps {
1125
+ readonly label: string;
1126
+ /** `YYYY-MM-DD` ou vazio. */
1127
+ readonly value: string;
1128
+ readonly onChange: (value: string) => void;
1129
+ }
1130
+ /** Troca o `<input type="date">` nativo pelo seletor de data do host. */
1131
+ type RenderDateInput = (props: DateInputProps) => ReactNode;
1122
1132
  interface DocumentsFiltersContext {
1123
1133
  readonly extra: Readonly<Record<string, string | number>>;
1124
1134
  readonly setExtra: (next: Readonly<Record<string, string | number>>) => void;
1125
1135
  }
1126
- declare function DocumentsWorkspace({ perPage: initialPerPage, perPageOptions, onOpenConversation, sources, categories, dateFilter, renderFilters, labels: labelsOverride, className, classNames, syncUrl, }: DocumentsWorkspaceProps): react.JSX.Element | null;
1136
+ declare function DocumentsWorkspace({ perPage: initialPerPage, perPageOptions, onOpenConversation, sources, categories, dateFilter, renderFilters, labels: labelsOverride, className, classNames, syncUrl, renderDateInput, }: DocumentsWorkspaceProps): react.JSX.Element | null;
1127
1137
 
1128
1138
  /**
1129
1139
  * Estado de listagem espelhado na URL — ordenação, filtros e paginação (regra `web.md` §7).
@@ -2397,4 +2407,4 @@ type QueuedAttachmentsListProps = {
2397
2407
  };
2398
2408
  declare function QueuedAttachmentsList({ items, statusOf, onRemove, onRetry, retryingKeys, getThumbnailUrl, labels, busy, }: QueuedAttachmentsListProps): react.JSX.Element | null;
2399
2409
 
2400
- export { type AsyncResourceState, type AttachmentFileRejection, AudioPlayer, type AudioPlayerProps, AudioTranscription, type AudioTranscriptionProps, Avatar, type AvatarLabels, type AvatarProps, type BotMessages, type BuildTranscriptTextParams, BulkActionBar, type BulkActionBarProps, CHANNEL_BRAND_COLOR, CONVERSATIONS_PER_PAGE, CONVERSATION_WINDOW, ChannelFilter, ChannelFilterOption, ChannelIcon, type ChannelIconProps, ConversationChannel, type ConversationContextEntry, ConversationContextPanel, type ConversationContextPanelClassNames, type ConversationContextPanelLabels, type ConversationContextPanelProps, type ConversationContextStatus, ConversationDocument, ConversationDocumentsPanel, type ConversationDocumentsPanelClassNames, type ConversationDocumentsPanelLabels, type ConversationDocumentsPanelProps, ConversationHeader, type ConversationHeaderClassNames, type ConversationHeaderLabels, type ConversationHeaderProps, type ConversationHeaderUtility, ConversationListItem, type ConversationListItemLabels, type ConversationListItemProps, type ConversationLocales, ConversationLocalesProvider, type ConversationLocalesProviderProps, ConversationPane, type ConversationPaneProps, type ConversationRealtimeHandler, ConversationRow, type ConversationRowClassNames, type ConversationRowProps, ConversationSimulatorClient, ConversationSummary, ConversationTemplate, ConversationVariable, ConversationWallpaper, type ConversationWallpaperProps, type ConversationWindow, ConversationsApi, ConversationsFeatures, ConversationsInboxList, type ConversationsInboxListProps, ConversationsProvider, ConversationsWorkspace, type ConversationsWorkspaceLabels, type ConversationsWorkspaceProps, type ConversationsWorkspaceSimulator, type CreateMetaWhatsAppQuickRepliesClientParams, DEFAULT_ACCEPTED_FILE_TYPES, DEFAULT_AVATAR_LABELS, DEFAULT_CONVERSATIONS_WORKSPACE_LABELS, DEFAULT_CONVERSATION_CONTEXT_LABELS, DEFAULT_CONVERSATION_DOCUMENTS_LABELS, DEFAULT_CONVERSATION_HEADER_LABELS, DEFAULT_CONVERSATION_LIST_ITEM_LABELS, DEFAULT_DARK_MODE_TOGGLE_LABELS, DEFAULT_DOCUMENTS_LIBRARY_LABELS, DEFAULT_DOCUMENTS_WORKSPACE_LABELS, DEFAULT_EMOJI_PICKER_LABELS, DEFAULT_INTERACTIVE_MESSAGE_LABELS, DEFAULT_LIGHTBOX_LABELS, DEFAULT_MAX_ATTACHMENT_SIZE_BYTES, DEFAULT_MAX_RECORDING_MILLISECONDS, DEFAULT_MESSAGE_COMPOSER_LABELS, DEFAULT_QUICK_REPLIES_PICKER_LABELS, DEFAULT_QUICK_REPLIES_WORKSPACE_LABELS, DEFAULT_RICH_COMPOSER_TOOLTIPS, DEFAULT_TEMPLATES_SETTINGS_LABELS, DEFAULT_WHATSAPP_MESSAGE_EDITOR_LABELS, DEFAULT_WINDOW_EXPIRED_LABELS, DOCUMENT_SOURCE_FILTER, DarkModeToggle, type DarkModeToggleLabels, type DarkModeToggleProps, DateDivider, type DateDividerClassNames, type DateDividerProps, type DocumentSourceFilter, type DocumentsFiltersContext, DocumentsLibrary, type DocumentsLibraryClassNames, type DocumentsLibraryLabels, type DocumentsLibraryProps, DocumentsWorkspace, type DocumentsWorkspaceClassNames, type DocumentsWorkspaceLabels, type DocumentsWorkspaceProps, EMOJI_CATEGORIES, type EmojiCategory, type EmojiEntry, EmojiPicker, type EmojiPickerLabels, type EmojiPickerProps, FileIcon, type FileIconProps, type FilterOption, type FilterQuickRepliesParams, InteractiveMessage, type InteractiveMessageLabels, type InteractiveMessageProps, InteractivePayload, InteractiveSelection, Lightbox, type LightboxLabels, type LightboxProps, ListConversationsParams, ListDocumentsParams, ListingPagination, type ListingPaginationProps, type MatchSegment, type MaxAttachmentSizeBytes, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerClassNames, type MessageComposerLabels, type MessageComposerProps, MessagePayload, MessageTail, MessageText, type MessageTextProps, MessageTimestamp, MessageTranscription, MessagesWorkspace, type MessagesWorkspaceApi, type MessagesWorkspaceLabels, type MessagesWorkspaceProps, type MessagesWorkspaceTemplateRole, type MetaWhatsAppQuickRepliesClient, MultiSelectFilter, type MultiSelectFilterProps, NARROW_MAX_WIDTH_PX, type OutgoingItems, QueuedAttachment, QueuedAttachmentsList, QuickRepliesApiError, type QuickRepliesApiErrorDetail, QuickRepliesPicker, type QuickRepliesPickerLabels, type QuickRepliesPickerProps, QuickRepliesWorkspace, type QuickRepliesWorkspaceLabels, type QuickRepliesWorkspaceProps, type QuickReply, QuickReplyAttachment, QuickReplyInput, REPLY_LATENCY, REPLY_LATENCY_CRITICAL_HOURS, REPLY_LATENCY_LATE_HOURS, RICH_COMPOSER_ACTION, type ReplyLatency, type ReplyLatencyParams, ResolveMediaUrl, type RichComposerAction, type RichComposerQuickReply, type RichComposerTooltips, type RichComposerVariable, RichMessageComposer, type RichMessageComposerHandle, type RichMessageComposerProps, SSEProvider, QuickReply$1 as SavedQuickReply, SimpleEmojiPicker, type SimpleEmojiPickerProps, type SimulatorTestContact, type SimulatorTransportFactory, type SimulatorTransportParams, type SortDirection, SortableHead, type SortableHeadProps, StatusTicks, type StatusTicksProps, TEMPLATE_SETTINGS_TAB, TEST_CONTACT_LABEL, TOOLTIP_ATTRIBUTE, type TemplateSettings, type TemplateSettingsTab, ToastProvider, TooltipLayer, type TopicItem, TopicsForm, type TopicsFormLabels, type TopicsFormProps, TranscriptionMode, type TranscriptionSettings, TranscriptionSettingsForm, type TranscriptionSettingsFormLabels, type TranscriptionSettingsFormProps, type UrlStateOptions, type UseConversationActionsResult, type UseConversationContextResult, type UseConversationDocumentsParams, type UseConversationDocumentsResult, type UseConversationListParams, type UseConversationListResult, type UseConversationMessagesResult, type UseConversationsInboxParams, type UseConversationsInboxResult, type UseInboxActionsResult, type UseScrollToLatestMessageParams, type UseScrollToLatestMessageResult, type UseWaitingNotificationsLabels, type UseWaitingNotificationsParams, type UseWaitingNotificationsResult, type ValidateAttachmentFilesResult, WHATSAPP_MARKER_BY_ACTION, WINDOW_FILTERS, WelcomeFarewellForm, type WelcomeFarewellFormLabels, type WelcomeFarewellFormProps, WhatsAppCreateTemplateForm, type WhatsAppCreateTemplateFormLabels, type WhatsAppCreateTemplateFormProps, type WhatsAppCreateTemplateResult, type WhatsAppCreateTemplateState, WhatsAppMessageEditor, type WhatsAppMessageEditorLabels, type WhatsAppMessageEditorProps, WhatsAppMessagePreview, type WhatsAppMessagePreviewProps, type WhatsAppTemplateHeaderType, WhatsAppTemplateSettingsForm, type WhatsAppTemplateSettingsFormLabels, type WhatsAppTemplateSettingsFormProps, type WhatsAppTemplateSummary, type WhatsAppTemplateVariableSuggestion, WhatsAppTemplatesSettings, type WhatsAppTemplatesSettingsLabels, type WhatsAppTemplatesSettingsProps, WindowExpiredNotice, type WindowExpiredNoticeLabels, type WindowExpiredNoticeProps, type WindowOfParams, applyQuickReplyVariables, buildTranscriptFilename, buildTranscriptText, channelCapabilityFor, createMediaUrlResolver, createMetaWhatsAppQuickRepliesClient, downloadTextFile, filterQuickReplies, formatDateTime, formatFileSize, formatPhone, formatStalledFor, formatTimestamp, highlightMatch, htmlToWA, isReplyOverdue, isSameDay, isTestContactNumber, isWindowBlocking, normalizeForSearch, parseWhatsAppFormatting, phoneInitials, queuedAttachmentsFromQuickReply, replyLatencyOf, resolveMaxAttachmentSizeBytes, resolveQuickReply, searchEmojis, toast, useConversationActions, useConversationContext, useConversationDocuments, useConversationList, useConversationLocales, useConversationMessages, useConversationRealtime, useConversations, useConversationsInbox, useDarkMode, useDebouncedValue, useGlobalRealtime, useInboxActions, useIsDarkTheme, useIsNarrow, useScrollToLatestMessage, useToast, useUrlArrayState, useUrlNumberState, useUrlStringState, useWaitingNotifications, waToHTML, waToHTMLInline, windowOf };
2410
+ export { type AsyncResourceState, type AttachmentFileRejection, AudioPlayer, type AudioPlayerProps, AudioTranscription, type AudioTranscriptionProps, Avatar, type AvatarLabels, type AvatarProps, type BotMessages, type BuildTranscriptTextParams, BulkActionBar, type BulkActionBarProps, CHANNEL_BRAND_COLOR, CONVERSATIONS_PER_PAGE, CONVERSATION_WINDOW, ChannelFilter, ChannelFilterOption, ChannelIcon, type ChannelIconProps, ConversationChannel, type ConversationContextEntry, ConversationContextPanel, type ConversationContextPanelClassNames, type ConversationContextPanelLabels, type ConversationContextPanelProps, type ConversationContextStatus, ConversationDocument, ConversationDocumentsPanel, type ConversationDocumentsPanelClassNames, type ConversationDocumentsPanelLabels, type ConversationDocumentsPanelProps, ConversationHeader, type ConversationHeaderClassNames, type ConversationHeaderLabels, type ConversationHeaderProps, type ConversationHeaderUtility, ConversationListItem, type ConversationListItemLabels, type ConversationListItemProps, type ConversationLocales, ConversationLocalesProvider, type ConversationLocalesProviderProps, ConversationPane, type ConversationPaneProps, type ConversationRealtimeHandler, ConversationRow, type ConversationRowClassNames, type ConversationRowProps, ConversationSimulatorClient, ConversationSummary, ConversationTemplate, ConversationVariable, ConversationWallpaper, type ConversationWallpaperProps, type ConversationWindow, ConversationsApi, ConversationsFeatures, ConversationsInboxList, type ConversationsInboxListProps, ConversationsProvider, ConversationsWorkspace, type ConversationsWorkspaceLabels, type ConversationsWorkspaceProps, type ConversationsWorkspaceSimulator, type CreateMetaWhatsAppQuickRepliesClientParams, DEFAULT_ACCEPTED_FILE_TYPES, DEFAULT_AVATAR_LABELS, DEFAULT_CONVERSATIONS_WORKSPACE_LABELS, DEFAULT_CONVERSATION_CONTEXT_LABELS, DEFAULT_CONVERSATION_DOCUMENTS_LABELS, DEFAULT_CONVERSATION_HEADER_LABELS, DEFAULT_CONVERSATION_LIST_ITEM_LABELS, DEFAULT_DARK_MODE_TOGGLE_LABELS, DEFAULT_DOCUMENTS_LIBRARY_LABELS, DEFAULT_DOCUMENTS_WORKSPACE_LABELS, DEFAULT_EMOJI_PICKER_LABELS, DEFAULT_INTERACTIVE_MESSAGE_LABELS, DEFAULT_LIGHTBOX_LABELS, DEFAULT_MAX_ATTACHMENT_SIZE_BYTES, DEFAULT_MAX_RECORDING_MILLISECONDS, DEFAULT_MESSAGE_COMPOSER_LABELS, DEFAULT_QUICK_REPLIES_PICKER_LABELS, DEFAULT_QUICK_REPLIES_WORKSPACE_LABELS, DEFAULT_RICH_COMPOSER_TOOLTIPS, DEFAULT_TEMPLATES_SETTINGS_LABELS, DEFAULT_WHATSAPP_MESSAGE_EDITOR_LABELS, DEFAULT_WINDOW_EXPIRED_LABELS, DOCUMENT_SOURCE_FILTER, DarkModeToggle, type DarkModeToggleLabels, type DarkModeToggleProps, DateDivider, type DateDividerClassNames, type DateDividerProps, type DateInputProps, type DocumentSourceFilter, type DocumentsFiltersContext, DocumentsLibrary, type DocumentsLibraryClassNames, type DocumentsLibraryLabels, type DocumentsLibraryProps, DocumentsWorkspace, type DocumentsWorkspaceClassNames, type DocumentsWorkspaceLabels, type DocumentsWorkspaceProps, EMOJI_CATEGORIES, type EmojiCategory, type EmojiEntry, EmojiPicker, type EmojiPickerLabels, type EmojiPickerProps, FileIcon, type FileIconProps, type FilterOption, type FilterQuickRepliesParams, InteractiveMessage, type InteractiveMessageLabels, type InteractiveMessageProps, InteractivePayload, InteractiveSelection, Lightbox, type LightboxLabels, type LightboxProps, ListConversationsParams, ListDocumentsParams, ListingPagination, type ListingPaginationProps, type MatchSegment, type MaxAttachmentSizeBytes, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerClassNames, type MessageComposerLabels, type MessageComposerProps, MessagePayload, MessageTail, MessageText, type MessageTextProps, MessageTimestamp, MessageTranscription, MessagesWorkspace, type MessagesWorkspaceApi, type MessagesWorkspaceLabels, type MessagesWorkspaceProps, type MessagesWorkspaceTemplateRole, type MetaWhatsAppQuickRepliesClient, MultiSelectFilter, type MultiSelectFilterProps, NARROW_MAX_WIDTH_PX, type OutgoingItems, QueuedAttachment, QueuedAttachmentsList, QuickRepliesApiError, type QuickRepliesApiErrorDetail, QuickRepliesPicker, type QuickRepliesPickerLabels, type QuickRepliesPickerProps, QuickRepliesWorkspace, type QuickRepliesWorkspaceLabels, type QuickRepliesWorkspaceProps, type QuickReply, QuickReplyAttachment, QuickReplyInput, REPLY_LATENCY, REPLY_LATENCY_CRITICAL_HOURS, REPLY_LATENCY_LATE_HOURS, RICH_COMPOSER_ACTION, type RenderDateInput, type ReplyLatency, type ReplyLatencyParams, ResolveMediaUrl, type RichComposerAction, type RichComposerQuickReply, type RichComposerTooltips, type RichComposerVariable, RichMessageComposer, type RichMessageComposerHandle, type RichMessageComposerProps, SSEProvider, QuickReply$1 as SavedQuickReply, SimpleEmojiPicker, type SimpleEmojiPickerProps, type SimulatorTestContact, type SimulatorTransportFactory, type SimulatorTransportParams, type SortDirection, SortableHead, type SortableHeadProps, StatusTicks, type StatusTicksProps, TEMPLATE_SETTINGS_TAB, TEST_CONTACT_LABEL, TOOLTIP_ATTRIBUTE, type TemplateSettings, type TemplateSettingsTab, ToastProvider, TooltipLayer, type TopicItem, TopicsForm, type TopicsFormLabels, type TopicsFormProps, TranscriptionMode, type TranscriptionSettings, TranscriptionSettingsForm, type TranscriptionSettingsFormLabels, type TranscriptionSettingsFormProps, type UrlStateOptions, type UseConversationActionsResult, type UseConversationContextResult, type UseConversationDocumentsParams, type UseConversationDocumentsResult, type UseConversationListParams, type UseConversationListResult, type UseConversationMessagesResult, type UseConversationsInboxParams, type UseConversationsInboxResult, type UseInboxActionsResult, type UseScrollToLatestMessageParams, type UseScrollToLatestMessageResult, type UseWaitingNotificationsLabels, type UseWaitingNotificationsParams, type UseWaitingNotificationsResult, type ValidateAttachmentFilesResult, WHATSAPP_MARKER_BY_ACTION, WINDOW_FILTERS, WelcomeFarewellForm, type WelcomeFarewellFormLabels, type WelcomeFarewellFormProps, WhatsAppCreateTemplateForm, type WhatsAppCreateTemplateFormLabels, type WhatsAppCreateTemplateFormProps, type WhatsAppCreateTemplateResult, type WhatsAppCreateTemplateState, WhatsAppMessageEditor, type WhatsAppMessageEditorLabels, type WhatsAppMessageEditorProps, WhatsAppMessagePreview, type WhatsAppMessagePreviewProps, type WhatsAppTemplateHeaderType, WhatsAppTemplateSettingsForm, type WhatsAppTemplateSettingsFormLabels, type WhatsAppTemplateSettingsFormProps, type WhatsAppTemplateSummary, type WhatsAppTemplateVariableSuggestion, WhatsAppTemplatesSettings, type WhatsAppTemplatesSettingsLabels, type WhatsAppTemplatesSettingsProps, WindowExpiredNotice, type WindowExpiredNoticeLabels, type WindowExpiredNoticeProps, type WindowOfParams, applyQuickReplyVariables, buildTranscriptFilename, buildTranscriptText, channelCapabilityFor, createMediaUrlResolver, createMetaWhatsAppQuickRepliesClient, downloadTextFile, filterQuickReplies, formatDateTime, formatFileSize, formatPhone, formatStalledFor, formatTimestamp, highlightMatch, htmlToWA, isReplyOverdue, isSameDay, isTestContactNumber, isWindowBlocking, normalizeForSearch, parseWhatsAppFormatting, phoneInitials, queuedAttachmentsFromQuickReply, replyLatencyOf, resolveMaxAttachmentSizeBytes, resolveQuickReply, searchEmojis, toast, useConversationActions, useConversationContext, useConversationDocuments, useConversationList, useConversationLocales, useConversationMessages, useConversationRealtime, useConversations, useConversationsInbox, useDarkMode, useDebouncedValue, useGlobalRealtime, useInboxActions, useIsDarkTheme, useIsNarrow, useScrollToLatestMessage, useToast, useUrlArrayState, useUrlNumberState, useUrlStringState, useWaitingNotifications, waToHTML, waToHTMLInline, windowOf };
package/dist/index.js CHANGED
@@ -2393,7 +2393,8 @@ function DocumentsWorkspace({
2393
2393
  labels: labelsOverride,
2394
2394
  className,
2395
2395
  classNames,
2396
- syncUrl = true
2396
+ syncUrl = true,
2397
+ renderDateInput
2397
2398
  }) {
2398
2399
  const labels = { ...DEFAULT_DOCUMENTS_WORKSPACE_LABELS, ...labelsOverride };
2399
2400
  const context = useConversations();
@@ -2461,7 +2462,20 @@ function DocumentsWorkspace({
2461
2462
  return () => {
2462
2463
  active = false;
2463
2464
  };
2464
- }, [fetchAll, debouncedSearch, source, category, startDate, endDate, sortField, sortDirection, page, perPage, extraKey, reloadToken]);
2465
+ }, [
2466
+ fetchAll,
2467
+ debouncedSearch,
2468
+ source,
2469
+ category,
2470
+ startDate,
2471
+ endDate,
2472
+ sortField,
2473
+ sortDirection,
2474
+ page,
2475
+ perPage,
2476
+ extraKey,
2477
+ reloadToken
2478
+ ]);
2465
2479
  useEffect7(() => {
2466
2480
  setPage(1);
2467
2481
  setSelectedIds(/* @__PURE__ */ new Set());
@@ -2566,7 +2580,10 @@ function DocumentsWorkspace({
2566
2580
  onChange: setCategory
2567
2581
  }
2568
2582
  ) : null,
2569
- dateFilter ? /* @__PURE__ */ jsxs14(Fragment5, { children: [
2583
+ dateFilter ? /* @__PURE__ */ jsx17(Fragment5, { children: renderDateInput ? /* @__PURE__ */ jsxs14(Fragment5, { children: [
2584
+ renderDateInput({ label: labels.startDate, value: startDate, onChange: setStartDate }),
2585
+ renderDateInput({ label: labels.endDate, value: endDate, onChange: setEndDate })
2586
+ ] }) : /* @__PURE__ */ jsxs14(Fragment5, { children: [
2570
2587
  /* @__PURE__ */ jsx17(
2571
2588
  "input",
2572
2589
  {
@@ -2587,12 +2604,22 @@ function DocumentsWorkspace({
2587
2604
  className: "rounded-md border border-gray-300 px-2 py-2 text-xs dark:border-gray-700 dark:bg-gray-900"
2588
2605
  }
2589
2606
  )
2590
- ] }) : null,
2607
+ ] }) }) : null,
2591
2608
  renderFilters?.({ extra, setExtra }),
2592
- hasFilters ? /* @__PURE__ */ jsxs14("button", { "data-cv-tooltip": labels.clearFilters, "aria-label": labels.clearFilters, type: "button", onClick: clearFilters, className: "cv-header-action inline-flex items-center gap-1", children: [
2593
- /* @__PURE__ */ jsx17(X3, { size: 12, "aria-hidden": "true" }),
2594
- labels.clearFilters
2595
- ] }) : null,
2609
+ hasFilters ? /* @__PURE__ */ jsxs14(
2610
+ "button",
2611
+ {
2612
+ "data-cv-tooltip": labels.clearFilters,
2613
+ "aria-label": labels.clearFilters,
2614
+ type: "button",
2615
+ onClick: clearFilters,
2616
+ className: "cv-header-action inline-flex items-center gap-1",
2617
+ children: [
2618
+ /* @__PURE__ */ jsx17(X3, { size: 12, "aria-hidden": "true" }),
2619
+ labels.clearFilters
2620
+ ]
2621
+ }
2622
+ ) : null,
2596
2623
  uploadDocument ? /* @__PURE__ */ jsxs14(Fragment5, { children: [
2597
2624
  /* @__PURE__ */ jsx17(
2598
2625
  "input",
@@ -2655,7 +2682,8 @@ function DocumentsWorkspace({
2655
2682
  "aria-label": labels.bulkRemove(selectedIds.size),
2656
2683
  type: "button",
2657
2684
  onClick: () => {
2658
- if (window.confirm(labels.bulkRemoveConfirm(selectedIds.size))) void handleRemove(Array.from(selectedIds));
2685
+ if (window.confirm(labels.bulkRemoveConfirm(selectedIds.size)))
2686
+ void handleRemove(Array.from(selectedIds));
2659
2687
  },
2660
2688
  disabled: busy,
2661
2689
  className: "cv-header-action cv-header-action--danger inline-flex items-center gap-1 disabled:opacity-40",
@@ -2683,12 +2711,71 @@ function DocumentsWorkspace({
2683
2711
  className: "cursor-pointer rounded border-gray-300 text-blue-600 dark:border-gray-600"
2684
2712
  }
2685
2713
  ) }) : null,
2686
- /* @__PURE__ */ jsx17(SortableHead, { label: labels.columnFilename, field: "filename", activeField: sortField, direction, onSort: toggleSort }),
2687
- /* @__PURE__ */ jsx17(SortableHead, { label: labels.columnContact, field: "conversationId", activeField: sortField, direction, onSort: toggleSort, className: "hidden sm:table-cell" }),
2688
- /* @__PURE__ */ jsx17(SortableHead, { label: labels.columnType, field: "mimeType", activeField: sortField, direction, onSort: toggleSort, className: "hidden md:table-cell" }),
2689
- /* @__PURE__ */ jsx17(SortableHead, { label: labels.columnSize, field: "sizeBytes", activeField: sortField, direction, onSort: toggleSort, className: "hidden lg:table-cell" }),
2690
- /* @__PURE__ */ jsx17(SortableHead, { label: labels.columnSource, field: "source", activeField: sortField, direction, onSort: toggleSort, className: "hidden lg:table-cell" }),
2691
- /* @__PURE__ */ jsx17(SortableHead, { label: labels.columnDate, field: "linkedAt", activeField: sortField, direction, onSort: toggleSort, className: "hidden xl:table-cell" }),
2714
+ /* @__PURE__ */ jsx17(
2715
+ SortableHead,
2716
+ {
2717
+ label: labels.columnFilename,
2718
+ field: "filename",
2719
+ activeField: sortField,
2720
+ direction,
2721
+ onSort: toggleSort
2722
+ }
2723
+ ),
2724
+ /* @__PURE__ */ jsx17(
2725
+ SortableHead,
2726
+ {
2727
+ label: labels.columnContact,
2728
+ field: "conversationId",
2729
+ activeField: sortField,
2730
+ direction,
2731
+ onSort: toggleSort,
2732
+ className: "hidden sm:table-cell"
2733
+ }
2734
+ ),
2735
+ /* @__PURE__ */ jsx17(
2736
+ SortableHead,
2737
+ {
2738
+ label: labels.columnType,
2739
+ field: "mimeType",
2740
+ activeField: sortField,
2741
+ direction,
2742
+ onSort: toggleSort,
2743
+ className: "hidden md:table-cell"
2744
+ }
2745
+ ),
2746
+ /* @__PURE__ */ jsx17(
2747
+ SortableHead,
2748
+ {
2749
+ label: labels.columnSize,
2750
+ field: "sizeBytes",
2751
+ activeField: sortField,
2752
+ direction,
2753
+ onSort: toggleSort,
2754
+ className: "hidden lg:table-cell"
2755
+ }
2756
+ ),
2757
+ /* @__PURE__ */ jsx17(
2758
+ SortableHead,
2759
+ {
2760
+ label: labels.columnSource,
2761
+ field: "source",
2762
+ activeField: sortField,
2763
+ direction,
2764
+ onSort: toggleSort,
2765
+ className: "hidden lg:table-cell"
2766
+ }
2767
+ ),
2768
+ /* @__PURE__ */ jsx17(
2769
+ SortableHead,
2770
+ {
2771
+ label: labels.columnDate,
2772
+ field: "linkedAt",
2773
+ activeField: sortField,
2774
+ direction,
2775
+ onSort: toggleSort,
2776
+ className: "hidden xl:table-cell"
2777
+ }
2778
+ ),
2692
2779
  /* @__PURE__ */ jsx17("th", { scope: "col", className: "px-3 py-2 text-left text-xs font-medium", children: labels.columnActions })
2693
2780
  ] }) }),
2694
2781
  /* @__PURE__ */ jsx17("tbody", { children: documents.map((document2) => /* @__PURE__ */ jsxs14("tr", { className: classNames?.row, children: [
package/dist/styles.css CHANGED
@@ -388,6 +388,10 @@
388
388
  padding: 0.5rem 0.75rem;
389
389
  font-size: 0.875rem;
390
390
  min-height: 2.75rem;
391
+ transition:
392
+ background-color 150ms ease-out,
393
+ color 150ms ease-out,
394
+ border-color 150ms ease-out;
391
395
  }
392
396
  .cv-workspace-toggle:disabled {
393
397
  opacity: 0.5;
@@ -628,6 +632,21 @@
628
632
  white-space: nowrap;
629
633
  border-radius: 0.375rem;
630
634
  padding: 0.25rem 0.5rem;
635
+ transition:
636
+ background-color 150ms ease-out,
637
+ color 150ms ease-out,
638
+ border-color 150ms ease-out;
639
+ }
640
+ .cv-workspace-chip:focus-visible,
641
+ .cv-workspace-toggle:focus-visible {
642
+ outline: 2px solid rgb(37 99 235);
643
+ outline-offset: 2px;
644
+ }
645
+ @media (prefers-reduced-motion: reduce) {
646
+ .cv-workspace-chip,
647
+ .cv-workspace-toggle {
648
+ transition: none;
649
+ }
631
650
  }
632
651
  .cv-workspace-chip--on {
633
652
  background: rgb(229 231 235);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adatechnology/conversations-ui",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "description": "WhatsApp conversation UI components — parametrizável por endpoint, tema e feature flags",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -65,8 +65,20 @@ export interface DocumentsWorkspaceProps {
65
65
  readonly classNames?: Partial<DocumentsWorkspaceClassNames>
66
66
  /** Espelhar filtros e paginação na URL. Desligado em preview, onde não há rota de verdade. */
67
67
  readonly syncUrl?: boolean
68
+ /** Seletor de data do host para o recorte por período. Padrão: `<input type="date">`. */
69
+ readonly renderDateInput?: RenderDateInput
68
70
  }
69
71
 
72
+ export interface DateInputProps {
73
+ readonly label: string
74
+ /** `YYYY-MM-DD` ou vazio. */
75
+ readonly value: string
76
+ readonly onChange: (value: string) => void
77
+ }
78
+
79
+ /** Troca o `<input type="date">` nativo pelo seletor de data do host. */
80
+ export type RenderDateInput = (props: DateInputProps) => ReactNode
81
+
70
82
  export interface DocumentsFiltersContext {
71
83
  readonly extra: Readonly<Record<string, string | number>>
72
84
  readonly setExtra: (next: Readonly<Record<string, string | number>>) => void
@@ -84,6 +96,7 @@ export function DocumentsWorkspace({
84
96
  className,
85
97
  classNames,
86
98
  syncUrl = true,
99
+ renderDateInput,
87
100
  }: DocumentsWorkspaceProps) {
88
101
  const labels = { ...DEFAULT_DOCUMENTS_WORKSPACE_LABELS, ...labelsOverride }
89
102
  const context = useConversations()
@@ -172,14 +185,25 @@ export function DocumentsWorkspace({
172
185
  }
173
186
  // `extraKey` no lugar de `extra`: o objeto é remontado a cada render do host e a identidade
174
187
  // sozinha dispararia a busca em loop.
175
-
176
- }, [fetchAll, debouncedSearch, source, category, startDate, endDate, sortField, sortDirection, page, perPage, extraKey, reloadToken])
188
+ }, [
189
+ fetchAll,
190
+ debouncedSearch,
191
+ source,
192
+ category,
193
+ startDate,
194
+ endDate,
195
+ sortField,
196
+ sortDirection,
197
+ page,
198
+ perPage,
199
+ extraKey,
200
+ reloadToken,
201
+ ])
177
202
 
178
203
  // Trocar de filtro mantendo a página 7 mostra "nenhum resultado" com dados existindo na página 1.
179
204
  useEffect(() => {
180
205
  setPage(1)
181
206
  setSelectedIds(new Set())
182
-
183
207
  }, [debouncedSearch, source, category, startDate, endDate, perPage, extraKey])
184
208
 
185
209
  function toggleSort(field: string): void {
@@ -298,27 +322,42 @@ export function DocumentsWorkspace({
298
322
 
299
323
  {dateFilter ? (
300
324
  <>
301
- <input
302
- type="date"
303
- value={startDate}
304
- onChange={(event) => setStartDate(event.target.value)}
305
- aria-label={labels.startDate}
306
- className="rounded-md border border-gray-300 px-2 py-2 text-xs dark:border-gray-700 dark:bg-gray-900"
307
- />
308
- <input
309
- type="date"
310
- value={endDate}
311
- onChange={(event) => setEndDate(event.target.value)}
312
- aria-label={labels.endDate}
313
- className="rounded-md border border-gray-300 px-2 py-2 text-xs dark:border-gray-700 dark:bg-gray-900"
314
- />
325
+ {renderDateInput ? (
326
+ <>
327
+ {renderDateInput({ label: labels.startDate, value: startDate, onChange: setStartDate })}
328
+ {renderDateInput({ label: labels.endDate, value: endDate, onChange: setEndDate })}
329
+ </>
330
+ ) : (
331
+ <>
332
+ <input
333
+ type="date"
334
+ value={startDate}
335
+ onChange={(event) => setStartDate(event.target.value)}
336
+ aria-label={labels.startDate}
337
+ className="rounded-md border border-gray-300 px-2 py-2 text-xs dark:border-gray-700 dark:bg-gray-900"
338
+ />
339
+ <input
340
+ type="date"
341
+ value={endDate}
342
+ onChange={(event) => setEndDate(event.target.value)}
343
+ aria-label={labels.endDate}
344
+ className="rounded-md border border-gray-300 px-2 py-2 text-xs dark:border-gray-700 dark:bg-gray-900"
345
+ />
346
+ </>
347
+ )}
315
348
  </>
316
349
  ) : null}
317
350
 
318
351
  {renderFilters?.({ extra, setExtra })}
319
352
 
320
353
  {hasFilters ? (
321
- <button data-cv-tooltip={labels.clearFilters} aria-label={labels.clearFilters} type="button" onClick={clearFilters} className="cv-header-action inline-flex items-center gap-1">
354
+ <button
355
+ data-cv-tooltip={labels.clearFilters}
356
+ aria-label={labels.clearFilters}
357
+ type="button"
358
+ onClick={clearFilters}
359
+ className="cv-header-action inline-flex items-center gap-1"
360
+ >
322
361
  <X size={12} aria-hidden="true" />
323
362
  {labels.clearFilters}
324
363
  </button>
@@ -366,7 +405,8 @@ export function DocumentsWorkspace({
366
405
  >
367
406
  {downloadArchive ? (
368
407
  <button
369
- data-cv-tooltip={labels.bulkDownloadZip} aria-label={labels.bulkDownloadZip}
408
+ data-cv-tooltip={labels.bulkDownloadZip}
409
+ aria-label={labels.bulkDownloadZip}
370
410
  type="button"
371
411
  onClick={() => void handleDownloadArchive()}
372
412
  disabled={busy}
@@ -378,10 +418,12 @@ export function DocumentsWorkspace({
378
418
  ) : null}
379
419
  {removeDocument ? (
380
420
  <button
381
- data-cv-tooltip={labels.bulkRemove(selectedIds.size)} aria-label={labels.bulkRemove(selectedIds.size)}
421
+ data-cv-tooltip={labels.bulkRemove(selectedIds.size)}
422
+ aria-label={labels.bulkRemove(selectedIds.size)}
382
423
  type="button"
383
424
  onClick={() => {
384
- if (window.confirm(labels.bulkRemoveConfirm(selectedIds.size))) void handleRemove(Array.from(selectedIds))
425
+ if (window.confirm(labels.bulkRemoveConfirm(selectedIds.size)))
426
+ void handleRemove(Array.from(selectedIds))
385
427
  }}
386
428
  disabled={busy}
387
429
  className="cv-header-action cv-header-action--danger inline-flex items-center gap-1 disabled:opacity-40"
@@ -415,12 +457,53 @@ export function DocumentsWorkspace({
415
457
  />
416
458
  </th>
417
459
  ) : null}
418
- <SortableHead label={labels.columnFilename} field="filename" activeField={sortField} direction={direction} onSort={toggleSort} />
419
- <SortableHead label={labels.columnContact} field="conversationId" activeField={sortField} direction={direction} onSort={toggleSort} className="hidden sm:table-cell" />
420
- <SortableHead label={labels.columnType} field="mimeType" activeField={sortField} direction={direction} onSort={toggleSort} className="hidden md:table-cell" />
421
- <SortableHead label={labels.columnSize} field="sizeBytes" activeField={sortField} direction={direction} onSort={toggleSort} className="hidden lg:table-cell" />
422
- <SortableHead label={labels.columnSource} field="source" activeField={sortField} direction={direction} onSort={toggleSort} className="hidden lg:table-cell" />
423
- <SortableHead label={labels.columnDate} field="linkedAt" activeField={sortField} direction={direction} onSort={toggleSort} className="hidden xl:table-cell" />
460
+ <SortableHead
461
+ label={labels.columnFilename}
462
+ field="filename"
463
+ activeField={sortField}
464
+ direction={direction}
465
+ onSort={toggleSort}
466
+ />
467
+ <SortableHead
468
+ label={labels.columnContact}
469
+ field="conversationId"
470
+ activeField={sortField}
471
+ direction={direction}
472
+ onSort={toggleSort}
473
+ className="hidden sm:table-cell"
474
+ />
475
+ <SortableHead
476
+ label={labels.columnType}
477
+ field="mimeType"
478
+ activeField={sortField}
479
+ direction={direction}
480
+ onSort={toggleSort}
481
+ className="hidden md:table-cell"
482
+ />
483
+ <SortableHead
484
+ label={labels.columnSize}
485
+ field="sizeBytes"
486
+ activeField={sortField}
487
+ direction={direction}
488
+ onSort={toggleSort}
489
+ className="hidden lg:table-cell"
490
+ />
491
+ <SortableHead
492
+ label={labels.columnSource}
493
+ field="source"
494
+ activeField={sortField}
495
+ direction={direction}
496
+ onSort={toggleSort}
497
+ className="hidden lg:table-cell"
498
+ />
499
+ <SortableHead
500
+ label={labels.columnDate}
501
+ field="linkedAt"
502
+ activeField={sortField}
503
+ direction={direction}
504
+ onSort={toggleSort}
505
+ className="hidden xl:table-cell"
506
+ />
424
507
  <th scope="col" className="px-3 py-2 text-left text-xs font-medium">
425
508
  {labels.columnActions}
426
509
  </th>
@@ -457,14 +540,17 @@ export function DocumentsWorkspace({
457
540
  <button
458
541
  type="button"
459
542
  onClick={() => onOpenConversation(document.conversationId)}
460
- data-cv-tooltip={labels.openConversation} aria-label={labels.openConversation}
543
+ data-cv-tooltip={labels.openConversation}
544
+ aria-label={labels.openConversation}
461
545
  className="cv-header-action inline-flex items-center gap-1"
462
546
  >
463
547
  <MessageSquare size={12} aria-hidden="true" />
464
548
  {document.contactName ?? formatPhone(document.conversationId)}
465
549
  </button>
466
550
  ) : (
467
- <span className="text-xs text-gray-500">{document.contactName ?? formatPhone(document.conversationId)}</span>
551
+ <span className="text-xs text-gray-500">
552
+ {document.contactName ?? formatPhone(document.conversationId)}
553
+ </span>
468
554
  )}
469
555
  </td>
470
556
 
@@ -475,11 +561,15 @@ export function DocumentsWorkspace({
475
561
  <td className="hidden px-3 py-2 md:table-cell" data-cv-tooltip={document.mimeType}>
476
562
  <span className="cv-type-tag">{documentTypeLabel(document.filename, document.mimeType)}</span>
477
563
  </td>
478
- <td className="hidden whitespace-nowrap px-3 py-2 text-xs lg:table-cell">{formatFileSize(document.sizeBytes)}</td>
564
+ <td className="hidden whitespace-nowrap px-3 py-2 text-xs lg:table-cell">
565
+ {formatFileSize(document.sizeBytes)}
566
+ </td>
479
567
  <td className="hidden whitespace-nowrap px-3 py-2 text-xs lg:table-cell">
480
568
  {labels.sourceLabels[document.source] ?? document.source}
481
569
  </td>
482
- <td className="hidden whitespace-nowrap px-3 py-2 text-xs xl:table-cell">{formatDateTime(document.linkedAt)}</td>
570
+ <td className="hidden whitespace-nowrap px-3 py-2 text-xs xl:table-cell">
571
+ {formatDateTime(document.linkedAt)}
572
+ </td>
483
573
 
484
574
  <td className="px-3 py-2">
485
575
  <div className="flex gap-1">
@@ -3,6 +3,8 @@ export type {
3
3
  DocumentsWorkspaceProps,
4
4
  DocumentsWorkspaceClassNames,
5
5
  DocumentsFiltersContext,
6
+ DateInputProps,
7
+ RenderDateInput,
6
8
  } from './DocumentsWorkspace'
7
9
  export { DEFAULT_DOCUMENTS_WORKSPACE_LABELS } from './labels'
8
10
  export type { DocumentsWorkspaceLabels } from './labels'
package/src/index.ts CHANGED
@@ -108,6 +108,8 @@ export type {
108
108
  DocumentsWorkspaceLabels,
109
109
  DocumentsWorkspaceClassNames,
110
110
  DocumentsFiltersContext,
111
+ DateInputProps,
112
+ RenderDateInput,
111
113
  } from './documents'
112
114
  export { SortableHead, MultiSelectFilter, BulkActionBar, ListingPagination } from './listing'
113
115
  export type {
package/src/styles.css CHANGED
@@ -355,6 +355,7 @@
355
355
  font-size: 0.875rem;
356
356
  /* 44px de área de toque em mobile — abaixo disso o dedo erra o alvo. */
357
357
  min-height: 2.75rem;
358
+ transition: background-color 150ms ease-out, color 150ms ease-out, border-color 150ms ease-out;
358
359
  }
359
360
  .cv-workspace-toggle:disabled { opacity: 0.5; }
360
361
  .cv-workspace-toggle--on { background: rgb(37 99 235); color: #fff; border-color: rgb(37 99 235); }
@@ -575,6 +576,12 @@
575
576
  white-space: nowrap;
576
577
  border-radius: 0.375rem;
577
578
  padding: 0.25rem 0.5rem;
579
+
580
+ transition: background-color 150ms ease-out, color 150ms ease-out, border-color 150ms ease-out;
581
+ }
582
+ .cv-workspace-chip:focus-visible, .cv-workspace-toggle:focus-visible { outline: 2px solid rgb(37 99 235); outline-offset: 2px; }
583
+ @media (prefers-reduced-motion: reduce) {
584
+ .cv-workspace-chip, .cv-workspace-toggle { transition: none; }
578
585
  }
579
586
  .cv-workspace-chip--on { background: rgb(229 231 235); }
580
587
  .dark .cv-workspace-chip--on { background: rgb(51 65 85); }
@@ -0,0 +1,34 @@
1
+ import { readFileSync } from 'node:fs'
2
+ import { join } from 'node:path'
3
+ import { describe, expect, it } from 'bun:test'
4
+
5
+ const CSS = readFileSync(join(import.meta.dir, 'styles.css'), 'utf8')
6
+
7
+ function ruleBody(selector: string): string {
8
+ const escaped = selector.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
9
+ const match = new RegExp(`(?:^|\\n)${escaped}\\s*\\{([^}]*)\\}`).exec(CSS)
10
+ if (!match) throw new Error(`regra ${selector} não encontrada`)
11
+ return match[1] ?? ''
12
+ }
13
+
14
+ describe.each(['.cv-workspace-chip', '.cv-workspace-toggle'])('%s', (selector) => {
15
+ it('troca de cor com transição de 150 ms ease-out, sem animar layout', () => {
16
+ const body = ruleBody(selector)
17
+ expect(body).toMatch(/transition:[^;]*background-color 150ms ease-out/)
18
+ expect(body).toMatch(/transition:[^;]*color 150ms ease-out/)
19
+ expect(body).not.toMatch(/transition:[^;]*\ball\b/)
20
+ })
21
+ })
22
+
23
+ describe('chips de filtro do workspace', () => {
24
+ it('têm foco visível próprio', () => {
25
+ expect(CSS).toMatch(/\.cv-workspace-chip:focus-visible[^{]*\{[^}]*outline: 2px solid/)
26
+ expect(CSS).toContain('.cv-workspace-toggle:focus-visible')
27
+ })
28
+
29
+ it('zeram a transição com prefers-reduced-motion: reduce', () => {
30
+ expect(CSS).toMatch(
31
+ /@media \(prefers-reduced-motion: reduce\) \{\s*\.cv-workspace-chip, \.cv-workspace-toggle \{ transition: none; \}/,
32
+ )
33
+ })
34
+ })