@appbuckets/react-ui-smart-components
Version:
UI Extended Components that work with @appbuckets/react-client and @appbuckets/react-ui
58 lines (51 loc) • 1.58 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var _tslib = require('../_virtual/_tslib.js');
var React = require('react');
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(
n,
k,
d.get
? d
: {
enumerable: true,
get: function () {
return e[k];
},
}
);
}
});
}
n['default'] = e;
return Object.freeze(n);
}
var React__namespace = /*#__PURE__*/ _interopNamespace(React);
/** Create the base context */
var SmartComponentsContext = React__namespace.createContext(undefined);
/** Create the Hook */
var useSmartComponents = function () {
return React__namespace.useContext(SmartComponentsContext);
};
/** Export a Context Provider Shorthand */
var SmartComponentsProvider = function (props) {
/** Keep Props for Building Context Provider */
var children = props.children,
smartComponentProps = _tslib.__rest(props, ['children']);
/** Return the Provider */
return React__namespace.createElement(
SmartComponentsContext.Provider,
{ value: smartComponentProps },
children
);
};
SmartComponentsProvider.displayName = 'SmartComponentsProvider';
exports.SmartComponentsProvider = SmartComponentsProvider;
exports.useSmartComponents = useSmartComponents;