// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import React from 'react';
import { makeStyles, shorthands, FluentProvider, mergeClasses } from '@fluentui/react-components';
import { createV9Theme } from './v9ThemeShim';
import { TextDirectionProvider } from '@griffel/react';
/**
 * @private
 */
export const useFluentV9Wrapper = makeStyles({
    body: Object.assign(Object.assign(Object.assign(Object.assign({ height: '100%' }, shorthands.margin(0)), shorthands.overflow('hidden')), shorthands.padding(0)), { width: '100%' })
});
/**
 * @private
 */
export const FluentV9ThemeProvider = (props) => {
    const { v8Theme, children, className } = props;
    const v9Theme = createV9Theme(v8Theme);
    const dir = v8Theme.rtl ? 'rtl' : 'ltr';
    return (
    // TextDirectionProvider is needed to fix issue with direction value update in FluentProvider
    React.createElement(TextDirectionProvider, { dir: dir },
        React.createElement(FluentProviderWithStylesOverrides, { theme: v9Theme, dir: dir, className: className }, children)));
};
const FluentProviderWithStylesOverrides = props => {
    const classes = useFluentV9Wrapper();
    return React.createElement(FluentProvider, Object.assign({}, props, { className: mergeClasses(props.className, classes.body), applyStylesToPortals: false }));
};
//# sourceMappingURL=FluentV9ThemeProvider.js.map