diff --git a/.changelog/6024-fix-css-modules-option-free-styles-2.md b/.changelog/6024-fix-css-modules-option-free-styles-2.md new file mode 100644 index 0000000000..5831ed8b46 --- /dev/null +++ b/.changelog/6024-fix-css-modules-option-free-styles-2.md @@ -0,0 +1,7 @@ +### Changed + +- Converted the chat history box, image avatar, error box, transcript list and media attachments to CSS Modules with `webchat__` class names, and `videoHeight` to `--webchat__height--video`, in PR [#6024](https://github.com/microsoft/BotFramework-WebChat/pull/6024), by [@OEvgeny](https://github.com/OEvgeny) + +### Removed + +- 💥 Deprecated the `activities`, `audioAttachment`, `audioContent`, `chatHistoryBox`, `errorBox`, `imageAvatar`, `videoAttachment`, `videoContent`, `vimeoContent` and `youTubeContent` style set entries, which no longer affect rendering, and removed the unused `webchat__chat-history-box__toolbar--rtl` class, in PR [#6024](https://github.com/microsoft/BotFramework-WebChat/pull/6024), by [@OEvgeny](https://github.com/OEvgeny) diff --git a/__tests__/html2/rtl/scrollToEndButton.html b/__tests__/html2/rtl/scrollToEndButton.html new file mode 100644 index 0000000000..182cfd8520 --- /dev/null +++ b/__tests__/html2/rtl/scrollToEndButton.html @@ -0,0 +1,61 @@ + + + + + + +
+ + + + diff --git a/__tests__/html2/rtl/scrollToEndButton.html.snap-1.png b/__tests__/html2/rtl/scrollToEndButton.html.snap-1.png new file mode 100644 index 0000000000..734c851112 Binary files /dev/null and b/__tests__/html2/rtl/scrollToEndButton.html.snap-1.png differ diff --git a/__tests__/html2/styleOptions/videoHeight.html b/__tests__/html2/styleOptions/videoHeight.html new file mode 100644 index 0000000000..ad551e9325 --- /dev/null +++ b/__tests__/html2/styleOptions/videoHeight.html @@ -0,0 +1,59 @@ + + + + + + +
+ + + + diff --git a/__tests__/html2/styleOptions/videoHeight.html.snap-1.png b/__tests__/html2/styleOptions/videoHeight.html.snap-1.png new file mode 100644 index 0000000000..09005d6e11 Binary files /dev/null and b/__tests__/html2/styleOptions/videoHeight.html.snap-1.png differ diff --git a/packages/bundle/src/adaptiveCards/Attachment/AnimationCardContent.module.css b/packages/bundle/src/adaptiveCards/Attachment/AnimationCardContent.module.css index 506606a1ac..bfacfac7ac 100644 --- a/packages/bundle/src/adaptiveCards/Attachment/AnimationCardContent.module.css +++ b/packages/bundle/src/adaptiveCards/Attachment/AnimationCardContent.module.css @@ -26,7 +26,7 @@ display: block; } - /* Same two-tone focus indicator as video attachments, see `Styles/StyleSet/VideoAttachment.ts` in the component package. */ + /* Same two-tone focus indicator as video attachments, see `Attachment/MediaAttachment.module.css` in the component package. */ /* It follows the clipped top corners. When the bubble does not clip the video, the video is rounded like the indicator. */ > video:focus-visible { border-radius: inherit; diff --git a/packages/component/src/Attachment/AudioAttachment.js b/packages/component/src/Attachment/AudioAttachment.js index f04c6da71e..86824ba5dc 100644 --- a/packages/component/src/Attachment/AudioAttachment.js +++ b/packages/component/src/Attachment/AudioAttachment.js @@ -1,9 +1,11 @@ import { validateProps } from '@msinternal/botframework-webchat-react-valibot'; +import { useStyles, webChatPrefixedClassName } from '@msinternal/botframework-webchat-styles/react'; import React from 'react'; import { object, optional, pipe, readonly, string } from 'valibot'; import AudioContent from './AudioContent'; -import useStyleSet from '../hooks/useStyleSet'; + +import styles from './MediaAttachment.module.css'; const audioAttachmentPropsSchema = pipe( object({ @@ -21,10 +23,10 @@ const audioAttachmentPropsSchema = pipe( const AudioAttachment = props => { const { attachment } = validateProps(audioAttachmentPropsSchema, props); - const [{ audioAttachment: audioAttachmentStyleSet }] = useStyleSet(); + const classNames = useStyles(styles, webChatPrefixedClassName); return ( -
+
); diff --git a/packages/component/src/Attachment/AudioContent.tsx b/packages/component/src/Attachment/AudioContent.tsx index 711f5d55b2..bab37819c8 100644 --- a/packages/component/src/Attachment/AudioContent.tsx +++ b/packages/component/src/Attachment/AudioContent.tsx @@ -1,8 +1,9 @@ -import { validateProps } from '@msinternal/botframework-webchat-react-valibot'; +import { validateProps, type InferReactProps } from '@msinternal/botframework-webchat-react-valibot'; +import { useStyles, webChatPrefixedClassName } from '@msinternal/botframework-webchat-styles/react'; import React, { memo } from 'react'; -import { boolean, object, optional, pipe, readonly, string, type InferInput } from 'valibot'; +import { boolean, object, optional, pipe, readonly, string } from 'valibot'; -import useStyleSet from '../hooks/useStyleSet'; +import styles from './MediaAttachment.module.css'; const audioContentPropsSchema = pipe( object({ @@ -15,17 +16,18 @@ const audioContentPropsSchema = pipe( readonly() ); -type AudioContentProps = InferInput; +type AudioContentProps = InferReactProps; function AudioContent(props: AudioContentProps) { const { alt, autoPlay = false, loop = false, src } = validateProps(audioContentPropsSchema, props); - const [{ audioContent: audioContentStyleSet }] = useStyleSet(); + + const classNames = useStyles(styles, webChatPrefixedClassName); return (