@occmundial/occ-atomic 3.0.0-beta.7 → 3.0.0-beta.71

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 (171) hide show
  1. package/CHANGELOG.md +556 -0
  2. package/build/Avatar/Avatar.js +69 -21
  3. package/build/Avatar/Avatar.test.js +15 -8
  4. package/build/Avatar/AvatarContent/AvatarContent.js +61 -21
  5. package/build/Avatar/AvatarContent/AvatarContent.test.js +4 -18
  6. package/build/Avatar/AvatarContent/__snapshots__/AvatarContent.test.js.snap +75 -15
  7. package/build/Avatar/AvatarContent/styles.js +88 -21
  8. package/build/Avatar/__snapshots__/Avatar.test.js.snap +11 -2
  9. package/build/Avatar/styles.js +18 -7
  10. package/build/Banner/Banner.js +30 -40
  11. package/build/Banner/Banner.test.js +64 -17
  12. package/build/Banner/__snapshots__/Banner.test.js.snap +0 -28
  13. package/build/Banner/index.js +1 -6
  14. package/build/Button/Button.js +1 -1
  15. package/build/Button/Button.test.js +0 -11
  16. package/build/Button/__snapshots__/Button.test.js.snap +63 -67
  17. package/build/Button/styles.js +42 -75
  18. package/build/Checkbox/Checkbox.js +48 -3
  19. package/build/Checkbox/__snapshots__/Checkbox.test.js.snap +81 -49
  20. package/build/Checkbox/styles.js +91 -48
  21. package/build/Drawer/Drawer.js +40 -0
  22. package/build/{Header/Nav/Nav.js → Drawer/index.js} +54 -39
  23. package/build/Drawer/index.test.js +52 -0
  24. package/build/Drawer/styles.js +61 -0
  25. package/build/Droplist/__snapshots__/Droplist.test.js.snap +5 -5
  26. package/build/Fab/__snapshots__/Fab.test.js.snap +2 -2
  27. package/build/Footer/Footer.js +81 -87
  28. package/build/Footer/List/List.js +89 -124
  29. package/build/Footer/List/styles.js +85 -31
  30. package/build/Footer/__snapshots__/Footer.test.js.snap +109 -59
  31. package/build/Footer/styles.js +116 -51
  32. package/build/Grid/Col/__snapshots__/Col.test.js.snap +16 -2
  33. package/build/Grid/Col/styles.js +12 -6
  34. package/build/Grid/Row/__snapshots__/Row.test.js.snap +18 -2
  35. package/build/Grid/Row/styles.js +15 -5
  36. package/build/Grid/styles.js +26 -9
  37. package/build/Menu/Menu.js +96 -0
  38. package/build/Menu/index.js +34 -0
  39. package/build/Menu/styles.js +25 -0
  40. package/build/MenuDivider/MenuDivider.js +47 -0
  41. package/build/MenuDivider/index.js +18 -0
  42. package/build/MenuDivider/styles.js +21 -0
  43. package/build/MenuItem/MenuItem.js +160 -0
  44. package/build/{Header/Menu → MenuItem}/index.js +2 -2
  45. package/build/MenuItem/styles.js +25 -0
  46. package/build/MenuItemBase/MenuItemBase.js +94 -0
  47. package/build/MenuItemBase/index.js +18 -0
  48. package/build/MenuItemBase/styles.js +57 -0
  49. package/build/MenuList/MenuList.js +71 -0
  50. package/build/{Header → MenuList}/index.js +2 -2
  51. package/build/MenuList/styles.js +54 -0
  52. package/build/MenuUser/MenuUser.js +152 -0
  53. package/build/MenuUser/index.js +18 -0
  54. package/build/MenuUser/styles.js +22 -0
  55. package/build/Modal/Modal.js +94 -66
  56. package/build/Modal/Modal.test.js +14 -7
  57. package/build/Modal/__snapshots__/Modal.test.js.snap +155 -100
  58. package/build/Modal/styles.js +165 -143
  59. package/build/NavAside/NavAside.js +54 -113
  60. package/build/NavAside/NavAside.test.js +0 -57
  61. package/build/NavAside/__snapshots__/NavAside.test.js.snap +35 -43
  62. package/build/NavAside/index.js +6 -0
  63. package/build/NavAside/styles.js +45 -63
  64. package/build/NavAvatarButton/NavAvatarButton.js +134 -0
  65. package/build/{NavIcon → NavAvatarButton}/index.js +2 -2
  66. package/build/NavAvatarButton/styles.js +33 -0
  67. package/build/NavButton/NavButton.js +73 -0
  68. package/build/{Header/Nav → NavButton}/index.js +2 -2
  69. package/build/NavButton/styles.js +79 -0
  70. package/build/NavItem/styles.js +4 -4
  71. package/build/NavTab/NavTab.js +45 -32
  72. package/build/NavTab/styles.js +59 -27
  73. package/build/NavTop/styles.js +6 -6
  74. package/build/OrderBy/OrderBy.js +2 -1
  75. package/build/Pager/Page/Page.js +11 -6
  76. package/build/Pager/Page/Page.test.js +13 -9
  77. package/build/Pager/Page/__snapshots__/Page.test.js.snap +34 -10
  78. package/build/Pager/Page/styles.js +48 -14
  79. package/build/Pager/Pager.js +144 -235
  80. package/build/Pager/Pager.test.js +81 -36
  81. package/build/Pager/__snapshots__/Pager.test.js.snap +3 -36
  82. package/build/Pager/styles.js +5 -40
  83. package/build/Pill/Choice/Choice.js +6 -4
  84. package/build/Pill/Choice/styles.js +13 -10
  85. package/build/Pill/Group/styles.js +5 -5
  86. package/build/Pill/Stack/Stack.js +2 -2
  87. package/build/Pill/Stack/styles.js +5 -8
  88. package/build/Placeholder/Placeholder.js +29 -12
  89. package/build/Placeholder/Placeholder.test.js +4 -4
  90. package/build/Placeholder/__snapshots__/Placeholder.test.js.snap +81 -38
  91. package/build/Placeholder/styles.js +86 -42
  92. package/build/Provider/MenuListProvider.js +38 -0
  93. package/build/Provider/usePrevious.js +1 -1
  94. package/build/Radio/Radio.js +22 -7
  95. package/build/Radio/__snapshots__/Radio.test.js.snap +71 -79
  96. package/build/Radio/styles.js +84 -85
  97. package/build/SlideDown/SlideDown.js +167 -169
  98. package/build/SlideDown/SlideDown.test.js +49 -44
  99. package/build/SlideDown/__snapshots__/SlideDown.test.js.snap +44 -15
  100. package/build/SlideDown/styles.js +51 -20
  101. package/build/SlideToggle/SlideToggle.js +38 -6
  102. package/build/SlideToggle/SlideToggle.test.js +2 -2
  103. package/build/SlideToggle/__snapshots__/SlideToggle.test.js.snap +53 -38
  104. package/build/SlideToggle/styles.js +64 -45
  105. package/build/Tabs/Tab/Tab.js +73 -0
  106. package/build/Tabs/Tab/index.js +34 -0
  107. package/build/Tabs/Tab/index.test.js +132 -0
  108. package/build/Tabs/Tab/styles.js +74 -0
  109. package/build/Tabs/TabContent/TabContent.js +76 -0
  110. package/build/Tabs/TabContent/index.js +34 -0
  111. package/build/Tabs/TabContent/index.test.js +68 -0
  112. package/build/Tabs/TabContent/styles.js +23 -0
  113. package/build/Tabs/TabIndicator/TabIndicator.js +158 -0
  114. package/build/Tabs/TabIndicator/index.js +34 -0
  115. package/build/Tabs/TabIndicator/styles.js +24 -0
  116. package/build/Tabs/TabList/TabList.js +108 -0
  117. package/build/Tabs/TabList/index.js +34 -0
  118. package/build/{Pager/Break → Tabs/TabList}/styles.js +3 -2
  119. package/build/Tabs/Tabs.js +74 -0
  120. package/build/Tabs/context.js +94 -0
  121. package/build/Tabs/index.js +34 -0
  122. package/build/Tabs/index.test.js +157 -0
  123. package/build/Tabs/styles.js +19 -0
  124. package/build/Tag/Tag.js +2 -2
  125. package/build/Tag/__snapshots__/Tag.test.js.snap +40 -43
  126. package/build/Tag/styles.js +76 -82
  127. package/build/Text/Text.js +2 -1
  128. package/build/TextField/TextField.js +7 -6
  129. package/build/TextField/__snapshots__/TextField.test.js.snap +3 -0
  130. package/build/TextField/styles.js +3 -0
  131. package/build/Tip/Tip.js +62 -95
  132. package/build/Tip/Tip.test.js +29 -6
  133. package/build/Tip/TipText/index.js +32 -0
  134. package/build/Tip/__snapshots__/Tip.test.js.snap +127 -15
  135. package/build/Tip/styles.js +125 -31
  136. package/build/Toaster/Toast/Toast.js +76 -64
  137. package/build/Toaster/Toast/styles.js +118 -46
  138. package/build/Toaster/Toaster.js +3 -2
  139. package/build/Toaster/Toaster.test.js +5 -2
  140. package/build/Toaster/__snapshots__/Toaster.test.js.snap +1 -1
  141. package/build/Toaster/functions.js +4 -0
  142. package/build/Toaster/styles.js +3 -3
  143. package/build/Tooltip/Tooltip.js +73 -22
  144. package/build/Tooltip/__snapshots__/Tooltip.test.js.snap +22 -6
  145. package/build/Tooltip/styles.js +32 -10
  146. package/build/index.js +33 -19
  147. package/build/plugin/babel.js +0 -2
  148. package/build/subatomic/grid.js +5 -5
  149. package/build/tokens/colors.json +94 -60
  150. package/build/tokens/index.js +12 -31
  151. package/build/tokens/shadows.json +3 -3
  152. package/package.json +5 -2
  153. package/build/Banner/styles.js +0 -41
  154. package/build/Header/Header.js +0 -163
  155. package/build/Header/Header.test.js +0 -118
  156. package/build/Header/Menu/Menu.js +0 -135
  157. package/build/Header/Menu/Menu.test.js +0 -107
  158. package/build/Header/Menu/__snapshots__/Menu.test.js.snap +0 -113
  159. package/build/Header/Menu/styles.js +0 -123
  160. package/build/Header/Nav/Nav.test.js +0 -81
  161. package/build/Header/Nav/__snapshots__/Nav.test.js.snap +0 -101
  162. package/build/Header/Nav/styles.js +0 -110
  163. package/build/Header/__snapshots__/Header.test.js.snap +0 -79
  164. package/build/Header/styles.js +0 -94
  165. package/build/NavIcon/NavIcon.js +0 -112
  166. package/build/NavIcon/styles.js +0 -81
  167. package/build/Pager/Break/Break.js +0 -27
  168. package/build/Pager/Break/Break.test.js +0 -53
  169. package/build/Pager/Break/__snapshots__/Break.test.js.snap +0 -13
  170. package/build/Pager/Break/index.js +0 -18
  171. /package/build/Button/{Loading.js → Loading/index.js} +0 -0
