@intility/bifrost-react
Version:
React library for Intility's design system, Bifrost.
50 lines (49 loc) • 1.05 kB
JavaScript
"use client";
import { c as _c } from "react-compiler-runtime";
import enUS from "../../locales/en-us.js";
import { BifrostContext } from "./BifrostContext.js";
import { jsx as _jsx } from "react/jsx-runtime";
/**
* Configure Bifrost locale globally by wrapping this component around your app
*
* @see https://bifrost.intility.com/react/bifrost
*
* @example
* import nbNO from "@intility/bifrost-react/locales/nb-no";
*
* <Bifrost locale={nbNO}>
* Your norwegian app here
* </Bifrost>
*/
const Bifrost = t0 => {
const $ = _c(5);
const {
children,
locale: t1
} = t0;
const locale = t1 === undefined ? enUS : t1;
let t2;
if ($[0] !== locale) {
t2 = {
locale
};
$[0] = locale;
$[1] = t2;
} else {
t2 = $[1];
}
let t3;
if ($[2] !== children || $[3] !== t2) {
t3 = /*#__PURE__*/_jsx(BifrostContext.Provider, {
value: t2,
children: children
});
$[2] = children;
$[3] = t2;
$[4] = t3;
} else {
t3 = $[4];
}
return t3;
};
export default Bifrost;