diff --git a/src/constants/color.ts b/src/constants/color.ts index deb6592..2ee34a6 100644 --- a/src/constants/color.ts +++ b/src/constants/color.ts @@ -1,7 +1,6 @@ export const THEME_COLOR = { WHITE: "white", BLACK: "black", - GRAY_09: "gray-09", GRAY_08: "gray-08", GRAY_07: "gray-07", GRAY_06: "gray-06", diff --git a/src/constants/index.ts b/src/constants/index.ts index e094821..2ea4323 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -1,7 +1,6 @@ export const ColorOptions = [ "white", "black", - "gray-09", "gray-08", "gray-07", "gray-06", diff --git a/src/core/components/Calendar/DatePickerCalendar/DatePickerCalendar.stories.tsx b/src/core/components/Calendar/DatePickerCalendar/DatePickerCalendar.stories.tsx index 4e8e454..5af837a 100644 --- a/src/core/components/Calendar/DatePickerCalendar/DatePickerCalendar.stories.tsx +++ b/src/core/components/Calendar/DatePickerCalendar/DatePickerCalendar.stories.tsx @@ -2,7 +2,6 @@ import { Meta } from "@storybook/react"; import { useState } from "react"; import DatePickerCalendar from "@/core/components/Calendar/DatePickerCalendar"; -import { DATE_PICKER_TYPE } from "./constants"; import { PeriodDates } from "./types/DatePickerCalendarProps"; const meta = { @@ -26,7 +25,7 @@ export const SingleDatePicker = () => {
{ return (
{ return; } - if (variants === DATE_PICKER_TYPE["PERIOD"] && periodDates.startDate) { + if (variants === "period" && periodDates.startDate) { if (!dayjs(periodDates.startDate).isAfter(calendarDate.dayjs)) { newPeriodDates.endDate = currentDate; } else { @@ -83,7 +82,7 @@ export const useDatePickerCalendar = (): UseDatePickerCalendarResponse => { }; const DatePickerCalendar = ({ - variants = DATE_PICKER_TYPE["SINGLE"], + variants = "single", label = ["사용일"], initialDate, periodDates, diff --git a/src/core/components/Demo/Demo.stories.tsx b/src/core/components/Demo/Demo.stories.tsx new file mode 100644 index 0000000..6ec41a9 --- /dev/null +++ b/src/core/components/Demo/Demo.stories.tsx @@ -0,0 +1,14 @@ +import { Meta } from "@storybook/react"; +import Demo from "./index"; + +const meta = { + title: "core/Demo", + component: Demo, + argTypes: {}, +} satisfies Meta; + +export default meta; + +export const Default = { + args: {}, +}; diff --git a/src/core/components/Demo/index.tsx b/src/core/components/Demo/index.tsx new file mode 100644 index 0000000..76154dd --- /dev/null +++ b/src/core/components/Demo/index.tsx @@ -0,0 +1,7 @@ +const Demo = () => { + return ( +
데모
+ ); +}; + +export default Demo; diff --git a/src/core/components/Dropdown/DropdownBase/DropdownTrigger.tsx b/src/core/components/Dropdown/DropdownBase/DropdownTrigger.tsx index e99ae00..9a17ddd 100644 --- a/src/core/components/Dropdown/DropdownBase/DropdownTrigger.tsx +++ b/src/core/components/Dropdown/DropdownBase/DropdownTrigger.tsx @@ -13,13 +13,10 @@ const DropdownTrigger = forwardRef(( }: DropdownTriggerProps, ref: React.Ref, ) => { - const { isToggle, readOnly, disabled, setIsToggle } = useContext(DropdownContext) as DropdownContextValue; - const content = typeof children === "function" ? children({ isToggle, readOnly, disabled }) : children; - const isDisabled = readOnly || disabled; + const { isToggle, setIsToggle } = useContext(DropdownContext) as DropdownContextValue; + const content = typeof children === "function" ? children({ isToggle }) : children; const onClickHandler = (e: React.MouseEvent) => { - if(isDisabled) return; - setIsToggle(v => !v); onClick?.(e); }; @@ -29,11 +26,9 @@ const DropdownTrigger = forwardRef(( ref = {ref} type = "button" onClick = {onClickHandler} - className = {clsx("whitespace-nowrap cursor-pointer", isDisabled && "!cursor-not-allowed bg-gray-09", className)} + className = {clsx("whitespace-nowrap cursor-pointer", className)} aria-haspopup = "listbox" aria-expanded = {isToggle} - aria-disabled = {disabled} - aria-readonly = {readOnly} {...props} > {content} diff --git a/src/core/components/Dropdown/DropdownBase/index.tsx b/src/core/components/Dropdown/DropdownBase/index.tsx index 4ac1f6f..a5e6cab 100644 --- a/src/core/components/Dropdown/DropdownBase/index.tsx +++ b/src/core/components/Dropdown/DropdownBase/index.tsx @@ -10,16 +10,15 @@ import { DropdownContextValue, DropdownProps, ReturnType } from "./types"; export const DropdownContext = createContext(undefined); DropdownContext.displayName = "DropdownContext"; -const DropdownBase = ({ className, readOnly = false, disabled = false, trigger, content }: DropdownProps) => { +const DropdownBase = ({ className, trigger, content }: DropdownProps) => { const [ isToggle, setIsToggle ] = useState(false); const { contentRef } = useClickOutside(() => setIsToggle(false)); - const isVisibleContent = !readOnly && !disabled && isToggle; return ( - +
{trigger} - {isVisibleContent && content} + {isToggle && content}
); diff --git a/src/core/components/Dropdown/DropdownBase/types/index.ts b/src/core/components/Dropdown/DropdownBase/types/index.ts index 2b3a4ca..41be6e0 100644 --- a/src/core/components/Dropdown/DropdownBase/types/index.ts +++ b/src/core/components/Dropdown/DropdownBase/types/index.ts @@ -4,17 +4,15 @@ import DropdownItems from "../DropdownItems"; import DropdownTrigger from "../DropdownTrigger"; export interface DropdownProps { - className?: string; - disabled?: boolean; - readOnly?: boolean; - trigger: React.ReactNode; - content: React.ReactNode; + className?: string, + trigger: React.ReactNode, + content: React.ReactNode, } -export interface DropdownContextValue extends Pick { +export type DropdownContextValue = { isToggle: boolean; setIsToggle: Dispatch>; -} +}; export interface DropdownItemProps extends HTMLAttributes {} @@ -24,7 +22,7 @@ export interface DropdownItemsProps extends HTMLAttributes{ export interface DropdownTriggerProps extends Omit, "children"> { onClick?: (e: React.MouseEvent) => void; - children: React.ReactNode | ((props: Pick) => React.ReactNode); + children: React.ReactNode | ((props: { isToggle: boolean }) => React.ReactNode); } type Dropdown = (props: DropdownProps) => React.ReactElement; diff --git a/src/core/components/Dropdown/DropdownSelect/DropdownSelectTrigger.tsx b/src/core/components/Dropdown/DropdownSelect/DropdownSelectTrigger.tsx index 93f77e4..74ec89c 100644 --- a/src/core/components/Dropdown/DropdownSelect/DropdownSelectTrigger.tsx +++ b/src/core/components/Dropdown/DropdownSelect/DropdownSelectTrigger.tsx @@ -18,17 +18,12 @@ const DropdownSelectTrigger = forwardRef(( return ( - {({ isToggle, disabled, readOnly }) => { - const isDisabled = readOnly || disabled; - const isVisibleContent = !readOnly && !disabled && isToggle; - - return ( - <> - - {!isDisabled ? : null} - - ); - }} + {({ isToggle }) => ( + <> + + + + )} ); }); diff --git a/src/core/components/Input/InputBase/index.tsx b/src/core/components/Input/InputBase/index.tsx index a9bda83..11e3a95 100644 --- a/src/core/components/Input/InputBase/index.tsx +++ b/src/core/components/Input/InputBase/index.tsx @@ -9,29 +9,26 @@ import { InputBaseProps } from "./types"; const InputBase = forwardRef( ( { - label, inputId, - rootClassName, element: Element, + rootClassName, inputRootClassName, + label, startComponent, inputComponent, endComponent, labelColor, - feedback, borderColor = "gray-03", - feedbackColor = "error", error = false, - disabled = false, - readOnly = false, - required = false, + required, + readOnly, + feedback, + feedbackColor = "error", ...props }: InputBaseProps, ref: React.ComponentPropsWithRef["ref"], ) => { const Component: React.ElementType = Element || "div"; - const isDisabled = readOnly || disabled; - const isVisibleEndComponent = !isDisabled && endComponent; return ( @@ -42,16 +39,15 @@ const InputBase = forwardRef( }
{startComponent && startComponent} {inputComponent && inputComponent} - {isVisibleEndComponent && endComponent} + {!readOnly && endComponent && endComponent}
{feedback ? : null}
diff --git a/src/core/components/Input/InputBase/types/index.ts b/src/core/components/Input/InputBase/types/index.ts index ce7c07e..0f81196 100644 --- a/src/core/components/Input/InputBase/types/index.ts +++ b/src/core/components/Input/InputBase/types/index.ts @@ -15,7 +15,6 @@ export interface InputBaseProps extends React.HTMLA borderColor?: ThemeColors; error?: boolean readOnly?: boolean; - disabled?: boolean; feedback?: React.ReactNode; feedbackColor?: ThemeColors; } diff --git a/src/core/components/Input/InputDatePicker/DatePicker.tsx b/src/core/components/Input/InputDatePicker/DatePicker.tsx index 045c4cd..2cfa4c1 100644 --- a/src/core/components/Input/InputDatePicker/DatePicker.tsx +++ b/src/core/components/Input/InputDatePicker/DatePicker.tsx @@ -2,7 +2,6 @@ import { useEffect, useId, useState } from "react"; import Button from "../../Button"; import DatePickerCalendar from "../../Calendar/DatePickerCalendar"; -import { DATE_PICKER_TYPE } from "../../Calendar/DatePickerCalendar/constants"; import { PeriodDates } from "../../Calendar/DatePickerCalendar/types/DatePickerCalendarProps"; import Divider from "../../Divider"; import ModalPopUp from "../../Modal/ModalPopUp"; @@ -11,7 +10,7 @@ import Typography from "../../Typography"; import { DatePickerProps } from "./types"; const DatePicker = ({ - variants = DATE_PICKER_TYPE["PERIOD"], + variants = "period", cutoffDate, cutoffAfterDate, isOpen, diff --git a/src/core/components/Input/InputDatePicker/index.tsx b/src/core/components/Input/InputDatePicker/index.tsx index 791f3b1..769cdfb 100644 --- a/src/core/components/Input/InputDatePicker/index.tsx +++ b/src/core/components/Input/InputDatePicker/index.tsx @@ -3,14 +3,13 @@ import clsx from "clsx"; import dayjs from "dayjs"; import { HTMLAttributes, useEffect, useId, useState } from "react"; -import { DATE_PICKER_TYPE } from "../../Calendar/DatePickerCalendar/constants"; import { PeriodDates } from "../../Calendar/DatePickerCalendar/types/DatePickerCalendarProps"; import InputBase from "../InputBase"; import DatePicker from "./DatePicker"; import { InputDatePickerProps } from "./types"; const InputDatePicker = ({ - variants = DATE_PICKER_TYPE["PERIOD"], + variants = "period", cutoffDate, cutoffAfterDate, overlay, @@ -21,7 +20,6 @@ const InputDatePicker = ({ useTab = false, useHoliday = false, disabled = false, - readOnly = false, required = false, className, inputClassName, @@ -32,7 +30,7 @@ const InputDatePicker = ({ placeholder, feedback, feedbackColor, -}: InputDatePickerProps & Omit, "disabled" | "readOnly">) => { +}: InputDatePickerProps & HTMLAttributes) => { const id = useId(); const [ periodDates, setPeriodDates ] = useState({ startDate: "", @@ -40,14 +38,13 @@ const InputDatePicker = ({ }); const startDate = dayjs(periodDates.startDate).format("YYYY. MM. DD"); const endDate = dayjs(periodDates.endDate).format("YYYY. MM. DD"); - const isDisabled = readOnly || disabled; const onDatePickerClick = (): Promise => { return new Promise(resolve => { overlay.open(({ isOpen, close }) => ( { resolve(periodDates); @@ -69,8 +66,7 @@ const InputDatePicker = ({ }; const handleDatePicker = async () => { - if (isDisabled) return; - + if (disabled) return; const periodDates = await onDatePickerClick(); setPeriodDates(periodDates); }; @@ -87,29 +83,24 @@ const InputDatePicker = ({ false} onFocus = {(e: React.FocusEvent) => e.target.blur()} onChange = {() => {}} onInvalid = {handleOnInvalid} disabled = {disabled} - readOnly = {readOnly} - aria-disabled = {disabled} - aria-readonly = {readOnly} required = {required} /> } diff --git a/src/core/components/Input/InputDatePicker/types/index.ts b/src/core/components/Input/InputDatePicker/types/index.ts index edd5ee3..5353a2e 100644 --- a/src/core/components/Input/InputDatePicker/types/index.ts +++ b/src/core/components/Input/InputDatePicker/types/index.ts @@ -24,7 +24,7 @@ export interface ExternalDates { export interface InputDatePickerProps extends Omit, - Pick, "feedback" | "feedbackColor" | "disabled" | "readOnly"> { + Pick, "feedback" | "feedbackColor"> { required?: boolean; inputClassName?: string; label?: string; diff --git a/src/core/components/Input/InputPassword/index.tsx b/src/core/components/Input/InputPassword/index.tsx index 5e43955..f5c4986 100644 --- a/src/core/components/Input/InputPassword/index.tsx +++ b/src/core/components/Input/InputPassword/index.tsx @@ -18,7 +18,7 @@ const InputPassword = forwardRef(( ) => { const id = useId(); const [ showPassword, setShowPassword ] = useState(false); - const { readOnly = false, disabled = false, rootClassName, className, required = false, value, onChange, autoComplete = "off", error = false, name, ...rest } = props; + const { readOnly, rootClassName, className, required, value, onChange, autoComplete = "off", error, name, ...rest } = props; const { inputValue, onChangeHandler } = useInput({ value, regCallback, onChange, name }); const ShowPasswordIcon = ; const HidePasswordIcon = ; @@ -33,7 +33,6 @@ const InputPassword = forwardRef(( inputRootClassName = "h-[3.75rem]" error = {error} readOnly = {readOnly} - disabled = {disabled} required = {required} feedback = {feedback} labelColor = {labelColor} @@ -45,12 +44,8 @@ const InputPassword = forwardRef(( type = {showPassword ? "text" : "password"} required = {required} value = {inputValue} - readOnly = {readOnly} - disabled = {disabled} onChange = {onChangeHandler} autoComplete = {autoComplete} - aria-disabled = {disabled} - aria-readonly = {readOnly} placeholder = {"********"} name = {name} {...rest} diff --git a/src/core/components/Input/InputPassword/types/index.ts b/src/core/components/Input/InputPassword/types/index.ts index 724ea21..691d929 100644 --- a/src/core/components/Input/InputPassword/types/index.ts +++ b/src/core/components/Input/InputPassword/types/index.ts @@ -2,6 +2,6 @@ import { InputBaseProps } from "../../InputBase/types"; import { UseInputProps } from "../../hooks/useInput"; export interface InputPasswordProps - extends Omit, "readOnly" | "disabled">, - Pick, "feedback" | "rootClassName" | "label" | "error" | "labelColor" | "readOnly" | "disabled">, + extends React.InputHTMLAttributes, + Pick, "feedback" | "rootClassName" | "label" | "error" | "labelColor">, Pick {} diff --git a/src/core/components/Input/InputSearch/InputSearch.stories.tsx b/src/core/components/Input/InputSearch/InputSearch.stories.tsx index f87a0d4..0eb20f7 100644 --- a/src/core/components/Input/InputSearch/InputSearch.stories.tsx +++ b/src/core/components/Input/InputSearch/InputSearch.stories.tsx @@ -13,14 +13,6 @@ const meta = { regCallback: { description: "Input RegEx", }, - readOnly: { - control: "boolean", - description: "Input readOnly", - }, - disabled: { - control: "boolean", - description: "Input disabled", - }, }, } satisfies Meta; diff --git a/src/core/components/Input/InputSearch/index.tsx b/src/core/components/Input/InputSearch/index.tsx index b96eef4..a36b041 100644 --- a/src/core/components/Input/InputSearch/index.tsx +++ b/src/core/components/Input/InputSearch/index.tsx @@ -17,7 +17,7 @@ const InputSearch = forwardRef(( ) => { const id = useId(); const formRef = useRef(null); - const { readOnly = false, disabled = false, rootClassName, className, value, onChange, autoComplete = "off", error = false, name, ...rest } = props; + const { rootClassName, className, value, onChange, autoComplete = "off", error, name, ...rest } = props; const { inputValue, onChangeHandler, onResetInputValue } = useInput({ value, regCallback, onChange, name }); const SearchIcon = ; @@ -38,8 +38,6 @@ const InputSearch = forwardRef(( ref = {formRef} error = {error} feedback = {feedback} - readOnly = {readOnly} - disabled = {disabled} rootClassName = {rootClassName} inputRootClassName = {"flex items-center px-6 py-2 text-body-02-medium bg-white rounded-full overflow-hidden border border-gray-02"} onSubmit = {onSubmitHandler} @@ -52,10 +50,6 @@ const InputSearch = forwardRef(( value = {inputValue} onChange = {onChangeHandler} autoComplete = {autoComplete} - readOnly = {readOnly} - disabled = {disabled} - aria-disabled = {disabled} - aria-readonly = {readOnly} name = {name} required {...rest} diff --git a/src/core/components/Input/InputSearch/types/index.ts b/src/core/components/Input/InputSearch/types/index.ts index ccb325c..6f99313 100644 --- a/src/core/components/Input/InputSearch/types/index.ts +++ b/src/core/components/Input/InputSearch/types/index.ts @@ -2,8 +2,8 @@ import { InputBaseProps } from "../../InputBase/types"; import { UseInputProps } from "../../hooks/useInput"; export interface InputSearchProps - extends Omit, "readOnly" | "disabled">, - Pick, "feedback" | "rootClassName" | "error" | "readOnly" | "disabled">, + extends React.InputHTMLAttributes, + Pick, "feedback" | "rootClassName" | "error">, Pick { formSubmitHandler?: (e: React.FormEvent) => void; } diff --git a/src/core/components/Input/InputTextArea/InputTextArea.stories.tsx b/src/core/components/Input/InputTextArea/InputTextArea.stories.tsx index c1dfdc6..0077000 100644 --- a/src/core/components/Input/InputTextArea/InputTextArea.stories.tsx +++ b/src/core/components/Input/InputTextArea/InputTextArea.stories.tsx @@ -25,14 +25,6 @@ const meta = { regCallback: { description: "Input RegEx", }, - readOnly: { - control: "boolean", - description: "Input readOnly", - }, - disabled: { - control: "boolean", - description: "Input disabled", - }, }, } satisfies Meta; diff --git a/src/core/components/Input/InputTextArea/index.tsx b/src/core/components/Input/InputTextArea/index.tsx index 739d750..4d3162b 100644 --- a/src/core/components/Input/InputTextArea/index.tsx +++ b/src/core/components/Input/InputTextArea/index.tsx @@ -20,7 +20,7 @@ const InputTextArea = forwardRef(( ref: React.Ref, ) => { const id = useId(); - const { readOnly = false, disabled = false, rootClassName, className, required = false, value, onChange, autoComplete = "off", maxLength = 150, error = false, name, ...rest } = props; + const { rootClassName, className, required, value, onChange, autoComplete = "off", maxLength = 150, error, name, ...rest } = props; const { inputValue, onChangeHandler } = useInput({ value, regCallback, onChange, name }); const currentInputValueLength = (inputValue as string)?.length || 0; @@ -38,8 +38,6 @@ const InputTextArea = forwardRef(( inputRootClassName = {clsx("flex-v-stack", TEXT_AREA_HEIGHT[textAreaHeight])} feedback = {feedback} error = {error} - readOnly = {readOnly} - disabled = {disabled} inputComponent = {