Skip to content

Commit dec01f4

Browse files
committed
addition of "will-change" CSS prop to lib components and storybook components
1 parent 6161d8b commit dec01f4

File tree

15 files changed

+39
-13
lines changed

15 files changed

+39
-13
lines changed

__stories__/helpers/components/Checkbox.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ const CheckIcon = styled.i`
7373
border-width: 1.5px;
7474
box-sizing: border-box;
7575
border-radius: 0.0625rem;
76+
will-change: border-color;
7677
background-color: transparent;
7778
border-color: rgba(0, 0, 0, 0.54);
7879
transition: border-color 0.365s ease;
@@ -88,6 +89,7 @@ const CheckIcon = styled.i`
8889
border-radius: 3px;
8990
transform-origin: left top;
9091
background-color: ${CHECK_COLOR};
92+
will-change: opacity, height, transform;
9193
transition: opacity 0.365s ease, height 0s linear 0.365s;
9294
}
9395

__stories__/helpers/components/PackageLink.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const Link = styled.a`
1919
text-align: center;
2020
text-decoration: none;
2121
display: inline-block;
22+
will-change: transform;
2223
background-color: transparent;
2324
transition: transform 0.25s ease-out;
2425
transform: translate3d(0px, 0px, 0px);

__stories__/helpers/styled/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ export const Button = styled.button`
184184
background-color: #eaebec;
185185
padding: 0.375rem 0.75rem;
186186
-webkit-appearance: button;
187+
will-change: color, background-color;
187188
transition: color 0.2s ease-out, background-color 0.2s ease-out;
188189
189190
:focus {
@@ -333,6 +334,7 @@ export const MenuPortalElement = styled.div<{ menuOpen: boolean; }>`
333334
min-height: 115px;
334335
position: relative;
335336
border-radius: 3px;
337+
will-change: background-color;
336338
transition: background-color 0.2s ease-out;
337339
background-color: ${({ menuOpen }) => menuOpen ? 'white' : 'whitesmoke'};
338340
@@ -373,6 +375,7 @@ export const ChevronDownSvg = styled.svg<{ menuOpen: boolean }>`
373375
width: 14px;
374376
height: 14px;
375377
fill: currentColor;
378+
will-change: transform;
376379
transition: transform 0.25s ease-in-out;
377380
${({ menuOpen }) => menuOpen && css`transform: rotate(180deg);`}
378381
`;

__stories__/index.stories.tsx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,9 @@ export const Events = () => {
492492
<Hr />
493493
<Card>
494494
<CardHeader>
495-
<Label>Events trigger a toast notification (demo only)</Label>
495+
<Label>
496+
Events trigger a toast notification (demo only)
497+
</Label>
496498
<Checkboxes>
497499
<Checkbox
498500
label='onOptionChange'
@@ -798,7 +800,10 @@ export const Advanced = () => {
798800
const renderOptionLabel = useCallback(
799801
(option: PackageOption): ReactNode => (
800802
<OptionContainer>
801-
<ReactSvg {...REACT_SVG_PROPS} isDisabled={getIsOptionDisabled(option)}>
803+
<ReactSvg
804+
{...REACT_SVG_PROPS}
805+
isDisabled={getIsOptionDisabled(option)}
806+
>
802807
<path {...REACT_SVG_PATH_PROPS} />
803808
<circle {...REACT_SVG_CIRCLE_PROPS} />
804809
</ReactSvg>
@@ -810,7 +815,10 @@ export const Advanced = () => {
810815

811816
const customCaretIcon = useCallback(
812817
({ menuOpen }): ReactNode => (
813-
<ChevronDownSvg {...CHEVRON_SVG_PROPS} menuOpen={menuOpen}>
818+
<ChevronDownSvg
819+
menuOpen={menuOpen}
820+
{...CHEVRON_SVG_PROPS}
821+
>
814822
<path {...CHEVRON_DOWN_PATH_PROPS} />
815823
</ChevronDownSvg>
816824
),
@@ -855,7 +863,9 @@ export const Advanced = () => {
855863
<Hr />
856864
<Card>
857865
<CardHeader>
858-
<Label>JSX labels, custom caret icon, and disabled option</Label>
866+
<Label>
867+
JSX labels, custom caret icon, and disabled option
868+
</Label>
859869
</CardHeader>
860870
<CardBody>
861871
<SelectContainer>
@@ -1001,7 +1011,9 @@ export const Async = () => {
10011011
<Hr />
10021012
<Card>
10031013
<CardHeader>
1004-
<Label>Search debounced 500ms and mock HTTP call resolves after {delay}ms</Label>
1014+
<Label>
1015+
Search debounced 500ms and mock HTTP call resolves after {delay}ms
1016+
</Label>
10051017
</CardHeader>
10061018
<CardBody>
10071019
<SelectContainer>

docs/asset-manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"files": {
3-
"main.js": "./main.5ac201dc.iframe.bundle.js",
3+
"main.js": "./main.f629e0d6.iframe.bundle.js",
44
"runtime~main.js": "./runtime~main.f398e60b.iframe.bundle.js",
55
"vendors~main.js": "./vendors~main.31a06b8d.iframe.bundle.js",
66
"vendors~main.js.map": "./vendors~main.31a06b8d.iframe.bundle.js.map",
@@ -10,6 +10,6 @@
1010
"entrypoints": [
1111
"runtime~main.f398e60b.iframe.bundle.js",
1212
"vendors~main.31a06b8d.iframe.bundle.js",
13-
"main.5ac201dc.iframe.bundle.js"
13+
"main.f629e0d6.iframe.bundle.js"
1414
]
1515
}

docs/iframe.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,4 @@
130130

131131

132132

133-
window['FRAMEWORK_OPTIONS'] = {"fastRefresh":true};</script><script src="runtime~main.f398e60b.iframe.bundle.js"></script><script src="vendors~main.31a06b8d.iframe.bundle.js"></script><script src="main.5ac201dc.iframe.bundle.js"></script></body></html>
133+
window['FRAMEWORK_OPTIONS'] = {"fastRefresh":true};</script><script src="runtime~main.f398e60b.iframe.bundle.js"></script><script src="vendors~main.31a06b8d.iframe.bundle.js"></script><script src="main.f629e0d6.iframe.bundle.js"></script></body></html>

docs/main.5ac201dc.iframe.bundle.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/main.f629e0d6.iframe.bundle.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Select.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ const ControlWrapper = styled.div<ControlWrapperProps>`
192192
align-items: center;
193193
box-sizing: border-box;
194194
justify-content: space-between;
195+
will-change: box-shadow, border-color;
195196
196197
${({ isDisabled, isFocused, isInvalid, theme: { control, color } }) => css`
197198
transition: ${control.transition};

src/components/indicators/ClearSvgIcon.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import type { FunctionComponent } from 'react';
66

77
const ClearSvg = styled.svg`
88
fill: currentColor;
9+
will-change: opacity, color;
10+
911
${({ theme }) => css`
1012
width: ${theme.icon.clear.width};
1113
height: ${theme.icon.clear.height};

0 commit comments

Comments
 (0)