import React from 'react';
import { IconName } from '../../foundation';
import { FilterChip } from './FilterChip';
import { ActionChip } from './ActionChip';
import { InputChip } from './InputChip';
import { IconChip } from './IconChip';
import { ThrottleOptions } from '../../internal/utils/useThrottledPressHandler';
type CommonChipProps = { selected?: boolean; disabled?: boolean };
export type FilterChipProps = { type: 'filter'; title: string; onPress: (title: string) => void } & CommonChipProps;
export type ActionChipProps = {
type: 'action';
title: string;
icon?: IconName;
onPress: (title: string) => void;
} & CommonChipProps;
export type InputChipProps = {
type: 'input';
title: string;
onPress: (title: string) => void;
/**
* @deprecated
* - [2024.10 update] 대신 `showIcon`을 사용해주세요.
*/
hideXIcon?: boolean;
onPressXIcon?: () => void;
showIcon?: boolean;
} & CommonChipProps;
export type IconChipProps = {
type: 'icon_only';
icon: 'filter_outlined' | 'refresh_outlined';
onPress: () => void;
} & ThrottleOptions &
CommonChipProps;
/**
* 칩 컴포넌트
*/
export function Chip(props: FilterChipProps | ActionChipProps | InputChipProps | IconChipProps): React.JSX.Element {
const { type } = props;
if (type === 'filter') {
return ;
}
if (type === 'action') {
return ;
}
if (type === 'input') {
return ;
}
if (type === 'icon_only') {
return ;
}
throw new Error(`Chip 컴포넌트에 유효하지 않은 타입이 전달되었습니다: ${type}`);
}