@broxus/react-uikit 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/ConfigProvider/index.d.ts +3 -3
- package/dist/cjs/components/ConfigProvider/index.js +7 -6
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/components/ConfigProvider/index.d.ts +3 -3
- package/dist/esm/components/ConfigProvider/index.js +7 -5
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +4 -3
|
@@ -9,8 +9,8 @@ export type ConfigContextConsumerProps = {
|
|
|
9
9
|
direction?: string;
|
|
10
10
|
getPopupContainer?: (triggerNode?: HTMLElement) => HTMLElement;
|
|
11
11
|
getRootPrefixCls: (prefix?: string, component?: string) => string;
|
|
12
|
-
getTooltipConfig: (props: string | TooltipOptions) => {
|
|
13
|
-
'data-uk-tooltip'
|
|
12
|
+
getTooltipConfig: (props: string | TooltipOptions | undefined) => {
|
|
13
|
+
'data-uk-tooltip'?: string;
|
|
14
14
|
};
|
|
15
15
|
inverseGlobalColorMode?: ColorMode;
|
|
16
16
|
prefixCls: string;
|
|
@@ -24,4 +24,4 @@ export type ConfigContextConsumerProps = {
|
|
|
24
24
|
export type ConfigContextProviderProps = React.PropsWithChildren<ConfigContextConsumerProps>;
|
|
25
25
|
export declare const ConfigContext: React.Context<ConfigContextConsumerProps>;
|
|
26
26
|
export declare function useConfig(): ConfigContextConsumerProps;
|
|
27
|
-
export declare
|
|
27
|
+
export declare const ConfigContextProvider: React.MemoExoticComponent<(props: Partial<ConfigContextProviderProps>) => React.JSX.Element>;
|
|
@@ -26,7 +26,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.ConfigContextProvider = exports.useConfig = exports.ConfigContext = void 0;
|
|
27
27
|
const js_utils_1 = require("@broxus/js-utils");
|
|
28
28
|
const React = __importStar(require("react"));
|
|
29
|
-
const hooks_1 = require("../../hooks");
|
|
30
29
|
exports.ConfigContext = React.createContext({
|
|
31
30
|
breakpoints: {
|
|
32
31
|
l: 1200,
|
|
@@ -42,6 +41,9 @@ exports.ConfigContext = React.createContext({
|
|
|
42
41
|
return `${prefix ? `${prefix}-` : `${this.prefixCls}-`}${module ?? ''}`;
|
|
43
42
|
},
|
|
44
43
|
getTooltipConfig(props) {
|
|
44
|
+
if (props == null) {
|
|
45
|
+
return {};
|
|
46
|
+
}
|
|
45
47
|
if (typeof props === 'string') {
|
|
46
48
|
return { 'data-uk-tooltip': `title: ${props}` };
|
|
47
49
|
}
|
|
@@ -67,11 +69,11 @@ exports.ConfigContext = React.createContext({
|
|
|
67
69
|
// tileTertiaryColorMode: 'light',
|
|
68
70
|
});
|
|
69
71
|
function useConfig() {
|
|
70
|
-
return
|
|
72
|
+
return React.useContext(exports.ConfigContext);
|
|
71
73
|
}
|
|
72
74
|
exports.useConfig = useConfig;
|
|
73
|
-
|
|
74
|
-
const initialContext =
|
|
75
|
+
exports.ConfigContextProvider = React.memo((props) => {
|
|
76
|
+
const initialContext = useConfig();
|
|
75
77
|
const { children, ...restProps } = props;
|
|
76
78
|
const context = React.useMemo(() => {
|
|
77
79
|
let direction = 'ltr';
|
|
@@ -84,8 +86,7 @@ function ConfigContextProvider(props) {
|
|
|
84
86
|
return { ...initialContext, direction, ...restProps };
|
|
85
87
|
}, [initialContext, restProps]);
|
|
86
88
|
return React.createElement(exports.ConfigContext.Provider, { value: context }, children);
|
|
87
|
-
}
|
|
88
|
-
exports.ConfigContextProvider = ConfigContextProvider;
|
|
89
|
+
});
|
|
89
90
|
if (process.env.NODE_ENV !== 'production') {
|
|
90
91
|
exports.ConfigContext.displayName = 'ConfigContext';
|
|
91
92
|
}
|