@algolia/satellite 2.4.0 → 2.5.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/dist/cjs/Actions/Accordion/Accordion.d.ts +9 -9
- package/dist/cjs/Actions/Accordion/Accordion.tailwind.d.ts +1 -1
- package/dist/cjs/Actions/Button/Button.d.ts +1 -2
- package/dist/cjs/Actions/Button/Button.tailwind.d.ts +1 -1
- package/dist/cjs/Actions/Button/PolymorphicButton.d.ts +2 -2
- package/dist/cjs/Actions/Button/PolymorphicIconButton.d.ts +2 -3
- package/dist/cjs/Actions/Button/types.d.ts +7 -7
- package/dist/cjs/Actions/ButtonLink/ButtonLink.d.ts +2 -3
- package/dist/cjs/Actions/IconButton/IconButton.d.ts +1 -2
- package/dist/cjs/Actions/IconButtonLink/IconButtonLink.d.ts +1 -2
- package/dist/cjs/Actions/IconButtonWithFeedback/IconButtonWithFeedback.d.ts +2 -2
- package/dist/cjs/Actions/SegmentedControl/SegmentedControl.tailwind.d.ts +1 -1
- package/dist/cjs/Actions/SegmentedControl/types.d.ts +1 -1
- package/dist/cjs/Actions/ToggleButton/ToggleButton.d.ts +1 -1
- package/dist/cjs/Actions/ToggleButton/ToggleButtonBase.d.ts +3 -3
- package/dist/cjs/Actions/ToggleGroup/ToggleGroup.d.ts +6 -6
- package/dist/cjs/Actions/ToggleGroup/ToggleGroup.tailwind.d.ts +1 -1
- package/dist/cjs/Chat/ChatContextAccordion/ChatContextAccordion.d.ts +1 -1
- package/dist/cjs/Chat/ChatContextContainer/ChatContextContainer.d.ts +23 -0
- package/dist/cjs/Chat/ChatContextContainer/ChatContextContainer.js +72 -0
- package/dist/cjs/Chat/ChatContextContainer/ChatContextContainer.styles.d.ts +65 -0
- package/dist/cjs/Chat/ChatContextContainer/ChatContextContainer.styles.js +22 -0
- package/dist/cjs/Chat/ChatContextContainer/index.d.ts +1 -0
- package/dist/cjs/Chat/ChatContextContainer/index.js +16 -0
- package/dist/cjs/Chat/ChatContextContainer/theme.d.ts +57 -0
- package/dist/cjs/Chat/ChatContextContainer/theme.js +73 -0
- package/dist/cjs/Chat/ChatMessage/ChatMessage.d.ts +5 -54
- package/dist/cjs/Chat/ChatMessageError/ChatMessageError.d.ts +6 -6
- package/dist/cjs/Chat/ChatMessageLoader/ChatMessageLoader.d.ts +2 -2
- package/dist/cjs/Chat/ChatMessages/ChatMessages.d.ts +5 -66
- package/dist/cjs/Chat/ChatMessages/ChatMessages.js +0 -1
- package/dist/cjs/Chat/ChatPrompt/ChatPrompt.d.ts +9 -9
- package/dist/cjs/Chat/ChatPrompt/useFocusTyping.d.ts +1 -2
- package/dist/cjs/Chat/helpers.d.ts +28 -0
- package/dist/cjs/Chat/helpers.js +68 -0
- package/dist/cjs/Chat/index.d.ts +4 -1
- package/dist/cjs/Chat/index.js +33 -1
- package/dist/cjs/Chat/types.d.ts +22 -3
- package/dist/cjs/Fields/AutoComplete/AutoComplete.d.ts +1 -2
- package/dist/cjs/Fields/AutoComplete/AutoComplete.tailwind.d.ts +1 -1
- package/dist/cjs/Fields/AutoComplete/components/AutoCompleteContext.d.ts +2 -2
- package/dist/cjs/Fields/AutoComplete/components/DefaultOptionItem.d.ts +1 -1
- package/dist/cjs/Fields/AutoComplete/types.d.ts +8 -8
- package/dist/cjs/Fields/Checkbox/Checkbox.d.ts +3 -3
- package/dist/cjs/Fields/Checkbox/Checkbox.tailwind.d.ts +1 -1
- package/dist/cjs/Fields/DateInput/DateInput.d.ts +2 -3
- package/dist/cjs/Fields/DatePicker/DatePicker/DatePicker.d.ts +1 -1
- package/dist/cjs/Fields/DatePicker/DatePicker/datePickerReducer.d.ts +1 -1
- package/dist/cjs/Fields/DatePicker/DatePicker.tailwind.d.ts +1 -1
- package/dist/cjs/Fields/DatePicker/DateRangePicker/DateRangePicker.d.ts +1 -1
- package/dist/cjs/Fields/DatePicker/DateRangePicker/DateRangePickerDisplay.d.ts +0 -1
- package/dist/cjs/Fields/DatePicker/DateRangePicker/dateRangePickerReducer.d.ts +1 -1
- package/dist/cjs/Fields/DatePicker/DateRangePicker/dateRangePickerTimeRange.d.ts +1 -1
- package/dist/cjs/Fields/DatePicker/components/Calendar.d.ts +3 -3
- package/dist/cjs/Fields/DatePicker/components/Footer.d.ts +1 -1
- package/dist/cjs/Fields/DatePicker/components/FooterActions.d.ts +0 -1
- package/dist/cjs/Fields/DatePicker/components/NavBar.d.ts +1 -1
- package/dist/cjs/Fields/DatePicker/components/SidePanel.d.ts +1 -1
- package/dist/cjs/Fields/DatePicker/types.d.ts +2 -2
- package/dist/cjs/Fields/DateRangeInput/DateRangeInput.d.ts +2 -3
- package/dist/cjs/Fields/Dropzone/Dropzone.d.ts +2 -3
- package/dist/cjs/Fields/Field/FieldContext.d.ts +2 -3
- package/dist/cjs/Fields/Field/useField.d.ts +1 -1
- package/dist/cjs/Fields/FilePicker/FilePicker.d.ts +4 -5
- package/dist/cjs/Fields/Form/Form.d.ts +1 -1
- package/dist/cjs/Fields/Form/FormContext.d.ts +2 -3
- package/dist/cjs/Fields/Input/Input.d.ts +3 -3
- package/dist/cjs/Fields/Input/Input.tailwind.d.ts +1 -1
- package/dist/cjs/Fields/RadioGroup/RadioButton.d.ts +1 -1
- package/dist/cjs/Fields/RadioGroup/RadioButton.tailwind.d.ts +1 -1
- package/dist/cjs/Fields/RadioGroup/RadioGroup.d.ts +5 -5
- package/dist/cjs/Fields/RadioGroup/RadioGroupItem.d.ts +4 -4
- package/dist/cjs/Fields/RangeSlider/RangeSlider.d.ts +5 -5
- package/dist/cjs/Fields/Select/Select.d.ts +1 -1
- package/dist/cjs/Fields/Select/Select.tailwind.d.ts +1 -1
- package/dist/cjs/Fields/SelectableCard/SelectableCard.d.ts +2 -2
- package/dist/cjs/Fields/SelectableCard/SelectableCardGroup.d.ts +2 -2
- package/dist/cjs/Fields/Switch/Switch.d.ts +7 -7
- package/dist/cjs/Fields/Switch/Switch.tailwind.d.ts +1 -1
- package/dist/cjs/Fields/TextArea/TextArea.d.ts +1 -1
- package/dist/cjs/Fields/TextArea/TextArea.tailwind.d.ts +1 -1
- package/dist/cjs/Fields/TextAreaAutoSize/TextAreaAutoSize.d.ts +3 -4
- package/dist/cjs/Helpers/ClickAwayContainer/ClickAwayContainer.d.ts +1 -1
- package/dist/cjs/Helpers/CodeEditor/CodeEditor.d.ts +1 -1
- package/dist/cjs/Helpers/HelpUnderline/HelpUnderline.d.ts +1 -1
- package/dist/cjs/Helpers/HelpUnderline/HelpUnderline.tailwind.d.ts +1 -1
- package/dist/cjs/Helpers/InstantSearch/InstantSearch.tailwind.d.ts +1 -1
- package/dist/cjs/Helpers/MarkdownContent/MarkdownContent.tailwind.d.ts +1 -1
- package/dist/cjs/Helpers/ShimmerText/ShimmerText.d.ts +1 -1
- package/dist/cjs/Helpers/ShimmerText/ShimmerText.tailwind.d.ts +1 -1
- package/dist/cjs/Helpers/UserContent/UserContent.tailwind.d.ts +1 -1
- package/dist/cjs/Helpers/utilities/focusable.tailwind.d.ts +1 -1
- package/dist/cjs/Helpers/utilities/overlay.tailwind.d.ts +1 -1
- package/dist/cjs/Helpers/utilities/utilities.tailwind.d.ts +1 -1
- package/dist/cjs/Icons/AlgoliaRecommendIcon.d.ts +0 -1
- package/dist/cjs/Icons/AlgoliaSearchIcon.d.ts +0 -1
- package/dist/cjs/Icons/BulbIcon.d.ts +0 -1
- package/dist/cjs/Icons/ContextIcon.d.ts +0 -1
- package/dist/cjs/Icons/CrawlerIcon.d.ts +0 -1
- package/dist/cjs/Icons/DragHandleIcon.d.ts +0 -1
- package/dist/cjs/Icons/NeuralSearchIcon.d.ts +0 -1
- package/dist/cjs/Icons/NoFiltersIcon.d.ts +0 -1
- package/dist/cjs/Icons/PinIcon.d.ts +0 -1
- package/dist/cjs/Icons/QueryBreakdownIcon.d.ts +0 -1
- package/dist/cjs/Icons/RocketIcon.d.ts +0 -1
- package/dist/cjs/Icons/SettingsCategoryPagesIcon.d.ts +0 -1
- package/dist/cjs/Icons/SettingsConsequencesIcon.d.ts +0 -1
- package/dist/cjs/Icons/TestingIcon.d.ts +0 -1
- package/dist/cjs/Icons/UnpinIcon.d.ts +0 -1
- package/dist/cjs/Icons/WorkspaceSwitcherIcon.d.ts +0 -1
- package/dist/cjs/Icons/index.d.ts +2 -2
- package/dist/cjs/Indicators/AnnouncementBadge/AnnouncementBadge.d.ts +3 -3
- package/dist/cjs/Indicators/Avatars/ApplicationAvatar/ApplicationAvatar.d.ts +1 -1
- package/dist/cjs/Indicators/Avatars/UserAvatar/UserAvatar.d.ts +2 -2
- package/dist/cjs/Indicators/Avatars/types.d.ts +5 -5
- package/dist/cjs/Indicators/Badge/Badge.d.ts +4 -4
- package/dist/cjs/Indicators/Banners/Alert/Alert.d.ts +2 -2
- package/dist/cjs/Indicators/Banners/Promote/Promote.d.ts +2 -2
- package/dist/cjs/Indicators/EmptyState/types.d.ts +3 -3
- package/dist/cjs/Indicators/KeyboardKey/KeyboardKey.tailwind.d.ts +1 -1
- package/dist/cjs/Indicators/Medallion/Medallion.tailwind.d.ts +1 -1
- package/dist/cjs/Indicators/Medallion/types.d.ts +2 -2
- package/dist/cjs/Indicators/ProgressBar/ProgressBar.tailwind.d.ts +1 -1
- package/dist/cjs/Indicators/ProgressSpinner/ProgressSpinner.d.ts +1 -1
- package/dist/cjs/Indicators/ProgressSpinner/ProgressSpinner.tailwind.d.ts +1 -1
- package/dist/cjs/Indicators/ScrollIndicator/ScrollIndicator.d.ts +1 -1
- package/dist/cjs/Indicators/ScrollIndicator/ScrollIndicator.tailwind.d.ts +1 -1
- package/dist/cjs/Indicators/Separator/Separator.tailwind.d.ts +1 -1
- package/dist/cjs/Indicators/Tag/Tag.d.ts +2 -2
- package/dist/cjs/Indicators/Tag/Tag.tailwind.d.ts +1 -1
- package/dist/cjs/Indicators/Toast/Toast.d.ts +2 -2
- package/dist/cjs/Indicators/Toast/Toast.tailwind.d.ts +1 -1
- package/dist/cjs/Indicators/Toast/Toasts.d.ts +1 -1
- package/dist/cjs/Indicators/Toast/types.d.ts +1 -1
- package/dist/cjs/Layout/Card/Card.d.ts +2 -2
- package/dist/cjs/Layout/Card/Card.tailwind.d.ts +1 -1
- package/dist/cjs/Layout/Card/components/CardHeader.d.ts +1 -1
- package/dist/cjs/Layout/Card/components/CardTitle.d.ts +2 -2
- package/dist/cjs/Layout/CollapsibleCard/CollapsibleCard.d.ts +6 -6
- package/dist/cjs/Layout/CollapsibleCard/CollapsibleCard.tailwind.d.ts +1 -1
- package/dist/cjs/Layout/FlexGrid/FlexGrid.d.ts +4 -4
- package/dist/cjs/Layout/FlexGrid/FlexGrid.tailwind.d.ts +1 -1
- package/dist/cjs/Layout/Insert/Insert.d.ts +1 -1
- package/dist/cjs/Layout/Sidebar/Sidebar.d.ts +1 -1
- package/dist/cjs/Layout/Sidebar/SidebarButtonLink.d.ts +1 -1
- package/dist/cjs/Layout/Sidebar/SidebarContext.d.ts +1 -2
- package/dist/cjs/Layout/Sidebar/SidebarHeader.d.ts +1 -1
- package/dist/cjs/Layout/Sidebar/SidebarHeading.d.ts +1 -1
- package/dist/cjs/Layout/Sidebar/SidebarLink.d.ts +1 -1
- package/dist/cjs/Layout/Sidebar/SidebarLinksGroup/ActiveLinkIndicator.d.ts +1 -1
- package/dist/cjs/Layout/Sidebar/SidebarLinksGroup/SidebarGroupLink.d.ts +1 -1
- package/dist/cjs/Layout/Sidebar/SidebarLinksGroup/SidebarLinksGroup.d.ts +4 -4
- package/dist/cjs/Layout/Sidebar/SidebarLinksGroup/types.d.ts +1 -1
- package/dist/cjs/Layout/Sidebar/SidebarNav.d.ts +2 -2
- package/dist/cjs/Layout/Sidebar/types.d.ts +3 -3
- package/dist/cjs/Layout/Tables/DataTable/DataTable.d.ts +7 -7
- package/dist/cjs/Layout/Tables/DataTable/DataTable.tailwind.d.ts +1 -1
- package/dist/cjs/Layout/Tables/DataTable/types.d.ts +7 -7
- package/dist/cjs/Layout/Tables/Table/Table.d.ts +1 -1
- package/dist/cjs/Layout/Tables/Table/Table.tailwind.d.ts +1 -1
- package/dist/cjs/Layout/Tables/Table/components/TableFooter.d.ts +2 -2
- package/dist/cjs/Navigation/Link/BaseLink.d.ts +1 -1
- package/dist/cjs/Navigation/Link/Link.d.ts +4 -4
- package/dist/cjs/Navigation/Pagination/CompactPagination/CompactPagination.d.ts +6 -6
- package/dist/cjs/Navigation/Pagination/DotPagination/DotPagination.d.ts +3 -3
- package/dist/cjs/Navigation/Pagination/Pagination/Pagination.d.ts +1 -1
- package/dist/cjs/Navigation/Stepper/Step.d.ts +1 -1
- package/dist/cjs/Navigation/Stepper/Stepper.d.ts +3 -3
- package/dist/cjs/Navigation/Stepper/StepperContext.d.ts +1 -2
- package/dist/cjs/Navigation/Stepper/types.d.ts +1 -1
- package/dist/cjs/Navigation/Tabs/Tabs.tailwind.d.ts +1 -1
- package/dist/cjs/Navigation/Tabs/types.d.ts +1 -1
- package/dist/cjs/Overlay/MenuButton/MenuButton.d.ts +16 -17
- package/dist/cjs/Overlay/MenuButton/components/Content.d.ts +1 -2
- package/dist/cjs/Overlay/MenuButton/components/CustomTrigger.d.ts +1 -2
- package/dist/cjs/Overlay/MenuButton/components/DefaultTrigger.d.ts +1 -2
- package/dist/cjs/Overlay/MenuButton/components/Divider.d.ts +0 -1
- package/dist/cjs/Overlay/MenuButton/components/Label.d.ts +1 -1
- package/dist/cjs/Overlay/MenuButton/components/collapsible/CollapsibleItem.d.ts +1 -1
- package/dist/cjs/Overlay/MenuButton/components/collapsible/CollapsibleItemsGroup.d.ts +1 -1
- package/dist/cjs/Overlay/MenuButton/components/collapsible/CollapsibleItemsGroupContext.d.ts +0 -1
- package/dist/cjs/Overlay/MenuButton/components/collapsible/CollapsibleItemsMultipleGroup.d.ts +1 -1
- package/dist/cjs/Overlay/MenuButton/components/collapsible/CollapsibleItemsSingleGroup.d.ts +1 -1
- package/dist/cjs/Overlay/MenuButton/components/items/Item.d.ts +4 -5
- package/dist/cjs/Overlay/MenuButton/components/items/LinkItem.d.ts +2 -2
- package/dist/cjs/Overlay/MenuButton/components/items/RadioItem.d.ts +2 -2
- package/dist/cjs/Overlay/Modal/Modal.d.ts +4 -4
- package/dist/cjs/Overlay/Modal/Modal.tailwind.d.ts +1 -1
- package/dist/cjs/Overlay/Modal/components/ModalFooter.d.ts +1 -1
- package/dist/cjs/Overlay/Modal/components/ModalSection.d.ts +1 -1
- package/dist/cjs/Overlay/Popover/types.d.ts +4 -4
- package/dist/cjs/Overlay/Tooltip/Tooltip.d.ts +1 -1
- package/dist/cjs/Overlay/Tooltip/Tooltip.tailwind.d.ts +1 -1
- package/dist/cjs/Satellite/SatelliteContext.d.ts +0 -1
- package/dist/cjs/Satellite/locale.d.ts +1 -1
- package/dist/cjs/Satellite/useCreatePortal.d.ts +1 -1
- package/dist/cjs/Typography/Typography.tailwind.d.ts +1 -1
- package/dist/cjs/styles/base.tailwind.d.ts +1 -1
- package/dist/cjs/styles/brandColors.d.ts +6 -6
- package/dist/cjs/styles/colors.d.ts +11 -11
- package/dist/cjs/styles/helpers/satellitePrefixer.d.ts +1 -1
- package/dist/cjs/styles/tailwind.config.d.ts +1 -1
- package/dist/cjs/styles/tailwind.config.js +1 -1
- package/dist/cjs/styles/zIndexes.d.ts +8 -8
- package/dist/cjs/types.d.ts +6 -7
- package/dist/cjs/utils/NumberUnion.d.ts +3 -3
- package/dist/cjs/utils/genericChangeHandler.d.ts +2 -2
- package/dist/cjs/utils/isCssPropertySupported.d.ts +1 -1
- package/dist/cjs/utils/isRenderedChild.d.ts +1 -1
- package/dist/cjs/utils/matchLocation.d.ts +1 -1
- package/dist/cjs/utils/parseUrl.d.ts +1 -1
- package/dist/cjs/utils/useLinkProps.d.ts +2 -2
- package/dist/cjs/utils/useTimeoutFn.d.ts +1 -1
- package/dist/cjs/utils/useTriggerInputChange.d.ts +1 -1
- package/dist/esm/Actions/Accordion/Accordion.d.ts +9 -9
- package/dist/esm/Actions/Accordion/Accordion.tailwind.d.ts +1 -1
- package/dist/esm/Actions/Button/Button.d.ts +1 -2
- package/dist/esm/Actions/Button/Button.tailwind.d.ts +1 -1
- package/dist/esm/Actions/Button/PolymorphicButton.d.ts +2 -2
- package/dist/esm/Actions/Button/PolymorphicIconButton.d.ts +2 -3
- package/dist/esm/Actions/Button/types.d.ts +7 -7
- package/dist/esm/Actions/ButtonLink/ButtonLink.d.ts +2 -3
- package/dist/esm/Actions/IconButton/IconButton.d.ts +1 -2
- package/dist/esm/Actions/IconButtonLink/IconButtonLink.d.ts +1 -2
- package/dist/esm/Actions/IconButtonWithFeedback/IconButtonWithFeedback.d.ts +2 -2
- package/dist/esm/Actions/SegmentedControl/SegmentedControl.tailwind.d.ts +1 -1
- package/dist/esm/Actions/SegmentedControl/types.d.ts +1 -1
- package/dist/esm/Actions/ToggleButton/ToggleButton.d.ts +1 -1
- package/dist/esm/Actions/ToggleButton/ToggleButtonBase.d.ts +3 -3
- package/dist/esm/Actions/ToggleGroup/ToggleGroup.d.ts +6 -6
- package/dist/esm/Actions/ToggleGroup/ToggleGroup.tailwind.d.ts +1 -1
- package/dist/esm/Chat/ChatContextAccordion/ChatContextAccordion.d.ts +1 -1
- package/dist/esm/Chat/ChatContextContainer/ChatContextContainer.d.ts +23 -0
- package/dist/esm/Chat/ChatContextContainer/ChatContextContainer.js +66 -0
- package/dist/esm/Chat/ChatContextContainer/ChatContextContainer.styles.d.ts +65 -0
- package/dist/esm/Chat/ChatContextContainer/ChatContextContainer.styles.js +15 -0
- package/dist/esm/Chat/ChatContextContainer/index.d.ts +1 -0
- package/dist/esm/Chat/ChatContextContainer/index.js +1 -0
- package/dist/esm/Chat/ChatContextContainer/theme.d.ts +57 -0
- package/dist/esm/Chat/ChatContextContainer/theme.js +67 -0
- package/dist/esm/Chat/ChatMessage/ChatMessage.d.ts +5 -54
- package/dist/esm/Chat/ChatMessageError/ChatMessageError.d.ts +6 -6
- package/dist/esm/Chat/ChatMessageLoader/ChatMessageLoader.d.ts +2 -2
- package/dist/esm/Chat/ChatMessages/ChatMessages.d.ts +5 -66
- package/dist/esm/Chat/ChatMessages/ChatMessages.js +0 -1
- package/dist/esm/Chat/ChatPrompt/ChatPrompt.d.ts +9 -9
- package/dist/esm/Chat/ChatPrompt/useFocusTyping.d.ts +1 -2
- package/dist/esm/Chat/helpers.d.ts +28 -0
- package/dist/esm/Chat/helpers.js +60 -0
- package/dist/esm/Chat/index.d.ts +4 -1
- package/dist/esm/Chat/index.js +3 -1
- package/dist/esm/Chat/types.d.ts +22 -3
- package/dist/esm/Fields/AutoComplete/AutoComplete.d.ts +1 -2
- package/dist/esm/Fields/AutoComplete/AutoComplete.tailwind.d.ts +1 -1
- package/dist/esm/Fields/AutoComplete/components/AutoCompleteContext.d.ts +2 -2
- package/dist/esm/Fields/AutoComplete/components/DefaultOptionItem.d.ts +1 -1
- package/dist/esm/Fields/AutoComplete/types.d.ts +8 -8
- package/dist/esm/Fields/Checkbox/Checkbox.d.ts +3 -3
- package/dist/esm/Fields/Checkbox/Checkbox.tailwind.d.ts +1 -1
- package/dist/esm/Fields/DateInput/DateInput.d.ts +2 -3
- package/dist/esm/Fields/DatePicker/DatePicker/DatePicker.d.ts +1 -1
- package/dist/esm/Fields/DatePicker/DatePicker/datePickerReducer.d.ts +1 -1
- package/dist/esm/Fields/DatePicker/DatePicker.tailwind.d.ts +1 -1
- package/dist/esm/Fields/DatePicker/DateRangePicker/DateRangePicker.d.ts +1 -1
- package/dist/esm/Fields/DatePicker/DateRangePicker/DateRangePickerDisplay.d.ts +0 -1
- package/dist/esm/Fields/DatePicker/DateRangePicker/dateRangePickerReducer.d.ts +1 -1
- package/dist/esm/Fields/DatePicker/DateRangePicker/dateRangePickerTimeRange.d.ts +1 -1
- package/dist/esm/Fields/DatePicker/components/Calendar.d.ts +3 -3
- package/dist/esm/Fields/DatePicker/components/Footer.d.ts +1 -1
- package/dist/esm/Fields/DatePicker/components/FooterActions.d.ts +0 -1
- package/dist/esm/Fields/DatePicker/components/NavBar.d.ts +1 -1
- package/dist/esm/Fields/DatePicker/components/SidePanel.d.ts +1 -1
- package/dist/esm/Fields/DatePicker/types.d.ts +2 -2
- package/dist/esm/Fields/DateRangeInput/DateRangeInput.d.ts +2 -3
- package/dist/esm/Fields/Dropzone/Dropzone.d.ts +2 -3
- package/dist/esm/Fields/Field/FieldContext.d.ts +2 -3
- package/dist/esm/Fields/Field/useField.d.ts +1 -1
- package/dist/esm/Fields/FilePicker/FilePicker.d.ts +4 -5
- package/dist/esm/Fields/Form/Form.d.ts +1 -1
- package/dist/esm/Fields/Form/FormContext.d.ts +2 -3
- package/dist/esm/Fields/Input/Input.d.ts +3 -3
- package/dist/esm/Fields/Input/Input.tailwind.d.ts +1 -1
- package/dist/esm/Fields/RadioGroup/RadioButton.d.ts +1 -1
- package/dist/esm/Fields/RadioGroup/RadioButton.tailwind.d.ts +1 -1
- package/dist/esm/Fields/RadioGroup/RadioGroup.d.ts +5 -5
- package/dist/esm/Fields/RadioGroup/RadioGroupItem.d.ts +4 -4
- package/dist/esm/Fields/RangeSlider/RangeSlider.d.ts +5 -5
- package/dist/esm/Fields/Select/Select.d.ts +1 -1
- package/dist/esm/Fields/Select/Select.tailwind.d.ts +1 -1
- package/dist/esm/Fields/SelectableCard/SelectableCard.d.ts +2 -2
- package/dist/esm/Fields/SelectableCard/SelectableCardGroup.d.ts +2 -2
- package/dist/esm/Fields/Switch/Switch.d.ts +7 -7
- package/dist/esm/Fields/Switch/Switch.tailwind.d.ts +1 -1
- package/dist/esm/Fields/TextArea/TextArea.d.ts +1 -1
- package/dist/esm/Fields/TextArea/TextArea.tailwind.d.ts +1 -1
- package/dist/esm/Fields/TextAreaAutoSize/TextAreaAutoSize.d.ts +3 -4
- package/dist/esm/Helpers/ClickAwayContainer/ClickAwayContainer.d.ts +1 -1
- package/dist/esm/Helpers/CodeEditor/CodeEditor.d.ts +1 -1
- package/dist/esm/Helpers/HelpUnderline/HelpUnderline.d.ts +1 -1
- package/dist/esm/Helpers/HelpUnderline/HelpUnderline.tailwind.d.ts +1 -1
- package/dist/esm/Helpers/InstantSearch/InstantSearch.tailwind.d.ts +1 -1
- package/dist/esm/Helpers/MarkdownContent/MarkdownContent.tailwind.d.ts +1 -1
- package/dist/esm/Helpers/ShimmerText/ShimmerText.d.ts +1 -1
- package/dist/esm/Helpers/ShimmerText/ShimmerText.tailwind.d.ts +1 -1
- package/dist/esm/Helpers/UserContent/UserContent.tailwind.d.ts +1 -1
- package/dist/esm/Helpers/utilities/focusable.tailwind.d.ts +1 -1
- package/dist/esm/Helpers/utilities/overlay.tailwind.d.ts +1 -1
- package/dist/esm/Helpers/utilities/utilities.tailwind.d.ts +1 -1
- package/dist/esm/Icons/AlgoliaRecommendIcon.d.ts +0 -1
- package/dist/esm/Icons/AlgoliaSearchIcon.d.ts +0 -1
- package/dist/esm/Icons/BulbIcon.d.ts +0 -1
- package/dist/esm/Icons/ContextIcon.d.ts +0 -1
- package/dist/esm/Icons/CrawlerIcon.d.ts +0 -1
- package/dist/esm/Icons/DragHandleIcon.d.ts +0 -1
- package/dist/esm/Icons/NeuralSearchIcon.d.ts +0 -1
- package/dist/esm/Icons/NoFiltersIcon.d.ts +0 -1
- package/dist/esm/Icons/PinIcon.d.ts +0 -1
- package/dist/esm/Icons/QueryBreakdownIcon.d.ts +0 -1
- package/dist/esm/Icons/RocketIcon.d.ts +0 -1
- package/dist/esm/Icons/SettingsCategoryPagesIcon.d.ts +0 -1
- package/dist/esm/Icons/SettingsConsequencesIcon.d.ts +0 -1
- package/dist/esm/Icons/TestingIcon.d.ts +0 -1
- package/dist/esm/Icons/UnpinIcon.d.ts +0 -1
- package/dist/esm/Icons/WorkspaceSwitcherIcon.d.ts +0 -1
- package/dist/esm/Icons/index.d.ts +2 -2
- package/dist/esm/Indicators/AnnouncementBadge/AnnouncementBadge.d.ts +3 -3
- package/dist/esm/Indicators/Avatars/ApplicationAvatar/ApplicationAvatar.d.ts +1 -1
- package/dist/esm/Indicators/Avatars/UserAvatar/UserAvatar.d.ts +2 -2
- package/dist/esm/Indicators/Avatars/types.d.ts +5 -5
- package/dist/esm/Indicators/Badge/Badge.d.ts +4 -4
- package/dist/esm/Indicators/Banners/Alert/Alert.d.ts +2 -2
- package/dist/esm/Indicators/Banners/Promote/Promote.d.ts +2 -2
- package/dist/esm/Indicators/EmptyState/types.d.ts +3 -3
- package/dist/esm/Indicators/KeyboardKey/KeyboardKey.tailwind.d.ts +1 -1
- package/dist/esm/Indicators/Medallion/Medallion.tailwind.d.ts +1 -1
- package/dist/esm/Indicators/Medallion/types.d.ts +2 -2
- package/dist/esm/Indicators/ProgressBar/ProgressBar.tailwind.d.ts +1 -1
- package/dist/esm/Indicators/ProgressSpinner/ProgressSpinner.d.ts +1 -1
- package/dist/esm/Indicators/ProgressSpinner/ProgressSpinner.tailwind.d.ts +1 -1
- package/dist/esm/Indicators/ScrollIndicator/ScrollIndicator.d.ts +1 -1
- package/dist/esm/Indicators/ScrollIndicator/ScrollIndicator.tailwind.d.ts +1 -1
- package/dist/esm/Indicators/Separator/Separator.tailwind.d.ts +1 -1
- package/dist/esm/Indicators/Tag/Tag.d.ts +2 -2
- package/dist/esm/Indicators/Tag/Tag.tailwind.d.ts +1 -1
- package/dist/esm/Indicators/Toast/Toast.d.ts +2 -2
- package/dist/esm/Indicators/Toast/Toast.tailwind.d.ts +1 -1
- package/dist/esm/Indicators/Toast/Toasts.d.ts +1 -1
- package/dist/esm/Indicators/Toast/types.d.ts +1 -1
- package/dist/esm/Layout/Card/Card.d.ts +2 -2
- package/dist/esm/Layout/Card/Card.tailwind.d.ts +1 -1
- package/dist/esm/Layout/Card/components/CardHeader.d.ts +1 -1
- package/dist/esm/Layout/Card/components/CardTitle.d.ts +2 -2
- package/dist/esm/Layout/CollapsibleCard/CollapsibleCard.d.ts +6 -6
- package/dist/esm/Layout/CollapsibleCard/CollapsibleCard.tailwind.d.ts +1 -1
- package/dist/esm/Layout/FlexGrid/FlexGrid.d.ts +4 -4
- package/dist/esm/Layout/FlexGrid/FlexGrid.tailwind.d.ts +1 -1
- package/dist/esm/Layout/Insert/Insert.d.ts +1 -1
- package/dist/esm/Layout/Sidebar/Sidebar.d.ts +1 -1
- package/dist/esm/Layout/Sidebar/SidebarButtonLink.d.ts +1 -1
- package/dist/esm/Layout/Sidebar/SidebarContext.d.ts +1 -2
- package/dist/esm/Layout/Sidebar/SidebarHeader.d.ts +1 -1
- package/dist/esm/Layout/Sidebar/SidebarHeading.d.ts +1 -1
- package/dist/esm/Layout/Sidebar/SidebarLink.d.ts +1 -1
- package/dist/esm/Layout/Sidebar/SidebarLinksGroup/ActiveLinkIndicator.d.ts +1 -1
- package/dist/esm/Layout/Sidebar/SidebarLinksGroup/SidebarGroupLink.d.ts +1 -1
- package/dist/esm/Layout/Sidebar/SidebarLinksGroup/SidebarLinksGroup.d.ts +4 -4
- package/dist/esm/Layout/Sidebar/SidebarLinksGroup/types.d.ts +1 -1
- package/dist/esm/Layout/Sidebar/SidebarNav.d.ts +2 -2
- package/dist/esm/Layout/Sidebar/types.d.ts +3 -3
- package/dist/esm/Layout/Tables/DataTable/DataTable.d.ts +7 -7
- package/dist/esm/Layout/Tables/DataTable/DataTable.tailwind.d.ts +1 -1
- package/dist/esm/Layout/Tables/DataTable/types.d.ts +7 -7
- package/dist/esm/Layout/Tables/Table/Table.d.ts +1 -1
- package/dist/esm/Layout/Tables/Table/Table.tailwind.d.ts +1 -1
- package/dist/esm/Layout/Tables/Table/components/TableFooter.d.ts +2 -2
- package/dist/esm/Navigation/Link/BaseLink.d.ts +1 -1
- package/dist/esm/Navigation/Link/Link.d.ts +4 -4
- package/dist/esm/Navigation/Pagination/CompactPagination/CompactPagination.d.ts +6 -6
- package/dist/esm/Navigation/Pagination/DotPagination/DotPagination.d.ts +3 -3
- package/dist/esm/Navigation/Pagination/Pagination/Pagination.d.ts +1 -1
- package/dist/esm/Navigation/Stepper/Step.d.ts +1 -1
- package/dist/esm/Navigation/Stepper/Stepper.d.ts +3 -3
- package/dist/esm/Navigation/Stepper/StepperContext.d.ts +1 -2
- package/dist/esm/Navigation/Stepper/types.d.ts +1 -1
- package/dist/esm/Navigation/Tabs/Tabs.tailwind.d.ts +1 -1
- package/dist/esm/Navigation/Tabs/types.d.ts +1 -1
- package/dist/esm/Overlay/MenuButton/MenuButton.d.ts +16 -17
- package/dist/esm/Overlay/MenuButton/components/Content.d.ts +1 -2
- package/dist/esm/Overlay/MenuButton/components/CustomTrigger.d.ts +1 -2
- package/dist/esm/Overlay/MenuButton/components/DefaultTrigger.d.ts +1 -2
- package/dist/esm/Overlay/MenuButton/components/Divider.d.ts +0 -1
- package/dist/esm/Overlay/MenuButton/components/Label.d.ts +1 -1
- package/dist/esm/Overlay/MenuButton/components/collapsible/CollapsibleItem.d.ts +1 -1
- package/dist/esm/Overlay/MenuButton/components/collapsible/CollapsibleItemsGroup.d.ts +1 -1
- package/dist/esm/Overlay/MenuButton/components/collapsible/CollapsibleItemsGroupContext.d.ts +0 -1
- package/dist/esm/Overlay/MenuButton/components/collapsible/CollapsibleItemsMultipleGroup.d.ts +1 -1
- package/dist/esm/Overlay/MenuButton/components/collapsible/CollapsibleItemsSingleGroup.d.ts +1 -1
- package/dist/esm/Overlay/MenuButton/components/items/Item.d.ts +4 -5
- package/dist/esm/Overlay/MenuButton/components/items/LinkItem.d.ts +2 -2
- package/dist/esm/Overlay/MenuButton/components/items/RadioItem.d.ts +2 -2
- package/dist/esm/Overlay/Modal/Modal.d.ts +4 -4
- package/dist/esm/Overlay/Modal/Modal.tailwind.d.ts +1 -1
- package/dist/esm/Overlay/Modal/components/ModalFooter.d.ts +1 -1
- package/dist/esm/Overlay/Modal/components/ModalSection.d.ts +1 -1
- package/dist/esm/Overlay/Popover/types.d.ts +4 -4
- package/dist/esm/Overlay/Tooltip/Tooltip.d.ts +1 -1
- package/dist/esm/Overlay/Tooltip/Tooltip.tailwind.d.ts +1 -1
- package/dist/esm/Satellite/SatelliteContext.d.ts +0 -1
- package/dist/esm/Satellite/locale.d.ts +1 -1
- package/dist/esm/Satellite/useCreatePortal.d.ts +1 -1
- package/dist/esm/Typography/Typography.tailwind.d.ts +1 -1
- package/dist/esm/styles/base.tailwind.d.ts +1 -1
- package/dist/esm/styles/brandColors.d.ts +6 -6
- package/dist/esm/styles/colors.d.ts +11 -11
- package/dist/esm/styles/helpers/satellitePrefixer.d.ts +1 -1
- package/dist/esm/styles/tailwind.config.d.ts +1 -1
- package/dist/esm/styles/tailwind.config.js +1 -1
- package/dist/esm/styles/zIndexes.d.ts +8 -8
- package/dist/esm/types.d.ts +6 -7
- package/dist/esm/utils/NumberUnion.d.ts +3 -3
- package/dist/esm/utils/genericChangeHandler.d.ts +2 -2
- package/dist/esm/utils/isCssPropertySupported.d.ts +1 -1
- package/dist/esm/utils/isRenderedChild.d.ts +1 -1
- package/dist/esm/utils/matchLocation.d.ts +1 -1
- package/dist/esm/utils/parseUrl.d.ts +1 -1
- package/dist/esm/utils/useLinkProps.d.ts +2 -2
- package/dist/esm/utils/useTimeoutFn.d.ts +1 -1
- package/dist/esm/utils/useTriggerInputChange.d.ts +1 -1
- package/dist/satellite.min.css +1 -1
- package/package.json +7 -6
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Children, isValidElement, useMemo, useRef } from "react";
|
|
2
|
+
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
|
|
3
|
+
import { chatContextContainerStyles } from "./ChatContextContainer.styles";
|
|
4
|
+
import { theme } from "./theme";
|
|
5
|
+
import { IconButtonWithFeedback } from "./../../Actions";
|
|
6
|
+
import { CopyIcon } from "./../../Icons";
|
|
7
|
+
import { uniqueId } from "./../../utils";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
/**
|
|
10
|
+
* The `ChatContextContainer` component wraps data with an actionable header. Intended for use with the chat interface.
|
|
11
|
+
*/
|
|
12
|
+
export var ChatContextContainer = function ChatContextContainer(_ref) {
|
|
13
|
+
var className = _ref.className,
|
|
14
|
+
title = _ref.title,
|
|
15
|
+
actions = _ref.actions,
|
|
16
|
+
code = _ref.code,
|
|
17
|
+
children = _ref.children;
|
|
18
|
+
var styles = chatContextContainerStyles();
|
|
19
|
+
var contentContainerRef = useRef(null);
|
|
20
|
+
var titleId = useMemo(function () {
|
|
21
|
+
return uniqueId("chat-context-container-title-");
|
|
22
|
+
}, []);
|
|
23
|
+
return /*#__PURE__*/_jsx("div", {
|
|
24
|
+
className: styles.base({
|
|
25
|
+
className: className
|
|
26
|
+
}),
|
|
27
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
28
|
+
className: styles.item(),
|
|
29
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
30
|
+
className: styles.header(),
|
|
31
|
+
children: [/*#__PURE__*/_jsx("p", {
|
|
32
|
+
id: titleId,
|
|
33
|
+
className: styles.title(),
|
|
34
|
+
children: title !== null && title !== void 0 ? title : code
|
|
35
|
+
}), actions !== null && actions !== void 0 ? actions : /*#__PURE__*/_jsx(IconButtonWithFeedback, {
|
|
36
|
+
icon: CopyIcon,
|
|
37
|
+
variant: "subtle",
|
|
38
|
+
size: "small",
|
|
39
|
+
message: "Copy to clipboard",
|
|
40
|
+
tooltipSide: "bottom",
|
|
41
|
+
tooltipDelay: 0,
|
|
42
|
+
tooltipHideDelay: 0,
|
|
43
|
+
onClick: function onClick() {
|
|
44
|
+
var _contentContainerRef$;
|
|
45
|
+
// Fallback to unformatted HTML as text if content is JSX or array of JSX
|
|
46
|
+
var content = /*#__PURE__*/isValidElement(children) || Children.count(children) > 1 ? (_contentContainerRef$ = contentContainerRef.current) === null || _contentContainerRef$ === void 0 ? void 0 : _contentContainerRef$.innerHTML : children === null || children === void 0 ? void 0 : children.toString();
|
|
47
|
+
if (content) {
|
|
48
|
+
void navigator.clipboard.writeText(content);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
})]
|
|
52
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
53
|
+
ref: contentContainerRef,
|
|
54
|
+
role: "region",
|
|
55
|
+
"aria-labelledby": titleId,
|
|
56
|
+
className: styles.content(),
|
|
57
|
+
children: code !== undefined && typeof children === "string" ? /*#__PURE__*/_jsx(SyntaxHighlighter, {
|
|
58
|
+
PreTag: "div",
|
|
59
|
+
language: code,
|
|
60
|
+
style: theme,
|
|
61
|
+
children: children
|
|
62
|
+
}) : children
|
|
63
|
+
})]
|
|
64
|
+
})
|
|
65
|
+
});
|
|
66
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export declare const chatContextContainerStyles: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
[key: string]: {
|
|
3
|
+
[key: string]: import("tailwind-merge").ClassNameValue | {
|
|
4
|
+
base?: import("tailwind-merge").ClassNameValue;
|
|
5
|
+
header?: import("tailwind-merge").ClassNameValue;
|
|
6
|
+
title?: import("tailwind-merge").ClassNameValue;
|
|
7
|
+
content?: import("tailwind-merge").ClassNameValue;
|
|
8
|
+
item?: import("tailwind-merge").ClassNameValue;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
} | {
|
|
12
|
+
[x: string]: {
|
|
13
|
+
[x: string]: import("tailwind-merge").ClassNameValue | {
|
|
14
|
+
base?: import("tailwind-merge").ClassNameValue;
|
|
15
|
+
header?: import("tailwind-merge").ClassNameValue;
|
|
16
|
+
title?: import("tailwind-merge").ClassNameValue;
|
|
17
|
+
content?: import("tailwind-merge").ClassNameValue;
|
|
18
|
+
item?: import("tailwind-merge").ClassNameValue;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
} | {}, {
|
|
22
|
+
base: string;
|
|
23
|
+
item: string;
|
|
24
|
+
header: string;
|
|
25
|
+
title: string;
|
|
26
|
+
content: string;
|
|
27
|
+
}, undefined, {
|
|
28
|
+
responsiveVariants?: boolean | ("sm" | "md" | "lg" | "xl" | "2xl")[] | {} | undefined;
|
|
29
|
+
} & import("tailwind-variants/dist/config").TWMConfig & {
|
|
30
|
+
twMergeConfig: {
|
|
31
|
+
prefix: string;
|
|
32
|
+
};
|
|
33
|
+
}, {
|
|
34
|
+
[key: string]: {
|
|
35
|
+
[key: string]: import("tailwind-merge").ClassNameValue | {
|
|
36
|
+
base?: import("tailwind-merge").ClassNameValue;
|
|
37
|
+
header?: import("tailwind-merge").ClassNameValue;
|
|
38
|
+
title?: import("tailwind-merge").ClassNameValue;
|
|
39
|
+
content?: import("tailwind-merge").ClassNameValue;
|
|
40
|
+
item?: import("tailwind-merge").ClassNameValue;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
} | {}, {
|
|
44
|
+
base: string;
|
|
45
|
+
item: string;
|
|
46
|
+
header: string;
|
|
47
|
+
title: string;
|
|
48
|
+
content: string;
|
|
49
|
+
}, import("tailwind-variants").TVReturnType<unknown, {
|
|
50
|
+
base: string;
|
|
51
|
+
item: string;
|
|
52
|
+
header: string;
|
|
53
|
+
title: string;
|
|
54
|
+
content: string;
|
|
55
|
+
}, undefined, import("tailwind-variants/dist/config").TVConfig<unknown, {
|
|
56
|
+
[key: string]: {
|
|
57
|
+
[key: string]: import("tailwind-merge").ClassNameValue | {
|
|
58
|
+
base?: import("tailwind-merge").ClassNameValue;
|
|
59
|
+
header?: import("tailwind-merge").ClassNameValue;
|
|
60
|
+
title?: import("tailwind-merge").ClassNameValue;
|
|
61
|
+
content?: import("tailwind-merge").ClassNameValue;
|
|
62
|
+
item?: import("tailwind-merge").ClassNameValue;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
} | {}>, unknown, unknown, undefined>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
3
|
+
import stl from "./../../styles/helpers/satellitePrefixer";
|
|
4
|
+
import { tv } from "./../../styles/helpers/tv";
|
|
5
|
+
export var chatContextContainerStyles = tv({
|
|
6
|
+
slots: {
|
|
7
|
+
base: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["w-full"]))),
|
|
8
|
+
item: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["border border-grey-200 rounded-[4px] overflow-hidden"]))),
|
|
9
|
+
header: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["flex items-center justify-between bg-white border-b border-grey-200 transition-colors duration-500 pl-3 pr-1 min-h-8"]))),
|
|
10
|
+
// override markdown-content styles for "p" tags
|
|
11
|
+
title: stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["!typo-display-caption !typo-subdued !m-0"]))),
|
|
12
|
+
// select "code" to override any selectors added by markdown-content styles
|
|
13
|
+
content: stl(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["bg-grey-100 [&_code]:bg-grey-100 text-grey-600 [&_code]:text-grey-600 text-sm [&_code]:text-sm leading-[20px] [&_code]:leading-[20px] px-3 py-2 [&_code]:p-0 [&_code]:m-0 overflow-y-auto max-h-80 thin-scrollbar"])))
|
|
14
|
+
}
|
|
15
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ChatContextContainer";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ChatContextContainer";
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export declare const theme: {
|
|
2
|
+
'pre[class*="language-"]': {
|
|
3
|
+
whiteSpace: string;
|
|
4
|
+
};
|
|
5
|
+
comment: {
|
|
6
|
+
color: string;
|
|
7
|
+
};
|
|
8
|
+
tag: {
|
|
9
|
+
color: string;
|
|
10
|
+
};
|
|
11
|
+
boolean: {
|
|
12
|
+
color: string;
|
|
13
|
+
};
|
|
14
|
+
number: {
|
|
15
|
+
color: string;
|
|
16
|
+
};
|
|
17
|
+
constant: {
|
|
18
|
+
color: string;
|
|
19
|
+
};
|
|
20
|
+
symbol: {
|
|
21
|
+
color: string;
|
|
22
|
+
};
|
|
23
|
+
selector: {
|
|
24
|
+
color: string;
|
|
25
|
+
};
|
|
26
|
+
"attr-name": {
|
|
27
|
+
color: string;
|
|
28
|
+
};
|
|
29
|
+
string: {
|
|
30
|
+
color: string;
|
|
31
|
+
};
|
|
32
|
+
char: {
|
|
33
|
+
color: string;
|
|
34
|
+
};
|
|
35
|
+
inserted: {
|
|
36
|
+
color: string;
|
|
37
|
+
};
|
|
38
|
+
url: {
|
|
39
|
+
color: string;
|
|
40
|
+
background: string;
|
|
41
|
+
};
|
|
42
|
+
"attr-value": {
|
|
43
|
+
color: string;
|
|
44
|
+
};
|
|
45
|
+
function: {
|
|
46
|
+
color: string;
|
|
47
|
+
};
|
|
48
|
+
keyword: {
|
|
49
|
+
color: string;
|
|
50
|
+
};
|
|
51
|
+
bold: {
|
|
52
|
+
fontWeight: string;
|
|
53
|
+
};
|
|
54
|
+
italic: {
|
|
55
|
+
fontStyle: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { colors } from "./../../index";
|
|
2
|
+
var BACKGROUND = colors.grey[100];
|
|
3
|
+
var PINK = colors.pink[700];
|
|
4
|
+
var BLUE = colors.xenon[600];
|
|
5
|
+
var DARK_BLUE = colors.nebula[900];
|
|
6
|
+
var LIGHT_BLUE = colors.blue[800];
|
|
7
|
+
var GREEN = colors.green[800];
|
|
8
|
+
var ORANGE = colors.orange[700];
|
|
9
|
+
|
|
10
|
+
// Based on prism theme with design token colors
|
|
11
|
+
export var theme = {
|
|
12
|
+
'pre[class*="language-"]': {
|
|
13
|
+
whiteSpace: "pre"
|
|
14
|
+
},
|
|
15
|
+
comment: {
|
|
16
|
+
color: DARK_BLUE
|
|
17
|
+
},
|
|
18
|
+
tag: {
|
|
19
|
+
color: ORANGE
|
|
20
|
+
},
|
|
21
|
+
"boolean": {
|
|
22
|
+
color: BLUE
|
|
23
|
+
},
|
|
24
|
+
number: {
|
|
25
|
+
color: BLUE
|
|
26
|
+
},
|
|
27
|
+
constant: {
|
|
28
|
+
color: BLUE
|
|
29
|
+
},
|
|
30
|
+
symbol: {
|
|
31
|
+
color: BLUE
|
|
32
|
+
},
|
|
33
|
+
selector: {
|
|
34
|
+
color: GREEN
|
|
35
|
+
},
|
|
36
|
+
"attr-name": {
|
|
37
|
+
color: GREEN
|
|
38
|
+
},
|
|
39
|
+
string: {
|
|
40
|
+
color: GREEN
|
|
41
|
+
},
|
|
42
|
+
"char": {
|
|
43
|
+
color: GREEN
|
|
44
|
+
},
|
|
45
|
+
inserted: {
|
|
46
|
+
color: GREEN
|
|
47
|
+
},
|
|
48
|
+
url: {
|
|
49
|
+
color: BLUE,
|
|
50
|
+
background: BACKGROUND
|
|
51
|
+
},
|
|
52
|
+
"attr-value": {
|
|
53
|
+
color: PINK
|
|
54
|
+
},
|
|
55
|
+
"function": {
|
|
56
|
+
color: LIGHT_BLUE
|
|
57
|
+
},
|
|
58
|
+
keyword: {
|
|
59
|
+
color: PINK
|
|
60
|
+
},
|
|
61
|
+
bold: {
|
|
62
|
+
fontWeight: "bold"
|
|
63
|
+
},
|
|
64
|
+
italic: {
|
|
65
|
+
fontStyle: "italic"
|
|
66
|
+
}
|
|
67
|
+
};
|
|
@@ -3,11 +3,11 @@ import type { VariantProps } from "tailwind-variants";
|
|
|
3
3
|
import { chatMessageStyles } from "./ChatMessage.styles";
|
|
4
4
|
import type { IconButtonWithFeedbackProps } from "../../Actions";
|
|
5
5
|
import type { UserAvatarProps } from "../../Indicators";
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
type ChatMessageVariants = VariantProps<typeof chatMessageStyles>;
|
|
7
|
+
type Actions<ActionsExtraData extends Record<string, any> = Record<string, any>> = Array<Omit<IconButtonWithFeedbackProps, "onClick" | "tooltipDelay" | "tooltipHideDelay"> & {
|
|
8
8
|
onClick?: (e: MouseEvent<HTMLButtonElement>, actionsExtraData?: ActionsExtraData) => Promise<void> | void;
|
|
9
9
|
}>;
|
|
10
|
-
export
|
|
10
|
+
export type ChatMessageProps<ActionsExtraData extends Record<string, any> = Record<string, any>> = Omit<HTMLAttributes<HTMLElement>, "children" | "content"> & {
|
|
11
11
|
/**
|
|
12
12
|
* The content of the message.
|
|
13
13
|
*/
|
|
@@ -62,56 +62,7 @@ export declare type ChatMessageProps<ActionsExtraData extends Record<string, any
|
|
|
62
62
|
*
|
|
63
63
|
* See the [ChatMessage documentation page](https://satellite.algolia.com/8261d6576/p/06f740-chat-message) for more information.
|
|
64
64
|
*/
|
|
65
|
-
export declare const ChatMessage: <ActionsExtraData extends Record<string, any> = Record<string, any>>(props:
|
|
66
|
-
|
|
67
|
-
* The content of the message.
|
|
68
|
-
*/
|
|
69
|
-
content: ReactNode;
|
|
70
|
-
/**
|
|
71
|
-
* The avatar of the message.
|
|
72
|
-
*/
|
|
73
|
-
avatar?: import("../../Indicators/Avatars/types").MinimalUser | undefined;
|
|
74
|
-
/**
|
|
75
|
-
* The size of the avatar.
|
|
76
|
-
*/
|
|
77
|
-
avatarSize?: UserAvatarProps["size"];
|
|
78
|
-
/**
|
|
79
|
-
* The side of the message.
|
|
80
|
-
*/
|
|
81
|
-
side?: ChatMessageVariants["side"];
|
|
82
|
-
/**
|
|
83
|
-
* The variant of the message.
|
|
84
|
-
*/
|
|
85
|
-
variant?: ChatMessageVariants["variant"];
|
|
86
|
-
/**
|
|
87
|
-
* The actions of the message.
|
|
88
|
-
*/
|
|
89
|
-
actions?: Actions<ActionsExtraData> | undefined;
|
|
90
|
-
/**
|
|
91
|
-
* Whether to automatically hide the actions.
|
|
92
|
-
*/
|
|
93
|
-
autoHideActions?: boolean | undefined;
|
|
94
|
-
/**
|
|
95
|
-
* The leading content of the message.
|
|
96
|
-
*/
|
|
97
|
-
renderLeading?: ReactNode;
|
|
98
|
-
/**
|
|
99
|
-
* The actions content of the message.
|
|
100
|
-
*/
|
|
101
|
-
renderActions?: ((actions?: Actions<ActionsExtraData> | undefined) => ReactNode) | undefined;
|
|
102
|
-
/**
|
|
103
|
-
* The footer content of the message.
|
|
104
|
-
*/
|
|
105
|
-
renderFooter?: ReactNode;
|
|
106
|
-
/**
|
|
107
|
-
* The extra data of the actions.
|
|
108
|
-
*/
|
|
109
|
-
actionsExtraData?: ActionsExtraData | undefined;
|
|
110
|
-
/**
|
|
111
|
-
* Whether to render the message in RTL.
|
|
112
|
-
*/
|
|
113
|
-
rtl?: boolean | undefined;
|
|
114
|
-
} & {
|
|
115
|
-
ref?: Ref<HTMLDivElement> | undefined;
|
|
65
|
+
export declare const ChatMessage: <ActionsExtraData extends Record<string, any> = Record<string, any>>(props: ChatMessageProps<ActionsExtraData> & {
|
|
66
|
+
ref?: Ref<HTMLDivElement>;
|
|
116
67
|
}) => ReactElement | null;
|
|
117
68
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
2
|
import type { ButtonProps } from "../../Actions";
|
|
3
3
|
import type { ChatMessageProps } from "../../Chat/ChatMessage";
|
|
4
|
-
export
|
|
4
|
+
export type ChatMessageErrorLocale = {
|
|
5
5
|
error?: string;
|
|
6
6
|
retry?: string;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type ChatMessageErrorProps = Omit<HTMLAttributes<HTMLElement>, "children"> & Pick<ChatMessageProps, "rtl"> & {
|
|
9
9
|
/**
|
|
10
10
|
* Content to render as the error message.
|
|
11
11
|
* If not provided, a default error message will be shown.
|
|
@@ -35,7 +35,7 @@ export declare type ChatMessageErrorProps = Omit<HTMLAttributes<HTMLElement>, "c
|
|
|
35
35
|
*
|
|
36
36
|
* See the [ChatMessageError documentation page](https://satellite.algolia.com/8261d6576/p/06f740-chat-message-error) for more information.
|
|
37
37
|
*/
|
|
38
|
-
export declare const ChatMessageError: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLElement>, "children"> & Pick<ChatMessageProps
|
|
38
|
+
export declare const ChatMessageError: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLElement>, "children"> & Pick<ChatMessageProps, "rtl"> & {
|
|
39
39
|
/**
|
|
40
40
|
* Content to render as the error message.
|
|
41
41
|
* If not provided, a default error message will be shown.
|
|
@@ -49,14 +49,14 @@ export declare const ChatMessageError: import("react").ForwardRefExoticComponent
|
|
|
49
49
|
* Optional actions to display below the error message.
|
|
50
50
|
* If not provided, a default retry button will be shown.
|
|
51
51
|
*/
|
|
52
|
-
actions?: ButtonProps[]
|
|
52
|
+
actions?: ButtonProps[];
|
|
53
53
|
/**
|
|
54
54
|
* Callback function to be called when the retry button is clicked.
|
|
55
55
|
* If not provided, the default retry button will not have any action.
|
|
56
56
|
*/
|
|
57
|
-
onReload?: (
|
|
57
|
+
onReload?: () => void;
|
|
58
58
|
/**
|
|
59
59
|
* Optional locale.
|
|
60
60
|
*/
|
|
61
|
-
locale?: ChatMessageErrorLocale
|
|
61
|
+
locale?: ChatMessageErrorLocale;
|
|
62
62
|
} & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
2
|
import type { ChatMessageProps } from "../../Chat/ChatMessage";
|
|
3
|
-
export
|
|
3
|
+
export type ChatMessageLoaderProps = Omit<HTMLAttributes<HTMLElement>, "children"> & Pick<ChatMessageProps, "rtl"> & {
|
|
4
4
|
/**
|
|
5
5
|
* Message to display in the loader.
|
|
6
6
|
* If not provided, no message will be shown.
|
|
@@ -12,7 +12,7 @@ export declare type ChatMessageLoaderProps = Omit<HTMLAttributes<HTMLElement>, "
|
|
|
12
12
|
*
|
|
13
13
|
* See the [ChatMessageLoader documentation page](https://satellite.algolia.com/8261d6576/p/06f740-chat-message-loader) for more information.
|
|
14
14
|
*/
|
|
15
|
-
export declare const ChatMessageLoader: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLElement>, "children"> & Pick<ChatMessageProps
|
|
15
|
+
export declare const ChatMessageLoader: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLElement>, "children"> & Pick<ChatMessageProps, "rtl"> & {
|
|
16
16
|
/**
|
|
17
17
|
* Message to display in the loader.
|
|
18
18
|
* If not provided, no message will be shown.
|
|
@@ -3,11 +3,11 @@ import type { ChatMessageProps } from "../../Chat/ChatMessage";
|
|
|
3
3
|
import type { ChatMessageErrorProps } from "../../Chat/ChatMessageError";
|
|
4
4
|
import type { ChatMessageLoaderProps } from "../../Chat/ChatMessageLoader";
|
|
5
5
|
import type { ChatMessageBase, ChatStatus } from "../../Chat/types";
|
|
6
|
-
export
|
|
6
|
+
export type ChatMessageLocale = {
|
|
7
7
|
scrollToBottomText?: string;
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
export
|
|
9
|
+
type ChatMessageWithoutContent<Message extends ChatMessageBase> = Omit<ChatMessageProps<Message>, "content">;
|
|
10
|
+
export type ChatMessagesProps<Message extends ChatMessageBase = ChatMessageBase> = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
11
11
|
/**
|
|
12
12
|
* The messages to display in the chat.
|
|
13
13
|
*/
|
|
@@ -74,68 +74,7 @@ export declare type ChatMessagesProps<Message extends ChatMessageBase = ChatMess
|
|
|
74
74
|
*
|
|
75
75
|
* See the [ChatMessages documentation page](https://satellite.algolia.com/8261d6576/p/06f740-chat-messages) for more information.
|
|
76
76
|
*/
|
|
77
|
-
export declare const ChatMessages: <Message extends ChatMessageBase = ChatMessageBase>(props:
|
|
78
|
-
|
|
79
|
-
* The messages to display in the chat.
|
|
80
|
-
*/
|
|
81
|
-
messages: Message[];
|
|
82
|
-
/**
|
|
83
|
-
* The props for the user message.
|
|
84
|
-
*/
|
|
85
|
-
userMessageProps?: ChatMessageWithoutContent<Message> | ((message: Message) => ChatMessageWithoutContent<Message>) | undefined;
|
|
86
|
-
/**
|
|
87
|
-
* The props for the assistant message.
|
|
88
|
-
*/
|
|
89
|
-
assistantMessageProps?: ChatMessageWithoutContent<Message> | ((message: Message) => ChatMessageWithoutContent<Message>) | undefined;
|
|
90
|
-
/**
|
|
91
|
-
* The props for the loader message.
|
|
92
|
-
*/
|
|
93
|
-
loaderProps?: ChatMessageLoaderProps | undefined;
|
|
94
|
-
/**
|
|
95
|
-
* The props for the error message.
|
|
96
|
-
*/
|
|
97
|
-
errorProps?: Omit<ChatMessageErrorProps, "onReload"> | undefined;
|
|
98
|
-
/**
|
|
99
|
-
* The function to render the message.
|
|
100
|
-
*/
|
|
101
|
-
renderMessage?: ((message: Message) => ReactNode) | undefined;
|
|
102
|
-
/**
|
|
103
|
-
* The function to render the loader message.
|
|
104
|
-
*/
|
|
105
|
-
renderLoader?: ReactNode;
|
|
106
|
-
/**
|
|
107
|
-
* The function to render the error message.
|
|
108
|
-
*/
|
|
109
|
-
renderError?: ReactNode;
|
|
110
|
-
/**
|
|
111
|
-
* The status of the chat.
|
|
112
|
-
*/
|
|
113
|
-
status?: ChatStatus | undefined;
|
|
114
|
-
/**
|
|
115
|
-
* The function to reload the chat.
|
|
116
|
-
*/
|
|
117
|
-
onReload?: (() => void) | undefined;
|
|
118
|
-
/**
|
|
119
|
-
* Whether to hide the scroll to bottom button.
|
|
120
|
-
*/
|
|
121
|
-
hideScrollToBottom?: boolean | undefined;
|
|
122
|
-
/**
|
|
123
|
-
* The class name for the scroll container.
|
|
124
|
-
*/
|
|
125
|
-
scrollClassName?: string | undefined;
|
|
126
|
-
/**
|
|
127
|
-
* The class name for the content container.
|
|
128
|
-
*/
|
|
129
|
-
contentClassName?: string | undefined;
|
|
130
|
-
/**
|
|
131
|
-
* The locale for the chat messages.
|
|
132
|
-
*/
|
|
133
|
-
locale?: ChatMessageLocale | undefined;
|
|
134
|
-
/**
|
|
135
|
-
* Whether to enable right-to-left text direction.
|
|
136
|
-
*/
|
|
137
|
-
rtl?: boolean | undefined;
|
|
138
|
-
} & {
|
|
139
|
-
ref?: Ref<HTMLDivElement> | undefined;
|
|
77
|
+
export declare const ChatMessages: <Message extends ChatMessageBase = ChatMessageBase>(props: ChatMessagesProps<Message> & {
|
|
78
|
+
ref?: Ref<HTMLDivElement>;
|
|
140
79
|
}) => ReactElement | null;
|
|
141
80
|
export {};
|
|
@@ -48,7 +48,6 @@ var ChatMessagesBase = function ChatMessagesBase(_ref, forwardedRef) {
|
|
|
48
48
|
var contextLocale = useLocale("chatMessage");
|
|
49
49
|
var locale = _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_CHAT_MESSAGE_LOCALE), contextLocale), propsLocale);
|
|
50
50
|
var _useStickToBottom = useStickToBottom({
|
|
51
|
-
// @ts-expect-error - Types are wrong in use-stick-to-bottom
|
|
52
51
|
initial: "instant",
|
|
53
52
|
resize: "smooth"
|
|
54
53
|
}),
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { FormEvent, KeyboardEvent, ReactNode } from "react";
|
|
2
2
|
import type { ChatStatus } from "../../Chat/types";
|
|
3
3
|
import type { TextAreaAutoSizeProps } from "../../Fields/TextAreaAutoSize/TextAreaAutoSize";
|
|
4
|
-
export
|
|
4
|
+
export type ChatPromptLocale = {
|
|
5
5
|
textareaLabel?: string;
|
|
6
6
|
emptyMessageTooltip?: string;
|
|
7
7
|
stopResponseTooltip?: string;
|
|
8
8
|
sendMessageTooltip?: string;
|
|
9
9
|
disabledTooltip?: string;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type ChatPromptProps = Omit<TextAreaAutoSizeProps, "onSubmit"> & {
|
|
12
12
|
/**
|
|
13
13
|
* Content to render above the textarea (e.g., a title or instructions).
|
|
14
14
|
*/
|
|
@@ -72,7 +72,7 @@ export declare const ChatPrompt: import("react").ForwardRefExoticComponent<Omit<
|
|
|
72
72
|
* If provided and non-empty, the component will use the dynamic, animated placeholder
|
|
73
73
|
* text instead of any static `placeholder` prop passed in.
|
|
74
74
|
*/
|
|
75
|
-
placeholders?: string[]
|
|
75
|
+
placeholders?: string[];
|
|
76
76
|
/**
|
|
77
77
|
* The current status of the chat prompt submit button:
|
|
78
78
|
* - "submitted": The message has been sent to the API and we're awaiting the start of the response stream.
|
|
@@ -80,26 +80,26 @@ export declare const ChatPrompt: import("react").ForwardRefExoticComponent<Omit<
|
|
|
80
80
|
* - "ready": The full response has been received and processed; a new user message can be submitted.
|
|
81
81
|
* - "error": An error occurred during the API request, preventing successful completion.
|
|
82
82
|
*/
|
|
83
|
-
status?: ChatStatus
|
|
83
|
+
status?: ChatStatus;
|
|
84
84
|
/**
|
|
85
85
|
* Whether to automatically focus the textarea when the user starts typing.
|
|
86
86
|
*/
|
|
87
|
-
autoFocusOnTyping?: boolean
|
|
87
|
+
autoFocusOnTyping?: boolean;
|
|
88
88
|
/**
|
|
89
89
|
* Whether to enable right-to-left (RTL) layout support.
|
|
90
90
|
*/
|
|
91
|
-
rtl?: boolean
|
|
91
|
+
rtl?: boolean;
|
|
92
92
|
/**
|
|
93
93
|
* Optional locale.
|
|
94
94
|
*/
|
|
95
|
-
locale?: ChatPromptLocale
|
|
95
|
+
locale?: ChatPromptLocale;
|
|
96
96
|
/**
|
|
97
97
|
* Callback invoked when the user submits the form, either by clicking
|
|
98
98
|
* the submit button or pressing Enter (without Shift) inside the textarea.
|
|
99
99
|
*/
|
|
100
|
-
onSubmit?: (
|
|
100
|
+
onSubmit?: (e: KeyboardEvent<HTMLTextAreaElement> | FormEvent<HTMLFormElement>) => void;
|
|
101
101
|
/**
|
|
102
102
|
* Callback invoked when the user requests to stop the current chat response stream.
|
|
103
103
|
*/
|
|
104
|
-
onStop?: (
|
|
104
|
+
onStop?: () => void;
|
|
105
105
|
} & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
/**
|
|
3
2
|
* Check if the element is a textual element.
|
|
4
3
|
* @param el - The element to check.
|
|
5
4
|
* @returns True if the element is a textual element, false otherwise.
|
|
6
5
|
*/
|
|
7
6
|
export declare const isTextualElement: (el: HTMLElement) => boolean;
|
|
8
|
-
|
|
7
|
+
type Editable = HTMLTextAreaElement | HTMLInputElement | HTMLElement;
|
|
9
8
|
export interface UseFocusOnTypingOptions {
|
|
10
9
|
/**
|
|
11
10
|
* Whether the hook is enabled.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AiSdkMessage, AiSdkMessageV4, AiSdkMessageV5, ChatMessageWithSource } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Type guard to check if a message is in AI SDK v4.0 format.
|
|
4
|
+
* @param message - The message to check
|
|
5
|
+
* @returns True if the message is in v4.0 format (has string content property)
|
|
6
|
+
*/
|
|
7
|
+
export declare const isAiSdkMessageV4: (message: AiSdkMessage) => message is AiSdkMessageV4;
|
|
8
|
+
/**
|
|
9
|
+
* Type guard to check if a message is in AI SDK v5.0 format.
|
|
10
|
+
* @param message - The message to check
|
|
11
|
+
* @returns True if the message is in v5.0 format (has parts array)
|
|
12
|
+
*/
|
|
13
|
+
export declare const isAiSdkMessageV5: (message: AiSdkMessage) => message is AiSdkMessageV5;
|
|
14
|
+
/**
|
|
15
|
+
* Converts an AI SDK message (v4.0 or v5.0) to the universal ChatMessage format.
|
|
16
|
+
* For v4.0 messages, uses the content directly.
|
|
17
|
+
* For v5.0 messages, extracts text from parts and joins them.
|
|
18
|
+
* @param message - The AI SDK message to convert
|
|
19
|
+
* @returns A ChatMessage with the original message as source
|
|
20
|
+
*/
|
|
21
|
+
export declare function convertAiSdkMessage<T extends AiSdkMessage>(message: T): ChatMessageWithSource<T>;
|
|
22
|
+
/**
|
|
23
|
+
* Converts an array of AI SDK messages to the universal ChatMessage format.
|
|
24
|
+
* Filters out v4.0 data messages and converts the rest using convertAiSdkMessage.
|
|
25
|
+
* @param messages - Array of AI SDK messages to convert
|
|
26
|
+
* @returns Array of converted ChatMessages
|
|
27
|
+
*/
|
|
28
|
+
export declare function convertAiSdkMessages<T extends AiSdkMessage>(messages: T[]): ChatMessageWithSource<T>[];
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type guard to check if a message is in AI SDK v4.0 format.
|
|
3
|
+
* @param message - The message to check
|
|
4
|
+
* @returns True if the message is in v4.0 format (has string content property)
|
|
5
|
+
*/
|
|
6
|
+
export var isAiSdkMessageV4 = function isAiSdkMessageV4(message) {
|
|
7
|
+
return "content" in message && typeof message.content === "string";
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Type guard to check if a message is in AI SDK v5.0 format.
|
|
12
|
+
* @param message - The message to check
|
|
13
|
+
* @returns True if the message is in v5.0 format (has parts array)
|
|
14
|
+
*/
|
|
15
|
+
export var isAiSdkMessageV5 = function isAiSdkMessageV5(message) {
|
|
16
|
+
return "parts" in message && Array.isArray(message.parts);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Converts an AI SDK message (v4.0 or v5.0) to the universal ChatMessage format.
|
|
21
|
+
* For v4.0 messages, uses the content directly.
|
|
22
|
+
* For v5.0 messages, extracts text from parts and joins them.
|
|
23
|
+
* @param message - The AI SDK message to convert
|
|
24
|
+
* @returns A ChatMessage with the original message as source
|
|
25
|
+
*/
|
|
26
|
+
export function convertAiSdkMessage(message) {
|
|
27
|
+
var content;
|
|
28
|
+
if (isAiSdkMessageV4(message)) {
|
|
29
|
+
// V4: Use content directly
|
|
30
|
+
content = message.content;
|
|
31
|
+
} else if (isAiSdkMessageV5(message)) {
|
|
32
|
+
// V5: Extract text from parts
|
|
33
|
+
content = message.parts.filter(function (p) {
|
|
34
|
+
return p.type === "text";
|
|
35
|
+
}).map(function (p) {
|
|
36
|
+
return p.text;
|
|
37
|
+
}).join("");
|
|
38
|
+
} else {
|
|
39
|
+
content = "";
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
id: message.id,
|
|
43
|
+
role: message.role,
|
|
44
|
+
content: content,
|
|
45
|
+
source: message
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Converts an array of AI SDK messages to the universal ChatMessage format.
|
|
51
|
+
* Filters out v4.0 data messages and converts the rest using convertAiSdkMessage.
|
|
52
|
+
* @param messages - Array of AI SDK messages to convert
|
|
53
|
+
* @returns Array of converted ChatMessages
|
|
54
|
+
*/
|
|
55
|
+
export function convertAiSdkMessages(messages) {
|
|
56
|
+
return messages.filter(function (m) {
|
|
57
|
+
return !isAiSdkMessageV4(m) || m.role !== "data";
|
|
58
|
+
}) // Skip v4 data messages
|
|
59
|
+
.map(convertAiSdkMessage);
|
|
60
|
+
}
|