zent
Version:
一套前端设计语言和基于React的实现
15 lines (14 loc) • 562 B
JavaScript
import { __assign } from "tslib";
import { jsx as _jsx } from "react/jsx-runtime";
import { createContext, useMemo } from 'react';
export var DisabledContext = createContext({
value: false,
});
DisabledContext.displayName = 'DisabledContext';
export var Disabled = function (_a) {
var _b = _a.value, value = _b === void 0 ? true : _b, children = _a.children;
var ctx = useMemo(function () { return ({
value: value,
}); }, [value]);
return (_jsx(DisabledContext.Provider, __assign({ value: ctx }, { children: children }), void 0));
};