UNPKG

fannypack-v5

Version:

An accessible, composable, and friendly React UI Kit

42 lines (35 loc) 1.36 kB
import 'react'; import '../Provider/ThemeContext.js'; import 'classnames'; import 'emotion'; import '@emotion/core'; import 'emotion-theming'; import '@emotion/styled'; import './useTheme.js'; import { _ as _objectSpread2 } from '../chunk-0c448560.js'; import './get.js'; import { omit } from './omit.js'; import './useLocalStorage.js'; import '../Provider/ColorModeContext.js'; import './useColorMode.js'; import './omitBy.js'; import { useDefaultProps } from './useDefaultProps.js'; function createHook(useHook, config) { return function (props, _temp) { var _ref = _temp === void 0 ? {} : _temp, _ref$themeKey = _ref.themeKey, themeKeyOverride = _ref$themeKey === void 0 ? undefined : _ref$themeKey; // @ts-ignore var themeKey = themeKeyOverride || (props === null || props === void 0 ? void 0 : props.themeKey) || (config === null || config === void 0 ? void 0 : config.themeKey); var _useDefaultProps = useDefaultProps(props, _objectSpread2(_objectSpread2({}, config), {}, { themeKey: themeKey })), newProps = _useDefaultProps.props, newThemeKey = _useDefaultProps.themeKey; // @ts-ignore return useHook(omit(newProps, 'themeKey'), { themeKey: config === null || config === void 0 ? void 0 : config.themeKey, themeKeyOverride: newThemeKey }); }; } export { createHook };