Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Styled components 6 bump poc #1335

Draft
wants to merge 44 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
6812337
fix(component): add test util to disable vendor prefixes for snapshots
leeBigCommerce Feb 6, 2024
680495f
fix(component): update snapshots to remove expectation of vendor pref…
leeBigCommerce Feb 1, 2024
374ef5a
chore(deps): bump styled-components, jest-styled-components and add s…
leeBigCommerce Feb 1, 2024
f03a95c
fix(component): remove now redundant render wrapper that dropped vend…
leeBigCommerce Feb 1, 2024
e854eca
fix(component): fix eslint errors caused by styled-components bump
leeBigCommerce Feb 2, 2024
1e6287f
fix(component): move to RuleSet type from deprecated FlattenSimpleInt…
leeBigCommerce Feb 6, 2024
29f2c48
fix(component): move to IStyledComponent type from deprecated StyledC…
leeBigCommerce Feb 6, 2024
dcdd71b
chore(deps): dodgy draft - fix typescript and lint issues in big-desi…
leeBigCommerce Jan 23, 2024
d2b5615
chore(deps): dodgy draft - remove double assignment of defaultProps t…
leeBigCommerce Jan 23, 2024
5b52c7f
chore(deps): convert Link to transient props and add withTransients u…
leeBigCommerce Jan 23, 2024
9bb906f
chore(deps): convert Box to transient props
leeBigCommerce Jan 24, 2024
7e9400b
chore(deps): convert Flex to transient props
leeBigCommerce Jan 31, 2024
7c54c6d
chore(deps): convert Grid to transient props
leeBigCommerce Jan 31, 2024
37b0b11
chore(deps): convert Badge to transient props
leeBigCommerce Jan 24, 2024
7d862c1
chore(deps): convert Typeography to transient props
leeBigCommerce Jan 24, 2024
84e100d
chore(deps): correct StyledCircleFiller defaultProps and update snaps…
leeBigCommerce Jan 25, 2024
e87e05a
chore(deps): convert List and Button to transient props
leeBigCommerce Jan 25, 2024
c7c3166
chore(deps): convert Form and Input and Counter to transient props
leeBigCommerce Jan 25, 2024
7d01ec9
chore(deps): dodgy draft - skip Datepicker test pending investigation
leeBigCommerce Jan 25, 2024
b8de40b
chore(deps): update snapshorts for InlineMessage
leeBigCommerce Jan 25, 2024
11cf832
chore(deps): update snapshots for Message
leeBigCommerce Jan 25, 2024
326d1e9
chore(deps): update snapshots for Modal
leeBigCommerce Jan 25, 2024
234006a
chore(deps): update snapshots for Pagination
leeBigCommerce Jan 25, 2024
eeb07f6
chore(deps): dodgy draft - skip Panel test pending investigation
leeBigCommerce Jan 25, 2024
a06ff95
chore(deps): convert Panel to transient props
leeBigCommerce Jan 25, 2024
484f4b2
chore(deps): update snapshots for PillTabs
leeBigCommerce Jan 25, 2024
c06d521
chore(deps): convert ProgressBar to transient props
leeBigCommerce Jan 25, 2024
d989155
chore(deps): update snapshots for Radio
leeBigCommerce Jan 25, 2024
30ed821
chore(deps): convert Checkbox, Table and TableNext to transient props
leeBigCommerce Jan 30, 2024
ed4739e
chore(deps): update snapshots for AccordianPanel
leeBigCommerce Jan 30, 2024
898af15
chore(deps): update snapshots for Alert
leeBigCommerce Jan 30, 2024
00721b6
chore(deps): update snapshots for Button
leeBigCommerce Jan 30, 2024
722a923
chore(deps): update snapshots for Checkbox
leeBigCommerce Jan 30, 2024
a9c27a6
chore(deps): update snapshots for Chip
leeBigCommerce Jan 30, 2024
bdee094
chore(deps): update snapshots for Message
leeBigCommerce Jan 31, 2024
14388e8
chore(deps): update snapshots for Modal
leeBigCommerce Jan 31, 2024
866255e
chore(deps): update snapshots for Pagination
leeBigCommerce Jan 31, 2024
cbe7b6d
chore(deps): update snapshots for PillTabs
leeBigCommerce Jan 31, 2024
0e507a6
chore(deps): convert Tree to transient props
leeBigCommerce Jan 31, 2024
c583bda
chore(deps): update snapshots for Stepper
leeBigCommerce Jan 31, 2024
5e62c23
chore(deps): update snapshots for Switch
leeBigCommerce Jan 31, 2024
f971118
chore(deps): convert Textarea to transient props
leeBigCommerce Jan 31, 2024
47310fa
chore(deps): convert Toggle to transient props
leeBigCommerce Jan 31, 2024
3325667
chore(deps): convert Worksheet to transient props
leeBigCommerce Feb 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/big-design-icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"peerDependencies": {
"react": "^18.0.0",
"react-dom": "^18.0.0",
"styled-components": "^5.3.5"
"styled-components": "^6.1.8"
},
"devDependencies": {
"@babel/cli": "^7.15.4",
Expand Down Expand Up @@ -70,7 +70,8 @@
"react-dom": "^18.2.0",
"react-is": "^18.2.0",
"rimraf": "^5.0.0",
"styled-components": "^5.3.5",
"styled-components": "^6.1.8",
"stylis": "^4.3.1",
"tiny-async-pool": "^2.0.1",
"typescript": "^5.3.3",
"typescript-styled-plugin": "^0.18.2"
Expand Down
9 changes: 7 additions & 2 deletions packages/big-design-icons/src/base/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
ThemeInterface,
} from '@bigcommerce/big-design-theme';
import React, { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes, SVGProps } from 'react';
import styled from 'styled-components';
import { IStyledComponent, styled } from 'styled-components';

