import type React from 'react'; import type { ComponentTheme } from "./ui/theme/common/ComponentTheme.cjs"; import type { ButtonTheme } from './ui/button/ButtonTheme.cjs'; import type { ButtonSpinnerTheme } from './ui/button/ButtonSpinnerTheme.cjs'; import type { BadgeTheme } from './ui/badge/BadgeTheme.cjs'; import type { ChipTheme } from './ui/chip/ChipTheme.cjs'; import type { CodeTheme } from './ui/code/CodeTheme.cjs'; import type { TypographyTheme } from './ui/typography/common/TypographyTheme.cjs'; import type { LinkTheme } from './ui/typography/link/LinkTheme.cjs'; import type { ListTheme } from './ui/typography/list/ListTheme.cjs'; import type { ListItemTheme } from './ui/typography/listItem/ListItemTheme.cjs'; import type { CardTheme } from "./ui/card/CardTheme.cjs"; import type { FieldTheme } from "./ui/field/FieldTheme.cjs"; import type { AlertTheme } from "./ui/alert/AlertTheme.cjs"; import type { SpinnerTheme } from "./ui/spinner/SpinnerTheme.cjs"; import type { CardHeaderTheme } from './ui/card/CardHeaderTheme.cjs'; import type { CardBodyTheme } from './ui/card/CardBodyTheme.cjs'; import type { CardFooterTheme } from './ui/card/CardFooterTheme.cjs'; import type { RowTheme } from "./ui/row/RowTheme.cjs"; import type { DividerTheme } from './ui/divider/DividerTheme.cjs'; import type { ContainerTheme } from './ui/container/ContainerTheme.cjs'; import type { ColTheme } from './ui/col/ColTheme.cjs'; import type { StackTheme } from './ui/stack/StackTheme.cjs'; import type { SectionTheme } from "./ui/section/SectionTheme.cjs"; import type { GridTheme } from "./ui/grid/GridTheme.cjs"; import type { CheckboxTheme } from './ui/checkbox/CheckboxTheme.cjs'; import type { CheckboxCheckTheme } from './ui/checkbox/CheckboxCheckTheme.cjs'; import type { CheckboxIndeterminateTheme } from './ui/checkbox/CheckboxIndeterminateTheme.cjs'; import type { CheckboxWrapperTheme } from './ui/checkbox/CheckboxWrapperTheme.cjs'; import type { LabelTheme } from './ui/label/LabelTheme.cjs'; import type { ImgTheme } from './ui/img/ImgTheme.cjs'; import type { InputTheme } from './ui/input/InputTheme.cjs'; import type { InputErrorIconTheme } from './ui/input/InputErrorIconTheme.cjs'; import type { InputWrapperTheme } from './ui/input/InputWrapperTheme.cjs'; import type { SelectChevronTheme } from './ui/select/SelectChevronTheme.cjs'; import type { SelectWrapperTheme } from './ui/select/SelectWrapperTheme.cjs'; import type { SwitchTheme } from './ui/switch/SwitchTheme.cjs'; import type { SwitchThumbTheme } from './ui/switch/SwitchThumbTheme.cjs'; import type { SwitchWrapperTheme } from './ui/switch/SwitchWrapperTheme.cjs'; import type { RadioTheme } from './ui/radio/RadioTheme.cjs'; import type { RadioDotTheme } from './ui/radio/RadioDotTheme.cjs'; import type { RadioWrapperTheme } from './ui/radio/RadioWrapperTheme.cjs'; import type { OverlayTheme } from './ui/overlay/OverlayTheme.cjs'; import type { ModalContentTheme } from './ui/modal/ModalContentTheme.cjs'; import type { ModalHeaderTheme } from './ui/modal/ModalHeaderTheme.cjs'; import type { ModalBodyTheme } from './ui/modal/ModalBodyTheme.cjs'; import type { ModalFooterTheme } from './ui/modal/ModalFooterTheme.cjs'; import type { ModalCloseButtonTheme } from './ui/modal/ModalCloseButtonTheme.cjs'; import type { PopupTheme } from './ui/popup/PopupTheme.cjs'; import type { IconButtonTheme } from './ui/iconButton/IconButtonTheme.cjs'; import type { IconTheme } from './ui/icon/IconTheme.cjs'; import type { KbdTheme } from './ui/kbd/KbdTheme.cjs'; import type { MarkTheme } from './ui/mark/MarkTheme.cjs'; import type { MenuItemTheme } from './ui/menu/MenuItemTheme.cjs'; import type { MenuLabelTheme } from './ui/menu/MenuLabelTheme.cjs'; import type { NavLinkTheme } from './ui/navLink/NavLinkTheme.cjs'; import type { NavLinkLabelTheme } from './ui/navLink/NavLinkLabelTheme.cjs'; import type { TableTheme } from './ui/table/TableTheme.cjs'; import type { TheadTheme } from './ui/table/TheadTheme.cjs'; import type { TbodyTheme } from './ui/table/TbodyTheme.cjs'; import type { TfootTheme } from './ui/table/TfootTheme.cjs'; import type { TrTheme } from './ui/table/TrTheme.cjs'; import type { ThTheme } from './ui/table/ThTheme.cjs'; import type { TdTheme } from './ui/table/TdTheme.cjs'; import type { CaptionTheme } from './ui/table/CaptionTheme.cjs'; import type { BadgeProps } from "./ui/badge/BadgeProps.cjs"; import type { ButtonProps } from "./ui/button/ButtonProps.cjs"; import type { ButtonSpinnerProps } from "./ui/button/ButtonSpinnerProps.cjs"; import type { CardProps } from "./ui/card/CardProps.cjs"; import type { FieldProps } from "./ui/field/FieldProps.cjs"; import type { AlertProps } from "./ui/alert/AlertProps.cjs"; import type { SpinnerProps } from "./ui/spinner/SpinnerProps.cjs"; import type { CardHeaderProps } from "./ui/card/CardHeaderProps.cjs"; import type { CardBodyProps } from "./ui/card/CardBodyProps.cjs"; import type { CardFooterProps } from "./ui/card/CardFooterProps.cjs"; import type { ChipProps } from "./ui/chip/ChipProps.cjs"; import type { CodeProps } from "./ui/code/CodeProps.cjs"; import type { ColProps } from "./ui/col/index.cjs"; import type { ContainerProps } from "./ui/container/index.cjs"; import type { DividerProps } from "./ui/divider/index.cjs"; import type { GridProps } from "./ui/grid/index.cjs"; import type { ListProps, TypographyProps } from "./ui/typography/index.cjs"; import type { RowProps } from "./ui/row/RowProps.cjs"; import type { SectionProps } from "./ui/section/index.cjs"; import type { StackProps } from "./ui/stack/index.cjs"; import type { CheckboxProps } from "./ui/checkbox/index.cjs"; import type { CheckboxCheckProps } from "./ui/checkbox/CheckboxCheckProps.cjs"; import type { CheckboxIndeterminateProps } from "./ui/checkbox/CheckboxIndeterminateProps.cjs"; import type { LabelProps } from "./ui/label/index.cjs"; import type { ImgProps } from "./ui/img/index.cjs"; import type { InputProps, InputErrorIconProps, InputWrapperProps } from "./ui/input/index.cjs"; import type { TextareaProps } from "./ui/textarea/TextareaProps.cjs"; import type { SelectProps, SelectChevronProps, SelectWrapperProps } from "./ui/select/index.cjs"; import type { SwitchProps, SwitchThumbProps } from "./ui/switch/index.cjs"; import type { RadioProps, RadioDotProps, RadioGroupProps } from "./ui/radio/index.cjs"; import type { OverlayProps } from "./ui/overlay/index.cjs"; import type { ModalProps, ModalHeaderProps, ModalBodyProps, ModalFooterProps } from "./ui/modal/index.cjs"; import type { ModalCloseButtonProps } from "./ui/modal/ModalCloseButtonProps.cjs"; import type { PopupProps } from "./ui/popup/index.cjs"; import type { IconButtonProps } from "./ui/iconButton/IconButtonProps.cjs"; import type { IconProps } from "./ui/icon/IconProps.cjs"; import type { KbdProps } from "./ui/kbd/KbdProps.cjs"; import type { MarkProps } from "./ui/mark/MarkProps.cjs"; import type { MenuItemProps } from "./ui/menu/MenuItemProps.cjs"; import type { MenuLabelProps } from './ui/menu/MenuLabelProps.cjs'; import type { NavLinkProps } from './ui/navLink/NavLinkProps.cjs'; import type { NavLinkLabelProps } from './ui/navLink/NavLinkLabelProps.cjs'; import type { TableProps } from './ui/table/TableProps.cjs'; import type { TheadProps } from './ui/table/TheadProps.cjs'; import type { TbodyProps } from './ui/table/TbodyProps.cjs'; import type { TfootProps } from './ui/table/TfootProps.cjs'; import type { TrProps } from './ui/table/TrProps.cjs'; import type { ThProps } from './ui/table/ThProps.cjs'; import type { TdProps } from './ui/table/TdProps.cjs'; import type { CaptionProps } from './ui/table/CaptionProps.cjs'; import type { DeepPartial } from "./utils/deepPartial.cjs"; import type { ComponentKeys, ComponentCategoryKey } from "./ui/props/keys.cjs"; 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 {};