@stokr/components-library 2.3.65-beta.1 → 2.3.65-beta.11

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 (222) hide show
  1. package/dist/components/2FA/main-flow.js +28 -7
  2. package/dist/components/AdminDashboard/Table/ReactTable.js +123 -7
  3. package/dist/components/Chips/Chip.js +1 -2
  4. package/dist/components/Chips/Chip.styles.js +3 -2
  5. package/dist/components/Input/Input.js +33 -33
  6. package/dist/components/Input/MultiSelect.js +319 -0
  7. package/dist/components/Input/SearchInput.js +78 -0
  8. package/dist/components/Input/SearchInput.styles.js +25 -0
  9. package/dist/components/Input/Select.js +51 -28
  10. package/dist/components/Modal/SideModal.js +82 -0
  11. package/dist/components/Modal/SideModal.styles.js +21 -0
  12. package/dist/components/Payment/PaymentDetailsCard.js +189 -0
  13. package/dist/components/Payment/PaymentDisplay.js +2 -12
  14. package/dist/components/ProfileBox/ProfileBox.js +2 -1
  15. package/dist/components/Snackbar/Snackbar.js +193 -0
  16. package/dist/components/Snackbar/Snackbar.styles.js +97 -0
  17. package/dist/components/Snackbar/SnackbarProvider.js +81 -0
  18. package/dist/components/Snackbar/index.js +32 -0
  19. package/dist/components/Snackbar/useSnackbar.js +43 -0
  20. package/dist/components/StatusTag/StatusTag.js +175 -0
  21. package/dist/components/StatusTag/StatusTag.styles.js +37 -0
  22. package/dist/components/StepsProgress/StepIndicator.js +59 -0
  23. package/dist/components/StepsProgress/StepIndicator.styles.js +30 -0
  24. package/dist/components/TextLink/TextLink.styles.js +1 -1
  25. package/dist/components/Timeline/TimelineStep.js +2 -2
  26. package/dist/constants/globalVariables.js +41 -2
  27. package/dist/context/Checkbox/CheckboxContext.js +0 -1
  28. package/dist/index.js +66 -0
  29. package/dist/static/images/bmn2-logo.svg +9 -0
  30. package/dist/static/images/document-icon.svg +3 -0
  31. package/dist/static/images/plus-icon.svg +4 -0
  32. package/dist/static/images/search-icon.svg +3 -0
  33. package/dist/static/images/sent-icon.svg +10 -0
  34. package/dist/static/images/transfer-icon.svg +10 -0
  35. package/dist/utils/formatCurrencyValue.js +43 -3
  36. package/package.json +3 -2
  37. package/dist/components/2FA/EnterCode.stories.js +0 -35
  38. package/dist/components/2FA/disable-2fa-flow.stories.js +0 -31
  39. package/dist/components/2FA/enable-2fa-flow.stories.js +0 -31
  40. package/dist/components/2FA/login-with-otp-flow.stories.js +0 -31
  41. package/dist/components/2FA/main-flow.stories.js +0 -33
  42. package/dist/components/AccountBalance/AccountBalance.stories.js +0 -83
  43. package/dist/components/AdminDashboard/Table/ReactTable.stories.js +0 -406
  44. package/dist/components/AgreementItem/AgreementItem.stories.js +0 -105
  45. package/dist/components/AnalyticGraphs/Analytic.js +0 -541
  46. package/dist/components/AnalyticGraphs/Analytic.styles.js +0 -25
  47. package/dist/components/BackButton/BackButton.stories.js +0 -32
  48. package/dist/components/Background/Background.stories.js +0 -75
  49. package/dist/components/BarChart/BarChart.js +0 -263
  50. package/dist/components/BarChart/BarChart.stories.js +0 -66
  51. package/dist/components/BarChart/BarChart.styles.js +0 -26
  52. package/dist/components/BarChartLegend/BarChartLegend.js +0 -79
  53. package/dist/components/BarChartLegend/BarChartLegend.styles.js +0 -21
  54. package/dist/components/BasicTable/BasicTable.stories.js +0 -59
  55. package/dist/components/BlogPost/BlogPost.stories.js +0 -160
  56. package/dist/components/Button/Button.stories.js +0 -146
  57. package/dist/components/Button/GlareButton.stories.js +0 -132
  58. package/dist/components/CapitalRaisedSummary/CapitalRaisedSummery.stories.js +0 -42
  59. package/dist/components/ChartBox/ChartBox.js +0 -41
  60. package/dist/components/ChartBox/ChartBox.stories.js +0 -17
  61. package/dist/components/ChartBox/ChartBox.styles.js +0 -27
  62. package/dist/components/ChartBox/ChartBoxDistribution.js +0 -27
  63. package/dist/components/ChartBox/ChartBoxDistribution.stories.js +0 -18
  64. package/dist/components/ChartLegend/ChartLegend.stories.js +0 -90
  65. package/dist/components/Checkbox/Checkbox.stories.js +0 -88
  66. package/dist/components/Checklist/ChecklistCard.stories.js +0 -102
  67. package/dist/components/Checklist/UserChecklist.js +0 -184
  68. package/dist/components/Checklist/UserChecklist.stories.js +0 -317
  69. package/dist/components/Chips/Chip.stories.js +0 -36
  70. package/dist/components/Chips/ChipsWrapper.stories.js +0 -47
  71. package/dist/components/ComponentScroll/ComponentScroll.stories.js +0 -111
  72. package/dist/components/CryptoAddress/CryptoAddress.stories.js +0 -205
  73. package/dist/components/CryptoAddressDetails/CryptoAddressDetails.stories.js +0 -70
  74. package/dist/components/DonutChart/DonutChart.stories.js +0 -54
  75. package/dist/components/FAQ/FAQ.stories.js +0 -76
  76. package/dist/components/Footer/Footer.stories.js +0 -49
  77. package/dist/components/Footer/FooterLayout.stories.js +0 -26
  78. package/dist/components/Footer/FooterMenu.stories.js +0 -113
  79. package/dist/components/Footer/mangopay.png +0 -0
  80. package/dist/components/Footer/mangopay.svg +0 -20
  81. package/dist/components/ForgotPasswordModal/ForgotPasswordModal.stories.js +0 -69
  82. package/dist/components/Form/Form.stories.js +0 -32
  83. package/dist/components/FullscreenCard/FullscreenCard.styles.js +0 -27
  84. package/dist/components/Header/Header.stories.js +0 -192
  85. package/dist/components/InfoIcon/InfoIcon.stories.js +0 -299
  86. package/dist/components/InfoPanel/InfoPanel.js +0 -124
  87. package/dist/components/Input/DatePickerInput.stories.js +0 -87
  88. package/dist/components/Input/Input.stories.js +0 -142
  89. package/dist/components/Input/InputPassword.stories.js +0 -80
  90. package/dist/components/Input/InputWithButton.stories.js +0 -75
  91. package/dist/components/Input/OtpInput.stories.js +0 -57
  92. package/dist/components/Input/RangeInput.stories.js +0 -58
  93. package/dist/components/Input/Select.stories.js +0 -139
  94. package/dist/components/InvestCalculator/InvestCalculator.stories.js +0 -135
  95. package/dist/components/InvestmentStat/InvestmentStat.stories.js +0 -52
  96. package/dist/components/KYCFlow/BasicInfo.js +0 -448
  97. package/dist/components/KYCFlow/Confirmation.js +0 -46
  98. package/dist/components/KYCFlow/DocumentFileUpload.js +0 -263
  99. package/dist/components/KYCFlow/DocumentScan.js +0 -75
  100. package/dist/components/KYCFlow/DocumentScanUpload.js +0 -251
  101. package/dist/components/KYCFlow/DocumentSelect.js +0 -118
  102. package/dist/components/KYCFlow/DocumentSuccess.js +0 -63
  103. package/dist/components/KYCFlow/DocumentUpload.js +0 -53
  104. package/dist/components/KYCFlow/DocumentVerificationType.js +0 -131
  105. package/dist/components/KYCFlow/FaceScan.js +0 -54
  106. package/dist/components/KYCFlow/FaceScanRecognition.js +0 -61
  107. package/dist/components/KYCFlow/FaceScanSuccess.js +0 -56
  108. package/dist/components/KYCFlow/Terms.js +0 -119
  109. package/dist/components/KYCFlow/_styles.js +0 -111
  110. package/dist/components/KYCFlow/index.js +0 -97
  111. package/dist/components/KYCSelectBox/KYCSelectBox.styles.js +0 -29
  112. package/dist/components/LatestUpdate/LatestUpdate.stories.js +0 -58
  113. package/dist/components/Layout/Layout.stories.js +0 -60
  114. package/dist/components/LearnMoreCarousel/LearnMoreCarousel.stories.js +0 -66
  115. package/dist/components/LearnMorePage/LearnMore.stories.js +0 -48
  116. package/dist/components/LearnMorePage/LearnMoreItem.stories.js +0 -62
  117. package/dist/components/LearnMoreSection/LearnMore.stories.js +0 -30
  118. package/dist/components/LearnMoreSection/LearnMoreItem.stories.js +0 -59
  119. package/dist/components/LoginModal/LoginModal.stories.js +0 -74
  120. package/dist/components/MatomoConnect/Matomo.js +0 -228
  121. package/dist/components/MatomoConnect/Matomo_fuckup.js +0 -387
  122. package/dist/components/Modal/Modal.stories.js +0 -75
  123. package/dist/components/Modal/NewVentureModal/NewVentureModal.stories.js +0 -150
  124. package/dist/components/Modal/PaymentModal.stories.js +0 -57
  125. package/dist/components/MultiProgressBar/MultiProgressBar.stories.js +0 -67
  126. package/dist/components/Newsletter/Newsletter.stories.js +0 -16
  127. package/dist/components/NotificationContext/NotificationContext.js +0 -141
  128. package/dist/components/Number/Number.stories.js +0 -92
  129. package/dist/components/Pagination/Pagination.stories.js +0 -83
  130. package/dist/components/Pagination/PaginationControls.stories.js +0 -112
  131. package/dist/components/Payment/PaymentDisplay.stories.js +0 -302
  132. package/dist/components/Payment/TimerComponent.stories.js +0 -236
  133. package/dist/components/Process/Process.stories.js +0 -42
  134. package/dist/components/ProfileBadge/ProfileBadge.stories.js +0 -45
  135. package/dist/components/ProfileBox/ProfileBox.stories.js +0 -35
  136. package/dist/components/ProfileHeader/ProfileHeader.js +0 -252
  137. package/dist/components/ProfileHeader/ProfileHeader.styles.js +0 -65
  138. package/dist/components/ProfileStat/ProfileStat.stories.js +0 -66
  139. package/dist/components/ProofOfAddress/ProofOfAddress.styles.js +0 -53
  140. package/dist/components/QRCode/QRCode.stories.js +0 -104
  141. package/dist/components/Radio/Radio.stories.js +0 -73
  142. package/dist/components/RefreshButton/RefreshButton.stories.js +0 -38
  143. package/dist/components/RegisterAlgorand/AlgoAddressName.js +0 -138
  144. package/dist/components/RegisterAlgorand/AlgoAdressSelect.js +0 -443
  145. package/dist/components/RegisterAlgorand/AlgoConnectWallet.js +0 -47
  146. package/dist/components/RegisterAlgorand/AlgoSuccess.js +0 -38
  147. package/dist/components/RegisterAlgorand/Algorand.stories.js +0 -80
  148. package/dist/components/RegisterAlgorand/ChooseWallet.js +0 -97
  149. package/dist/components/RegisterAlgorand/SelectProject.js +0 -89
  150. package/dist/components/RegisterAlgorand/_styles.js +0 -28
  151. package/dist/components/RegisterAlgorand/flow.js +0 -409
  152. package/dist/components/RegisterAlgorand/flowWithMemo.js +0 -410
  153. package/dist/components/RegisterAlgorand/index.js +0 -48
  154. package/dist/components/RegisterConfirmModal/RegisterConfirmModal.stories.js +0 -41
  155. package/dist/components/RegisterEthereum/EthAddressLedger.js +0 -226
  156. package/dist/components/RegisterEthereum/EthAddressMetamask.js +0 -204
  157. package/dist/components/RegisterEthereum/EthAddressName.js +0 -135
  158. package/dist/components/RegisterEthereum/EthConnectLedger.js +0 -194
  159. package/dist/components/RegisterEthereum/EthConnectMetamask.js +0 -35
  160. package/dist/components/RegisterEthereum/EthFinish.js +0 -41
  161. package/dist/components/RegisterEthereum/EthIntro.js +0 -95
  162. package/dist/components/RegisterEthereum/_styles.js +0 -28
  163. package/dist/components/RegisterEthereum/index.js +0 -68
  164. package/dist/components/RegisterModal/RegisterModal.stories.js +0 -49
  165. package/dist/components/RequestDataBox/RequestDataBox.stories.js +0 -37
  166. package/dist/components/RiskQuestionnaire/RiskQuestionnaireContext.js +0 -185
  167. package/dist/components/RiskQuestionnaire/_styles.js +0 -15
  168. package/dist/components/SEO/SEO.stories.js +0 -60
  169. package/dist/components/SideLine/SideLine.stories.js +0 -28
  170. package/dist/components/SigningSubflow/SignSubAddressMetamask.js +0 -137
  171. package/dist/components/SigningSubflow/SignSubConnectLedger.js +0 -150
  172. package/dist/components/SigningSubflow/SignSubConnectMetamask.js +0 -137
  173. package/dist/components/SigningSubflow/SignSubIntro.js +0 -55
  174. package/dist/components/SigningSubflow/SignSubSendLedger.js +0 -150
  175. package/dist/components/SigningSubflow/SignSubSendMetamask.js +0 -62
  176. package/dist/components/SigningSubflow/SignSubTransactionLedger.js +0 -161
  177. package/dist/components/SigningSubflow/SignSubTransactionMetamask.js +0 -166
  178. package/dist/components/SigningSubflow/_styles.js +0 -34
  179. package/dist/components/SigningSubflow/index.js +0 -32
  180. package/dist/components/Slider/Slider.stories.js +0 -68
  181. package/dist/components/StepController/StepController.stories.js +0 -60
  182. package/dist/components/StepController/StepControllerProgress.stories.js +0 -49
  183. package/dist/components/StepsProgress/StepsProgress.stories.js +0 -49
  184. package/dist/components/Switch/Switch.stories.js +0 -81
  185. package/dist/components/Tabs/Tabs.stories.js +0 -36
  186. package/dist/components/TabsNav/TabNav.stories.js +0 -40
  187. package/dist/components/TabsNav/TabsNav.stories.js +0 -37
  188. package/dist/components/TeamOverview/TeamOverview.stories.js +0 -76
  189. package/dist/components/TermsModal/TermsModal.stories.js +0 -31
  190. package/dist/components/Text/Headline.stories.js +0 -48
  191. package/dist/components/Text/Text.stories.js +0 -70
  192. package/dist/components/Timeline/Timeline.stories.js +0 -393
  193. package/dist/components/ToDoList/ToDoList.stories.js +0 -133
  194. package/dist/components/ToDoList/ToDoListTask.stories.js +0 -70
  195. package/dist/components/TransactionDetails/TransactionDetails.stories.js +0 -55
  196. package/dist/components/TransactionDetails/TransactionDetailsTable.stories.js +0 -305
  197. package/dist/components/TransactionInfo/TransactionInfo.stories.js +0 -61
  198. package/dist/components/TwoFactorModal/TwoFactorModal.js +0 -100
  199. package/dist/components/VerifyEmailModal/VerifyEmailModal.stories.js +0 -59
  200. package/dist/components/headerHo/HeaderHo.stories.js +0 -35
  201. package/dist/components/icons/Arrow.stories.js +0 -42
  202. package/dist/components/icons/ArrowSimple.stories.js +0 -48
  203. package/dist/components/icons/Check.stories.js +0 -22
  204. package/dist/components/icons/Facebook.stories.js +0 -21
  205. package/dist/components/icons/Facebook_Logo.png +0 -0
  206. package/dist/components/icons/Info.stories.js +0 -16
  207. package/dist/components/icons/Instagram.stories.js +0 -21
  208. package/dist/components/icons/LI-In-Bug.png +0 -0
  209. package/dist/components/icons/LinkIcon.stories.js +0 -21
  210. package/dist/components/icons/LinkedIn.stories.js +0 -16
  211. package/dist/components/icons/Medium.stories.js +0 -16
  212. package/dist/components/icons/Reddit.stories.js +0 -21
  213. package/dist/components/icons/Share.stories.js +0 -16
  214. package/dist/components/icons/Telegram-Logo.png +0 -0
  215. package/dist/components/icons/Telegram.stories.js +0 -16
  216. package/dist/components/icons/Twitter.stories.js +0 -21
  217. package/dist/components/icons/X-logo-black.png +0 -0
  218. package/dist/components/icons/X.stories.js +0 -16
  219. package/dist/components/icons/Youtube.stories.js +0 -21
  220. package/dist/components/icons/youtube_social_circle_red.png +0 -0
  221. package/dist/components/taxId/TaxId.stories.js +0 -50
  222. package/dist/components/video/Video.stories.js +0 -52
