@stihl-design-system/components
Version:
Welcome to the STIHL Design System react component library.
25 lines (24 loc) • 1.27 kB
TypeScript
import { default as React } from 'react';
import { ActionCardProps, ActionCardSlotProps } from './ActionCard';
export type ActionCardAriaAttributes = 'aria-label' | 'aria-labelledby';
type ValidationProps = Pick<ActionCardProps, 'aria'> & {
cardElement: HTMLElement | null;
};
export declare const validateActionCardProps: ({ aria, cardElement, }: ValidationProps) => void;
/**
* Filters a React children collection and returns only elements of a given slot type.
*
* Why needed: In production builds, `component.type` identity can differ due to
* bundling/minification. To stay robust, we match either by strict identity or by
* `displayName`/`name` so slot detection works reliably.
*
* Notes:
* - Only valid React elements are considered; primitives (strings, numbers, etc.) are ignored.
* - Returns a new array of React elements; original children are not mutated.
*
* @param sourceChildren React node(s) to search within (usually `children`).
* @param target The slot component to match (e.g., `Header`, `Footer`).
* @returns An array of matching React elements of the desired slot type.
*/
export declare const getChildrenOfType: (sourceChildren: React.ReactNode, target: React.ComponentType<ActionCardSlotProps>) => React.ReactElement[];
export {};