From ff4e48be35cbc5bef1ccf47bf096c02ea0f092cd Mon Sep 17 00:00:00 2001 From: malangcat Date: Fri, 3 Jan 2025 20:42:38 +0900 Subject: [PATCH] fix: ControlChip snippet --- docs/registry/ui/control-chip.tsx | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/docs/registry/ui/control-chip.tsx b/docs/registry/ui/control-chip.tsx index b3b36cc3a..5ea375915 100644 --- a/docs/registry/ui/control-chip.tsx +++ b/docs/registry/ui/control-chip.tsx @@ -5,7 +5,7 @@ import * as React from "react"; import "@seed-design/stylesheet/controlChip.css"; -export interface ControlChipProps extends SeedControlChip.RootProps { +export interface ControlChipToggleProps extends SeedControlChip.RootProps { prefixIcon?: React.ReactNode; suffixIcon?: React.ReactNode; @@ -13,7 +13,10 @@ export interface ControlChipProps extends SeedControlChip.RootProps { count?: number; } -export const ControlChip = React.forwardRef( +export const ControlChipToggle = React.forwardRef< + HTMLLabelElement, + ControlChipToggleProps +>( ( { className, children, prefixIcon, suffixIcon, count, ...otherProps }, ref, @@ -34,7 +37,18 @@ export const ControlChip = React.forwardRef( ); }, ); -ControlChip.displayName = "ControlChip"; +ControlChipToggle.displayName = "ControlChip.Toggle"; + +export const ControlChip = Object.assign( + () => { + console.warn( + "ControlChip is a base component and should not be rendered. Use ControlChip.Toggle or ControlChip.Radio instead.", + ); + }, + { + Toggle: ControlChipToggle, + }, +); /** * This file is generated snippet from the Seed Design.