Skip to content

Commit d3aaa76

Browse files
committed
Add support of styled-components v6
1 parent 9203934 commit d3aaa76

File tree

44 files changed

+255
-115
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+255
-115
lines changed

CHANGELOG.md

+11-6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
### Added
1313

14+
- Added support for styled-components v6. This change is compatible with both styled-components v5 and v6. styled-components v6 introduces various breaking changes. One major difference is that styled-components v6 omits automatic vendor prefixing by default. If you prefer the v5 behavior, refer to the [styled-components v6 migration guide](https://styled-components.com/docs/faqs#what-do-i-need-to-do-to-migrate-to-v6) for details.
15+
1416
### Removed
1517

1618
### Changed
@@ -74,9 +76,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7476
### Removed
7577

7678
### Changed
79+
7780
- Updated `ContentShare` to have optional nameplate prop.
81+
7882
### Fixed
79-
- Fix a bug where the `isVideoEnabled` is still true even when the video device is unplugged.
83+
84+
- Fix a bug where the `isVideoEnabled` is still true even when the video device is unplugged.
8085

8186
- When audio inputs change in a meeting, `AudioInputProvider` will only automatically select a new audio input device if a meeting is joined with `DeviceLabels.Audio` or `DeviceLabels.AudioAndVideo` device labels.
8287
- Publish `MeetingStatus.Failed` only when a non-terminal failure is encountered. Currently, some Amazon Chime SDK for JavaScript meeting session statuses pass both the `sessionStatus.isFailure()` as well as `sessionStatus.isTerminal()` in JS SDK, thus, for a status if it is in both, it will be considered as non-terminal failure and `MeetingStatus.TerminalFailure` will never get set for such statuses. Check [MeetingSessionStatus](https://github.com/aws/amazon-chime-sdk-js/blob/main/src/meetingsession/MeetingSessionStatus.ts) file for more information on both methods in JS SDK.
@@ -85,18 +90,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8590

8691
### Added
8792

88-
* Add support for Node.js 18.
93+
- Add support for Node.js 18.
8994

9095
### Removed
9196

9297
### Changed
98+
9399
- Updated `VoiceFocusProvider` to destroy the Voice Focus worker thread on unmount.
94100
- Reverted changes to `BackgroundBlurProvider` and `BackgroundReplacemenProvider` to fix bug related to `isBackgroundBlurSupported` and `isBackgroundReplacementSupported` returning false.
95101

96102
### Fixed
97103

98-
* Update the documentation to use `GlobalStyles` along with `ThemeProvider`.
99-
104+
- Update the documentation to use `GlobalStyles` along with `ThemeProvider`.
100105

101106
## [3.4.0] - 2022-09-13
102107

@@ -171,7 +176,7 @@ Below is a list of all changes in Amazon Chime SDK React Components Library v3.
171176
- Remove preset device selection options ("None" and "440 Hz" for audio input device. "None", "Blue", and "SMTP Color Bars" for video input device). Remove `appendSampleDevices` from Props of `CameraSelection`, `MicSelection`, `AudioInputControl`, `AudioInputVFcontrol`, and `VideoInputControl`. Remove `DeviceConfig` type. Remove `additionalDevices` from Props of `useAudioInputs` and `useVideoInputs` hook.
172177
- Remove `useSelectAudioInputDevice`, `useSelectAudioOutputDevice` and `useSelectVideoInputDevice` hook.
173178
- Remove use of the deprecated `enableUnifiedPlanForChromiumBasedBrowsers` configuration variable.
174-
- Remove all deprecated `MeetingSessionStatusCode`.
179+
- Remove all deprecated `MeetingSessionStatusCode`.
175180
- Remove legacy metrics `videoDownstreamGoogFrameHeight`, `videoDownstreamGoogFrameWidth`, `videoUpstreamGoogFrameHeight` and `videoUpstreamGoogFrameWidth` from the `videoStreamMetrics` returned by the `useMediaStreamMetrics` hook to adopt to Amazon Chime SDK for JavaScript V3 changes ([aws/amazon-chime-sdk-js#2086](https://github.com/aws/amazon-chime-sdk-js/pull/2086)).
176181
- Remove `MeetingSessionConfiguration` properties from `MeetingProvider` props.
177182
- Remove `deviceLabels`, `eventController`, `logLevel`, `postLogConfig`, `logger`, `enableWebAudio`, and `activeSpeakerPolicy` from `MeetingProvider` props.
@@ -217,7 +222,7 @@ Below is a list of all changes in Amazon Chime SDK React Components Library v3.
217222
### Removed
218223

219224
- Remove use of the deprecated `enableUnifiedPlanForChromiumBasedBrowsers` configuration variable.
220-
- Remove all deprecated `MeetingSessionStatusCode`.
225+
- Remove all deprecated `MeetingSessionStatusCode`.
221226
- Remove legacy metrics `videoDownstreamGoogFrameHeight`, `videoDownstreamGoogFrameWidth`, `videoUpstreamGoogFrameHeight` and `videoUpstreamGoogFrameWidth` from the `videoStreamMetrics` returned by the `useMediaStreamMetrics` hook to adopt to Amazon Chime SDK for JavaScript V3 changes ([aws/amazon-chime-sdk-js#2086](https://github.com/aws/amazon-chime-sdk-js/pull/2086)).
222227
- Deprecate `useBandwidthMetrics` hook as we already have `useMediaStreamMetrics`.
223228
- Remove `MeetingSessionConfiguration` properties from `MeetingProvider` props.

src/components/sdk/LocalVideo/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import styled from 'styled-components';
77
import { useApplyVideoObjectFit } from '../../../hooks/useApplyVideoObjectFit';
88
import { useAudioVideo } from '../../../providers/AudioVideoProvider';
99
import { useLocalVideo } from '../../../providers/LocalVideoProvider';
10+
import { defaultStyledConfig } from '../../../utils/style';
1011
import VideoTile from '../../ui/VideoTile';
1112
import { BaseSdkProps } from '../Base';
1213

@@ -15,7 +16,7 @@ interface Props extends BaseSdkProps {
1516
nameplate?: string;
1617
}
1718

18-
const StyledLocalVideo = styled<any>(VideoTile)`
19+
const StyledLocalVideo = styled<any>(VideoTile).withConfig(defaultStyledConfig)`
1920
${(props) => (!props.active ? 'display: none' : '')};
2021
`;
2122

src/components/sdk/PreviewVideo/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ import { useVideoInputs } from '../../../providers/DevicesProvider';
99
import { useLocalVideo } from '../../../providers/LocalVideoProvider';
1010
import { useLogger } from '../../../providers/LoggerProvider';
1111
import { useMeetingManager } from '../../../providers/MeetingProvider';
12+
import { defaultStyledConfig } from '../../../utils/style';
1213
import VideoTile from '../../ui/VideoTile';
1314
import { BaseSdkProps } from '../Base';
1415

15-
const StyledPreview = styled(VideoTile)`
16+
const StyledPreview = styled(VideoTile).withConfig(defaultStyledConfig)`
1617
height: auto;
1718
background: unset;
1819

src/components/ui/Badge/Styled.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33

44
import styled from 'styled-components';
55

6+
import { defaultStyledConfig } from '../../../utils/style';
67
import { baseSpacing, baseStyles } from '../Base';
78
import { BadgeProps } from './';
89

9-
export const StyledBadge = styled.span<Partial<BadgeProps>>`
10+
export const StyledBadge = styled.span.withConfig(defaultStyledConfig)<
11+
Partial<BadgeProps>
12+
>`
1013
${(props) => {
1114
if (typeof props.value === 'object') {
1215
const element: JSX.Element = props.value as JSX.Element;

src/components/ui/Button/Styled.tsx

+7-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33

44
import styled, { css } from 'styled-components';
55

6-
import { visuallyHidden } from '../../../utils/style';
6+
import { defaultStyledConfig, visuallyHidden } from '../../../utils/style';
77
import { baseSpacing, baseStyles } from '../Base';
88
import { ButtonProps } from './';
99

10-
export const StyledButton = styled.button<ButtonProps>`
10+
export const StyledButton = styled.button.withConfig(
11+
defaultStyledConfig
12+
)<ButtonProps>`
1113
border-radius: ${(props) => props.theme.radii.default};
1214
font-size: ${(props) => props.theme.fontSizes.text.fontSize};
1315
padding: 0.5rem 1rem;
@@ -219,7 +221,9 @@ export const StyledIconButton = css<ButtonProps>`
219221
}
220222
`;
221223

222-
export const StyledIconButtonWrapper = styled.span`
224+
export const StyledIconButtonWrapper = styled.span.withConfig(
225+
defaultStyledConfig
226+
)`
223227
display: inline-block;
224228
position: relative;
225229
`;

src/components/ui/Chat/ChannelList/Styled.tsx

+7-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33

44
import styled from 'styled-components';
55

6+
import { defaultStyledConfig } from '../../../../utils/style';
67
import { baseSpacing, baseStyles } from '../../Base';
78
import { ChannelListProps } from '.';
89
import { ChannelItemProps } from './ChannelItem';
910

10-
export const StyledChannelList = styled.ul<ChannelListProps>`
11+
export const StyledChannelList = styled.ul.withConfig(
12+
defaultStyledConfig
13+
)<ChannelListProps>`
1114
display: flex;
1215
flex-direction: column;
1316
width: 20rem;
@@ -16,7 +19,9 @@ export const StyledChannelList = styled.ul<ChannelListProps>`
1619
${baseSpacing}
1720
`;
1821

19-
export const StyledChannelItem = styled.li<ChannelItemProps>`
22+
export const StyledChannelItem = styled.li.withConfig(
23+
defaultStyledConfig
24+
)<ChannelItemProps>`
2025
position: relative;
2126
2227
${baseStyles};

src/components/ui/Chat/ChatBubble/Styled.tsx

+8-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import styled from 'styled-components';
55

6+
import { defaultStyledConfig } from '../../../../utils/style';
67
import { BaseProps, baseSpacing, baseStyles } from '../../Base';
78
import { MessageVariant } from './ChatBubbleContainer';
89

@@ -15,7 +16,9 @@ interface StyledChatBubbleProps extends BaseProps {
1516
editable?: boolean;
1617
}
1718

18-
export const StyledChatBubbleContainer = styled.div<StyledChatBubbleContainerProps>`
19+
export const StyledChatBubbleContainer = styled.div.withConfig(
20+
defaultStyledConfig
21+
)<StyledChatBubbleContainerProps>`
1922
display: flex;
2023
flex-direction: row;
2124
font-size: 0.65rem;
@@ -32,7 +35,9 @@ export const StyledChatBubbleContainer = styled.div<StyledChatBubbleContainerPro
3235
${baseStyles}
3336
`;
3437

35-
export const StyledChatBubble = styled.div<StyledChatBubbleProps>`
38+
export const StyledChatBubble = styled.div.withConfig(
39+
defaultStyledConfig
40+
)<StyledChatBubbleProps>`
3641
background-color: ${(props) => props.theme.chatBubble[props.variant].bgd};
3742
padding: 0.625rem 1rem;
3843
border-radius: 4px;
@@ -94,7 +99,7 @@ export const StyledChatBubble = styled.div<StyledChatBubbleProps>`
9499
${baseStyles};
95100
`;
96101

97-
export const StyledChatBubbleInfo = styled.div`
102+
export const StyledChatBubbleInfo = styled.div.withConfig(defaultStyledConfig)`
98103
display: flex;
99104
margin-right: 0.5rem;
100105
margin-left: auto;

src/components/ui/Chat/InfiniteList/Styled.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import styled, { keyframes } from 'styled-components';
55

6+
import { defaultStyledConfig } from '../../../../utils/style';
67
import { baseSpacing, baseStyles } from '../../Base';
78
import { InfiniteListProps } from './';
89

@@ -18,7 +19,9 @@ const rotate = keyframes`
1819

1920
interface StyledInfiniteListProps extends InfiniteListProps {}
2021

21-
export const StyledInfiniteList = styled.ul<StyledInfiniteListProps>`
22+
export const StyledInfiniteList = styled.ul.withConfig(
23+
defaultStyledConfig
24+
)<StyledInfiniteListProps>`
2225
background-color: ${(props) => props.theme.chatBubble.container.bgd};
2326
overflow-y: scroll;
2427
display: flex;

src/components/ui/Chat/MessageAttachment/Styled.tsx

+10-5
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33

44
import styled from 'styled-components';
55

6+
import { defaultStyledConfig } from '../../../../utils/style';
67
import { BaseProps, baseSpacing, baseStyles } from '../../Base';
78

89
interface StyledMessageAttachmentProps extends BaseProps {
910
imgStyles?: string;
1011
}
1112

12-
export const StyledMessageAttachmentContent = styled.div`
13+
export const StyledMessageAttachmentContent = styled.div.withConfig(
14+
defaultStyledConfig
15+
)`
1316
display: flex;
1417
flex-direction: row;
1518
padding: 10px;
@@ -30,9 +33,9 @@ export const StyledMessageAttachmentContent = styled.div`
3033
margin-left: 1rem;
3134
3235
& a:link,
33-
a:visited,
34-
a:hover,
35-
a:active {
36+
& a:visited,
37+
& a:hover,
38+
& a:active {
3639
color: ${(props) => props.theme.messageAttachment.name.fontColor};
3740
text-decoration: none;
3841
}
@@ -45,7 +48,9 @@ export const StyledMessageAttachmentContent = styled.div`
4548
}
4649
`;
4750

48-
export const StyledMessageAttachment = styled.div<StyledMessageAttachmentProps>`
51+
export const StyledMessageAttachment = styled.div.withConfig(
52+
defaultStyledConfig
53+
)<StyledMessageAttachmentProps>`
4954
color: ${(props) => props.theme.messageAttachment.content.fontColor};
5055
display: flex;
5156
flex-direction: column;

src/components/ui/Checkbox/Styled.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
import styled from 'styled-components';
55

6-
import { visuallyHidden } from '../../../utils/style';
6+
import { defaultStyledConfig, visuallyHidden } from '../../../utils/style';
77
import { StyledCheckboxProps } from './';
88

9-
export const HiddenCheckbox = styled.input`
9+
export const HiddenCheckbox = styled.input.withConfig(defaultStyledConfig)`
1010
${visuallyHidden};
1111
1212
&[aria-invalid='true'] + .ch-checkbox {
@@ -15,7 +15,9 @@ export const HiddenCheckbox = styled.input`
1515
}
1616
`;
1717

18-
export const StyledCheckbox = styled.div<StyledCheckboxProps>`
18+
export const StyledCheckbox = styled.div.withConfig(
19+
defaultStyledConfig
20+
)<StyledCheckboxProps>`
1921
background-color: ${(props) => props.theme.inputs.bgd};
2022
border: ${(props) => props.theme.inputs.border};
2123
border-radius: ${(props) => props.theme.radii.default};

src/components/ui/ContentTile/index.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33

44
import styled from 'styled-components';
55

6+
import { createStyledConfig } from '../../../utils/style';
67
import { VideoTile } from '../../ui/VideoTile';
78

8-
export const ContentTile = styled(VideoTile)`
9+
export const ContentTile = styled(VideoTile).withConfig(
10+
createStyledConfig(['nameplate'])
11+
)`
912
background-color: ${({ theme }) => theme.colors.greys.grey80};
1013
`;
1114

src/components/ui/ControlBar/Styled.tsx

+13-14
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import styled, { css } from 'styled-components';
55

66
import { darkTheme } from '../../../theme/dark';
77
import { lightTheme } from '../../../theme/light';
8+
import { defaultStyledConfig } from '../../../utils/style';
89
import { baseSpacing, baseStyles } from '../Base';
910
import { PopOverItemProps } from '../PopOver/PopOverItem';
1011
import { ControlBarLayout, ControlBarProps } from '.';
@@ -47,30 +48,26 @@ export const responsiveStyles = (props: StyledControlBarProps) => {
4748
return css`
4849
${({ theme }) => theme.mediaQueries.max.sm} {
4950
${unsetPosition}
50-
${(props: StyledControlBarProps) =>
51-
isVertical(props.layout) ? layoutMap['left'] : layoutMap['bottom']};
52-
box-shadow: ${(props: StyledControlBarProps) =>
53-
props.theme.controlBar.shadow};
51+
${isVertical(props.layout) ? layoutMap['left'] : layoutMap['bottom']};
52+
box-shadow: ${props.theme.controlBar.shadow};
5453
border: none;
55-
height: ${(props: StyledControlBarProps) =>
56-
isVertical(props.layout) && '100%'};
57-
width: ${(props: StyledControlBarProps) =>
58-
!isVertical(props.layout) && '100%'};
54+
height: ${isVertical(props.layout) && '100%'};
55+
width: ${!isVertical(props.layout) && '100%'};
5956
}
6057
6158
${({ theme }) => theme.mediaQueries.max.xs} {
62-
justify-content: ${(props: StyledControlBarProps) =>
63-
isVertical(props.layout) ? 'center' : 'space-around'};
59+
justify-content: ${isVertical(props.layout) ? 'center' : 'space-around'};
6460
${unsetPosition}
65-
${(props: StyledControlBarProps) =>
66-
isVertical(props.layout) ? layoutMap['left'] : layoutMap['bottom']};
61+
${isVertical(props.layout) ? layoutMap['left'] : layoutMap['bottom']};
6762
box-shadow: ${({ theme }) => theme.controlBar.shadow};
6863
border: none;
6964
}
7065
`;
7166
};
7267

73-
export const StyledControlBar = styled.div<StyledControlBarProps>`
68+
export const StyledControlBar = styled.div.withConfig(
69+
defaultStyledConfig
70+
)<StyledControlBarProps>`
7471
display: inline-flex;
7572
justify-content: center;
7673
align-items: center;
@@ -98,7 +95,9 @@ interface StyledControlBarItemProps extends StyledControlBarProps {
9895
isSelected: boolean;
9996
}
10097

101-
export const StyledControlBarItem = styled.div<StyledControlBarItemProps>`
98+
export const StyledControlBarItem = styled.div.withConfig(
99+
defaultStyledConfig
100+
)<StyledControlBarItemProps>`
102101
margin: ${({ layout }) => (isVertical(layout) ? '0.625rem 0' : '0 0.625rem')};
103102
display: grid;
104103
grid-template-rows: ${({ showLabels }) =>

src/components/ui/Flex/Styled.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import styled, { css } from 'styled-components';
55

6+
import { defaultStyledConfig } from '../../../utils/style';
67
import { baseSpacing, baseStyles } from '../Base';
78
import { FlexProps } from './';
89

@@ -47,7 +48,7 @@ const layoutMap = {
4748
stack,
4849
};
4950

50-
export const StyledFlex = styled.div<FlexProps>`
51+
export const StyledFlex = styled.div.withConfig(defaultStyledConfig)<FlexProps>`
5152
align-items: ${(props) => props.alignItems};
5253
display: ${(props) => (props.container ? 'flex' : 'block')};
5354
flex: ${(props) => props.flex || ''};

0 commit comments

Comments
 (0)