@prom-ui/core 0.0.21 → 0.0.24
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/Body/package.json +1 -1
- package/Box/package.json +1 -1
- package/Button/package.json +1 -1
- package/ButtonPageUp/package.json +1 -1
- package/Checkbox/package.json +1 -1
- package/Flex/package.json +1 -1
- package/Grid/package.json +1 -1
- package/Icon/package.json +1 -1
- package/Image/package.json +1 -1
- package/ImageEmoji/package.json +1 -1
- package/Input/package.json +1 -1
- package/KeyPress/package.json +1 -1
- package/Line/package.json +1 -1
- package/Link/package.json +1 -1
- package/List/package.json +1 -1
- package/Media/breakpoints.d.ts +17 -0
- package/Media/context.d.ts +8 -0
- package/Media/index.d.ts +14 -0
- package/Media/index.js +75 -0
- package/Media/package.json +12 -0
- package/OutsideClick/package.json +1 -1
- package/Picture/package.json +1 -1
- package/PortableOverlay/package.json +1 -1
- package/Portal/package.json +1 -1
- package/Rating/package.json +1 -1
- package/SafeQuery/components/Error.d.ts +7 -0
- package/SafeQuery/index.d.ts +7 -0
- package/SafeQuery/index.js +176 -0
- package/SafeQuery/package.json +12 -0
- package/SafeQuery/style.css +4 -0
- package/Scroll/package.json +1 -1
- package/ScrollControls/package.json +1 -1
- package/SideOverlay/package.json +1 -1
- package/SimpleSlider/package.json +1 -1
- package/Skeleton/package.json +1 -1
- package/Spinner/package.json +1 -1
- package/Text/package.json +1 -1
- package/TextEmoji/package.json +1 -1
- package/Tumbler/package.json +1 -1
- package/package.json +12 -2
package/Body/package.json
CHANGED
package/Box/package.json
CHANGED
package/Button/package.json
CHANGED
package/Checkbox/package.json
CHANGED
package/Flex/package.json
CHANGED
package/Grid/package.json
CHANGED
package/Icon/package.json
CHANGED
package/Image/package.json
CHANGED
package/ImageEmoji/package.json
CHANGED
package/Input/package.json
CHANGED
package/KeyPress/package.json
CHANGED
package/Line/package.json
CHANGED
package/Link/package.json
CHANGED
package/List/package.json
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const MIN_SCREEN_WIDTH = 1;
|
|
2
|
+
export declare const SCREEN_BREAKPOINTS: {
|
|
3
|
+
small: number;
|
|
4
|
+
medium: number;
|
|
5
|
+
large: number;
|
|
6
|
+
wide: number;
|
|
7
|
+
huge: number;
|
|
8
|
+
};
|
|
9
|
+
export declare type tSCREEN_BREAKPOINTS = keyof typeof SCREEN_BREAKPOINTS;
|
|
10
|
+
export declare const SCREEN_BREAKPOINTS_PROXY: {
|
|
11
|
+
small: number;
|
|
12
|
+
medium: number;
|
|
13
|
+
large: number;
|
|
14
|
+
wide: number;
|
|
15
|
+
huge: number;
|
|
16
|
+
};
|
|
17
|
+
export declare const getBreakPoint: (key: tSCREEN_BREAKPOINTS) => number;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { tSCREEN_BREAKPOINTS } from './breakpoints';
|
|
3
|
+
export declare type tMediaProviderProps = {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
resetOnMount?: boolean;
|
|
6
|
+
width?: tSCREEN_BREAKPOINTS;
|
|
7
|
+
};
|
|
8
|
+
export declare const MediaProvider: React.FC<tMediaProviderProps>;
|
package/Media/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { tSCREEN_BREAKPOINTS } from './breakpoints';
|
|
3
|
+
declare type tUseMedia = (arg: {
|
|
4
|
+
minWidth?: tSCREEN_BREAKPOINTS;
|
|
5
|
+
maxWidth?: tSCREEN_BREAKPOINTS;
|
|
6
|
+
}) => boolean;
|
|
7
|
+
export declare const useMedia: tUseMedia;
|
|
8
|
+
declare type tMedia = (props: {
|
|
9
|
+
minWidth?: tSCREEN_BREAKPOINTS;
|
|
10
|
+
maxWidth?: tSCREEN_BREAKPOINTS;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
}) => React.ReactNode;
|
|
13
|
+
export declare const Media: tMedia;
|
|
14
|
+
export {};
|
package/Media/index.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var reactResponsive = require('react-responsive');
|
|
6
|
+
|
|
7
|
+
var MIN_SCREEN_WIDTH = 1;
|
|
8
|
+
var SCREEN_BREAKPOINTS = {
|
|
9
|
+
small: 480,
|
|
10
|
+
medium: 768,
|
|
11
|
+
large: 960,
|
|
12
|
+
wide: 1200,
|
|
13
|
+
huge: 1400
|
|
14
|
+
};
|
|
15
|
+
var SCREEN_BREAKPOINTS_PROXY = new Proxy(SCREEN_BREAKPOINTS, {
|
|
16
|
+
get: function (target, key) {
|
|
17
|
+
if (!target.hasOwnProperty(key)) {
|
|
18
|
+
var keyListStr = JSON.stringify(Object.keys(target));
|
|
19
|
+
throw new Error("Media received unknown width \"".concat(key, "\". You should use one of ").concat(keyListStr));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return target[key];
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
var getBreakPoint = function (key) {
|
|
26
|
+
// Use proxy in debug mode, to ensure that we are reading only existing breakpoints
|
|
27
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
28
|
+
return SCREEN_BREAKPOINTS_PROXY[key];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return SCREEN_BREAKPOINTS[key];
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// import PropTypes from 'prop-types';
|
|
35
|
+
var useMedia = function (_a) {
|
|
36
|
+
var minWidth = _a.minWidth,
|
|
37
|
+
maxWidth = _a.maxWidth;
|
|
38
|
+
return reactResponsive.useMediaQuery({
|
|
39
|
+
minWidth: minWidth ? getBreakPoint(minWidth) : MIN_SCREEN_WIDTH,
|
|
40
|
+
maxWidth: maxWidth ? getBreakPoint(maxWidth) - 1 : undefined
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
var Media = function (_a) {
|
|
44
|
+
var minWidth = _a.minWidth,
|
|
45
|
+
maxWidth = _a.maxWidth,
|
|
46
|
+
children = _a.children;
|
|
47
|
+
var matchMedia = useMedia({
|
|
48
|
+
minWidth: minWidth,
|
|
49
|
+
maxWidth: maxWidth
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
if (matchMedia) {
|
|
53
|
+
return children;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return null;
|
|
57
|
+
}; // Media.propTypes = {
|
|
58
|
+
// minWidth: PropTypes.oneOf([
|
|
59
|
+
// 'small',
|
|
60
|
+
// 'medium',
|
|
61
|
+
// 'large',
|
|
62
|
+
// 'wide',
|
|
63
|
+
// 'huge',
|
|
64
|
+
// ]),
|
|
65
|
+
// maxWidth: PropTypes.oneOf([
|
|
66
|
+
// 'small',
|
|
67
|
+
// 'medium',
|
|
68
|
+
// 'large',
|
|
69
|
+
// 'wide',
|
|
70
|
+
// 'huge',
|
|
71
|
+
// ]),
|
|
72
|
+
// };
|
|
73
|
+
|
|
74
|
+
exports.Media = Media;
|
|
75
|
+
exports.useMedia = useMedia;
|
package/Picture/package.json
CHANGED
package/Portal/package.json
CHANGED
package/Rating/package.json
CHANGED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var PropTypes = require('prop-types');
|
|
7
|
+
var components = require('@apollo/client/react/components');
|
|
8
|
+
var errcatch = require('@evo/errcatch');
|
|
9
|
+
var Box = require('@prom-ui/core/Box');
|
|
10
|
+
var Button = require('@prom-ui/core/Button');
|
|
11
|
+
var Text = require('@prom-ui/core/Text');
|
|
12
|
+
|
|
13
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
|
+
|
|
15
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
16
|
+
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
17
|
+
|
|
18
|
+
/******************************************************************************
|
|
19
|
+
Copyright (c) Microsoft Corporation.
|
|
20
|
+
|
|
21
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
22
|
+
purpose with or without fee is hereby granted.
|
|
23
|
+
|
|
24
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
25
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
26
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
27
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
28
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
29
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
30
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
31
|
+
***************************************************************************** */
|
|
32
|
+
|
|
33
|
+
var __assign = function() {
|
|
34
|
+
__assign = Object.assign || function __assign(t) {
|
|
35
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
36
|
+
s = arguments[i];
|
|
37
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
38
|
+
}
|
|
39
|
+
return t;
|
|
40
|
+
};
|
|
41
|
+
return __assign.apply(this, arguments);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
function __rest(s, e) {
|
|
45
|
+
var t = {};
|
|
46
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
47
|
+
t[p] = s[p];
|
|
48
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
49
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
50
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
51
|
+
t[p[i]] = s[p[i]];
|
|
52
|
+
}
|
|
53
|
+
return t;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
var css = {"root":"SafeQuery__root___RWb3q"};
|
|
57
|
+
|
|
58
|
+
var SafeQueryError = function (_a) {
|
|
59
|
+
var componentErrorName = _a.componentErrorName,
|
|
60
|
+
onReload = _a.onReload;
|
|
61
|
+
|
|
62
|
+
var _b = React.useState(false),
|
|
63
|
+
isHidden = _b[0],
|
|
64
|
+
setHidden = _b[1];
|
|
65
|
+
|
|
66
|
+
if (isHidden) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
71
|
+
if (typeof window === 'undefined') return null;
|
|
72
|
+
return React__default["default"].createElement(Box.Box, {
|
|
73
|
+
className: css.root,
|
|
74
|
+
"box-background": 'red-500',
|
|
75
|
+
"box-padding": ['s m', 'm@large l@large'],
|
|
76
|
+
"box-position": 'relative',
|
|
77
|
+
"box-round": 'm',
|
|
78
|
+
"data-qaid": 'err_catch_trace'
|
|
79
|
+
}, React__default["default"].createElement(Box.Box, {
|
|
80
|
+
"box-margin-right": '5xl'
|
|
81
|
+
}, React__default["default"].createElement(Text.Text, {
|
|
82
|
+
"text-color": 'white'
|
|
83
|
+
}, "\u0412\u043E\u0437\u043D\u0438\u043A\u043B\u0430 \u043E\u0448\u0438\u0431\u043A\u0430:", ' ', React__default["default"].createElement(Text.Text, {
|
|
84
|
+
"text-weight": 'bold',
|
|
85
|
+
style: {
|
|
86
|
+
fontFamily: 'Consolas, "Liberation Mono", Menlo, monospace',
|
|
87
|
+
userSelect: 'all'
|
|
88
|
+
}
|
|
89
|
+
}, componentErrorName))), React__default["default"].createElement(Box.Box, {
|
|
90
|
+
"box-position": 'absolute center-right',
|
|
91
|
+
"box-margin-right": 's'
|
|
92
|
+
}, React__default["default"].createElement(Button.Button, {
|
|
93
|
+
"button-padding": 'xxs',
|
|
94
|
+
"button-theme": 'white-inherit',
|
|
95
|
+
onClick: onReload,
|
|
96
|
+
title: '\u041E\u0431\u043D\u043E\u0432\u0438\u0442\u044C'
|
|
97
|
+
}, React__default["default"].createElement("svg", {
|
|
98
|
+
xmlns: 'http://www.w3.org/2000/svg',
|
|
99
|
+
viewBox: '0 0 18 18',
|
|
100
|
+
width: 18,
|
|
101
|
+
height: 18
|
|
102
|
+
}, React__default["default"].createElement("path", {
|
|
103
|
+
fill: '#fff',
|
|
104
|
+
d: 'M9 13.5c-2.49 0-4.5-2.01-4.5-4.5S6.51 4.5 9 4.5c1.24\n 0 2.36.52 3.17 1.33L10 8h5V3l-1.76 1.76C12.15 3.68 10.66\n 3 9 3 5.69 3 3.01 5.69 3.01 9S5.69 15 9 15c2.97 0\n 5.43-2.16 5.9-5h-1.52c-.46 2-2.24 3.5-4.38 3.5z'
|
|
105
|
+
}))), React__default["default"].createElement(Button.Button, {
|
|
106
|
+
"button-padding": 'xxs',
|
|
107
|
+
"button-theme": 'white-inherit',
|
|
108
|
+
onClick: function () {
|
|
109
|
+
return setHidden(true);
|
|
110
|
+
},
|
|
111
|
+
title: '\u0421\u043A\u0440\u044B\u0442\u044C'
|
|
112
|
+
}, React__default["default"].createElement("svg", {
|
|
113
|
+
xmlns: 'http://www.w3.org/2000/svg',
|
|
114
|
+
viewBox: '0 0 24 24',
|
|
115
|
+
width: 18,
|
|
116
|
+
height: 18
|
|
117
|
+
}, React__default["default"].createElement("path", {
|
|
118
|
+
fill: '#fff',
|
|
119
|
+
d: 'M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5\n 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'
|
|
120
|
+
})))));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return null;
|
|
124
|
+
};
|
|
125
|
+
SafeQueryError.propTypes = {
|
|
126
|
+
componentErrorName: PropTypes__default["default"].string.isRequired,
|
|
127
|
+
onReload: PropTypes__default["default"].func.isRequired
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
var SafeQuery = function (_a) {
|
|
131
|
+
var _b = _a.componentErrorName,
|
|
132
|
+
componentErrorName = _b === void 0 ? 'SafeQuery' : _b,
|
|
133
|
+
children = _a.children,
|
|
134
|
+
props = __rest(_a, ["componentErrorName", "children"]);
|
|
135
|
+
|
|
136
|
+
var _c = React.useState(false),
|
|
137
|
+
isReload = _c[0],
|
|
138
|
+
setReload = _c[1];
|
|
139
|
+
|
|
140
|
+
React.useEffect(function () {
|
|
141
|
+
if (isReload) {
|
|
142
|
+
setReload(false);
|
|
143
|
+
}
|
|
144
|
+
}, [isReload]);
|
|
145
|
+
|
|
146
|
+
if (isReload) {
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
var errorComponent = React__default["default"].createElement(SafeQueryError, {
|
|
151
|
+
componentErrorName: componentErrorName,
|
|
152
|
+
onReload: function () {
|
|
153
|
+
return setReload(true);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
return React__default["default"].createElement(errcatch.ErrCatch, {
|
|
157
|
+
name: componentErrorName,
|
|
158
|
+
errorComponent: errorComponent
|
|
159
|
+
}, React__default["default"].createElement(components.Query, __assign({}, props), function (queryResult) {
|
|
160
|
+
var error = queryResult.error;
|
|
161
|
+
if (error) throw error;
|
|
162
|
+
return children(queryResult);
|
|
163
|
+
}));
|
|
164
|
+
}; // SafeQuery.defaultProps = {
|
|
165
|
+
// componentErrorName: 'SafeQuery',
|
|
166
|
+
// };
|
|
167
|
+
|
|
168
|
+
SafeQuery.propTypes = {
|
|
169
|
+
/** Название компонента в тексте с ошибкой */
|
|
170
|
+
componentErrorName: PropTypes__default["default"].string // children: PropTypes.func.isRequired,
|
|
171
|
+
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
exports.SafeQuery = SafeQuery;
|
|
175
|
+
|
|
176
|
+
require('./style.css');
|
package/Scroll/package.json
CHANGED
package/SideOverlay/package.json
CHANGED
package/Skeleton/package.json
CHANGED
package/Spinner/package.json
CHANGED
package/Text/package.json
CHANGED
package/TextEmoji/package.json
CHANGED
package/Tumbler/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prom-ui/core",
|
|
3
3
|
"author": "e.marchenko",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.24",
|
|
5
5
|
"description": "core ui blocks",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"prebuild": "node ./preBuild.js",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"directory": "dist"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
+
"@apollo/client": "^3.6.5",
|
|
23
24
|
"@prom-ui/core": "file:../core/src",
|
|
24
25
|
"@prom-ui/hooks": "file:../hooks/src",
|
|
25
26
|
"@prom-ui/icons": "file:../icons/src"
|
|
@@ -27,6 +28,7 @@
|
|
|
27
28
|
"dependencies": {
|
|
28
29
|
"@evo/emoji": "^0.2.0",
|
|
29
30
|
"@evo/emoji-text": "^0.1.1",
|
|
31
|
+
"@evo/errcatch": "^1.0.2",
|
|
30
32
|
"@prom-ui/hooks": "^0.0.3",
|
|
31
33
|
"@prom-ui/icons": "^0.0.5",
|
|
32
34
|
"classnames": "^2.3.1",
|
|
@@ -44,15 +46,23 @@
|
|
|
44
46
|
"evokit-text": "^3.2.0",
|
|
45
47
|
"intersection-observer": "^0.12.0",
|
|
46
48
|
"react-easy-swipe": "^0.0.22",
|
|
49
|
+
"react-popper-tooltip": "2.10.1",
|
|
50
|
+
"react-responsive": "^8.1.0",
|
|
47
51
|
"react-scrolllock": "^5.0.1",
|
|
48
52
|
"react-transition-group": "^4.4.2",
|
|
49
53
|
"ts-debounce": "^4.0.0",
|
|
50
54
|
"ttag": "^1.7.24"
|
|
51
55
|
},
|
|
52
56
|
"peerDependencies": {
|
|
57
|
+
"@apollo/client": "*",
|
|
53
58
|
"prop-types": "*",
|
|
54
59
|
"react": "*",
|
|
55
60
|
"react-dom": "*"
|
|
56
61
|
},
|
|
57
|
-
"
|
|
62
|
+
"peerDependenciesMeta": {
|
|
63
|
+
"@apollo/client": {
|
|
64
|
+
"optional": true
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"gitHead": "cad8a8b8433c057f5c01d75816050232094af394"
|
|
58
68
|
}
|