UNPKG

@workday/canvas-kit-react

Version:

The parent module that contains all Workday Canvas Kit React components

16 lines (15 loc) 962 B
import { jsx as _jsx } from "react/jsx-runtime"; import * as React from 'react'; import { createComponent, useIsRTL } from '@workday/canvas-kit-react/common'; import { Flex } from '@workday/canvas-kit-react/layout'; import { PaginationContext } from '../usePaginationModel'; import { GoToContext, useGoToForm } from './useGoToForm'; export const GoToForm = createComponent('form')({ Component({ children, onSubmit, ...elemProps }, ref, Element) { const model = React.useContext(PaginationContext); const goToContext = useGoToForm({ model, onSubmit }); const { formProps } = goToContext; const shouldUseRTL = useIsRTL(); return (_jsx(GoToContext.Provider, { value: goToContext, children: _jsx(Flex, { ref: ref, as: Element, alignItems: "center", gap: "xxs", paddingLeft: shouldUseRTL ? 'xxs' : undefined, paddingRight: shouldUseRTL ? 'xxs' : undefined, ...formProps, ...elemProps, children: children }) })); }, });