import type React from 'react'; import type { ComponentTheme } from "./ui/theme/common/ComponentTheme"; import type { ButtonTheme } from './ui/button/ButtonTheme'; import type { ButtonSpinnerTheme } from './ui/button/ButtonSpinnerTheme'; import type { BadgeTheme } from './ui/badge/BadgeTheme'; import type { ChipTheme } from './ui/chip/ChipTheme'; import type { CodeTheme } from './ui/code/CodeTheme'; import type { TypographyTheme } from './ui/typography/common/TypographyTheme'; import type { LinkTheme } from './ui/typography/link/LinkTheme'; import type { ListTheme } from './ui/typography/list/ListTheme'; import type { ListItemTheme } from './ui/typography/listItem/ListItemTheme'; import type { CardTheme } from "./ui/card/CardTheme"; import type { FieldTheme } from "./ui/field/FieldTheme"; import type { AlertTheme } from "./ui/alert/AlertTheme"; import type { SpinnerTheme } from "./ui/spinner/SpinnerTheme"; import type { CardHeaderTheme } from './ui/card/CardHeaderTheme'; import type { CardBodyTheme } from './ui/card/CardBodyTheme'; import type { CardFooterTheme } from './ui/card/CardFooterTheme'; import type { RowTheme } from "./ui/row/RowTheme"; import type { DividerTheme } from './ui/divider/DividerTheme'; import type { ContainerTheme } from './ui/container/ContainerTheme'; import type { ColTheme } from './ui/col/ColTheme'; import type { StackTheme } from './ui/stack/StackTheme'; import type { SectionTheme } from "./ui/section/SectionTheme"; import type { GridTheme } from "./ui/grid/GridTheme"; import type { CheckboxTheme } from './ui/checkbox/CheckboxTheme'; import type { CheckboxCheckTheme } from './ui/checkbox/CheckboxCheckTheme'; import type { CheckboxIndeterminateTheme } from './ui/checkbox/CheckboxIndeterminateTheme'; import type { CheckboxWrapperTheme } from './ui/checkbox/CheckboxWrapperTheme'; import type { LabelTheme } from './ui/label/LabelTheme'; import type { ImgTheme } from './ui/img/ImgTheme'; import type { InputTheme } from './ui/input/InputTheme'; import type { InputErrorIconTheme } from './ui/input/InputErrorIconTheme'; import type { InputWrapperTheme } from './ui/input/InputWrapperTheme'; import type { SelectChevronTheme } from './ui/select/SelectChevronTheme'; import type { SelectWrapperTheme } from './ui/select/SelectWrapperTheme'; import type { SwitchTheme } from './ui/switch/SwitchTheme'; import type { SwitchThumbTheme } from './ui/switch/SwitchThumbTheme'; import type { SwitchWrapperTheme } from './ui/switch/SwitchWrapperTheme'; import type { RadioTheme } from './ui/radio/RadioTheme'; import type { RadioDotTheme } from './ui/radio/RadioDotTheme'; import type { RadioWrapperTheme } from './ui/radio/RadioWrapperTheme'; import type { OverlayTheme } from './ui/overlay/OverlayTheme'; import type { ModalContentTheme } from './ui/modal/ModalContentTheme'; import type { ModalHeaderTheme } from './ui/modal/ModalHeaderTheme'; import type { ModalBodyTheme } from './ui/modal/ModalBodyTheme'; import type { ModalFooterTheme } from './ui/modal/ModalFooterTheme'; import type { ModalCloseButtonTheme } from './ui/modal/ModalCloseButtonTheme'; import type { PopupTheme } from './ui/popup/PopupTheme'; import type { IconButtonTheme } from './ui/iconButton/IconButtonTheme'; import type { IconTheme } from './ui/icon/IconTheme'; import type { KbdTheme } from './ui/kbd/KbdTheme'; import type { MarkTheme } from './ui/mark/MarkTheme'; import type { MenuItemTheme } from './ui/menu/MenuItemTheme'; import type { MenuLabelTheme } from './ui/menu/MenuLabelTheme'; import type { NavLinkTheme } from './ui/navLink/NavLinkTheme'; import type { NavLinkLabelTheme } from './ui/navLink/NavLinkLabelTheme'; import type { TableTheme } from './ui/table/TableTheme'; import type { TheadTheme } from './ui/table/TheadTheme'; import type { TbodyTheme } from './ui/table/TbodyTheme'; import type { TfootTheme } from './ui/table/TfootTheme'; import type { TrTheme } from './ui/table/TrTheme'; import type { ThTheme } from './ui/table/ThTheme'; import type { TdTheme } from './ui/table/TdTheme'; import type { CaptionTheme } from './ui/table/CaptionTheme'; import type { BadgeProps } from "./ui/badge/BadgeProps"; import type { ButtonProps } from "./ui/button/ButtonProps"; import type { ButtonSpinnerProps } from "./ui/button/ButtonSpinnerProps"; import type { CardProps } from "./ui/card/CardProps"; import type { FieldProps } from "./ui/field/FieldProps"; import type { AlertProps } from "./ui/alert/AlertProps"; import type { SpinnerProps } from "./ui/spinner/SpinnerProps"; import type { CardHeaderProps } from "./ui/card/CardHeaderProps"; import type { CardBodyProps } from "./ui/card/CardBodyProps"; import type { CardFooterProps } from "./ui/card/CardFooterProps"; import type { ChipProps } from "./ui/chip/ChipProps"; import type { CodeProps } from "./ui/code/CodeProps"; import type { ColProps } from "./ui/col"; import type { ContainerProps } from "./ui/container"; import type { DividerProps } from "./ui/divider"; import type { GridProps } from "./ui/grid"; import type { ListProps, TypographyProps } from "./ui/typography"; import type { RowProps } from "./ui/row/RowProps"; import type { SectionProps } from "./ui/section"; import type { StackProps } from "./ui/stack"; import type { CheckboxProps } from "./ui/checkbox"; import type { CheckboxCheckProps } from "./ui/checkbox/CheckboxCheckProps"; import type { CheckboxIndeterminateProps } from "./ui/checkbox/CheckboxIndeterminateProps"; import type { LabelProps } from "./ui/label"; import type { ImgProps } from "./ui/img"; import type { InputProps, InputErrorIconProps, InputWrapperProps } from "./ui/input"; import type { TextareaProps } from "./ui/textarea/TextareaProps"; import type { SelectProps, SelectChevronProps, SelectWrapperProps } from "./ui/select"; import type { SwitchProps, SwitchThumbProps } from "./ui/switch"; import type { RadioProps, RadioDotProps, RadioGroupProps } from "./ui/radio"; import type { OverlayProps } from "./ui/overlay"; import type { ModalProps, ModalHeaderProps, ModalBodyProps, ModalFooterProps } from "./ui/modal"; import type { ModalCloseButtonProps } from "./ui/modal/ModalCloseButtonProps"; import type { PopupProps } from "./ui/popup"; import type { IconButtonProps } from "./ui/iconButton/IconButtonProps"; import type { IconProps } from "./ui/icon/IconProps"; import type { KbdProps } from "./ui/kbd/KbdProps"; import type { MarkProps } from "./ui/mark/MarkProps"; import type { MenuItemProps } from "./ui/menu/MenuItemProps"; import type { MenuLabelProps } from './ui/menu/MenuLabelProps'; import type { NavLinkProps } from './ui/navLink/NavLinkProps'; import type { NavLinkLabelProps } from './ui/navLink/NavLinkLabelProps'; import type { TableProps } from './ui/table/TableProps'; import type { TheadProps } from './ui/table/TheadProps'; import type { TbodyProps } from './ui/table/TbodyProps'; import type { TfootProps } from './ui/table/TfootProps'; import type { TrProps } from './ui/table/TrProps'; import type { ThProps } from './ui/table/ThProps'; import type { TdProps } from './ui/table/TdProps'; import type { CaptionProps } from './ui/table/CaptionProps'; import type { DeepPartial } from "./utils/deepPartial"; import type { ComponentKeys, ComponentCategoryKey } from "./ui/props/keys"; export interface ThemeProps { button: { main: ComponentTheme; spinner: ComponentTheme; }; iconButton: ComponentTheme; badge: ComponentTheme; icon: ComponentTheme; chip: ComponentTheme; code: ComponentTheme; kbd: ComponentTheme; mark: ComponentTheme; card: { main: ComponentTheme; header: ComponentTheme; body: ComponentTheme; footer: ComponentTheme; }; divider: ComponentTheme; container: ComponentTheme; row: ComponentTheme; col: ComponentTheme; stack: ComponentTheme; section: ComponentTheme; grid2: ComponentTheme; grid3: ComponentTheme; grid4: ComponentTheme; grid5: ComponentTheme; grid6: ComponentTheme; pageTitle: ComponentTheme; sectionTitle: ComponentTheme; title: ComponentTheme; text: ComponentTheme; blockquote: ComponentTheme; blockquoteCite: ComponentTheme; link: ComponentTheme; listItem: ComponentTheme; list: ComponentTheme; checkbox: { input: ComponentTheme; check: ComponentTheme; indeterminate: ComponentTheme; wrapper: ComponentTheme; }; label: ComponentTheme; field: { main: ComponentTheme; label: ComponentTheme; controlRow: ComponentTheme; description: ComponentTheme; error: ComponentTheme; }; img: ComponentTheme; input: ComponentTheme; inputErrorIcon: ComponentTheme; inputWrapper: ComponentTheme; textarea: ComponentTheme; select: ComponentTheme; selectChevron: ComponentTheme; selectWrapper: ComponentTheme; switch: { input: ComponentTheme; thumb: ComponentTheme; wrapper: ComponentTheme; }; radio: { input: ComponentTheme; dot: ComponentTheme; wrapper: ComponentTheme; }; radioGroup: ComponentTheme; overlay: ComponentTheme; modal: { content: ComponentTheme; overlay: ComponentTheme; header: ComponentTheme; body: ComponentTheme; footer: ComponentTheme; closeButton: ComponentTheme; }; popup: ComponentTheme; tooltip: ComponentTheme; alert: ComponentTheme; spinner: ComponentTheme; menu: { item: ComponentTheme; popup: ComponentTheme; divider: ComponentTheme; label: ComponentTheme; }; navLink: { root: ComponentTheme; label: ComponentTheme; }; table: { main: ComponentTheme; thead: ComponentTheme; tbody: ComponentTheme; tfoot: ComponentTheme; tr: ComponentTheme; th: ComponentTheme; td: ComponentTheme; caption: ComponentTheme; }; } export type PartialTheme = DeepPartial; /** Boolean prop flags of a component's props type, as an all-boolean bag. */ type BooleanKeys = { [K in keyof T as T[K] extends boolean | undefined ? K : never]: boolean; }; /** * Every flag the category engine can extract: the union of all values of all * categories in ComponentKeys ('primary', 'md', 'filled', 'disabled', ...). */ type CategoryFlagKey = (typeof ComponentKeys)[ComponentCategoryKey][number]; /** * themeDefaults payload for one component: any of its boolean props. This is * intentionally the full boolean key space of P (category flags plus boolean * props like Button's `loading`) — defaults merge into * ComponentTheme.defaults, which is consulted by the category extractor and * passed to tagFunction. */ type ThemeDefaultsLeaf

