UNPKG

@kwiz/fluentui

Version:
32 lines 1.25 kB
import { isNullOrUndefined } from "@kwiz/common"; import React from "react"; import { KWIZFluentContext } from "./context-const"; //use context from within controls export function useKWIZFluentContext() { var _a, _b; let ctx = React.useContext(KWIZFluentContext) || {}; //set defaults if (isNullOrUndefined(ctx.inputAppearance)) ctx.inputAppearance = "underline"; if (isNullOrUndefined(ctx.buttonShape)) ctx.buttonShape = "circular"; patchResize(); ctx.isRtl = ctx.isRtl || ((_b = (_a = ctx.strings) === null || _a === void 0 ? void 0 : _a.dir) === null || _b === void 0 ? void 0 : _b.call(_a)) === "rtl"; return ctx; } function patchResize() { if (!window.ResizeObserver["sos-patch"]) { window.ResizeObserver["sos-patch"] = true; const OriginalResizeObserver = window.ResizeObserver; window.ResizeObserver = class ResizeObserver extends OriginalResizeObserver { constructor(callback) { super((entries, observer) => { window.requestAnimationFrame(() => { callback(entries, observer); }); }); } }; } } //# sourceMappingURL=context-internal.js.map