@@ -10,7 +10,6 @@ var _AuthContext = require("../../context/AuthContext");
10
10
  var _ComponentWrapper = _interopRequireDefault(require("../ComponentWrapper/ComponentWrapper.styles"));
11
11
  var _Switch = _interopRequireDefault(require("../Switch/Switch"));
12
12
  var _Text = _interopRequireDefault(require("../Text/Text.styles"));
13
- var _Button = _interopRequireDefault(require("../Button/Button.styles"));
14
13
  var _loginWithOtpFlow = _interopRequireDefault(require("./login-with-otp-flow"));
15
14
  var _enable2faFlow = _interopRequireDefault(require("./enable-2fa-flow"));
16
15
  var _disable2faFlow = _interopRequireDefault(require("./disable-2fa-flow"));
@@ -18,7 +17,7 @@ var _colors = _interopRequireDefault(require("../../styles/colors"));
18
17
  var _InfoIcon = _interopRequireDefault(require("../InfoIcon/InfoIcon"));
19
18
  var _Modal = require("../Modal/Modal");
20
19
  var _Sucess2FA = _interopRequireDefault(require("./Sucess2FA"));
21
- const _excluded = ["onRequiresRecentLoginError", "open2faflow", "onLoginAgainClick", "openDisable2faflow"];
20
+ const _excluded = ["onRequiresRecentLoginError", "open2faflow", "onLoginAgainClick", "openDisable2faflow", "title", "subtitle", "showSwitch", "customComponent"];
22
21
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
23
22
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
24
23
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -33,7 +32,11 @@ const Main2FAFlow = _ref => {
33
32
  onRequiresRecentLoginError,
34
33
  open2faflow,
35
34
  onLoginAgainClick,
36
- openDisable2faflow
35
+ openDisable2faflow,
36
+ title = 'SET UP YOUR LOG IN TWO FACTOR AUTHENTICATION',
37
+ subtitle = 'Protect your account with an additional layer of security to log in',
38
+ showSwitch = true,
39
+ customComponent
37
40
  } = _ref,
