@workday/canvas-kit-react
Version:
The parent module that contains all Workday Canvas Kit React components
16 lines (15 loc) • 935 B
JavaScript
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 (React.createElement(GoToContext.Provider, { value: goToContext },
React.createElement(Flex, { ref: ref, as: Element, alignItems: "center", gap: "xxs", paddingLeft: shouldUseRTL ? 'xxs' : undefined, paddingRight: shouldUseRTL ? 'xxs' : undefined, ...formProps, ...elemProps }, children)));
},
});