@rescui/ui-contexts 0.1.0 → 0.2.0
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/lib/index.d.ts +5 -5
- package/lib/index.js +4 -5
- package/lib/layering-provider.d.ts +13 -13
- package/lib/layering-provider.js +11 -12
- package/lib/parts/layering-context.d.ts +24 -24
- package/lib/parts/layering-context.js +68 -48
- package/lib/parts/theme-context.d.ts +13 -13
- package/lib/parts/theme-context.js +32 -15
- package/lib/theme-provider.d.ts +4 -4
- package/lib/theme-provider.js +5 -6
- package/package.json +4 -4
- package/CHANGELOG.md +0 -35
- package/lib/index.js.map +0 -1
- package/lib/layering-provider.js.map +0 -1
- package/lib/parts/layering-context.js.map +0 -1
- package/lib/parts/theme-context.js.map +0 -1
- package/lib/theme-provider.js.map +0 -1
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { LayeringConsumer, withLayering, useLayeringContext } from './parts/layering-context';
|
|
2
|
-
export { default as LayeringProvider } from './layering-provider';
|
|
3
|
-
export { ThemeConsumer, withTheme, useTheme, getInverseTheme } from './parts/theme-context';
|
|
4
|
-
export { default as ThemeProvider } from './theme-provider';
|
|
5
|
-
export type { Theme } from './parts/theme-context';
|
|
1
|
+
export { LayeringConsumer, withLayering, useLayeringContext } from './parts/layering-context';
|
|
2
|
+
export { default as LayeringProvider } from './layering-provider';
|
|
3
|
+
export { ThemeConsumer, withTheme, useTheme, getInverseTheme } from './parts/theme-context';
|
|
4
|
+
export { default as ThemeProvider } from './theme-provider';
|
|
5
|
+
export type { Theme } from './parts/theme-context';
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export { LayeringConsumer,
|
|
2
|
-
export { default as LayeringProvider } from './layering-provider';
|
|
3
|
-
export { ThemeConsumer,
|
|
4
|
-
export { default as ThemeProvider } from './theme-provider';
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { LayeringConsumer, useLayeringContext, withLayering } from './parts/layering-context.js';
|
|
2
|
+
export { default as LayeringProvider } from './layering-provider.js';
|
|
3
|
+
export { ThemeConsumer, getInverseTheme, useTheme, withTheme } from './parts/theme-context.js';
|
|
4
|
+
export { default as ThemeProvider } from './theme-provider.js';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
declare type Layer = 'default' | 'popup' | 'dropdown' | 'tooltip';
|
|
4
|
-
declare function LayeringProvider({ baseLayer, children }: PropsWithChildren<{
|
|
5
|
-
baseLayer?: Exclude<Layer, 'default'>;
|
|
6
|
-
}>): JSX.Element;
|
|
7
|
-
declare namespace LayeringProvider {
|
|
8
|
-
var propTypes: {
|
|
9
|
-
baseLayer: PropTypes.Requireable<string>;
|
|
10
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
export default LayeringProvider;
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
declare type Layer = 'default' | 'popup' | 'dropdown' | 'tooltip';
|
|
4
|
+
declare function LayeringProvider({ baseLayer, children }: PropsWithChildren<{
|
|
5
|
+
baseLayer?: Exclude<Layer, 'default'>;
|
|
6
|
+
}>): JSX.Element;
|
|
7
|
+
declare namespace LayeringProvider {
|
|
8
|
+
var propTypes: {
|
|
9
|
+
baseLayer: PropTypes.Requireable<string>;
|
|
10
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export default LayeringProvider;
|
package/lib/layering-provider.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
3
|
+
import { useLayeringContext, LayeringContextValue, LayeringContext } from './parts/layering-context.js';
|
|
4
4
|
|
|
5
|
-
function LayeringProvider(
|
|
6
|
-
var baseLayer =
|
|
7
|
-
children =
|
|
5
|
+
function LayeringProvider(_ref) {
|
|
6
|
+
var baseLayer = _ref.baseLayer,
|
|
7
|
+
children = _ref.children;
|
|
8
8
|
|
|
9
|
-
var
|
|
10
|
-
popupZIndex =
|
|
11
|
-
dropdownZIndex =
|
|
12
|
-
tooltipZIndex =
|
|
13
|
-
baseZIndex =
|
|
14
|
-
isInPortal =
|
|
9
|
+
var _useLayeringContext = useLayeringContext(),
|
|
10
|
+
popupZIndex = _useLayeringContext.popupZIndex,
|
|
11
|
+
dropdownZIndex = _useLayeringContext.dropdownZIndex,
|
|
12
|
+
tooltipZIndex = _useLayeringContext.tooltipZIndex,
|
|
13
|
+
baseZIndex = _useLayeringContext.baseZIndex,
|
|
14
|
+
isInPortal = _useLayeringContext.isInPortal;
|
|
15
15
|
|
|
16
16
|
var contextValue = useMemo(function () {
|
|
17
17
|
switch (baseLayer) {
|
|
@@ -28,7 +28,7 @@ function LayeringProvider(_a) {
|
|
|
28
28
|
return new LayeringContextValue(baseZIndex, isInPortal);
|
|
29
29
|
}
|
|
30
30
|
}, [baseLayer, baseZIndex, dropdownZIndex, isInPortal, popupZIndex, tooltipZIndex]);
|
|
31
|
-
return React.createElement(LayeringContext.Provider, {
|
|
31
|
+
return /*#__PURE__*/React.createElement(LayeringContext.Provider, {
|
|
32
32
|
value: contextValue
|
|
33
33
|
}, children);
|
|
34
34
|
}
|
|
@@ -38,4 +38,3 @@ LayeringProvider.propTypes = {
|
|
|
38
38
|
children: PropTypes.node
|
|
39
39
|
};
|
|
40
40
|
export default LayeringProvider;
|
|
41
|
-
//# sourceMappingURL=layering-provider.js.map
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface LayeringInfo {
|
|
3
|
-
baseZIndex: number;
|
|
4
|
-
isInPortal: boolean;
|
|
5
|
-
popupZIndex: number;
|
|
6
|
-
dropdownZIndex: number;
|
|
7
|
-
tooltipZIndex: number;
|
|
8
|
-
}
|
|
9
|
-
export declare class LayeringContextValue implements LayeringInfo {
|
|
10
|
-
readonly baseZIndex: number;
|
|
11
|
-
readonly isInPortal: boolean;
|
|
12
|
-
readonly popupZIndex: number;
|
|
13
|
-
readonly dropdownZIndex: number;
|
|
14
|
-
readonly tooltipZIndex: number;
|
|
15
|
-
constructor(baseZIndex: number, isInPortal?: boolean);
|
|
16
|
-
}
|
|
17
|
-
export declare const LayeringContext: React.Context<LayeringContextValue>;
|
|
18
|
-
export declare const LayeringConsumer: React.Consumer<LayeringContextValue>;
|
|
19
|
-
export declare const useLayeringContext: () => LayeringContextValue;
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated use `useLayeringContext` hook instead
|
|
22
|
-
* */
|
|
23
|
-
export declare const withLayering: <P extends Partial<LayeringInfo>>(WrappedComponent: React.ComponentType<P>) => React.ComponentType<P>;
|
|
24
|
-
export {};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface LayeringInfo {
|
|
3
|
+
baseZIndex: number;
|
|
4
|
+
isInPortal: boolean;
|
|
5
|
+
popupZIndex: number;
|
|
6
|
+
dropdownZIndex: number;
|
|
7
|
+
tooltipZIndex: number;
|
|
8
|
+
}
|
|
9
|
+
export declare class LayeringContextValue implements LayeringInfo {
|
|
10
|
+
readonly baseZIndex: number;
|
|
11
|
+
readonly isInPortal: boolean;
|
|
12
|
+
readonly popupZIndex: number;
|
|
13
|
+
readonly dropdownZIndex: number;
|
|
14
|
+
readonly tooltipZIndex: number;
|
|
15
|
+
constructor(baseZIndex: number, isInPortal?: boolean);
|
|
16
|
+
}
|
|
17
|
+
export declare const LayeringContext: React.Context<LayeringContextValue>;
|
|
18
|
+
export declare const LayeringConsumer: React.Consumer<LayeringContextValue>;
|
|
19
|
+
export declare const useLayeringContext: () => LayeringContextValue;
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated use `useLayeringContext` hook instead
|
|
22
|
+
* */
|
|
23
|
+
export declare const withLayering: <P extends Partial<LayeringInfo>>(WrappedComponent: React.ComponentType<P>) => React.ComponentType<P>;
|
|
24
|
+
export {};
|
|
@@ -1,65 +1,85 @@
|
|
|
1
|
+
import "core-js/modules/web.dom-collections.for-each.js";
|
|
2
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
3
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
4
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
5
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
|
6
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
|
7
|
+
import _classCallCheck from "@babel/runtime-corejs3/helpers/esm/classCallCheck";
|
|
8
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
1
9
|
import "core-js/modules/es.function.name.js";
|
|
2
|
-
|
|
10
|
+
|
|
11
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) { symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
12
|
+
|
|
13
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { Object.defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
14
|
+
|
|
3
15
|
import React, { createContext, useContext } from 'react';
|
|
4
16
|
var LAYER_STEP = 500;
|
|
5
17
|
|
|
6
|
-
var LayeringContextValue =
|
|
7
|
-
|
|
8
|
-
function () {
|
|
9
|
-
function LayeringContextValue(baseZIndex, isInPortal) {
|
|
10
|
-
var _this = this;
|
|
18
|
+
var LayeringContextValue = function LayeringContextValue(baseZIndex, isInPortal) {
|
|
19
|
+
var _this = this;
|
|
11
20
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
value: baseZIndex
|
|
16
|
-
});
|
|
17
|
-
Object.defineProperty(this, 'isInPortal', {
|
|
18
|
-
writable: false,
|
|
19
|
-
enumerable: true,
|
|
20
|
-
value: Boolean(isInPortal)
|
|
21
|
-
});
|
|
22
|
-
Object.defineProperty(this, 'popupZIndex', {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: function get() {
|
|
25
|
-
return _this.baseZIndex + 3 * LAYER_STEP;
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
Object.defineProperty(this, 'dropdownZIndex', {
|
|
29
|
-
enumerable: true,
|
|
30
|
-
get: function get() {
|
|
31
|
-
return _this.baseZIndex + 2 * LAYER_STEP;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
Object.defineProperty(this, 'tooltipZIndex', {
|
|
35
|
-
enumerable: true,
|
|
36
|
-
get: function get() {
|
|
37
|
-
return _this.baseZIndex + LAYER_STEP;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
21
|
+
_classCallCheck(this, LayeringContextValue);
|
|
22
|
+
|
|
23
|
+
_defineProperty(this, "baseZIndex", void 0);
|
|
41
24
|
|
|
42
|
-
|
|
43
|
-
}();
|
|
25
|
+
_defineProperty(this, "isInPortal", void 0);
|
|
44
26
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
27
|
+
_defineProperty(this, "popupZIndex", void 0);
|
|
28
|
+
|
|
29
|
+
_defineProperty(this, "dropdownZIndex", void 0);
|
|
30
|
+
|
|
31
|
+
_defineProperty(this, "tooltipZIndex", void 0);
|
|
32
|
+
|
|
33
|
+
Object.defineProperty(this, 'baseZIndex', {
|
|
34
|
+
writable: false,
|
|
35
|
+
enumerable: true,
|
|
36
|
+
value: baseZIndex
|
|
37
|
+
});
|
|
38
|
+
Object.defineProperty(this, 'isInPortal', {
|
|
39
|
+
writable: false,
|
|
40
|
+
enumerable: true,
|
|
41
|
+
value: Boolean(isInPortal)
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(this, 'popupZIndex', {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function get() {
|
|
46
|
+
return _this.baseZIndex + 3 * LAYER_STEP;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(this, 'dropdownZIndex', {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function get() {
|
|
52
|
+
return _this.baseZIndex + 2 * LAYER_STEP;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(this, 'tooltipZIndex', {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function get() {
|
|
58
|
+
return _this.baseZIndex + LAYER_STEP;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
var LayeringContext = /*#__PURE__*/createContext(new LayeringContextValue(0));
|
|
64
|
+
var LayeringConsumer = LayeringContext.Consumer;
|
|
65
|
+
|
|
66
|
+
var useLayeringContext = function useLayeringContext() {
|
|
49
67
|
return useContext(LayeringContext);
|
|
50
68
|
};
|
|
51
|
-
/**
|
|
52
|
-
* @deprecated use `useLayeringContext` hook instead
|
|
69
|
+
/**
|
|
70
|
+
* @deprecated use `useLayeringContext` hook instead
|
|
53
71
|
* */
|
|
54
72
|
|
|
55
|
-
|
|
73
|
+
|
|
74
|
+
var withLayering = function withLayering(WrappedComponent) {
|
|
56
75
|
var component = function component(props) {
|
|
57
|
-
return React.createElement(LayeringContext.Consumer, null, function (layering) {
|
|
58
|
-
return React.createElement(WrappedComponent,
|
|
76
|
+
return /*#__PURE__*/React.createElement(LayeringContext.Consumer, null, function (layering) {
|
|
77
|
+
return /*#__PURE__*/React.createElement(WrappedComponent, _objectSpread(_objectSpread({}, layering), props));
|
|
59
78
|
});
|
|
60
79
|
};
|
|
61
80
|
|
|
62
|
-
component.displayName = "WithLayering("
|
|
81
|
+
component.displayName = "WithLayering(".concat(WrappedComponent.displayName || WrappedComponent.name, ")");
|
|
63
82
|
return component;
|
|
64
83
|
};
|
|
65
|
-
|
|
84
|
+
|
|
85
|
+
export { LayeringConsumer, LayeringContext, LayeringContextValue, useLayeringContext, withLayering };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import React, { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react';
|
|
2
|
-
export declare type Theme = 'light' | 'dark';
|
|
3
|
-
export declare const ThemeContext: React.Context<Theme>;
|
|
4
|
-
export declare const ThemeConsumer: React.Consumer<Theme>;
|
|
5
|
-
export declare const getInverseTheme: (theme: Theme) => Theme;
|
|
6
|
-
export declare const useTheme: (overwriteValue?: Theme) => Theme;
|
|
7
|
-
export interface ThemeProps {
|
|
8
|
-
theme?: Theme;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated use `useTheme` hook instead
|
|
12
|
-
* */
|
|
13
|
-
export declare const withTheme: <P extends ThemeProps = ThemeProps>(wrappedComponent: React.ComponentType<P>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<unknown>>;
|
|
1
|
+
import React, { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react';
|
|
2
|
+
export declare type Theme = 'light' | 'dark';
|
|
3
|
+
export declare const ThemeContext: React.Context<Theme>;
|
|
4
|
+
export declare const ThemeConsumer: React.Consumer<Theme>;
|
|
5
|
+
export declare const getInverseTheme: (theme: Theme) => Theme;
|
|
6
|
+
export declare const useTheme: (overwriteValue?: Theme) => Theme;
|
|
7
|
+
export interface ThemeProps {
|
|
8
|
+
theme?: Theme;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated use `useTheme` hook instead
|
|
12
|
+
* */
|
|
13
|
+
export declare const withTheme: <P extends ThemeProps = ThemeProps>(wrappedComponent: React.ComponentType<P>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<unknown>>;
|
|
@@ -1,33 +1,50 @@
|
|
|
1
|
+
import "core-js/modules/web.dom-collections.for-each.js";
|
|
2
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
3
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
4
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
5
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
|
6
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
|
7
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
8
|
+
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
|
9
|
+
var _excluded = ["theme"];
|
|
1
10
|
import "core-js/modules/es.function.name.js";
|
|
2
|
-
|
|
11
|
+
|
|
12
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) { symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
13
|
+
|
|
14
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { Object.defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
15
|
+
|
|
3
16
|
import React, { createContext, useContext } from 'react';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
17
|
+
var ThemeContext = /*#__PURE__*/createContext('light');
|
|
18
|
+
var ThemeConsumer = ThemeContext.Consumer;
|
|
19
|
+
|
|
20
|
+
var getInverseTheme = function getInverseTheme(theme) {
|
|
7
21
|
return theme === 'light' ? 'dark' : 'light';
|
|
8
22
|
};
|
|
9
|
-
|
|
23
|
+
|
|
24
|
+
var useTheme = function useTheme(overwriteValue) {
|
|
10
25
|
var themeFromContext = useContext(ThemeContext);
|
|
11
26
|
return overwriteValue || themeFromContext;
|
|
12
27
|
};
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated use `useTheme` hook instead
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated use `useTheme` hook instead
|
|
15
30
|
* */
|
|
16
31
|
|
|
17
|
-
|
|
32
|
+
|
|
33
|
+
var withTheme = function withTheme(wrappedComponent) {
|
|
18
34
|
var WrappedComponent = wrappedComponent;
|
|
19
|
-
var ComponentWithTheme = React.forwardRef(function (
|
|
20
|
-
var theme =
|
|
21
|
-
restProps =
|
|
35
|
+
var ComponentWithTheme = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
36
|
+
var theme = _ref.theme,
|
|
37
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
22
38
|
|
|
23
|
-
return React.createElement(ThemeConsumer, null, function (themeFromContext) {
|
|
24
|
-
return React.createElement(WrappedComponent,
|
|
39
|
+
return /*#__PURE__*/React.createElement(ThemeConsumer, null, function (themeFromContext) {
|
|
40
|
+
return /*#__PURE__*/React.createElement(WrappedComponent, _objectSpread({
|
|
25
41
|
ref: ref,
|
|
26
42
|
theme: theme || themeFromContext
|
|
27
43
|
}, restProps));
|
|
28
44
|
});
|
|
29
45
|
});
|
|
30
|
-
ComponentWithTheme.displayName = "WithTheme("
|
|
46
|
+
ComponentWithTheme.displayName = "WithTheme(".concat(WrappedComponent.displayName || WrappedComponent.name, ")");
|
|
31
47
|
return ComponentWithTheme;
|
|
32
48
|
};
|
|
33
|
-
|
|
49
|
+
|
|
50
|
+
export { ThemeConsumer, ThemeContext, getInverseTheme, useTheme, withTheme };
|
package/lib/theme-provider.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { PropsWithChildren } from 'react';
|
|
2
|
-
import { ThemeProps } from './parts/theme-context';
|
|
3
|
-
declare const ThemeProvider: React.FC<PropsWithChildren<ThemeProps>>;
|
|
4
|
-
export default ThemeProvider;
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
import { ThemeProps } from './parts/theme-context';
|
|
3
|
+
declare const ThemeProvider: React.FC<PropsWithChildren<ThemeProps>>;
|
|
4
|
+
export default ThemeProvider;
|
package/lib/theme-provider.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { ThemeContext } from './parts/theme-context';
|
|
3
|
+
import { ThemeContext } from './parts/theme-context.js';
|
|
4
4
|
|
|
5
|
-
var ThemeProvider = function ThemeProvider(
|
|
6
|
-
var theme =
|
|
7
|
-
children =
|
|
8
|
-
return React.createElement(ThemeContext.Provider, {
|
|
5
|
+
var ThemeProvider = function ThemeProvider(_ref) {
|
|
6
|
+
var theme = _ref.theme,
|
|
7
|
+
children = _ref.children;
|
|
8
|
+
return /*#__PURE__*/React.createElement(ThemeContext.Provider, {
|
|
9
9
|
value: theme
|
|
10
10
|
}, children);
|
|
11
11
|
};
|
|
@@ -14,4 +14,3 @@ ThemeProvider.propTypes = {
|
|
|
14
14
|
theme: PropTypes.oneOf(['light', 'dark'])
|
|
15
15
|
};
|
|
16
16
|
export default ThemeProvider;
|
|
17
|
-
//# sourceMappingURL=theme-provider.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rescui/ui-contexts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "JetBrains",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@babel/runtime-corejs3": "^7.
|
|
19
|
+
"@babel/runtime-corejs3": "^7.14.0",
|
|
20
20
|
"core-js": "^3.9.1"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"react": ">=16.8.0 <18"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@rescui/scripts": "^0.1.
|
|
27
|
+
"@rescui/scripts": "^0.1.4"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build": "rescui-scripts build"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "6b1d206de2641861028760d73f33dee214c07911"
|
|
33
33
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
<a name="v0.1.0"></a>
|
|
7
|
-
# 0.1.0 (2021-06-03)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
### Features
|
|
11
|
-
|
|
12
|
-
* Add getInverseTheme helper ([52c7251](https://github.com/JetBrains/RescUI/commit/52c7251))
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<a name="v0.0.2"></a>
|
|
20
|
-
## 0.0.2 (2021-03-30)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
### Bug Fixes
|
|
24
|
-
|
|
25
|
-
* Remove unneeded dependency ([dc1ab3f](https://github.com/JetBrains/RescUI/commit/dc1ab3f))
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
<a name="v0.0.1"></a>
|
|
33
|
-
## 0.0.1 (2021-03-30)
|
|
34
|
-
|
|
35
|
-
**Note:** Version bump only for package @rescui/ui-contexts
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AAAA,SAAS,gBAAT,EAA2B,YAA3B,EAAyC,kBAAzC,QAAmE,0BAAnE;AACA,SAAS,OAAO,IAAI,gBAApB,QAA4C,qBAA5C;AAEA,SAAS,aAAT,EAAwB,SAAxB,EAAmC,QAAnC,EAA6C,eAA7C,QAAoE,uBAApE;AACA,SAAS,OAAO,IAAI,aAApB,QAAyC,kBAAzC","sourceRoot":"","file":"index.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/layering-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAP,IAAmC,OAAnC,QAAkD,OAAlD;AACA,OAAO,SAAP,MAAsB,YAAtB;AAEA,SACE,eADF,EAEE,oBAFF,EAGE,kBAHF,QAIO,0BAJP;;AAQA,SAAS,gBAAT,CAA0B,EAA1B,EAG+D;MAF7D,SAAS,GAAA,EAAA,CAAA,S;MACT,QAAQ,GAAA,EAAA,CAAA,Q;;AAEF,MAAA,EAAA,GAMF,kBAAkB,EANhB;AAAA,MACJ,WAAW,GAAA,EAAA,CAAA,WADP;AAAA,MAEJ,cAAc,GAAA,EAAA,CAAA,cAFV;AAAA,MAGJ,aAAa,GAAA,EAAA,CAAA,aAHT;AAAA,MAIJ,UAAU,GAAA,EAAA,CA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AAA,KAAL;AAAA,QAAU,SAAS,GAAA,MAAA,CAAA,EAAA,EAArB,CAAA,OAAA,CAAqB,CAAnB;;AAAkC,WACnC,KAAA,CAAA,aAAA,CAAC,aAAD,EAAc,IAAd,EACG,UAAA,gBAAA,EAAgB;AAAI,aACnB,KAAA,CAAA,aAAA,CAAC,gBAAD,EAAiB,QAAA,CAAA;AACf,QAAA,GAAG,EAAE,GADU;AAEf,QAAA,KAAK,EAAE,KAAK,IAAI;AAFD,OAAA,EADE,SACF,CAAjB,CADmB;AAMpB,KAPH,CADmC;AAUpC,GAXwB,CAA3B;AAcA,EAAA,kBAAkB,CAAC,WAAnB,GAAiC,gBAAa,gBAAgB,CAAC,WAAjB,IAC5C,gBAAgB,CAAC,IADc,IACV,GADvB;AAGA,SAAO,kBAAP;AACD,CAtBM","sourceRoot":"","file":"theme-context.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/theme-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAP,MAAyC,OAAzC;AACA,OAAO,SAAP,MAAsB,YAAtB;AAEA,SAAS,YAAT,QAAyC,uBAAzC;;AAEA,IAAM,aAAa,GAA4C,SAAzD,aAAyD,CAAC,EAAD,EAG9D;MAFC,KAAK,GAAA,EAAA,CAAA,K;MACL,QAAQ,GAAA,EAAA,CAAA,Q;AACJ,SAAA,KAAA,CAAA,aAAA,CAAC,YAAY,CAAC,QAAd,EAAsB;AAAC,IAAA,KAAK,EAAE;AAAR,GAAtB,EAAsC,QAAtC,CAAA;AAAuE,CAH7E;;AAKA,aAAa,CAAC,SAAd,GAA0B;AACxB,EAAA,KAAK,EAAE,SAAS,CAAC,KAAV,CAAgB,CAAC,OAAD,EAAU,MAAV,CAAhB;AADiB,CAA1B;AAIA,eAAe,aAAf","sourceRoot":"","file":"theme-provider.js"}
|