@kwiz/fluentui
Version:
KWIZ common controls for FluentUI
19 lines • 1.53 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Field, ProgressBar } from '@fluentui/react-components';
import { isFunction } from '@kwiz/common';
import { useKWIZFluentContext } from '../helpers/context-internal';
import { Prompter } from './prompt';
export const PleaseWait = (props) => {
var _a, _b;
const ctx = useKWIZFluentContext();
//add a hidden input to capture focus, otherwise dialog will show a warning
const field = _jsxs(Field, { validationMessage: props.label || ((_b = (_a = ctx.strings) === null || _a === void 0 ? void 0 : _a.prompt_wait) === null || _b === void 0 ? void 0 : _b.call(_a, { cap: true })) || "please wait...", validationState: "none", children: [_jsx(ProgressBar, { value: props.step, max: props.max }), _jsx("input", { type: "button", style: { position: "fixed", left: `-200vw` } })] });
return (props.contentOnly
? field
: _jsx(Prompter, { hideOk: true, hideCancel: !isFunction(props.onCancel), cancelButtonText: props.cancelText || 'cancel', onCancel: props.onCancel, children: field }));
};
export const PleaseWaitPrompt = (props) => ({
hideOk: true, hideCancel: true,
children: _jsx(Field, { validationMessage: (props === null || props === void 0 ? void 0 : props.message) || "please wait...", validationState: "none", children: _jsx(ProgressBar, { value: props === null || props === void 0 ? void 0 : props.step, max: props === null || props === void 0 ? void 0 : props.max }) })
});
//# sourceMappingURL=please-wait.js.map