38
41
  props = _objectWithoutProperties(_ref, _excluded);
39
42
  const {
@@ -58,6 +61,7 @@ const Main2FAFlow = _ref => {
58
61
  checkMfaEnrollment();
59
62
  generateTotp();
60
63
  }
64
+ // eslint-disable-next-line react-hooks/exhaustive-deps
61
65
  }, [user, userMfaEnrollment]);
62
66
 
63
67
  //remove succes message after 5 seconds
@@ -70,7 +74,7 @@ const Main2FAFlow = _ref => {
70
74
  }, [successMessage]);
71
75
  const generateTotp = async () => {
72
76
  try {
73
- const response = await generateTotpSecret(user);
77
+ const response = await generateTotpSecret();
74
78
  settotpData(response);
75
79
  } catch (error) {
76
80
  if (error.code === 'auth/requires-recent-login' || error.code === 'auth/unsupported-first-factor') {
@@ -79,7 +83,7 @@ const Main2FAFlow = _ref => {
79
83
  }
80
84
  };
81
85
  const switchOpenFlow = (prevFlowId, nextFlowId) => {
82
- setIsFlowOpen(_objectSpread(_objectSpread({}, isFlowopen), {}, {
86
+ setIsFlowOpen(prev => _objectSpread(_objectSpread({}, prev), {}, {
83
87
  [prevFlowId]: false,
84
88
  [nextFlowId]: true
85
89
  }));
@@ -102,10 +106,25 @@ const Main2FAFlow = _ref => {
102
106
  });
103
107
  onRequiresRecentLoginError && onRequiresRecentLoginError();
104
108
  };
109
+
110
+ // Expose flow control functions for customComponent
111
+ const flowActions = {
112
+ openEnable2FA: () => switchOpenFlow('disable2fa', 'enable2fa'),
113
+ openDisable2FA: () => switchOpenFlow('enable2fa', 'disable2fa'),
114
+ closeFlows: () => {
115
+ setIsFlowOpen({
116
+ enable2fa: false,
117
+ disable2fa: false,
118
+ requiresRecentLogin: false
119
+ });
120
+ },
121
+ is2FAEnabled,
122
+ isFlowOpen: isFlowopen
123
+ };
105
124
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ComponentWrapper.default, {
106
125
  alignVertically: true,
107
126
  noPaddingHorizontal: true
108
- }, /*#__PURE__*/_react.default.createElement(_Text.default, null, /*#__PURE__*/_react.default.createElement("h5", null, "SET UP YOUR LOG IN TWO FACTOR AUTHENTICATION"))), /*#__PURE__*/_react.default.createElement(_Text.default, null, /*#__PURE__*/_react.default.createElement("p", null, "Protect your account with an additional layer of security to log in")), /*#__PURE__*/_react.default.createElement(_ComponentWrapper.default, {
127
+ }, /*#__PURE__*/_react.default.createElement(_Text.default, null, /*#__PURE__*/_react.default.createElement("h5", null, title))), /*#__PURE__*/_react.default.createElement(_Text.default, null, /*#__PURE__*/_react.default.createElement("p", null, subtitle)), showSwitch && /*#__PURE__*/_react.default.createElement(_ComponentWrapper.default, {
109
128
  noPaddingHorizontal: true
110
129
  }, /*#__PURE__*/_react.default.createElement(_InfoIcon.default, {
111
130
  position: 'top',
@@ -146,7 +165,9 @@ const Main2FAFlow = _ref => {
146
165
  bottom: 0,
147
166
  left: 0
148
167
  }
149
- }, /*#__PURE__*/_react.default.createElement("p", null, successMessage))), isFlowopen.enable2fa && /*#__PURE__*/_react.default.createElement(_enable2faFlow.default, {
168
+ }, /*#__PURE__*/_react.default.createElement("p", null, successMessage))), customComponent && (typeof customComponent === 'function' ? customComponent(flowActions) : /*#__PURE__*/_react.default.isValidElement(customComponent) ? /*#__PURE__*/_react.default.cloneElement(customComponent, {
169
+ flowActions
170
+ }) : customComponent), isFlowopen.enable2fa && /*#__PURE__*/_react.default.createElement(_enable2faFlow.default, {
150
171
  showFlow: isFlowopen.enable2fa,
151
172
  setShowFlow: value => setIsFlowOpen(_objectSpread(_objectSpread({}, isFlowopen), {}, {
152
173
  enable2fa: value
@@ -18,6 +18,31 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
18
18
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
19
19
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
20
20
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
21
+ // Interactive elements that should NOT trigger row click
22
+ const INTERACTIVE_ELEMENTS = ['button', 'a', 'input', 'select', 'textarea', 'label'];
23
+
24
+ // Check if an element or its parents are interactive
25
+ const isInteractiveElement = element => {
26
+ let current = element;
27
+ while (current && current.tagName !== 'TR') {
28
+ var _current$tagName, _current$getAttribute, _current, _current$dataset;
29
+ const tagName = (_current$tagName = current.tagName) === null || _current$tagName === void 0 ? void 0 : _current$tagName.toLowerCase();
30
+ if (INTERACTIVE_ELEMENTS.includes(tagName)) {
31
+ return true;
32
+ }
33
+ // Check for role="button" or other interactive roles
34
+ const role = (_current$getAttribute = (_current = current).getAttribute) === null || _current$getAttribute === void 0 ? void 0 : _current$getAttribute.call(_current, 'role');
35
+ if (role === 'button' || role === 'link') {
36
+ return true;
37
+ }
38
+ // Check for data-clickable attribute (escape hatch for custom interactive elements)
39
+ if (((_current$dataset = current.dataset) === null || _current$dataset === void 0 ? void 0 : _current$dataset.clickable) === 'true') {
40
+ return true;
41
+ }
42
+ current = current.parentElement;
43
+ }
44
+ return false;
45
+ };
21
46
  function ReactTable(props) {
22
47
  const {
23
48
  columns,
@@ -37,6 +62,19 @@ function ReactTable(props) {
37
62
  getRowDataCy,
38
63
  // Function to generate data-cy attribute: (rowData, rowIndex) => string
39
64
 
65
+ // Row click handler: (rowData, rowIndex, event) => void
66
+ // Will NOT trigger if clicking on buttons, links, inputs, etc.
67
+ onRowClick,
68
+ // Custom expanded content renderer: (row, toggleExpanded) => ReactNode
69
+ // If provided, this will be used instead of the sub-table
70
+ renderExpandedContent,
71
+ // Header click handler: (column, event) => void
72
+ // Called when a header cell is clicked (useful for sorting/filtering)
73
+ // Won't trigger if clicking on interactive elements inside header
74
+ onHeaderClick,
75
+ // Render custom header content: (column, defaultContent) => ReactNode
76
+ // Allows wrapping/replacing header content (e.g., add sort icons, dropdowns)
77
+ renderHeaderContent,
40
78
  //instead of passing the subData, we pass a function that will calculate the subData
41
79
  //subData must be part of the data array (an array or whatever)
42
80
  //calculateSubData is a function that receives the row and returns the subData
@@ -75,6 +113,17 @@ function ReactTable(props) {
75
113
  setInputPageSize(pageSize);
76
114
  }, [pageSize]);
77
115
 
116
+ // Handle row click with interactive element detection
117
+ const handleRowClick = (0, _react.useCallback)((row, rowIndex, event) => {
118
+ if (!onRowClick) return;
119
+
120
+ // Don't trigger if clicking on interactive elements
121
+ if (isInteractiveElement(event.target)) {
122
+ return;
123
+ }
124
+ onRowClick(row.original, rowIndex, event);
125
+ }, [onRowClick]);
126
+
78
127
  // Function to render cell content with hover support
79
128
  const renderCellContent = (cell, rowIndex, rowData) => {
80
129
  if (customRowHoverContent && hoveredRowIndex === rowIndex) {
@@ -85,21 +134,65 @@ function ReactTable(props) {
85
134
  }
86
135
  return cell.render('Cell');
87
136
  };
137
+
138
+ // Determine if row should have expand functionality
139
+ const shouldEnableExpand = withSubTable || renderExpandedContent;
140
+
141
+ // Handle header click with interactive element detection
142
+ const handleHeaderClick = (0, _react.useCallback)((column, event) => {
143
+ // Check for column-level click handler first
144
+ if (column.onHeaderClick) {
145
+ // Don't trigger if clicking on interactive elements
146
+ if (!isInteractiveElement(event.target)) {
147
+ column.onHeaderClick(column, event);
148
+ }
149
+ return;
150
+ }
151
+
152
+ // Fall back to global onHeaderClick
153
+ if (!onHeaderClick) return;
154
+
155
+ // Don't trigger if clicking on interactive elements inside header
156
+ if (isInteractiveElement(event.target)) {
157
+ return;
158
+ }
159
+ onHeaderClick(column, event);
160
+ }, [onHeaderClick]);
161
+
162
+ // Render header content with optional custom rendering
163
+ const renderHeader = column => {
164
+ const defaultContent = column.render('Header');
165
+
166
+ // If renderHeaderContent is provided, use it to wrap/modify the header
167
+ if (renderHeaderContent) {
168
+ return renderHeaderContent(column, defaultContent);
169
+ }
170
+ return defaultContent;
171
+ };
172
+
173
+ // Check if header should be clickable
174
+ const isHeaderClickable = column => {
175
+ return column.onHeaderClick || onHeaderClick;
176
+ };
88
177
  return /*#__PURE__*/_react.default.createElement(_Table.Styles, null, /*#__PURE__*/_react.default.createElement(_Table.TableWrap, {
89
178
  style: tableWrapStyles
90
179
  }, /*#__PURE__*/_react.default.createElement(_Table.StyledReactTable, _extends({}, getTableProps(), {
91
180
  customTableStyles: customTableStyles
92
181
  }), /*#__PURE__*/_react.default.createElement("thead", null, headerGroups.map(headerGroup => /*#__PURE__*/_react.default.createElement(_Table.StyledReactTable.Tr, headerGroup.getHeaderGroupProps(), headerGroup.headers.map(column => {
93
182
  const cellStyles = customThStyles ? customThStyles(column) : {};
183
+ const clickable = isHeaderClickable(column);
94
184
  return /*#__PURE__*/_react.default.createElement(_Table.StyledReactTable.Th, _extends({}, column.getHeaderProps({
95
185
  className: column.collapse ? 'collapse' : '',
96
- style: _objectSpread({}, cellStyles)
186
+ style: _objectSpread(_objectSpread({}, cellStyles), clickable ? {
187
+ cursor: 'pointer'
188
+ } : {})
97
189
  }), {
98
190
  blue: blue,
99
191
  width: column.width,
100
192
  minWidth: column.minWidth,
101
- maxWidth: column.maxWidth
102
- }), column.render('Header'));
193
+ maxWidth: column.maxWidth,
194
+ onClick: clickable ? e => handleHeaderClick(column, e) : undefined
195
+ }), renderHeader(column));
103
196
  })))), /*#__PURE__*/_react.default.createElement("tbody", getTableBodyProps(), page.map((row, i) => {
104
197
  prepareRow(row);
105
198
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
@@ -112,10 +205,17 @@ function ReactTable(props) {
112
205
  rowIndex: i,
113
206
  rowData: row.original,
114
207
  onMouseEnter: () => setHoveredRowIndex(i),
115
- onMouseLeave: () => setHoveredRowIndex(null)
208
+ onMouseLeave: () => setHoveredRowIndex(null),
209
+ onClick: e => handleRowClick(row, i, e),
210
+ style: onRowClick ? {
211
+ cursor: 'pointer'
212
+ } : undefined
116
213
  }), row.cells.map(cell => {
117
214
  const cellStyles = customTdStyles ? customTdStyles(i, row.original, cell.column) : {};
118
- return /*#__PURE__*/_react.default.createElement(_Table.StyledReactTable.Td, _extends({}, cell.row.getToggleRowExpandedProps(), {
215
+
216
+ // Only apply expand toggle props if expansion is enabled
217
+ const expandProps = shouldEnableExpand ? cell.row.getToggleRowExpandedProps() : {};
218
+ return /*#__PURE__*/_react.default.createElement(_Table.StyledReactTable.Td, _extends({}, expandProps, {
119
219
  title: ""
120
220
  }, cell.getCellProps({
121
221
  className: cell.column.collapse ? 'collapse' : '',
@@ -126,7 +226,12 @@ function ReactTable(props) {
126
226
  minWidth: cell.column.minWidth,
127
227
  maxWidth: cell.column.maxWidth
128
228
  }), renderCellContent(cell, i, row.original));
129
- })), withSubTable && row.isExpanded && /*#__PURE__*/_react.default.createElement(_Table.StyledReactTable.Tr, {
229
+ })), renderExpandedContent && row.isExpanded && /*#__PURE__*/_react.default.createElement(_Table.StyledReactTable.Tr, {
230
+ key: "".concat(row.id, "-expanded")
231
+ }, /*#__PURE__*/_react.default.createElement(_Table.StyledReactTable.Td, {
232
+ colSpan: visibleColumns.length,
233
+ subTable: true
234
+ }, renderExpandedContent(row, row.toggleRowExpanded))), withSubTable && !renderExpandedContent && row.isExpanded && /*#__PURE__*/_react.default.createElement(_Table.StyledReactTable.Tr, {
130
235
  key: "".concat(row.id, "-").concat(i)
131
236
  }, /*#__PURE__*/_react.default.createElement(_Table.StyledReactTable.Td, {
132
237
  colSpan: visibleColumns.length,
@@ -160,7 +265,18 @@ ReactTable.propTypes = {
160
265
  customRowHoverContent: _propTypes.default.func,
161
266
  customRowStyles: _propTypes.default.func,
162
267
  customTableStyles: _propTypes.default.func,
163
- getRowDataCy: _propTypes.default.func // (rowData, rowIndex) => string
268
+ tableWrapStyles: _propTypes.default.object,
269
+ customTdStyles: _propTypes.default.func,
270
+ customThStyles: _propTypes.default.func,
271
+ getRowDataCy: _propTypes.default.func,
272
+ // (rowData, rowIndex) => string
273
+ onRowClick: _propTypes.default.func,
274
+ // (rowData, rowIndex, event) => void
275
+ renderExpandedContent: _propTypes.default.func,
276
+ // (row, toggleExpanded) => ReactNode
277
+ onHeaderClick: _propTypes.default.func,
278
+ // (column, event) => void
279
+ renderHeaderContent: _propTypes.default.func // (column, defaultContent) => ReactNode
164
280
  };
165
281
  ReactTable.defaultProps = {
166
282
  blue: false,
@@ -28,10 +28,9 @@ const Chip = _ref => {
28
28
  }, props), /*#__PURE__*/_react.default.createElement(_ChipStyles.ChipText, null, children), tooltip && /*#__PURE__*/_react.default.createElement(_InfoIcon.default, _extends({
29
29
  title: tooltip,
30
30
  position: "top",
31
- noIcon: true,
32
31
  noMarginLeft: true,
33
32
  noMarginRight: true
34
- }, tooltipProps), /*#__PURE__*/_react.default.createElement(_ChipStyles.TooltipChipIcon, null)));
33
+ }, tooltipProps)));
35
34
  };
36
35
  exports.Chip = Chip;
37
36
  Chip.propTypes = {
@@ -6,15 +6,16 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.Wrapper = exports.TooltipChipIcon = exports.StyledChip = exports.ChipText = void 0;
7
7
  var _styledComponents = _interopRequireDefault(require("styled-components"));
8
8
  var _theme = _interopRequireDefault(require("../../styles/theme"));
9
+ var _InfoIcon = require("../InfoIcon/InfoIcon.styles");
9
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
11
  const StyledChip = exports.StyledChip = _styledComponents.default.div.withConfig({
11
12
  displayName: "Chipstyles__StyledChip",
12
13
  componentId: "sc-pcmyil-0"
13
- })(["display:inline-flex;gap:4px;align-items:center;padding:8px 16px;border-radius:20px;background-color:transparent;color:black;cursor:pointer;transition:background-color 0.3s;font-size:11px;font-weight:400;line-height:20px;letter-spacing:3px;font-weight:600;min-height:40px;&:hover,&:active{background-color:red;color:white;}", ""], _ref => {
14
+ })(["display:inline-flex;gap:4px;align-items:center;padding:8px 16px;border-radius:20px;background-color:transparent;color:black;cursor:pointer;transition:background-color 0.3s;font-size:11px;font-weight:400;line-height:20px;letter-spacing:3px;font-weight:600;min-height:40px;&:hover,&:active{background-color:red;color:white;", "{color:", ";}}", ""], _InfoIcon.Icon, _theme.default.cWhite, _ref => {
14
15
  let {
15
16
  isActive
16
17
  } = _ref;
17
- return isActive && "\n background-color: red;\n color: white;\n font-weight: 800;\n\n ".concat(TooltipChipIcon, " {\n color: ").concat(_theme.default.cWhite, ";\n }\n ");
18
+ return isActive && "\n background-color: red;\n color: white;\n font-weight: 800;\n\n ".concat(_InfoIcon.Icon, " {\n color: ").concat(_theme.default.cWhite, " ;\n }\n ");
18
19
  });
19
20
  const Wrapper = exports.Wrapper = _styledComponents.default.div.withConfig({
20
21
  displayName: "Chipstyles__Wrapper",
@@ -7,65 +7,64 @@ exports.default = exports.Input = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _Input = require("./Input.styles");
10
+ const _excluded = ["type", "id", "name", "label", "placeholder", "value", "error", "touched", "readOnly", "inverted", "dashboard", "disabled", "inputWrapStyle", "wrapperStyle", "autoHeightLabel", "onChange", "onBlur", "onFocus"];
10
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
12
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
12
13
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
14
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
15
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
13
16
  const Input = props => {
14
17
  const {
15
- type,
16
- id,
17
- name,
18
- label,
19
- placeholder,
20
- value,
21
- error,
22
- touched,
23
- readOnly,
24
- inverted,
25
- dashboard,
26
- disabled,
27
- inputWrapStyle,
28
- wrapperStyle,
29
- autoHeightLabel
30
- } = props;
18
+ type,
19
+ id,
20
+ name,
21
+ label,
22
+ placeholder,
23
+ value,
24
+ error,
25
+ touched,
26
+ readOnly,
27
+ inverted,
28
+ dashboard,
29
+ disabled,
30
+ inputWrapStyle,
31
+ wrapperStyle,
32
+ autoHeightLabel,
33
+ // Destructure these so they don't get spread to the input
34
+ onChange: onChangeProp,
35
+ onBlur: onBlurProp,
36
+ onFocus: onFocusProp
37
+ } = props,
38
+ restProps = _objectWithoutProperties(props, _excluded);
31
39
  const [labelUp, setLabelUp] = (0, _react.useState)(false);
32
40
  const [hasFocus, setHasFocus] = (0, _react.useState)(false);
33
41
  (0, _react.useEffect)(() => {
34
42
  checkLabel(false);
35
43
  }, []);
36
44
  (0, _react.useEffect)(() => {
37
- checkLabel(false);
38
- }, [hasFocus, value]);
45
+ if (!!value && !labelUp) {
46
+ checkLabel(false);
47
+ }
48
+ }, [labelUp, value]);
39
49
  (0, _react.useEffect)(() => {
40
50
  if (value && !labelUp) setLabelUp(true);
41
51
  }, [value, labelUp]);
42
52
  const onBlur = (e, field) => {
43
- const {
44
- onBlur
45
- } = props;
46
-
47
53
  // formik handler MUST be called before our logic !
48
- onBlur && onBlur(e, field);
54
+ onBlurProp && onBlurProp(e, field);
49
55
 
50
56
  // our logic follows
51
57
  checkLabel(false);
52
58
  };
53
59
  const onFocus = (e, field) => {
54
- const {
55
- onFocus
56
- } = props;
57
-
58
60
  // formik handler MUST be called before our logic !
59
- onFocus && onFocus(e, field);
61
+ onFocusProp && onFocusProp(e, field);
60
62
 
61
63
  // our logic follows
62
64
  checkLabel(true);
63
65
  };
64
66
  const onChange = (e, field) => {
65
- const {
66
- onChange
67
- } = props;
68
- onChange && onChange(e, field); // formik handler
67
+ onChangeProp && onChangeProp(e, field); // formik handler
69
68
  };
70
69
  const checkLabel = focus => {
71
70
  setHasFocus(focus);
@@ -96,11 +95,12 @@ const Input = props => {
96
95
  onFocus: onFocus,
97
96
  readOnly: readOnly,
98
97
  placeholder: placeholder,
98
+ disabled: disabled,
99
99
  style: {
100
100
  WebkitAppearance: 'none',
101
101
  WebkitBorderRadius: 0
102
102
  }
103
- }, props))));
103
+ }, restProps))));
104
104
  };
105
105
  exports.Input = Input;
106
106
  Input.propTypes = {