package/build/Tip/Tip.js CHANGED
@@ -1,39 +1,28 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports["default"] = void 0;
9
7
 
10
- var _react = _interopRequireWildcard(require("react"));
8
+ var _react = _interopRequireDefault(require("react"));
11
9
 
12
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
11
 
14
- var _isString = _interopRequireDefault(require("lodash/isString"));
15
-
16
- var _flatten = _interopRequireDefault(require("lodash/flatten"));
17
-
18
12
  var _Flexbox = _interopRequireDefault(require("../Flexbox"));
19
13
 
20
- var _Text = _interopRequireDefault(require("../Text"));
21
-
22
14
  var _Icon = _interopRequireDefault(require("../Icon"));
23
15
 
24
- var _colors = _interopRequireDefault(require("../subatomic/colors"));
16
+ var _Button = _interopRequireDefault(require("../Button"));
25
17
 
26
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
18
+ var _TipText = _interopRequireDefault(require("./TipText"));
27
19
 
28
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
20
+ var _colors = _interopRequireDefault(require("../tokens/colors.json"));
29
21
 
30
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
22
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
31
23
 
32
24
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
33
25
 
34
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
35
-
36
- var boldRegex = /\*(.*?)\*/g;
37
26
  var icons = {
38
27
  info: 'info-circle',
39
28
  warning: 'alert',
@@ -42,6 +31,20 @@ var icons = {
42
31
  promote: null
43
32
  };
44
33
  var PROMOTE = 'promote';
34
+ var colorTextClasses = {
35
+ info: 'textInfo',
36
+ promote: 'textPromote',
37
+ warning: 'textWarning',
38
+ success: 'textSuccess',
39
+ error: 'textError'
40
+ };
41
+ var colorLinkClasses = {
42
+ info: 'linkInfo',
43
+ promote: 'linkPromote',
44
+ warning: 'linkWarning',
45
+ success: 'linkSuccess',
46
+ error: 'linkError'
47
+ };
45
48
  /** Tip component with different themes (info, warning, success & error). You can pass a string or a react element as the children prop, but the bold regex will only work with strings. */
46
49
 
47
50
  var Tip = function Tip(_ref) {
@@ -51,65 +54,13 @@ var Tip = function Tip(_ref) {
51
54
  classes = _ref.classes,
52
55
  icon = _ref.icon,
53
56
  theme = _ref.theme,
54
- noBorderRadius = _ref.noBorderRadius,
55
- center = _ref.center,
57
+ banner = _ref.banner,
56
58
  onClose = _ref.onClose,
57
- spacedClose = _ref.spacedClose,
58
59
  children = _ref.children,
59
- cta = _ref.cta;
60
-
61
- var replaceStringToBold = function replaceStringToBold() {
62
- if (children === '') return children;
63
- var result = children.split(boldRegex);
64
- if (result.length === 1) return children;
65
-
66
- for (var i = 1, length = result.length; i < length; i += 2) {
67
- result[i] = boldMatch(result[i], i, theme);
68
- }
69
-
70
- return result;
71
- };
72
-
73
- var getTheme = function getTheme() {
74
- if (theme === PROMOTE) return {
75
- white: true
76
- };
77
- return _defineProperty({}, theme, true);
78
- };
79
-
80
- var boldMatch = function boldMatch(match, i) {
81
- return /*#__PURE__*/_react["default"].createElement(_Text["default"], _extends({
82
- key: i,
83
- strong: true,
84
- tag: "b"
85
- }, getTheme()), match);
86
- };
87
-
88
- var getIconName = function getIconName() {
89
- return icons[theme];
90
- };
91
-
92
- var renderText = function renderText() {
93
- var textArray;
94
- if (!Array.isArray(children)) textArray = [children];
95
- var text = (0, _flatten["default"])(textArray.map(function (x) {
96
- return (0, _isString["default"])(x) ? replaceStringToBold(x, theme) : x;
97
- }));
98
-
99
- if (cta) {
100
- text.push( /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, ' ', /*#__PURE__*/_react["default"].createElement("a", {
101
- className: classes.cta,
102
- href: cta.href,
103
- target: cta.target,
104
- onClick: cta.onClick
105
- }, /*#__PURE__*/_react["default"].createElement(_Text["default"], _extends({
106
- tag: "span"
107
- }, getTheme()), cta.text))));
108
- }
109
-
110
- return text;
111
- };
112
-
60
+ cta = _ref.cta,
61
+ _ref$size = _ref.size,
62
+ size = _ref$size === void 0 ? 'large' : _ref$size,
63
+ testId = _ref.testId;
113
64
  return /*#__PURE__*/_react["default"].createElement("div", {
114
65
  id: id,
115
66
  className: className,
@@ -117,27 +68,42 @@ var Tip = function Tip(_ref) {
117
68
  }, /*#__PURE__*/_react["default"].createElement(_Flexbox["default"], {
118
69
  justifyContent: "start",
119
70
  display: "flex",
120
- className: "".concat(classes.container, " ").concat(classes[theme]).concat(noBorderRadius ? " ".concat(classes.noBorderRadius) : '')
71
+ className: "".concat(classes.container, " ").concat(classes[theme]).concat(banner ? " ".concat(classes.noBorderRadius) : '')
121
72
  }, /*#__PURE__*/_react["default"].createElement(_Flexbox["default"], {
122
73
  display: "flex",
123
74
  flex: "1",
124
- justifyContent: center ? 'center' : null,
125
- alignItems: "center"
126
- }, icon && /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
127
- iconName: getIconName(),
75
+ alignItems: "stretch",
76
+ justifyContent: banner ? 'center' : ' '
77
+ }, icon && theme !== PROMOTE && /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
78
+ iconName: icons[theme],
128
79
  className: classes.icon,
129
- colors: [_colors["default"]["".concat(theme, "Text")]]
130
- }), /*#__PURE__*/_react["default"].createElement("div", {
131
- className: icon ? classes.textWithIcon : classes.text
132
- }, /*#__PURE__*/_react["default"].createElement(_Text["default"], _extends({
133
- standard: true,
134
- tag: "div"
135
- }, getTheme()), renderText()))), onClose && /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
136
- iconName: "cross",
80
+ colors: [theme === 'info' ? _colors["default"].icon.brand["default"] : _colors["default"].icon[theme]]
81
+ }), /*#__PURE__*/_react["default"].createElement(_Flexbox["default"], {
82
+ display: "flex",
83
+ direction: size === 'small' ? 'col' : 'row',
84
+ justifyContent: banner ? 'center' : 'start',
85
+ alignSelf: "center",
86
+ flex: banner ? "" : "1",
87
+ className: banner ? " ".concat(classes.maxWidth) : ''
88
+ }, /*#__PURE__*/_react["default"].createElement(_TipText["default"], {
89
+ classes: "".concat(classes.normalText, " ").concat(classes[colorTextClasses[theme]]).concat(!banner ? " ".concat(classes.growText) : ''),
90
+ text: children
91
+ }), cta && /*#__PURE__*/_react["default"].createElement("a", _extends({
92
+ className: "".concat(classes.cta, " ").concat(classes[colorLinkClasses[theme]]).concat(size === 'large' && banner ? " ".concat(classes.ctaBanner) : size === 'large' ? " ".concat(classes.ctaAlert) : ''),
93
+ href: cta.href,
94
+ target: cta.target,
95
+ onClick: cta.onClick
96
+ }, testId && {
97
+ 'data-testid': "".concat(testId, "__link")
98
+ }), cta.text))), onClose && /*#__PURE__*/_react["default"].createElement(_Button["default"], _extends({
137
99
  onClick: onClose,
138
- colors: [theme === PROMOTE ? _colors["default"].bgWhite : _colors["default"]["".concat(theme, "Text")]],
139
- className: spacedClose ? classes.spacedClose : null
140
- })));
100
+ size: "md",
101
+ className: size === 'small' ? classes.closeIconSmallMargin : classes.closeIconMargin,
102
+ icon: "x",
103
+ theme: theme === PROMOTE ? 'ghostWhite' : 'ghostGrey'
104
+ }, testId && {
105
+ testId: "".concat(testId, "__close-icon")
106
+ }))));
141
107
  };
