@coorpacademy/components 11.10.3 → 11.10.4-alpha.7

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 (105) hide show
  1. package/es/atom/input-switch/index.js +2 -1
  2. package/es/atom/input-switch/index.js.map +1 -1
  3. package/es/atom/link/index.d.ts +7 -15
  4. package/es/atom/link/index.d.ts.map +1 -1
  5. package/es/atom/link/index.js +71 -97
  6. package/es/atom/link/index.js.map +1 -1
  7. package/es/atom/provider/web-context.d.ts +2 -2
  8. package/es/atom/provider/web-context.d.ts.map +1 -1
  9. package/es/atom/provider/web-context.js +1 -4
  10. package/es/atom/provider/web-context.js.map +1 -1
  11. package/es/atom/review-header-step-item/index.d.ts.map +1 -1
  12. package/es/atom/review-header-step-item/index.js +8 -3
  13. package/es/atom/review-header-step-item/index.js.map +1 -1
  14. package/es/atom/tooltip/index.d.ts +7 -1
  15. package/es/atom/tooltip/index.d.ts.map +1 -1
  16. package/es/atom/tooltip/index.js +39 -14
  17. package/es/atom/tooltip/index.js.map +1 -1
  18. package/es/atom/tooltip/style.css +9 -0
  19. package/es/molecule/answer/index.d.ts +3 -0
  20. package/es/molecule/answer/index.d.ts.map +1 -1
  21. package/es/molecule/answer/index.js +9 -3
  22. package/es/molecule/answer/index.js.map +1 -1
  23. package/es/organism/review-header/index.d.ts +23 -0
  24. package/es/organism/review-header/index.d.ts.map +1 -1
  25. package/es/organism/review-header/index.js +4 -0
  26. package/es/organism/review-header/index.js.map +1 -1
  27. package/es/organism/user-preferences/index.d.ts.map +1 -1
  28. package/es/organism/user-preferences/index.js +20 -19
  29. package/es/organism/user-preferences/index.js.map +1 -1
  30. package/es/organism/user-preferences/style.css +5 -56
  31. package/es/organism/wizard-contents/index.d.ts +2 -2
  32. package/es/organism/wizard-contents/index.d.ts.map +1 -1
  33. package/es/organism/wizard-contents/index.js +32 -13
  34. package/es/organism/wizard-contents/index.js.map +1 -1
  35. package/es/organism/wizard-contents/style.css +46 -6
  36. package/es/template/activity/engine-stars.d.ts +1 -0
  37. package/es/template/activity/engine-stars.js +2 -1
  38. package/es/template/activity/engine-stars.js.map +1 -1
  39. package/es/template/activity/index.d.ts +1 -0
  40. package/es/template/activity/index.js +2 -1
  41. package/es/template/activity/index.js.map +1 -1
  42. package/es/template/activity/progression-item.d.ts +1 -1
  43. package/es/template/activity/progression-item.d.ts.map +1 -1
  44. package/es/template/activity/progression-item.js +3 -5
  45. package/es/template/activity/progression-item.js.map +1 -1
  46. package/es/template/activity/stars-summary.d.ts +1 -0
  47. package/es/template/activity/stars-summary.js +2 -1
  48. package/es/template/activity/stars-summary.js.map +1 -1
  49. package/es/template/back-office/brand-update/index.d.ts +2 -2
  50. package/es/util/render-with-context.d.ts.map +1 -1
  51. package/es/util/render-with-context.js +13 -6
  52. package/es/util/render-with-context.js.map +1 -1
  53. package/lib/atom/input-switch/index.js +2 -1
  54. package/lib/atom/input-switch/index.js.map +1 -1
  55. package/lib/atom/link/index.d.ts +7 -15
  56. package/lib/atom/link/index.d.ts.map +1 -1
  57. package/lib/atom/link/index.js +75 -97
  58. package/lib/atom/link/index.js.map +1 -1
  59. package/lib/atom/provider/web-context.d.ts +2 -2
  60. package/lib/atom/provider/web-context.d.ts.map +1 -1
  61. package/lib/atom/provider/web-context.js +1 -5
  62. package/lib/atom/provider/web-context.js.map +1 -1
  63. package/lib/atom/review-header-step-item/index.d.ts.map +1 -1
  64. package/lib/atom/review-header-step-item/index.js +12 -3
  65. package/lib/atom/review-header-step-item/index.js.map +1 -1
  66. package/lib/atom/tooltip/index.d.ts +7 -1
  67. package/lib/atom/tooltip/index.d.ts.map +1 -1
  68. package/lib/atom/tooltip/index.js +41 -14
  69. package/lib/atom/tooltip/index.js.map +1 -1
  70. package/lib/atom/tooltip/style.css +9 -0
  71. package/lib/molecule/answer/index.d.ts +3 -0
  72. package/lib/molecule/answer/index.d.ts.map +1 -1
  73. package/lib/molecule/answer/index.js +9 -3
  74. package/lib/molecule/answer/index.js.map +1 -1
  75. package/lib/organism/review-header/index.d.ts +23 -0
  76. package/lib/organism/review-header/index.d.ts.map +1 -1
  77. package/lib/organism/review-header/index.js +5 -0
  78. package/lib/organism/review-header/index.js.map +1 -1
  79. package/lib/organism/user-preferences/index.d.ts.map +1 -1
  80. package/lib/organism/user-preferences/index.js +23 -21
  81. package/lib/organism/user-preferences/index.js.map +1 -1
  82. package/lib/organism/user-preferences/style.css +5 -56
  83. package/lib/organism/wizard-contents/index.d.ts +2 -2
  84. package/lib/organism/wizard-contents/index.d.ts.map +1 -1
  85. package/lib/organism/wizard-contents/index.js +34 -13
  86. package/lib/organism/wizard-contents/index.js.map +1 -1
  87. package/lib/organism/wizard-contents/style.css +46 -6
  88. package/lib/template/activity/engine-stars.d.ts +1 -0
  89. package/lib/template/activity/engine-stars.js +2 -1
  90. package/lib/template/activity/engine-stars.js.map +1 -1
  91. package/lib/template/activity/index.d.ts +1 -0
  92. package/lib/template/activity/index.js +2 -1
  93. package/lib/template/activity/index.js.map +1 -1
  94. package/lib/template/activity/progression-item.d.ts +1 -1
  95. package/lib/template/activity/progression-item.d.ts.map +1 -1
  96. package/lib/template/activity/progression-item.js +3 -5
  97. package/lib/template/activity/progression-item.js.map +1 -1
  98. package/lib/template/activity/stars-summary.d.ts +1 -0
  99. package/lib/template/activity/stars-summary.js +2 -1
  100. package/lib/template/activity/stars-summary.js.map +1 -1
  101. package/lib/template/back-office/brand-update/index.d.ts +2 -2
  102. package/lib/util/render-with-context.d.ts.map +1 -1
  103. package/lib/util/render-with-context.js +18 -6
  104. package/lib/util/render-with-context.js.map +1 -1
  105. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/link/index.js"],"names":[],"mappings":";AAMA;IACE;;;;;;;;;;;;;;MAcE;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;;MAGE;IAEF,wBAKC;IAHC;;MAEC;IAGH,6BAQE;IAEF,6BAQE;IAEF,gCASE;IAEF,sBA2CC;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/link/index.js"],"names":[],"mappings":";AAMA,mEA+EC"}
@@ -9,118 +9,92 @@ var _getOr2 = _interopRequireDefault(require("lodash/fp/getOr"));
9
9
 
10
10
  var _identity2 = _interopRequireDefault(require("lodash/fp/identity"));
11
11
 
12
- var _react = _interopRequireDefault(require("react"));
12
+ var _react = _interopRequireWildcard(require("react"));
13
13
 
14
14
  var _propTypes = _interopRequireDefault(require("prop-types"));
15
15
 
16
- var _provider = _interopRequireDefault(require("../provider"));
16
+ var _provider = _interopRequireWildcard(require("../provider"));
17
17
 
18
18
  var _navigation = _interopRequireDefault(require("../../util/navigation"));
19
19
 
20
20
  const _excluded = ["skinHover", "hoverColor", "data-name", "aria-label"];
21
21
 
22
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
+
24
+ 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; }
25
+
22
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
27
 
24
28
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
25
29
 
26
30
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
27
31
 
