@veracity/vui 0.0.15 → 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/avatar/avatar.js +2 -2
- package/box/box.js +1 -1
- package/button/button.d.ts +7 -1
- package/button/button.js +56 -23
- package/button/button.types.d.ts +8 -6
- package/button/buttonIcon.d.ts +3 -0
- package/{alert/alertText.js → button/buttonIcon.js} +9 -9
- package/button/buttonText.d.ts +3 -0
- package/button/buttonText.js +30 -0
- package/button/buttons.d.ts +4 -3
- package/button/buttons.js +4 -3
- package/button/consts.js +3 -2
- package/button/context.d.ts +2 -2
- package/button/context.js +4 -4
- package/button/index.d.ts +2 -2
- package/button/index.js +2 -2
- package/button/theme.d.ts +79 -41
- package/button/theme.js +85 -46
- package/{button → buttonGroup}/buttonGroup.d.ts +3 -1
- package/{button → buttonGroup}/buttonGroup.js +4 -2
- package/buttonGroup/context.d.ts +4 -0
- package/buttonGroup/context.js +23 -0
- package/buttonGroup/helpers.d.ts +3 -0
- package/buttonGroup/helpers.js +10 -0
- package/buttonGroup/index.d.ts +4 -0
- package/{alert → buttonGroup}/index.js +4 -8
- package/card/card.d.ts +3 -0
- package/{tile/tile.js → card/card.js} +8 -7
- package/{tile/tile.types.d.ts → card/card.types.d.ts} +1 -1
- package/card/index.d.ts +3 -0
- package/{tile → card}/index.js +4 -4
- package/card/theme.d.ts +6 -0
- package/card/theme.js +10 -0
- package/checkbox/checkbox.js +4 -4
- package/checkbox/checkbox.types.d.ts +1 -1
- package/checkbox/checkboxGroup.types.d.ts +1 -1
- package/core/globalStyle.d.ts +4 -1
- package/core/globalStyle.js +7 -3
- package/core/index.d.ts +2 -0
- package/core/index.js +5 -1
- package/core/styled.d.ts +4 -0
- package/core/styled.js +80 -0
- package/core/types/component.d.ts +12 -12
- package/core/types/index.d.ts +1 -0
- package/core/types/index.js +1 -0
- package/core/types/styled.d.ts +11 -0
- package/core/utils.d.ts +2 -2
- package/core/utils.js +7 -7
- package/core/v.d.ts +182 -0
- package/core/v.js +6 -0
- package/core/vuiProvider.d.ts +13 -2
- package/core/vuiProvider.js +1 -1
- package/divider/divider.types.d.ts +1 -1
- package/heading/heading.types.d.ts +2 -1
- package/icon/helpers.d.ts +2 -3
- package/icon/helpers.js +6 -8
- package/icon/icon.js +3 -2
- package/icon/icon.types.d.ts +4 -2
- package/icons/library.js +1 -1
- package/icons/types.d.ts +1 -1
- package/image/image.d.ts +3 -0
- package/image/image.js +38 -0
- package/image/image.types.d.ts +5 -0
- package/image/index.d.ts +3 -0
- package/{label → image}/index.js +4 -4
- package/image/theme.d.ts +6 -0
- package/image/theme.js +10 -0
- package/index.d.ts +6 -3
- package/index.js +6 -3
- package/input/context.d.ts +4 -0
- package/{alert → input}/context.js +4 -4
- package/input/index.d.ts +2 -0
- package/input/index.js +2 -0
- package/input/input.d.ts +7 -2
- package/input/input.js +33 -22
- package/input/input.types.d.ts +7 -3
- package/input/inputIcon.d.ts +3 -0
- package/input/inputIcon.js +30 -0
- package/input/inputInput.d.ts +5 -0
- package/input/inputInput.js +36 -0
- package/input/theme.d.ts +40 -15
- package/input/theme.js +40 -16
- package/list/index.d.ts +3 -1
- package/list/index.js +3 -1
- package/list/list.d.ts +2 -0
- package/list/list.js +3 -1
- package/list/list.types.d.ts +19 -1
- package/list/listHeading.d.ts +2 -2
- package/list/listHeading.js +2 -2
- package/list/listIcon.js +1 -1
- package/list/listItem.d.ts +1 -1
- package/list/listItem.js +8 -5
- package/list/listText.d.ts +3 -0
- package/list/listText.js +30 -0
- package/list/theme.d.ts +20 -6
- package/list/theme.js +26 -12
- package/notification/consts.d.ts +2 -0
- package/{alert → notification}/consts.js +7 -7
- package/notification/context.d.ts +4 -0
- package/notification/context.js +23 -0
- package/notification/index.d.ts +8 -0
- package/notification/index.js +25 -0
- package/notification/notification.d.ts +13 -0
- package/{alert/alert.js → notification/notification.js} +25 -25
- package/notification/notification.types.d.ts +20 -0
- package/notification/notificationButton.d.ts +3 -0
- package/{alert/alertButton.js → notification/notificationButton.js} +8 -8
- package/notification/notificationIcon.d.ts +3 -0
- package/{alert/alertIcon.js → notification/notificationIcon.js} +9 -9
- package/notification/notificationText.d.ts +3 -0
- package/notification/notificationText.js +30 -0
- package/notification/notificationTitle.d.ts +3 -0
- package/notification/notificationTitle.js +30 -0
- package/{alert → notification}/theme.d.ts +0 -15
- package/{alert → notification}/theme.js +1 -22
- package/package.json +2 -3
- package/panel/index.d.ts +3 -0
- package/panel/index.js +20 -0
- package/panel/panel.d.ts +3 -0
- package/panel/panel.js +39 -0
- package/panel/panel.types.d.ts +4 -0
- package/{tile → panel}/theme.d.ts +1 -8
- package/{tile → panel}/theme.js +4 -11
- package/radio/radio.js +4 -4
- package/radio/radio.types.d.ts +1 -1
- package/radio/radioGroup.types.d.ts +1 -1
- package/skeleton/skeleton.types.d.ts +1 -0
- package/spinner/spinner.types.d.ts +1 -0
- package/svg/cache.js +1 -5
- package/svg/svg.js +2 -3
- package/switch/index.d.ts +0 -1
- package/switch/index.js +0 -1
- package/switch/switch.js +6 -6
- package/switch/switch.types.d.ts +19 -4
- package/switch/switchButton.d.ts +2 -2
- package/switch/switchButton.js +18 -19
- package/switch/theme.d.ts +41 -46
- package/switch/theme.js +50 -72
- package/system/borders.d.ts +3 -1
- package/system/custom.d.ts +24 -7
- package/system/custom.js +33 -13
- package/system/system.d.ts +2 -2
- package/system/system.js +1 -1
- package/t/t.types.d.ts +2 -1
- package/tag/context.d.ts +4 -0
- package/tag/context.js +23 -0
- package/tag/index.d.ts +6 -0
- package/tag/index.js +23 -0
- package/tag/tag.d.ts +11 -0
- package/tag/tag.js +99 -0
- package/{label/label.types.d.ts → tag/tag.types.d.ts} +6 -7
- package/tag/tag.types.js +2 -0
- package/tag/tagIcon.d.ts +3 -0
- package/{alert/alertTitle.js → tag/tagIcon.js} +9 -9
- package/tag/tagText.d.ts +3 -0
- package/tag/tagText.js +30 -0
- package/tag/theme.d.ts +65 -0
- package/tag/theme.js +78 -0
- package/textarea/textarea.js +2 -1
- package/textarea/textarea.types.d.ts +1 -0
- package/theme/components.d.ts +291 -223
- package/theme/components.js +32 -28
- package/theme/defaultTheme.d.ts +291 -223
- package/utils/assertion.d.ts +14 -0
- package/utils/assertion.js +34 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/utils/object.d.ts +5 -18
- package/utils/object.js +17 -50
- package/utils/types.d.ts +2 -0
- package/alert/alert.d.ts +0 -13
- package/alert/alert.types.d.ts +0 -20
- package/alert/alertButton.d.ts +0 -3
- package/alert/alertIcon.d.ts +0 -3
- package/alert/alertText.d.ts +0 -3
- package/alert/alertTitle.d.ts +0 -3
- package/alert/consts.d.ts +0 -2
- package/alert/context.d.ts +0 -4
- package/alert/index.d.ts +0 -8
- package/label/index.d.ts +0 -3
- package/label/label.d.ts +0 -5
- package/label/label.js +0 -71
- package/label/theme.d.ts +0 -61
- package/label/theme.js +0 -107
- package/list/listItem.types.d.ts +0 -16
- package/switch/switchButton.types.d.ts +0 -19
- package/tile/index.d.ts +0 -3
- package/tile/tile.d.ts +0 -3
- /package/{button → buttonGroup}/buttonGroup.types.d.ts +0 -0
- /package/{button → buttonGroup}/buttonGroup.types.js +0 -0
- /package/{alert/alert.types.js → card/card.types.js} +0 -0
- /package/{label/label.types.js → core/types/styled.js} +0 -0
- /package/{list/listItem.types.js → image/image.types.js} +0 -0
- /package/{switch/switchButton.types.js → notification/notification.types.js} +0 -0
- /package/{tile/tile.types.js → panel/panel.types.js} +0 -0
package/list/listHeading.js
CHANGED
|
@@ -17,14 +17,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.ListHeading = void 0;
|
|
18
18
|
var react_1 = __importDefault(require("react"));
|
|
19
19
|
var context_1 = require("./context");
|
|
20
|
-
var listItem_1 = __importDefault(require("./listItem"));
|
|
21
20
|
var core_1 = require("../core");
|
|
21
|
+
var t_1 = require("../t");
|
|
22
22
|
exports.ListHeading = core_1.vui(function (props, ref) {
|
|
23
23
|
var _a;
|
|
24
24
|
var listProps = (_a = context_1.useList()) !== null && _a !== void 0 ? _a : {};
|
|
25
25
|
var mergedProps = __assign(__assign({}, listProps), props);
|
|
26
26
|
var styles = core_1.useStyleConfig('List', mergedProps);
|
|
27
|
-
return (react_1.default.createElement(
|
|
27
|
+
return (react_1.default.createElement(t_1.T, __assign({ className: "vui-listHeading", color: "grey.80", display: "inline-block", fontSize: "sm", px: 1, py: 0.5, ref: ref, textTransform: "uppercase", weight: "medium" }, styles.heading, props)));
|
|
28
28
|
});
|
|
29
29
|
exports.ListHeading.displayName = 'ListHeading';
|
|
30
30
|
exports.default = exports.ListHeading;
|
package/list/listIcon.js
CHANGED
|
@@ -24,7 +24,7 @@ exports.ListIcon = core_1.vui(function (props, ref) {
|
|
|
24
24
|
var listProps = (_a = context_1.useList()) !== null && _a !== void 0 ? _a : {};
|
|
25
25
|
var mergedProps = __assign(__assign({}, listProps), props);
|
|
26
26
|
var styles = core_1.useStyleConfig('List', mergedProps);
|
|
27
|
-
return react_1.default.createElement(icon_1.default, __assign({ ref: ref }, styles.icon, props));
|
|
27
|
+
return react_1.default.createElement(icon_1.default, __assign({ className: "vui-listIcon", ref: ref }, styles.icon, props));
|
|
28
28
|
});
|
|
29
29
|
exports.ListIcon.displayName = 'ListIcon';
|
|
30
30
|
exports.default = exports.ListIcon;
|
package/list/listItem.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ListItemProps } from './
|
|
1
|
+
import { ListItemProps } from './list.types';
|
|
2
2
|
import { SystemProps } from '../system';
|
|
3
3
|
export declare const ListItemBase: import("styled-components").StyledComponent<"li", import("styled-components").DefaultTheme, SystemProps, never>;
|
|
4
4
|
export declare const ListItem: import("../core").VuiComponent<"li", ListItemProps>;
|
package/list/listItem.js
CHANGED
|
@@ -34,14 +34,15 @@ var react_1 = __importDefault(require("react"));
|
|
|
34
34
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
35
35
|
var context_1 = require("./context");
|
|
36
36
|
var listIcon_1 = __importDefault(require("./listIcon"));
|
|
37
|
+
var listText_1 = __importDefault(require("./listText"));
|
|
37
38
|
var core_1 = require("../core");
|
|
38
39
|
var system_1 = require("../system");
|
|
39
40
|
var utils_1 = require("../utils");
|
|
40
|
-
exports.ListItemBase = styled_components_1.default.li.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tdisplay: flex;\n\tline-height: normal;\n\toutline: none;\n\n\t&[data-disabled='true'] {\n\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\t\tuser-select: none;\n\t}\n\n\t", "\n"], ["\n\tdisplay: flex;\n\tline-height: normal;\n\toutline: none;\n\n\t&[data-disabled='true'] {\n\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\t\tuser-select: none;\n\t}\n\n\t", "\n"])), system_1.system);
|
|
41
|
+
exports.ListItemBase = styled_components_1.default.li.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tdisplay: flex;\n\tline-height: normal;\n\tmargin-bottom: 1px;\n\toutline: none;\n\n\t&[data-disabled='true'] {\n\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\t\tuser-select: none;\n\t}\n\n\t", "\n"], ["\n\tdisplay: flex;\n\tline-height: normal;\n\tmargin-bottom: 1px;\n\toutline: none;\n\n\t&[data-disabled='true'] {\n\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\tcolor: var(--vui-colors-disabled-font);\n\t\tcursor: not-allowed;\n\t\tuser-select: none;\n\t}\n\n\t", "\n"])), system_1.system);
|
|
41
42
|
exports.ListItem = core_1.vui(function (props, ref) {
|
|
42
43
|
var listProps = context_1.useList();
|
|
43
44
|
var mergedProps = __assign(__assign({}, listProps), props);
|
|
44
|
-
var children = mergedProps.children, center = mergedProps.center, centerH = mergedProps.centerH, _a = mergedProps.centerV, centerV = _a === void 0 ? true : _a, className = mergedProps.className, column = mergedProps.column, disabled = mergedProps.disabled,
|
|
45
|
+
var children = mergedProps.children, center = mergedProps.center, centerH = mergedProps.centerH, _a = mergedProps.centerV, centerV = _a === void 0 ? true : _a, className = mergedProps.className, column = mergedProps.column, disabled = mergedProps.disabled, iconLeft = mergedProps.iconLeft, iconRight = mergedProps.iconRight, _b = mergedProps.isInteractive, isInteractive = _b === void 0 ? props.onClick !== undefined : _b, isSelected = mergedProps.isSelected, isTruncated = mergedProps.isTruncated, itemLeft = mergedProps.itemLeft, itemRight = mergedProps.itemRight, onClick = mergedProps.onClick, text = mergedProps.text, rest = __rest(mergedProps, ["children", "center", "centerH", "centerV", "className", "column", "disabled", "iconLeft", "iconRight", "isInteractive", "isSelected", "isTruncated", "itemLeft", "itemRight", "onClick", "text"]);
|
|
45
46
|
var styles = core_1.useStyleConfig('List', mergedProps);
|
|
46
47
|
var _c = styles.item, activeBg = _c.activeBg, hoverBg = _c.hoverBg, itemStyles = __rest(_c, ["activeBg", "hoverBg"]);
|
|
47
48
|
var alignItems = (center || (column ? centerH : centerV)) && 'center';
|
|
@@ -64,9 +65,11 @@ exports.ListItem = core_1.vui(function (props, ref) {
|
|
|
64
65
|
flexDirection: flexDirection,
|
|
65
66
|
justifyContent: justifyContent
|
|
66
67
|
});
|
|
67
|
-
return (react_1.default.createElement(exports.ListItemBase, __assign({ className: utils_1.cs('vui-listItem', className),
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
return (react_1.default.createElement(exports.ListItemBase, __assign({ className: utils_1.cs('vui-listItem', className), onClick: !disabled ? onClick : undefined, px: 1, ref: ref, transitionDuration: "fast" }, itemStyles, interactiveProps, aliasedProps, rest),
|
|
69
|
+
itemLeft,
|
|
70
|
+
utils_1.isString(iconLeft) ? react_1.default.createElement(listIcon_1.default, { mr: 1, name: iconLeft }) : iconLeft, children !== null && children !== void 0 ? children : (utils_1.isReactText(text) ? react_1.default.createElement(listText_1.default, { isTruncated: isTruncated, text: text }) : text),
|
|
71
|
+
utils_1.isString(iconRight) ? react_1.default.createElement(listIcon_1.default, { ml: "auto", name: iconRight }) : iconRight,
|
|
72
|
+
itemRight));
|
|
70
73
|
});
|
|
71
74
|
exports.ListItem.displayName = 'ListItem';
|
|
72
75
|
exports.default = exports.ListItem;
|
package/list/listText.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.ListText = void 0;
|
|
18
|
+
var react_1 = __importDefault(require("react"));
|
|
19
|
+
var context_1 = require("./context");
|
|
20
|
+
var core_1 = require("../core");
|
|
21
|
+
var t_1 = __importDefault(require("../t"));
|
|
22
|
+
exports.ListText = core_1.vui(function (props, ref) {
|
|
23
|
+
var _a;
|
|
24
|
+
var listProps = (_a = context_1.useList()) !== null && _a !== void 0 ? _a : {};
|
|
25
|
+
var mergedProps = __assign(__assign({}, listProps), props);
|
|
26
|
+
var styles = core_1.useStyleConfig('List', mergedProps);
|
|
27
|
+
return react_1.default.createElement(t_1.default, __assign({ className: "vui-listText", fontSize: "inherit", ref: ref }, styles.text, props));
|
|
28
|
+
});
|
|
29
|
+
exports.ListText.displayName = 'ListText';
|
|
30
|
+
exports.default = exports.ListText;
|
package/list/theme.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Dict } from '../utils';
|
|
2
2
|
declare function variantDefault(props: Dict): {
|
|
3
3
|
container: {};
|
|
4
|
+
heading: {};
|
|
4
5
|
icon: {};
|
|
5
6
|
item: Dict<any>;
|
|
7
|
+
text: {};
|
|
6
8
|
};
|
|
7
9
|
declare const _default: {
|
|
8
10
|
defaultProps: {
|
|
@@ -13,6 +15,8 @@ declare const _default: {
|
|
|
13
15
|
parts: string[];
|
|
14
16
|
sizes: {
|
|
15
17
|
sm: {
|
|
18
|
+
container: {};
|
|
19
|
+
heading: {};
|
|
16
20
|
icon: {
|
|
17
21
|
size: string;
|
|
18
22
|
};
|
|
@@ -20,8 +24,11 @@ declare const _default: {
|
|
|
20
24
|
fontSize: string;
|
|
21
25
|
h: number;
|
|
22
26
|
};
|
|
27
|
+
text: {};
|
|
23
28
|
};
|
|
24
29
|
md: {
|
|
30
|
+
container: {};
|
|
31
|
+
heading: {};
|
|
25
32
|
icon: {
|
|
26
33
|
size: string;
|
|
27
34
|
};
|
|
@@ -29,24 +36,31 @@ declare const _default: {
|
|
|
29
36
|
fontSize: string;
|
|
30
37
|
h: number;
|
|
31
38
|
};
|
|
39
|
+
text: {};
|
|
32
40
|
};
|
|
33
41
|
lg: {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
};
|
|
42
|
+
container: {};
|
|
43
|
+
heading: {};
|
|
37
44
|
item: {
|
|
38
45
|
fontSize: string;
|
|
39
46
|
h: number;
|
|
40
47
|
};
|
|
41
|
-
};
|
|
42
|
-
xl: {
|
|
43
48
|
icon: {
|
|
44
|
-
|
|
49
|
+
size: string;
|
|
45
50
|
};
|
|
51
|
+
text: {};
|
|
52
|
+
};
|
|
53
|
+
xl: {
|
|
54
|
+
container: {};
|
|
55
|
+
heading: {};
|
|
46
56
|
item: {
|
|
47
57
|
fontSize: string;
|
|
48
58
|
h: number;
|
|
49
59
|
};
|
|
60
|
+
icon: {
|
|
61
|
+
scale: number;
|
|
62
|
+
};
|
|
63
|
+
text: {};
|
|
50
64
|
};
|
|
51
65
|
};
|
|
52
66
|
variants: {
|
package/list/theme.js
CHANGED
|
@@ -8,51 +8,65 @@ function variantDefault(props) {
|
|
|
8
8
|
hoverBg: c + ".20"
|
|
9
9
|
};
|
|
10
10
|
var container = {};
|
|
11
|
+
var heading = {};
|
|
11
12
|
var icon = {};
|
|
12
|
-
|
|
13
|
+
var text = {};
|
|
14
|
+
return { container: container, heading: heading, icon: icon, item: item, text: text };
|
|
13
15
|
}
|
|
14
16
|
var defaultProps = {
|
|
15
17
|
colorScheme: 'blue',
|
|
16
18
|
size: 'md',
|
|
17
19
|
variant: 'default'
|
|
18
20
|
};
|
|
19
|
-
var parts = ['container', 'heading', 'icon', 'item'];
|
|
21
|
+
var parts = ['container', 'heading', 'icon', 'item', 'text'];
|
|
20
22
|
var sizes = {
|
|
21
23
|
sm: {
|
|
24
|
+
container: {},
|
|
25
|
+
heading: {},
|
|
22
26
|
icon: {
|
|
23
27
|
size: 'sm'
|
|
24
28
|
},
|
|
25
29
|
item: {
|
|
26
30
|
fontSize: 'md',
|
|
27
31
|
h: 32
|
|
28
|
-
}
|
|
32
|
+
},
|
|
33
|
+
text: {}
|
|
29
34
|
},
|
|
30
35
|
md: {
|
|
36
|
+
container: {},
|
|
37
|
+
heading: {},
|
|
31
38
|
icon: {
|
|
32
39
|
size: 'md'
|
|
33
40
|
},
|
|
34
41
|
item: {
|
|
35
42
|
fontSize: 'md',
|
|
36
43
|
h: 40
|
|
37
|
-
}
|
|
44
|
+
},
|
|
45
|
+
text: {}
|
|
38
46
|
},
|
|
39
47
|
lg: {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
},
|
|
48
|
+
container: {},
|
|
49
|
+
heading: {},
|
|
43
50
|
item: {
|
|
44
51
|
fontSize: 'md',
|
|
45
52
|
h: 48
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
xl: {
|
|
53
|
+
},
|
|
49
54
|
icon: {
|
|
50
|
-
|
|
55
|
+
size: 'lg'
|
|
51
56
|
},
|
|
57
|
+
text: {}
|
|
58
|
+
},
|
|
59
|
+
xl: {
|
|
60
|
+
container: {},
|
|
61
|
+
heading: {},
|
|
52
62
|
item: {
|
|
53
63
|
fontSize: 'lg',
|
|
54
64
|
h: 56
|
|
55
|
-
}
|
|
65
|
+
},
|
|
66
|
+
icon: {
|
|
67
|
+
scale: 2
|
|
68
|
+
},
|
|
69
|
+
text: {}
|
|
56
70
|
}
|
|
57
71
|
};
|
|
58
72
|
var variants = {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
3
|
+
exports.notificationStatusMapping = void 0;
|
|
4
|
+
exports.notificationStatusMapping = {
|
|
5
5
|
error: {
|
|
6
6
|
colorScheme: 'red',
|
|
7
7
|
iconProps: {
|
|
8
|
-
|
|
8
|
+
name: 'falTimesCircle'
|
|
9
9
|
}
|
|
10
10
|
},
|
|
11
11
|
info: {
|
|
12
12
|
colorScheme: 'blue',
|
|
13
13
|
iconProps: {
|
|
14
|
-
|
|
14
|
+
name: 'falInfoCircle'
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
loading: {
|
|
@@ -19,19 +19,19 @@ exports.alertStatusMapping = {
|
|
|
19
19
|
iconProps: {
|
|
20
20
|
animation: 'vui-spin 0.6s linear infinite',
|
|
21
21
|
fill: ['blue.40', 'blue.60'],
|
|
22
|
-
|
|
22
|
+
name: 'fadSpinnerThird'
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
success: {
|
|
26
26
|
colorScheme: 'green',
|
|
27
27
|
iconProps: {
|
|
28
|
-
|
|
28
|
+
name: 'falCheckCircle'
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
warning: {
|
|
32
32
|
colorScheme: 'yellow',
|
|
33
33
|
iconProps: {
|
|
34
|
-
|
|
34
|
+
name: 'falExclamationCircle'
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { NotificationProps } from './notification.types';
|
|
3
|
+
declare const NotificationProvider: import("react").Provider<Partial<NotificationProps>>, useNotification: () => Partial<NotificationProps>;
|
|
4
|
+
export { NotificationProvider, useNotification };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
+
if (!m) return o;
|
|
5
|
+
var i = m.call(o), r, ar = [], e;
|
|
6
|
+
try {
|
|
7
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
+
}
|
|
9
|
+
catch (error) { e = { error: error }; }
|
|
10
|
+
finally {
|
|
11
|
+
try {
|
|
12
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
+
}
|
|
14
|
+
finally { if (e) throw e.error; }
|
|
15
|
+
}
|
|
16
|
+
return ar;
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.useNotification = exports.NotificationProvider = void 0;
|
|
20
|
+
var core_1 = require("../core");
|
|
21
|
+
var _a = __read(core_1.createContext({ isOptional: true }), 2), NotificationProvider = _a[0], useNotification = _a[1];
|
|
22
|
+
exports.NotificationProvider = NotificationProvider;
|
|
23
|
+
exports.useNotification = useNotification;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './notification';
|
|
2
|
+
export * from './notification.types';
|
|
3
|
+
export * from './notificationButton';
|
|
4
|
+
export * from './notificationIcon';
|
|
5
|
+
export * from './notificationText';
|
|
6
|
+
export * from './notificationTitle';
|
|
7
|
+
export * from './context';
|
|
8
|
+
export { default } from './notification';
|
|
@@ -0,0 +1,25 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.default = void 0;
|
|
17
|
+
__exportStar(require("./notification"), exports);
|
|
18
|
+
__exportStar(require("./notification.types"), exports);
|
|
19
|
+
__exportStar(require("./notificationButton"), exports);
|
|
20
|
+
__exportStar(require("./notificationIcon"), exports);
|
|
21
|
+
__exportStar(require("./notificationText"), exports);
|
|
22
|
+
__exportStar(require("./notificationTitle"), exports);
|
|
23
|
+
__exportStar(require("./context"), exports);
|
|
24
|
+
var notification_1 = require("./notification");
|
|
25
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(notification_1).default; } });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NotificationProps } from './notification.types';
|
|
2
|
+
import NotificationButton from './notificationButton';
|
|
3
|
+
import NotificationIcon from './notificationIcon';
|
|
4
|
+
import NotificationText from './notificationText';
|
|
5
|
+
import NotificationTitle from './notificationTitle';
|
|
6
|
+
import { VuiComponent } from '../core';
|
|
7
|
+
export declare const Notification: VuiComponent<"div", NotificationProps> & {
|
|
8
|
+
Button: typeof NotificationButton;
|
|
9
|
+
Icon: typeof NotificationIcon;
|
|
10
|
+
Text: typeof NotificationText;
|
|
11
|
+
Title: typeof NotificationTitle;
|
|
12
|
+
};
|
|
13
|
+
export default Notification;
|
|
@@ -44,42 +44,42 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
44
44
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
45
45
|
};
|
|
46
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
-
exports.
|
|
47
|
+
exports.Notification = void 0;
|
|
48
48
|
var react_1 = __importStar(require("react"));
|
|
49
|
-
var alertButton_1 = __importDefault(require("./alertButton"));
|
|
50
|
-
var alertIcon_1 = __importDefault(require("./alertIcon"));
|
|
51
|
-
var alertText_1 = __importDefault(require("./alertText"));
|
|
52
|
-
var alertTitle_1 = __importDefault(require("./alertTitle"));
|
|
53
49
|
var consts_1 = require("./consts");
|
|
54
50
|
var context_1 = require("./context");
|
|
51
|
+
var notificationButton_1 = __importDefault(require("./notificationButton"));
|
|
52
|
+
var notificationIcon_1 = __importDefault(require("./notificationIcon"));
|
|
53
|
+
var notificationText_1 = __importDefault(require("./notificationText"));
|
|
54
|
+
var notificationTitle_1 = __importDefault(require("./notificationTitle"));
|
|
55
55
|
var box_1 = __importDefault(require("../box"));
|
|
56
56
|
var core_1 = require("../core");
|
|
57
57
|
var utils_1 = require("../utils");
|
|
58
|
-
exports.
|
|
59
|
-
var _a;
|
|
60
|
-
var action = props.action, children = props.children, className = props.className,
|
|
61
|
-
var statuses = __assign(__assign({}, consts_1.
|
|
62
|
-
var
|
|
63
|
-
var styles = core_1.useStyleConfig('
|
|
58
|
+
exports.Notification = core_1.vui(function (props, ref) {
|
|
59
|
+
var _a, _b, _c;
|
|
60
|
+
var action = props.action, children = props.children, className = props.className, _d = props.colorScheme, colorSchemeProp = _d === void 0 ? 'blue' : _d, icon = props.icon, onClose = props.onClose, size = props.size, _e = props.status, status = _e === void 0 ? '' : _e, statusMapping = props.statusMapping, text = props.text, title = props.title, variant = props.variant, rest = __rest(props, ["action", "children", "className", "colorScheme", "icon", "onClose", "size", "status", "statusMapping", "text", "title", "variant"]);
|
|
61
|
+
var statuses = __assign(__assign({}, consts_1.notificationStatusMapping), statusMapping);
|
|
62
|
+
var _f = ((_a = statuses[status]) !== null && _a !== void 0 ? _a : {}).colorScheme, colorScheme = _f === void 0 ? colorSchemeProp : _f;
|
|
63
|
+
var styles = core_1.useStyleConfig('Notification', __assign({ colorScheme: colorScheme }, props));
|
|
64
|
+
var iconName = utils_1.isString(icon) ? icon : (_c = (_b = statuses[status]) === null || _b === void 0 ? void 0 : _b.iconProps) === null || _c === void 0 ? void 0 : _c.name;
|
|
64
65
|
var context = react_1.useMemo(function () { return utils_1.filterUndefined({ colorScheme: colorScheme, size: size, status: status, variant: variant }); }, [
|
|
65
66
|
colorScheme,
|
|
66
67
|
size,
|
|
67
68
|
status,
|
|
68
69
|
variant
|
|
69
70
|
]);
|
|
70
|
-
return (react_1.default.createElement(context_1.
|
|
71
|
-
react_1.default.createElement(box_1.default, __assign({ borderRadius: "md", className: utils_1.cs('vui-
|
|
72
|
-
|
|
73
|
-
react_1.default.createElement(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
text),
|
|
71
|
+
return (react_1.default.createElement(context_1.NotificationProvider, { value: context },
|
|
72
|
+
react_1.default.createElement(box_1.default, __assign({ borderRadius: "md", className: utils_1.cs('vui-notification', className), px: 1.5, py: 1, ref: ref, w: "fit-content" }, styles.container, rest),
|
|
73
|
+
iconName ? react_1.default.createElement(notificationIcon_1.default, { name: iconName }) : icon, children !== null && children !== void 0 ? children : (react_1.default.createElement(notificationText_1.default, null,
|
|
74
|
+
utils_1.isReactText(title) ? react_1.default.createElement(notificationTitle_1.default, { text: title }) : title,
|
|
75
|
+
" ",
|
|
76
|
+
text)),
|
|
77
77
|
action,
|
|
78
|
-
onClose && react_1.default.createElement(
|
|
78
|
+
onClose && react_1.default.createElement(notificationButton_1.default, { icon: "falTimes", onClick: onClose }))));
|
|
79
79
|
});
|
|
80
|
-
exports.
|
|
81
|
-
exports.
|
|
82
|
-
exports.
|
|
83
|
-
exports.
|
|
84
|
-
exports.
|
|
85
|
-
exports.default = exports.
|
|
80
|
+
exports.Notification.displayName = 'Notification';
|
|
81
|
+
exports.Notification.Button = notificationButton_1.default;
|
|
82
|
+
exports.Notification.Icon = notificationIcon_1.default;
|
|
83
|
+
exports.Notification.Text = notificationText_1.default;
|
|
84
|
+
exports.Notification.Title = notificationTitle_1.default;
|
|
85
|
+
exports.default = exports.Notification;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { BoxProps } from '../box';
|
|
3
|
+
import { IconProp, IconProps } from '../icon';
|
|
4
|
+
import { ThemingProps } from '../theme';
|
|
5
|
+
import { AnyElement } from '../utils';
|
|
6
|
+
export interface NotificationProps extends Omit<BoxProps, 'size' | 'variant'>, ThemingProps<'Notification'> {
|
|
7
|
+
action?: ReactNode;
|
|
8
|
+
colorScheme?: 'blue' | 'green' | 'red' | 'yellow';
|
|
9
|
+
icon?: IconProp | AnyElement;
|
|
10
|
+
onClose?: () => void;
|
|
11
|
+
status?: NotificationStatus;
|
|
12
|
+
statusMapping?: NotificationStatusMapping;
|
|
13
|
+
text?: ReactNode;
|
|
14
|
+
title?: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export declare type NotificationStatus = 'error' | 'info' | 'loading' | 'success' | 'warning';
|
|
17
|
+
export declare type NotificationStatusMapping = Record<string, {
|
|
18
|
+
colorScheme?: NotificationProps['colorScheme'];
|
|
19
|
+
iconProps: IconProps;
|
|
20
|
+
}>;
|
|
@@ -14,17 +14,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.NotificationButton = void 0;
|
|
18
18
|
var react_1 = __importDefault(require("react"));
|
|
19
19
|
var context_1 = require("./context");
|
|
20
20
|
var core_1 = require("../core");
|
|
21
21
|
var button_1 = __importDefault(require("../button"));
|
|
22
|
-
exports.
|
|
22
|
+
exports.NotificationButton = core_1.vui(function (props, ref) {
|
|
23
23
|
var _a;
|
|
24
|
-
var
|
|
25
|
-
var mergedProps = __assign(__assign({},
|
|
26
|
-
var styles = core_1.useStyleConfig('
|
|
27
|
-
return (react_1.default.createElement(button_1.default, __assign({ className: "vui-
|
|
24
|
+
var notificationProps = (_a = context_1.useNotification()) !== null && _a !== void 0 ? _a : {};
|
|
25
|
+
var mergedProps = __assign(__assign({}, notificationProps), props);
|
|
26
|
+
var styles = core_1.useStyleConfig('Notification', mergedProps);
|
|
27
|
+
return (react_1.default.createElement(button_1.default, __assign({ className: "vui-notificationButton", colorScheme: mergedProps.colorScheme, ml: 1, mr: -0.5, ref: ref, size: "sm" }, styles.button, props)));
|
|
28
28
|
});
|
|
29
|
-
exports.
|
|
30
|
-
exports.default = exports.
|
|
29
|
+
exports.NotificationButton.displayName = 'NotificationButton';
|
|
30
|
+
exports.default = exports.NotificationButton;
|
|
@@ -14,20 +14,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.NotificationIcon = void 0;
|
|
18
18
|
var react_1 = __importDefault(require("react"));
|
|
19
19
|
var consts_1 = require("./consts");
|
|
20
20
|
var context_1 = require("./context");
|
|
21
21
|
var core_1 = require("../core");
|
|
22
22
|
var icon_1 = __importDefault(require("../icon"));
|
|
23
|
-
exports.
|
|
23
|
+
exports.NotificationIcon = core_1.vui(function (props, ref) {
|
|
24
24
|
var _a, _b;
|
|
25
|
-
var
|
|
26
|
-
var mergedProps = __assign(__assign({},
|
|
27
|
-
var styles = core_1.useStyleConfig('
|
|
25
|
+
var notificationProps = (_a = context_1.useNotification()) !== null && _a !== void 0 ? _a : {};
|
|
26
|
+
var mergedProps = __assign(__assign({}, notificationProps), props);
|
|
27
|
+
var styles = core_1.useStyleConfig('Notification', mergedProps);
|
|
28
28
|
var _c = mergedProps.status, status = _c === void 0 ? '' : _c;
|
|
29
|
-
var iconProps = ((_b = consts_1.
|
|
30
|
-
return (react_1.default.createElement(icon_1.default, __assign({ className: "vui-
|
|
29
|
+
var iconProps = ((_b = consts_1.notificationStatusMapping[status]) !== null && _b !== void 0 ? _b : {}).iconProps;
|
|
30
|
+
return (react_1.default.createElement(icon_1.default, __assign({ className: "vui-notificationIcon", mr: 1, my: 0.5, ref: ref, size: "md" }, styles.icon, iconProps, props)));
|
|
31
31
|
});
|
|
32
|
-
exports.
|
|
33
|
-
exports.default = exports.
|
|
32
|
+
exports.NotificationIcon.displayName = 'NotificationIcon';
|
|
33
|
+
exports.default = exports.NotificationIcon;
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.NotificationText = void 0;
|
|
18
|
+
var react_1 = __importDefault(require("react"));
|
|
19
|
+
var context_1 = require("./context");
|
|
20
|
+
var core_1 = require("../core");
|
|
21
|
+
var t_1 = __importDefault(require("../t"));
|
|
22
|
+
exports.NotificationText = core_1.vui(function (props, ref) {
|
|
23
|
+
var _a;
|
|
24
|
+
var notificationProps = (_a = context_1.useNotification()) !== null && _a !== void 0 ? _a : {};
|
|
25
|
+
var mergedProps = __assign(__assign({}, notificationProps), props);
|
|
26
|
+
var styles = core_1.useStyleConfig('Notification', mergedProps);
|
|
27
|
+
return (react_1.default.createElement(t_1.default, __assign({ className: "vui-notificationText", flex: "1", lineHeight: "24px", minW: 0, py: 0.5, ref: ref }, styles.text, props)));
|
|
28
|
+
});
|
|
29
|
+
exports.NotificationText.displayName = 'NotificationText';
|
|
30
|
+
exports.default = exports.NotificationText;
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.NotificationTitle = void 0;
|
|
18
|
+
var react_1 = __importDefault(require("react"));
|
|
19
|
+
var context_1 = require("./context");
|
|
20
|
+
var core_1 = require("../core");
|
|
21
|
+
var heading_1 = require("../heading");
|
|
22
|
+
exports.NotificationTitle = core_1.vui(function (props, ref) {
|
|
23
|
+
var _a;
|
|
24
|
+
var notificationProps = (_a = context_1.useNotification()) !== null && _a !== void 0 ? _a : {};
|
|
25
|
+
var mergedProps = __assign(__assign({}, notificationProps), props);
|
|
26
|
+
var styles = core_1.useStyleConfig('Notification', mergedProps);
|
|
27
|
+
return react_1.default.createElement(heading_1.H6, __assign({ className: "vui-notificationTitle", display: "inline-flex", ref: ref }, styles.title, props));
|
|
28
|
+
});
|
|
29
|
+
exports.NotificationTitle.displayName = 'NotificationTitle';
|
|
30
|
+
exports.default = exports.NotificationTitle;
|