Skip to content

Commit 666bb42

Browse files
author
Lee Zhen Jie
committed
feat: upgrade styled components
1 parent dcf5a38 commit 666bb42

File tree

10 files changed

+478
-106
lines changed

10 files changed

+478
-106
lines changed

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
"@types/react": "^17.0.37",
8080
"@types/react-dom": "^17.0.11",
8181
"@types/react-test-renderer": "^17.0.1",
82-
"@types/styled-components": "^5.1.1",
8382
"@types/styled-system": "^5.1.10",
8483
"@typescript-eslint/eslint-plugin": "^5.6.0",
8584
"@typescript-eslint/parser": "^5.6.0",
@@ -117,7 +116,6 @@
117116
"react-is": "^17.0.2",
118117
"react-test-renderer": "^17.0.2",
119118
"start-server-and-test": "^1.15.2",
120-
"styled-components": "^5.1.1",
121119
"stylelint": "^10.0.1",
122120
"stylelint-config-recommended": "^2.2.0",
123121
"stylelint-config-styled-components": "^0.1.1",
@@ -135,13 +133,14 @@
135133
"moment": "^2.24.0",
136134
"polaris-glints": "^15.12.0",
137135
"react-id-generator": "^3.0.1",
138-
"styled-system": "^5.1.5"
136+
"styled-components": "^6.0.3",
137+
"styled-system": "^5.1.5",
138+
"stylis": "^4.3.0"
139139
},
140140
"peerDependencies": {
141141
"lodash-es": "^4.0.0",
142142
"react": "^16.3.0 || ^17",
143-
"react-dom": "^16.3.0 || ^17",
144-
"styled-components": "^4.0.0 || ^5.0.0"
143+
"react-dom": "^16.3.0 || ^17"
145144
},
146145
"jest": {
147146
"moduleNameMapper": {

src/@next/ActionList/ActionItem.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { MouseEvent } from 'react';
22
import { Typography } from '../Typography';
33
import { Neutral } from '../utilities/colors';
44
import { Item } from './ActionList';
@@ -10,11 +10,12 @@ import {
1010

1111
export const ActionItem = ({ content, description, icon, action }: Item) => {
1212
const hasDescription = !!description;
13+
1314
return (
1415
<StyledActionListItemWrapper
1516
tabIndex={0}
1617
role="button"
17-
onMouseUp={e => e.currentTarget.blur()}
18+
onMouseUp={(e: MouseEvent<HTMLDivElement>) => e.currentTarget.blur()}
1819
onClick={() => action?.()}
1920
>
2021
<StyledActionListItem>

src/@next/Button/Button.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { MouseEvent } from 'react';
22
import { Spinner } from '../Spinner/Spinner';
33
import { Typography } from '../Typography';
44
import { StyledButton } from './ButtonStyle';
@@ -53,7 +53,7 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
5353
data-loading={loading}
5454
data-icon={!!icon}
5555
{...otherProps}
56-
onMouseUp={e => e.currentTarget.blur()}
56+
onMouseUp={(e: MouseEvent<HTMLButtonElement>) => e.currentTarget.blur()}
5757
>
5858
{loading && <Spinner />}
5959
{renderIcon('left')}

src/@next/Modal/Modal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useEffect } from 'react';
1+
import React, { MouseEvent, useEffect } from 'react';
22
import { ComponentAction } from '../../types/componentAction';
33
import { Button, PrimaryButton } from '../Button';
44
import { ButtonGroup } from '../ButtonGroup';
@@ -124,7 +124,7 @@ export const Modal = React.forwardRef<HTMLDivElement, ModalProps>(
124124
>
125125
<StyledModalContainer
126126
ref={ref}
127-
onClick={e => e.stopPropagation()}
127+
onClick={(e: MouseEvent<HTMLDivElement>) => e.stopPropagation()}
128128
{...props}
129129
>
130130
{header && (

src/@next/Pagination/SimplePagination.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import React, { useState } from 'react';
1+
import React, { ChangeEvent, useState } from 'react';
22
import { Typography } from '../Typography';
33
import {
4+
SimplePaginationStyledNav,
45
StyledActiveSimplePaginationButton,
5-
StyledSimplePaginationInput,
66
StyledSimplePaginationButton,
7-
SimplePaginationStyledNav,
7+
StyledSimplePaginationInput,
88
} from './PaginationStyle';
9+
import { NextStepper, PreviousStepper } from './Stepper';
910
import {
11+
PaginationProps,
1012
defaultPageSize,
1113
getAllPages,
12-
PaginationProps,
1314
} from './paginationUtils';
14-
import { NextStepper, PreviousStepper } from './Stepper';
1515

1616
export const SimplePagination = React.forwardRef<HTMLElement, PaginationProps>(
1717
function SimplePagination(
@@ -76,7 +76,7 @@ export const SimplePagination = React.forwardRef<HTMLElement, PaginationProps>(
7676
data-testid="current-page-input"
7777
autoFocus
7878
onFocus={handleFocus}
79-
onChange={e => {
79+
onChange={(e: ChangeEvent<HTMLInputElement>) => {
8080
handlePageNumberChange(Number(e.currentTarget.value));
8181
}}
8282
onBlur={() => setEditMode(false)}

src/@next/RadioButton/RadioButton.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import React from 'react';
1+
import React, { MouseEvent } from 'react';
2+
import { Colors } from '..';
3+
import { Typography } from '../Typography';
24
import {
35
LabelWrapper,
46
RadioButtonInput,
57
RadioButtonWrapper,
68
} from './RadioButtonStyle';
7-
import { Typography } from '../Typography';
8-
import { Colors } from '..';
99

1010
export interface RadioButtonProps
1111
extends Omit<React.HTMLAttributes<HTMLInputElement>, 'onChange'> {
@@ -45,7 +45,7 @@ export const RadioButton = React.forwardRef<HTMLInputElement, RadioButtonProps>(
4545
value={value}
4646
type="radio"
4747
onChange={onChange}
48-
onMouseDown={e => e.preventDefault()}
48+
onMouseDown={(e: MouseEvent<HTMLInputElement>) => e.preventDefault()}
4949
{...props}
5050
/>
5151
<LabelWrapper data-disabled={disabled}>

src/@next/Select/components/Activator/ActivatorTextInput.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useEffect, useRef, useState } from 'react';
1+
import React, { ChangeEvent, useEffect, useRef, useState } from 'react';
22

33
import { Icon } from '../../../Icon';
44
import { Option } from '../../../Menu';
@@ -80,7 +80,9 @@ export const ActivatorTextInput = ({
8080
className="select-input"
8181
ref={activatorRef}
8282
prefix={prefix}
83-
onChange={value => handleChange({ value })}
83+
onChange={(value: ChangeEvent<HTMLInputElement>) =>
84+
handleChange({ value })
85+
}
8486
onFocus={onFocus}
8587
error={hasError}
8688
disabled={disabled}

src/@next/SideSheet/SideSheet.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useEffect, useState, useRef } from 'react';
1+
import React, { useEffect, useState, useRef, MouseEvent } from 'react';
22
import { Button, PrimaryButton } from '../Button';
33
import { ButtonGroup } from '../ButtonGroup';
44
import { ComponentAction } from '../../types/componentAction';
@@ -91,7 +91,7 @@ const SideSheet = React.forwardRef<HTMLDivElement, SideSheetProps>(
9191
<StyledSideSheetContainer
9292
className={`${isClosedAnimation ? 'closed' : ''}`}
9393
ref={ref}
94-
onClick={e => e.stopPropagation()}
94+
onClick={(e: MouseEvent<HTMLDivElement>) => e.stopPropagation()}
9595
{...props}
9696
>
9797
<StyledSideSheetHeader>

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"compilerOptions": {
33
"alwaysStrict": true,
4+
"skipLibCheck": true,
45
"declaration": true,
56
"emitDeclarationOnly": true,
67
"jsx": "preserve",
@@ -18,7 +19,6 @@
1819
"node",
1920
"react",
2021
"react-dom",
21-
// "storybook__react",
2222
"styled-components"
2323
]
2424
},

0 commit comments

Comments
 (0)