diff --git a/components/alert/Alert.tsx b/components/alert/Alert.tsx index 5ad40114b4..202645a8cc 100644 --- a/components/alert/Alert.tsx +++ b/components/alert/Alert.tsx @@ -20,14 +20,7 @@ export interface AlertRef { nativeElement: HTMLDivElement; } -export type AlertSemanticName = - | 'root' - | 'icon' - | 'section' - | 'title' - | 'description' - | 'actions' - | 'close'; +export type AlertSemanticName = keyof AlertSemanticClassNames & keyof AlertSemanticStyles; export type AlertSemanticClassNames = { root?: string; diff --git a/components/anchor/Anchor.tsx b/components/anchor/Anchor.tsx index 364b4a5913..2f40fd296b 100644 --- a/components/anchor/Anchor.tsx +++ b/components/anchor/Anchor.tsx @@ -52,7 +52,7 @@ interface Section { top: number; } -export type SemanticName = 'root' | 'item' | 'itemTitle' | 'indicator'; +export type SemanticName = keyof AnchorSemanticClassNames & keyof AnchorSemanticStyles; export type AnchorSemanticClassNames = { root?: string; diff --git a/components/auto-complete/AutoComplete.tsx b/components/auto-complete/AutoComplete.tsx index 76dbb2c874..843cbe2308 100644 --- a/components/auto-complete/AutoComplete.tsx +++ b/components/auto-complete/AutoComplete.tsx @@ -20,7 +20,8 @@ import type { } from '../select'; import Select from '../select'; -export type AutoCompleteSemanticName = 'root' | 'prefix' | 'input' | 'placeholder' | 'content'; +export type AutoCompleteSemanticName = keyof AutoCompleteSemanticClassNames & + keyof AutoCompleteSemanticStyles; export type AutoCompleteSemanticClassNames = { root?: string; diff --git a/components/breadcrumb/Breadcrumb.tsx b/components/breadcrumb/Breadcrumb.tsx index b545aa34b7..2861ecb1b5 100755 --- a/components/breadcrumb/Breadcrumb.tsx +++ b/components/breadcrumb/Breadcrumb.tsx @@ -52,7 +52,8 @@ export type ItemType = Partial; export type InternalRouteType = Partial; -export type BreadcrumbSemanticName = 'root' | 'item' | 'separator'; +export type BreadcrumbSemanticName = keyof BreadcrumbSemanticClassNames & + keyof BreadcrumbSemanticStyles; export type BreadcrumbSemanticClassNames = { root?: string; diff --git a/components/button/Button.tsx b/components/button/Button.tsx index 39558dc4f8..27b234080a 100644 --- a/components/button/Button.tsx +++ b/components/button/Button.tsx @@ -29,7 +29,7 @@ import Compact from './style/compact'; export type LegacyButtonType = ButtonType | 'danger'; -export type ButtonSemanticName = 'root' | 'icon' | 'content'; +export type ButtonSemanticName = keyof ButtonSemanticClassNames & keyof ButtonSemanticStyles; export type ButtonSemanticClassNames = { root?: string; diff --git a/components/card/CardMeta.tsx b/components/card/CardMeta.tsx index 4708e6f7bf..1844223fce 100644 --- a/components/card/CardMeta.tsx +++ b/components/card/CardMeta.tsx @@ -5,7 +5,7 @@ import { useMergeSemantic } from '../_util/hooks'; import type { SemanticClassNamesType, SemanticStylesType } from '../_util/hooks'; import { useComponentConfig } from '../config-provider/context'; -export type SemanticName = 'root' | 'section' | 'avatar' | 'title' | 'description'; +export type SemanticName = keyof CardMetaSemanticClassNames & keyof CardMetaSemanticStyles; export type CardMetaSemanticClassNames = { root?: string; diff --git a/components/collapse/Collapse.tsx b/components/collapse/Collapse.tsx index 5d60ce3c32..eeed5985e9 100644 --- a/components/collapse/Collapse.tsx +++ b/components/collapse/Collapse.tsx @@ -20,7 +20,7 @@ import useStyle from './style'; export type ExpandIconPlacement = 'start' | 'end'; -export type CollapseSemanticName = 'root' | 'header' | 'title' | 'body' | 'icon'; +export type CollapseSemanticName = keyof CollapseSemanticClassNames & keyof CollapseSemanticStyles; export type CollapseSemanticClassNames = { root?: string; diff --git a/components/empty/index.tsx b/components/empty/index.tsx index 1d294fac04..8499d8ce5b 100644 --- a/components/empty/index.tsx +++ b/components/empty/index.tsx @@ -17,7 +17,7 @@ export interface TransferLocale { description: string; } -export type EmptySemanticName = 'root' | 'image' | 'description' | 'footer'; +export type EmptySemanticName = keyof EmptySemanticClassNames & keyof EmptySemanticStyles; export type EmptySemanticClassNames = { root?: string; diff --git a/components/form/Form.tsx b/components/form/Form.tsx index d74ba71d0b..1509e39cef 100644 --- a/components/form/Form.tsx +++ b/components/form/Form.tsx @@ -37,7 +37,7 @@ export type FormItemLayout = 'horizontal' | 'vertical'; export type { ScrollFocusOptions }; -export type FormSemanticName = 'root' | 'label' | 'content'; +export type FormSemanticName = keyof FormSemanticClassNames & keyof FormSemanticStyles; export type FormSemanticClassNames = { root?: string; diff --git a/components/image/index.tsx b/components/image/index.tsx index 0b73aefed0..bcdf3c3b6d 100644 --- a/components/image/index.tsx +++ b/components/image/index.tsx @@ -47,7 +47,7 @@ export interface CompositionImage

extends React.FC

{ PreviewGroup: typeof PreviewGroup; } -export type ImageSemanticName = 'root' | 'image' | 'cover'; +export type ImageSemanticName = keyof ImageSemanticClassNames & keyof ImageSemanticStyles; export type ImageSemanticClassNames = { root?: string; diff --git a/components/masonry/Masonry.tsx b/components/masonry/Masonry.tsx index fc28a6e561..b42347a25a 100644 --- a/components/masonry/Masonry.tsx +++ b/components/masonry/Masonry.tsx @@ -28,7 +28,7 @@ export type Gap = number | undefined; export type Key = string | number; -export type SemanticName = 'root' | 'item'; +export type SemanticName = keyof MasonrySemanticClassNames & keyof MasonrySemanticStyles; type MasonrySemanticClassNames = { root?: string; diff --git a/components/menu/menu.tsx b/components/menu/menu.tsx index db64874b1a..9806caf4ba 100644 --- a/components/menu/menu.tsx +++ b/components/menu/menu.tsx @@ -34,7 +34,7 @@ const MENU_COMPONENTS: GetProp = { divider: Divider, }; -export type SemanticName = 'root' | 'itemTitle' | 'list' | 'item' | 'itemIcon' | 'itemContent'; +export type SemanticName = keyof MenuSemanticClassNames & keyof MenuSemanticStyles; export type MenuSemanticClassNames = { root?: string; @@ -54,7 +54,7 @@ export type MenuSemanticStyles = { itemContent?: React.CSSProperties; }; -export type SubMenuSemanticName = 'item' | 'itemTitle' | 'list' | 'itemContent' | 'itemIcon'; +export type SubMenuSemanticName = keyof SubMenuSemanticClassNames & keyof SubMenuSemanticStyles; export type SubMenuSemanticClassNames = { item?: string; diff --git a/components/message/interface.ts b/components/message/interface.ts index 3ff612ca63..bf3970dff9 100644 --- a/components/message/interface.ts +++ b/components/message/interface.ts @@ -4,7 +4,7 @@ import type { SemanticClassNamesType, SemanticStylesType } from '../_util/hooks' export type NoticeType = 'info' | 'success' | 'error' | 'warning' | 'loading'; -export type SemanticName = 'root' | 'icon' | 'content'; +export type SemanticName = keyof MessageSemanticClassNames & keyof MessageSemanticStyles; export type MessageSemanticClassNames = { root?: string; diff --git a/components/notification/interface.ts b/components/notification/interface.ts index 653b8b6755..ce7b75908a 100644 --- a/components/notification/interface.ts +++ b/components/notification/interface.ts @@ -19,7 +19,8 @@ export type NotificationPlacement = (typeof NotificationPlacements)[number]; export type IconType = 'success' | 'info' | 'error' | 'warning'; -export type NotificationSemantic = 'root' | 'title' | 'description' | 'actions' | 'icon'; +export type NotificationSemanticName = keyof NotificationSemanticClassNames & + keyof NotificationSemanticStyles; export type NotificationSemanticClassNames = { root?: string; diff --git a/components/pagination/Pagination.tsx b/components/pagination/Pagination.tsx index 1cd09cde80..9efaf3deb9 100644 --- a/components/pagination/Pagination.tsx +++ b/components/pagination/Pagination.tsx @@ -25,7 +25,7 @@ import useStyle from './style'; import BorderedStyle from './style/bordered'; import useShowSizeChanger from './useShowSizeChanger'; -export type SemanticName = 'root' | 'item'; +export type SemanticName = keyof PaginationSemanticClassNames & keyof PaginationSemanticStyles; export type PaginationSemanticName = SemanticName; diff --git a/components/popover/index.tsx b/components/popover/index.tsx index b471924413..85275e0d27 100644 --- a/components/popover/index.tsx +++ b/components/popover/index.tsx @@ -15,7 +15,6 @@ import type { AbstractTooltipProps, TooltipRef, TooltipSemanticClassNames, - SemanticName as TooltipSemanticName, TooltipSemanticStyles, } from '../tooltip'; import Tooltip from '../tooltip'; @@ -24,7 +23,7 @@ import PurePanel, { Overlay } from './PurePanel'; // CSSINJS import useStyle from './style'; -export type PopoverSemanticName = TooltipSemanticName | 'title' | 'content'; +export type PopoverSemanticName = keyof PopoverSemanticClassNames & keyof PopoverSemanticStyles; export type PopoverSemanticClassNames = TooltipSemanticClassNames & { title?: string; diff --git a/components/progress/progress.tsx b/components/progress/progress.tsx index 587ec7a977..3bcd5e8f1f 100644 --- a/components/progress/progress.tsx +++ b/components/progress/progress.tsx @@ -17,7 +17,7 @@ import Steps from './Steps'; import useStyle from './style'; import { getSize, getSuccessPercent, validProgress } from './utils'; -export type SemanticName = 'root' | 'body' | 'rail' | 'track' | 'indicator'; +export type SemanticName = keyof ProgressSemanticClassNames & keyof ProgressSemanticStyles; export type ProgressSemanticClassNames = { root?: string; diff --git a/components/qr-code/interface.ts b/components/qr-code/interface.ts index d006428075..4163ca8461 100644 --- a/components/qr-code/interface.ts +++ b/components/qr-code/interface.ts @@ -20,7 +20,7 @@ export type StatusRenderInfo = { onRefresh?: () => void; }; -export type QRCodeSemanticName = 'root' | 'cover'; +export type QRCodeSemanticName = keyof QRCodeSemanticClassNames & keyof QRCodeSemanticStyles; export type QRCodeSemanticClassNames = { root?: string; diff --git a/components/segmented/index.tsx b/components/segmented/index.tsx index 4ce0d80227..751fdde19c 100644 --- a/components/segmented/index.tsx +++ b/components/segmented/index.tsx @@ -20,7 +20,7 @@ import useStyle from './style'; export type { SegmentedValue } from '@rc-component/segmented'; -export type SemanticName = 'root' | 'icon' | 'label' | 'item'; +export type SemanticName = keyof SegmentedSemanticClassNames & keyof SegmentedSemanticStyles; export type SegmentedSemanticClassNames = { root?: string; diff --git a/components/select/index.tsx b/components/select/index.tsx index a405b0fbf8..4a71b58ea2 100755 --- a/components/select/index.tsx +++ b/components/select/index.tsx @@ -71,6 +71,8 @@ export interface InternalSelectProps< styles?: SelectSemanticStyles & { popup?: PopupSemanticStyles }; } +export type SelectSemanticName = keyof SelectSemanticClassNames & keyof SelectSemanticStyles; + export type SelectSemanticClassNames = { root?: string; prefix?: string; diff --git a/components/skeleton/Element.tsx b/components/skeleton/Element.tsx index 61c918452c..a1906a3eee 100644 --- a/components/skeleton/Element.tsx +++ b/components/skeleton/Element.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { clsx } from 'clsx'; -export type ElementSemanticName = 'root' | 'content'; +export type ElementSemanticName = keyof ElementSemanticClassNames & keyof ElementSemanticStyles; export type ElementSemanticClassNames = { root?: string; diff --git a/components/skeleton/Skeleton.tsx b/components/skeleton/Skeleton.tsx index 5150aab49c..641d598e1f 100644 --- a/components/skeleton/Skeleton.tsx +++ b/components/skeleton/Skeleton.tsx @@ -20,7 +20,7 @@ import Title from './Title'; /* This only for skeleton internal. */ type SkeletonAvatarProps = Omit; -export type SemanticName = 'root' | 'header' | 'section' | 'avatar' | 'title' | 'paragraph'; +export type SemanticName = keyof SkeletonSemanticClassNames & keyof SkeletonSemanticStyles; export type SkeletonSemanticClassNames = { root?: string; diff --git a/components/slider/index.tsx b/components/slider/index.tsx index e9346b0c8e..c444f9ddc2 100644 --- a/components/slider/index.tsx +++ b/components/slider/index.tsx @@ -19,7 +19,7 @@ import useRafLock from './useRafLock'; export type SliderMarks = RcSliderProps['marks']; -export type SemanticName = 'root' | 'tracks' | 'track' | 'rail' | 'handle'; +export type SemanticName = keyof SliderSemanticClassNames & keyof SliderSemanticStyles; export type SliderSemanticClassNames = { root?: string; diff --git a/components/splitter/interface.ts b/components/splitter/interface.ts index eab967e473..fcfa9b61a8 100644 --- a/components/splitter/interface.ts +++ b/components/splitter/interface.ts @@ -1,7 +1,7 @@ import type { Orientation, SemanticClassNamesType, SemanticStylesType } from '../_util/hooks'; import type { ShowCollapsibleIconMode } from './SplitBar'; -export type SplitterSemanticName = 'root' | 'panel'; +export type SplitterSemanticName = keyof SplitterSemanticClassNames & keyof SplitterSemanticStyles; export type SplitterSemanticClassNames = { root?: string; diff --git a/components/statistic/Statistic.tsx b/components/statistic/Statistic.tsx index cf484420cb..0d69562aef 100644 --- a/components/statistic/Statistic.tsx +++ b/components/statistic/Statistic.tsx @@ -12,7 +12,7 @@ import StatisticNumber from './Number'; import useStyle from './style'; import type { FormatConfig, valueType } from './utils'; -export type SemanticName = 'root' | 'content' | 'title' | 'header' | 'prefix' | 'suffix'; +export type SemanticName = keyof StatisticSemanticClassNames & keyof StatisticSemanticStyles; export type StatisticSemanticClassNames = { root?: string; diff --git a/components/table/InternalTable.tsx b/components/table/InternalTable.tsx index c92c299c14..8fdb6f8613 100644 --- a/components/table/InternalTable.tsx +++ b/components/table/InternalTable.tsx @@ -68,7 +68,7 @@ export type { ColumnsType, TablePaginationConfig }; const EMPTY_LIST: AnyObject[] = []; -export type TableSemanticName = 'root' | 'section' | 'title' | 'footer' | 'content'; +export type TableSemanticName = keyof TableSemanticClassNames & keyof TableSemanticStyles; export type TableSemanticClassNames = { root?: string; diff --git a/components/tabs/index.tsx b/components/tabs/index.tsx index 0888ca5766..3bcd29b28d 100755 --- a/components/tabs/index.tsx +++ b/components/tabs/index.tsx @@ -30,7 +30,7 @@ export type TabPlacement = 'top' | 'end' | 'bottom' | 'start'; export type { TabPaneProps }; -export type TabsSemanticName = 'root' | 'item' | 'indicator' | 'content' | 'header'; +export type TabsSemanticName = keyof TabsSemanticClassNames & keyof TabsSemanticStyles; export type TabsSemanticClassNames = { root?: string; diff --git a/components/tag/CheckableTagGroup.tsx b/components/tag/CheckableTagGroup.tsx index fb65c22d98..9c0d92bbc9 100644 --- a/components/tag/CheckableTagGroup.tsx +++ b/components/tag/CheckableTagGroup.tsx @@ -30,7 +30,7 @@ interface CheckableTagGroupMultipleProps { onChange?: (value: CheckableTagValue[]) => void; } -export type SemanticName = 'root' | 'item'; +export type SemanticName = keyof TagGroupSemanticClassNames & keyof TagGroupSemanticStyles; export type TagGroupSemanticClassNames = { root?: string; diff --git a/components/tag/index.tsx b/components/tag/index.tsx index 6297dbb8e2..cba7cddd5a 100644 --- a/components/tag/index.tsx +++ b/components/tag/index.tsx @@ -22,7 +22,7 @@ import StatusCmp from './style/statusCmp'; export type { CheckableTagProps } from './CheckableTag'; export type { CheckableTagGroupProps } from './CheckableTagGroup'; -export type TagSemanticName = 'root' | 'icon' | 'content'; +export type TagSemanticName = keyof TagSemanticClassNames & keyof TagSemanticStyles; export type TagSemanticClassNames = { root?: string; diff --git a/components/time-picker/index.tsx b/components/time-picker/index.tsx index ae903f5aaa..682b8398f7 100644 --- a/components/time-picker/index.tsx +++ b/components/time-picker/index.tsx @@ -32,7 +32,8 @@ export type TimePickerSemanticStyles = { suffix?: React.CSSProperties; }; -export type PanelSemanticName = 'root' | 'content' | 'item' | 'footer' | 'container'; +export type PanelSemanticName = keyof TimePickerPanelSemanticClassNames & + keyof TimePickerPanelSemanticStyles; export type TimePickerPanelSemanticClassNames = { root?: string; diff --git a/components/tooltip/index.tsx b/components/tooltip/index.tsx index 58e9d23665..48f2e4a99c 100644 --- a/components/tooltip/index.tsx +++ b/components/tooltip/index.tsx @@ -86,7 +86,7 @@ interface LegacyTooltipProps afterOpenChange?: RcTooltipProps['afterVisibleChange']; } -export type SemanticName = 'root' | 'container' | 'arrow'; +export type SemanticName = keyof TooltipSemanticClassNames & keyof TooltipSemanticStyles; export type TooltipSemanticClassNames = { root?: string; diff --git a/components/tree/Tree.tsx b/components/tree/Tree.tsx index 6850c4660e..5f968f9ff0 100644 --- a/components/tree/Tree.tsx +++ b/components/tree/Tree.tsx @@ -112,7 +112,7 @@ interface DraggableConfig { nodeDraggable?: DraggableFn; } -export type TreeSemanticName = 'root' | 'item' | 'itemIcon' | 'itemTitle'; +export type TreeSemanticName = keyof TreeSemanticClassNames & keyof TreeSemanticStyles; export type TreeSemanticClassNames = { root?: string; diff --git a/components/upload/interface.ts b/components/upload/interface.ts index e903faf65c..127c049821 100755 --- a/components/upload/interface.ts +++ b/components/upload/interface.ts @@ -85,9 +85,10 @@ export type ItemRender = ( ) => React.ReactNode; type PreviewFileHandler = (file: File | Blob) => PromiseLike; + type BeforeUploadValueType = void | boolean | string | Blob | File; -export type SemanticName = 'root' | 'list' | 'item'; +export type SemanticName = keyof UploadSemanticClassNames & keyof UploadSemanticStyles; export type UploadSemanticClassNames = { root?: string;