-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Lena Rashkovan
committed
Sep 18, 2024
1 parent
91c5206
commit 7c4ed8a
Showing
5 changed files
with
210 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React, { ReactElement } from 'react'; | ||
import styled from 'styled-components'; | ||
import { Button as BaseButton, ButtonProps as BaseButtonProps } from 'react-aria-components'; | ||
import { getSemanticValue } from '../../../essentials/experimental/cssVariables'; | ||
import { XCrossCircleIcon } from '../../../icons'; | ||
|
||
const StyledButton = styled(BaseButton)` | ||
appearance: none; | ||
background: none; | ||
border: none; | ||
display: flex; | ||
margin: 0; | ||
padding: 0; | ||
color: ${getSemanticValue('on-surface-variant')}; | ||
`; | ||
|
||
function ClearButton(props: BaseButtonProps): ReactElement { | ||
return ( | ||
<StyledButton {...props}> | ||
<XCrossCircleIcon /> | ||
</StyledButton> | ||
); | ||
} | ||
|
||
export { ClearButton }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { Input as BaseInput, TextArea as BaseTextArea } from 'react-aria-components'; | ||
import styled, { css } from 'styled-components'; | ||
import { getSemanticValue } from '../../../essentials/experimental/cssVariables'; | ||
import { textStyles } from '../Text/Text'; | ||
|
||
const fieldStyles = css` | ||
border: none; | ||
background-color: unset; | ||
outline: none; | ||
display: block; | ||
width: 100%; | ||
padding: 0; | ||
caret-color: ${getSemanticValue('interactive')}; | ||
color: ${getSemanticValue('on-surface')}; | ||
${textStyles.variants.body1} | ||
&::placeholder { | ||
color: ${getSemanticValue('on-surface-variant')}; | ||
} | ||
`; | ||
|
||
// TODO: Implement autogrow | ||
export const TextArea = styled(BaseTextArea).attrs({ rows: 1 })` | ||
${fieldStyles}; | ||
resize: none; | ||
min-height: ${textStyles.variants.body1.lineHeight}; | ||
`; | ||
|
||
export const Input = styled(BaseInput)` | ||
${fieldStyles} | ||
&[type='search'] { | ||
&::-webkit-search-cancel-button { | ||
display: none; | ||
} | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Label as BaseLabel } from 'react-aria-components'; | ||
import styled, { css } from 'styled-components'; | ||
import { textStyles } from '../Text/Text'; | ||
|
||
export const flyingLabelStyles = css` | ||
top: 0; | ||
transform: translate3d(0, 0, 0); | ||
${textStyles.variants.label2} | ||
`; | ||
|
||
export const Label = styled(BaseLabel)<{ $flying: boolean }>` | ||
position: absolute; | ||
top: 50%; | ||
color: currentColor; | ||
${textStyles.variants.body1} | ||
transform: translate3d(0, calc(-${textStyles.variants.body1.lineHeight} / 2), 0); | ||
transform-origin: 0; | ||
transition: top 200ms ease, font-size 200ms ease, transform 200ms ease; | ||
${props => props.$flying && flyingLabelStyles} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.