intelicoreact 1.8.3 → 1.8.5

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 (264) hide show
  1. package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.jsx +18 -0
  2. package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN_old.jsx +121 -0
  3. package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.jsx +507 -0
  4. package/dist/Atomic/FormElements/MultiSelect/MultiSelect.jsx +46 -0
  5. package/dist/Atomic/FormElements/NumericInput/NumericInput.jsx +337 -0
  6. package/dist/Atomic/FormElements/RadioGroup/RadioGroup.jsx +66 -0
  7. package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.jsx +78 -0
  8. package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.jsx +54 -0
  9. package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.jsx +183 -0
  10. package/dist/Atomic/FormElements/RangeList/RangeList.jsx +181 -0
  11. package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.jsx +41 -0
  12. package/dist/Atomic/FormElements/RangeSlider/RangeSlider.jsx +449 -0
  13. package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.jsx +865 -0
  14. package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.jsx +37 -0
  15. package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.jsx +48 -0
  16. package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.jsx +62 -0
  17. package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.jsx +175 -0
  18. package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.jsx +65 -0
  19. package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.jsx +118 -0
  20. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.interface.ts +2 -0
  21. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +1 -1
  22. package/dist/Atomic/FormElements/Text/Text.jsx +126 -0
  23. package/dist/Atomic/FormElements/Textarea/Textarea.jsx +61 -0
  24. package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.jsx +181 -0
  25. package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.jsx +60 -0
  26. package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.jsx +83 -0
  27. package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.jsx +80 -0
  28. package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.jsx +103 -0
  29. package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.jsx +115 -0
  30. package/dist/Atomic/Layout/Header/Header.jsx +86 -0
  31. package/dist/Atomic/UI/AccordionTable/AccordionTable.jsx +250 -0
  32. package/dist/Atomic/UI/AccordionText/AccordionText.jsx +68 -0
  33. package/dist/Atomic/UI/Arrow/Arrow.jsx +134 -0
  34. package/dist/Atomic/UI/Box/Box.jsx +53 -0
  35. package/dist/Atomic/UI/Chart/Chart.jsx +178 -0
  36. package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.jsx +78 -0
  37. package/dist/Atomic/UI/Chart/partial/optionsConstructor.jsx +334 -0
  38. package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.jsx +111 -0
  39. package/dist/Atomic/UI/DateTime/DateTime.jsx +57 -0
  40. package/dist/Atomic/UI/DebugContainer/DebugContainer.jsx +44 -0
  41. package/dist/Atomic/UI/DebugContainer/useDebugContainer.jsx +15 -0
  42. package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.jsx +223 -0
  43. package/dist/Atomic/UI/MonoAccordion/MonoAccordion._test.jsx +75 -0
  44. package/dist/Atomic/UI/MonoAccordion/MonoAccordion.jsx +86 -0
  45. package/dist/Atomic/UI/PieChart/PieChart.jsx +41 -0
  46. package/dist/Atomic/UI/Table/Partials/TdCell.jsx +87 -0
  47. package/dist/Atomic/UI/Table/Partials/TdHeader.jsx +36 -0
  48. package/dist/Atomic/UI/Table/Partials/TdRow.jsx +103 -0
  49. package/dist/Atomic/UI/Table/Partials/TdTitle.jsx +55 -0
  50. package/dist/Atomic/UI/Table/Table.jsx +63 -0
  51. package/dist/Atomic/UI/Table/TdTypes/TdActions.jsx +80 -0
  52. package/dist/Atomic/UI/Table/TdTypes/TdPriority.jsx +26 -0
  53. package/dist/Atomic/UI/Table/TdTypes/TdRange.jsx +13 -0
  54. package/dist/Atomic/UI/Table/TdTypes/TdWeight.jsx +56 -0
  55. package/dist/Atomic/UI/Tag/Tag.interface.ts +1 -0
  56. package/dist/Atomic/UI/Tag/Tag.js +1 -1
  57. package/dist/Atomic/UI/TagList/TagList.jsx +256 -0
  58. package/dist/Atomic/UI/WizardStepper/constructor.jsx +86 -0
  59. package/dist/Classes/RESTAPI/partials/CredentialsProcessing.jsx +254 -0
  60. package/dist/Functions/customEventListener.jsx +96 -0
  61. package/dist/Functions/operations.jsx +138 -0
  62. package/dist/Functions/useFormTools/functions/RenderFields.jsx +108 -0
  63. package/dist/Functions/useFormTools/index.jsx +777 -0
  64. package/dist/Functions/usePasswordChecker.jsx +128 -0
  65. package/dist/Functions/utils.jsx +492 -0
  66. package/dist/Molecular/CustomIcons/components/AffiliateNetworks.jsx +22 -0
  67. package/dist/Molecular/CustomIcons/components/AlertCircle.jsx +24 -0
  68. package/dist/Molecular/CustomIcons/components/AppStore.jsx +30 -0
  69. package/dist/Molecular/CustomIcons/components/Arrow.jsx +33 -0
  70. package/dist/Molecular/CustomIcons/components/ArrowDown.jsx +18 -0
  71. package/dist/Molecular/CustomIcons/components/ArrowLeft.jsx +23 -0
  72. package/dist/Molecular/CustomIcons/components/ArrowRight.jsx +23 -0
  73. package/dist/Molecular/CustomIcons/components/ArrowUp.jsx +18 -0
  74. package/dist/Molecular/CustomIcons/components/Bell.jsx +16 -0
  75. package/dist/Molecular/CustomIcons/components/Button.jsx +13 -0
  76. package/dist/Molecular/CustomIcons/components/Campaigns.jsx +17 -0
  77. package/dist/Molecular/CustomIcons/components/Check.jsx +15 -0
  78. package/dist/Molecular/CustomIcons/components/Check2.jsx +13 -0
  79. package/dist/Molecular/CustomIcons/components/ChevronDown.jsx +13 -0
  80. package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.jsx +12 -0
  81. package/dist/Molecular/CustomIcons/components/ChevronLeft.jsx +12 -0
  82. package/dist/Molecular/CustomIcons/components/ChevronRight.jsx +12 -0
  83. package/dist/Molecular/CustomIcons/components/ChevronUp.jsx +12 -0
  84. package/dist/Molecular/CustomIcons/components/ChevronUpDown.jsx +28 -0
  85. package/dist/Molecular/CustomIcons/components/Close.jsx +15 -0
  86. package/dist/Molecular/CustomIcons/components/ColumnsOrder.jsx +18 -0
  87. package/dist/Molecular/CustomIcons/components/Delete.jsx +17 -0
  88. package/dist/Molecular/CustomIcons/components/Edit.jsx +16 -0
  89. package/dist/Molecular/CustomIcons/components/Email.jsx +32 -0
  90. package/dist/Molecular/CustomIcons/components/FinturfLogo.jsx +19 -0
  91. package/dist/Molecular/CustomIcons/components/FinturfLogo2.jsx +36 -0
  92. package/dist/Molecular/CustomIcons/components/Flows.jsx +16 -0
  93. package/dist/Molecular/CustomIcons/components/Gift.jsx +26 -0
  94. package/dist/Molecular/CustomIcons/components/GoogleAuth.jsx +30 -0
  95. package/dist/Molecular/CustomIcons/components/GooglePlay.jsx +30 -0
  96. package/dist/Molecular/CustomIcons/components/HelpCircle.jsx +20 -0
  97. package/dist/Molecular/CustomIcons/components/HelpCircle2.jsx +21 -0
  98. package/dist/Molecular/CustomIcons/components/HelpCircleFilled.jsx +20 -0
  99. package/dist/Molecular/CustomIcons/components/Home.jsx +17 -0
  100. package/dist/Molecular/CustomIcons/components/Home2.jsx +23 -0
  101. package/dist/Molecular/CustomIcons/components/Key.jsx +24 -0
  102. package/dist/Molecular/CustomIcons/components/Landers.jsx +21 -0
  103. package/dist/Molecular/CustomIcons/components/Lock.jsx +16 -0
  104. package/dist/Molecular/CustomIcons/components/Mail.jsx +27 -0
  105. package/dist/Molecular/CustomIcons/components/Mastercard.jsx +74 -0
  106. package/dist/Molecular/CustomIcons/components/Minus.jsx +26 -0
  107. package/dist/Molecular/CustomIcons/components/Offers.jsx +17 -0
  108. package/dist/Molecular/CustomIcons/components/Pause.jsx +29 -0
  109. package/dist/Molecular/CustomIcons/components/PayPal.jsx +42 -0
  110. package/dist/Molecular/CustomIcons/components/PayPalLightLarge.jsx +29 -0
  111. package/dist/Molecular/CustomIcons/components/Phone.jsx +31 -0
  112. package/dist/Molecular/CustomIcons/components/Play.jsx +26 -0
  113. package/dist/Molecular/CustomIcons/components/Plus.jsx +26 -0
  114. package/dist/Molecular/CustomIcons/components/Profile.jsx +17 -0
  115. package/dist/Molecular/CustomIcons/components/QRCode.jsx +30 -0
  116. package/dist/Molecular/CustomIcons/components/Rectangle.jsx +13 -0
  117. package/dist/Molecular/CustomIcons/components/Revert.jsx +14 -0
  118. package/dist/Molecular/CustomIcons/components/Star.jsx +15 -0
  119. package/dist/Molecular/CustomIcons/components/Star2.jsx +17 -0
  120. package/dist/Molecular/CustomIcons/components/TrafficSources.jsx +15 -0
  121. package/dist/Molecular/CustomIcons/components/Trash.jsx +16 -0
  122. package/dist/Molecular/CustomIcons/components/TrashRed.jsx +16 -0
  123. package/dist/Molecular/CustomIcons/components/Triggers.jsx +16 -0
  124. package/dist/Molecular/CustomIcons/components/User.jsx +26 -0
  125. package/dist/Molecular/CustomIcons/components/Visa.jsx +32 -0
  126. package/dist/Molecular/CustomIcons/components/X.jsx +13 -0
  127. package/dist/Molecular/FormElement/FormElement.jsx +52 -0
  128. package/dist/Molecular/FormWithDependOn/FormWithDependOn.jsx +161 -0
  129. package/dist/Molecular/InputAddress/InputAddress.jsx +641 -0
  130. package/dist/Molecular/InputPassword/InputPassword.jsx +50 -0
  131. package/package.json +13 -6
  132. package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +0 -1
  133. package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN_old.js +0 -1
  134. package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +0 -1
  135. package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +0 -1
  136. package/dist/Atomic/FormElements/NumericInput/NumericInput.js +0 -1
  137. package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +0 -1
  138. package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +0 -1
  139. package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +0 -1
  140. package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +0 -1
  141. package/dist/Atomic/FormElements/RangeList/RangeList.js +0 -1
  142. package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +0 -1
  143. package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +0 -1
  144. package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +0 -1
  145. package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +0 -1
  146. package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +0 -1
  147. package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +0 -1
  148. package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.d.ts +0 -16
  149. package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +0 -1
  150. package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +0 -1
  151. package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.d.ts +0 -9
  152. package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.js +0 -1
  153. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.d.ts +0 -5
  154. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.interface.d.ts +0 -79
  155. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.interface.js +0 -1
  156. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.interface.js.map +0 -1
  157. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js.map +0 -1
  158. package/dist/Atomic/FormElements/Text/Text.js +0 -1
  159. package/dist/Atomic/FormElements/Textarea/Textarea.js +0 -1
  160. package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +0 -1
  161. package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +0 -1
  162. package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +0 -1
  163. package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +0 -1
  164. package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +0 -1
  165. package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +0 -1
  166. package/dist/Atomic/Layout/Header/Header.js +0 -1
  167. package/dist/Atomic/UI/AccordionTable/AccordionTable.js +0 -1
  168. package/dist/Atomic/UI/AccordionText/AccordionText.js +0 -1
  169. package/dist/Atomic/UI/Arrow/Arrow.js +0 -1
  170. package/dist/Atomic/UI/Box/Box.js +0 -1
  171. package/dist/Atomic/UI/Chart/Chart.js +0 -1
  172. package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +0 -1
  173. package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +0 -1
  174. package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +0 -1
  175. package/dist/Atomic/UI/DateTime/DateTime.js +0 -1
  176. package/dist/Atomic/UI/DebugContainer/DebugContainer.js +0 -1
  177. package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +0 -1
  178. package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +0 -1
  179. package/dist/Atomic/UI/MonoAccordion/MonoAccordion._test.js +0 -1
  180. package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +0 -1
  181. package/dist/Atomic/UI/PieChart/PieChart.js +0 -1
  182. package/dist/Atomic/UI/Table/Partials/TdCell.js +0 -1
  183. package/dist/Atomic/UI/Table/Partials/TdHeader.js +0 -1
  184. package/dist/Atomic/UI/Table/Partials/TdRow.js +0 -1
  185. package/dist/Atomic/UI/Table/Partials/TdTitle.js +0 -1
  186. package/dist/Atomic/UI/Table/Table.js +0 -1
  187. package/dist/Atomic/UI/Table/TdTypes/TdActions.js +0 -1
  188. package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +0 -1
  189. package/dist/Atomic/UI/Table/TdTypes/TdRange.js +0 -1
  190. package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +0 -1
  191. package/dist/Atomic/UI/TagList/TagList.js +0 -1
  192. package/dist/Atomic/UI/WizardStepper/constructor.js +0 -1
  193. package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +0 -1
  194. package/dist/Functions/customEventListener.js +0 -1
  195. package/dist/Functions/operations.js +0 -1
  196. package/dist/Functions/useFormTools/functions/RenderFields.js +0 -1
  197. package/dist/Functions/useFormTools/index.js +0 -1
  198. package/dist/Functions/usePasswordChecker.js +0 -1
  199. package/dist/Functions/utils.js +0 -1
  200. package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +0 -1
  201. package/dist/Molecular/CustomIcons/components/AlertCircle.js +0 -1
  202. package/dist/Molecular/CustomIcons/components/AppStore.js +0 -1
  203. package/dist/Molecular/CustomIcons/components/Arrow.js +0 -1
  204. package/dist/Molecular/CustomIcons/components/ArrowDown.js +0 -1
  205. package/dist/Molecular/CustomIcons/components/ArrowLeft.js +0 -1
  206. package/dist/Molecular/CustomIcons/components/ArrowRight.js +0 -1
  207. package/dist/Molecular/CustomIcons/components/ArrowUp.js +0 -1
  208. package/dist/Molecular/CustomIcons/components/Bell.js +0 -1
  209. package/dist/Molecular/CustomIcons/components/Button.js +0 -1
  210. package/dist/Molecular/CustomIcons/components/Campaigns.js +0 -1
  211. package/dist/Molecular/CustomIcons/components/Check.js +0 -1
  212. package/dist/Molecular/CustomIcons/components/Check2.js +0 -1
  213. package/dist/Molecular/CustomIcons/components/ChevronDown.js +0 -1
  214. package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +0 -1
  215. package/dist/Molecular/CustomIcons/components/ChevronLeft.js +0 -1
  216. package/dist/Molecular/CustomIcons/components/ChevronRight.js +0 -1
  217. package/dist/Molecular/CustomIcons/components/ChevronUp.js +0 -1
  218. package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +0 -1
  219. package/dist/Molecular/CustomIcons/components/Close.js +0 -1
  220. package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +0 -1
  221. package/dist/Molecular/CustomIcons/components/Delete.js +0 -1
  222. package/dist/Molecular/CustomIcons/components/Edit.js +0 -1
  223. package/dist/Molecular/CustomIcons/components/Email.js +0 -1
  224. package/dist/Molecular/CustomIcons/components/FinturfLogo.js +0 -1
  225. package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +0 -1
  226. package/dist/Molecular/CustomIcons/components/Flows.js +0 -1
  227. package/dist/Molecular/CustomIcons/components/Gift.js +0 -1
  228. package/dist/Molecular/CustomIcons/components/GoogleAuth.js +0 -1
  229. package/dist/Molecular/CustomIcons/components/GooglePlay.js +0 -1
  230. package/dist/Molecular/CustomIcons/components/HelpCircle.js +0 -1
  231. package/dist/Molecular/CustomIcons/components/HelpCircle2.js +0 -1
  232. package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +0 -1
  233. package/dist/Molecular/CustomIcons/components/Home.js +0 -1
  234. package/dist/Molecular/CustomIcons/components/Home2.js +0 -1
  235. package/dist/Molecular/CustomIcons/components/Key.js +0 -1
  236. package/dist/Molecular/CustomIcons/components/Landers.js +0 -1
  237. package/dist/Molecular/CustomIcons/components/Lock.js +0 -1
  238. package/dist/Molecular/CustomIcons/components/Mail.js +0 -1
  239. package/dist/Molecular/CustomIcons/components/Mastercard.js +0 -1
  240. package/dist/Molecular/CustomIcons/components/Minus.js +0 -1
  241. package/dist/Molecular/CustomIcons/components/Offers.js +0 -1
  242. package/dist/Molecular/CustomIcons/components/Pause.js +0 -1
  243. package/dist/Molecular/CustomIcons/components/PayPal.js +0 -1
  244. package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +0 -1
  245. package/dist/Molecular/CustomIcons/components/Phone.js +0 -1
  246. package/dist/Molecular/CustomIcons/components/Play.js +0 -1
  247. package/dist/Molecular/CustomIcons/components/Plus.js +0 -1
  248. package/dist/Molecular/CustomIcons/components/Profile.js +0 -1
  249. package/dist/Molecular/CustomIcons/components/QRCode.js +0 -1
  250. package/dist/Molecular/CustomIcons/components/Rectangle.js +0 -1
  251. package/dist/Molecular/CustomIcons/components/Revert.js +0 -1
  252. package/dist/Molecular/CustomIcons/components/Star.js +0 -1
  253. package/dist/Molecular/CustomIcons/components/Star2.js +0 -1
  254. package/dist/Molecular/CustomIcons/components/TrafficSources.js +0 -1
  255. package/dist/Molecular/CustomIcons/components/Trash.js +0 -1
  256. package/dist/Molecular/CustomIcons/components/TrashRed.js +0 -1
  257. package/dist/Molecular/CustomIcons/components/Triggers.js +0 -1
  258. package/dist/Molecular/CustomIcons/components/User.js +0 -1
  259. package/dist/Molecular/CustomIcons/components/Visa.js +0 -1
  260. package/dist/Molecular/CustomIcons/components/X.js +0 -1
  261. package/dist/Molecular/FormElement/FormElement.js +0 -1
  262. package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +0 -1
  263. package/dist/Molecular/InputAddress/InputAddress.js +0 -1
  264. package/dist/Molecular/InputPassword/InputPassword.js +0 -1
