@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.
Files changed (195) hide show
  1. package/avatar/avatar.js +2 -2
  2. package/box/box.js +1 -1
  3. package/button/button.d.ts +7 -1
  4. package/button/button.js +56 -23
  5. package/button/button.types.d.ts +8 -6
  6. package/button/buttonIcon.d.ts +3 -0
  7. package/{alert/alertText.js → button/buttonIcon.js} +9 -9
  8. package/button/buttonText.d.ts +3 -0
  9. package/button/buttonText.js +30 -0
  10. package/button/buttons.d.ts +4 -3
  11. package/button/buttons.js +4 -3
  12. package/button/consts.js +3 -2
  13. package/button/context.d.ts +2 -2
  14. package/button/context.js +4 -4
  15. package/button/index.d.ts +2 -2
  16. package/button/index.js +2 -2
  17. package/button/theme.d.ts +79 -41
  18. package/button/theme.js +85 -46
  19. package/{button → buttonGroup}/buttonGroup.d.ts +3 -1
  20. package/{button → buttonGroup}/buttonGroup.js +4 -2
  21. package/buttonGroup/context.d.ts +4 -0
  22. package/buttonGroup/context.js +23 -0
  23. package/buttonGroup/helpers.d.ts +3 -0
  24. package/buttonGroup/helpers.js +10 -0
  25. package/buttonGroup/index.d.ts +4 -0
  26. package/{alert → buttonGroup}/index.js +4 -8
  27. package/card/card.d.ts +3 -0
  28. package/{tile/tile.js → card/card.js} +8 -7
  29. package/{tile/tile.types.d.ts → card/card.types.d.ts} +1 -1
  30. package/card/index.d.ts +3 -0
  31. package/{tile → card}/index.js +4 -4
  32. package/card/theme.d.ts +6 -0
  33. package/card/theme.js +10 -0
  34. package/checkbox/checkbox.js +4 -4
  35. package/checkbox/checkbox.types.d.ts +1 -1
  36. package/checkbox/checkboxGroup.types.d.ts +1 -1
  37. package/core/globalStyle.d.ts +4 -1
  38. package/core/globalStyle.js +7 -3
  39. package/core/index.d.ts +2 -0
  40. package/core/index.js +5 -1
  41. package/core/styled.d.ts +4 -0
  42. package/core/styled.js +80 -0
  43. package/core/types/component.d.ts +12 -12
  44. package/core/types/index.d.ts +1 -0
  45. package/core/types/index.js +1 -0
  46. package/core/types/styled.d.ts +11 -0
  47. package/core/utils.d.ts +2 -2
  48. package/core/utils.js +7 -7
  49. package/core/v.d.ts +182 -0
  50. package/core/v.js +6 -0
  51. package/core/vuiProvider.d.ts +13 -2
  52. package/core/vuiProvider.js +1 -1
  53. package/divider/divider.types.d.ts +1 -1
  54. package/heading/heading.types.d.ts +2 -1
  55. package/icon/helpers.d.ts +2 -3
  56. package/icon/helpers.js +6 -8
  57. package/icon/icon.js +3 -2
  58. package/icon/icon.types.d.ts +4 -2
  59. package/icons/library.js +1 -1
  60. package/icons/types.d.ts +1 -1
  61. package/image/image.d.ts +3 -0
  62. package/image/image.js +38 -0
  63. package/image/image.types.d.ts +5 -0
  64. package/image/index.d.ts +3 -0
  65. package/{label → image}/index.js +4 -4
  66. package/image/theme.d.ts +6 -0
  67. package/image/theme.js +10 -0
  68. package/index.d.ts +6 -3
  69. package/index.js +6 -3
  70. package/input/context.d.ts +4 -0
  71. package/{alert → input}/context.js +4 -4
  72. package/input/index.d.ts +2 -0
  73. package/input/index.js +2 -0
  74. package/input/input.d.ts +7 -2
  75. package/input/input.js +33 -22
  76. package/input/input.types.d.ts +7 -3
  77. package/input/inputIcon.d.ts +3 -0
  78. package/input/inputIcon.js +30 -0
  79. package/input/inputInput.d.ts +5 -0
  80. package/input/inputInput.js +36 -0
  81. package/input/theme.d.ts +40 -15
  82. package/input/theme.js +40 -16
  83. package/list/index.d.ts +3 -1
  84. package/list/index.js +3 -1
  85. package/list/list.d.ts +2 -0
  86. package/list/list.js +3 -1
  87. package/list/list.types.d.ts +19 -1
  88. package/list/listHeading.d.ts +2 -2
  89. package/list/listHeading.js +2 -2
  90. package/list/listIcon.js +1 -1
  91. package/list/listItem.d.ts +1 -1
  92. package/list/listItem.js +8 -5
  93. package/list/listText.d.ts +3 -0
  94. package/list/listText.js +30 -0
  95. package/list/theme.d.ts +20 -6
  96. package/list/theme.js +26 -12
  97. package/notification/consts.d.ts +2 -0
  98. package/{alert → notification}/consts.js +7 -7
  99. package/notification/context.d.ts +4 -0
  100. package/notification/context.js +23 -0
  101. package/notification/index.d.ts +8 -0
  102. package/notification/index.js +25 -0
  103. package/notification/notification.d.ts +13 -0
  104. package/{alert/alert.js → notification/notification.js} +25 -25
  105. package/notification/notification.types.d.ts +20 -0
  106. package/notification/notificationButton.d.ts +3 -0
  107. package/{alert/alertButton.js → notification/notificationButton.js} +8 -8
  108. package/notification/notificationIcon.d.ts +3 -0
  109. package/{alert/alertIcon.js → notification/notificationIcon.js} +9 -9
  110. package/notification/notificationText.d.ts +3 -0
  111. package/notification/notificationText.js +30 -0
  112. package/notification/notificationTitle.d.ts +3 -0
  113. package/notification/notificationTitle.js +30 -0
  114. package/{alert → notification}/theme.d.ts +0 -15
  115. package/{alert → notification}/theme.js +1 -22
  116. package/package.json +2 -3
  117. package/panel/index.d.ts +3 -0
  118. package/panel/index.js +20 -0
  119. package/panel/panel.d.ts +3 -0
  120. package/panel/panel.js +39 -0
  121. package/panel/panel.types.d.ts +4 -0
  122. package/{tile → panel}/theme.d.ts +1 -8
  123. package/{tile → panel}/theme.js +4 -11
  124. package/radio/radio.js +4 -4
  125. package/radio/radio.types.d.ts +1 -1
  126. package/radio/radioGroup.types.d.ts +1 -1
  127. package/skeleton/skeleton.types.d.ts +1 -0
  128. package/spinner/spinner.types.d.ts +1 -0
  129. package/svg/cache.js +1 -5
  130. package/svg/svg.js +2 -3
  131. package/switch/index.d.ts +0 -1
  132. package/switch/index.js +0 -1
  133. package/switch/switch.js +6 -6
  134. package/switch/switch.types.d.ts +19 -4
  135. package/switch/switchButton.d.ts +2 -2
  136. package/switch/switchButton.js +18 -19
  137. package/switch/theme.d.ts +41 -46
  138. package/switch/theme.js +50 -72
  139. package/system/borders.d.ts +3 -1
  140. package/system/custom.d.ts +24 -7
  141. package/system/custom.js +33 -13
  142. package/system/system.d.ts +2 -2
  143. package/system/system.js +1 -1
  144. package/t/t.types.d.ts +2 -1
  145. package/tag/context.d.ts +4 -0
  146. package/tag/context.js +23 -0
  147. package/tag/index.d.ts +6 -0
  148. package/tag/index.js +23 -0
  149. package/tag/tag.d.ts +11 -0
  150. package/tag/tag.js +99 -0
  151. package/{label/label.types.d.ts → tag/tag.types.d.ts} +6 -7
  152. package/tag/tag.types.js +2 -0
  153. package/tag/tagIcon.d.ts +3 -0
  154. package/{alert/alertTitle.js → tag/tagIcon.js} +9 -9
  155. package/tag/tagText.d.ts +3 -0
  156. package/tag/tagText.js +30 -0
  157. package/tag/theme.d.ts +65 -0
  158. package/tag/theme.js +78 -0
  159. package/textarea/textarea.js +2 -1
  160. package/textarea/textarea.types.d.ts +1 -0
  161. package/theme/components.d.ts +291 -223
  162. package/theme/components.js +32 -28
  163. package/theme/defaultTheme.d.ts +291 -223
  164. package/utils/assertion.d.ts +14 -0
  165. package/utils/assertion.js +34 -0
  166. package/utils/index.d.ts +1 -0
  167. package/utils/index.js +1 -0
  168. package/utils/object.d.ts +5 -18
  169. package/utils/object.js +17 -50
  170. package/utils/types.d.ts +2 -0
  171. package/alert/alert.d.ts +0 -13
  172. package/alert/alert.types.d.ts +0 -20
  173. package/alert/alertButton.d.ts +0 -3
  174. package/alert/alertIcon.d.ts +0 -3
  175. package/alert/alertText.d.ts +0 -3
  176. package/alert/alertTitle.d.ts +0 -3
  177. package/alert/consts.d.ts +0 -2
  178. package/alert/context.d.ts +0 -4
  179. package/alert/index.d.ts +0 -8
  180. package/label/index.d.ts +0 -3
  181. package/label/label.d.ts +0 -5
  182. package/label/label.js +0 -71
  183. package/label/theme.d.ts +0 -61
  184. package/label/theme.js +0 -107
  185. package/list/listItem.types.d.ts +0 -16
  186. package/switch/switchButton.types.d.ts +0 -19
  187. package/tile/index.d.ts +0 -3
  188. package/tile/tile.d.ts +0 -3
  189. /package/{button → buttonGroup}/buttonGroup.types.d.ts +0 -0
  190. /package/{button → buttonGroup}/buttonGroup.types.js +0 -0
  191. /package/{alert/alert.types.js → card/card.types.js} +0 -0
  192. /package/{label/label.types.js → core/types/styled.js} +0 -0
  193. /package/{list/listItem.types.js → image/image.types.js} +0 -0
  194. /package/{switch/switchButton.types.js → notification/notification.types.js} +0 -0
  195. /package/{tile/tile.types.js → panel/panel.types.js} +0 -0