export interface IconProps extends SVGProps<SVGSVGElement> {
className?: string;
Expand All @@ -20,9 +20,14 @@ export interface PrivateIconProps {
titleId?: string;
}

type StyledIcon = IStyledComponent<
'web',
Omit<IconProps, 'ref'> & React.RefAttributes<SVGSVGElement>
>;

export function createStyledIcon(
Icon: ForwardRefExoticComponent<PropsWithoutRef<IconProps> & RefAttributes<SVGSVGElement>>,
) {
): StyledIcon {
const StyledIcon = styled(Icon)`
vertical-align: middle;

Expand Down
9 changes: 7 additions & 2 deletions packages/big-design-icons/src/flags/base/index.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import { theme as defaultTheme, Spacing, ThemeInterface } from '@bigcommerce/big-design-theme';
import { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes, SVGProps } from 'react';
import styled from 'styled-components';
import { IStyledComponent, styled } from 'styled-components';

export interface FlagIconProps extends SVGProps<SVGSVGElement> {
size?: keyof Spacing | number;
theme?: ThemeInterface;
title?: string;
}

type StyledFlagIcon = IStyledComponent<
'web',
Omit<FlagIconProps, 'ref'> & RefAttributes<SVGSVGElement>
>;

export function createStyledFlagIcon(
FlagIcon: ForwardRefExoticComponent<
PropsWithoutRef<FlagIconProps> & RefAttributes<SVGSVGElement>
>,
) {
): StyledFlagIcon {
const StyledFlagIcon = styled(FlagIcon)`
${({ size, theme }) =>
size && {
Expand Down
5 changes: 3 additions & 2 deletions packages/big-design-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"peerDependencies": {
"react": "^18.0.0",
"react-dom": "^18.0.0",
"styled-components": "^5.3.5"
"styled-components": "^6.1.8"
},
"devDependencies": {
"@babel/cli": "^7.15.4",
Expand All @@ -60,7 +60,8 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rimraf": "^5.0.0",
"styled-components": "^5.3.5",
"styled-components": "^6.1.8",
"stylis": "^4.3.1",
"typescript": "^5.3.3",
"typescript-styled-plugin": "^0.18.2"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/big-design-theme/src/helpers/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { em, hideVisually, math, rem, transparentize } from 'polished';
import { css, FlattenSimpleInterpolation } from 'styled-components';
import { css, RuleSet } from 'styled-components';

import { themeOptions } from '../options';

Expand All @@ -8,7 +8,7 @@ export interface Helpers {
createRGBA(color: string, alpha: number): string;
remCalc(value: string | number): string;
emCalc(value: string | number): string;
listReset: FlattenSimpleInterpolation;
listReset: RuleSet;
hideVisually: typeof hideVisually;
}

Expand Down
8 changes: 5 additions & 3 deletions packages/big-design/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"@babel/runtime": "^7.15.4",
"@bigcommerce/big-design-icons": "^0.25.1",
"@bigcommerce/big-design-theme": "^0.20.1",
"@emotion/is-prop-valid": "^1.2.1",
"@popperjs/core": "^2.11.6",
"@types/react-datepicker": "^4.4.2",
"date-fns": "2.30.0",
Expand All @@ -49,7 +50,7 @@
"peerDependencies": {
"react": "^18.0.0",
"react-dom": "^18.0.0",
"styled-components": "^5.3.5"
"styled-components": "^6.1.8"
},
"devDependencies": {
"@babel/cli": "^7.15.4",
Expand Down Expand Up @@ -77,12 +78,13 @@
"jest": "^29.0.3",
"jest-environment-jsdom": "^29.4.1",
"jest-fail-on-console": "^3.1.1",
"jest-styled-components": "^7.1.1",
"jest-styled-components": "^7.2.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-test-renderer": "^18.2.0",
"rimraf": "^5.0.0",
"styled-components": "^5.3.5",
"styled-components": "^6.1.8",
"stylis": "^4.3.1",
"typescript": "^5.3.3",
"typescript-styled-plugin": "^0.18.2"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { theme as defaultTheme, remCalc } from '@bigcommerce/big-design-theme';
import styled, { css } from 'styled-components';
import { css, styled } from 'styled-components';

import { withTransition } from '../../../mixins/transitions';
import { Box } from '../../Box';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`it renders accordion panel header 1`] = `
<h2
class="styled__StyledH2-sc-tqnj75-2 styled__StyledH2-sc-1h6ef3q-1 ilmBBr iRmYTD"
class="styled__StyledH2-sc-tqnj75-2 styled__StyledH2-sc-1h6ef3q-1 ctTqqD htyVYX"
>
Accordion Panel Header
</h2>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { theme as defaultTheme } from '@bigcommerce/big-design-theme';
import styled from 'styled-components';
import { styled } from 'styled-components';

import { Flex } from '../Flex';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ exports[`render default (success) Alert 1`] = `
.c2 {
border-radius: 0.25rem;
box-shadow: 0px 2px 12px rgba(49,52,64,0.2);
-webkit-animation: jBcSpD .5s ease-in-out;
animation: jBcSpD .5s ease-in-out;
background-color: #FFFFFF;
grid-gap: 0.75rem;
Expand Down Expand Up @@ -149,7 +148,6 @@ exports[`render error Alert 1`] = `
.c2 {
border-radius: 0.25rem;
box-shadow: 0px 2px 12px rgba(49,52,64,0.2);
-webkit-animation: jBcSpD .5s ease-in-out;
animation: jBcSpD .5s ease-in-out;
background-color: #FFFFFF;
grid-gap: 0.75rem;
Expand Down Expand Up @@ -252,7 +250,6 @@ exports[`render info Alert 1`] = `
.c2 {
border-radius: 0.25rem;
box-shadow: 0px 2px 12px rgba(49,52,64,0.2);
-webkit-animation: jBcSpD .5s ease-in-out;
animation: jBcSpD .5s ease-in-out;
background-color: #FFFFFF;
grid-gap: 0.75rem;
Expand Down Expand Up @@ -359,7 +356,6 @@ exports[`render warning Alert 1`] = `
.c2 {
border-radius: 0.25rem;
box-shadow: 0px 2px 12px rgba(49,52,64,0.2);
-webkit-animation: jBcSpD .5s ease-in-out;
animation: jBcSpD .5s ease-in-out;
background-color: #FFFFFF;
grid-gap: 0.75rem;
Expand Down Expand Up @@ -439,45 +435,26 @@ exports[`renders close button 1`] = `
}

.c8 {
-webkit-transition: all 150ms ease-out;
transition: all 150ms ease-out;
-webkit-transition-property: background-color,border-color,box-shadow,color;
transition-property: background-color,border-color,box-shadow,color;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
border: 1px solid #D9DCE9;
border-radius: 0.25rem;
color: #FFFFFF;
cursor: pointer;
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: -ms-inline-flexbox;
display: inline-flex;
-webkit-flex: none;
-ms-flex: none;
flex: none;
font-size: 1rem;
font-weight: 400;
height: 2.25rem;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
line-height: 2rem;
outline: none;
padding: 0 1rem;
position: relative;
text-align: center;
-webkit-text-decoration: none;
text-decoration: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
vertical-align: middle;
white-space: nowrap;
Expand All @@ -496,7 +473,7 @@ exports[`renders close button 1`] = `
pointer-events: none;
}

.c8 + .bd-button {
.c8+.bd-button {
margin-top: 0.5rem;
}

Expand All @@ -517,12 +494,7 @@ exports[`renders close button 1`] = `
}

.c10 {
-webkit-align-content: center;
-ms-flex-line-pack: center;
align-content: center;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
display: inline-grid;
grid-auto-flow: column;
Expand Down Expand Up @@ -584,7 +556,6 @@ exports[`renders close button 1`] = `
.c2 {
border-radius: 0.25rem;
box-shadow: 0px 2px 12px rgba(49,52,64,0.2);
-webkit-animation: jBcSpD .5s ease-in-out;
animation: jBcSpD .5s ease-in-out;
background-color: #FFFFFF;
grid-gap: 0.75rem;
Expand All @@ -604,14 +575,14 @@ exports[`renders close button 1`] = `
vertical-align: middle;
}

@media (min-width:720px) {
.c8 + .bd-button {
@media (min-width: 720px) {
.c8+.bd-button {
margin-top: 0;
margin-left: 0.5rem;
}
}

@media (min-width:720px) {
@media (min-width: 720px) {
.c8 {
width: auto;
padding: 0;
Expand Down Expand Up @@ -745,7 +716,6 @@ exports[`renders header 1`] = `
.c2 {
border-radius: 0.25rem;
box-shadow: 0px 2px 12px rgba(49,52,64,0.2);
-webkit-animation: jBcSpD .5s ease-in-out;
animation: jBcSpD .5s ease-in-out;
background-color: #FFFFFF;
grid-gap: 0.75rem;
Expand Down Expand Up @@ -852,23 +822,14 @@ exports[`renders with external link 1`] = `
}

.c8 {
-webkit-transition: all 70ms ease-out;
transition: all 70ms ease-out;
-webkit-transition-property: color;
transition-property: color;
color: #3C64F4;
cursor: pointer;
font-size: 1rem;
font-weight: 400;
-webkit-text-decoration: none;
text-decoration: none;
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: -ms-inline-flexbox;
display: inline-flex;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}

Expand All @@ -881,8 +842,6 @@ exports[`renders with external link 1`] = `
}

.c8 svg {
-webkit-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
margin-left: 0.25rem;
}
Expand All @@ -904,7 +863,6 @@ exports[`renders with external link 1`] = `
.c2 {
border-radius: 0.25rem;
box-shadow: 0px 2px 12px rgba(49,52,64,0.2);
-webkit-animation: jBcSpD .5s ease-in-out;
animation: jBcSpD .5s ease-in-out;
background-color: #FFFFFF;
grid-gap: 0.75rem;
Expand Down Expand Up @@ -1027,15 +985,12 @@ exports[`renders with link 1`] = `
}

.c8 {
-webkit-transition: all 70ms ease-out;
transition: all 70ms ease-out;
-webkit-transition-property: color;
transition-property: color;
color: #3C64F4;
cursor: pointer;
font-size: 1rem;
font-weight: 400;
-webkit-text-decoration: none;
text-decoration: none;
}

Expand Down Expand Up @@ -1064,7 +1019,6 @@ exports[`renders with link 1`] = `
.c2 {
border-radius: 0.25rem;
box-shadow: 0px 2px 12px rgba(49,52,64,0.2);
-webkit-animation: jBcSpD .5s ease-in-out;
animation: jBcSpD .5s ease-in-out;
background-color: #FFFFFF;
grid-gap: 0.75rem;
Expand Down
6 changes: 2 additions & 4 deletions packages/big-design/src/components/Alert/styled.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { theme as defaultTheme } from '@bigcommerce/big-design-theme';
import styled, { css, DefaultTheme, StyledComponent } from 'styled-components';
import { css, IStyledComponent, styled } from 'styled-components';

import { getBorderStyle } from '../../utils';
import { Grid } from '../Grid';
Expand Down Expand Up @@ -42,7 +42,7 @@ export const StyledHeader = styled(StyleableH4)`
margin-bottom: ${({ theme }) => theme.spacing.xxSmall};
`;

export const StyledMessageItem = styled<StyledComponent<'span', DefaultTheme, Partial<TextProps>>>(
export const StyledMessageItem = styled<IStyledComponent<'web', Partial<TextProps>>>(
StyleableSmall,
).attrs({ as: 'span' })`
color: ${({ theme }) => theme.colors.secondary70};
Expand All @@ -55,6 +55,4 @@ export const StyledLink = styled(Link)`
`;

StyledAlert.defaultProps = { theme: defaultTheme };
StyledHeader.defaultProps = { theme: defaultTheme };
StyledMessageItem.defaultProps = { theme: defaultTheme };
StyledLink.defaultProps = { theme: defaultTheme };
3 changes: 2 additions & 1 deletion packages/big-design/src/components/Badge/Badge.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { HTMLAttributes, memo } from 'react';

import { MarginProps } from '../../mixins';
import { withTransients } from '../../utils/withTransients';

import { StyledBadge } from './styled';

Expand All @@ -10,7 +11,7 @@ export interface BadgeProps extends HTMLAttributes<HTMLSpanElement>, MarginProps
}

export const Badge: React.FC<BadgeProps> = memo(({ className, style, label, ...props }) =>
typeof label === 'string' ? <StyledBadge {...props}>{label}</StyledBadge> : null,
typeof label === 'string' ? <StyledBadge {...withTransients(props)}>{label}</StyledBadge> : null,
);

Badge.displayName = 'Badge';
Loading