@@ -0,0 +1,103 @@
1
+ import cn from 'classnames';
2
+
3
+ import { useState } from 'react';
4
+
5
+ import { handleObjectChange } from '../../../../Functions/utils';
6
+ import Modal from '../../Modal/Modal';
7
+ import TdRange from '../TdTypes/TdRange';
8
+
9
+ import TdCell from './TdCell';
10
+
11
+ import '../Table.scss';
12
+
13
+ function TdRow({
14
+ item,
15
+ onChange,
16
+ rowIndex,
17
+ cardStatus,
18
+ range,
19
+ type,
20
+ rowSpan,
21
+ colSpan,
22
+ cardLength,
23
+ changePriority,
24
+ getAdviceWeight,
25
+ onActionClick,
26
+ isDeleted,
27
+ testId = 'td-row',
28
+ }) {
29
+ const [isOpen, setIsOpen] = useState(false);
30
+
31
+ const handleChange = handleObjectChange(item, () => onChange({ ...item }));
32
+
33
+ return (
34
+ <>
35
+ <tr data-testid={testId}>
36
+ {type && rowSpan && (
37
+ <td className="rel" rowSpan={rowSpan + 1}>
38
+ <span
39
+ className={cn(
40
+ type && `cards-table__score cards-table__score-${cardStatus}`,
41
+ )}
42
+ >
43
+ <TdRange item={range} />
44
+ </span>
45
+ </td>
46
+ )}
47
+
48
+ {Object.entries(item).map(([key, value]) =>
49
+ key === 'id' || key === 'isDeleted'
50
+ ? null
51
+ : (
52
+ <td
53
+ key={key}
54
+ className={cn('cards-table__body-item', {
55
+ 'cards-table__accordion': value.type === 'accordion',
56
+ })}
57
+ >
58
+ <TdCell
59
+ onActionClick={onActionClick}
60
+ changePriority={changePriority}
61
+ cardLength={cardLength}
62
+ rowIndex={rowIndex}
63
+ rowItem={item}
64
+ type={key}
65
+ item={value}
66
+ onChange={newValue => handleChange(newValue, key)}
67
+ getAdviceWeight={getAdviceWeight}
68
+ isDeleted={isDeleted}
69
+ />
70
+ </td>
71
+ ),
72
+ )}
73
+ </tr>
74
+
75
+ {type && colSpan
76
+ ? (
77
+ <tr>
78
+ <td />
79
+ <td colSpan={colSpan}>
80
+ <span
81
+ className="cards-table__title-select-lender-btn"
82
+ onClick={() => setIsOpen(true)}
83
+ >
84
+ Select Lender
85
+ </span>
86
+
87
+ <Modal
88
+ closeModal={() => setIsOpen(false)}
89
+ isOpen={isOpen}
90
+ title="Choose Lender"
91
+ size="420"
92
+ >
93
+ test
94
+ </Modal>
95
+ </td>
96
+ </tr>
97
+ )
98
+ : null}
99
+ </>
100
+ );
101
+ }
102
+
103
+ export default TdRow;
@@ -0,0 +1,55 @@
1
+ import { useState } from 'react';
2
+
3
+ import Langs from '../../../../../Langs';
4
+ import Modal from '../../Modal/Modal';
5
+ import Tag from '../../Tag/Tag';
6
+
7
+ import '../Table.scss';
8
+
9
+ function TdTitle({ locations, title }) {
10
+ const txt = Langs[globalThis.lng];
11
+ const [isOpen, setIsOpen] = useState(false);
12
+
13
+ return (
14
+ <div className="cards-table__title-box">
15
+ <div className="cards-table__title-box--left">
16
+ <div className="cards-table__title-box--title">
17
+ {txt.titles[title] || title}
18
+ </div>
19
+ <div className="cards-table__title-box--tags">
20
+ <span className="mr5">
21
+ {txt.labels.locations.toUpperCase()}
22
+ :
23
+ </span>
24
+ {locations?.map((tag, index) => (
25
+ <Tag key={index} label={tag.label} />
26
+ ))}
27
+ </div>
28
+ </div>
29
+
30
+ <div className="cards-table__title-box--right">
31
+ <span
32
+ onClick={() => setIsOpen(true)}
33
+ className="cards-table__title-edit-btn mr5"
34
+ >
35
+ {txt.buttons.edit}
36
+ </span>
37
+
38
+ <Modal
39
+ mode="edit"
40
+ closeModal={() => setIsOpen(false)}
41
+ isOpen={isOpen}
42
+ title={txt.titles.pingTree}
43
+ size="420"
44
+ >
45
+ test
46
+ </Modal>
47
+ <span className="cards-table__title-delete-btn">
48
+ {txt.buttons.deletePingTree}
49
+ </span>
50
+ </div>
51
+ </div>
52
+ );
53
+ }
54
+
55
+ export default TdTitle;
@@ -0,0 +1,63 @@
1
+ import cn from 'classnames';
2
+
3
+ import TdHeader from './Partials/TdHeader';
4
+ import TdRow from './Partials/TdRow';
5
+
6
+ import './Table.scss';
7
+
8
+ function Table({
9
+ rows,
10
+ onChange,
11
+ className,
12
+ header,
13
+ onActionClick,
14
+ testId = 'table',
15
+ }) {
16
+ const handleArrayChange = (value, index) => {
17
+ rows[index] = value;
18
+ onChange({ header: [...header], rows: [...rows] });
19
+ };
20
+
21
+ return (
22
+ <div
23
+ data-testid={testId}
24
+ className={cn('simple-table', {
25
+ [`simple-table--${className}`]: className,
26
+ })}
27
+ >
28
+ <table>
29
+ <thead>
30
+ <tr>
31
+ {header?.map(item => (
32
+ <TdHeader item={item} key={item.key} />
33
+ ))}
34
+ </tr>
35
+ </thead>
36
+ <tbody>
37
+ {rows && rows?.length
38
+ ? (
39
+ rows?.map((row, index) => (
40
+ <TdRow
41
+ onActionClick={onActionClick}
42
+ rowIndex={index}
43
+ key={typeof row.id === 'object' ? row.id.value : row.id}
44
+ item={row}
45
+ header={header}
46
+ onChange={value => handleArrayChange(value, index)}
47
+ />
48
+ ))
49
+ )
50
+ : (
51
+ <tr>
52
+ <td className="row--not-found" colSpan={header?.length}>
53
+ Not set
54
+ </td>
55
+ </tr>
56
+ )}
57
+ </tbody>
58
+ </table>
59
+ </div>
60
+ );
61
+ }
62
+
63
+ export default Table;
@@ -0,0 +1,80 @@
1
+ import { useState } from 'react';
2
+
3
+ import * as Icons from 'react-feather';
4
+
5
+ import Switcher from '../../../FormElements/Switcher/Switcher';
6
+
7
+ import './TdTypes.scss';
8
+
9
+ export function TdActions({ actions, onChange, onActionClick, rowItem }) {
10
+ if (!actions) return false;
11
+
12
+ const [state, setState] = useState(actions);
13
+
14
+ const handleArrayChange = (value, index, prop) => {
15
+ state[index][prop] = value;
16
+ setState([...state]);
17
+ onChange(state);
18
+ };
19
+
20
+ return (
21
+ <div className="j6">
22
+ {actions?.map((action, index) => {
23
+ switch (action.type) {
24
+ case 'download':
25
+ return (
26
+ <div
27
+ key={index}
28
+ className="td-actions--item td-actions--download"
29
+ onClick={() => {}}
30
+ >
31
+ <Icons.Download />
32
+ </div>
33
+ );
34
+ case 'edit':
35
+ return (
36
+ <div
37
+ key={index}
38
+ className="td-actions--item td-actions--edit"
39
+ onClick={() => {}}
40
+ >
41
+ <Icons.Edit3 />
42
+ </div>
43
+ );
44
+ case 'delete':
45
+ return (
46
+ <div
47
+ key={index}
48
+ className="td-actions--item td-actions--delete"
49
+ onClick={() => onActionClick('delete', rowItem)}
50
+ >
51
+ <Icons.Trash2 />
52
+ </div>
53
+ );
54
+ case 'undo':
55
+ return (
56
+ <div
57
+ key={index}
58
+ className="td-actions--item td-actions--undo"
59
+ onClick={() => onActionClick('undo', rowItem)}
60
+ >
61
+ <Icons.RotateCcw />
62
+ </div>
63
+ );
64
+ case 'switcher':
65
+ return (
66
+ <div key={index} className="df">
67
+ <Switcher
68
+ label={action.label || null}
69
+ isActive={action?.value}
70
+ onChange={e => handleArrayChange(e, index, 'value')}
71
+ />
72
+ </div>
73
+ );
74
+ default:
75
+ return null;
76
+ }
77
+ })}
78
+ </div>
79
+ );
80
+ }
@@ -0,0 +1,26 @@
1
+ import cn from 'classnames';
2
+ import { ArrowDown, ArrowUp } from 'react-feather';
3
+
4
+ import '../Table.scss';
5
+
6
+ function TdPriority({ onClick, rowIndex, cardLength }) {
7
+ return (
8
+ <div className="cards-table__priority">
9
+ <span className="mr5">{rowIndex + 1}</span>
10
+ <div className="df">
11
+ <ArrowDown
12
+ onClick={() => onClick(rowIndex)}
13
+ className={cn('table--icon', {
14
+ disabled: rowIndex + 1 === cardLength,
15
+ })}
16
+ />
17
+ <ArrowUp
18
+ onClick={() => onClick(rowIndex, true)}
19
+ className={cn('table--icon', { disabled: rowIndex === 0 })}
20
+ />
21
+ </div>
22
+ </div>
23
+ );
24
+ }
25
+
26
+ export default TdPriority;
@@ -0,0 +1,13 @@
1
+ function TdRange({ item }) {
2
+ if (!item) return false;
3
+
4
+ return (
5
+ <div>
6
+ <span>{item.from}</span>
7
+ <span> - </span>
8
+ <span>{item.to}</span>
9
+ </div>
10
+ );
11
+ }
12
+
13
+ export default TdRange;
@@ -0,0 +1,56 @@
1
+ import cn from 'classnames';
2
+
3
+ import { useEffect, useState } from 'react';
4
+
5
+ import { useOutsideToggle } from '../../../../Functions/utils';
6
+ import { KEY_CODE } from '../../Modal/Modal';
7
+
8
+ import '../Table.scss';
9
+
10
+ function TdWeight({ value, percent, onChange, className }) {
11
+ const [state, setState] = useState(value);
12
+ const {
13
+ isToggled: isEdited,
14
+ toggleOff: unsetIsEdited,
15
+ toggleOn: setIsEdited,
16
+ } = useOutsideToggle(false);
17
+
18
+ useEffect(() => {
19
+ setState(value);
20
+ }, [value, isEdited]);
21
+
22
+ const handleKeyUp = ({ keyCode, target }) => {
23
+ if (keyCode === KEY_CODE.ENTER) {
24
+ const newValue = Number(target.value) || 1;
25
+ onChange(newValue);
26
+ unsetIsEdited();
27
+ }
28
+ };
29
+
30
+ return (
31
+ <>
32
+ {isEdited
33
+ ? (
34
+ <Input
35
+ value={state}
36
+ onChange={e => setState(e)}
37
+ onBlur={unsetIsEdited}
38
+ onKeyUp={handleKeyUp}
39
+ autoFocus
40
+ />
41
+ )
42
+ : (
43
+ <div className={cn('td-weight', className)} onClick={setIsEdited}>
44
+ <span>{value}</span>
45
+ <span className="ml2 color--grey-gull">
46
+ (
47
+ {percent}
48
+ %)
49
+ </span>
50
+ </div>
51
+ )}
52
+ </>
53
+ );
54
+ }
55
+
56
+ export default TdWeight;
@@ -20,4 +20,5 @@ export interface ITagProps extends IUniProps {
20
20
  isNoDismiss?: boolean;
21
21
  onClick?: (id?: string) => void;
22
22
  isFreezed?: boolean;
23
+ readOnly?: boolean;
23
24
  }