142
108
 
143
109
  Tip.defaultProps = {
@@ -151,6 +117,7 @@ Tip.propTypes = {
151
117
 
152
118
  /** Text of the tip. If you put text between two * characters that text will be displayed as bold. */
153
119
  children: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node]).isRequired,
120
+ size: _propTypes["default"].oneOf(['large', 'small']),
154
121
 
155
122
  /** Call to action. Appended after the children's text. */
156
123
  cta: _propTypes["default"].shape({
@@ -163,11 +130,8 @@ Tip.propTypes = {
163
130
  /** Boolean to show an icon. */
164
131
  icon: _propTypes["default"].bool,
165
132
 
166
- /** Cancel the default border radius. */
167
- noBorderRadius: _propTypes["default"].bool,
168
-
169
- /** Center Tip content. */
170
- center: _propTypes["default"].bool,
133
+ /** Sets content centered and remove border radius. */
134
+ banner: _propTypes["default"].bool,
171
135
 
172
136
  /** Function to call on click of the x icon. */
173
137
  onClose: _propTypes["default"].func,
@@ -176,7 +140,10 @@ Tip.propTypes = {
176
140
  spacedClose: _propTypes["default"].bool,
177
141
  id: _propTypes["default"].string,
178
142
  className: _propTypes["default"].string,
179
- style: _propTypes["default"].object
143
+ style: _propTypes["default"].object,
144
+
145
+ /** The testId property adds the data attribute data-testid to the main element and should be used for testing only. */
146
+ testId: _propTypes["default"].string
180
147
  };
181
148
  var _default = Tip;
182
149
  exports["default"] = _default;
@@ -43,19 +43,42 @@ describe("Tip", function () {
43
43
  var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_Tip["default"], {
44
44
  classes: classes,
45
45
  icon: true
46
- }));
46
+ }, "Alert text"));
47
47
  expect(wrapper.find('.icon').length).toBe(1);
