@astral/ui 1.16.1 → 1.16.3
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/ConfigProvider/ConfigProvider.d.ts +2 -2
- package/ConfigProvider/ConfigProvider.js +1 -1
- package/ErrorBoundary/ErrorBoundary.d.ts +3 -3
- package/ErrorBoundary/ErrorBoundary.js +2 -2
- package/Placeholder/Placeholder.d.ts +9 -1
- package/Placeholder/Placeholder.js +2 -2
- package/Placeholder/styles.js +7 -1
- package/esm/ConfigProvider/ConfigProvider.d.ts +2 -2
- package/esm/ConfigProvider/ConfigProvider.js +1 -1
- package/esm/ErrorBoundary/ErrorBoundary.d.ts +3 -3
- package/esm/ErrorBoundary/ErrorBoundary.js +2 -2
- package/esm/Placeholder/Placeholder.d.ts +9 -1
- package/esm/Placeholder/Placeholder.js +2 -2
- package/esm/Placeholder/styles.js +7 -1
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
export declare type ConfigContextProps = {
|
|
3
3
|
locale?: Locale;
|
|
4
|
-
captureException?: (
|
|
4
|
+
captureException?: (error: any) => void;
|
|
5
5
|
};
|
|
6
6
|
export declare type ConfigProviderProps = ConfigContextProps & {
|
|
7
7
|
children: ReactNode;
|
|
@@ -20,7 +20,7 @@ var react_1 = require("react");
|
|
|
20
20
|
var ru_1 = __importDefault(require("date-fns/locale/ru"));
|
|
21
21
|
exports.ConfigContext = (0, react_1.createContext)({
|
|
22
22
|
locale: ru_1.default,
|
|
23
|
-
captureException: function (
|
|
23
|
+
captureException: function (error) { return console.error(error); },
|
|
24
24
|
});
|
|
25
25
|
var ConfigProvider = function (_a) {
|
|
26
26
|
var children = _a.children, _b = _a.locale, locale = _b === void 0 ? ru_1.default : _b, captureException = _a.captureException;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
declare type Props = {
|
|
3
3
|
children: ReactNode;
|
|
4
|
-
captureException?: (
|
|
4
|
+
captureException?: (error: any) => void;
|
|
5
5
|
};
|
|
6
6
|
declare type State = {
|
|
7
7
|
error: boolean;
|
|
@@ -11,7 +11,7 @@ declare class ErrorBoundary extends React.Component<Props, State> {
|
|
|
11
11
|
static getDerivedStateFromError(): {
|
|
12
12
|
error: boolean;
|
|
13
13
|
};
|
|
14
|
-
componentDidCatch(error: Error
|
|
14
|
+
componentDidCatch(error: Error): void;
|
|
15
15
|
handleReloadPage(): void;
|
|
16
16
|
render(): string | number | boolean | React.ReactFragment | JSX.Element | null | undefined;
|
|
17
17
|
}
|
|
@@ -46,9 +46,9 @@ var ErrorBoundary = /** @class */ (function (_super) {
|
|
|
46
46
|
ErrorBoundary.getDerivedStateFromError = function () {
|
|
47
47
|
return { error: true };
|
|
48
48
|
};
|
|
49
|
-
ErrorBoundary.prototype.componentDidCatch = function (error
|
|
49
|
+
ErrorBoundary.prototype.componentDidCatch = function (error) {
|
|
50
50
|
var _a, _b;
|
|
51
|
-
(_b = (_a = this.props).captureException) === null || _b === void 0 ? void 0 : _b.call(_a,
|
|
51
|
+
(_b = (_a = this.props).captureException) === null || _b === void 0 ? void 0 : _b.call(_a, error);
|
|
52
52
|
};
|
|
53
53
|
ErrorBoundary.prototype.handleReloadPage = function () {
|
|
54
54
|
location.reload();
|
|
@@ -8,6 +8,14 @@ export declare type PlaceholderProps = {
|
|
|
8
8
|
* Описание изображения
|
|
9
9
|
*/
|
|
10
10
|
imgAlt: string;
|
|
11
|
+
/**
|
|
12
|
+
* ширина изображения
|
|
13
|
+
*/
|
|
14
|
+
imgWidth?: string;
|
|
15
|
+
/**
|
|
16
|
+
* высота изображения
|
|
17
|
+
*/
|
|
18
|
+
imgHeight?: string;
|
|
11
19
|
/**
|
|
12
20
|
* Заголовок
|
|
13
21
|
*/
|
|
@@ -21,4 +29,4 @@ export declare type PlaceholderProps = {
|
|
|
21
29
|
*/
|
|
22
30
|
Actions?: ReactNode;
|
|
23
31
|
};
|
|
24
|
-
export declare const Placeholder: ({ title, imgSrc, imgAlt, description, Actions, }: PlaceholderProps) => JSX.Element;
|
|
32
|
+
export declare const Placeholder: ({ title, imgSrc, imgAlt, imgWidth, imgHeight, description, Actions, }: PlaceholderProps) => JSX.Element;
|
|
@@ -15,7 +15,7 @@ exports.Placeholder = void 0;
|
|
|
15
15
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
16
|
var styles_1 = require("./styles");
|
|
17
17
|
var Placeholder = function (_a) {
|
|
18
|
-
var title = _a.title, imgSrc = _a.imgSrc, imgAlt = _a.imgAlt, description = _a.description, Actions = _a.Actions;
|
|
19
|
-
return ((0, jsx_runtime_1.jsxs)(styles_1.PlaceholderRoot, { children: [(0, jsx_runtime_1.jsxs)(styles_1.PlaceholderInnerContainer, { children: [(0, jsx_runtime_1.jsx)(styles_1.PlaceholderImage, { src: imgSrc, alt: imgAlt }), (0, jsx_runtime_1.jsx)(styles_1.PlaceholderTitle, __assign({ variant: "h4" }, { children: title })), description && ((0, jsx_runtime_1.jsx)(styles_1.PlaceholderDescription, __assign({ variant: "ui" }, { children: description })))] }), Actions && (0, jsx_runtime_1.jsx)(styles_1.PlaceholderActions, { children: Actions })] }));
|
|
18
|
+
var title = _a.title, imgSrc = _a.imgSrc, imgAlt = _a.imgAlt, imgWidth = _a.imgWidth, imgHeight = _a.imgHeight, description = _a.description, Actions = _a.Actions;
|
|
19
|
+
return ((0, jsx_runtime_1.jsxs)(styles_1.PlaceholderRoot, { children: [(0, jsx_runtime_1.jsxs)(styles_1.PlaceholderInnerContainer, { children: [(0, jsx_runtime_1.jsx)(styles_1.PlaceholderImage, { src: imgSrc, alt: imgAlt, width: imgWidth, height: imgHeight }), (0, jsx_runtime_1.jsx)(styles_1.PlaceholderTitle, __assign({ variant: "h4" }, { children: title })), description && ((0, jsx_runtime_1.jsx)(styles_1.PlaceholderDescription, __assign({ variant: "ui" }, { children: description })))] }), Actions && (0, jsx_runtime_1.jsx)(styles_1.PlaceholderActions, { children: Actions })] }));
|
|
20
20
|
};
|
|
21
21
|
exports.Placeholder = Placeholder;
|
package/Placeholder/styles.js
CHANGED
|
@@ -15,7 +15,13 @@ exports.PlaceholderRoot = styles_1.styled.div(templateObject_1 || (templateObjec
|
|
|
15
15
|
return theme.palette.background.paper;
|
|
16
16
|
});
|
|
17
17
|
exports.PlaceholderInnerContainer = styles_1.styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n max-width: 384px;\n"], ["\n max-width: 384px;\n"])));
|
|
18
|
-
exports.PlaceholderImage = styles_1.styled.img(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: block;\n width:
|
|
18
|
+
exports.PlaceholderImage = styles_1.styled.img(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: block;\n width: ", ";\n height: ", ";\n margin: auto auto ", ";\n object-fit: contain;\n\n ", " {\n margin-bottom: ", ";\n\n color: ", ";\n }\n"], ["\n display: block;\n width: ", ";\n height: ", ";\n margin: auto auto ", ";\n object-fit: contain;\n\n ", " {\n margin-bottom: ", ";\n\n color: ", ";\n }\n"])), function (_a) {
|
|
19
|
+
var width = _a.width;
|
|
20
|
+
return width || '100%';
|
|
21
|
+
}, function (_a) {
|
|
22
|
+
var height = _a.height;
|
|
23
|
+
return height || 'auto';
|
|
24
|
+
}, function (_a) {
|
|
19
25
|
var theme = _a.theme;
|
|
20
26
|
return theme.spacing(6);
|
|
21
27
|
}, function (_a) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
export declare type ConfigContextProps = {
|
|
3
3
|
locale?: Locale;
|
|
4
|
-
captureException?: (
|
|
4
|
+
captureException?: (error: any) => void;
|
|
5
5
|
};
|
|
6
6
|
export declare type ConfigProviderProps = ConfigContextProps & {
|
|
7
7
|
children: ReactNode;
|
|
@@ -14,7 +14,7 @@ import { createContext, useEffect } from 'react';
|
|
|
14
14
|
import ru from 'date-fns/locale/ru';
|
|
15
15
|
export var ConfigContext = createContext({
|
|
16
16
|
locale: ru,
|
|
17
|
-
captureException: function (
|
|
17
|
+
captureException: function (error) { return console.error(error); },
|
|
18
18
|
});
|
|
19
19
|
export var ConfigProvider = function (_a) {
|
|
20
20
|
var children = _a.children, _b = _a.locale, locale = _b === void 0 ? ru : _b, captureException = _a.captureException;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
declare type Props = {
|
|
3
3
|
children: ReactNode;
|
|
4
|
-
captureException?: (
|
|
4
|
+
captureException?: (error: any) => void;
|
|
5
5
|
};
|
|
6
6
|
declare type State = {
|
|
7
7
|
error: boolean;
|
|
@@ -11,7 +11,7 @@ declare class ErrorBoundary extends React.Component<Props, State> {
|
|
|
11
11
|
static getDerivedStateFromError(): {
|
|
12
12
|
error: boolean;
|
|
13
13
|
};
|
|
14
|
-
componentDidCatch(error: Error
|
|
14
|
+
componentDidCatch(error: Error): void;
|
|
15
15
|
handleReloadPage(): void;
|
|
16
16
|
render(): string | number | boolean | React.ReactFragment | JSX.Element | null | undefined;
|
|
17
17
|
}
|
|
@@ -41,9 +41,9 @@ var ErrorBoundary = /** @class */ (function (_super) {
|
|
|
41
41
|
ErrorBoundary.getDerivedStateFromError = function () {
|
|
42
42
|
return { error: true };
|
|
43
43
|
};
|
|
44
|
-
ErrorBoundary.prototype.componentDidCatch = function (error
|
|
44
|
+
ErrorBoundary.prototype.componentDidCatch = function (error) {
|
|
45
45
|
var _a, _b;
|
|
46
|
-
(_b = (_a = this.props).captureException) === null || _b === void 0 ? void 0 : _b.call(_a,
|
|
46
|
+
(_b = (_a = this.props).captureException) === null || _b === void 0 ? void 0 : _b.call(_a, error);
|
|
47
47
|
};
|
|
48
48
|
ErrorBoundary.prototype.handleReloadPage = function () {
|
|
49
49
|
location.reload();
|
|
@@ -8,6 +8,14 @@ export declare type PlaceholderProps = {
|
|
|
8
8
|
* Описание изображения
|
|
9
9
|
*/
|
|
10
10
|
imgAlt: string;
|
|
11
|
+
/**
|
|
12
|
+
* ширина изображения
|
|
13
|
+
*/
|
|
14
|
+
imgWidth?: string;
|
|
15
|
+
/**
|
|
16
|
+
* высота изображения
|
|
17
|
+
*/
|
|
18
|
+
imgHeight?: string;
|
|
11
19
|
/**
|
|
12
20
|
* Заголовок
|
|
13
21
|
*/
|
|
@@ -21,4 +29,4 @@ export declare type PlaceholderProps = {
|
|
|
21
29
|
*/
|
|
22
30
|
Actions?: ReactNode;
|
|
23
31
|
};
|
|
24
|
-
export declare const Placeholder: ({ title, imgSrc, imgAlt, description, Actions, }: PlaceholderProps) => JSX.Element;
|
|
32
|
+
export declare const Placeholder: ({ title, imgSrc, imgAlt, imgWidth, imgHeight, description, Actions, }: PlaceholderProps) => JSX.Element;
|
|
@@ -12,6 +12,6 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { PlaceholderActions, PlaceholderDescription, PlaceholderImage, PlaceholderInnerContainer, PlaceholderRoot, PlaceholderTitle, } from './styles';
|
|
14
14
|
export var Placeholder = function (_a) {
|
|
15
|
-
var title = _a.title, imgSrc = _a.imgSrc, imgAlt = _a.imgAlt, description = _a.description, Actions = _a.Actions;
|
|
16
|
-
return (_jsxs(PlaceholderRoot, { children: [_jsxs(PlaceholderInnerContainer, { children: [_jsx(PlaceholderImage, { src: imgSrc, alt: imgAlt }), _jsx(PlaceholderTitle, __assign({ variant: "h4" }, { children: title })), description && (_jsx(PlaceholderDescription, __assign({ variant: "ui" }, { children: description })))] }), Actions && _jsx(PlaceholderActions, { children: Actions })] }));
|
|
15
|
+
var title = _a.title, imgSrc = _a.imgSrc, imgAlt = _a.imgAlt, imgWidth = _a.imgWidth, imgHeight = _a.imgHeight, description = _a.description, Actions = _a.Actions;
|
|
16
|
+
return (_jsxs(PlaceholderRoot, { children: [_jsxs(PlaceholderInnerContainer, { children: [_jsx(PlaceholderImage, { src: imgSrc, alt: imgAlt, width: imgWidth, height: imgHeight }), _jsx(PlaceholderTitle, __assign({ variant: "h4" }, { children: title })), description && (_jsx(PlaceholderDescription, __assign({ variant: "ui" }, { children: description })))] }), Actions && _jsx(PlaceholderActions, { children: Actions })] }));
|
|
17
17
|
};
|
|
@@ -12,7 +12,13 @@ export var PlaceholderRoot = styled.div(templateObject_1 || (templateObject_1 =
|
|
|
12
12
|
return theme.palette.background.paper;
|
|
13
13
|
});
|
|
14
14
|
export var PlaceholderInnerContainer = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n max-width: 384px;\n"], ["\n max-width: 384px;\n"])));
|
|
15
|
-
export var PlaceholderImage = styled.img(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: block;\n width:
|
|
15
|
+
export var PlaceholderImage = styled.img(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: block;\n width: ", ";\n height: ", ";\n margin: auto auto ", ";\n object-fit: contain;\n\n ", " {\n margin-bottom: ", ";\n\n color: ", ";\n }\n"], ["\n display: block;\n width: ", ";\n height: ", ";\n margin: auto auto ", ";\n object-fit: contain;\n\n ", " {\n margin-bottom: ", ";\n\n color: ", ";\n }\n"])), function (_a) {
|
|
16
|
+
var width = _a.width;
|
|
17
|
+
return width || '100%';
|
|
18
|
+
}, function (_a) {
|
|
19
|
+
var height = _a.height;
|
|
20
|
+
return height || 'auto';
|
|
21
|
+
}, function (_a) {
|
|
16
22
|
var theme = _a.theme;
|
|
17
23
|
return theme.spacing(6);
|
|
18
24
|
}, function (_a) {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@astral/ui",
|
|
3
3
|
"browser": "./src/index.ts",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@astral/icons": "^1.16.
|
|
5
|
+
"@astral/icons": "^1.16.3",
|
|
6
6
|
"@emotion/cache": "11.7.1",
|
|
7
7
|
"@emotion/react": "11.9.0",
|
|
8
8
|
"@emotion/server": "11.4.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"require": "./server/index.js"
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
|
-
"version": "1.16.
|
|
34
|
+
"version": "1.16.3",
|
|
35
35
|
"author": "Astral.Soft",
|
|
36
36
|
"license": "MIT",
|
|
37
37
|
"repository": {
|