UNPKG

@base-ui-components/react

Version:

Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.

40 lines (38 loc) 1.54 kB
'use client'; import * as React from 'react'; import PropTypes from 'prop-types'; import { DirectionContext } from './DirectionContext.js'; /** * Enables RTL behavior for Base UI components. * * Documentation: [Base UI Direction Provider](https://base-ui.com/react/utils/direction-provider) */ import { jsx as _jsx } from "react/jsx-runtime"; const DirectionProvider = function DirectionProvider(props) { const { direction = 'ltr' } = props; const contextValue = React.useMemo(() => ({ direction }), [direction]); return /*#__PURE__*/_jsx(DirectionContext.Provider, { value: contextValue, children: props.children }); }; export { DirectionProvider }; process.env.NODE_ENV !== "production" ? DirectionProvider.propTypes /* remove-proptypes */ = { // ┌────────────────────────────── Warning ──────────────────────────────┐ // │ These PropTypes are generated from the TypeScript type definitions. │ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │ // └─────────────────────────────────────────────────────────────────────┘ /** * @ignore */ children: PropTypes.node, /** * The reading direction of the text * @default 'ltr' */ direction: PropTypes.oneOf(['ltr', 'rtl']) } : void 0;