48
48
  });
49
- it('has bold text', function () {
49
+ it('has a close icon button', function () {
50
50
  var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_Tip["default"], {
51
- classes: classes
52
- }, "Text with *bold* text"));
53
- expect(wrapper.find('b').length).toBe(1);
51
+ classes: classes,
52
+ icon: true,
53
+ onClose: function onClose() {
54
+ return console.log('Close');
55
+ },
56
+ testId: "alert-test"
57
+ }, "Tip text "));
58
+ expect(wrapper.find({
59
+ "data-testid": 'alert-test__close-icon'
60
+ }).length).toBe(1);
61
+ });
62
+ it('has a link', function () {
63
+ var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_Tip["default"], {
64
+ classes: classes,
65
+ icon: true,
66
+ cta: {
67
+ text: 'Click here.',
68
+ onClick: function onClick() {
69
+ return alert('CTA clicked!');
70
+ }
71
+ },
72
+ testId: "alert-test"
73
+ }, "Tip text "));
74
+ expect(wrapper.find({
75
+ "data-testid": 'alert-test__link'
76
+ }).length).toBe(1);
54
77
  });
55
78
  });
56
79
  describe("TipJSS", function () {
57
80
  it('matches the snapshot', function () {
58
- var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_index["default"], null));
81
+ var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_index["default"], null, "Tip text "));
59
82
  expect(wrapper).toMatchSnapshot();