@@ -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(listItem_1.default, __assign({ className: "vui-listHeading", color: "grey.80", fontSize: "sm", fontWeight: "medium", ref: ref, textTransform: "uppercase" }, styles.heading, props)));
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;
@@ -1,4 +1,4 @@
1
- import { ListItemProps } from './listItem.types';
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, iconRight = mergedProps.iconRight, iconLeft = mergedProps.iconLeft, _b = mergedProps.isInteractive, isInteractive = _b === void 0 ? props.onClick !== undefined : _b, isSelected = mergedProps.isSelected, onClick = mergedProps.onClick, text = mergedProps.text, rest = __rest(mergedProps, ["children", "center", "centerH", "centerV", "className", "column", "disabled", "iconRight", "iconLeft", "isInteractive", "isSelected", "onClick", "text"]);
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), mb: "1px", onClick: !disabled ? onClick : undefined, px: 1, ref: ref, transitionDuration: "fast" }, itemStyles, interactiveProps, aliasedProps, rest),
68
- iconLeft && react_1.default.createElement(listIcon_1.default, { icon: iconLeft, mr: 1 }), children !== null && children !== void 0 ? children : text,
69
- iconRight && react_1.default.createElement(listIcon_1.default, { icon: iconRight, ml: "auto" })));
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;
@@ -0,0 +1,3 @@
1
+ import { TProps } from '../t';
2
+ export declare const ListText: import("../core").VuiComponent<"span", TProps>;
3
+ export default ListText;
@@ -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
- icon: {
35
- size: string;
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
- scale: number;
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
- return { container: container, icon: icon, item: item };
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
- icon: {
41
- size: 'lg'
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
- scale: 2
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 = {
@@ -0,0 +1,2 @@
1
+ import { NotificationStatusMapping } from './notification.types';
2
+ export declare const notificationStatusMapping: NotificationStatusMapping;
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.alertStatusMapping = void 0;
4
- exports.alertStatusMapping = {
3
+ exports.notificationStatusMapping = void 0;
4
+ exports.notificationStatusMapping = {
5
5
  error: {
6
6
  colorScheme: 'red',
7
7
  iconProps: {
8
- icon: 'falTimesCircle'
8
+ name: 'falTimesCircle'
9
9
  }
10
10
  },
11
11
  info: {
12
12
  colorScheme: 'blue',
13
13
  iconProps: {
14
- icon: 'falInfoCircle'
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
- icon: 'fadSpinnerThird'
22
+ name: 'fadSpinnerThird'
23
23
  }
24
24
  },
25
25
  success: {
26
26
  colorScheme: 'green',
27
27
  iconProps: {
28
- icon: 'falCheckCircle'
28
+ name: 'falCheckCircle'
29
29
  }
30
30
  },
31
31
  warning: {
32
32
  colorScheme: 'yellow',
33
33
  iconProps: {
34
- icon: 'falExclamationCircle'
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.Alert = void 0;
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.Alert = core_1.vui(function (props, ref) {
59
- var _a;
60
- var action = props.action, children = props.children, className = props.className, _b = props.colorScheme, colorSchemeProp = _b === void 0 ? 'blue' : _b, icon = props.icon, onClose = props.onClose, size = props.size, _c = props.status, status = _c === void 0 ? '' : _c, 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.alertStatusMapping), statusMapping);
62
- var _d = ((_a = statuses[status]) !== null && _a !== void 0 ? _a : {}).colorScheme, colorScheme = _d === void 0 ? colorSchemeProp : _d;
63
- var styles = core_1.useStyleConfig('Alert', __assign({ colorScheme: colorScheme }, props));
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.AlertProvider, { value: context },
71
- react_1.default.createElement(box_1.default, __assign({ borderRadius: "md", className: utils_1.cs('vui-alert', className), px: 1.5, py: 1, ref: ref, w: "fit-content" }, styles.container, rest), children ? (children) : (react_1.default.createElement(react_1.default.Fragment, null,
72
- status ? react_1.default.createElement(alertIcon_1.default, null) : typeof icon === 'string' ? react_1.default.createElement(alertIcon_1.default, { icon: icon }) : icon,
73
- react_1.default.createElement(alertText_1.default, null,
74
- typeof title === 'string' ? react_1.default.createElement(alertTitle_1.default, { text: title }) : title,
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(alertButton_1.default, { icon: "falTimes", onClick: onClose }))))));
78
+ onClose && react_1.default.createElement(notificationButton_1.default, { icon: "falTimes", onClick: onClose }))));
79
79
  });
80
- exports.Alert.displayName = 'Alert';
81
- exports.Alert.Button = alertButton_1.default;
82
- exports.Alert.Icon = alertIcon_1.default;
83
- exports.Alert.Text = alertText_1.default;
84
- exports.Alert.Title = alertTitle_1.default;
85
- exports.default = exports.Alert;
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
+ }>;
@@ -0,0 +1,3 @@
1
+ import { ButtonProps } from '../button';
2
+ export declare const NotificationButton: import("../core").VuiComponent<"button", ButtonProps>;
3
+ export default NotificationButton;
@@ -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.AlertButton = void 0;
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.AlertButton = core_1.vui(function (props, ref) {
22
+ exports.NotificationButton = core_1.vui(function (props, ref) {
23
23
  var _a;
24
- var alertProps = (_a = context_1.useAlert()) !== null && _a !== void 0 ? _a : {};
25
- var mergedProps = __assign(__assign({}, alertProps), props);
26
- var styles = core_1.useStyleConfig('Alert', mergedProps);
27
- return (react_1.default.createElement(button_1.default, __assign({ className: "vui-alertButton", colorScheme: mergedProps.colorScheme, ml: 1, mr: -0.5, ref: ref, size: "sm" }, styles.button, props)));
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.AlertButton.displayName = 'AlertButton';
30
- exports.default = exports.AlertButton;
29
+ exports.NotificationButton.displayName = 'NotificationButton';
30
+ exports.default = exports.NotificationButton;
@@ -0,0 +1,3 @@
1
+ import { IconProps } from '../icon';
2
+ export declare const NotificationIcon: import("../core").VuiComponent<"svg", IconProps>;
3
+ export default NotificationIcon;
@@ -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.AlertIcon = void 0;
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.AlertIcon = core_1.vui(function (props, ref) {
23
+ exports.NotificationIcon = core_1.vui(function (props, ref) {
24
24
  var _a, _b;
25
- var alertProps = (_a = context_1.useAlert()) !== null && _a !== void 0 ? _a : {};
26
- var mergedProps = __assign(__assign({}, alertProps), props);
27
- var styles = core_1.useStyleConfig('Alert', mergedProps);
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.alertStatusMapping[status]) !== null && _b !== void 0 ? _b : {}).iconProps;
30
- return (react_1.default.createElement(icon_1.default, __assign({ className: "vui-alertIcon", mr: 1, my: 0.5, ref: ref, size: "md" }, styles.icon, iconProps, props)));
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.AlertIcon.displayName = 'AlertIcon';
33
- exports.default = exports.AlertIcon;
32
+ exports.NotificationIcon.displayName = 'NotificationIcon';
33
+ exports.default = exports.NotificationIcon;
@@ -0,0 +1,3 @@
1
+ import { TProps } from '../t';
2
+ export declare const NotificationText: import("../core").VuiComponent<"p", TProps>;
3
+ export default 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.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,3 @@
1
+ import { HeadingProps } from '../heading';
2
+ export declare const NotificationTitle: import("../core").VuiComponent<"h6", HeadingProps>;
3
+ export default NotificationTitle;
@@ -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;