Skip to content

Commit

Permalink
Merge pull request #14 from kaiachain/dev
Browse files Browse the repository at this point in the history
Update version to v0.1.13
  • Loading branch information
skqksh authored Oct 10, 2024
2 parents 91b6c77 + 29d0397 commit b111e32
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 29 deletions.
15 changes: 12 additions & 3 deletions example/src/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,17 +169,20 @@ const Home = ({
value: value,
onChangeText: setValue,
}}
/>{' '}
/>
<KaTextInput
inputProps={{
type: 'password',
placeholder: 'placeholder',
value: value,
onChangeText: setValue,
style: { color: 'red' },
}}
rightUnit="$"
/>
<KaTextInput
inputProps={{
type: 'number',
placeholder: 'placeholder',
value: value,
onChangeText: setValue,
Expand All @@ -202,13 +205,17 @@ const Home = ({
/>
<KaTextInput
inputProps={{
value,
onChangeText: setValue,
placeholder: 'placeholder',
}}
rightComponent={<KaButton size="md">Confirm</KaButton>}
leftUnit="$"
/>
<KaTextInput
inputProps={{
value,
onChangeText: setValue,
placeholder: 'search here and see the sentence is very long',
}}
leftComponent={
Expand All @@ -221,6 +228,8 @@ const Home = ({
/>
<KaTextInput
inputProps={{
value,
onChangeText: setValue,
placeholder: 'search here and see the sentence is very long',
}}
leftComponent={
Expand All @@ -235,12 +244,12 @@ const Home = ({
/>
<KaTextInput
inputProps={{
value,
onChangeText: setValue,
placeholder: 'search here and see the sentence is very long',
}}
// leftComponent="search"
leftUnit="$"
rightUnit="Unit"
//rightComponent={'close'}
disabled={true}
/>
</StyledSection>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kaiachain/kaia-design-system",
"version": "0.1.12",
"version": "0.1.13",
"license": "MIT",
"type": "module",
"main": "dist/index.js",
Expand Down
50 changes: 25 additions & 25 deletions src/components/Input/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ReactElement, useState } from 'react'
import styled from '@emotion/styled'
import { themeFunc } from '../../styles'
import { font, themeFunc } from '../../styles'
import { KaText } from '../Text/Text'
import { useKaTheme } from '../../hooks'
import MathClose from '../../icons/MathClose.svg'
Expand All @@ -16,11 +16,11 @@ const StyledContainer = styled.div<StyledContainerProps>`
border-radius: var(--Radius-6, 360px);
box-sizing: border-box;
outline: ${({ isError }) => (isError ? '1px' : '4px')} solid;
outline-color: ${({ theme, isFocused, isError }): string =>
outline-color: ${({ isFocused, isError }) =>
isError
? theme.danger['6']
? themeFunc('danger', '6')
: isFocused
? theme.elevation['8']
? themeFunc('elevation', '8')
: 'transparent'};
transition: border-color 0.3s ease;
`
Expand Down Expand Up @@ -52,25 +52,20 @@ const StyledClose = styled.div`

const StyledInput = styled.input<{ isError?: boolean }>`
flex: 1;
width: 100%;
font-size: 14px;
font-weight: 400;
${font['body/md_600'].styles};
height: var(--Sizing-8, 40px);
background-color: transparent;
text-overflow: ellipsis;
color: ${themeFunc('gray', '0')};
color: ${({ disabled }) =>
disabled ? themeFunc('elevation', '6') : themeFunc('gray', '0')};
border: none;
box-sizing: border-box;
::placeholder {
font-size: 14px;
font-family: Manrope;
line-height: 20px;
font-weight: 600;
color: ${(props) =>
props.isError
color: ${({ isError, disabled }) =>
isError
? themeFunc('danger', '6')
: props.disabled
: disabled
? themeFunc('elevation', '6')
: themeFunc('elevation', '5')};
}
Expand All @@ -83,10 +78,12 @@ const StyledInput = styled.input<{ isError?: boolean }>`
`

export interface KaTextInputProps {
inputProps?: {
inputProps: {
type?: 'text' | 'email' | 'password' | 'number'
placeholder?: string
value?: string
onChangeText?: (value: string) => void
value: string
onChangeText: (value: string) => void
style?: React.CSSProperties
}
leftComponent?: ReactElement
rightComponent?: ReactElement
Expand All @@ -102,7 +99,12 @@ export const KaTextInput = ({
rightComponent,
leftUnit,
rightUnit,
inputProps,
inputProps = {
type: 'text',
placeholder: '',
value: '',
onChangeText: () => {},
},
disabled,
isError,
containerStyle,
Expand Down Expand Up @@ -141,7 +143,7 @@ export const KaTextInput = ({
}}
isError={isError}
onChange={({ target: { value } }): void => {
inputProps?.onChangeText?.(value)
inputProps.onChangeText?.(value)
}}
disabled={disabled}
{...inputProps}
Expand All @@ -158,20 +160,18 @@ export const KaTextInput = ({
{rightUnit}
</KaText>
)}
{inputProps?.value && (
{inputProps.value && !disabled && (
<StyledClose
onClick={(): void => {
inputProps?.onChangeText?.('')
inputProps.onChangeText?.('')
}}
>
<MathClose
style={{
width: 'var(--Sizing-3, 12px)',
height: 'var(--Sizing-3, 12px)',
}}
fill={
disabled ? getTheme('elevation', '7') : getTheme('gray', '0')
}
fill={getTheme('elevation', '4')}
/>
</StyledClose>
)}
Expand Down

0 comments on commit b111e32

Please sign in to comment.