@steroidsjs/core 2.1.0-beta.15 → 2.1.0-beta.19
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/actions/list.d.ts +1 -0
- package/actions/list.js +1 -0
- package/components/ClientStorageComponent.d.ts +3 -3
- package/components/ClientStorageComponent.js +28 -22
- package/components/HttpComponent.js +32 -15
- package/components/LocaleComponent.js +9 -9
- package/components/MetricsComponent.js +3 -1
- package/components/StoreComponent.d.ts +6 -0
- package/components/StoreComponent.js +5 -6
- package/components/UiComponent.d.ts +1 -1
- package/components/WebSocketComponent.d.ts +1 -1
- package/hoc/components.d.ts +1 -1
- package/hoc/components.js +1 -1
- package/hooks/index.d.ts +2 -1
- package/hooks/index.js +3 -1
- package/hooks/useApplication.d.ts +29 -26
- package/hooks/useApplication.js +17 -82
- package/hooks/useComponents.d.ts +1 -14
- package/hooks/useComponents.js +5 -5
- package/hooks/useFetch.d.ts +11 -3
- package/hooks/useFetch.js +34 -31
- package/hooks/useLayout.d.ts +9 -0
- package/hooks/useLayout.js +64 -44
- package/hooks/useList.d.ts +45 -0
- package/hooks/useList.js +83 -53
- package/hooks/useModel.js +1 -1
- package/hooks/useScreen.d.ts +1 -1
- package/hooks/useScreen.js +2 -2
- package/hooks/useSsr.d.ts +2 -0
- package/hooks/useSsr.js +8 -0
- package/index.d.ts +8 -2
- package/package.json +4 -2
- package/providers/ComponentsProvider.d.ts +26 -0
- package/providers/ComponentsProvider.js +28 -0
- package/providers/ScreenProvider.d.ts +20 -0
- package/providers/ScreenProvider.js +87 -0
- package/providers/SsrProvider.d.ts +17 -0
- package/providers/SsrProvider.js +32 -0
- package/providers/index.d.ts +4 -0
- package/providers/index.js +12 -0
- package/reducers/form.d.ts +1 -1
- package/reducers/form.js +1 -1
- package/reducers/list.js +1 -3
- package/reducers/router.js +1 -1
- package/ui/content/Alert/Alert.d.ts +50 -0
- package/ui/content/Alert/Alert.js +39 -0
- package/ui/content/Alert/index.d.ts +2 -0
- package/ui/content/Alert/index.js +7 -0
- package/ui/content/Avatar/Avatar.d.ts +53 -12
- package/ui/content/Avatar/Avatar.js +25 -4
- package/ui/content/Avatar/index.d.ts +6 -1
- package/ui/content/Avatar/index.js +4 -0
- package/ui/content/Card/Card.d.ts +61 -13
- package/ui/content/Card/Card.js +3 -2
- package/ui/content/Collapse/Collapse.d.ts +63 -0
- package/ui/content/Collapse/Collapse.js +75 -0
- package/ui/content/Collapse/CollapseItem.d.ts +67 -0
- package/ui/content/Collapse/CollapseItem.js +22 -0
- package/ui/content/Collapse/index.d.ts +7 -0
- package/ui/content/Collapse/index.js +8 -0
- package/ui/content/index.d.ts +13 -0
- package/ui/content/index.js +22 -0
- package/ui/crud/Crud/Crud.d.ts +1 -1
- package/ui/crud/index.d.ts +1 -0
- package/ui/form/Button/Button.d.ts +1 -0
- package/ui/form/Button/Button.js +1 -0
- package/ui/form/DropDownField/DropDownField.js +4 -2
- package/ui/form/Form/Form.js +1 -1
- package/ui/form/InputField/InputField.d.ts +7 -0
- package/ui/form/InputField/InputField.js +1 -0
- package/ui/form/TextField/TextField.d.ts +2 -1
- package/ui/form/TextField/TextField.js +1 -1
- package/ui/icon/Icon/Icon.js +3 -0
- package/ui/layout/Meta/Meta.d.ts +56 -0
- package/ui/layout/Meta/Meta.js +38 -0
- package/ui/layout/Meta/index.d.ts +2 -0
- package/ui/layout/Meta/index.js +7 -0
- package/ui/layout/Notifications/Notifications.js +1 -1
- package/ui/layout/Portal.js +3 -0
- package/ui/layout/ProgressBar/ProgressBar.d.ts +55 -0
- package/ui/layout/ProgressBar/ProgressBar.js +52 -0
- package/ui/layout/ProgressBar/index.d.ts +2 -0
- package/ui/layout/ProgressBar/index.js +7 -0
- package/ui/layout/Skeleton/Skeleton.d.ts +25 -0
- package/ui/layout/Skeleton/Skeleton.js +11 -0
- package/ui/layout/Skeleton/index.d.ts +2 -0
- package/ui/layout/Skeleton/index.js +7 -0
- package/ui/list/Steps/Steps.d.ts +32 -0
- package/ui/list/Steps/Steps.js +23 -0
- package/ui/list/Steps/index.d.ts +2 -0
- package/ui/list/Steps/index.js +7 -0
- package/ui/nav/Router/Router.d.ts +13 -0
- package/ui/nav/Router/Router.js +1 -1
- package/ui/content/Avatar/SizeContext.d.ts +0 -1
- package/ui/content/Avatar/SizeContext.js +0 -14
- package/ui/nav/Router/SsrProvider.d.ts +0 -15
- package/ui/nav/Router/SsrProvider.js +0 -55
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steroidsjs/core",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.19",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Vladimir Kozhin <hello@kozhindev.com>",
|
|
6
6
|
"repository": {
|
|
@@ -44,13 +44,15 @@
|
|
|
44
44
|
"react-dom": "^17.0.2",
|
|
45
45
|
"react-grid-gallery": "^0.4.8",
|
|
46
46
|
"react-image-crop": "^9.0.2",
|
|
47
|
+
"react-helmet": "^6.1.0",
|
|
47
48
|
"react-input-mask": "^3.0.0-alpha.2",
|
|
48
49
|
"react-redux": "^7.1.1",
|
|
49
50
|
"react-router": "^5.2.0",
|
|
50
51
|
"react-router-dom": "^5.2.0",
|
|
51
52
|
"react-use": "^17.1.0",
|
|
52
53
|
"redux": "^4.0.4",
|
|
53
|
-
"redux-mock-store": "^1.5.4"
|
|
54
|
+
"redux-mock-store": "^1.5.4",
|
|
55
|
+
"set-cookie-parser": "^2.4.8"
|
|
54
56
|
},
|
|
55
57
|
"devDependencies": {
|
|
56
58
|
"@babel/cli": "^7.13.14",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
SteroidsComponents: IComponents;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export interface IComponents {
|
|
9
|
+
api?: any;
|
|
10
|
+
clientStorage?: any;
|
|
11
|
+
html?: any;
|
|
12
|
+
http?: any;
|
|
13
|
+
locale?: any;
|
|
14
|
+
store?: any;
|
|
15
|
+
ui?: any;
|
|
16
|
+
resource?: any;
|
|
17
|
+
ws?: any;
|
|
18
|
+
pushNotification?: any;
|
|
19
|
+
meta?: any;
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
}
|
|
22
|
+
export interface IComponentsProviderProps extends PropsWithChildren<any> {
|
|
23
|
+
components: IComponents;
|
|
24
|
+
}
|
|
25
|
+
export declare const ComponentsContext: React.Context<IComponents>;
|
|
26
|
+
export default function ComponentsProvider(props: IComponentsProviderProps): JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
exports.__esModule = true;
|
|
22
|
+
exports.ComponentsContext = void 0;
|
|
23
|
+
var React = __importStar(require("react"));
|
|
24
|
+
exports.ComponentsContext = React.createContext({});
|
|
25
|
+
function ComponentsProvider(props) {
|
|
26
|
+
return (React.createElement(exports.ComponentsContext.Provider, { value: props.components }, props.children));
|
|
27
|
+
}
|
|
28
|
+
exports["default"] = ComponentsProvider;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
export interface IScreen {
|
|
4
|
+
width: number;
|
|
5
|
+
media: Record<string, any>;
|
|
6
|
+
setMedia: any;
|
|
7
|
+
isPhone: () => boolean;
|
|
8
|
+
isTablet: () => boolean;
|
|
9
|
+
isDesktop: () => boolean;
|
|
10
|
+
getDeviceType: () => string;
|
|
11
|
+
}
|
|
12
|
+
export declare const ScreenContext: React.Context<IScreen>;
|
|
13
|
+
export interface IScreenProviderProps extends PropsWithChildren<any> {
|
|
14
|
+
media?: Record<string, any>;
|
|
15
|
+
skipTimeout?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const SCREEN_PHONE = "phone";
|
|
18
|
+
export declare const SCREEN_TABLET = "tablet";
|
|
19
|
+
export declare const SCREEN_DESKTOP = "desktop";
|
|
20
|
+
export default function ScreenProvider(props: IScreenProviderProps): JSX.Element;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
exports.__esModule = true;
|
|
22
|
+
exports.SCREEN_DESKTOP = exports.SCREEN_TABLET = exports.SCREEN_PHONE = exports.ScreenContext = void 0;
|
|
23
|
+
var React = __importStar(require("react"));
|
|
24
|
+
var react_1 = require("react");
|
|
25
|
+
var react_use_1 = require("react-use");
|
|
26
|
+
exports.ScreenContext = React.createContext({});
|
|
27
|
+
exports.SCREEN_PHONE = 'phone';
|
|
28
|
+
exports.SCREEN_TABLET = 'tablet';
|
|
29
|
+
exports.SCREEN_DESKTOP = 'desktop';
|
|
30
|
+
function ScreenProvider(props) {
|
|
31
|
+
var _a;
|
|
32
|
+
var _b = react_1.useState(!process.env.IS_SSR ? window.innerWidth : 1280), width = _b[0], setWidth = _b[1];
|
|
33
|
+
var _c = react_1.useState(props.media || (_a = {},
|
|
34
|
+
_a[exports.SCREEN_PHONE] = 320,
|
|
35
|
+
_a[exports.SCREEN_TABLET] = 768,
|
|
36
|
+
_a[exports.SCREEN_DESKTOP] = 1024,
|
|
37
|
+
_a)), media = _c[0], setMedia = _c[1];
|
|
38
|
+
var timer = null;
|
|
39
|
+
var onResize = function () {
|
|
40
|
+
if (timer) {
|
|
41
|
+
clearTimeout(timer);
|
|
42
|
+
}
|
|
43
|
+
if (props.skipTimeout) {
|
|
44
|
+
setWidth(window.innerWidth);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
timer = setTimeout(function () { return setWidth(window.innerWidth); }, 100);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
react_use_1.useMount(function () {
|
|
51
|
+
window.addEventListener('resize', onResize, false);
|
|
52
|
+
});
|
|
53
|
+
react_use_1.useUnmount(function () {
|
|
54
|
+
window.removeEventListener('resize', onResize);
|
|
55
|
+
});
|
|
56
|
+
var getDeviceType = react_1.useCallback(function () {
|
|
57
|
+
if (width < media[exports.SCREEN_TABLET]) {
|
|
58
|
+
return exports.SCREEN_PHONE;
|
|
59
|
+
}
|
|
60
|
+
if (width < media[exports.SCREEN_DESKTOP]) {
|
|
61
|
+
return exports.SCREEN_TABLET;
|
|
62
|
+
}
|
|
63
|
+
return exports.SCREEN_DESKTOP;
|
|
64
|
+
}, [width, media]);
|
|
65
|
+
var isPhone = react_1.useCallback(function () { return getDeviceType() === exports.SCREEN_PHONE; }, [getDeviceType]);
|
|
66
|
+
var isTablet = react_1.useCallback(function () { return getDeviceType() === exports.SCREEN_TABLET; }, [getDeviceType]);
|
|
67
|
+
var isDesktop = react_1.useCallback(function () { return getDeviceType() === exports.SCREEN_DESKTOP; }, [getDeviceType]);
|
|
68
|
+
var value = react_1.useMemo(function () { return ({
|
|
69
|
+
width: width,
|
|
70
|
+
media: media,
|
|
71
|
+
setMedia: setMedia,
|
|
72
|
+
isPhone: isPhone,
|
|
73
|
+
isTablet: isTablet,
|
|
74
|
+
isDesktop: isDesktop,
|
|
75
|
+
getDeviceType: getDeviceType
|
|
76
|
+
}); }, [
|
|
77
|
+
width,
|
|
78
|
+
media,
|
|
79
|
+
setMedia,
|
|
80
|
+
isPhone,
|
|
81
|
+
isTablet,
|
|
82
|
+
isDesktop,
|
|
83
|
+
getDeviceType,
|
|
84
|
+
]);
|
|
85
|
+
return (React.createElement(exports.ScreenContext.Provider, { value: value }, props.children));
|
|
86
|
+
}
|
|
87
|
+
exports["default"] = ScreenProvider;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
import { StaticRouterContext } from 'react-router';
|
|
4
|
+
export interface IPreloadedData {
|
|
5
|
+
[configId: string]: any;
|
|
6
|
+
}
|
|
7
|
+
export interface ISsr {
|
|
8
|
+
history?: {
|
|
9
|
+
initialEntries: string[];
|
|
10
|
+
};
|
|
11
|
+
staticContext?: StaticRouterContext;
|
|
12
|
+
preloadedData?: IPreloadedData;
|
|
13
|
+
}
|
|
14
|
+
export declare const SsrProviderContext: React.Context<ISsr>;
|
|
15
|
+
export interface ISsrProviderProps extends ISsr, PropsWithChildren<any> {
|
|
16
|
+
}
|
|
17
|
+
export default function SsrProvider(props: ISsrProviderProps): JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
exports.__esModule = true;
|
|
22
|
+
exports.SsrProviderContext = void 0;
|
|
23
|
+
var React = __importStar(require("react"));
|
|
24
|
+
exports.SsrProviderContext = React.createContext(null);
|
|
25
|
+
function SsrProvider(props) {
|
|
26
|
+
return (React.createElement(exports.SsrProviderContext.Provider, { value: {
|
|
27
|
+
history: props.history,
|
|
28
|
+
staticContext: props.staticContext,
|
|
29
|
+
preloadedData: props.preloadedData
|
|
30
|
+
} }, props.children));
|
|
31
|
+
}
|
|
32
|
+
exports["default"] = SsrProvider;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import SsrProvider from '@steroidsjs/core/providers/SsrProvider';
|
|
2
|
+
import ScreenProvider from '@steroidsjs/core/providers/ScreenProvider';
|
|
3
|
+
import ComponentsProvider from '@steroidsjs/core/providers/ComponentsProvider';
|
|
4
|
+
export { SsrProvider, ScreenProvider, ComponentsProvider };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.ComponentsProvider = exports.ScreenProvider = exports.SsrProvider = void 0;
|
|
7
|
+
var SsrProvider_1 = __importDefault(require("@steroidsjs/core/providers/SsrProvider"));
|
|
8
|
+
exports.SsrProvider = SsrProvider_1["default"];
|
|
9
|
+
var ScreenProvider_1 = __importDefault(require("@steroidsjs/core/providers/ScreenProvider"));
|
|
10
|
+
exports.ScreenProvider = ScreenProvider_1["default"];
|
|
11
|
+
var ComponentsProvider_1 = __importDefault(require("@steroidsjs/core/providers/ComponentsProvider"));
|
|
12
|
+
exports.ComponentsProvider = ComponentsProvider_1["default"];
|
package/reducers/form.d.ts
CHANGED
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* @param action
|
|
5
5
|
*/
|
|
6
6
|
export declare function reducerItem(state: any, action: any): any;
|
|
7
|
-
declare const _default: (state: {}, action: any) =>
|
|
7
|
+
declare const _default: (state: {}, action: any) => any;
|
|
8
8
|
export default _default;
|
|
9
9
|
export declare const formSelector: (state: any, formId: any, selector: any) => any;
|
package/reducers/form.js
CHANGED
|
@@ -60,7 +60,7 @@ var initialState = {};
|
|
|
60
60
|
exports["default"] = (function (state, action) {
|
|
61
61
|
if (state === void 0) { state = initialState; }
|
|
62
62
|
if (action.formId) {
|
|
63
|
-
state
|
|
63
|
+
return dot_prop_immutable_1.set(state, action.formId, reducerItem(state[action.formId], action));
|
|
64
64
|
}
|
|
65
65
|
return state;
|
|
66
66
|
});
|
package/reducers/list.js
CHANGED
|
@@ -32,9 +32,7 @@ var reducerMap = (_a = {},
|
|
|
32
32
|
},
|
|
33
33
|
_a[list_1.LIST_SET_ITEMS] = function (state, action) {
|
|
34
34
|
var _a;
|
|
35
|
-
return (__assign(__assign({}, state), { lists: __assign(__assign({}, state.lists), (_a = {}, _a[action.listId] = {
|
|
36
|
-
items: action.items
|
|
37
|
-
}, _a)) }));
|
|
35
|
+
return (__assign(__assign({}, state), { lists: __assign(__assign({}, state.lists), (_a = {}, _a[action.listId] = __assign(__assign({}, state.lists[action.listId]), { items: action.items }), _a)) }));
|
|
38
36
|
},
|
|
39
37
|
_a[list_1.LIST_BEFORE_FETCH] = function (state, action) {
|
|
40
38
|
var _a;
|
package/reducers/router.js
CHANGED
|
@@ -95,7 +95,7 @@ exports.buildUrl = buildUrl;
|
|
|
95
95
|
*/
|
|
96
96
|
var checkIsActive = function (state, item) {
|
|
97
97
|
// Check is active
|
|
98
|
-
var pathname = window.location.protocol === 'file:'
|
|
98
|
+
var pathname = !process.env.IS_SSR && window.location.protocol === 'file:'
|
|
99
99
|
? window.location.hash.replace(/^#/, '')
|
|
100
100
|
: get_1["default"](state, 'location.pathname');
|
|
101
101
|
var checkActive = function (subPathname, subItem) {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface IAlertProps {
|
|
3
|
+
view?: any;
|
|
4
|
+
className?: CssClassName;
|
|
5
|
+
/**
|
|
6
|
+
* Дочерние элементы
|
|
7
|
+
*/
|
|
8
|
+
action?: React.ReactNode;
|
|
9
|
+
type: 'success' | 'info' | 'warning' | 'error' | string;
|
|
10
|
+
/** Основное сообщения Оповещения
|
|
11
|
+
* @example {'Sending is confirmed!'}
|
|
12
|
+
*/
|
|
13
|
+
message: string;
|
|
14
|
+
/** Дополнительное содрежание сообщения.
|
|
15
|
+
* @example {'Please, check your email.'}
|
|
16
|
+
*/
|
|
17
|
+
description?: string;
|
|
18
|
+
style?: React.CSSProperties;
|
|
19
|
+
showClose?: boolean;
|
|
20
|
+
showIcon?: boolean | string;
|
|
21
|
+
/**
|
|
22
|
+
* Callback функция вызываемая при нажатии на кнопку закрытия
|
|
23
|
+
* @example {() => console.log('this is callback')}
|
|
24
|
+
*/
|
|
25
|
+
onClose?: () => void;
|
|
26
|
+
animation?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Время анимации в миллисекундах
|
|
29
|
+
* @example {1000}
|
|
30
|
+
*/
|
|
31
|
+
animationDuration?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface IAlertViewProps extends IAlertProps {
|
|
34
|
+
isExist: boolean;
|
|
35
|
+
isVisible: boolean;
|
|
36
|
+
onClose: () => void;
|
|
37
|
+
onClick?: (e: MouseEvent) => void;
|
|
38
|
+
}
|
|
39
|
+
declare function Alert(props: IAlertProps): JSX.Element;
|
|
40
|
+
declare namespace Alert {
|
|
41
|
+
var defaultProps: {
|
|
42
|
+
type: string;
|
|
43
|
+
message: string;
|
|
44
|
+
showClose: boolean;
|
|
45
|
+
showIcon: boolean;
|
|
46
|
+
animation: boolean;
|
|
47
|
+
animationDuration: number;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export default Alert;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
exports.__esModule = true;
|
|
14
|
+
var react_1 = require("react");
|
|
15
|
+
var hooks_1 = require("@steroidsjs/core/hooks");
|
|
16
|
+
function Alert(props) {
|
|
17
|
+
var components = hooks_1.useComponents();
|
|
18
|
+
var _a = react_1.useState(true), isExist = _a[0], setIsExist = _a[1];
|
|
19
|
+
var _b = react_1.useState(true), isVisible = _b[0], setIsVisible = _b[1];
|
|
20
|
+
var onClose = react_1.useCallback(function () {
|
|
21
|
+
setIsVisible(false);
|
|
22
|
+
setTimeout(function () { return setIsExist(false); }, props.animationDuration);
|
|
23
|
+
if (props.onClose) {
|
|
24
|
+
props.onClose();
|
|
25
|
+
}
|
|
26
|
+
}, []);
|
|
27
|
+
return components.ui.renderView(props.view || 'content.AlertView', __assign(__assign({}, props), { isExist: isExist,
|
|
28
|
+
isVisible: isVisible,
|
|
29
|
+
onClose: onClose }));
|
|
30
|
+
}
|
|
31
|
+
Alert.defaultProps = {
|
|
32
|
+
type: 'success',
|
|
33
|
+
message: 'Message',
|
|
34
|
+
showClose: false,
|
|
35
|
+
showIcon: true,
|
|
36
|
+
animation: false,
|
|
37
|
+
animationDuration: 390
|
|
38
|
+
};
|
|
39
|
+
exports["default"] = Alert;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
var Alert_1 = __importDefault(require("./Alert"));
|
|
7
|
+
exports["default"] = Alert_1["default"];
|
|
@@ -1,24 +1,65 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
interface IAvatarProps {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Альтернативный текст для изображения
|
|
4
|
+
* @example {'default image'}
|
|
5
|
+
*/
|
|
7
6
|
alt?: string;
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Дополнительный CSS-класс
|
|
9
|
+
*/
|
|
10
10
|
className?: CssClassName;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Дочерние элементы
|
|
13
|
+
*/
|
|
14
|
+
children?: CustomView;
|
|
15
|
+
/**
|
|
16
|
+
* Размер аватара
|
|
17
|
+
* @example {'md'}
|
|
18
|
+
*/
|
|
19
|
+
size?: Size | 'x-large' | number;
|
|
20
|
+
/**
|
|
21
|
+
* Форма аватара
|
|
22
|
+
* @example {'circle'}
|
|
23
|
+
*/
|
|
24
|
+
shape?: 'circle' | 'square' | string;
|
|
25
|
+
/**
|
|
26
|
+
* Ссылка на изображение для аватара
|
|
27
|
+
* @example {'https://user/avatar.png'}
|
|
28
|
+
*/
|
|
29
|
+
src?: string;
|
|
30
|
+
srcSet?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Статус онлайна
|
|
33
|
+
* @example {true}
|
|
34
|
+
*/
|
|
35
|
+
status?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Объект CSS стилей
|
|
38
|
+
* @example {width: '30px'}
|
|
39
|
+
*/
|
|
40
|
+
style?: CustomStyle;
|
|
41
|
+
/**
|
|
42
|
+
* Заголовок аватарки
|
|
43
|
+
* @example {'Avatar'}
|
|
44
|
+
*/
|
|
45
|
+
title?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Переопределение view React компонента для кастомизации отображения
|
|
48
|
+
* @example MyCustomView
|
|
49
|
+
*/
|
|
50
|
+
view?: CustomView;
|
|
51
|
+
}
|
|
52
|
+
export interface IAvatarViewProps extends IAvatarProps {
|
|
53
|
+
isError: boolean;
|
|
54
|
+
onError: () => void;
|
|
55
|
+
formattedTitle: () => void;
|
|
14
56
|
}
|
|
15
|
-
export declare type IAvatarViewProps = IAvatarProps;
|
|
16
|
-
export declare type Size = 'large' | 'medium' | 'small' | number;
|
|
17
57
|
declare function Avatar(props: IAvatarProps): any;
|
|
18
58
|
declare namespace Avatar {
|
|
19
59
|
var defaultProps: {
|
|
20
60
|
size: string;
|
|
21
61
|
shape: string;
|
|
62
|
+
status: boolean;
|
|
22
63
|
};
|
|
23
64
|
}
|
|
24
65
|
export default Avatar;
|
|
@@ -11,13 +11,34 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
exports.__esModule = true;
|
|
14
|
-
var
|
|
14
|
+
var react_1 = require("react");
|
|
15
|
+
var hooks_1 = require("@steroidsjs/core/hooks");
|
|
15
16
|
function Avatar(props) {
|
|
16
17
|
var components = hooks_1.useComponents();
|
|
17
|
-
|
|
18
|
+
var _a = react_1.useState(false), isError = _a[0], setIsError = _a[1];
|
|
19
|
+
var onError = react_1.useCallback(function () {
|
|
20
|
+
if (!isError) {
|
|
21
|
+
setIsError(true);
|
|
22
|
+
}
|
|
23
|
+
}, [isError]);
|
|
24
|
+
var formattedTitle = react_1.useMemo(function () {
|
|
25
|
+
var resultTitle = '';
|
|
26
|
+
if (props.title) {
|
|
27
|
+
var title = props.title.split(' ');
|
|
28
|
+
resultTitle = title[0][0].toUpperCase();
|
|
29
|
+
if (title.length > 1) {
|
|
30
|
+
resultTitle += title[1][0].toUpperCase();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return resultTitle;
|
|
34
|
+
}, [props.title]);
|
|
35
|
+
return components.ui.renderView(props.view || 'content.AvatarView', __assign(__assign({}, props), { isError: isError,
|
|
36
|
+
onError: onError,
|
|
37
|
+
formattedTitle: formattedTitle }));
|
|
18
38
|
}
|
|
19
39
|
Avatar.defaultProps = {
|
|
20
|
-
size: '
|
|
21
|
-
shape: 'circle'
|
|
40
|
+
size: 'middle',
|
|
41
|
+
shape: 'circle',
|
|
42
|
+
status: false
|
|
22
43
|
};
|
|
23
44
|
exports["default"] = Avatar;
|
|
@@ -8,3 +8,7 @@ var Avatar_1 = __importDefault(require("./Avatar"));
|
|
|
8
8
|
exports.Avatar = Avatar_1["default"];
|
|
9
9
|
var AvatarGroup_1 = __importDefault(require("./AvatarGroup"));
|
|
10
10
|
exports.AvatarGroup = AvatarGroup_1["default"];
|
|
11
|
+
exports["default"] = {
|
|
12
|
+
Avatar: Avatar_1["default"],
|
|
13
|
+
AvatarGroup: AvatarGroup_1["default"]
|
|
14
|
+
};
|
|
@@ -1,24 +1,72 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
interface ICardProps {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Цвет границы (если передать false, то граница будет скрыта)
|
|
4
|
+
* @example success
|
|
5
|
+
*/
|
|
6
|
+
borderColor?: ColorName | 'default' | boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Дополнительный CSS-класс
|
|
9
|
+
*/
|
|
8
10
|
className?: CssClassName;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Дочерние элементы
|
|
13
|
+
*/
|
|
14
|
+
children?: CustomView;
|
|
15
|
+
/**
|
|
16
|
+
* Цвет состояния
|
|
17
|
+
* @example success
|
|
18
|
+
*/
|
|
19
|
+
color?: ColorName;
|
|
20
|
+
/**
|
|
21
|
+
* Обложка для карточки, нужно передать ссылку на изображение
|
|
22
|
+
* @example 'https://cat/cat.png'
|
|
23
|
+
*/
|
|
24
|
+
cover?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Описание карточки
|
|
27
|
+
* @example {'Scroll to see more...'}
|
|
28
|
+
*/
|
|
29
|
+
description?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Текст для header
|
|
32
|
+
*/
|
|
33
|
+
header?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Текст для footer
|
|
36
|
+
*/
|
|
37
|
+
footer?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Ориентация карточки, горизонтальная и вертикальная
|
|
40
|
+
* @example {'vertical-reverse'}
|
|
41
|
+
*/
|
|
42
|
+
orientation?: 'vertical' | 'vertical-reverse' | 'horizontal';
|
|
43
|
+
/**
|
|
44
|
+
* Ориентация карточки, горизонтальная и вертикальная
|
|
45
|
+
* @example {'vertical-reverse'}
|
|
46
|
+
*/
|
|
13
47
|
shape?: 'square' | 'circle';
|
|
14
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Объект CSS стилей
|
|
50
|
+
* @example {width: '30px'}
|
|
51
|
+
*/
|
|
52
|
+
style?: CustomStyle;
|
|
53
|
+
/**
|
|
54
|
+
* Заголовок карточки
|
|
55
|
+
* @example {'Main card'}
|
|
56
|
+
*/
|
|
57
|
+
title?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Переопределение view React компонента для кастомизации отображения
|
|
60
|
+
* @example MyCustomView
|
|
61
|
+
*/
|
|
62
|
+
view?: CustomView;
|
|
15
63
|
}
|
|
16
64
|
export declare type ICardViewProps = ICardProps;
|
|
17
|
-
export declare type Size = 'large' | 'medium' | 'small';
|
|
18
65
|
declare function Card(props: ICardProps): any;
|
|
19
66
|
declare namespace Card {
|
|
20
67
|
var defaultProps: {
|
|
21
|
-
|
|
68
|
+
borderColor: string;
|
|
69
|
+
orientation: string;
|
|
22
70
|
shape: string;
|
|
23
71
|
};
|
|
24
72
|
}
|
package/ui/content/Card/Card.js
CHANGED
|
@@ -11,13 +11,14 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
exports.__esModule = true;
|
|
14
|
-
var hooks_1 = require("
|
|
14
|
+
var hooks_1 = require("@steroidsjs/core/hooks");
|
|
15
15
|
function Card(props) {
|
|
16
16
|
var components = hooks_1.useComponents();
|
|
17
17
|
return components.ui.renderView(props.view || 'content.CardView', __assign({}, props));
|
|
18
18
|
}
|
|
19
19
|
Card.defaultProps = {
|
|
20
|
-
|
|
20
|
+
borderColor: 'default',
|
|
21
|
+
orientation: 'vertical',
|
|
21
22
|
shape: 'circle'
|
|
22
23
|
};
|
|
23
24
|
exports["default"] = Card;
|