@@ -1 +1 @@
1
- function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function t(t,n){return function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(l)throw r}}return a}}(t,n)||function(t,n){if(t){if("string"==typeof t)return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}}(t,n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return f}});var n=require("react/jsx-runtime"),r=u(require("classnames")),o=function(e,t){if(e&&e.__esModule)return e;if(null===e||(void 0===e?"undefined":e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)!="object"&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var i=o?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(r,a,i):r[a]=e[a]}return r.default=e,n&&n.set(e,r),r}(require("react")),a=require("react-dom"),i=require("react-feather"),l=u(require("../../Layout/Spinner"));function u(e){return e&&e.__esModule?e:{default:e}}function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}function s(){}require("./Tag.scss");var f=function(e){var u,c,f=e.value,d=e.className,p=e.style,m=e.label,y=e.warning,v=e.isWarningHint,g=e.removeItem,b=e.name,h=e.isPopup,j=e.popupInfoContent,w=e.popupClassName,x=e.id,_=e.isNoDismiss,O=e.onClick,P=void 0===O?s:O,M=e.testId,N=(0,o.useRef)(null),S=t((0,o.useState)(!1),2),E=S[0],k=S[1],C=t((0,o.useState)(!1),2),q=C[0],A=C[1],I=null!=(c=null==N||null==(u=N.current)?void 0:u.getBoundingClientRect())?c:{},L=I.x,W=I.y,D=I.height,R=I.width,T=window.scrollY,B=(0,o.useMemo)(function(){if(!q||!(null==N?void 0:N.current))return{};var e,t=null==N||null==(e=N.current)?void 0:e.getBoundingClientRect(),n=t.x,r=t.y,o=t.height,a=t.width;return{left:"".concat(n,"px"),top:"".concat(r+T,"px"),transform:"translate(calc(-1 * calc(100% - ".concat(a/2+22,"px)), ").concat(o+10,"px)")}},[q,L,W,R,D,T]),z=function(){h&&A(!q),P(x)},H=function(){A(!1)};return(0,o.useEffect)(function(){return document.addEventListener("click",H,!0),function(){document.removeEventListener("click",H,!0)}},[]),(0,o.useEffect)(function(){var e=function(){A(!1)};return window.addEventListener("scroll",e,!0),function(){window.removeEventListener("scroll",e,!0)}},[]),(0,n.jsxs)("div",{onMouseEnter:function(){return k(!0)},onMouseLeave:function(){return k(!1)},"data-testid":void 0===M?"tag":M,role:"listitem","aria-label":"Tag: ".concat(m||b),className:(0,r.default)("tag",d,{"tag-warn":y}),style:null!=p?p:{},onClick:function(){return z()},ref:N,children:[y&&"string"==typeof y&&(0,n.jsx)(i.AlertTriangle,{className:"advanced-tags--warning-icon mr5","aria-label":"Warning"}),y&&"string"==typeof y&&E&&(void 0===v||v)&&(0,n.jsx)("div",{className:"tag__warn-hint",role:"tooltip",children:y}),(0,n.jsx)("span",{className:"tag__label",children:m||b}),g&&!(void 0===_||_)&&(0,n.jsx)("button",{type:"button",onClick:function(e){null==e||e.preventDefault(),null==e||e.stopPropagation(),g(f)},"aria-label":"Remove ".concat(m||b),className:"tag__button",children:(0,n.jsx)(i.X,{className:"color--text"})}),q&&(0,a.createPortal)((0,n.jsx)("div",{id:"tagPopup".concat(f),className:(0,r.default)("tag__popup",w),style:B,children:j||(0,n.jsx)(l.default,{size:"small"})}),document.getElementById("app"))]})};
1
+ function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function t(t,n){return function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(l)throw r}}return a}}(t,n)||function(t,n){if(t){if("string"==typeof t)return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}}(t,n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return f}});var n=require("react/jsx-runtime"),r=u(require("classnames")),o=function(e,t){if(e&&e.__esModule)return e;if(null===e||(void 0===e?"undefined":e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)!="object"&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var i=o?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(r,a,i):r[a]=e[a]}return r.default=e,n&&n.set(e,r),r}(require("react")),a=require("react-dom"),i=require("react-feather"),l=u(require("../../Layout/Spinner"));function u(e){return e&&e.__esModule?e:{default:e}}function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}function s(){}require("./Tag.scss");var f=function(e){var u,c,f=e.value,d=e.className,p=e.style,m=e.label,y=e.warning,v=e.isWarningHint,g=e.removeItem,b=e.name,h=e.isPopup,j=e.popupInfoContent,w=e.popupClassName,x=e.id,_=e.isNoDismiss,O=e.onClick,P=void 0===O?s:O,M=e.testId,N=(0,o.useRef)(null),S=t((0,o.useState)(!1),2),E=S[0],k=S[1],C=t((0,o.useState)(!1),2),q=C[0],A=C[1],I=null!=(c=null==N||null==(u=N.current)?void 0:u.getBoundingClientRect())?c:{},L=I.x,W=I.y,D=I.height,R=I.width,T=window.scrollY,B=(0,o.useMemo)(function(){if(!q||!(null==N?void 0:N.current))return{};var e,t=null==N||null==(e=N.current)?void 0:e.getBoundingClientRect(),n=t.x,r=t.y,o=t.height,a=t.width;return{left:"".concat(n,"px"),top:"".concat(r+T,"px"),transform:"translate(calc(-1 * calc(100% - ".concat(a/2+22,"px)), ").concat(o+10,"px)")}},[q,L,W,R,D,T]),z=function(){h&&A(!q),P(x)},H=function(){A(!1)};return(0,o.useEffect)(function(){return document.addEventListener("click",H,!0),function(){document.removeEventListener("click",H,!0)}},[]),(0,o.useEffect)(function(){var e=function(){A(!1)};return window.addEventListener("scroll",e,!0),function(){window.removeEventListener("scroll",e,!0)}},[]),(0,n.jsxs)("div",{onMouseEnter:function(){return k(!0)},onMouseLeave:function(){return k(!1)},"data-testid":void 0===M?"tag":M,role:"listitem","aria-label":"Tag: ".concat(m||b),className:(0,r.default)("tag",d,{"tag-warn":y}),style:null!=p?p:{},onClick:function(){return z()},ref:N,children:[y&&"string"==typeof y&&(0,n.jsx)(i.AlertTriangle,{className:"advanced-tags--warning-icon mr5","aria-label":"Warning"}),y&&"string"==typeof y&&E&&(void 0===v||v)&&(0,n.jsx)("div",{className:"tag__warn-hint",role:"tooltip",children:y}),(0,n.jsx)("span",{className:"tag__label",children:m||b}),g&&!(void 0===_||_)&&(0,n.jsx)("button",{type:"button",onClick:function(e){null==e||e.preventDefault(),null==e||e.stopPropagation(),g(f)},"aria-label":"Remove ".concat(m||b),className:"tag__button",children:(0,n.jsx)(i.X,{className:"color--text"})}),q&&(0,a.createPortal)((0,n.jsx)("div",{id:"tagPopup".concat(f),className:(0,r.default)("tag__popup",w),style:B,children:j||(0,n.jsx)(l.default,{size:"small"})}),document.getElementById("root"))]})};
@@ -0,0 +1,256 @@
1
+ import cn from 'classnames';
2
+
3
+ import {
4
+ createRef,
5
+ useEffect,
6
+ useLayoutEffect,
7
+ useRef,
8
+ useState,
9
+ } from 'react';
10
+ import { Edit3 } from 'react-feather';
11
+
12
+ import { checkedRef } from '../../../Functions/utils';
13
+ import Tag from '../Tag/Tag';
14
+
15
+ import './TagList.scss';
16
+
17
+ function TagList({
18
+ disabled,
19
+ className,
20
+ onTagClick,
21
+ removeItem = null,
22
+ items = [],
23
+ withToggle = true,
24
+ disableShowMore = false,
25
+ shownItemsCount = 'auto',
26
+ testId = 'test-taglist',
27
+ refProp,
28
+
29
+ renderOrder,
30
+
31
+ onEditClick,
32
+ onToggleRenderAll,
33
+ }) {
34
+ const wrapperRef = useRef(null);
35
+ const [tagList, setTagList] = useState([]);
36
+
37
+ const [staticTagsCount, setStaticTagsCount] = useState(-1);
38
+ const [renderItemsCount, setRenderItemsCount] = useState(-1);
39
+ const [renderAll, setRenderAll] = useState(!withToggle);
40
+
41
+ const wrapperWidth
42
+ = wrapperRef?.current?.getBoundingClientRect()?.width ?? -1;
43
+
44
+ const setRenderAllInterceptor = (v) => {
45
+ setRenderAll(v);
46
+ onToggleRenderAll?.(v);
47
+ };
48
+
49
+ const getStaticTagsCount = (computedWidth) => {
50
+ if (typeof shownItemsCount === 'number') return shownItemsCount;
51
+
52
+ const delta = typeof onEditClick === 'function' ? 60 : 32;
53
+ const result = tagList.reduce(
54
+ (result, { itemRef }, index) => {
55
+ if (result.skip) return result;
56
+
57
+ const itemStyle
58
+ = itemRef?.current && window.getComputedStyle(itemRef.current);
59
+
60
+ const itemWidth = [
61
+ Number.parseInt(itemRef.current?.getBoundingClientRect()?.width, 10),
62
+ Number.parseInt(itemStyle?.marginLeft, 10),
63
+ Number.parseInt(itemStyle?.marginRight, 10),
64
+ ].reduce((result, item) => {
65
+ if (!isNaN(item)) result += item;
66
+ return result;
67
+ }, 0);
68
+
69
+ if (
70
+ (!isNaN(itemWidth)
71
+ && itemWidth > 0
72
+ && itemWidth + result.width < computedWidth - delta)
73
+ || index === 0
74
+ ) {
75
+ result = {
76
+ count: result.count + 1,
77
+ width: result.width + itemWidth,
78
+ items: [...result.items, { w: itemWidth, r: itemRef?.current }],
79
+ };
80
+ }
81
+ else {
82
+ result.skip = true;
83
+ }
84
+
85
+ return result;
86
+ },
87
+ { count: 0, width: 0, items: [], skip: false },
88
+ );
89
+ if (result?.items?.length === 1 && tagList.length > 1) {
90
+ result.items[0].r.style.maxWidth = `${computedWidth - delta - 8}px`;
91
+ }
92
+
93
+ return result?.count;
94
+ };
95
+
96
+ const cancelDefault = (e, cb = () => {}) => {
97
+ e?.preventDefault();
98
+ e?.stopPropagation();
99
+
100
+ cb(e);
101
+ };
102
+
103
+ const renderTags = () => {
104
+ const tagsRenderOrder
105
+ = renderOrder ?? tagList.map(({ value, id }) => value ?? id);
106
+
107
+ return tagsRenderOrder.map((v, i) => {
108
+ const item = tagList.find(({ value, id }) => {
109
+ if (id) return id === v; // сначала ищем по id
110
+ if (value) return value === v; // потом по value
111
+ return false;
112
+ });
113
+
114
+ if (!item) return null;
115
+
116
+ const isHidden
117
+ = renderItemsCount !== -1 && staticTagsCount !== -1
118
+ ? i >= renderItemsCount
119
+ : false;
120
+
121
+ return (
122
+ <div
123
+ className={`tag-list_wrapper_item ${isHidden ? 'tag-list_wrapper_item--hidden' : ''}`}
124
+ key={`tag-list-item-${item?.id ?? item?.value}`}
125
+ ref={checkedRef(item?.itemRef)}
126
+ >
127
+ <Tag
128
+ testId={`test-taglist-item-${item?.id ?? item?.value}`}
129
+ {...item}
130
+ onClick={onTagClick}
131
+ removeItem={removeItem}
132
+ />
133
+ </div>
134
+ );
135
+ });
136
+ };
137
+
138
+ const renderMoreTags = () => {
139
+ if (
140
+ tagList?.length < shownItemsCount
141
+ || !tagList?.length
142
+ || disableShowMore
143
+ ) {
144
+ return null;
145
+ }
146
+ const restItems = tagList.length - renderItemsCount;
147
+
148
+ if (restItems === 0 || !withToggle || staticTagsCount === -1) return null;
149
+
150
+ return (
151
+ <Tag
152
+ label={`+${restItems}`}
153
+ className="tag-list_wrapper_render-more"
154
+ onClick={
155
+ disableShowMore
156
+ ? () => {}
157
+ : e => cancelDefault(e, () => setRenderAllInterceptor(true))
158
+ }
159
+ />
160
+ );
161
+ };
162
+ const renderHideTags = () => {
163
+ if (
164
+ renderItemsCount !== tagList?.length
165
+ || !withToggle
166
+ || staticTagsCount === -1
167
+ || staticTagsCount === tagList?.length
168
+ ) {
169
+ return null;
170
+ }
171
+
172
+ return (
173
+ <Tag
174
+ label="..."
175
+ className="tag-list_wrapper_hide-more"
176
+ onClick={e => cancelDefault(e, () => setRenderAllInterceptor(false))}
177
+ />
178
+ );
179
+ };
180
+
181
+ // Set TagList Items
182
+ useEffect(() => {
183
+ setStaticTagsCount(-1);
184
+ setRenderItemsCount(-1);
185
+ setRenderAllInterceptor(false);
186
+ const itemsWithRef = items.map(item => ({ ...item, itemRef: createRef() }));
187
+ setTagList(itemsWithRef);
188
+ }, [items]);
189
+
190
+ // Count Row Tags
191
+ useLayoutEffect(() => {
192
+ if (withToggle && wrapperWidth !== -1 && staticTagsCount === -1) {
193
+ let computedWidth = wrapperWidth;
194
+
195
+ if (computedWidth === 0) {
196
+ computedWidth = Number.parseInt(
197
+ wrapperRef?.current
198
+ ? window.getComputedStyle(wrapperRef?.current)?.width
199
+ : 0,
200
+ );
201
+ }
202
+
203
+ if (!isNaN(computedWidth)) {
204
+ setStaticTagsCount(getStaticTagsCount(computedWidth));
205
+ }
206
+ }
207
+ }, [tagList, wrapperWidth, wrapperRef?.current]);
208
+
209
+ //
210
+ useLayoutEffect(() => {
211
+ setRenderItemsCount(staticTagsCount);
212
+ }, [staticTagsCount]);
213
+
214
+ // Toggle Show/Hide More Tags
215
+ useEffect(() => {
216
+ setRenderItemsCount(renderAll ? tagList?.length : staticTagsCount);
217
+ }, [renderAll]);
218
+
219
+ useEffect(() => {
220
+ if (wrapperRef?.current && refProp) refProp.current = wrapperRef?.current;
221
+ }, [wrapperRef?.current]);
222
+
223
+ return (
224
+ <div
225
+ className={cn(
226
+ 'tag-list_wrapper',
227
+ `${
228
+ renderItemsCount !== tagList?.length
229
+ || !withToggle
230
+ || staticTagsCount === -1
231
+ || staticTagsCount === tagList?.length
232
+ ? 'tag-list_wrapper--only-static-items'
233
+ : 'tag-list_wrapper--all-items'
234
+ }`,
235
+ className,
236
+ { 'tag-list_wrapper--disabled': disabled },
237
+ )}
238
+ style={{
239
+ visibility: staticTagsCount === -1 ? 'hidden' : 'visible',
240
+ zIndex: staticTagsCount === -1 ? '-1' : 'auto',
241
+ }}
242
+ ref={wrapperRef}
243
+ >
244
+ {renderTags()}
245
+ {renderMoreTags()}
246
+ {renderHideTags()}
247
+ {typeof onEditClick === 'function' && (
248
+ <div className="tag-list__edit-trigger">
249
+ <Edit3 onClick={onEditClick} />
250
+ </div>
251
+ )}
252
+ </div>
253
+ );
254
+ }
255
+
256
+ export default TagList;