= Partial>; /** * extraClasses payload for one component: extra CSS classes keyed by prop * flag. Keys are narrowed to the component's boolean props that some category * can actually extract, because the runtime applies extraClasses only to * extracted category values (see ComponentTheme.getClasses) — a key no * category can produce (e.g. Button's `loading`, NavLink's `active`) is dead * configuration, so it is rejected at compile time. * * Precision note: this narrows to `keys of P ∩ global category-flag union`, * not to the flags of the component's exact categories array. ComponentTheme's * type parameters do not carry the categories tuple (the constructor argument * is widened to `readonly ComponentCategoryKey[]` and stored privately), so * per-component category narrowing would require either a third ComponentTheme * type parameter threaded through every theme file or a hand-written * path→categories type map — the kind of mirror this derivation exists to * delete. In practice each Props type mirrors its categories array (the * categories⊆props direction is compile-time enforced by * propsCategoriesAlignment.test.ts), so the residual over-acceptance is * limited to flags whose prop interface is on P while the category is absent * from the component's categories array. */ type ThemeExtraClassesLeaf

= Partial, CategoryFlagKey>, string>>; /** Recursive walk of a ThemeProps subtree mapping every theme leaf to its themeDefaults payload. */ type DeriveThemeDefaults = { [K in keyof T]?: T[K] extends ComponentTheme ? ThemeDefaultsLeaf

: DeriveThemeDefaults; }; /** Recursive walk of a ThemeProps subtree mapping every theme leaf to its extraClasses payload. */ type DeriveThemeExtraClasses = { [K in keyof T]?: T[K] extends ComponentTheme ? ThemeExtraClassesLeaf

: DeriveThemeExtraClasses; }; /** * Per-component default boolean props, applied via ThemeProvider's * `themeDefaults` prop. Derived from ThemeProps (see above). */ export type ThemeDefaults = DeriveThemeDefaults; /** * Per-component extra CSS classes keyed by category flag, applied via * ThemeProvider's `extraClasses` prop. Derived from ThemeProps (see above). */ export type ThemeExtraClasses = DeriveThemeExtraClasses; export type MergeStrategy = 'merge' | 'replace'; export interface ThemeProviderProps { children: React.ReactNode; theme?: PartialTheme; themeDefaults?: ThemeDefaults; extraClasses?: ThemeExtraClasses; themeOverride?: (theme: ThemeProps) => ThemeProps; mergeStrategy?: MergeStrategy; } export {};