@oxy.so/bloom 5.1.0 → 5.2.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/docs/adoption-matrix.mdx +9 -9
- package/docs/app-shell.mdx +3 -1
- package/docs/button.mdx +2 -0
- package/docs/card-form.mdx +2 -0
- package/docs/chat-composer.mdx +1 -1
- package/docs/chat-people.mdx +8 -0
- package/docs/earnings.mdx +2 -0
- package/docs/field.mdx +2 -0
- package/docs/label.mdx +2 -0
- package/docs/payment-method.mdx +2 -0
- package/docs/place-details.mdx +2 -2
- package/docs/proof-of-delivery.mdx +4 -0
- package/docs/select.mdx +2 -0
- package/docs/settings-modal.mdx +15 -0
- package/lib/commonjs/ai-chat/AiChatResizeHandle.js +166 -0
- package/lib/commonjs/ai-chat/AiChatResizeHandle.js.map +1 -0
- package/lib/commonjs/ai-chat/AiChatShell.js +6 -154
- package/lib/commonjs/ai-chat/AiChatShell.js.map +1 -1
- package/lib/commonjs/ai-chat/index.js +2 -1
- package/lib/commonjs/ai-chat/index.js.map +1 -1
- package/lib/commonjs/ai-chat/index.web.js +2 -1
- package/lib/commonjs/ai-chat/index.web.js.map +1 -1
- package/lib/commonjs/ai-chat/messages.js +15 -30
- package/lib/commonjs/ai-chat/messages.js.map +1 -1
- package/lib/commonjs/app-shell/AppShellSplit.js +2 -2
- package/lib/commonjs/app-shell/AppShellSplit.js.map +1 -1
- package/lib/commonjs/button/Button.js +36 -3
- package/lib/commonjs/button/Button.js.map +1 -1
- package/lib/commonjs/button/GlyphButton.js +7 -3
- package/lib/commonjs/button/GlyphButton.js.map +1 -1
- package/lib/commonjs/card-form/shared.js +3 -2
- package/lib/commonjs/card-form/shared.js.map +1 -1
- package/lib/commonjs/chat-composer/AttachmentMenu.js +8 -227
- package/lib/commonjs/chat-composer/AttachmentMenu.js.map +1 -1
- package/lib/commonjs/chat-composer/AttachmentMenu.web.js +16 -0
- package/lib/commonjs/chat-composer/AttachmentMenu.web.js.map +1 -0
- package/lib/commonjs/chat-composer/ChatComposer.js +9 -388
- package/lib/commonjs/chat-composer/ChatComposer.js.map +1 -1
- package/lib/commonjs/chat-composer/ChatComposer.web.js +16 -0
- package/lib/commonjs/chat-composer/ChatComposer.web.js.map +1 -0
- package/lib/commonjs/chat-composer/ComposerAttachmentStrip.js +5 -200
- package/lib/commonjs/chat-composer/ComposerAttachmentStrip.js.map +1 -1
- package/lib/commonjs/chat-composer/ComposerAttachmentStrip.web.js +12 -0
- package/lib/commonjs/chat-composer/ComposerAttachmentStrip.web.js.map +1 -0
- package/lib/commonjs/chat-composer/ComposerBanner.js +5 -163
- package/lib/commonjs/chat-composer/ComposerBanner.js.map +1 -1
- package/lib/commonjs/chat-composer/ComposerBanner.web.js +12 -0
- package/lib/commonjs/chat-composer/ComposerBanner.web.js.map +1 -0
- package/lib/commonjs/chat-composer/EmojiPicker.js +6 -443
- package/lib/commonjs/chat-composer/EmojiPicker.js.map +1 -1
- package/lib/commonjs/chat-composer/EmojiPicker.web.js +14 -0
- package/lib/commonjs/chat-composer/EmojiPicker.web.js.map +1 -0
- package/lib/commonjs/chat-composer/MessageContextMenu.js +12 -102
- package/lib/commonjs/chat-composer/MessageContextMenu.js.map +1 -1
- package/lib/commonjs/chat-composer/MessageContextMenu.web.js +19 -0
- package/lib/commonjs/chat-composer/MessageContextMenu.web.js.map +1 -0
- package/lib/commonjs/chat-composer/ReactionPicker.js +6 -107
- package/lib/commonjs/chat-composer/ReactionPicker.js.map +1 -1
- package/lib/commonjs/chat-composer/ReactionPicker.web.js +14 -0
- package/lib/commonjs/chat-composer/ReactionPicker.web.js.map +1 -0
- package/lib/commonjs/chat-composer/SuggestionList.js +5 -222
- package/lib/commonjs/chat-composer/SuggestionList.js.map +1 -1
- package/lib/commonjs/chat-composer/SuggestionList.web.js +12 -0
- package/lib/commonjs/chat-composer/SuggestionList.web.js.map +1 -0
- package/lib/commonjs/chat-composer/VoiceRecorder.js +7 -263
- package/lib/commonjs/chat-composer/VoiceRecorder.js.map +1 -1
- package/lib/commonjs/chat-composer/VoiceRecorder.web.js +16 -0
- package/lib/commonjs/chat-composer/VoiceRecorder.web.js.map +1 -0
- package/lib/commonjs/chat-composer/create-attachment-menu.js +243 -0
- package/lib/commonjs/chat-composer/create-attachment-menu.js.map +1 -0
- package/lib/commonjs/chat-composer/create-chat-composer.js +400 -0
- package/lib/commonjs/chat-composer/create-chat-composer.js.map +1 -0
- package/lib/commonjs/chat-composer/create-composer-attachment-strip.js +212 -0
- package/lib/commonjs/chat-composer/create-composer-attachment-strip.js.map +1 -0
- package/lib/commonjs/chat-composer/create-composer-banner.js +176 -0
- package/lib/commonjs/chat-composer/create-composer-banner.js.map +1 -0
- package/lib/commonjs/chat-composer/create-emoji-picker.js +456 -0
- package/lib/commonjs/chat-composer/create-emoji-picker.js.map +1 -0
- package/lib/commonjs/chat-composer/create-message-context-menu.js +119 -0
- package/lib/commonjs/chat-composer/create-message-context-menu.js.map +1 -0
- package/lib/commonjs/chat-composer/create-reaction-picker.js +120 -0
- package/lib/commonjs/chat-composer/create-reaction-picker.js.map +1 -0
- package/lib/commonjs/chat-composer/create-suggestion-list.js +234 -0
- package/lib/commonjs/chat-composer/create-suggestion-list.js.map +1 -0
- package/lib/commonjs/chat-composer/create-voice-recorder.js +277 -0
- package/lib/commonjs/chat-composer/create-voice-recorder.js.map +1 -0
- package/lib/commonjs/chat-composer/index.js +9 -9
- package/lib/commonjs/chat-composer/index.web.js +18 -18
- package/lib/commonjs/chat-composer/index.web.js.map +1 -1
- package/lib/commonjs/chat-people/contact-row.js +13 -0
- package/lib/commonjs/chat-people/contact-row.js.map +1 -0
- package/lib/commonjs/chat-screen/ChatSplitLayout.js +2 -2
- package/lib/commonjs/chat-screen/ChatSplitLayout.js.map +1 -1
- package/lib/commonjs/earnings/EarningsSummary.js +12 -2
- package/lib/commonjs/earnings/EarningsSummary.js.map +1 -1
- package/lib/commonjs/field/Field.js +2 -0
- package/lib/commonjs/field/Field.js.map +1 -1
- package/lib/commonjs/item/Item.js +16 -8
- package/lib/commonjs/item/Item.js.map +1 -1
- package/lib/commonjs/job-board/JobCard.js +6 -2
- package/lib/commonjs/job-board/JobCard.js.map +1 -1
- package/lib/commonjs/label/Label.js +2 -1
- package/lib/commonjs/label/Label.js.map +1 -1
- package/lib/commonjs/listing-details/AmenityList.js +4 -3
- package/lib/commonjs/listing-details/AmenityList.js.map +1 -1
- package/lib/commonjs/locale/common-messages.js +30 -15
- package/lib/commonjs/locale/common-messages.js.map +1 -1
- package/lib/commonjs/mail-compose/MailComposeSurface.js +1 -1
- package/lib/commonjs/overlay/InteractionBoundary.js +28 -0
- package/lib/commonjs/overlay/InteractionBoundary.js.map +1 -0
- package/lib/commonjs/payment-method/PaymentMethodList.js +3 -2
- package/lib/commonjs/payment-method/PaymentMethodList.js.map +1 -1
- package/lib/commonjs/place-details/PlaceAmenities.js +17 -6
- package/lib/commonjs/place-details/PlaceAmenities.js.map +1 -1
- package/lib/commonjs/place-details/PlacePopularTimes.js +7 -1
- package/lib/commonjs/place-details/PlacePopularTimes.js.map +1 -1
- package/lib/commonjs/proof-of-delivery/ProofOfDelivery.js +10 -1
- package/lib/commonjs/proof-of-delivery/ProofOfDelivery.js.map +1 -1
- package/lib/commonjs/proof-of-delivery/shared.js +1 -1
- package/lib/commonjs/proof-of-delivery/shared.js.map +1 -1
- package/lib/commonjs/select/Select.js +7 -4
- package/lib/commonjs/select/Select.js.map +1 -1
- package/lib/commonjs/select/Select.web.js +7 -4
- package/lib/commonjs/select/Select.web.js.map +1 -1
- package/lib/commonjs/select/use-required-description.js +37 -0
- package/lib/commonjs/select/use-required-description.js.map +1 -0
- package/lib/commonjs/settings-modal/rows.js +37 -0
- package/lib/commonjs/settings-modal/rows.js.map +1 -0
- package/lib/module/ai-chat/AiChatResizeHandle.js +160 -0
- package/lib/module/ai-chat/AiChatResizeHandle.js.map +1 -0
- package/lib/module/ai-chat/AiChatShell.js +5 -152
- package/lib/module/ai-chat/AiChatShell.js.map +1 -1
- package/lib/module/ai-chat/index.js +2 -1
- package/lib/module/ai-chat/index.js.map +1 -1
- package/lib/module/ai-chat/index.web.js +2 -1
- package/lib/module/ai-chat/index.web.js.map +1 -1
- package/lib/module/ai-chat/messages.js +15 -30
- package/lib/module/ai-chat/messages.js.map +1 -1
- package/lib/module/app-shell/AppShellSplit.js +1 -1
- package/lib/module/app-shell/AppShellSplit.js.map +1 -1
- package/lib/module/button/Button.js +36 -3
- package/lib/module/button/Button.js.map +1 -1
- package/lib/module/button/GlyphButton.js +7 -3
- package/lib/module/button/GlyphButton.js.map +1 -1
- package/lib/module/card-form/shared.js +3 -2
- package/lib/module/card-form/shared.js.map +1 -1
- package/lib/module/chat-composer/AttachmentMenu.js +7 -226
- package/lib/module/chat-composer/AttachmentMenu.js.map +1 -1
- package/lib/module/chat-composer/AttachmentMenu.web.js +12 -0
- package/lib/module/chat-composer/AttachmentMenu.web.js.map +1 -0
- package/lib/module/chat-composer/ChatComposer.js +8 -385
- package/lib/module/chat-composer/ChatComposer.js.map +1 -1
- package/lib/module/chat-composer/ChatComposer.web.js +12 -0
- package/lib/module/chat-composer/ChatComposer.web.js.map +1 -0
- package/lib/module/chat-composer/ComposerAttachmentStrip.js +4 -196
- package/lib/module/chat-composer/ComposerAttachmentStrip.js.map +1 -1
- package/lib/module/chat-composer/ComposerAttachmentStrip.web.js +8 -0
- package/lib/module/chat-composer/ComposerAttachmentStrip.web.js.map +1 -0
- package/lib/module/chat-composer/ComposerBanner.js +4 -162
- package/lib/module/chat-composer/ComposerBanner.js.map +1 -1
- package/lib/module/chat-composer/ComposerBanner.web.js +8 -0
- package/lib/module/chat-composer/ComposerBanner.web.js.map +1 -0
- package/lib/module/chat-composer/EmojiPicker.js +5 -440
- package/lib/module/chat-composer/EmojiPicker.js.map +1 -1
- package/lib/module/chat-composer/EmojiPicker.web.js +10 -0
- package/lib/module/chat-composer/EmojiPicker.web.js.map +1 -0
- package/lib/module/chat-composer/MessageContextMenu.js +11 -99
- package/lib/module/chat-composer/MessageContextMenu.js.map +1 -1
- package/lib/module/chat-composer/MessageContextMenu.web.js +15 -0
- package/lib/module/chat-composer/MessageContextMenu.web.js.map +1 -0
- package/lib/module/chat-composer/ReactionPicker.js +5 -104
- package/lib/module/chat-composer/ReactionPicker.js.map +1 -1
- package/lib/module/chat-composer/ReactionPicker.web.js +10 -0
- package/lib/module/chat-composer/ReactionPicker.web.js.map +1 -0
- package/lib/module/chat-composer/SuggestionList.js +4 -219
- package/lib/module/chat-composer/SuggestionList.js.map +1 -1
- package/lib/module/chat-composer/SuggestionList.web.js +8 -0
- package/lib/module/chat-composer/SuggestionList.web.js.map +1 -0
- package/lib/module/chat-composer/VoiceRecorder.js +6 -260
- package/lib/module/chat-composer/VoiceRecorder.js.map +1 -1
- package/lib/module/chat-composer/VoiceRecorder.web.js +12 -0
- package/lib/module/chat-composer/VoiceRecorder.web.js.map +1 -0
- package/lib/module/chat-composer/create-attachment-menu.js +238 -0
- package/lib/module/chat-composer/create-attachment-menu.js.map +1 -0
- package/lib/module/chat-composer/create-chat-composer.js +395 -0
- package/lib/module/chat-composer/create-chat-composer.js.map +1 -0
- package/lib/module/chat-composer/create-composer-attachment-strip.js +206 -0
- package/lib/module/chat-composer/create-composer-attachment-strip.js.map +1 -0
- package/lib/module/chat-composer/create-composer-banner.js +171 -0
- package/lib/module/chat-composer/create-composer-banner.js.map +1 -0
- package/lib/module/chat-composer/create-emoji-picker.js +451 -0
- package/lib/module/chat-composer/create-emoji-picker.js.map +1 -0
- package/lib/module/chat-composer/create-message-context-menu.js +114 -0
- package/lib/module/chat-composer/create-message-context-menu.js.map +1 -0
- package/lib/module/chat-composer/create-reaction-picker.js +115 -0
- package/lib/module/chat-composer/create-reaction-picker.js.map +1 -0
- package/lib/module/chat-composer/create-suggestion-list.js +229 -0
- package/lib/module/chat-composer/create-suggestion-list.js.map +1 -0
- package/lib/module/chat-composer/create-voice-recorder.js +272 -0
- package/lib/module/chat-composer/create-voice-recorder.js.map +1 -0
- package/lib/module/chat-composer/index.js +9 -9
- package/lib/module/chat-composer/index.js.map +1 -1
- package/lib/module/chat-composer/index.web.js +9 -9
- package/lib/module/chat-composer/index.web.js.map +1 -1
- package/lib/module/chat-people/contact-row.js +10 -0
- package/lib/module/chat-people/contact-row.js.map +1 -0
- package/lib/module/chat-screen/ChatSplitLayout.js +1 -1
- package/lib/module/chat-screen/ChatSplitLayout.js.map +1 -1
- package/lib/module/earnings/EarningsSummary.js +12 -2
- package/lib/module/earnings/EarningsSummary.js.map +1 -1
- package/lib/module/field/Field.js +2 -0
- package/lib/module/field/Field.js.map +1 -1
- package/lib/module/item/Item.js +16 -8
- package/lib/module/item/Item.js.map +1 -1
- package/lib/module/job-board/JobCard.js +6 -2
- package/lib/module/job-board/JobCard.js.map +1 -1
- package/lib/module/label/Label.js +2 -1
- package/lib/module/label/Label.js.map +1 -1
- package/lib/module/listing-details/AmenityList.js +4 -3
- package/lib/module/listing-details/AmenityList.js.map +1 -1
- package/lib/module/locale/common-messages.js +30 -15
- package/lib/module/locale/common-messages.js.map +1 -1
- package/lib/module/mail-compose/MailComposeSurface.js +1 -1
- package/lib/module/mail-compose/MailComposeSurface.js.map +1 -1
- package/lib/module/overlay/InteractionBoundary.js +25 -0
- package/lib/module/overlay/InteractionBoundary.js.map +1 -0
- package/lib/module/payment-method/PaymentMethodList.js +3 -2
- package/lib/module/payment-method/PaymentMethodList.js.map +1 -1
- package/lib/module/place-details/PlaceAmenities.js +15 -4
- package/lib/module/place-details/PlaceAmenities.js.map +1 -1
- package/lib/module/place-details/PlacePopularTimes.js +7 -1
- package/lib/module/place-details/PlacePopularTimes.js.map +1 -1
- package/lib/module/proof-of-delivery/ProofOfDelivery.js +10 -1
- package/lib/module/proof-of-delivery/ProofOfDelivery.js.map +1 -1
- package/lib/module/proof-of-delivery/shared.js +1 -1
- package/lib/module/proof-of-delivery/shared.js.map +1 -1
- package/lib/module/select/Select.js +7 -4
- package/lib/module/select/Select.js.map +1 -1
- package/lib/module/select/Select.web.js +7 -4
- package/lib/module/select/Select.web.js.map +1 -1
- package/lib/module/select/use-required-description.js +33 -0
- package/lib/module/select/use-required-description.js.map +1 -0
- package/lib/module/settings-modal/rows.js +10 -0
- package/lib/module/settings-modal/rows.js.map +1 -0
- package/lib/typescript/commonjs/ai-chat/AiChatResizeHandle.d.ts +11 -0
- package/lib/typescript/commonjs/ai-chat/AiChatResizeHandle.d.ts.map +1 -0
- package/lib/typescript/commonjs/ai-chat/AiChatShell.d.ts +1 -10
- package/lib/typescript/commonjs/ai-chat/AiChatShell.d.ts.map +1 -1
- package/lib/typescript/commonjs/ai-chat/index.d.ts +2 -1
- package/lib/typescript/commonjs/ai-chat/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ai-chat/index.web.d.ts +2 -1
- package/lib/typescript/commonjs/ai-chat/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/ai-chat/messages.d.ts +0 -1
- package/lib/typescript/commonjs/ai-chat/messages.d.ts.map +1 -1
- package/lib/typescript/commonjs/button/Button.d.ts.map +1 -1
- package/lib/typescript/commonjs/card-form/shared.d.ts +2 -1
- package/lib/typescript/commonjs/card-form/shared.d.ts.map +1 -1
- package/lib/typescript/commonjs/chat-composer/AttachmentMenu.d.ts +1 -2
- package/lib/typescript/commonjs/chat-composer/AttachmentMenu.d.ts.map +1 -1
- package/lib/typescript/commonjs/chat-composer/AttachmentMenu.web.d.ts +2 -0
- package/lib/typescript/commonjs/chat-composer/AttachmentMenu.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/chat-composer/ChatComposer.d.ts +1 -2
- package/lib/typescript/commonjs/chat-composer/ChatComposer.d.ts.map +1 -1
- package/lib/typescript/commonjs/chat-composer/ChatComposer.web.d.ts +2 -0
- package/lib/typescript/commonjs/chat-composer/ChatComposer.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/chat-composer/ComposerAttachmentStrip.d.ts +1 -2
- package/lib/typescript/commonjs/chat-composer/ComposerAttachmentStrip.d.ts.map +1 -1
- package/lib/typescript/commonjs/chat-composer/ComposerAttachmentStrip.web.d.ts +2 -0
- package/lib/typescript/commonjs/chat-composer/ComposerAttachmentStrip.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/chat-composer/ComposerBanner.d.ts +1 -2
- package/lib/typescript/commonjs/chat-composer/ComposerBanner.d.ts.map +1 -1
- package/lib/typescript/commonjs/chat-composer/ComposerBanner.web.d.ts +2 -0
- package/lib/typescript/commonjs/chat-composer/ComposerBanner.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/chat-composer/EmojiPicker.d.ts +1 -2
- package/lib/typescript/commonjs/chat-composer/EmojiPicker.d.ts.map +1 -1
- package/lib/typescript/commonjs/chat-composer/EmojiPicker.web.d.ts +2 -0
- package/lib/typescript/commonjs/chat-composer/EmojiPicker.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/chat-composer/MessageContextMenu.d.ts +1 -2
- package/lib/typescript/commonjs/chat-composer/MessageContextMenu.d.ts.map +1 -1
- package/lib/typescript/commonjs/chat-composer/MessageContextMenu.web.d.ts +2 -0
- package/lib/typescript/commonjs/chat-composer/MessageContextMenu.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/chat-composer/ReactionPicker.d.ts +1 -2
- package/lib/typescript/commonjs/chat-composer/ReactionPicker.d.ts.map +1 -1
- package/lib/typescript/commonjs/chat-composer/ReactionPicker.web.d.ts +2 -0
- package/lib/typescript/commonjs/chat-composer/ReactionPicker.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/chat-composer/SuggestionList.d.ts +1 -2
- package/lib/typescript/commonjs/chat-composer/SuggestionList.d.ts.map +1 -1
- package/lib/typescript/commonjs/chat-composer/SuggestionList.web.d.ts +2 -0
- package/lib/typescript/commonjs/chat-composer/SuggestionList.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/chat-composer/VoiceRecorder.d.ts +1 -2
- package/lib/typescript/commonjs/chat-composer/VoiceRecorder.d.ts.map +1 -1
- package/lib/typescript/commonjs/chat-composer/VoiceRecorder.web.d.ts +2 -0
- package/lib/typescript/commonjs/chat-composer/VoiceRecorder.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/chat-composer/create-attachment-menu.d.ts +11 -0
- package/lib/typescript/commonjs/chat-composer/create-attachment-menu.d.ts.map +1 -0
- package/lib/typescript/commonjs/chat-composer/create-chat-composer.d.ts +11 -0
- package/lib/typescript/commonjs/chat-composer/create-chat-composer.d.ts.map +1 -0
- package/lib/typescript/commonjs/chat-composer/create-composer-attachment-strip.d.ts +7 -0
- package/lib/typescript/commonjs/chat-composer/create-composer-attachment-strip.d.ts.map +1 -0
- package/lib/typescript/commonjs/chat-composer/create-composer-banner.d.ts +7 -0
- package/lib/typescript/commonjs/chat-composer/create-composer-banner.d.ts.map +1 -0
- package/lib/typescript/commonjs/chat-composer/create-emoji-picker.d.ts +9 -0
- package/lib/typescript/commonjs/chat-composer/create-emoji-picker.d.ts.map +1 -0
- package/lib/typescript/commonjs/chat-composer/create-message-context-menu.d.ts +14 -0
- package/lib/typescript/commonjs/chat-composer/create-message-context-menu.d.ts.map +1 -0
- package/lib/typescript/commonjs/chat-composer/create-reaction-picker.d.ts +9 -0
- package/lib/typescript/commonjs/chat-composer/create-reaction-picker.d.ts.map +1 -0
- package/lib/typescript/commonjs/chat-composer/create-suggestion-list.d.ts +7 -0
- package/lib/typescript/commonjs/chat-composer/create-suggestion-list.d.ts.map +1 -0
- package/lib/typescript/commonjs/chat-composer/create-voice-recorder.d.ts +11 -0
- package/lib/typescript/commonjs/chat-composer/create-voice-recorder.d.ts.map +1 -0
- package/lib/typescript/commonjs/chat-composer/index.web.d.ts +9 -9
- package/lib/typescript/commonjs/chat-composer/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/chat-people/contact-row.d.ts +9 -0
- package/lib/typescript/commonjs/chat-people/contact-row.d.ts.map +1 -0
- package/lib/typescript/commonjs/earnings/EarningsSummary.d.ts.map +1 -1
- package/lib/typescript/commonjs/field/Field.d.ts +1 -1
- package/lib/typescript/commonjs/field/Field.d.ts.map +1 -1
- package/lib/typescript/commonjs/field/types.d.ts +2 -0
- package/lib/typescript/commonjs/field/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/floating/types.d.ts +1 -0
- package/lib/typescript/commonjs/floating/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/item/Item.d.ts.map +1 -1
- package/lib/typescript/commonjs/job-board/JobCard.d.ts.map +1 -1
- package/lib/typescript/commonjs/label/Label.d.ts +1 -1
- package/lib/typescript/commonjs/label/Label.d.ts.map +1 -1
- package/lib/typescript/commonjs/label/types.d.ts +2 -0
- package/lib/typescript/commonjs/label/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/listing-details/AmenityList.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/common-messages.d.ts +2 -0
- package/lib/typescript/commonjs/locale/common-messages.d.ts.map +1 -1
- package/lib/typescript/commonjs/overlay/InteractionBoundary.d.ts +7 -0
- package/lib/typescript/commonjs/overlay/InteractionBoundary.d.ts.map +1 -0
- package/lib/typescript/commonjs/payment-method/PaymentMethodList.d.ts.map +1 -1
- package/lib/typescript/commonjs/place-details/PlaceAmenities.d.ts.map +1 -1
- package/lib/typescript/commonjs/place-details/PlacePopularTimes.d.ts.map +1 -1
- package/lib/typescript/commonjs/proof-of-delivery/ProofOfDelivery.d.ts.map +1 -1
- package/lib/typescript/commonjs/select/Select.d.ts.map +1 -1
- package/lib/typescript/commonjs/select/Select.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/select/use-required-description.d.ts +7 -0
- package/lib/typescript/commonjs/select/use-required-description.d.ts.map +1 -0
- package/lib/typescript/commonjs/settings-modal/rows.d.ts +9 -0
- package/lib/typescript/commonjs/settings-modal/rows.d.ts.map +1 -0
- package/lib/typescript/module/ai-chat/AiChatResizeHandle.d.ts +11 -0
- package/lib/typescript/module/ai-chat/AiChatResizeHandle.d.ts.map +1 -0
- package/lib/typescript/module/ai-chat/AiChatShell.d.ts +1 -10
- package/lib/typescript/module/ai-chat/AiChatShell.d.ts.map +1 -1
- package/lib/typescript/module/ai-chat/index.d.ts +2 -1
- package/lib/typescript/module/ai-chat/index.d.ts.map +1 -1
- package/lib/typescript/module/ai-chat/index.web.d.ts +2 -1
- package/lib/typescript/module/ai-chat/index.web.d.ts.map +1 -1
- package/lib/typescript/module/ai-chat/messages.d.ts +0 -1
- package/lib/typescript/module/ai-chat/messages.d.ts.map +1 -1
- package/lib/typescript/module/button/Button.d.ts.map +1 -1
- package/lib/typescript/module/card-form/shared.d.ts +2 -1
- package/lib/typescript/module/card-form/shared.d.ts.map +1 -1
- package/lib/typescript/module/chat-composer/AttachmentMenu.d.ts +1 -2
- package/lib/typescript/module/chat-composer/AttachmentMenu.d.ts.map +1 -1
- package/lib/typescript/module/chat-composer/AttachmentMenu.web.d.ts +2 -0
- package/lib/typescript/module/chat-composer/AttachmentMenu.web.d.ts.map +1 -0
- package/lib/typescript/module/chat-composer/ChatComposer.d.ts +1 -2
- package/lib/typescript/module/chat-composer/ChatComposer.d.ts.map +1 -1
- package/lib/typescript/module/chat-composer/ChatComposer.web.d.ts +2 -0
- package/lib/typescript/module/chat-composer/ChatComposer.web.d.ts.map +1 -0
- package/lib/typescript/module/chat-composer/ComposerAttachmentStrip.d.ts +1 -2
- package/lib/typescript/module/chat-composer/ComposerAttachmentStrip.d.ts.map +1 -1
- package/lib/typescript/module/chat-composer/ComposerAttachmentStrip.web.d.ts +2 -0
- package/lib/typescript/module/chat-composer/ComposerAttachmentStrip.web.d.ts.map +1 -0
- package/lib/typescript/module/chat-composer/ComposerBanner.d.ts +1 -2
- package/lib/typescript/module/chat-composer/ComposerBanner.d.ts.map +1 -1
- package/lib/typescript/module/chat-composer/ComposerBanner.web.d.ts +2 -0
- package/lib/typescript/module/chat-composer/ComposerBanner.web.d.ts.map +1 -0
- package/lib/typescript/module/chat-composer/EmojiPicker.d.ts +1 -2
- package/lib/typescript/module/chat-composer/EmojiPicker.d.ts.map +1 -1
- package/lib/typescript/module/chat-composer/EmojiPicker.web.d.ts +2 -0
- package/lib/typescript/module/chat-composer/EmojiPicker.web.d.ts.map +1 -0
- package/lib/typescript/module/chat-composer/MessageContextMenu.d.ts +1 -2
- package/lib/typescript/module/chat-composer/MessageContextMenu.d.ts.map +1 -1
- package/lib/typescript/module/chat-composer/MessageContextMenu.web.d.ts +2 -0
- package/lib/typescript/module/chat-composer/MessageContextMenu.web.d.ts.map +1 -0
- package/lib/typescript/module/chat-composer/ReactionPicker.d.ts +1 -2
- package/lib/typescript/module/chat-composer/ReactionPicker.d.ts.map +1 -1
- package/lib/typescript/module/chat-composer/ReactionPicker.web.d.ts +2 -0
- package/lib/typescript/module/chat-composer/ReactionPicker.web.d.ts.map +1 -0
- package/lib/typescript/module/chat-composer/SuggestionList.d.ts +1 -2
- package/lib/typescript/module/chat-composer/SuggestionList.d.ts.map +1 -1
- package/lib/typescript/module/chat-composer/SuggestionList.web.d.ts +2 -0
- package/lib/typescript/module/chat-composer/SuggestionList.web.d.ts.map +1 -0
- package/lib/typescript/module/chat-composer/VoiceRecorder.d.ts +1 -2
- package/lib/typescript/module/chat-composer/VoiceRecorder.d.ts.map +1 -1
- package/lib/typescript/module/chat-composer/VoiceRecorder.web.d.ts +2 -0
- package/lib/typescript/module/chat-composer/VoiceRecorder.web.d.ts.map +1 -0
- package/lib/typescript/module/chat-composer/create-attachment-menu.d.ts +11 -0
- package/lib/typescript/module/chat-composer/create-attachment-menu.d.ts.map +1 -0
- package/lib/typescript/module/chat-composer/create-chat-composer.d.ts +11 -0
- package/lib/typescript/module/chat-composer/create-chat-composer.d.ts.map +1 -0
- package/lib/typescript/module/chat-composer/create-composer-attachment-strip.d.ts +7 -0
- package/lib/typescript/module/chat-composer/create-composer-attachment-strip.d.ts.map +1 -0
- package/lib/typescript/module/chat-composer/create-composer-banner.d.ts +7 -0
- package/lib/typescript/module/chat-composer/create-composer-banner.d.ts.map +1 -0
- package/lib/typescript/module/chat-composer/create-emoji-picker.d.ts +9 -0
- package/lib/typescript/module/chat-composer/create-emoji-picker.d.ts.map +1 -0
- package/lib/typescript/module/chat-composer/create-message-context-menu.d.ts +14 -0
- package/lib/typescript/module/chat-composer/create-message-context-menu.d.ts.map +1 -0
- package/lib/typescript/module/chat-composer/create-reaction-picker.d.ts +9 -0
- package/lib/typescript/module/chat-composer/create-reaction-picker.d.ts.map +1 -0
- package/lib/typescript/module/chat-composer/create-suggestion-list.d.ts +7 -0
- package/lib/typescript/module/chat-composer/create-suggestion-list.d.ts.map +1 -0
- package/lib/typescript/module/chat-composer/create-voice-recorder.d.ts +11 -0
- package/lib/typescript/module/chat-composer/create-voice-recorder.d.ts.map +1 -0
- package/lib/typescript/module/chat-composer/index.web.d.ts +9 -9
- package/lib/typescript/module/chat-composer/index.web.d.ts.map +1 -1
- package/lib/typescript/module/chat-people/contact-row.d.ts +9 -0
- package/lib/typescript/module/chat-people/contact-row.d.ts.map +1 -0
- package/lib/typescript/module/earnings/EarningsSummary.d.ts.map +1 -1
- package/lib/typescript/module/field/Field.d.ts +1 -1
- package/lib/typescript/module/field/Field.d.ts.map +1 -1
- package/lib/typescript/module/field/types.d.ts +2 -0
- package/lib/typescript/module/field/types.d.ts.map +1 -1
- package/lib/typescript/module/floating/types.d.ts +1 -0
- package/lib/typescript/module/floating/types.d.ts.map +1 -1
- package/lib/typescript/module/item/Item.d.ts.map +1 -1
- package/lib/typescript/module/job-board/JobCard.d.ts.map +1 -1
- package/lib/typescript/module/label/Label.d.ts +1 -1
- package/lib/typescript/module/label/Label.d.ts.map +1 -1
- package/lib/typescript/module/label/types.d.ts +2 -0
- package/lib/typescript/module/label/types.d.ts.map +1 -1
- package/lib/typescript/module/listing-details/AmenityList.d.ts.map +1 -1
- package/lib/typescript/module/locale/common-messages.d.ts +2 -0
- package/lib/typescript/module/locale/common-messages.d.ts.map +1 -1
- package/lib/typescript/module/overlay/InteractionBoundary.d.ts +7 -0
- package/lib/typescript/module/overlay/InteractionBoundary.d.ts.map +1 -0
- package/lib/typescript/module/payment-method/PaymentMethodList.d.ts.map +1 -1
- package/lib/typescript/module/place-details/PlaceAmenities.d.ts.map +1 -1
- package/lib/typescript/module/place-details/PlacePopularTimes.d.ts.map +1 -1
- package/lib/typescript/module/proof-of-delivery/ProofOfDelivery.d.ts.map +1 -1
- package/lib/typescript/module/select/Select.d.ts.map +1 -1
- package/lib/typescript/module/select/Select.web.d.ts.map +1 -1
- package/lib/typescript/module/select/use-required-description.d.ts +7 -0
- package/lib/typescript/module/select/use-required-description.d.ts.map +1 -0
- package/lib/typescript/module/settings-modal/rows.d.ts +9 -0
- package/lib/typescript/module/settings-modal/rows.d.ts.map +1 -0
- package/package.json +35 -1
- package/src/ai-chat/AiChatResizeHandle.tsx +151 -0
- package/src/ai-chat/AiChatShell.tsx +8 -143
- package/src/ai-chat/index.ts +2 -1
- package/src/ai-chat/index.web.ts +2 -1
- package/src/ai-chat/messages.ts +0 -16
- package/src/app-shell/AppShellSplit.tsx +1 -1
- package/src/button/Button.tsx +35 -10
- package/src/button/GlyphButton.tsx +3 -3
- package/src/card-form/shared.ts +3 -2
- package/src/chat-composer/AttachmentMenu.tsx +2 -214
- package/src/chat-composer/AttachmentMenu.web.tsx +5 -0
- package/src/chat-composer/ChatComposer.tsx +2 -459
- package/src/chat-composer/ChatComposer.web.tsx +6 -0
- package/src/chat-composer/ComposerAttachmentStrip.tsx +2 -202
- package/src/chat-composer/ComposerAttachmentStrip.web.tsx +4 -0
- package/src/chat-composer/ComposerBanner.tsx +2 -157
- package/src/chat-composer/ComposerBanner.web.tsx +4 -0
- package/src/chat-composer/EmojiPicker.tsx +2 -402
- package/src/chat-composer/EmojiPicker.web.tsx +5 -0
- package/src/chat-composer/MessageContextMenu.tsx +2 -88
- package/src/chat-composer/MessageContextMenu.web.tsx +12 -0
- package/src/chat-composer/ReactionPicker.tsx +2 -100
- package/src/chat-composer/ReactionPicker.web.tsx +5 -0
- package/src/chat-composer/SuggestionList.tsx +2 -209
- package/src/chat-composer/SuggestionList.web.tsx +4 -0
- package/src/chat-composer/VoiceRecorder.tsx +2 -287
- package/src/chat-composer/VoiceRecorder.web.tsx +6 -0
- package/src/chat-composer/create-attachment-menu.tsx +228 -0
- package/src/chat-composer/create-chat-composer.tsx +473 -0
- package/src/chat-composer/create-composer-attachment-strip.tsx +212 -0
- package/src/chat-composer/create-composer-banner.tsx +167 -0
- package/src/chat-composer/create-emoji-picker.tsx +414 -0
- package/src/chat-composer/create-message-context-menu.tsx +112 -0
- package/src/chat-composer/create-reaction-picker.tsx +112 -0
- package/src/chat-composer/create-suggestion-list.tsx +219 -0
- package/src/chat-composer/create-voice-recorder.tsx +301 -0
- package/src/chat-composer/index.web.ts +9 -9
- package/src/chat-people/contact-row.ts +8 -0
- package/src/chat-screen/ChatSplitLayout.tsx +1 -1
- package/src/earnings/EarningsSummary.tsx +9 -2
- package/src/field/Field.tsx +2 -1
- package/src/field/types.ts +2 -0
- package/src/floating/types.ts +1 -0
- package/src/item/Item.tsx +16 -11
- package/src/job-board/JobCard.tsx +4 -1
- package/src/label/Label.tsx +2 -1
- package/src/label/types.ts +2 -0
- package/src/listing-details/AmenityList.tsx +4 -3
- package/src/locale/common-messages.ts +17 -0
- package/src/overlay/InteractionBoundary.tsx +24 -0
- package/src/payment-method/PaymentMethodList.tsx +2 -1
- package/src/place-details/PlaceAmenities.tsx +9 -0
- package/src/place-details/PlacePopularTimes.tsx +7 -1
- package/src/proof-of-delivery/ProofOfDelivery.tsx +9 -1
- package/src/proof-of-delivery/shared.ts +1 -1
- package/src/select/Select.tsx +5 -1
- package/src/select/Select.web.tsx +5 -1
- package/src/select/use-required-description.tsx +20 -0
- package/src/settings-modal/rows.ts +21 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { useSurfaceFill } from '../styles/surface-levels';
|
|
2
|
+
import { useCardFill } from '../card/use-card-fill';
|
|
3
|
+
import type { Surface as SurfaceComponent } from '../surface';
|
|
4
|
+
/**
|
|
5
|
+
* The anchored list above the composer: `@mention`, `/command` and `:shortcode`
|
|
6
|
+
* are ONE part with a `kind`, because the row geometry, the keyboard model and
|
|
7
|
+
* the announced role are identical — only the leading slot differs.
|
|
8
|
+
*
|
|
9
|
+
* It is a listbox the composer's field OWNS: `activeIndex` arrives as a prop and
|
|
10
|
+
* the arrow keys are handled on the input, never here. A list that kept its own
|
|
11
|
+
* highlight would fight the field for it the first time a pointer moved.
|
|
12
|
+
*/
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import { Image, Pressable, ScrollView, View } from 'react-native';
|
|
15
|
+
|
|
16
|
+
import { RiHashtag } from '../icons/remix/RiHashtag';
|
|
17
|
+
import { useImageResolver } from '../image-resolver/context';
|
|
18
|
+
import { useMessages } from '../locale/messages';
|
|
19
|
+
import { useTheme } from '../theme/use-theme';
|
|
20
|
+
import type { WebCssStyle } from '../styles/web-view-style';
|
|
21
|
+
import { Text } from '../typography';
|
|
22
|
+
import {
|
|
23
|
+
PANEL_RADIUS,
|
|
24
|
+
SUGGESTION_MAX_HEIGHT,
|
|
25
|
+
SUGGESTION_ROW_HEIGHT,
|
|
26
|
+
resolveChatComposerPalette,
|
|
27
|
+
} from './shared';
|
|
28
|
+
import { CHAT_COMPOSER_MESSAGES } from './messages';
|
|
29
|
+
import type { ChatComposerSuggestion, SuggestionKind, SuggestionListProps } from './types';
|
|
30
|
+
import { dataHook, IS_WEB } from './web-hooks';
|
|
31
|
+
|
|
32
|
+
/** Platform dependencies are bound once; shared rendering adds no wrapper. */
|
|
33
|
+
export function createSuggestionList({ Surface }: {
|
|
34
|
+
Surface: typeof SurfaceComponent;
|
|
35
|
+
}) {
|
|
36
|
+
|
|
37
|
+
function isUrl(value: string): boolean {
|
|
38
|
+
return /^(https?:)?\/\//.test(value) || value.startsWith('data:') || value.startsWith('file:');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function Leading({
|
|
42
|
+
kind,
|
|
43
|
+
suggestion,
|
|
44
|
+
}: {
|
|
45
|
+
kind: SuggestionKind;
|
|
46
|
+
suggestion: ChatComposerSuggestion;
|
|
47
|
+
}) {
|
|
48
|
+
const theme = useTheme();
|
|
49
|
+
const palette = resolveChatComposerPalette(theme, useSurfaceFill());
|
|
50
|
+
const resolveImage = useImageResolver();
|
|
51
|
+
|
|
52
|
+
if (kind === 'emoji') {
|
|
53
|
+
return (
|
|
54
|
+
<Text variant="title-2-regular" style={{ width: 28, textAlign: 'center' }}>
|
|
55
|
+
{suggestion.emoji ?? suggestion.label}
|
|
56
|
+
</Text>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
if (kind === 'mention') {
|
|
60
|
+
const uri =
|
|
61
|
+
suggestion.avatar === undefined
|
|
62
|
+
? undefined
|
|
63
|
+
: isUrl(suggestion.avatar)
|
|
64
|
+
? suggestion.avatar
|
|
65
|
+
: resolveImage?.(suggestion.avatar, 'thumb');
|
|
66
|
+
return uri ? (
|
|
67
|
+
<Image
|
|
68
|
+
source={{ uri }}
|
|
69
|
+
accessibilityIgnoresInvertColors
|
|
70
|
+
style={{ width: 28, height: 28, borderRadius: 14, backgroundColor: palette.inset }}
|
|
71
|
+
/>
|
|
72
|
+
) : (
|
|
73
|
+
<View
|
|
74
|
+
style={{
|
|
75
|
+
width: 28,
|
|
76
|
+
height: 28,
|
|
77
|
+
borderRadius: 14,
|
|
78
|
+
backgroundColor: palette.inset,
|
|
79
|
+
alignItems: 'center',
|
|
80
|
+
justifyContent: 'center',
|
|
81
|
+
}}>
|
|
82
|
+
<Text variant="body-2-medium" style={{ color: palette.textSecondary }}>
|
|
83
|
+
{suggestion.label.slice(0, 1).toUpperCase()}
|
|
84
|
+
</Text>
|
|
85
|
+
</View>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
return (
|
|
89
|
+
<View
|
|
90
|
+
style={{
|
|
91
|
+
width: 28,
|
|
92
|
+
height: 28,
|
|
93
|
+
borderRadius: 8,
|
|
94
|
+
backgroundColor: palette.inset,
|
|
95
|
+
alignItems: 'center',
|
|
96
|
+
justifyContent: 'center',
|
|
97
|
+
}}>
|
|
98
|
+
<RiHashtag width={16} height={16} fill={palette.iconSecondary} />
|
|
99
|
+
</View>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function SuggestionList({
|
|
104
|
+
kind,
|
|
105
|
+
suggestions,
|
|
106
|
+
activeIndex = -1,
|
|
107
|
+
onSelectSuggestion,
|
|
108
|
+
onActiveIndexChange,
|
|
109
|
+
header,
|
|
110
|
+
maxHeight = SUGGESTION_MAX_HEIGHT,
|
|
111
|
+
style,
|
|
112
|
+
testID,
|
|
113
|
+
accessibilityLabel,
|
|
114
|
+
}: SuggestionListProps) {
|
|
115
|
+
const theme = useTheme();
|
|
116
|
+
const palette = resolveChatComposerPalette(theme, useCardFill(style));
|
|
117
|
+
const { messages } = useMessages(CHAT_COMPOSER_MESSAGES);
|
|
118
|
+
if (suggestions.length === 0) return null;
|
|
119
|
+
|
|
120
|
+
// React Native's `Role` union has no `listbox`; react-native-web passes the
|
|
121
|
+
// DOM `role` straight through, so it travels as a web-only prop.
|
|
122
|
+
const listRole: Record<string, unknown> = IS_WEB ? { role: 'listbox' } : { accessibilityRole: 'list' };
|
|
123
|
+
|
|
124
|
+
const panel: WebCssStyle = {
|
|
125
|
+
borderRadius: PANEL_RADIUS,
|
|
126
|
+
paddingTop: 6,
|
|
127
|
+
paddingBottom: 6,
|
|
128
|
+
paddingLeft: 6,
|
|
129
|
+
paddingRight: 6,
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<Surface style={[panel, style]} testID={testID}>
|
|
134
|
+
{header ? (
|
|
135
|
+
<Text
|
|
136
|
+
variant="caption-1-medium"
|
|
137
|
+
style={{
|
|
138
|
+
color: palette.textSecondary,
|
|
139
|
+
paddingLeft: 8,
|
|
140
|
+
paddingRight: 8,
|
|
141
|
+
paddingTop: 2,
|
|
142
|
+
paddingBottom: 6,
|
|
143
|
+
}}>
|
|
144
|
+
{header}
|
|
145
|
+
</Text>
|
|
146
|
+
) : null}
|
|
147
|
+
<ScrollView
|
|
148
|
+
{...dataHook('bloomChatComposerScroll')}
|
|
149
|
+
{...listRole}
|
|
150
|
+
accessibilityLabel={accessibilityLabel ?? messages.suggestions[kind]}
|
|
151
|
+
style={{ maxHeight }}
|
|
152
|
+
showsVerticalScrollIndicator={false}>
|
|
153
|
+
{suggestions.map((suggestion, index) => {
|
|
154
|
+
const active = index === activeIndex;
|
|
155
|
+
const row: WebCssStyle = {
|
|
156
|
+
flexDirection: 'row',
|
|
157
|
+
alignItems: 'center',
|
|
158
|
+
gap: 10,
|
|
159
|
+
minHeight: SUGGESTION_ROW_HEIGHT,
|
|
160
|
+
borderRadius: 10,
|
|
161
|
+
paddingLeft: 8,
|
|
162
|
+
paddingRight: 8,
|
|
163
|
+
paddingTop: 6,
|
|
164
|
+
paddingBottom: 6,
|
|
165
|
+
opacity: suggestion.disabled ? 0.5 : 1,
|
|
166
|
+
backgroundColor: active ? palette.hover : 'transparent',
|
|
167
|
+
cursor: suggestion.disabled ? 'auto' : 'pointer',
|
|
168
|
+
'--bloom-chat-composer-ring': palette.focusRing,
|
|
169
|
+
};
|
|
170
|
+
const name = suggestion.handle
|
|
171
|
+
? `${suggestion.label} ${suggestion.handle}`
|
|
172
|
+
: suggestion.label;
|
|
173
|
+
return (
|
|
174
|
+
<Pressable
|
|
175
|
+
key={suggestion.id}
|
|
176
|
+
{...dataHook('bloomChatComposerRow')}
|
|
177
|
+
role="option"
|
|
178
|
+
accessibilityLabel={name}
|
|
179
|
+
aria-selected={active}
|
|
180
|
+
accessibilityState={{ selected: active, disabled: suggestion.disabled }}
|
|
181
|
+
disabled={suggestion.disabled}
|
|
182
|
+
onPress={() => onSelectSuggestion?.(suggestion, index)}
|
|
183
|
+
onHoverIn={() => onActiveIndexChange?.(index)}
|
|
184
|
+
style={row}
|
|
185
|
+
testID={testID ? `${testID}-row-${suggestion.id}` : undefined}>
|
|
186
|
+
<Leading kind={kind} suggestion={suggestion} />
|
|
187
|
+
<View style={{ flexShrink: 1, flexGrow: 1 }}>
|
|
188
|
+
<View style={{ flexDirection: 'row', alignItems: 'baseline', gap: 6 }}>
|
|
189
|
+
<Text variant="body-medium" numberOfLines={1} style={{ color: palette.text }}>
|
|
190
|
+
{suggestion.label}
|
|
191
|
+
</Text>
|
|
192
|
+
{suggestion.handle ? (
|
|
193
|
+
<Text
|
|
194
|
+
variant="body-2-regular"
|
|
195
|
+
numberOfLines={1}
|
|
196
|
+
style={{ color: palette.textSecondary, flexShrink: 1 }}>
|
|
197
|
+
{suggestion.handle}
|
|
198
|
+
</Text>
|
|
199
|
+
) : null}
|
|
200
|
+
</View>
|
|
201
|
+
{suggestion.description ? (
|
|
202
|
+
<Text
|
|
203
|
+
variant="caption-1-regular"
|
|
204
|
+
numberOfLines={1}
|
|
205
|
+
style={{ color: palette.textPlaceholder }}>
|
|
206
|
+
{suggestion.description}
|
|
207
|
+
</Text>
|
|
208
|
+
) : null}
|
|
209
|
+
</View>
|
|
210
|
+
</Pressable>
|
|
211
|
+
);
|
|
212
|
+
})}
|
|
213
|
+
</ScrollView>
|
|
214
|
+
</Surface>
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return SuggestionList;
|
|
219
|
+
}
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { useCardFill } from '../card/use-card-fill';
|
|
2
|
+
import type { Surface as SurfaceComponent } from '../surface';
|
|
3
|
+
/**
|
|
4
|
+
* The bar while a voice message is being recorded, and after: a live meter
|
|
5
|
+
* (`recording`), a hands-free one with explicit buttons (`locked`), and the
|
|
6
|
+
* playable result (`preview`).
|
|
7
|
+
*
|
|
8
|
+
* Purely presentational, and deliberately so — the elapsed time, the levels and
|
|
9
|
+
* the playback position all arrive as props. A recorder that owned a timer
|
|
10
|
+
* would be reading the clock inside a component, which is the one thing every
|
|
11
|
+
* relative time in this fleet is forbidden to do; it also makes the three
|
|
12
|
+
* states impossible to screenshot.
|
|
13
|
+
*/
|
|
14
|
+
import React, { useEffect, useState } from 'react';
|
|
15
|
+
import { View, type LayoutChangeEvent } from 'react-native';
|
|
16
|
+
import Animated, {
|
|
17
|
+
Easing,
|
|
18
|
+
cancelAnimation,
|
|
19
|
+
useAnimatedStyle,
|
|
20
|
+
useReducedMotion,
|
|
21
|
+
useSharedValue,
|
|
22
|
+
withRepeat,
|
|
23
|
+
withSequence,
|
|
24
|
+
withTiming,
|
|
25
|
+
} from 'react-native-reanimated';
|
|
26
|
+
|
|
27
|
+
import type { Button as ButtonComponent } from '../button';
|
|
28
|
+
import { RiArrowLeftSLine } from '../icons/remix/RiArrowLeftSLine';
|
|
29
|
+
import { RiCloseLine } from '../icons/remix/RiCloseLine';
|
|
30
|
+
import { RiDeleteBinLine } from '../icons/remix/RiDeleteBinLine';
|
|
31
|
+
import { RiLockLine } from '../icons/remix/RiLockLine';
|
|
32
|
+
import { RiPauseFill } from '../icons/remix/RiPauseFill';
|
|
33
|
+
import { RiPlayFill } from '../icons/remix/RiPlayFill';
|
|
34
|
+
import { RiSendPlaneLine } from '../icons/remix/RiSendPlaneLine';
|
|
35
|
+
import type { WebCssStyle } from '../styles/web-view-style';
|
|
36
|
+
import { useTheme } from '../theme/use-theme';
|
|
37
|
+
import { Text } from '../typography';
|
|
38
|
+
import type { ComposerIconButton as ComposerIconButtonComponent } from './ComposerIconButton';
|
|
39
|
+
import {
|
|
40
|
+
BAR_PADDING,
|
|
41
|
+
BAR_RADIUS,
|
|
42
|
+
CONTROL_SIZE,
|
|
43
|
+
voiceRecorderLabels,
|
|
44
|
+
WAVE_BAR_GAP,
|
|
45
|
+
WAVE_BAR_WIDTH,
|
|
46
|
+
WAVE_HEIGHT,
|
|
47
|
+
formatRecordingTime,
|
|
48
|
+
resolveChatComposerPalette,
|
|
49
|
+
waveformBars,
|
|
50
|
+
} from './shared';
|
|
51
|
+
import type { VoiceRecorderProps } from './types';
|
|
52
|
+
import { IS_WEB, useChatComposerWebCss } from './web-hooks';
|
|
53
|
+
import { useMessages } from '../locale/messages';
|
|
54
|
+
import { CHAT_COMPOSER_MESSAGES } from './messages';
|
|
55
|
+
|
|
56
|
+
/** Platform dependencies are bound once; shared rendering adds no wrapper. */
|
|
57
|
+
export function createVoiceRecorder({ Surface, Button, ComposerIconButton }: {
|
|
58
|
+
Surface: typeof SurfaceComponent;
|
|
59
|
+
Button: typeof ButtonComponent;
|
|
60
|
+
ComposerIconButton: typeof ComposerIconButtonComponent;
|
|
61
|
+
}) {
|
|
62
|
+
|
|
63
|
+
const EASE_IN_OUT = Easing.bezier(0.42, 0, 0.58, 1);
|
|
64
|
+
|
|
65
|
+
/** The live "we are recording" dot. CSS keyframes on web, a reanimated loop on native. */
|
|
66
|
+
function RecordDot({ color, active }: { color: string; active: boolean }) {
|
|
67
|
+
const reducedMotion = useReducedMotion();
|
|
68
|
+
const opacity = useSharedValue(1);
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
if (IS_WEB || !active || reducedMotion) return;
|
|
71
|
+
opacity.value = withRepeat(
|
|
72
|
+
withSequence(
|
|
73
|
+
withTiming(0.25, { duration: 500, easing: EASE_IN_OUT }),
|
|
74
|
+
withTiming(1, { duration: 500, easing: EASE_IN_OUT }),
|
|
75
|
+
),
|
|
76
|
+
-1,
|
|
77
|
+
);
|
|
78
|
+
return () => cancelAnimation(opacity);
|
|
79
|
+
}, [active, reducedMotion, opacity]);
|
|
80
|
+
const animated = useAnimatedStyle(() => ({ opacity: opacity.value }), [opacity]);
|
|
81
|
+
|
|
82
|
+
const base = { width: 8, height: 8, borderRadius: 4, backgroundColor: color };
|
|
83
|
+
if (IS_WEB) {
|
|
84
|
+
const web: WebCssStyle =
|
|
85
|
+
active && !reducedMotion
|
|
86
|
+
? { ...base, animation: 'bloom-chat-composer-pulse 1000ms ease-in-out infinite' }
|
|
87
|
+
: base;
|
|
88
|
+
return <View style={web} />;
|
|
89
|
+
}
|
|
90
|
+
return <Animated.View style={[base, animated]} />;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The meter. Bars are laid out from a MEASURED width rather than a fixed count,
|
|
95
|
+
* so the same recorder reads correctly in a 390px column and a 900px one; the
|
|
96
|
+
* oldest samples fall off the left as the array grows.
|
|
97
|
+
*/
|
|
98
|
+
function Waveform({
|
|
99
|
+
amplitudes,
|
|
100
|
+
color,
|
|
101
|
+
dimColor,
|
|
102
|
+
progress,
|
|
103
|
+
testID,
|
|
104
|
+
}: {
|
|
105
|
+
amplitudes: ReadonlyArray<number>;
|
|
106
|
+
color: string;
|
|
107
|
+
dimColor: string;
|
|
108
|
+
/** 0–1 playhead, for `preview`. Bars past it paint in `dimColor`. */
|
|
109
|
+
progress?: number;
|
|
110
|
+
testID?: string;
|
|
111
|
+
}) {
|
|
112
|
+
const [width, setWidth] = useState(0);
|
|
113
|
+
const onLayout = (event: LayoutChangeEvent) => setWidth(event.nativeEvent.layout.width);
|
|
114
|
+
const slot = WAVE_BAR_WIDTH + WAVE_BAR_GAP;
|
|
115
|
+
const count = width > 0 ? Math.max(1, Math.floor(width / slot)) : 0;
|
|
116
|
+
const bars = count > 0 ? waveformBars(amplitudes, count) : [];
|
|
117
|
+
const played = progress === undefined ? bars.length : Math.round(bars.length * progress);
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<View
|
|
121
|
+
onLayout={onLayout}
|
|
122
|
+
style={{
|
|
123
|
+
flexGrow: 1,
|
|
124
|
+
flexShrink: 1,
|
|
125
|
+
height: WAVE_HEIGHT,
|
|
126
|
+
flexDirection: 'row',
|
|
127
|
+
alignItems: 'center',
|
|
128
|
+
gap: WAVE_BAR_GAP,
|
|
129
|
+
}}
|
|
130
|
+
testID={testID}>
|
|
131
|
+
{bars.map((level, index) => (
|
|
132
|
+
<View
|
|
133
|
+
key={index}
|
|
134
|
+
style={{
|
|
135
|
+
width: WAVE_BAR_WIDTH,
|
|
136
|
+
height: Math.max(2, Math.round(level * WAVE_HEIGHT)),
|
|
137
|
+
borderRadius: WAVE_BAR_WIDTH,
|
|
138
|
+
backgroundColor: index < played ? color : dimColor,
|
|
139
|
+
}}
|
|
140
|
+
/>
|
|
141
|
+
))}
|
|
142
|
+
</View>
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function VoiceRecorder({
|
|
147
|
+
state,
|
|
148
|
+
seconds,
|
|
149
|
+
duration,
|
|
150
|
+
amplitudes = [],
|
|
151
|
+
playing = false,
|
|
152
|
+
onPlayToggle,
|
|
153
|
+
onCancel,
|
|
154
|
+
onDelete,
|
|
155
|
+
onSend,
|
|
156
|
+
onLock,
|
|
157
|
+
slideToCancel = !IS_WEB,
|
|
158
|
+
labels: labelOverrides,
|
|
159
|
+
style,
|
|
160
|
+
testID,
|
|
161
|
+
accessibilityLabel,
|
|
162
|
+
}: VoiceRecorderProps) {
|
|
163
|
+
const theme = useTheme();
|
|
164
|
+
const palette = resolveChatComposerPalette(theme, useCardFill(style));
|
|
165
|
+
const { messages } = useMessages(CHAT_COMPOSER_MESSAGES);
|
|
166
|
+
useChatComposerWebCss();
|
|
167
|
+
const labels = { ...voiceRecorderLabels(messages), ...labelOverrides };
|
|
168
|
+
const preview = state === 'preview';
|
|
169
|
+
const total = duration ?? seconds;
|
|
170
|
+
|
|
171
|
+
const bar: WebCssStyle = {
|
|
172
|
+
flexDirection: 'row',
|
|
173
|
+
alignItems: 'center',
|
|
174
|
+
gap: 10,
|
|
175
|
+
minHeight: CONTROL_SIZE + BAR_PADDING * 2,
|
|
176
|
+
borderRadius: BAR_RADIUS,
|
|
177
|
+
paddingLeft: 12,
|
|
178
|
+
paddingRight: BAR_PADDING,
|
|
179
|
+
paddingTop: BAR_PADDING,
|
|
180
|
+
paddingBottom: BAR_PADDING,
|
|
181
|
+
'--bloom-chat-composer-ring': palette.focusRing,
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
<Surface
|
|
186
|
+
accessibilityLabel={accessibilityLabel ?? labels.recording}
|
|
187
|
+
style={[bar, style]}
|
|
188
|
+
testID={testID}>
|
|
189
|
+
{preview ? (
|
|
190
|
+
<>
|
|
191
|
+
{onDelete ? (
|
|
192
|
+
<ComposerIconButton
|
|
193
|
+
icon={RiDeleteBinLine}
|
|
194
|
+
accessibilityLabel={labels.delete}
|
|
195
|
+
onPress={onDelete}
|
|
196
|
+
size={32}
|
|
197
|
+
iconSize={18}
|
|
198
|
+
style={{ marginLeft: -6 }}
|
|
199
|
+
testID={testID ? `${testID}-delete` : undefined}
|
|
200
|
+
/>
|
|
201
|
+
) : null}
|
|
202
|
+
<ComposerIconButton
|
|
203
|
+
icon={playing ? RiPauseFill : RiPlayFill}
|
|
204
|
+
accessibilityLabel={playing ? labels.pause : labels.play}
|
|
205
|
+
onPress={onPlayToggle}
|
|
206
|
+
size={32}
|
|
207
|
+
iconSize={18}
|
|
208
|
+
style={{ backgroundColor: palette.inset }}
|
|
209
|
+
testID={testID ? `${testID}-play` : undefined}
|
|
210
|
+
/>
|
|
211
|
+
</>
|
|
212
|
+
) : (
|
|
213
|
+
<RecordDot color={palette.destructive} active />
|
|
214
|
+
)}
|
|
215
|
+
|
|
216
|
+
<Text
|
|
217
|
+
variant="body-2-medium"
|
|
218
|
+
style={{ color: palette.text, minWidth: 40 }}
|
|
219
|
+
testID={testID ? `${testID}-time` : undefined}>
|
|
220
|
+
{formatRecordingTime(seconds)}
|
|
221
|
+
</Text>
|
|
222
|
+
|
|
223
|
+
<Waveform
|
|
224
|
+
amplitudes={amplitudes}
|
|
225
|
+
color={preview ? palette.accent : palette.destructive}
|
|
226
|
+
dimColor={palette.border}
|
|
227
|
+
progress={preview && total > 0 ? Math.min(1, seconds / total) : undefined}
|
|
228
|
+
testID={testID ? `${testID}-wave` : undefined}
|
|
229
|
+
/>
|
|
230
|
+
|
|
231
|
+
{preview ? (
|
|
232
|
+
<Text variant="caption-1-regular" style={{ color: palette.textSecondary }}>
|
|
233
|
+
{formatRecordingTime(total)}
|
|
234
|
+
</Text>
|
|
235
|
+
) : null}
|
|
236
|
+
|
|
237
|
+
{state === 'recording' && slideToCancel ? (
|
|
238
|
+
<Button
|
|
239
|
+
appearance="plain"
|
|
240
|
+
tone="neutral"
|
|
241
|
+
accessibilityLabel={labels.cancel}
|
|
242
|
+
onPress={onCancel}
|
|
243
|
+
style={{ flexDirection: 'row', alignItems: 'center', gap: 2, height: 'auto', minHeight: 0, padding: 0 }}
|
|
244
|
+
testID={testID ? `${testID}-slide` : undefined}>
|
|
245
|
+
<RiArrowLeftSLine width={16} height={16} fill={palette.textSecondary} />
|
|
246
|
+
<Text variant="caption-1-regular" style={{ color: palette.textSecondary }}>
|
|
247
|
+
{labels.slideToCancel}
|
|
248
|
+
</Text>
|
|
249
|
+
</Button>
|
|
250
|
+
) : null}
|
|
251
|
+
|
|
252
|
+
{state === 'recording' && !slideToCancel && onCancel ? (
|
|
253
|
+
<ComposerIconButton
|
|
254
|
+
icon={RiCloseLine}
|
|
255
|
+
accessibilityLabel={labels.cancel}
|
|
256
|
+
onPress={onCancel}
|
|
257
|
+
size={32}
|
|
258
|
+
iconSize={18}
|
|
259
|
+
testID={testID ? `${testID}-cancel` : undefined}
|
|
260
|
+
/>
|
|
261
|
+
) : null}
|
|
262
|
+
|
|
263
|
+
{state === 'recording' && onLock ? (
|
|
264
|
+
<ComposerIconButton
|
|
265
|
+
icon={RiLockLine}
|
|
266
|
+
accessibilityLabel={labels.lock}
|
|
267
|
+
onPress={onLock}
|
|
268
|
+
size={32}
|
|
269
|
+
iconSize={16}
|
|
270
|
+
style={{ backgroundColor: palette.inset }}
|
|
271
|
+
testID={testID ? `${testID}-lock` : undefined}
|
|
272
|
+
/>
|
|
273
|
+
) : null}
|
|
274
|
+
|
|
275
|
+
{state !== 'recording' && onCancel ? (
|
|
276
|
+
<ComposerIconButton
|
|
277
|
+
icon={RiCloseLine}
|
|
278
|
+
accessibilityLabel={labels.cancel}
|
|
279
|
+
onPress={onCancel}
|
|
280
|
+
size={32}
|
|
281
|
+
iconSize={18}
|
|
282
|
+
testID={testID ? `${testID}-cancel` : undefined}
|
|
283
|
+
/>
|
|
284
|
+
) : null}
|
|
285
|
+
|
|
286
|
+
{onSend && state !== 'recording' ? (
|
|
287
|
+
<ComposerIconButton
|
|
288
|
+
icon={RiSendPlaneLine}
|
|
289
|
+
tone="accent"
|
|
290
|
+
accessibilityLabel={labels.send}
|
|
291
|
+
onPress={onSend}
|
|
292
|
+
iconSize={18}
|
|
293
|
+
testID={testID ? `${testID}-send` : undefined}
|
|
294
|
+
/>
|
|
295
|
+
) : null}
|
|
296
|
+
</Surface>
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
return VoiceRecorder;
|
|
301
|
+
}
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
// Re-run `bun run generate:exports` (or any `bun run build`) after
|
|
4
4
|
// changing that barrel or the set of web-forked subpaths.
|
|
5
5
|
|
|
6
|
-
export { ChatComposer } from './ChatComposer';
|
|
7
|
-
export { ComposerBanner } from './ComposerBanner';
|
|
8
|
-
export { ComposerAttachmentStrip } from './ComposerAttachmentStrip';
|
|
6
|
+
export { ChatComposer } from './ChatComposer.web';
|
|
7
|
+
export { ComposerBanner } from './ComposerBanner.web';
|
|
8
|
+
export { ComposerAttachmentStrip } from './ComposerAttachmentStrip.web';
|
|
9
9
|
export { ComposerIconButton } from './ComposerIconButton.web';
|
|
10
|
-
export { SuggestionList } from './SuggestionList';
|
|
11
|
-
export { VoiceRecorder } from './VoiceRecorder';
|
|
12
|
-
export { AttachmentMenu } from './AttachmentMenu';
|
|
13
|
-
export { EmojiPicker } from './EmojiPicker';
|
|
14
|
-
export { ReactionPicker } from './ReactionPicker';
|
|
15
|
-
export { MessageContextMenu } from './MessageContextMenu';
|
|
10
|
+
export { SuggestionList } from './SuggestionList.web';
|
|
11
|
+
export { VoiceRecorder } from './VoiceRecorder.web';
|
|
12
|
+
export { AttachmentMenu } from './AttachmentMenu.web';
|
|
13
|
+
export { EmojiPicker } from './EmojiPicker.web';
|
|
14
|
+
export { ReactionPicker } from './ReactionPicker.web';
|
|
15
|
+
export { MessageContextMenu } from './MessageContextMenu.web';
|
|
16
16
|
export {
|
|
17
17
|
ATTACHMENT_MENU_ITEMS,
|
|
18
18
|
EMOJI_CATEGORY_ICONS,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightweight entry for a single person row (a suggestion, a search result)
|
|
3
|
+
* outside a contact list. Same `ContactRow` as `chat-people`, without linking
|
|
4
|
+
* the lists, the group form or the story viewer in Metro, which does not
|
|
5
|
+
* tree-shake barrel exports.
|
|
6
|
+
*/
|
|
7
|
+
export { ContactRow } from './ContactRow';
|
|
8
|
+
export type { ContactRowProps, ContactRowTrailing, PersonAvatarSource, PersonSummary } from './types';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { memo, useCallback, useRef, useState } from 'react';
|
|
2
2
|
import { useWindowDimensions, View, type LayoutChangeEvent } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import { AiChatResizeHandle } from '../ai-chat/
|
|
4
|
+
import { AiChatResizeHandle } from '../ai-chat/AiChatResizeHandle';
|
|
5
5
|
import { useControllableState } from '../hooks/use-controllable-state';
|
|
6
6
|
import {
|
|
7
7
|
CHAT_LIST_PANE_WIDTH,
|
|
@@ -118,13 +118,20 @@ function EarningsSummaryComponent({
|
|
|
118
118
|
|
|
119
119
|
// The chart's active bar is OWNED here: the headline has to be able to say
|
|
120
120
|
// which amount it is showing, and only this component knows the strings.
|
|
121
|
-
const [
|
|
121
|
+
const [selection, setSelection] = useState<{ period: string | undefined; index: number | null } | null>(null);
|
|
122
|
+
const currentPeriod = current?.id;
|
|
123
|
+
// A controlled prop change must clear selection before the new headline paints.
|
|
124
|
+
if (selection && selection.period !== currentPeriod) setSelection(null);
|
|
125
|
+
const activeIndex = selection?.period === currentPeriod ? selection?.index ?? null : null;
|
|
126
|
+
const setActiveIndex = useCallback((index: number | null) => {
|
|
127
|
+
setSelection({ period: currentPeriod, index });
|
|
128
|
+
}, [currentPeriod]);
|
|
122
129
|
const changePeriod = useCallback(
|
|
123
130
|
(id: string) => {
|
|
124
131
|
setActiveIndex(null);
|
|
125
132
|
setPeriodId(id);
|
|
126
133
|
},
|
|
127
|
-
[setPeriodId],
|
|
134
|
+
[setPeriodId, setActiveIndex],
|
|
128
135
|
);
|
|
129
136
|
|
|
130
137
|
const { width, onLayout } = useContainerWidth();
|
package/src/field/Field.tsx
CHANGED
|
@@ -40,6 +40,7 @@ const FieldComponent = function Field({
|
|
|
40
40
|
description,
|
|
41
41
|
error,
|
|
42
42
|
required = false,
|
|
43
|
+
requiredLabel,
|
|
43
44
|
disabled = false,
|
|
44
45
|
multiple = false,
|
|
45
46
|
nativeID,
|
|
@@ -94,7 +95,7 @@ const FieldComponent = function Field({
|
|
|
94
95
|
}
|
|
95
96
|
>
|
|
96
97
|
{label != null ? (
|
|
97
|
-
<Label nativeID={labelID} htmlFor={multiple ? null : base} required={required} disabled={disabled}>
|
|
98
|
+
<Label nativeID={labelID} htmlFor={multiple ? null : base} required={required} requiredLabel={requiredLabel} disabled={disabled}>
|
|
98
99
|
{label}
|
|
99
100
|
</Label>
|
|
100
101
|
) : null}
|
package/src/field/types.ts
CHANGED
|
@@ -14,6 +14,8 @@ export interface FieldProps {
|
|
|
14
14
|
error?: string | null;
|
|
15
15
|
/** Mark the field's label with a required asterisk. */
|
|
16
16
|
required?: boolean;
|
|
17
|
+
/** Accessible name of the required marker; defaults to the current locale. */
|
|
18
|
+
requiredLabel?: string;
|
|
17
19
|
/**
|
|
18
20
|
* Disables the label/description styling AND, for a control that reads the
|
|
19
21
|
* field context, the control itself.
|
package/src/floating/types.ts
CHANGED
|
@@ -167,6 +167,7 @@ export interface FloatingPanelProps extends FloatingPositionProps {
|
|
|
167
167
|
* is inherent to `asChild` rather than something this type can fix.
|
|
168
168
|
*/
|
|
169
169
|
export interface TriggerHandleProps {
|
|
170
|
+
accessibilityHint?: string;
|
|
170
171
|
onPress: (event: GestureResponderEvent) => void;
|
|
171
172
|
onLongPress?: (event: GestureResponderEvent) => void;
|
|
172
173
|
disabled?: boolean;
|
package/src/item/Item.tsx
CHANGED
|
@@ -132,6 +132,18 @@ const ItemComponent = function Item({
|
|
|
132
132
|
</View>
|
|
133
133
|
);
|
|
134
134
|
|
|
135
|
+
const stateRole = role ?? accessibilityRole;
|
|
136
|
+
const selectedAria =
|
|
137
|
+
selected == null
|
|
138
|
+
? null
|
|
139
|
+
: stateRole === 'option'
|
|
140
|
+
? { 'aria-selected': selected }
|
|
141
|
+
: stateRole === 'radio' || stateRole === 'checkbox'
|
|
142
|
+
? { 'aria-checked': selected }
|
|
143
|
+
: (stateRole == null || stateRole === 'button') && (onPress || onLongPress)
|
|
144
|
+
? { 'aria-pressed': selected }
|
|
145
|
+
: null;
|
|
146
|
+
|
|
135
147
|
if (onPress || onLongPress) {
|
|
136
148
|
// `radio` and `checkbox` are roles BOTH platforms have, so they travel on
|
|
137
149
|
// `accessibilityRole` as well rather than being web-only like `option`.
|
|
@@ -143,16 +155,6 @@ const ItemComponent = function Item({
|
|
|
143
155
|
// toggle a PRESSED one, and `menuitem`/`listitem` carry neither, so those
|
|
144
156
|
// emit nothing. React Native keeps reading `accessibilityState` below,
|
|
145
157
|
// which is why both are set.
|
|
146
|
-
const selectedAria =
|
|
147
|
-
selected == null
|
|
148
|
-
? null
|
|
149
|
-
: role === 'option'
|
|
150
|
-
? { 'aria-selected': selected }
|
|
151
|
-
: role === 'radio' || role === 'checkbox'
|
|
152
|
-
? { 'aria-checked': selected }
|
|
153
|
-
: role == null
|
|
154
|
-
? { 'aria-pressed': selected }
|
|
155
|
-
: null;
|
|
156
158
|
const handlePress = disabled || !onPress ? undefined : onPress;
|
|
157
159
|
const handleLongPress = disabled || !onLongPress ? undefined : onLongPress;
|
|
158
160
|
return (
|
|
@@ -192,7 +194,7 @@ const ItemComponent = function Item({
|
|
|
192
194
|
|
|
193
195
|
return (
|
|
194
196
|
<View
|
|
195
|
-
accessibilityRole={accessibilityRole ?? 'none'}
|
|
197
|
+
accessibilityRole={accessibilityRole ?? (role === 'radio' || role === 'checkbox' ? role : 'none')}
|
|
196
198
|
{...(role ? { role } : {})}
|
|
197
199
|
accessibilityLabel={
|
|
198
200
|
accessibilityLabel ?? (typeof title === 'string' ? title : undefined)
|
|
@@ -203,6 +205,9 @@ const ItemComponent = function Item({
|
|
|
203
205
|
// this the non-pressable row announced nothing. React Native folds
|
|
204
206
|
// `aria-disabled` back into `accessibilityState`.
|
|
205
207
|
aria-disabled={disabled || undefined}
|
|
208
|
+
accessibilityState={{ disabled, selected, expanded }}
|
|
209
|
+
aria-expanded={expanded}
|
|
210
|
+
{...selectedAria}
|
|
206
211
|
style={disabled ? styles.disabled : undefined}>
|
|
207
212
|
{content}
|
|
208
213
|
</View>
|