-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: TextField 컴포넌트 구현 * chore: 텍스트 필드 자잘한 수정 사항 반영 * feat: 텍스트 필드 컴포넌트 스토리 코드 작성 * fix: max length 관련 onChange 로직 수정 * test: 텍스트필드 컴포넌트 테스트 코드 작성 * chore: 토큰 변경 * feat: TextField 빌드 세팅 * fix: a11y violation, incomplete 사항 해결 * feat: 반응형 관련 breakpoint 추가 * chore: token에서 breakpoint 가져오도록 변경 * chore: label2 자간 수정사항 반영 * chore: breakpoint 네이밍 변경 * refactor: 텍스트필드 반응형 토큰 사용 * chore: 불필요한 useEffect 삭제 * chore: panda codegen 실행 * design: 글자 색 변경 * chore: useTextareaAutosize 훅에 useEffect 추가 * fix: 텍스트필드 색상 대조 관련 웹 접근성 테스트 끄도록 설정 변경 * chore: 포커스된 경우도 typing으로 처리하도록 변경 * chore: 스토리북 테스트 러너 a11y rule 관련 설정 추가 * chore: 변경된 빌드 설정 반영 * chore: placeholder 여러 줄인 경우도 수용하도록 수정 * fix: 머지 에러 해결 * refactor: 상수값 따로 분리 * chore: props style로 네이밍 변경 * chore: codegen 반영
- Loading branch information
1 parent
d7c1274
commit fd0be3d
Showing
21 changed files
with
864 additions
and
81 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
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,8 @@ | ||
import { breakpoint } from "wowds-tokens"; | ||
|
||
export const breakpoints = { | ||
xs: breakpoint.xs, | ||
sm: breakpoint.sm, | ||
md: breakpoint.md, | ||
lg: breakpoint.lg, | ||
}; |
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
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,4 @@ | ||
export const xs = "360px"; | ||
export const sm = "600px"; | ||
export const md = "900px"; | ||
export const lg = "1280px"; |
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
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
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
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
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
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
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
246 changes: 246 additions & 0 deletions
246
packages/wow-ui/src/components/TextField/TextField.stories.tsx
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,246 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { useState } from "react"; | ||
|
||
import TextField from "@/components/TextField"; | ||
|
||
const meta = { | ||
title: "UI/TextField", | ||
component: TextField, | ||
tags: ["autodocs"], | ||
parameters: { | ||
componentSubtitle: "텍스트필드 컴포넌트", | ||
a11y: { | ||
config: { | ||
rules: [{ id: "color-contrast", enabled: false }], | ||
}, | ||
}, | ||
}, | ||
argTypes: { | ||
label: { | ||
description: "텍스트필드의 라벨입니다.", | ||
table: { | ||
type: { summary: "string" }, | ||
defaultValue: { summary: null }, | ||
}, | ||
control: { | ||
type: "text", | ||
}, | ||
type: { | ||
name: "string", | ||
required: true, | ||
}, | ||
}, | ||
placeholder: { | ||
description: "텍스트필드의 플레이스홀더 텍스트입니다.", | ||
table: { | ||
type: { summary: "string" }, | ||
defaultValue: { summary: null }, | ||
}, | ||
control: { | ||
type: "text", | ||
}, | ||
}, | ||
defaultValue: { | ||
description: "텍스트필드의 기본 값입니다.", | ||
table: { | ||
type: { summary: "string" }, | ||
defaultValue: { summary: null }, | ||
}, | ||
control: { | ||
type: "text", | ||
}, | ||
}, | ||
value: { | ||
description: "외부에서 제어할 활성 상태입니다.", | ||
table: { | ||
type: { summary: "string" }, | ||
defaultValue: { summary: null }, | ||
}, | ||
control: { | ||
type: "text", | ||
}, | ||
}, | ||
maxLength: { | ||
description: "텍스트필드의 최대 입력 길이입니다.", | ||
table: { | ||
type: { summary: "number" }, | ||
defaultValue: { summary: null }, | ||
}, | ||
control: { | ||
type: "number", | ||
}, | ||
}, | ||
error: { | ||
description: "텍스트필드의 오류 상태 여부입니다.", | ||
table: { | ||
type: { summary: "boolean" }, | ||
defaultValue: { summary: false }, | ||
}, | ||
control: { | ||
type: "boolean", | ||
}, | ||
}, | ||
success: { | ||
description: "텍스트필드의 성공 상태 여부입니다.", | ||
table: { | ||
type: { summary: "boolean" }, | ||
defaultValue: { summary: false }, | ||
}, | ||
control: { | ||
type: "boolean", | ||
}, | ||
}, | ||
helperText: { | ||
description: "텍스트필드 아래 추가적인 텍스트입니다.", | ||
table: { | ||
type: { summary: "ReactNode" }, | ||
defaultValue: { summary: null }, | ||
}, | ||
control: { | ||
type: "text", | ||
}, | ||
}, | ||
onChange: { | ||
description: "외부 활성 상태가 변경될 때 호출될 콜백 함수입니다.", | ||
table: { | ||
type: { summary: "(value: string) => void" }, | ||
defaultValue: { summary: null }, | ||
control: { | ||
type: "function", | ||
}, | ||
}, | ||
}, | ||
onBlur: { | ||
description: "텍스트필드가 포커스를 잃을 때 호출될 콜백 함수입니다.", | ||
table: { | ||
type: { summary: "() => void" }, | ||
defaultValue: { summary: null }, | ||
control: { | ||
type: "function", | ||
}, | ||
}, | ||
}, | ||
onFocus: { | ||
description: "텍스트필드가 포커스됐을 때 호출될 콜백 함수입니다.", | ||
table: { | ||
type: { summary: "() => void" }, | ||
defaultValue: { summary: null }, | ||
control: { | ||
type: "function", | ||
}, | ||
}, | ||
}, | ||
textareaProps: { | ||
description: "텍스트필드에 전달할 추가 textarea 속성입니다.", | ||
table: { | ||
type: { summary: "TextareaHTMLAttributes<HTMLTextAreaElement>" }, | ||
defaultValue: { summary: null }, | ||
control: { | ||
type: "object", | ||
}, | ||
}, | ||
}, | ||
style: { | ||
description: "텍스트필드의 커스텀 스타일 속성입니다.", | ||
table: { | ||
type: { summary: "CSSProperties" }, | ||
defaultValue: { summary: null }, | ||
control: { | ||
type: "object", | ||
}, | ||
}, | ||
}, | ||
className: { | ||
description: "텍스트필드에 전달하는 커스텀 클래스명입니다.", | ||
table: { | ||
type: { summary: "string" }, | ||
defaultValue: { summary: null }, | ||
control: { | ||
type: "text", | ||
}, | ||
}, | ||
}, | ||
}, | ||
} satisfies Meta<typeof TextField>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Primary: Story = { | ||
args: { | ||
label: "Label", | ||
}, | ||
}; | ||
|
||
export const WithMaxLength: Story = { | ||
args: { | ||
label: "Label", | ||
maxLength: 10, | ||
}, | ||
}; | ||
|
||
export const WithPlaceholder: Story = { | ||
args: { | ||
label: "Label", | ||
placeholder: | ||
"PlaceholderPlaceholderPlaceholderPlaceholderPlaceholderPlaceholderPlaceholder", | ||
}, | ||
}; | ||
|
||
export const WithDefaultValue: Story = { | ||
args: { | ||
label: "Label", | ||
defaultValue: "Text", | ||
}, | ||
}; | ||
|
||
export const WithHelperText: Story = { | ||
args: { | ||
label: "Label", | ||
helperText: "*Caption", | ||
}, | ||
}; | ||
|
||
export const WithMaxLengthAndHelperText: Story = { | ||
args: { | ||
label: "Label", | ||
maxLength: 100, | ||
helperText: "*Caption", | ||
}, | ||
}; | ||
|
||
export const Success: Story = { | ||
args: { | ||
label: "Label", | ||
maxLength: 100, | ||
helperText: "*Caption", | ||
success: true, | ||
}, | ||
}; | ||
|
||
export const Error: Story = { | ||
args: { | ||
label: "Label", | ||
maxLength: 100, | ||
helperText: "*Caption", | ||
error: true, | ||
}, | ||
}; | ||
|
||
const ControlledTextField = () => { | ||
const [value, setValue] = useState(""); | ||
|
||
const handleChange = (value: string) => { | ||
setValue(value); | ||
}; | ||
|
||
return <TextField label="Label" value={value} onChange={handleChange} />; | ||
}; | ||
|
||
export const ControlledState: Story = { | ||
render: () => <ControlledTextField />, | ||
args: { | ||
label: "Label", | ||
}, | ||
}; |
Oops, something went wrong.