Skip to content

Commit

Permalink
feat: add animations for hover and active states (#3219)
Browse files Browse the repository at this point in the history
  • Loading branch information
SchwJ committed Aug 2, 2023
1 parent 39c07d4 commit 51a6165
Show file tree
Hide file tree
Showing 50 changed files with 119 additions and 79 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/react-ui/components/Button/Button.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export const styles = memoizeStyle({
${resetButton()};
${resetText()};
transition: background-color ${t.transitionDuration} ${t.transitionTimingFunction}
${t.btnBorderColorTransition ? `, ${t.btnBorderColorTransition}` : ''};
background-clip: ${t.btnBackgroundClip};
background-position: center;
background-repeat: no-repeat;
Expand Down
1 change: 0 additions & 1 deletion packages/react-ui/components/Calendar/Calendar.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export const styles = memoizeStyle({
root(t: Theme) {
const width = parseInt(t.calendarCellSize) * 7;
return css`
display: inline-block;
background: ${t.calendarBg};
box-sizing: content-box;
border-radius: ${t.pickerBorderRadius};
Expand Down
5 changes: 5 additions & 0 deletions packages/react-ui/components/Checkbox/Checkbox.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ export const styles = memoizeStyle({
font-size: ${t.checkboxFontSize};
padding: ${t.checkboxPaddingY} 0;
.${globalClasses.box} {
transition: background ${t.transitionDuration} ${t.transitionTimingFunction},
box-shadow ${t.transitionDuration} ${t.transitionTimingFunction};
}
&:hover .${globalClasses.box} {
background: ${t.checkboxHoverBg};
box-shadow: ${t.checkboxShadowHover};
Expand Down
2 changes: 2 additions & 0 deletions packages/react-ui/components/Dropdown/getDropdownTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export const getDropdownTheme = (theme: Theme): Theme => {
{
selectDefaultBg: theme.btnDefaultBg,
selectMenuOffsetY: theme.dropdownMenuOffsetY,
selectBorderColorHover: theme.dropdownMenuHoverBorderColor,
selectBorderColorTransition: theme.dropdownMenuBorderColorTransition,
},
theme,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ const styles = {
outline: none;
cursor: pointer;
padding: ${t.fileUploaderPaddingY} ${t.fileUploaderPaddingX};
transition: box-shadow 0.3s ease;
transition: background-color ${t.transitionDuration} ${t.transitionTimingFunction},
border-color ${t.transitionDuration} ${t.transitionTimingFunction};
background-color: ${t.fileUploaderUploadButtonBg};
`;
},
Expand Down
1 change: 1 addition & 0 deletions packages/react-ui/components/Input/Input.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const styles = memoizeStyle({
background-color: ${t.inputBg};
border: ${t.inputBorderWidth} solid ${t.inputBorderColor};
border-top-color: ${t.inputBorderTopColor};
transition: border-color ${t.transitionDuration} ${t.transitionTimingFunction};
box-shadow: ${t.inputShadow};
box-sizing: border-box;
color: ${t.inputColor};
Expand Down
4 changes: 4 additions & 0 deletions packages/react-ui/components/Radio/Radio.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ export const styles = memoizeStyle({
line-height: ${t.radioLineHeight};
font-size: ${t.radioFontSize};
.${globalClasses.circle} {
transition: background ${t.transitionDuration} ${t.transitionTimingFunction};
}
&:hover .${globalClasses.circle} {
background: ${t.radioHoverBg};
box-shadow: ${t.radioHoverShadow};
Expand Down
3 changes: 3 additions & 0 deletions packages/react-ui/components/Select/selectTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ export const getSelectTheme = (theme: Theme, props: SelectProps<any, any>): Them
btnDisabledBg: theme.selectBgDisabled,
btnDisabledBorderColor: theme.selectBorderColorDisabled,
btnDisabledTextColor: theme.selectTextColorDisabled,

btnDefaultHoverBorderColor: theme.selectBorderColorHover,
btnBorderColorTransition: theme.selectBorderColorTransition,
},
theme,
);
Expand Down
2 changes: 1 addition & 1 deletion packages/react-ui/components/Tabs/Tab.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ function tabRoot(t: Theme, size: TabSize) {
padding-top: ${paddingY(t, size)};
position: relative;
text-decoration: inherit;
transition: border-bottom 0.2s ease-out;
transition: border-bottom ${t.transitionDuration} ${t.transitionTimingFunction};
&:hover {
outline: inherit;
Expand Down
2 changes: 1 addition & 1 deletion packages/react-ui/components/Textarea/Textarea.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const styles = memoizeStyle({
min-height: ${t.textareaMinHeight};
outline: none;
padding: ${t.textareaPaddingY} ${t.textareaPaddingX};
transition: height 0.2s ease-out;
transition: border-color ${t.transitionDuration} ${t.transitionTimingFunction}, height 0.2s ease-out;
vertical-align: middle;
width: 100%;
border-radius: ${t.textareaBorderRadius};
Expand Down
2 changes: 1 addition & 1 deletion packages/react-ui/components/Toast/ToastView.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const styles = memoizeStyle({
margin: -${paddingTop} ${marginRight} -${paddingBottom} ${t.toastPaddingX};
padding: ${padding};
transition: background ${t.transitionDuration} ${t.transitionTimingFunction};
&:hover {
background: ${t.toastLinkBgHover};
text-decoration: ${t.toastLinkTextDecorationHover};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const styles = memoizeStyle({
box-shadow: ${t.tokenInputShadow};
border: ${t.tokenInputBorderWidth} solid ${t.tokenInputBorderColor};
border-top-color: ${t.tokenInputBorderTopColor};
transition: border-color ${t.transitionDuration} ${t.transitionTimingFunction};
box-sizing: border-box;
cursor: text;
padding: ${t.tokenInputPaddingY} ${t.tokenInputPaddingX};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const styles = memoizeStyle({
border-radius: ${t.closeBtnIconBorderRadius};
color: ${t.closeBtnIconColor};
cursor: pointer;
transition: color ${t.transitionDuration} ${t.transitionTimingFunction};
&:enabled:focus,
&:enabled:hover {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ export const InputLikeText: Story = () => (
);
InputLikeText.storyName = 'input like text';

const FIREFOX_REGEXP = /.*firefox.*/i;

InputLikeText.parameters = {
creevey: {
skip: {
// TODO @Khlutkova fix after update browsers
'story-skip-0': {
in: ['firefox8px', 'firefoxFlat8px', 'firefox', 'firefoxDark'],
in: FIREFOX_REGEXP,
tests: ['focused first element'],
},
},
Expand Down
14 changes: 13 additions & 1 deletion packages/react-ui/internal/DateSelect/DateSelect.styles.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { css, memoizeStyle } from '../../lib/theming/Emotion';
import { css, memoizeStyle, prefix } from '../../lib/theming/Emotion';
import { Theme } from '../../lib/theming/Theme';

export const globalClasses = prefix('select')({
arrow: 'arrow',
});

export const styles = memoizeStyle({
root(t: Theme) {
return css`
Expand All @@ -18,6 +22,14 @@ export const styles = memoizeStyle({
&:hover {
color: ${t.dateSelectLinkColor};
}
& .${globalClasses.arrow} {
transition: fill ${t.transitionDuration} ${t.transitionTimingFunction};
}
&:hover .${globalClasses.arrow} {
fill: ${t.dateSelectTextColorDefault} !important;
}
`;
},

Expand Down
4 changes: 2 additions & 2 deletions packages/react-ui/internal/DateSelect/DateSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { ArrowCollapseCVOpenIcon16Regular } from '../icons2022/ArrowCollapseCVOp
import { ArrowCUpIcon16Regular } from '../icons2022/ArrowCUpIcon/ArrowCUpIcon16Regular';
import { ArrowCDownIcon16Regular } from '../icons2022/ArrowCDownIcon/ArrowCDownIcon16Regular';

import { styles } from './DateSelect.styles';
import { globalClasses, styles } from './DateSelect.styles';

const itemHeight = 24;
const visibleYearsCount = 11;
Expand Down Expand Up @@ -234,7 +234,7 @@ export class DateSelect extends React.PureComponent<DateSelectProps, DateSelectS
<div data-tid={DateSelectDataTids.caption} className={styles.caption()}>
{this.getItem(0)}
</div>
{!disabled && <ArrowCollapseCVOpenIcon16Regular color="#ADADAD" />}
{!disabled && <ArrowCollapseCVOpenIcon16Regular className={cx(globalClasses.arrow)} color="#ADADAD" />}
{this.state.opened && this.renderMenu()}
</span>
);
Expand Down
1 change: 1 addition & 0 deletions packages/react-ui/internal/InputLikeText/InputLikeText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ export class InputLikeText extends React.Component<InputLikeTextProps, InputLike
[jsInputStyles.disabled(this.theme)]: !!disabled,
[jsInputStyles.borderless()]: !!borderless,
[jsInputStyles.focus(this.theme)]: focused,
[jsInputStyles.hovering(this.theme)]: !focused && !disabled && !warning && !error && !borderless,
[jsInputStyles.blink(this.theme)]: blinking,
[jsInputStyles.warning(this.theme)]: !!warning,
[jsInputStyles.error(this.theme)]: !!error,
Expand Down
Loading

0 comments on commit 51a6165

Please sign in to comment.