import { isValidElement, Children } from 'react';
import { SettingsPageHeader, } from '../../components/SettingsPageHeader';
import { SettingsPageContent, } from '../../components/SettingsPageContent';
export function useSettingsPageChild(children, scrollableRef) {
    // Mapping to raw WDS components since original Page filtering none expected components: https://github.com/wix-private/wix-design-systems/blob/master/packages/wix-style-react/src/Page/Page.js#L626
    return Children.toArray(children)
        .map((child) => {
        if (isValidElement(child)) {
            switch (child.type) {
                case SettingsPageHeader:
                    const header = child;
                    return header.type.useSettingsPageHeader(header);
                case SettingsPageContent:
                    const content = child;
                    return content.type.useSettingsPageContent(content, scrollableRef);
                default:
                    // TODO: Check whenever we should filter out or not other Page components
                    return null;
            }
        }
        return null;
    })
        .filter((c) => c);
}
//# sourceMappingURL=useSettingsPageChild.js.map