28
- class Link extends _react.default.Component {
29
- constructor(props) {
30
- super(props);
31
-
32
- this.handleMouseEnter = () => {
33
- const {
34
- onMouseEnter = _noop2.default
35
- } = this.props;
36
- this.setState({
37
- hovered: true
38
- });
39
- onMouseEnter();
40
- };
41
-
42
- this.handleMouseLeave = () => {
43
- const {
44
- onMouseLeave = _noop2.default
45
- } = this.props;
46
- this.setState({
47
- hovered: false
48
- });
49
- onMouseLeave();
50
- };
51
-
52
- this.handleOnClick = e => {
53
- const {
54
- onClick = _noop2.default,
55
- download
56
- } = this.props;
57
- onClick(e);
58
-
59
- if (!download) {
60
- const navigate = (0, _navigation.default)(this.context)(this.props);
61
- navigate(e);
62
- }
63
- };
64
-
65
- this.state = {
66
- hovered: false
67
- };
68
- }
69
-
70
- render() {
71
- const {
72
- skin,
73
- history: {
74
- createHref = _identity2.default
75
- } = {}
76
- } = this.context;
77
-
78
- const _this$props = this.props,
79
- {
80
- skinHover,
81
- hoverColor = (0, _getOr2.default)('#00B0FF', 'common.primary', skin),
82
- 'data-name': dataName = 'link',
83
- 'aria-label': ariaLabel
84
- } = _this$props,
85
- aProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
86
-
87
- const {
88
- href,
89
- onClick,
90
- className,
91
- style: propsStyle,
92
- children
93
- } = this.props;
94
- const {
95
- hovered
96
- } = this.state;
97
-
98
- const _style = href || onClick ? null : {
99
- pointerEvents: 'none'
100
- };
101
-
102
- const _hoverStyle = skinHover && hovered ? {
103
- color: hoverColor
104
- } : null;
105
-
106
- return /*#__PURE__*/_react.default.createElement("a", _extends({}, aProps, {
107
- "data-name": dataName,
108
- "aria-label": ariaLabel,
109
- href: href ? createHref(href) : undefined,
110
- onClick: this.handleOnClick,
111
- onMouseEnter: this.handleMouseEnter,
112
- onMouseLeave: this.handleMouseLeave,
113
- className: className,
114
- style: _extends({}, propsStyle, _style, _hoverStyle)
115
- }), children);
116
- }
117
-
118
- }
119
-
120
- Link.contextTypes = {
121
- skin: _provider.default.childContextTypes.skin,
122
- history: _provider.default.childContextTypes.history
32
+ const Link = (props, legacyContext) => {
33
+ const skin = (0, _provider.GetSkinFromContext)(legacyContext);
34
+ const [hovered, setHovered] = (0, _react.useState)(false);
35
+ const {
36
+ history: {
37
+ createHref = _identity2.default
38
+ } = {}
39
+ } = legacyContext;
40
+
41
+ const {
42
+ skinHover,
43
+ hoverColor = (0, _getOr2.default)('#00B0FF', 'common.primary', skin),
44
+ 'data-name': dataName = 'link',
45
+ 'aria-label': ariaLabel
46
+ } = props,
47
+ linKElementProps = _objectWithoutPropertiesLoose(props, _excluded);
48
+
49
+ const {
50
+ href,
51
+ onClick = _noop2.default,
52
+ className,
53
+ style: propsStyle,
54
+ children,
55
+ onMouseLeave = _noop2.default,
56
+ onMouseEnter = _noop2.default,
57
+ download
58
+ } = props;
59
+ const handleMouseEnter = (0, _react.useCallback)(() => {
60
+ setHovered(true);
61
+ onMouseEnter();
62
+ }, [onMouseEnter]);
63
+ const handleMouseLeave = (0, _react.useCallback)(() => {
64
+ setHovered(false);
65
+ onMouseLeave();
66
+ }, [onMouseLeave]);
67
+ const navigate = (0, _react.useMemo)(() => (0, _navigation.default)(legacyContext)({
68
+ href
69
+ }), [href, legacyContext]);
70
+ const handleOnClick = (0, _react.useCallback)(e => {
71
+ onClick(e);
72
+
73
+ if (!download) {
74
+ navigate(e);
75
+ }
76
+ }, [download, navigate, onClick]);
77
+
78
+ const _style = href || onClick ? null : {
79
+ pointerEvents: 'none'
80
+ };
81
+
82
+ const _hoverStyle = skinHover && hovered ? {
83
+ color: hoverColor
84
+ } : null;
85
+
86
+ return /*#__PURE__*/_react.default.createElement("a", _extends({}, linKElementProps, {
87
+ "data-name": dataName,
88
+ "aria-label": ariaLabel,
89
+ href: href ? createHref(href) : undefined,
90
+ onClick: handleOnClick,
91
+ onMouseEnter: handleMouseEnter,
92
+ onMouseLeave: handleMouseLeave,
93
+ className: className,
94
+ style: _extends({}, propsStyle, _style, _hoverStyle)
95
+ }), children);
123
96
  };
97
+
124
98
  Link.propTypes = process.env.NODE_ENV !== "production" ? {
125
99
  children: _propTypes.default.node,
126
100
  className: _propTypes.default.string,
@@ -136,6 +110,10 @@ Link.propTypes = process.env.NODE_ENV !== "production" ? {
136
110
  onMouseLeave: _propTypes.default.func,
137
111
  style: _propTypes.default.shape({})
138
112
  } : {};
113
+ Link.contextTypes = {
114
+ skin: _provider.default.childContextTypes.skin,
115
+ history: _provider.default.childContextTypes.history
116
+ };
139
117
  var _default = Link;
140
118
  exports.default = _default;
141
119
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Link","React","Component","constructor","props","handleMouseEnter","onMouseEnter","setState","hovered","handleMouseLeave","onMouseLeave","handleOnClick","e","onClick","download","navigate","pushToHistory","context","state","render","skin","history","createHref","skinHover","hoverColor","dataName","ariaLabel","aProps","href","className","style","propsStyle","children","_style","pointerEvents","_hoverStyle","color","undefined","contextTypes","Provider","childContextTypes","propTypes","PropTypes","node","string","target","oneOf","bool","func","shape"],"sources":["../../../src/atom/link/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {identity, getOr, noop} from 'lodash/fp';\nimport Provider from '../provider';\nimport pushToHistory from '../../util/navigation';\n\nclass Link extends React.Component {\n static propTypes = {\n children: PropTypes.node,\n className: PropTypes.string,\n href: PropTypes.string,\n 'data-name': PropTypes.string,\n 'aria-label': PropTypes.string,\n target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top']),\n skinHover: PropTypes.bool,\n hoverColor: PropTypes.string,\n download: PropTypes.bool,\n onClick: PropTypes.func,\n onMouseEnter: PropTypes.func,\n onMouseLeave: PropTypes.func,\n style: PropTypes.shape({})\n };\n\n static contextTypes = {\n skin: Provider.childContextTypes.skin,\n history: Provider.childContextTypes.history\n };\n\n constructor(props) {\n super(props);\n this.state = {\n hovered: false\n };\n }\n\n handleMouseEnter = () => {\n const {onMouseEnter = noop} = this.props;\n\n this.setState({\n hovered: true\n });\n\n onMouseEnter();\n };\n\n handleMouseLeave = () => {\n const {onMouseLeave = noop} = this.props;\n\n this.setState({\n hovered: false\n });\n\n onMouseLeave();\n };\n\n handleOnClick = e => {\n const {onClick = noop, download} = this.props;\n\n onClick(e);\n\n if (!download) {\n const navigate = pushToHistory(this.context)(this.props);\n navigate(e);\n }\n };\n\n render() {\n const {skin, history: {createHref = identity} = {}} = this.context;\n const {\n skinHover,\n hoverColor = getOr('#00B0FF', 'common.primary', skin),\n 'data-name': dataName = 'link',\n 'aria-label': ariaLabel,\n ...aProps\n } = this.props;\n const {href, onClick, className, style: propsStyle, children} = this.props;\n const {hovered} = this.state;\n const _style =\n href || onClick\n ? null\n : {\n pointerEvents: 'none'\n };\n const _hoverStyle =\n skinHover && hovered\n ? {\n color: hoverColor\n }\n : null;\n\n return (\n <a\n {...aProps}\n data-name={dataName}\n aria-label={ariaLabel}\n href={href ? createHref(href) : undefined}\n onClick={this.handleOnClick}\n onMouseEnter={this.handleMouseEnter}\n onMouseLeave={this.handleMouseLeave}\n className={className}\n style={{\n ...propsStyle,\n ..._style,\n ..._hoverStyle\n }}\n >\n {children}\n </a>\n );\n }\n}\n\nexport default Link;\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;;;;;AAEA,MAAMA,IAAN,SAAmBC,cAAA,CAAMC,SAAzB,CAAmC;EAsBjCC,WAAW,CAACC,KAAD,EAAQ;IACjB,MAAMA,KAAN;;IADiB,KAOnBC,gBAPmB,GAOA,MAAM;MACv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EAAEY,kBAAA,CAAUO,KAAV,CAAgB,EAAhB;AAbU,C;eAyGNjD,I"}
1
+ {"version":3,"file":"index.js","names":["Link","props","legacyContext","skin","GetSkinFromContext","hovered","setHovered","useState","history","createHref","skinHover","hoverColor","dataName","ariaLabel","linKElementProps","href","onClick","className","style","propsStyle","children","onMouseLeave","onMouseEnter","download","handleMouseEnter","useCallback","handleMouseLeave","navigate","useMemo","pushToHistory","handleOnClick","e","_style","pointerEvents","_hoverStyle","color","undefined","propTypes","PropTypes","node","string","target","oneOf","bool","func","shape","contextTypes","Provider","childContextTypes"],"sources":["../../../src/atom/link/index.js"],"sourcesContent":["import React, {useCallback, useMemo, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport {identity, getOr, noop} from 'lodash/fp';\nimport Provider, {GetSkinFromContext} from '../provider';\nimport pushToHistory from '../../util/navigation';\n\nconst Link = (props, legacyContext) => {\n const skin = GetSkinFromContext(legacyContext);\n const [hovered, setHovered] = useState(false);\n const {history: {createHref = identity} = {}} = legacyContext;\n const {\n skinHover,\n hoverColor = getOr('#00B0FF', 'common.primary', skin),\n 'data-name': dataName = 'link',\n 'aria-label': ariaLabel,\n ...linKElementProps\n } = props;\n const {\n href,\n onClick = noop,\n className,\n style: propsStyle,\n children,\n onMouseLeave = noop,\n onMouseEnter = noop,\n download\n } = props;\n\n const handleMouseEnter = useCallback(() => {\n setHovered(true);\n\n onMouseEnter();\n }, [onMouseEnter]);\n\n const handleMouseLeave = useCallback(() => {\n setHovered(false);\n\n onMouseLeave();\n }, [onMouseLeave]);\n\n const navigate = useMemo(() => pushToHistory(legacyContext)({href}), [href, legacyContext]);\n\n const handleOnClick = useCallback(\n e => {\n onClick(e);\n\n if (!download) {\n navigate(e);\n }\n },\n [download, navigate, onClick]\n );\n\n const _style =\n href || onClick\n ? null\n : {\n pointerEvents: 'none'\n };\n const _hoverStyle =\n skinHover && hovered\n ? {\n color: hoverColor\n }\n : null;\n\n return (\n <a\n {...linKElementProps}\n data-name={dataName}\n aria-label={ariaLabel}\n href={href ? createHref(href) : undefined}\n onClick={handleOnClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n className={className}\n style={{\n ...propsStyle,\n ..._style,\n ..._hoverStyle\n }}\n >\n {children}\n </a>\n );\n};\n\nLink.propTypes = {\n children: PropTypes.node,\n className: PropTypes.string,\n href: PropTypes.string,\n 'data-name': PropTypes.string,\n 'aria-label': PropTypes.string,\n target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top']),\n skinHover: PropTypes.bool,\n hoverColor: PropTypes.string,\n download: PropTypes.bool,\n onClick: PropTypes.func,\n onMouseEnter: PropTypes.func,\n onMouseLeave: PropTypes.func,\n style: PropTypes.shape({})\n};\n\nLink.contextTypes = {\n skin: Provider.childContextTypes.skin,\n history: Provider.childContextTypes.history\n};\n\nexport default Link;\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;;;;;;;;;AAEA,MAAMA,IAAI,GAAG,CAACC,KAAD,EAAQC,aAAR,KAA0B;EACrC,MAAMC,IAAI,GAAG,IAAAC,4BAAA,EAAmBF,aAAnB,CAAb;EACA,MAAM,CAACG,OAAD,EAAUC,UAAV,IAAwB,IAAAC,eAAA,EAAS,KAAT,CAA9B;EACA,MAAM;IAACC,OAAO,EAAE;MAACC,UAAU;IAAX,IAA0B;EAApC,IAA0CP,aAAhD;;EACA,MAAM;IACJQ,SADI;IAEJC,UAAU,GAAG,qBAAM,SAAN,EAAiB,gBAAjB,EAAmCR,IAAnC,CAFT;IAGJ,aAAaS,QAAQ,GAAG,MAHpB;IAIJ,cAAcC;EAJV,IAMFZ,KANJ;EAAA,MAKKa,gBALL,iCAMIb,KANJ;;EAOA,MAAM;IACJc,IADI;IAEJC,OAAO,iBAFH;IAGJC,SAHI;IAIJC,KAAK,EAAEC,UAJH;IAKJC,QALI;IAMJC,YAAY,iBANR;IAOJC,YAAY,iBAPR;IAQJC;EARI,IASFtB,KATJ;EAWA,MAAMuB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EAAEkB,kBAAA,CAAUC,IADL;EAEftB,SAAS,EAAEqB,kBAAA,CAAUE,MAFN;EAGfzB,IAAI,EAAEuB,kBAAA,CAAUE,MAHD;EAIf,aAAaF,kBAAA,CAAUE,MAJR;EAKf,cAAcF,kBAAA,CAAUE,MALT;EAMfC,MAAM,EAAEH,kBAAA,CAAUI,KAAV,CAAgB,CAAC,OAAD,EAAU,QAAV,EAAoB,SAApB,EAA+B,MAA/B,CAAhB,CANO;EAOfhC,SAAS,EAAE4B,kBAAA,CAAUK,IAPN;EAQfhC,UAAU,EAAE2B,kBAAA,CAAUE,MARP;EASfjB,QAAQ,EAAEe,kBAAA,CAAUK,IATL;EAUf3B,OAAO,EAAEsB,kBAAA,CAAUM,IAVJ;EAWftB,YAAY,EAAEgB,kBAAA,CAAUM,IAXT;EAYfvB,YAAY,EAAEiB,kBAAA,CAAUM,IAZT;EAaf1B,KAAK,EAAEoB,kBAAA,CAAUO,KAAV,CAAgB,EAAhB;AAbQ,CAAjB;AAgBA7C,IAAI,CAAC8C,YAAL,GAAoB;EAClB3C,IAAI,EAAE4C,iBAAA,CAASC,iBAAT,CAA2B7C,IADf;EAElBK,OAAO,EAAEuC,iBAAA,CAASC,iBAAT,CAA2BxC;AAFlB,CAApB;eAKeR,I"}
@@ -4,9 +4,9 @@ declare type Skin = {
4
4
  primary: string;
5
5
  };
6
6
  };
7
- declare type WebContextValues = {
7
+ export declare type WebContextValues = {
8
8
  skin?: Skin;
9
- translate: (key: string, data?: Record<string, string>) => string;
9
+ translate?: (key: string, data?: Record<string, string>) => string;
10
10
  };
11
11
  declare type Props = WebContextValues & {
12
12
  children: ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"web-context.d.ts","sourceRoot":"","sources":["../../../src/atom/provider/web-context.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAgB,SAAS,EAAa,MAAM,OAAO,CAAC;AAGlE,aAAK,IAAI,GAAG;IACV,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAAC;AAEF,aAAK,gBAAgB,GAAG;IACtB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC;CACnE,CAAC;AAMF,aAAK,KAAK,GAAG,gBAAgB,GAAG;IAC9B,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,QAAA,MAAM,UAAU,2BAA0B,KAAK,gBAE9C,CAAC;AAEF,eAAO,MAAM,aAAa,QAAO,gBAQhC,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"web-context.d.ts","sourceRoot":"","sources":["../../../src/atom/provider/web-context.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAgB,SAAS,EAAa,MAAM,OAAO,CAAC;AAElE,aAAK,IAAI,GAAG;IACV,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAAC;AAEF,oBAAY,gBAAgB,GAAG;IAC7B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC;CACpE,CAAC;AAIF,aAAK,KAAK,GAAG,gBAAgB,GAAG;IAC9B,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,QAAA,MAAM,UAAU,2BAA0B,KAAK,gBAE9C,CAAC;AAEF,eAAO,MAAM,aAAa,QAAO,gBAQhC,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -5,8 +5,6 @@ exports.useWebContext = exports.default = void 0;
5
5
 
6
6
  var _react = _interopRequireWildcard(require("react"));
7
7
 
8
- var _translate = require("@coorpacademy/translate");
9
-
10
8
  const _excluded = ["children"];
11
9
 
12
10
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -15,9 +13,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
15
13
 
16
14
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
17
15
 
18
- const Context = /*#__PURE__*/(0, _react.createContext)({
19
- translate: _translate.mockTranslate
20
- });
16
+ const Context = /*#__PURE__*/(0, _react.createContext)({});
21
17
 
22
18
  const WebContext = _ref => {
23
19
  let {
@@ -1 +1 @@
1
- {"version":3,"file":"web-context.js","names":["Context","createContext","translate","mockTranslate","WebContext","children","value","useWebContext","context","useContext","Error"],"sources":["../../../src/atom/provider/web-context.tsx"],"sourcesContent":["import React, {createContext, ReactNode, useContext} from 'react';\nimport {mockTranslate} from '@coorpacademy/translate';\n\ntype Skin = {\n common: {\n primary: string;\n };\n};\n\ntype WebContextValues = {\n skin?: Skin;\n translate: (key: string, data?: Record<string, string>) => string;\n};\n\nconst Context = createContext({\n translate: mockTranslate\n});\n\ntype Props = WebContextValues & {\n children: ReactNode;\n};\n\nconst WebContext = ({children, ...value}: Props) => {\n return <Context.Provider value={value}>{children}</Context.Provider>;\n};\n\nexport const useWebContext = (): WebContextValues => {\n const context = useContext(Context);\n\n if (!context) {\n throw new Error('❌ [WebContext] useWebContext must be used within a provider <WebContext>');\n }\n\n return context;\n};\n\nexport default WebContext;\n"],"mappings":";;;;;AAAA;;AACA;;;;;;;;;;AAaA,MAAMA,OAAO,gBAAG,IAAAC,oBAAA,EAAc;EAC5BC,SAAS,EAAEC;AADiB,CAAd,CAAhB;;AAQA,MAAMC,UAAU,GAAG,QAAiC;EAAA,IAAhC;IAACC;EAAD,CAAgC;EAAA,IAAlBC,KAAkB;;EAClD,oBAAO,6BAAC,OAAD,CAAS,QAAT;IAAkB,KAAK,EAAEA;EAAzB,GAAiCD,QAAjC,CAAP;AACD,CAFD;;AAIO,MAAME,aAAa,GAAG,MAAwB;EACnD,MAAMC,OAAO,GAAG,IAAAC,iBAAA,EAAWT,OAAX,CAAhB;;EAEA,IAAI,CAACQ,OAAL,EAAc;IACZ,MAAM,IAAIE,KAAJ,CAAU,0EAAV,CAAN;EACD;;EAED,OAAOF,OAAP;AACD,CARM;;;eAUQJ,U"}
1
+ {"version":3,"file":"web-context.js","names":["Context","createContext","WebContext","children","value","useWebContext","context","useContext","Error"],"sources":["../../../src/atom/provider/web-context.tsx"],"sourcesContent":["import React, {createContext, ReactNode, useContext} from 'react';\n\ntype Skin = {\n common: {\n primary: string;\n };\n};\n\nexport type WebContextValues = {\n skin?: Skin;\n translate?: (key: string, data?: Record<string, string>) => string;\n};\n\nconst Context = createContext({});\n\ntype Props = WebContextValues & {\n children: ReactNode;\n};\n\nconst WebContext = ({children, ...value}: Props) => {\n return <Context.Provider value={value}>{children}</Context.Provider>;\n};\n\nexport const useWebContext = (): WebContextValues => {\n const context = useContext(Context);\n\n if (!context) {\n throw new Error('❌ [WebContext] useWebContext must be used within a provider <WebContext>');\n }\n\n return context;\n};\n\nexport default WebContext;\n"],"mappings":";;;;;AAAA;;;;;;;;;;AAaA,MAAMA,OAAO,gBAAG,IAAAC,oBAAA,EAAc,EAAd,CAAhB;;AAMA,MAAMC,UAAU,GAAG,QAAiC;EAAA,IAAhC;IAACC;EAAD,CAAgC;EAAA,IAAlBC,KAAkB;;EAClD,oBAAO,6BAAC,OAAD,CAAS,QAAT;IAAkB,KAAK,EAAEA;EAAzB,GAAiCD,QAAjC,CAAP;AACD,CAFD;;AAIO,MAAME,aAAa,GAAG,MAAwB;EACnD,MAAMC,OAAO,GAAG,IAAAC,iBAAA,EAAWP,OAAX,CAAhB;;EAEA,IAAI,CAACM,OAAL,EAAc;IACZ,MAAM,IAAIE,KAAJ,CAAU,0EAAV,CAAN;EACD;;EAED,OAAOF,OAAP;AACD,CARM;;;eAUQJ,U"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/review-header-step-item/index.tsx"],"names":[],"mappings":";AAQA,OAAkB,EAAC,mBAAmB,EAAC,MAAM,SAAS,CAAC;AAsDvD,QAAA,MAAM,oBAAoB;YAAW,mBAAmB;;;;;;CAevD,CAAC;AAIF,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/review-header-step-item/index.tsx"],"names":[],"mappings":";AASA,OAAkB,EAAC,mBAAmB,EAAC,MAAM,SAAS,CAAC;AAsDvD,QAAA,MAAM,oBAAoB;YAAW,mBAAmB;;;;;;CAevD,CAAC;AAWF,eAAe,oBAAoB,CAAC"}
@@ -9,21 +9,25 @@ var _classnames = _interopRequireDefault(require("classnames"));
9
9
 
10
10
  var _novaIcons = require("@coorpacademy/nova-icons");
11
11
 
12
- var _provider = require("../provider");
12
+ var _provider = _interopRequireWildcard(require("../provider"));
13
13
 
14
14
  var _style = _interopRequireDefault(require("./style.css"));
15
15
 
16
16
  var _types = _interopRequireDefault(require("./types"));
17
17
 
18
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
+
20
+ 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; }
21
+
18
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
23
 
20
- const Content = props => {
24
+ const Content = (props, legacyContext) => {
21
25
  const {
22
26
  icon,
23
27
  current,
24
28
  value
25
29
  } = props;
26
- const translate = (0, _provider.GetTranslateFromContext)();
30
+ const translate = (0, _provider.GetTranslateFromContext)(legacyContext);
27
31
  let child;
28
32
  let ariaDescription;
29
33
 
@@ -79,6 +83,11 @@ const ReviewHeaderStepItem = props => {
79
83
  }, /*#__PURE__*/_react.default.createElement(Content, props));
80
84
  };
81
85
 
86
+ Content.propTypes = process.env.NODE_ENV !== "production" ? _types.default : {};
87
+ Content.contextTypes = {
88
+ skin: _provider.default.childContextTypes.skin,
89
+ translate: _provider.default.childContextTypes.translate
90
+ };
82
91
  ReviewHeaderStepItem.propTypes = process.env.NODE_ENV !== "production" ? _types.default : {};
83
92
  var _default = ReviewHeaderStepItem;
84
93
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Content","props","icon","current","value","translate","GetTranslateFromContext","child","ariaDescription","headerStepValue","classnames","style","rightIcon","currentRightIcon","wrongIcon","currentWrongIcon","ReviewHeaderStepItem","default","right","wrong","propTypes"],"sources":["../../../src/atom/review-header-step-item/index.tsx"],"sourcesContent":["import React from 'react';\nimport classnames from 'classnames';\nimport {\n NovaCompositionCoorpacademyCheck as RightIcon,\n NovaSolidStatusClose as WrongIcon\n} from '@coorpacademy/nova-icons';\nimport {GetTranslateFromContext} from '../provider';\nimport style from './style.css';\nimport propTypes, {HeaderStepItemProps} from './types';\n\nconst Content = (props: HeaderStepItemProps) => {\n const {icon, current, value} = props;\n const translate = GetTranslateFromContext();\n let child;\n let ariaDescription;\n switch (icon) {\n case 'no-answer':\n child = value;\n ariaDescription = current\n ? translate('review_header_step_item.current_question', {\n headerStepValue: value\n })\n : translate('review_header_step_item.not_answered_question', {\n headerStepValue: value\n });\n break;\n\n case 'right':\n child = (\n <RightIcon className={classnames(style.rightIcon, current && style.currentRightIcon)} />\n );\n ariaDescription = translate('review_header_step_item.correct_question', {\n headerStepValue: value\n });\n break;\n\n case 'wrong':\n child = (\n <WrongIcon className={classnames(style.wrongIcon, current && style.currentWrongIcon)} />\n );\n ariaDescription = translate('review_header_step_item.incorrect_question', {\n headerStepValue: value\n });\n break;\n\n default:\n return null;\n }\n\n return (\n <span\n className={style.value}\n aria-label={translate('review_header_step_item.aria_label', {\n headerStepValue: value\n })}\n aria-describedby={ariaDescription}\n >\n {child}\n </span>\n );\n};\n\nconst ReviewHeaderStepItem = (props: HeaderStepItemProps) => {\n const {icon, current} = props;\n return (\n <div\n className={classnames(\n style.default,\n icon === 'right' && style.right,\n icon === 'wrong' && style.wrong,\n current && style.current\n )}\n data-name=\"header-step-item\"\n >\n <Content {...props} />\n </div>\n );\n};\n\nReviewHeaderStepItem.propTypes = propTypes;\n\nexport default ReviewHeaderStepItem;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AAIA;;AACA;;AACA;;;;AAEA,MAAMA,OAAO,GAAIC,KAAD,IAAgC;EAC9C,MAAM;IAACC,IAAD;IAAOC,OAAP;IAAgBC;EAAhB,IAAyBH,KAA/B;EACA,MAAMI,SAAS,GAAG,IAAAC,iCAAA,GAAlB;EACA,IAAIC,KAAJ;EACA,IAAIC,eAAJ;;EACA,QAAQN,IAAR;IACE,KAAK,WAAL;MACEK,KAAK,GAAGH,KAAR;MACAI,eAAe,GAAGL,OAAO,GACrBE,SAAS,CAAC,0CAAD,EAA6C;QACpDI,eAAe,EAAEL;MADmC,CAA7C,CADY,GAIrBC,SAAS,CAAC,+CAAD,EAAkD;QACzDI,eAAe,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 {"version":3,"file":"index.js","names":["Content","props","legacyContext","icon","current","value","translate","GetTranslateFromContext","child","ariaDescription","headerStepValue","classnames","style","rightIcon","currentRightIcon","wrongIcon","currentWrongIcon","ReviewHeaderStepItem","default","right","wrong","propTypes","contextTypes","skin","Provider","childContextTypes"],"sources":["../../../src/atom/review-header-step-item/index.tsx"],"sourcesContent":["import React from 'react';\nimport classnames from 'classnames';\nimport {\n NovaCompositionCoorpacademyCheck as RightIcon,\n NovaSolidStatusClose as WrongIcon\n} from '@coorpacademy/nova-icons';\nimport Provider, {GetTranslateFromContext} from '../provider';\nimport {WebContextValues} from '../provider/web-context';\nimport style from './style.css';\nimport propTypes, {HeaderStepItemProps} from './types';\n\nconst Content = (props: HeaderStepItemProps, legacyContext: WebContextValues) => {\n const {icon, current, value} = props;\n const translate = GetTranslateFromContext(legacyContext);\n let child;\n let ariaDescription;\n switch (icon) {\n case 'no-answer':\n child = value;\n ariaDescription = current\n ? translate('review_header_step_item.current_question', {\n headerStepValue: value\n })\n : translate('review_header_step_item.not_answered_question', {\n headerStepValue: value\n });\n break;\n\n case 'right':\n child = (\n <RightIcon className={classnames(style.rightIcon, current && style.currentRightIcon)} />\n );\n ariaDescription = translate('review_header_step_item.correct_question', {\n headerStepValue: value\n });\n break;\n\n case 'wrong':\n child = (\n <WrongIcon className={classnames(style.wrongIcon, current && style.currentWrongIcon)} />\n );\n ariaDescription = translate('review_header_step_item.incorrect_question', {\n headerStepValue: value\n });\n break;\n\n default:\n return null;\n }\n\n return (\n <span\n className={style.value}\n aria-label={translate('review_header_step_item.aria_label', {\n headerStepValue: value\n })}\n aria-describedby={ariaDescription}\n >\n {child}\n </span>\n );\n};\n\nconst ReviewHeaderStepItem = (props: HeaderStepItemProps) => {\n const {icon, current} = props;\n return (\n <div\n className={classnames(\n style.default,\n icon === 'right' && style.right,\n icon === 'wrong' && style.wrong,\n current && style.current\n )}\n data-name=\"header-step-item\"\n >\n <Content {...props} />\n </div>\n );\n};\n\nContent.propTypes = propTypes;\n\nContent.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nReviewHeaderStepItem.propTypes = propTypes;\n\nexport default ReviewHeaderStepItem;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AAIA;;AAEA;;AACA;;;;;;;;AAEA,MAAMA,OAAO,GAAG,CAACC,KAAD,EAA6BC,aAA7B,KAAiE;EAC/E,MAAM;IAACC,IAAD;IAAOC,OAAP;IAAgBC;EAAhB,IAAyBJ,KAA/B;EACA,MAAMK,SAAS,GAAG,IAAAC,iCAAA,EAAwBL,aAAxB,CAAlB;EACA,IAAIM,KAAJ;EACA,IAAIC,eAAJ;;EACA,QAAQN,IAAR;IACE,KAAK,WAAL;MACEK,KAAK,GAAGH,KAAR;MACAI,eAAe,GAAGL,OAAO,GACrBE,SAAS,CAAC,0CAAD,EAA6C;QACpDI,eAAe,EAAEL;MADmC,CAA7C,CADY,GAIrBC,SAAS,CAAC,+CAAD,EAAkD;QACzDI,eAAe,EAAEL;MADwC,CAAlD,CAJb;MAOA;;IAEF,KAAK,OAAL;MACEG,KAAK,gBACH,6BAAC,2CAAD;QAAW,SAAS,EAAE,IAAAG,mBAAA,EAAWC,cAAA,CAAMC,SAAjB,EAA4BT,OAAO,IAAIQ,cAAA,CAAME,gBAA7C;MAAtB,EADF;MAGAL,eAAe,GAAGH,SAAS,CAAC,0CAAD,EAA6C;QACtEI,eAAe,EAAEL;MADqD,CAA7C,CAA3B;MAGA;;IAEF,KAAK,OAAL;MACEG,KAAK,gBACH,6BAAC,+BAAD;QAAW,SAAS,EAAE,IAAAG,mBAAA,EAAWC,cAAA,CAAMG,SAAjB,EAA4BX,OAAO,IAAIQ,cAAA,CAAMI,gBAA7C;MAAtB,EADF;MAGAP,eAAe,GAAGH,SAAS,CAAC,4CAAD,EAA+C;QACxEI,eAAe,EAAEL;MADuD,CAA/C,CAA3B;MAGA;;IAEF;MACE,OAAO,IAAP;EA/BJ;;EAkCA,oBACE;IACE,SAAS,EAAEO,cAAA,CAAMP,KADnB;IAEE,cAAYC,SAAS,CAAC,oCAAD,EAAuC;MAC1DI,eAAe,EAAEL;IADyC,CAAvC,CAFvB;IAKE,oBAAkBI;EALpB,GAOGD,KAPH,CADF;AAWD,CAlDD;;AAoDA,MAAMS,oBAAoB,GAAIhB,KAAD,IAAgC;EAC3D,MAAM;IAACE,IAAD;IAAOC;EAAP,IAAkBH,KAAxB;EACA,oBACE;IACE,SAAS,EAAE,IAAAU,mBAAA,EACTC,cAAA,CAAMM,OADG,EAETf,IAAI,KAAK,OAAT,IAAoBS,cAAA,CAAMO,KAFjB,EAGThB,IAAI,KAAK,OAAT,IAAoBS,cAAA,CAAMQ,KAHjB,EAIThB,OAAO,IAAIQ,cAAA,CAAMR,OAJR,CADb;IAOE,aAAU;EAPZ,gBASE,6BAAC,OAAD,EAAaH,KAAb,CATF,CADF;AAaD,CAfD;;AAiBAD,OAAO,CAACqB,SAAR,2CAAoBA,cAApB;AAEArB,OAAO,CAACsB,YAAR,GAAuB;EACrBC,IAAI,EAAEC,iBAAA,CAASC,iBAAT,CAA2BF,IADZ;EAErBjB,SAAS,EAAEkB,iBAAA,CAASC,iBAAT,CAA2BnB;AAFjB,CAAvB;AAKAW,oBAAoB,CAACI,SAArB,2CAAiCA,cAAjC;eAEeJ,oB"}
@@ -1,12 +1,15 @@
1
1
  export function toggleStateOnKeyPress(state: any, setState: any, ref: any): (event: any) => void;
2
2
  export default ToolTip;
3
- declare function ToolTip({ anchorId, TooltipContent, "aria-label": ariaLabel, "data-testid": dataTestId, closeToolTipInformationTextAriaLabel, toolTipIsVisible: _toolTipIsVisible }: {
3
+ declare function ToolTip({ anchorId, TooltipContent, "aria-label": ariaLabel, "data-testid": dataTestId, closeToolTipInformationTextAriaLabel, toolTipIsVisible: _toolTipIsVisible, iconContainerClassName, delayHide, fontSize }: {
4
4
  anchorId: any;
5
5
  TooltipContent: any;
6
6
  "aria-label": any;
7
7
  "data-testid": any;
8
8
  closeToolTipInformationTextAriaLabel: any;
9
9
  toolTipIsVisible: any;
10
+ iconContainerClassName: any;
11
+ delayHide?: number | undefined;
12
+ fontSize?: number | undefined;
10
13
  }): JSX.Element;
11
14
  declare namespace ToolTip {
12
15
  const propTypes: {
@@ -14,6 +17,9 @@ declare namespace ToolTip {
14
17
  'data-testid': PropTypes.Requireable<string>;
15
18
  'aria-label': PropTypes.Requireable<string>;
16
19
  closeToolTipInformationTextAriaLabel: PropTypes.Validator<string>;
20
+ iconContainerClassName: PropTypes.Requireable<string>;
21
+ delayHide: PropTypes.Requireable<number>;
22
+ fontSize: PropTypes.Requireable<number>;
17
23
  anchorId: PropTypes.Requireable<string>;
18
24
  toolTipIsVisible: PropTypes.Requireable<boolean>;
19
25
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/tooltip/index.js"],"names":[],"mappings":"AA+CO,iGASN;;AAED;;;;;;;gBA2EC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/tooltip/index.js"],"names":[],"mappings":"AAwDO,iGASN;;AAED;;;;;;;;;;gBAwFC"}
@@ -5,6 +5,8 @@ exports.toggleStateOnKeyPress = exports.default = void 0;
5
5
 
6
6
  var _react = _interopRequireWildcard(require("react"));
7
7
 
8
+ var _classnames = _interopRequireDefault(require("classnames"));
9
+
8
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
11
 
10
12
  var _reactTooltip = _interopRequireDefault(require("react-tooltip"));
@@ -21,11 +23,17 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
21
23
 
22
24
  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; }
23
25
 
26
+ const FontSizes = {
27
+ 12: _style.default.tooltipContentFontSize12,
28
+ 14: _style.default.tooltipContentFontSize14
29
+ };
30
+
24
31
  const ToolTipWrapper = ({
25
32
  toolTipIsVisible,
26
33
  anchorId,
27
34
  closeToolTipInformationTextAriaLabel,
28
- content
35
+ content,
36
+ handleContentMouseOver
29
37
  }) => {
30
38
  if (!toolTipIsVisible) return null;
31
39
 
@@ -42,7 +50,8 @@ const ToolTipWrapper = ({
42
50
  return /*#__PURE__*/_react.default.createElement("div", {
43
51
  className: _style.default.toolTip,
44
52
  "data-testid": "tooltip",
45
- "aria-label": closeToolTipInformationTextAriaLabel
53
+ "aria-label": closeToolTipInformationTextAriaLabel,
54
+ onMouseOver: handleContentMouseOver
46
55
  }, content);
47
56
  }
48
57
  };
@@ -51,7 +60,8 @@ ToolTipWrapper.propTypes = process.env.NODE_ENV !== "production" ? {
51
60
  toolTipIsVisible: _propTypes.default.bool,
52
61
  anchorId: _propTypes.default.string,
53
62
  closeToolTipInformationTextAriaLabel: _propTypes.default.string.isRequired,
54
- content: _propTypes.default.node
63
+ content: _propTypes.default.node,
64
+ handleContentMouseOver: _propTypes.default.func
55
65
  } : {};
56
66
 
57
67
  const toggleStateOnKeyPress = (state, setState, ref) => event => {
@@ -73,38 +83,49 @@ const ToolTip = ({
73
83
  'aria-label': ariaLabel,
74
84
  'data-testid': dataTestId,
75
85
  closeToolTipInformationTextAriaLabel,
76
- toolTipIsVisible: _toolTipIsVisible
86
+ toolTipIsVisible: _toolTipIsVisible,
87
+ iconContainerClassName,
88
+ delayHide = 250,
89
+ fontSize = 14
77
90
  }) => {
78
91
  const isComponent = (0, _react.useMemo)(() => !(0, _isString.default)(TooltipContent) && /*#__PURE__*/(0, _react.isValidElement)(TooltipContent()), [TooltipContent]);
79
92
  const [toolTipIsVisible, setToolTipIsVisible] = (0, _react.useState)(false);
93
+ const [mouseLeaveTimer, setMouseLeaveTimer] = (0, _react.useState)(undefined);
80
94
  const handleKeyPress = (0, _react.useCallback)(event => {
81
95
  toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible)(event);
82
96
  }, [toolTipIsVisible]);
97
+ const handleContentMouseOver = (0, _react.useCallback)(() => {
98
+ mouseLeaveTimer &&
99
+ /* istanbul ignore next */
100
+ clearTimeout(mouseLeaveTimer);
101
+ }, [mouseLeaveTimer]);
83
102
  const handleMouseOver = (0, _react.useCallback)(() => {
103
+ mouseLeaveTimer && clearTimeout(mouseLeaveTimer);
84
104
  setToolTipIsVisible(true);
85
- }, []);
105
+ }, [mouseLeaveTimer]);
86
106
  const handleMouseLeave = (0, _react.useCallback)(() => {
87
- setToolTipIsVisible(false);
88
- }, []);
107
+ setMouseLeaveTimer(setTimeout(() => setToolTipIsVisible(false), delayHide));
108
+ }, [delayHide]);
89
109
  const content = (0, _react.useMemo)(() => {
90
110
  return isComponent ? /*#__PURE__*/_react.default.createElement(TooltipContent, null) : /*#__PURE__*/_react.default.createElement("p", {
91
- className: _style.default.tooltipContent
111
+ className: (0, _classnames.default)([_style.default.tooltipContent, FontSizes[fontSize]])
92
112
  }, TooltipContent);
93
- }, [TooltipContent, isComponent]);
113
+ }, [TooltipContent, fontSize, isComponent]);
94
114
  return anchorId ? /*#__PURE__*/_react.default.createElement(ToolTipWrapper, {
95
115
  toolTipIsVisible: _toolTipIsVisible,
96
116
  anchorId: anchorId,
97
117
  closeToolTipInformationTextAriaLabel: closeToolTipInformationTextAriaLabel,
98
118
  content: content,
99
119
  onMouseLeave: handleMouseLeave,
100
- onMouseOver: handleMouseOver
120
+ onMouseOver: handleMouseOver,
121
+ fontSize: fontSize
101
122
  }) : /*#__PURE__*/_react.default.createElement("div", {
102
123
  className: _style.default.tooltipContainer,
103
124
  onMouseLeave: handleMouseLeave,
104
125
  onMouseOver: handleMouseOver
105
126
  }, /*#__PURE__*/_react.default.createElement("button", {
106
127
  type: "button",
107
- className: _style.default.tooltipIconContainer,
128
+ className: (0, _classnames.default)([_style.default.tooltipIconContainer, iconContainerClassName]),
108
129
  "data-testid": dataTestId,
109
130
  onKeyDown: handleKeyPress,
110
131
  tabIndex: 0
@@ -117,7 +138,9 @@ const ToolTip = ({
117
138
  toolTipIsVisible: toolTipIsVisible,
118
139
  anchorId: anchorId,
119
140
  closeToolTipInformationTextAriaLabel: closeToolTipInformationTextAriaLabel,
120
- content: content
141
+ content: content,
142
+ handleContentMouseOver: handleContentMouseOver,
143
+ fontSize: fontSize
121
144
  }));
122
145
  };
123
146
 
@@ -126,8 +149,12 @@ ToolTip.propTypes = process.env.NODE_ENV !== "production" ? {
126
149
  'data-testid': _propTypes.default.string,
127
150
  'aria-label': _propTypes.default.string,
128
151
  closeToolTipInformationTextAriaLabel: _propTypes.default.string.isRequired,
129
- // ---------- externalHandling --------------
130
- // if passed down, React Tooltip is used instead, due to limitations on
152
+ // ---------- Regular Tooltip exclusive --------------
153
+ iconContainerClassName: _propTypes.default.string,
154
+ delayHide: _propTypes.default.number,
155
+ fontSize: _propTypes.default.oneOf([12, 14]),
156
+ // ---------- React Tooltip exclusive --------------
157
+ // externalHandling: if passed down, React Tooltip is used instead, due to limitations on
131
158
  // parents overflow hidden controls
132
159
  anchorId: _propTypes.default.string,
133
160
  toolTipIsVisible: _propTypes.default.bool
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["ToolTipWrapper","toolTipIsVisible","anchorId","closeToolTipInformationTextAriaLabel","content","style","toolTipReact","toolTip","propTypes","PropTypes","bool","string","isRequired","node","toggleStateOnKeyPress","state","setState","ref","event","key","current","focus","stopPropagation","preventDefault","ToolTip","TooltipContent","ariaLabel","dataTestId","_toolTipIsVisible","isComponent","useMemo","isString","isValidElement","setToolTipIsVisible","useState","handleKeyPress","useCallback","handleMouseOver","handleMouseLeave","tooltipContent","tooltipContainer","tooltipIconContainer","informationIcon","oneOfType","func"],"sources":["../../../src/atom/tooltip/index.js"],"sourcesContent":["import React, {isValidElement, useState, useCallback, useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport ReactTooltip from 'react-tooltip';\nimport isString from 'lodash/fp/isString';\nimport {NovaCompositionCoorpacademyInformationIcon as InformationIcon} from '@coorpacademy/nova-icons';\nimport style from './style.css';\n\nconst ToolTipWrapper = ({\n toolTipIsVisible,\n anchorId,\n closeToolTipInformationTextAriaLabel,\n content\n}) => {\n if (!toolTipIsVisible) return null;\n if (anchorId) {\n return (\n <ReactTooltip\n id={anchorId}\n className={style.toolTipReact}\n data-event-off=\"click\"\n place=\"left\"\n effect=\"solid\"\n aria-label={closeToolTipInformationTextAriaLabel}\n >\n {content}\n </ReactTooltip>\n );\n } else {\n return (\n <div\n className={style.toolTip}\n data-testid=\"tooltip\"\n aria-label={closeToolTipInformationTextAriaLabel}\n >\n {content}\n </div>\n );\n }\n};\n\nToolTipWrapper.propTypes = {\n toolTipIsVisible: PropTypes.bool,\n anchorId: PropTypes.string,\n closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,\n content: PropTypes.node\n};\n\nexport const toggleStateOnKeyPress = (state, setState, ref) => event => {\n if (event.key === 'Enter') {\n if (ref) ref.current.focus();\n event.stopPropagation();\n event.preventDefault();\n setState(!state);\n } else if (event.key === 'Tab' || event.key === 'Escape') {\n setState(false);\n }\n};\n\nconst ToolTip = ({\n anchorId,\n TooltipContent,\n 'aria-label': ariaLabel,\n 'data-testid': dataTestId,\n closeToolTipInformationTextAriaLabel,\n toolTipIsVisible: _toolTipIsVisible\n}) => {\n const isComponent = useMemo(\n () => !isString(TooltipContent) && isValidElement(TooltipContent()),\n [TooltipContent]\n );\n\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n\n const handleKeyPress = useCallback(\n event => {\n toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible)(event);\n },\n [toolTipIsVisible]\n );\n\n const handleMouseOver = useCallback(() => {\n setToolTipIsVisible(true);\n }, []);\n\n const handleMouseLeave = useCallback(() => {\n setToolTipIsVisible(false);\n }, []);\n\n const content = useMemo(() => {\n return isComponent ? (\n <TooltipContent />\n ) : (\n <p className={style.tooltipContent}>{TooltipContent}</p>\n );\n }, [TooltipContent, isComponent]);\n\n return anchorId ? (\n <ToolTipWrapper\n toolTipIsVisible={_toolTipIsVisible}\n anchorId={anchorId}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n content={content}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n />\n ) : (\n <div\n className={style.tooltipContainer}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n >\n <button\n type=\"button\"\n className={style.tooltipIconContainer}\n data-testid={dataTestId}\n onKeyDown={handleKeyPress}\n tabIndex={0}\n >\n <InformationIcon\n className={style.informationIcon}\n width={12}\n height={12}\n aria-label={ariaLabel}\n />\n </button>\n <ToolTipWrapper\n toolTipIsVisible={toolTipIsVisible}\n anchorId={anchorId}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n content={content}\n />\n </div>\n );\n};\n\nToolTip.propTypes = {\n TooltipContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node, PropTypes.string]),\n 'data-testid': PropTypes.string,\n 'aria-label': PropTypes.string,\n closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,\n // ---------- externalHandling --------------\n // if passed down, React Tooltip is used instead, due to limitations on\n // parents overflow hidden controls\n anchorId: PropTypes.string,\n toolTipIsVisible: PropTypes.bool\n};\n\nexport default ToolTip;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,MAAMA,cAAc,GAAG,CAAC;EACtBC,gBADsB;EAEtBC,QAFsB;EAGtBC,oCAHsB;EAItBC;AAJsB,CAAD,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QADP;IAEE,SAAS,EAAEhC,cAAA,CAAMoC,oBAFnB;IAGE,eAAad,UAHf;IAIE,SAAS,EAAEQ,cAJb;IAKE,QAAQ,EAAE;EALZ,gBAOE,6BAAC,qDAAD;IACE,SAAS,EAAE9B,cAAA,CAAMqC,eADnB;IAEE,KAAK,EAAE,EAFT;IAGE,MAAM,EAAE,EAHV;IAIE,cAAYhB;EAJd,EAPF,CALF,eAmBE,6BAAC,cAAD;IACE,gBAAgB,EAAEzB,gBADpB;IAEE,QAAQ,EAAEC,QAFZ;IAGE,oCAAoC,EAAEC,oCAHxC;IAIE,OAAO,EAAEC;EAJX,EAnBF,CAVF;AAqCD,CA3ED;;AA6EAoB,OAAO,CAAChB,SAAR,2CAAoB;EAClBiB,cAAc,EAAEhB,kBAAA,CAAUkC,SAAV,CAAoB,CAAClC,kBAAA,CAAUmC,IAAX,EAAiBnC,kBAAA,CAAUI,IAA3B,EAAiCJ,kBAAA,CAAUE,MAA3C,CAApB,CADE;EAElB,eAAeF,kBAAA,CAAUE,MAFP;EAGlB,cAAcF,kBAAA,CAAUE,MAHN;EAIlBR,oCAAoC,EAAEM,kBAAA,CAAUE,MAAV,CAAiBC,UAJrC;EAKlB;EACA;EACA;EACAV,QAAQ,EAAEO,kBAAA,CAAUE,MARF;EASlBV,gBAAgB,EAAEQ,kBAAA,CAAUC;AATV,CAApB;eAYec,O"}
1
+ {"version":3,"file":"index.js","names":["FontSizes","style","tooltipContentFontSize12","tooltipContentFontSize14","ToolTipWrapper","toolTipIsVisible","anchorId","closeToolTipInformationTextAriaLabel","content","handleContentMouseOver","toolTipReact","toolTip","propTypes","PropTypes","bool","string","isRequired","node","func","toggleStateOnKeyPress","state","setState","ref","event","key","current","focus","stopPropagation","preventDefault","ToolTip","TooltipContent","ariaLabel","dataTestId","_toolTipIsVisible","iconContainerClassName","delayHide","fontSize","isComponent","useMemo","isString","isValidElement","setToolTipIsVisible","useState","mouseLeaveTimer","setMouseLeaveTimer","undefined","handleKeyPress","useCallback","clearTimeout","handleMouseOver","handleMouseLeave","setTimeout","classnames","tooltipContent","tooltipContainer","tooltipIconContainer","informationIcon","oneOfType","number","oneOf"],"sources":["../../../src/atom/tooltip/index.js"],"sourcesContent":["import React, {isValidElement, useState, useCallback, useMemo} from 'react';\nimport classnames from 'classnames';\nimport PropTypes from 'prop-types';\nimport ReactTooltip from 'react-tooltip';\nimport isString from 'lodash/fp/isString';\nimport {NovaCompositionCoorpacademyInformationIcon as InformationIcon} from '@coorpacademy/nova-icons';\nimport style from './style.css';\n\nconst FontSizes = {\n 12: style.tooltipContentFontSize12,\n 14: style.tooltipContentFontSize14\n};\n\nconst ToolTipWrapper = ({\n toolTipIsVisible,\n anchorId,\n closeToolTipInformationTextAriaLabel,\n content,\n handleContentMouseOver\n}) => {\n if (!toolTipIsVisible) return null;\n if (anchorId) {\n return (\n <ReactTooltip\n id={anchorId}\n className={style.toolTipReact}\n data-event-off=\"click\"\n place=\"left\"\n effect=\"solid\"\n aria-label={closeToolTipInformationTextAriaLabel}\n >\n {content}\n </ReactTooltip>\n );\n } else {\n return (\n <div\n className={style.toolTip}\n data-testid=\"tooltip\"\n aria-label={closeToolTipInformationTextAriaLabel}\n onMouseOver={handleContentMouseOver}\n >\n {content}\n </div>\n );\n }\n};\n\nToolTipWrapper.propTypes = {\n toolTipIsVisible: PropTypes.bool,\n anchorId: PropTypes.string,\n closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,\n content: PropTypes.node,\n handleContentMouseOver: PropTypes.func\n};\n\nexport const toggleStateOnKeyPress = (state, setState, ref) => event => {\n if (event.key === 'Enter') {\n if (ref) ref.current.focus();\n event.stopPropagation();\n event.preventDefault();\n setState(!state);\n } else if (event.key === 'Tab' || event.key === 'Escape') {\n setState(false);\n }\n};\n\nconst ToolTip = ({\n anchorId,\n TooltipContent,\n 'aria-label': ariaLabel,\n 'data-testid': dataTestId,\n closeToolTipInformationTextAriaLabel,\n toolTipIsVisible: _toolTipIsVisible,\n iconContainerClassName,\n delayHide = 250,\n fontSize = 14\n}) => {\n const isComponent = useMemo(\n () => !isString(TooltipContent) && isValidElement(TooltipContent()),\n [TooltipContent]\n );\n\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n\n const [mouseLeaveTimer, setMouseLeaveTimer] = useState(undefined);\n\n const handleKeyPress = useCallback(\n event => {\n toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible)(event);\n },\n [toolTipIsVisible]\n );\n\n const handleContentMouseOver = useCallback(() => {\n mouseLeaveTimer && /* istanbul ignore next */ clearTimeout(mouseLeaveTimer);\n }, [mouseLeaveTimer]);\n\n const handleMouseOver = useCallback(() => {\n mouseLeaveTimer && clearTimeout(mouseLeaveTimer);\n setToolTipIsVisible(true);\n }, [mouseLeaveTimer]);\n\n const handleMouseLeave = useCallback(() => {\n setMouseLeaveTimer(setTimeout(() => setToolTipIsVisible(false), delayHide));\n }, [delayHide]);\n\n const content = useMemo(() => {\n return isComponent ? (\n <TooltipContent />\n ) : (\n <p className={classnames([style.tooltipContent, FontSizes[fontSize]])}>{TooltipContent}</p>\n );\n }, [TooltipContent, fontSize, isComponent]);\n\n return anchorId ? (\n <ToolTipWrapper\n toolTipIsVisible={_toolTipIsVisible}\n anchorId={anchorId}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n content={content}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n fontSize={fontSize}\n />\n ) : (\n <div\n className={style.tooltipContainer}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n >\n <button\n type=\"button\"\n className={classnames([style.tooltipIconContainer, iconContainerClassName])}\n data-testid={dataTestId}\n onKeyDown={handleKeyPress}\n tabIndex={0}\n >\n <InformationIcon\n className={style.informationIcon}\n width={12}\n height={12}\n aria-label={ariaLabel}\n />\n </button>\n <ToolTipWrapper\n toolTipIsVisible={toolTipIsVisible}\n anchorId={anchorId}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n content={content}\n handleContentMouseOver={handleContentMouseOver}\n fontSize={fontSize}\n />\n </div>\n );\n};\n\nToolTip.propTypes = {\n TooltipContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node, PropTypes.string]),\n 'data-testid': PropTypes.string,\n 'aria-label': PropTypes.string,\n closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,\n // ---------- Regular Tooltip exclusive --------------\n iconContainerClassName: PropTypes.string,\n delayHide: PropTypes.number,\n fontSize: PropTypes.oneOf([12, 14]),\n // ---------- React Tooltip exclusive --------------\n // externalHandling: if passed down, React Tooltip is used instead, due to limitations on\n // parents overflow hidden controls\n anchorId: PropTypes.string,\n toolTipIsVisible: PropTypes.bool\n};\n\nexport default ToolTip;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,MAAMA,SAAS,GAAG;EAChB,IAAIC,cAAA,CAAMC,wBADM;EAEhB,IAAID,cAAA,CAAME;AAFM,CAAlB;;AAKA,MAAMC,cAAc,GAAG,CAAC;EACtBC,gBADsB;EAEtBC,QAFsB;EAGtBC,oCAHsB;EAItBC,OAJsB;EAKtBC;AALsB,CAAD,KAMjB;EACJ,IAAI,CAACJ,gBAAL,EAAuB,OAAO,IAAP;;EACvB,IAAIC,QAAJ,EAAc;IACZ,oBACE,6BAAC,qBAAD;MACE,EAAE,EAAEA,QADN;MAEE,SAAS,EAAEL,cAAA,CAAMS,YAFnB;MAGE,kBAAe,OAHjB;MAIE,KAAK,EAAC,MAJR;MAKE,MAAM,EAAC,OALT;MAME,cAAYH;IANd,GAQGC,OARH,CADF;EAYD,CAbD,MAaO;IACL,oBACE;MACE,SAAS,EAAEP,cAAA,CAAMU,OADnB;MAEE,eAAY,SAFd;MAGE,cAAYJ,oCAHd;MAIE,WAAW,EAAEE;IAJf,GAMGD,OANH,CADF;EAUD;AACF,CAjCD;;AAmCAJ,cAAc,CAACQ,SAAf,2CAA2B;EACzBP,gBAAgB,EAAEQ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BAAgB,EAAEQ,kBAAA,CAAUC;AAbV,CAApB;eAgBee,O"}
@@ -67,6 +67,15 @@
67
67
  text-align: center;
68
68
  }
69
69
 
70
+ .tooltipContentFontSize14 {
71
+ font-size: 14px;
72
+ }
73
+
74
+ .tooltipContentFontSize12 {
75
+ font-size: 12px;
76
+ }
77
+
78
+
70
79
  .informationIcon {
71
80
  color: cm_grey_500;
72
81
  }
@@ -2,6 +2,9 @@ export default Answer;
2
2
  declare function Answer(props: any): JSX.Element;
3
3
  declare namespace Answer {
4
4
  export { propTypes };
5
+ export namespace contextTypes {
6
+ const translate: import("prop-types").Requireable<(...args: any[]) => any>;
7
+ }
5
8
  }
6
9
  import propTypes from "./prop-types";
7
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/answer/index.js"],"names":[],"mappings":";AAwEA,iDAWC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/answer/index.js"],"names":[],"mappings":";AA4EA,iDAWC"}