60
83
  });
61
84
  });
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
+
14
+ var boldRegex = /\*(.*?)\*/g;
15
+
16
+ var TipText = function TipText(_ref) {
17
+ var classes = _ref.classes,
18
+ text = _ref.text;
19
+ if (text === '' || typeof text !== 'string') return text;
20
+ return /*#__PURE__*/_react["default"].createElement("p", {
21
+ className: classes
22
+ }, text.replace(boldRegex, function (_, txt) {
23
+ return txt;
24
+ }));
25
+ };
26
+
27
+ TipText.propTypes = {
28
+ classes: _propTypes["default"].string.isRequired,
29
+ text: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node]).isRequired
30
+ };
31
+ var _default = TipText;
32
+ exports["default"] = _default;
@@ -4,44 +4,156 @@ exports[`Tip matches the snapshot 1`] = `ShallowWrapper {}`;
4
4
 
5
5
  exports[`Tip styles matches the snapshot 1`] = `
6
6
  Object {
7
+ "closeIconMargin": Object {
8
+ "marginLeft": "16px",
9
+ },
10
+ "closeIconSmallMargin": Object {
11
+ "marginLeft": "12px",
12
+ },
7
13
  "container": Object {
14
+ "@media screen and (min-width:576px)": Object {
15
+ "padding": Array [
16
+ "8px",
17
+ "16px",
18
+ ],
19
+ },
8
20
  "alignItems": "center",
9
- "borderRadius": 6,
10
- "padding": 16,
21
+ "borderRadius": "4px",
22
+ "minHeight": "56px",
23
+ "outlineOffset": "-1px",
24
+ "padding": "12px",
11
25
  },
12
26
  "cta": Object {
27
+ "&:hover": Object {
28
+ "backgroundSize": "100%",
29
+ "cursor": "pointer",
30
+ },
31
+ "alignSelf": "start",
32
+ "backgroundSize": "0%",
13
33
  "cursor": "pointer",
34
+ "font": "400 14px/1.5 'OccText', sans-serif",
35
+ "margin": Array [
36
+ "8px",
37
+ 0,
38
+ 0,
39
+ ],
14
40
  "textDecoration": "underline",
41
+ "textWrap": "nowrap",
42
+ "transition": "all ease-out 150ms",
43
+ },
44
+ "ctaAlert": Object {
45
+ "alignSelf": "center",
46
+ "margin": Array [
47
+ 0,
48
+ 0,
49
+ 0,
50
+ "16px",
51
+ ],
52
+ },
53
+ "ctaBanner": Object {
54
+ "alignSelf": "center",
55
+ "margin": Array [
56
+ 0,
57
+ 0,
58
+ 0,
59
+ "8px",
60
+ ],
15
61
  },
16
62
  "error": Object {
17
- "backgroundColor": "#fcebeb",
63
+ "backgroundColor": "#fce8e8",
64
+ "outline": "1px solid #FBDFDF",
65
+ },
66
+ "growText": Object {
67
+ "flexGrow": 1,
18
68
  },
19
69
  "icon": Object {
20
- "marginRight": 8,
70
+ "flexShrink": 0,
71
+ "marginRight": "8px",
21
72
  },
22
73
  "info": Object {
23
- "backgroundColor": "#efebf7",
74
+ "backgroundColor": "#e3efff",
75
+ "outline": "1px solid #b9d7ff",
76
+ },
77
+ "linkError": Object {
78
+ "&:active": Object {
79
+ "background": "linear-gradient(hsl(0 81.3% 51.8% / 0.2), hsl(0 81.3% 51.8% / 0.2))",
80
+ },
81
+ "background": "linear-gradient(hsl(0 81.3% 51.8% / 0.1), hsl(0 81.3% 51.8% / 0.1))",
82
+ "backgroundRepeat": "no-repeat",
83
+ "color": "#8b1313",
84
+ },
85
+ "linkInfo": Object {
86
+ "&:active": Object {
87
+ "background": "linear-gradient(rgba(8, 60, 174, 0.2), rgba(8, 60, 174, 0.2))",
88
+ },
89
+ "background": "linear-gradient(rgba(8, 60, 174, 0.1), rgba(8, 60, 174, 0.1))",
90
+ "backgroundRepeat": "no-repeat",
91
+ "color": "#083CAE",
92
+ },
93
+ "linkPromote": Object {
94
+ "&:active": Object {
95
+ "background": "linear-gradient(rgba(255,255,255,0.3), rgba(255,255,255,0.3))",
96
+ },
97
+ "background": "linear-gradient(rgba(255,255,255,0.2), rgba(255,255,255,0.2))",
98
+ "backgroundRepeat": "no-repeat",
99
+ "color": "#fff",
100
+ },
101
+ "linkSuccess": Object {
102
+ "&:active": Object {
103
+ "background": "linear-gradient(hsl(143 63.8% 52.4% / 0.2), hsl(143 63.8% 52.4% / 0.2))",
104
+ },
105
+ "background": "linear-gradient(hsl(143 63.8% 52.4% / 0.1), hsl(143 63.8% 52.4% / 0.1))",
106
+ "backgroundRepeat": "no-repeat",
107
+ "color": "#16542e",
108
+ },
109
+ "linkWarning": Object {
110
+ "&:active": Object {
111
+ "background": "linear-gradient(hsl(41.1 100% 57.1% / 0.2), hsl(41.1 100% 57.1% / 0.2))",
112
+ },
113
+ "background": "linear-gradient(hsl(41.1 100% 57.1% / 0.1), hsl(41.1 100% 57.1% / 0.1))",
114
+ "backgroundRepeat": "no-repeat",
115
+ "color": "#664a0e",
116
+ },
117
+ "maxWidth": Object {
118
+ "maxWidth": "1200px",
24
119
  },
25
120
  "noBorderRadius": Object {
26
121
  "borderRadius": 0,
27
122
  },
28
- "promote": Object {
29
- "backgroundColor": "#222222",
123
+ "normalText": Object {
124
+ "display": "inline-block",
125
+ "font": "400 14px/1.5 'OccText', sans-serif",
126
+ "margin": 0,
30
127
  },
31
- "spacedClose": Object {
32
- "marginRight": 48,
128
+ "promote": Object {
129
+ "backgroundColor": "#000",
130
+ "outline": "1px solid rgba(255,255,255,0.2)",
33
131
  },
34
132
  "success": Object {
35
- "backgroundColor": "#e6f5eb",
133
+ "backgroundColor": "#ebfbf1",
134
+ "outline": "1px solid #d7f6e3",
135
+ },
136
+ "textContainer": Object {
137
+ "flex": 1,
138
+ },
139
+ "textError": Object {
140
+ "color": "#8b1313",
141
+ },
142
+ "textInfo": Object {
143
+ "color": "#083CAE",
144
+ },
145
+ "textPromote": Object {
146
+ "color": "#fff",
36
147
  },
37
- "text": Object {
38
- "maxWidth": "100%",
148
+ "textSuccess": Object {
149
+ "color": "#16542e",
39
150
  },
40
- "textWithIcon": Object {
41
- "maxWidth": "calc(100% - 32px)",
151
+ "textWarning": Object {
152
+ "color": "#664a0e",
42
153
  },
43
154
  "warning": Object {
44
- "backgroundColor": "#fffaed",
155
+ "backgroundColor": "#fff8e9",
156
+ "outline": "1px solid #fff1d3",
45
157
  },
46
158
  }
47
159
  `;
