diff --git a/.changeset/fresh-dodos-approve.md b/.changeset/fresh-dodos-approve.md new file mode 100644 index 00000000..20ecbddd --- /dev/null +++ b/.changeset/fresh-dodos-approve.md @@ -0,0 +1,5 @@ +--- +"wowds-ui": patch +--- + +Picker 컴포넌트와 DropDownOption 컴포넌트를 수정합니다. diff --git a/packages/wow-ui/src/components/DropDown/DropDownOption.tsx b/packages/wow-ui/src/components/DropDown/DropDownOption.tsx index c502f45c..fda4348e 100644 --- a/packages/wow-ui/src/components/DropDown/DropDownOption.tsx +++ b/packages/wow-ui/src/components/DropDown/DropDownOption.tsx @@ -1,8 +1,8 @@ "use client"; -import { cva } from "@styled-system/css"; +import { cva, cx } from "@styled-system/css"; import { styled } from "@styled-system/jsx"; -import type { ReactNode } from "react"; +import type { CSSProperties, ReactNode } from "react"; import { forwardRef, useCallback, useEffect } from "react"; import { useDropDownContext } from "@/components/DropDown/context/DropDownContext"; @@ -14,16 +14,20 @@ import { useCollection } from "./context/CollectionContext"; * * @param {string} value 옵션의 값입니다. * @param {() => void} [onClick] 옵션이 클릭되었을 때 호출되는 함수입니다. - * @param {React.ReactNode} [text] 드롭다운 옵션에 들어갈 텍스트. + * @param {React.ReactNode} text 드롭다운 옵션에 들어갈 텍스트. + * @param {CSSProperties} [style] 드롭다운 옵션의 커스텀 스타일. + * @param {string} [className] 드롭다운 옵션에 전달하는 커스텀 클래스. */ export interface DropDownOptionProps { value: string; onClick?: () => void; text: ReactNode; + style?: CSSProperties; + className?: string; } const DropDownOption = forwardRef( - function Option({ value, onClick, text }, ref) { + function Option({ value, onClick, text, className, ...rest }, ref) { const { focusedValue, selectedValue, handleSelect, dropdownId } = useDropDownContext(); const isSelected = selectedValue === value; @@ -52,12 +56,16 @@ const DropDownOption = forwardRef( ref={ref} role="option" tabIndex={isSelected ? 0 : -1} - className={optionStyle({ - type: isSelected ? "selected" : isFocused ? "focused" : "default", - })} + className={cx( + optionStyle({ + type: isSelected ? "selected" : isFocused ? "focused" : "default", + }), + className + )} onClick={() => { handleOptionClick(value, onClick); }} + {...rest} > {text} diff --git a/packages/wow-ui/src/components/Picker/DatePicker.stories.tsx b/packages/wow-ui/src/components/Picker/DatePicker.stories.tsx index 35c8b21f..623df9b1 100644 --- a/packages/wow-ui/src/components/Picker/DatePicker.stories.tsx +++ b/packages/wow-ui/src/components/Picker/DatePicker.stories.tsx @@ -108,3 +108,17 @@ export const TimeRange = () => { ); }; + +export const DisabledDatePicker = () => { + const [selected, setSelected] = useState(new Date()); + + return ( + + + + + ); +}; diff --git a/packages/wow-ui/src/components/Picker/PickerGroup.tsx b/packages/wow-ui/src/components/Picker/PickerGroup.tsx index 0d289aa7..74c1082d 100644 --- a/packages/wow-ui/src/components/Picker/PickerGroup.tsx +++ b/packages/wow-ui/src/components/Picker/PickerGroup.tsx @@ -21,9 +21,9 @@ const PickerGroup = ({ setSelectedDate, label, }: PickerGroupProps) => { - const hours = selectedDate?.getHours() || 12; + const hours = selectedDate?.getHours(); const [time, setTime] = useState