UNPKG

one

Version:

One is a new React Framework that makes Vite serve both native and web.

90 lines (88 loc) 3.02 kB
"use client"; import { useMemo } from "react"; import { useIsomorphicLayoutEffect } from "@vxrn/use-isomorphic-layout-effect"; import { NAVIGATOR_CONFIG } from "../../headless/children.mjs"; import { useNavigation } from "../../router/useNavigation.mjs"; import { STACK_TOOLBAR_CHILD, getStackToolbarImplementation } from "./StackToolbarImplementation.mjs"; import { appendStackToolbarConfig } from "./StackToolbar.shared.mjs"; function appendStackToolbarPropsToOptions(options, props, implementation) { const optionsWithConfig = appendStackToolbarConfig(options, props); return implementation ? implementation.appendPropsToOptions(optionsWithConfig, props) : optionsWithConfig; } function StackToolbarComponent(props) { const navigation = useNavigation(); const implementation = getStackToolbarImplementation(); const options = useMemo(() => appendStackToolbarPropsToOptions({}, props, implementation), [implementation, props.placement, props.asChild, props.children, props.disableImePadding, props.tintColor, props.backgroundColor]); useIsomorphicLayoutEffect(() => { navigation.setOptions(options); }, [navigation, options]); return implementation?.render(props) ?? null; } function StackToolbarButton(_props) { return null; } function StackToolbarMenu(_props) { return null; } function StackToolbarMenuAction(_props) { return null; } function StackToolbarSpacer(_props) { return null; } function StackToolbarSearchBarSlot(_props) { return null; } function StackToolbarView(_props) { return null; } function StackToolbarLabel(_props) { return null; } function StackToolbarIcon(_props) { return null; } function StackToolbarBadge(_props) { return null; } Object.assign(StackToolbarButton, { [STACK_TOOLBAR_CHILD]: "button" }); Object.assign(StackToolbarMenu, { [STACK_TOOLBAR_CHILD]: "menu" }); Object.assign(StackToolbarMenuAction, { [STACK_TOOLBAR_CHILD]: "menuAction" }); Object.assign(StackToolbarSpacer, { [STACK_TOOLBAR_CHILD]: "spacer" }); Object.assign(StackToolbarSearchBarSlot, { [STACK_TOOLBAR_CHILD]: "searchBarSlot" }); Object.assign(StackToolbarView, { [STACK_TOOLBAR_CHILD]: "view" }); Object.assign(StackToolbarLabel, { [STACK_TOOLBAR_CHILD]: "label" }); Object.assign(StackToolbarIcon, { [STACK_TOOLBAR_CHILD]: "icon" }); Object.assign(StackToolbarBadge, { [STACK_TOOLBAR_CHILD]: "badge" }); const StackToolbar = Object.assign(StackToolbarComponent, { [NAVIGATOR_CONFIG]: true, Button: StackToolbarButton, Menu: StackToolbarMenu, MenuAction: StackToolbarMenuAction, Spacer: StackToolbarSpacer, SearchBarSlot: StackToolbarSearchBarSlot, View: StackToolbarView, Label: StackToolbarLabel, Icon: StackToolbarIcon, Badge: StackToolbarBadge }); export { StackToolbar, StackToolbarBadge, StackToolbarButton, StackToolbarIcon, StackToolbarLabel, StackToolbarMenu, StackToolbarMenuAction, StackToolbarSearchBarSlot, StackToolbarSpacer, StackToolbarView, appendStackToolbarPropsToOptions }; //# sourceMappingURL=StackToolbar.mjs.map