@@ -5,61 +5,155 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = void 0;
7
7
 
8
- var _spacing = _interopRequireDefault(require("../subatomic/spacing"));
8
+ var _grid = _interopRequireDefault(require("../subatomic/grid"));
9
9
 
10
- var _colors = _interopRequireDefault(require("../subatomic/colors"));
10
+ var _colors = _interopRequireDefault(require("../tokens/colors.json"));
11
+
12
+ var _fonts = _interopRequireDefault(require("../tokens/fonts.json"));
13
+
14
+ var _spacing = _interopRequireDefault(require("../tokens/spacing.json"));
15
+
16
+ var _borderRadius = _interopRequireDefault(require("../tokens/borderRadius.json"));
17
+
18
+ var _styles = require("../Text/styles");
11
19
 
12
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
21
 
14
- var infoLight = _colors["default"].infoLight,
15
- warningLight = _colors["default"].warningLight,
16
- successLight = _colors["default"].successLight,
17
- errorLight = _colors["default"].errorLight,
18
- grey900 = _colors["default"].grey900;
19
- var radius = _spacing["default"].radius,
20
- large = _spacing["default"].large,
21
- medium = _spacing["default"].medium,
22
- small = _spacing["default"].small,
23
- tiny = _spacing["default"].tiny;
22
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
23
+
24
24
  var _default = {
25
- container: {
26
- padding: small,
27
- borderRadius: radius,
28
- alignItems: 'center'
29
- },
25
+ container: _defineProperty({
26
+ padding: _spacing["default"]['size-3'],
27
+ borderRadius: _borderRadius["default"]['br-xs'],
28
+ minHeight: '56px',
29
+ alignItems: 'center',
30
+ outlineOffset: '-1px'
31
+ }, "@media screen and (min-width:".concat(_grid["default"].xs, "px)"), {
32
+ padding: [_spacing["default"]['size-2'], _spacing["default"]['size-4']]
33
+ }),
30
34
  noBorderRadius: {
31
35
  borderRadius: 0
32
36
  },
33
37
  info: {
34
- backgroundColor: infoLight
38
+ backgroundColor: _colors["default"].alert.info.bg,
39
+ outline: "1px solid ".concat(_colors["default"].alert.info.border)
35
40
  },
36
41
  warning: {
37
- backgroundColor: warningLight
42
+ backgroundColor: _colors["default"].alert.warning.bg,
43
+ outline: "1px solid ".concat(_colors["default"].alert.warning.border)
38
44
  },
39
45
  success: {
40
- backgroundColor: successLight
46
+ backgroundColor: _colors["default"].alert.success.bg,
47
+ outline: "1px solid ".concat(_colors["default"].alert.success.border)
41
48
  },
42
49
  error: {
43
- backgroundColor: errorLight
50
+ backgroundColor: _colors["default"].alert.error.bg,
51
+ outline: "1px solid ".concat(_colors["default"].alert.error.border)
44
52
  },
45
53
  promote: {
46
- backgroundColor: grey900
54
+ backgroundColor: _colors["default"].alert.neutral.bg,
55
+ outline: "1px solid ".concat(_colors["default"].alert.neutral.border)
47
56
  },
48
- icon: {
49
- marginRight: tiny
57
+ textInfo: {
58
+ color: _colors["default"].text.indigo.primary
59
+ },
60
+ textWarning: {
61
+ color: _colors["default"].text.warning
62
+ },
63
+ textSuccess: {
64
+ color: _colors["default"].text.success
65
+ },
66
+ textError: {
67
+ color: _colors["default"].text.error
68
+ },
69
+ textPromote: {
70
+ color: _colors["default"].text.white.primary
71
+ },
72
+ linkInfo: {
73
+ color: _colors["default"].text.indigo.primary,
74
+ backgroundRepeat: 'no-repeat',
75
+ background: "linear-gradient(".concat(_colors["default"].link.brand.bg.hover, ", ").concat(_colors["default"].link.brand.bg.hover, ")"),
76
+ '&:active': {
77
+ background: "linear-gradient(".concat(_colors["default"].link.brand.bg.active, ", ").concat(_colors["default"].link.brand.bg.active, ")")
78
+ }
50
79
  },
51
- text: {
52
- maxWidth: '100%'
80
+ linkWarning: {
81
+ color: _colors["default"].text.warning,
82
+ backgroundRepeat: 'no-repeat',
83
+ background: "linear-gradient(".concat(_colors["default"].link.warning.bg.hover, ", ").concat(_colors["default"].link.warning.bg.hover, ")"),
84
+ '&:active': {
85
+ background: "linear-gradient(".concat(_colors["default"].link.warning.bg.active, ", ").concat(_colors["default"].link.warning.bg.active, ")")
86
+ }
53
87
  },
54
- textWithIcon: {
55
- maxWidth: "calc(100% - ".concat(medium, "px)")
88
+ linkSuccess: {
89
+ color: _colors["default"].text.success,
90
+ backgroundRepeat: 'no-repeat',
91
+ background: "linear-gradient(".concat(_colors["default"].link.success.bg.hover, ", ").concat(_colors["default"].link.success.bg.hover, ")"),
92
+ '&:active': {
93
+ background: "linear-gradient(".concat(_colors["default"].link.success.bg.active, ", ").concat(_colors["default"].link.success.bg.active, ")")
94
+ }
56
95
  },
57
- spacedClose: {
58
- marginRight: large
96
+ linkError: {
97
+ color: _colors["default"].text.error,
98
+ backgroundRepeat: 'no-repeat',
99
+ background: "linear-gradient(".concat(_colors["default"].link.error.bg.hover, ", ").concat(_colors["default"].link.error.bg.hover, ")"),
100
+ '&:active': {
101
+ background: "linear-gradient(".concat(_colors["default"].link.error.bg.active, ", ").concat(_colors["default"].link.error.bg.active, ")")
102
+ }
103
+ },
104
+ linkPromote: {
105
+ color: _colors["default"].text.white.primary,
106
+ backgroundRepeat: 'no-repeat',
107
+ background: "linear-gradient(".concat(_colors["default"].link.white.bg.hover, ", ").concat(_colors["default"].link.white.bg.hover, ")"),
108
+ '&:active': {
109
+ background: "linear-gradient(".concat(_colors["default"].link.white.bg.active, ", ").concat(_colors["default"].link.white.bg.active, ")")
110
+ }
111
+ },
112
+ icon: {
113
+ marginRight: _spacing["default"]['size-2'],
114
+ flexShrink: 0
115
+ },
116
+ closeIconMargin: {
117
+ marginLeft: _spacing["default"]['size-4']
118
+ },
119
+ closeIconSmallMargin: {
120
+ marginLeft: _spacing["default"]['size-3']
59
121
  },
60
122
  cta: {
61
123
  textDecoration: 'underline',
62
- cursor: 'pointer'
124
+ font: (0, _styles.parseFontValue)(_fonts["default"]['alert-default']),
125
+ cursor: 'pointer',
126
+ textWrap: 'nowrap',
127
+ margin: [_spacing["default"]['size-2'], 0, 0],
128
+ alignSelf: 'start',
129
+ transition: 'all ease-out 150ms',
130
+ backgroundSize: '0%',
131
+ '&:hover': {
132
+ backgroundSize: '100%',
133
+ cursor: 'pointer'
134
+ }
135
+ },
136
+ ctaAlert: {
137
+ margin: [0, 0, 0, _spacing["default"]['size-4']],
138
+ alignSelf: 'center'
139
+ },
140
+ ctaBanner: {
141
+ margin: [0, 0, 0, _spacing["default"]['size-2']],
142
+ alignSelf: 'center'
143
+ },
144
+ normalText: {
145
+ font: (0, _styles.parseFontValue)(_fonts["default"]['alert-default']),
146
+ display: 'inline-block',
147
+ margin: 0
148
+ },
149
+ textContainer: {
150
+ flex: 1
151
+ },
152
+ growText: {
153
+ flexGrow: 1
154
+ },
155
+ maxWidth: {
156
+ maxWidth: '1200px'
63
157
  }
64
158
  };
65
159
  exports["default"] = _default;