intelicoreact 1.6.22 → 1.6.24

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 (275) hide show
  1. package/dist/Atomic/FormElements/ActionAlert/ActionAlert.js +98 -1
  2. package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.js +48 -1
  3. package/dist/Atomic/FormElements/Calendar/Calendar.js +249 -1
  4. package/dist/Atomic/FormElements/Calendar/Calendar.props.js +4 -1
  5. package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +65 -1
  6. package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +52 -1
  7. package/dist/Atomic/FormElements/Datepicker/Datepicker.js +424 -1
  8. package/dist/Atomic/FormElements/Datepicker/Datepicker.props.js +4 -1
  9. package/dist/Atomic/FormElements/Datepicker/components/DatepickerCalendar.js +173 -1
  10. package/dist/Atomic/FormElements/Datepicker/components/DatepickerCalendar.props.js +4 -1
  11. package/dist/Atomic/FormElements/Dropdown/Dropdown.js +735 -1
  12. package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +20 -1
  13. package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +529 -1
  14. package/dist/Atomic/FormElements/FileLoader/FileLoader.js +94 -1
  15. package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +105 -1
  16. package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +67 -1
  17. package/dist/Atomic/FormElements/FileLoaderDescription/FileLoaderDescription.js +247 -1
  18. package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +160 -1
  19. package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +193 -1
  20. package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +135 -1
  21. package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN_old.js +116 -1
  22. package/dist/Atomic/FormElements/Input/Input.js +467 -1
  23. package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +161 -1
  24. package/dist/Atomic/FormElements/InputColor/InputColor.js +64 -1
  25. package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +200 -1
  26. package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +354 -1
  27. package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +71 -1
  28. package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +693 -1
  29. package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +254 -1
  30. package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +32 -1
  31. package/dist/Atomic/FormElements/InputDateRange/dependencies.js +200 -1
  32. package/dist/Atomic/FormElements/InputLink/InputLink.js +99 -1
  33. package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +37 -1
  34. package/dist/Atomic/FormElements/InputMask/InputMask.js +1214 -1
  35. package/dist/Atomic/FormElements/InputMask/config.js +15 -1
  36. package/dist/Atomic/FormElements/InputMask/functions.js +58 -1
  37. package/dist/Atomic/FormElements/InputMask2/InputMask2.js +674 -1
  38. package/dist/Atomic/FormElements/InputMask2/config.js +15 -1
  39. package/dist/Atomic/FormElements/InputMask2/functions.js +58 -1
  40. package/dist/Atomic/FormElements/InputMask3/InputMask3.js +766 -1
  41. package/dist/Atomic/FormElements/InputMask3/config.js +15 -1
  42. package/dist/Atomic/FormElements/InputMask3/functions.js +58 -1
  43. package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +114 -1
  44. package/dist/Atomic/FormElements/InputsRow/InputsRow.js +140 -1
  45. package/dist/Atomic/FormElements/Label/Label.js +87 -1
  46. package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +506 -1
  47. package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +45 -1
  48. package/dist/Atomic/FormElements/NumericInput/NumericInput.js +331 -1
  49. package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +66 -1
  50. package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +80 -1
  51. package/dist/Atomic/FormElements/RadioInput/RadioInput.js +57 -1
  52. package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +54 -1
  53. package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +183 -1
  54. package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +222 -1
  55. package/dist/Atomic/FormElements/RangeList/RangeList.js +175 -1
  56. package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +43 -1
  57. package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +443 -1
  58. package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +858 -1
  59. package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +39 -1
  60. package/dist/Atomic/FormElements/Switcher/Switcher.js +59 -1
  61. package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +50 -1
  62. package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +44 -1
  63. package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +100 -1
  64. package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +52 -1
  65. package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +64 -1
  66. package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +170 -1
  67. package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/States.js +202 -1
  68. package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +67 -1
  69. package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.js +115 -1
  70. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.interface.ts +2 -2
  71. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +1110 -1
  72. package/dist/Atomic/FormElements/Text/Text.js +125 -1
  73. package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +49 -1
  74. package/dist/Atomic/FormElements/Textarea/Textarea.js +80 -1
  75. package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +176 -1
  76. package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +62 -1
  77. package/dist/Atomic/FormElements/TimeRange/TimeRange.js +119 -1
  78. package/dist/Atomic/FormElements/UserContacts/UserContacts.js +188 -1
  79. package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +83 -1
  80. package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +82 -1
  81. package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +101 -1
  82. package/dist/Atomic/FormElements/WidgetPseudoTable/partial/constructor.js +29 -1
  83. package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +113 -1
  84. package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +30 -1
  85. package/dist/Atomic/Layout/Header/Header.js +85 -1
  86. package/dist/Atomic/Layout/Spinner/Spinner.js +44 -1
  87. package/dist/Atomic/UI/Accordion/Accordion.js +108 -1
  88. package/dist/Atomic/UI/Accordion/AccordionItem.js +176 -1
  89. package/dist/Atomic/UI/AccordionTable/AccordionTable.js +238 -1
  90. package/dist/Atomic/UI/AccordionText/AccordionText.js +69 -1
  91. package/dist/Atomic/UI/AdvancedTag/AdvTag.js +207 -1
  92. package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +56 -1
  93. package/dist/Atomic/UI/Alert/Alert.js +72 -1
  94. package/dist/Atomic/UI/Arrow/Arrow.js +132 -1
  95. package/dist/Atomic/UI/Box/Box.js +52 -1
  96. package/dist/Atomic/UI/Button/Button.js +47 -1
  97. package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +72 -1
  98. package/dist/Atomic/UI/Chart/Chart.js +172 -1
  99. package/dist/Atomic/UI/Chart/partial/Chart.constants.js +95 -1
  100. package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +80 -1
  101. package/dist/Atomic/UI/Chart/partial/datasetSetters.js +188 -1
  102. package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +335 -1
  103. package/dist/Atomic/UI/Chart/partial/optionsSetters.js +43 -1
  104. package/dist/Atomic/UI/Chart/partial/utils.js +60 -1
  105. package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +109 -1
  106. package/dist/Atomic/UI/DateTime/DateTime.js +57 -1
  107. package/dist/Atomic/UI/DebugContainer/DebugContainer.js +44 -1
  108. package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +15 -1
  109. package/dist/Atomic/UI/DoubleString/DoubleString.js +102 -1
  110. package/dist/Atomic/UI/DynamicIcon/DynamicIcon.js +70 -1
  111. package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +221 -1
  112. package/dist/Atomic/UI/ExampleChartIntegration/partial/utils.js +106 -1
  113. package/dist/Atomic/UI/Hint/Hint.js +256 -1
  114. package/dist/Atomic/UI/Hint/partials/_utils.js +64 -1
  115. package/dist/Atomic/UI/Modal/Modal.js +179 -1
  116. package/dist/Atomic/UI/Modal/ModalHOC.js +97 -1
  117. package/dist/Atomic/UI/Modal/partials/ModalFooter.js +71 -1
  118. package/dist/Atomic/UI/Modal/partials/ModalTitle.js +110 -1
  119. package/dist/Atomic/UI/Modal/partials/useMobileModal.js +192 -1
  120. package/dist/Atomic/UI/MonoAccordion/MonoAccordion._test.js +75 -1
  121. package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +80 -1
  122. package/dist/Atomic/UI/NavLine/NavLine.js +317 -1
  123. package/dist/Atomic/UI/PageTitle/PageTitle.js +77 -1
  124. package/dist/Atomic/UI/PieChart/PieChart.js +42 -1
  125. package/dist/Atomic/UI/Price/Price.js +31 -1
  126. package/dist/Atomic/UI/PriceRange/PriceRange.js +44 -1
  127. package/dist/Atomic/UI/ProgressLine/ProgressLine.js +98 -1
  128. package/dist/Atomic/UI/Status/Status.js +67 -1
  129. package/dist/Atomic/UI/Table/Partials/TdCell.js +87 -1
  130. package/dist/Atomic/UI/Table/Partials/TdHeader.js +38 -1
  131. package/dist/Atomic/UI/Table/Partials/TdRow.js +99 -1
  132. package/dist/Atomic/UI/Table/Partials/TdTitle.js +52 -1
  133. package/dist/Atomic/UI/Table/Table.js +63 -1
  134. package/dist/Atomic/UI/Table/TdTypes/TdActions.js +80 -1
  135. package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +28 -1
  136. package/dist/Atomic/UI/Table/TdTypes/TdRange.js +13 -1
  137. package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +53 -1
  138. package/dist/Atomic/UI/Tag/Tag.js +167 -1
  139. package/dist/Atomic/UI/TagList/TagList.js +251 -1
  140. package/dist/Atomic/UI/UserBox/UserBox.js +86 -1
  141. package/dist/Atomic/UI/WizardStepper/constructor.js +84 -1
  142. package/dist/Atomic/UI/WizardStepper/index.js +3 -1
  143. package/dist/Atomic/UI/WizardStepper/ui/StateIcon/StateIcon.js +37 -1
  144. package/dist/Atomic/UI/WizardStepper/ui/StateIcon/index.js +3 -1
  145. package/dist/Atomic/UI/WizardStepper/ui/StepRow/StepRow.js +61 -1
  146. package/dist/Atomic/UI/WizardStepper/ui/StepRow/index.js +3 -1
  147. package/dist/Atomic/UI/WizardStepper/ui/StepWrapper/StepWrapper.js +39 -1
  148. package/dist/Atomic/UI/WizardStepper/ui/StepWrapper/index.js +3 -1
  149. package/dist/Atomic/UI/WizardStepper/ui/icons.js +49 -1
  150. package/dist/Atomic/UI/WizardStepper/ui/index.js +3 -1
  151. package/dist/Classes/AbortableFetch.js +454 -1
  152. package/dist/Classes/AnimatedHandler.js +47 -1
  153. package/dist/Classes/RESTAPI/index.js +228 -1
  154. package/dist/Classes/RESTAPI/partials/AbortableFetch.js +457 -1
  155. package/dist/Classes/RESTAPI/partials/ApiBase.js +48 -1
  156. package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +112 -1
  157. package/dist/Classes/RESTAPI/partials/ApiUtils.js +189 -1
  158. package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +252 -1
  159. package/dist/Classes/RESTAPI/partials/Utils.js +92 -1
  160. package/dist/Classes/RESTAPI/partials/_outerDependencies.js +3 -1
  161. package/dist/Classes/RESTAPI/partials/_utils.js +197 -1
  162. package/dist/Constants/index.constants.js +78 -1
  163. package/dist/Functions/Portal.js +22 -1
  164. package/dist/Functions/customEventListener.js +96 -1
  165. package/dist/Functions/dateTime.js +149 -1
  166. package/dist/Functions/fieldValueFormatters.js +405 -1
  167. package/dist/Functions/guards/assertions.js +294 -1
  168. package/dist/Functions/guards/safeValue.js +75 -1
  169. package/dist/Functions/guards/typeGuards.js +373 -1
  170. package/dist/Functions/hooks/useFormFieldsChangesManager.js +95 -1
  171. package/dist/Functions/locale/createTranslator.js +32 -1
  172. package/dist/Functions/operations.js +130 -1
  173. package/dist/Functions/presets/inputMaskPresets.js +170 -1
  174. package/dist/Functions/presets/inputPresets.js +60 -1
  175. package/dist/Functions/presets/mobileKeyboardTypesPresets.js +45 -1
  176. package/dist/Functions/schemas.js +31 -1
  177. package/dist/Functions/useBodyScrollLock.js +17 -1
  178. package/dist/Functions/useClickOutside.js +15 -1
  179. package/dist/Functions/useDebounce.js +17 -1
  180. package/dist/Functions/useFieldFocus.js +84 -1
  181. package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +39 -1
  182. package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +159 -1
  183. package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +78 -1
  184. package/dist/Functions/useFormTools/functions/General.js +134 -1
  185. package/dist/Functions/useFormTools/functions/RenderFields.js +111 -1
  186. package/dist/Functions/useFormTools/functions/usePrevious.js +12 -1
  187. package/dist/Functions/useFormTools/index.js +778 -1
  188. package/dist/Functions/useInputHighlightError.js +67 -1
  189. package/dist/Functions/useIsMobile/useIsMobile.js +33 -1
  190. package/dist/Functions/useKeyPress/useHandleKeyPress.js +52 -1
  191. package/dist/Functions/useKeyPress/useKeyPress.js +52 -1
  192. package/dist/Functions/useLocalStorage.js +34 -1
  193. package/dist/Functions/useLocationParams.js +27 -1
  194. package/dist/Functions/useMediaQuery.js +17 -1
  195. package/dist/Functions/useMetaInfo.js +43 -1
  196. package/dist/Functions/useMouseUpOutside.js +16 -1
  197. package/dist/Functions/useOnlineStatus.js +29 -1
  198. package/dist/Functions/usePasswordChecker.js +110 -1
  199. package/dist/Functions/usePrevious.js +12 -1
  200. package/dist/Functions/useResize.js +31 -1
  201. package/dist/Functions/useScrollTo.js +17 -1
  202. package/dist/Functions/useToggle.js +17 -1
  203. package/dist/Functions/utils.js +522 -1
  204. package/dist/Langs.js +168 -1
  205. package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +21 -1
  206. package/dist/Molecular/CustomIcons/components/AlertCircle.js +23 -1
  207. package/dist/Molecular/CustomIcons/components/AppStore.js +29 -1
  208. package/dist/Molecular/CustomIcons/components/Arrow.js +32 -1
  209. package/dist/Molecular/CustomIcons/components/ArrowDown.js +17 -1
  210. package/dist/Molecular/CustomIcons/components/ArrowLeft.js +22 -1
  211. package/dist/Molecular/CustomIcons/components/ArrowRight.js +22 -1
  212. package/dist/Molecular/CustomIcons/components/ArrowUp.js +17 -1
  213. package/dist/Molecular/CustomIcons/components/Bell.js +15 -1
  214. package/dist/Molecular/CustomIcons/components/Button.js +12 -1
  215. package/dist/Molecular/CustomIcons/components/Campaigns.js +16 -1
  216. package/dist/Molecular/CustomIcons/components/Check.js +14 -1
  217. package/dist/Molecular/CustomIcons/components/Check2.js +12 -1
  218. package/dist/Molecular/CustomIcons/components/ChevronDown.js +12 -1
  219. package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +11 -1
  220. package/dist/Molecular/CustomIcons/components/ChevronLeft.js +11 -1
  221. package/dist/Molecular/CustomIcons/components/ChevronRight.js +11 -1
  222. package/dist/Molecular/CustomIcons/components/ChevronUp.js +11 -1
  223. package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +27 -1
  224. package/dist/Molecular/CustomIcons/components/Close.js +14 -1
  225. package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +17 -1
  226. package/dist/Molecular/CustomIcons/components/Delete.js +16 -1
  227. package/dist/Molecular/CustomIcons/components/Edit.js +15 -1
  228. package/dist/Molecular/CustomIcons/components/Email.js +31 -1
  229. package/dist/Molecular/CustomIcons/components/FinturfLogo.js +18 -1
  230. package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +35 -1
  231. package/dist/Molecular/CustomIcons/components/Flows.js +15 -1
  232. package/dist/Molecular/CustomIcons/components/Gift.js +25 -1
  233. package/dist/Molecular/CustomIcons/components/GoogleAuth.js +29 -1
  234. package/dist/Molecular/CustomIcons/components/GooglePlay.js +29 -1
  235. package/dist/Molecular/CustomIcons/components/HelpCircle.js +19 -1
  236. package/dist/Molecular/CustomIcons/components/HelpCircle2.js +20 -1
  237. package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +19 -1
  238. package/dist/Molecular/CustomIcons/components/Home.js +16 -1
  239. package/dist/Molecular/CustomIcons/components/Home2.js +22 -1
  240. package/dist/Molecular/CustomIcons/components/Key.js +23 -1
  241. package/dist/Molecular/CustomIcons/components/Landers.js +20 -1
  242. package/dist/Molecular/CustomIcons/components/Lock.js +15 -1
  243. package/dist/Molecular/CustomIcons/components/Mail.js +26 -1
  244. package/dist/Molecular/CustomIcons/components/Mastercard.js +73 -1
  245. package/dist/Molecular/CustomIcons/components/Minus.js +25 -1
  246. package/dist/Molecular/CustomIcons/components/Offers.js +16 -1
  247. package/dist/Molecular/CustomIcons/components/Pause.js +28 -1
  248. package/dist/Molecular/CustomIcons/components/PayPal.js +41 -1
  249. package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +28 -1
  250. package/dist/Molecular/CustomIcons/components/Phone.js +30 -1
  251. package/dist/Molecular/CustomIcons/components/Play.js +25 -1
  252. package/dist/Molecular/CustomIcons/components/Plus.js +25 -1
  253. package/dist/Molecular/CustomIcons/components/Profile.js +16 -1
  254. package/dist/Molecular/CustomIcons/components/QRCode.js +29 -1
  255. package/dist/Molecular/CustomIcons/components/Rectangle.js +12 -1
  256. package/dist/Molecular/CustomIcons/components/Revert.js +13 -1
  257. package/dist/Molecular/CustomIcons/components/Star.js +14 -1
  258. package/dist/Molecular/CustomIcons/components/Star2.js +16 -1
  259. package/dist/Molecular/CustomIcons/components/TrafficSources.js +14 -1
  260. package/dist/Molecular/CustomIcons/components/Trash.js +15 -1
  261. package/dist/Molecular/CustomIcons/components/TrashRed.js +15 -1
  262. package/dist/Molecular/CustomIcons/components/Triggers.js +15 -1
  263. package/dist/Molecular/CustomIcons/components/User.js +25 -1
  264. package/dist/Molecular/CustomIcons/components/Visa.js +31 -1
  265. package/dist/Molecular/CustomIcons/components/X.js +12 -1
  266. package/dist/Molecular/CustomIcons/index.js +61 -1
  267. package/dist/Molecular/FormElement/FormElement.js +54 -1
  268. package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +184 -1
  269. package/dist/Molecular/FormWithDependOn/partials/_utils.js +53 -1
  270. package/dist/Molecular/InputAddress/InputAddress.js +626 -1
  271. package/dist/Molecular/InputPassword/InputPassword.js +48 -1
  272. package/dist/index.js +104 -1
  273. package/package.json +1 -1
  274. package/dist/Molecular/InputAddress/InputAddress.d.ts +0 -26
  275. package/dist/Molecular/InputAddress/InputAddress.js.map +0 -1
@@ -1 +1,97 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return l}});var e=require("react/jsx-runtime"),r=o(require("classnames")),t=function(e,r){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 t=a(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if("default"!==l&&Object.prototype.hasOwnProperty.call(e,l)){var i=o?Object.getOwnPropertyDescriptor(e,l):null;i&&(i.get||i.set)?Object.defineProperty(n,l,i):n[l]=e[l]}return n.default=e,t&&t.set(e,n),n}(require("react")),n=o(require("../../../Functions/useKeyPress/useHandleKeyPress"));function o(e){return e&&e.__esModule?e:{default:e}}function a(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,t=new WeakMap;return(a=function(e){return e?t:r})(e)}require("./Modal.scss");var l=function(o){var a=o.zIndex,l=o.isOpen,i=o.closeModal,u=o.children,s=o.className,d=o.size,c=o.testId,f=void 0===c?"modal":c,p=o.closeOnEsc,y=(0,t.useRef)(null);return((0,n.default)({escCallback:(void 0===p||p)&&"function"==typeof i?function(){return null==i?void 0:i()}:void 0}),l)?(0,e.jsxs)("div",{style:{zIndex:void 0===a?100:a},"data-testid":f,className:"modal-box j5",role:"presentation",children:[(0,e.jsx)("div",{className:"modal-overlay",onClick:i,role:"presentation","aria-hidden":"true"}),(0,e.jsx)("div",{ref:y,style:{width:d},className:(0,r.default)(s,"modal"),role:"dialog","aria-modal":"true","aria-labelledby":f,tabIndex:-1,children:u})]}):null};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return _default;
9
+ }
10
+ });
11
+ const _jsxruntime = require("react/jsx-runtime");
12
+ const _classnames = /*#__PURE__*/ _interop_require_default(require("classnames"));
13
+ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
14
+ const _useHandleKeyPress = /*#__PURE__*/ _interop_require_default(require("../../../Functions/useKeyPress/useHandleKeyPress"));
15
+ require("./Modal.scss");
16
+ function _interop_require_default(obj) {
17
+ return obj && obj.__esModule ? obj : {
18
+ default: obj
19
+ };
20
+ }
21
+ function _getRequireWildcardCache(nodeInterop) {
22
+ if (typeof WeakMap !== "function") return null;
23
+ var cacheBabelInterop = new WeakMap();
24
+ var cacheNodeInterop = new WeakMap();
25
+ return (_getRequireWildcardCache = function(nodeInterop) {
26
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
27
+ })(nodeInterop);
28
+ }
29
+ function _interop_require_wildcard(obj, nodeInterop) {
30
+ if (!nodeInterop && obj && obj.__esModule) {
31
+ return obj;
32
+ }
33
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
34
+ return {
35
+ default: obj
36
+ };
37
+ }
38
+ var cache = _getRequireWildcardCache(nodeInterop);
39
+ if (cache && cache.has(obj)) {
40
+ return cache.get(obj);
41
+ }
42
+ var newObj = {
43
+ __proto__: null
44
+ };
45
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
46
+ for(var key in obj){
47
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
48
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
49
+ if (desc && (desc.get || desc.set)) {
50
+ Object.defineProperty(newObj, key, desc);
51
+ } else {
52
+ newObj[key] = obj[key];
53
+ }
54
+ }
55
+ }
56
+ newObj.default = obj;
57
+ if (cache) {
58
+ cache.set(obj, newObj);
59
+ }
60
+ return newObj;
61
+ }
62
+ const Modal = ({ zIndex = 100, isOpen, closeModal, children, className, size, testId = 'modal', closeOnEsc = true })=>{
63
+ const modalRef = (0, _react.useRef)(null);
64
+ (0, _useHandleKeyPress.default)({
65
+ escCallback: closeOnEsc && typeof closeModal === 'function' ? ()=>closeModal === null || closeModal === void 0 ? void 0 : closeModal() : undefined
66
+ });
67
+ if (!isOpen) return null;
68
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
69
+ style: {
70
+ zIndex
71
+ },
72
+ "data-testid": testId,
73
+ className: "modal-box j5",
74
+ role: "presentation",
75
+ children: [
76
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
77
+ className: "modal-overlay",
78
+ onClick: closeModal,
79
+ role: "presentation",
80
+ "aria-hidden": "true"
81
+ }),
82
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
83
+ ref: modalRef,
84
+ style: {
85
+ width: size
86
+ },
87
+ className: (0, _classnames.default)(className, 'modal'),
88
+ role: "dialog",
89
+ "aria-modal": "true",
90
+ "aria-labelledby": testId,
91
+ tabIndex: -1,
92
+ children: children
93
+ })
94
+ ]
95
+ });
96
+ };
97
+ const _default = Modal;
@@ -1 +1,71 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return a}});var e,r=require("react/jsx-runtime"),t=(e=require("classnames"))&&e.__esModule?e:{default:e};function o(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,t=new WeakMap;return(o=function(e){return e?t:r})(e)}var n=(0,function(e,r){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 t=o(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var l=a?Object.getOwnPropertyDescriptor(e,u):null;l&&(l.get||l.set)?Object.defineProperty(n,u,l):n[u]=e[u]}return n.default=e,t&&t.set(e,n),n}(require("react")).memo)(function(e){var o=e.className,n=e.children,a=e.wrapperRef,u=e.testId;return(0,r.jsx)("footer",{"data-testid":void 0===u?"modal-footer":u,ref:a,className:(0,t.default)("modal__footer",void 0===o?"":o),role:"contentinfo","aria-label":"Modal footer",children:n})});n.displayName="ModalFooter";var a=n;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return _default;
9
+ }
10
+ });
11
+ const _jsxruntime = require("react/jsx-runtime");
12
+ const _classnames = /*#__PURE__*/ _interop_require_default(require("classnames"));
13
+ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
14
+ function _interop_require_default(obj) {
15
+ return obj && obj.__esModule ? obj : {
16
+ default: obj
17
+ };
18
+ }
19
+ function _getRequireWildcardCache(nodeInterop) {
20
+ if (typeof WeakMap !== "function") return null;
21
+ var cacheBabelInterop = new WeakMap();
22
+ var cacheNodeInterop = new WeakMap();
23
+ return (_getRequireWildcardCache = function(nodeInterop) {
24
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
25
+ })(nodeInterop);
26
+ }
27
+ function _interop_require_wildcard(obj, nodeInterop) {
28
+ if (!nodeInterop && obj && obj.__esModule) {
29
+ return obj;
30
+ }
31
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
32
+ return {
33
+ default: obj
34
+ };
35
+ }
36
+ var cache = _getRequireWildcardCache(nodeInterop);
37
+ if (cache && cache.has(obj)) {
38
+ return cache.get(obj);
39
+ }
40
+ var newObj = {
41
+ __proto__: null
42
+ };
43
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
44
+ for(var key in obj){
45
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
46
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
47
+ if (desc && (desc.get || desc.set)) {
48
+ Object.defineProperty(newObj, key, desc);
49
+ } else {
50
+ newObj[key] = obj[key];
51
+ }
52
+ }
53
+ }
54
+ newObj.default = obj;
55
+ if (cache) {
56
+ cache.set(obj, newObj);
57
+ }
58
+ return newObj;
59
+ }
60
+ const ModalFooter = /*#__PURE__*/ (0, _react.memo)(({ className = '', children, wrapperRef, testId = 'modal-footer' })=>{
61
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)("footer", {
62
+ "data-testid": testId,
63
+ ref: wrapperRef,
64
+ className: (0, _classnames.default)('modal__footer', className),
65
+ role: "contentinfo",
66
+ "aria-label": "Modal footer",
67
+ children: children
68
+ });
69
+ });
70
+ ModalFooter.displayName = 'ModalFooter';
71
+ const _default = ModalFooter;
@@ -1 +1,110 @@
1
- function e(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return d}});var r,t=require("react/jsx-runtime"),a=(r=require("classnames"))&&r.__esModule?r:{default:r},n=function(e,r){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 t=l(r);if(t&&t.has(e))return t.get(e);var a={__proto__:null},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var i=n?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(a,o,i):a[o]=e[o]}return a.default=e,t&&t.set(e,a),a}(require("react")),o=require("react-feather");function l(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,t=new WeakMap;return(l=function(e){return e?t:r})(e)}var i=(0,n.memo)(function(r){var l=r.variant,i=void 0===l?"primary":l,d=r.children,u=r.isForced,c=r.onClose,s=r.noHeaderCloseBtn,f=r.className,p=r.wrapperRef,m=r.testId,b=void 0===m?"modal-title":m,y=(0,n.useCallback)(function(e){("Enter"===e.key||"Space"===e.key)&&(e.preventDefault(),null==c||c())},[c]),v=(0,n.useCallback)(function(){null==c||c()},[c]);return(0,t.jsxs)("header",{"data-testid":b,ref:p,className:(0,a.default)("modal__header",f,e({},"modal__header-".concat(i),i)),role:"banner","aria-label":"Modal header",children:[(0,t.jsx)("span",{className:(0,a.default)("modal__header-title",e({},"modal__header-".concat(i,"-title"),i)),id:"".concat(b,"-heading"),children:d}),!(void 0!==u&&u)&&(0,t.jsx)("button",{type:"button",onClick:v,onKeyDown:y,className:(0,a.default)("modal-close-icon-box",{"modal-close-icon-box-primary":"primary"===i}),"aria-label":"Close modal",title:"Close modal",children:!(void 0!==s&&s)&&(0,t.jsx)(o.X,{className:"modal-close-icon",role:"img","aria-hidden":"true"})})]})});i.displayName="ModalTitle";var d=i;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return _default;
9
+ }
10
+ });
11
+ const _jsxruntime = require("react/jsx-runtime");
12
+ const _classnames = /*#__PURE__*/ _interop_require_default(require("classnames"));
13
+ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
14
+ const _reactfeather = require("react-feather");
15
+ function _interop_require_default(obj) {
16
+ return obj && obj.__esModule ? obj : {
17
+ default: obj
18
+ };
19
+ }
20
+ function _getRequireWildcardCache(nodeInterop) {
21
+ if (typeof WeakMap !== "function") return null;
22
+ var cacheBabelInterop = new WeakMap();
23
+ var cacheNodeInterop = new WeakMap();
24
+ return (_getRequireWildcardCache = function(nodeInterop) {
25
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
26
+ })(nodeInterop);
27
+ }
28
+ function _interop_require_wildcard(obj, nodeInterop) {
29
+ if (!nodeInterop && obj && obj.__esModule) {
30
+ return obj;
31
+ }
32
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
33
+ return {
34
+ default: obj
35
+ };
36
+ }
37
+ var cache = _getRequireWildcardCache(nodeInterop);
38
+ if (cache && cache.has(obj)) {
39
+ return cache.get(obj);
40
+ }
41
+ var newObj = {
42
+ __proto__: null
43
+ };
44
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
45
+ for(var key in obj){
46
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
47
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
48
+ if (desc && (desc.get || desc.set)) {
49
+ Object.defineProperty(newObj, key, desc);
50
+ } else {
51
+ newObj[key] = obj[key];
52
+ }
53
+ }
54
+ }
55
+ newObj.default = obj;
56
+ if (cache) {
57
+ cache.set(obj, newObj);
58
+ }
59
+ return newObj;
60
+ }
61
+ const ModalTitle = /*#__PURE__*/ (0, _react.memo)(({ variant = 'primary', children, isForced = false, onClose, noHeaderCloseBtn = false, className, wrapperRef, testId = 'modal-title' })=>{
62
+ const handleKeyDown = (0, _react.useCallback)((e)=>{
63
+ if (e.key === 'Enter' || e.key === 'Space') {
64
+ e.preventDefault();
65
+ onClose === null || onClose === void 0 ? void 0 : onClose();
66
+ }
67
+ }, [
68
+ onClose
69
+ ]);
70
+ const handleClick = (0, _react.useCallback)(()=>{
71
+ onClose === null || onClose === void 0 ? void 0 : onClose();
72
+ }, [
73
+ onClose
74
+ ]);
75
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)("header", {
76
+ "data-testid": testId,
77
+ ref: wrapperRef,
78
+ className: (0, _classnames.default)('modal__header', className, {
79
+ [`modal__header-${variant}`]: variant
80
+ }),
81
+ role: "banner",
82
+ "aria-label": "Modal header",
83
+ children: [
84
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
85
+ className: (0, _classnames.default)('modal__header-title', {
86
+ [`modal__header-${variant}-title`]: variant
87
+ }),
88
+ id: `${testId}-heading`,
89
+ children: children
90
+ }),
91
+ !isForced && /*#__PURE__*/ (0, _jsxruntime.jsx)("button", {
92
+ type: "button",
93
+ onClick: handleClick,
94
+ onKeyDown: handleKeyDown,
95
+ className: (0, _classnames.default)('modal-close-icon-box', {
96
+ 'modal-close-icon-box-primary': variant === 'primary'
97
+ }),
98
+ "aria-label": "Close modal",
99
+ title: "Close modal",
100
+ children: !noHeaderCloseBtn && /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactfeather.X, {
101
+ className: "modal-close-icon",
102
+ role: "img",
103
+ "aria-hidden": "true"
104
+ })
105
+ })
106
+ ]
107
+ });
108
+ });
109
+ ModalTitle.displayName = 'ModalTitle';
110
+ const _default = ModalTitle;
@@ -1 +1,192 @@
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(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function n(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function r(t,n){return function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,l=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=l){var u=[],o=!0,i=!1;try{for(l=l.call(e);!(o=(n=l.next()).done)&&(u.push(n.value),!t||u.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{o||null==l.return||l.return()}finally{if(i)throw r}}return u}}(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 a}});var l,u=require("react/jsx-runtime"),o=require("react"),i=(l=require("../../../../Functions/useIsMobile/useIsMobile"))&&l.__esModule?l:{default:l},c={UP:"up",DOWN:"down"};function a(e){var l,a,f,d,s=e.modalRef,g=e.withMobileLogic,v=void 0!==g&&g,y=e.withFixedFooter,h=void 0!==y&&y,b=e.isOpen,O=void 0!==b&&b,p=(0,o.useRef)(null),m=(0,o.useRef)(null),S=(0,o.useRef)(null),E=(0,o.useRef)(null),w=(0,i.default)().isMobile,I=r((0,o.useState)(0),2),R=I[0],_=I[1],H=r((0,o.useState)({IS_HEADER_HIDDEN:!1,IS_HEADER_STICKY:!1,IS_FOOTER_HIDDEN:!1,IS_FOOTER_STICKY:h}),2),D=H[0],j=H[1],C=r((0,o.useState)({headerHeight:0,footerHeight:0}),2),P=C[0],T=C[1],M=r((0,o.useState)(c.UP),2),A=M[0],L=M[1],N=r((0,o.useState)(0),2),F=N[0],x=N[1],B=r((0,o.useState)(0),2),K=B[0],U=B[1],Y=r((0,o.useState)(1),2),W=Y[0],k=Y[1],q=r((0,o.useState)(1),2)[1];(0,o.useLayoutEffect)(function(){var e=null==p?void 0:p.current;e&&e.addEventListener("scroll",function(){U(function(t){return t!==e.scrollTop&&x(t),e.scrollTop})})},[null==p?void 0:p.current]),(0,o.useEffect)(function(){L(function(e){return K<F?c.UP:K>F?c.DOWN:e})},[K,F]),(0,o.useLayoutEffect)(function(){if(O){var e,t,n,r,l=(null==s?void 0:s.current)?(null==s?void 0:s.current.style)||window.getComputedStyle(null==s?void 0:s.current):{},u=(null==s?void 0:s.current)?R+Number.parseFloat((null==l?void 0:l.marginTop)||"0"):0,o=document.documentElement.clientHeight||window.screen.availHeight||window.screen.height;(null==p?void 0:p.current)&&(u<=o?(p.current.style.display="flex",p.current.style.alignItems="flex-end"):(null==(t=p.current)||null==(e=t.style)||e.removeProperty("display"),null==(r=p.current)||null==(n=r.style)||n.removeProperty("align-items")))}},[P,O,w,R]),(0,o.useLayoutEffect)(function(){if(w&&O){var e,t,n=null==s||null==(t=s.current)||null==(e=t.getBoundingClientRect())?void 0:e.height;n&&R!==n&&_(n)}}),(0,o.useEffect)(function(){if(w&&v){var e=P.footerHeight,t=P.headerHeight;j(function(n){return{IS_HEADER_HIDDEN:A===c.DOWN||0===K,IS_HEADER_STICKY:A===c.UP&&0!==K&&(K>=t||n.IS_HEADER_STICKY),IS_FOOTER_HIDDEN:!h&&(A===c.UP||W===Math.round(K)),IS_FOOTER_STICKY:h&&W>1||A===c.DOWN&&(W-Math.round(K)>=e||n.IS_FOOTER_STICKY)}})}},[K,W,w,v,A,P,R,window.innerHeight]),(0,o.useLayoutEffect)(function(){var e,r;(null==m||null==(r=m.current)||null==(e=r.getBoundingClientRect())?void 0:e.height)!==void 0&&T(function(e){var r,l,u;return n(t({},e),{headerHeight:null!=(u=null==m||null==(l=m.current)||null==(r=l.getBoundingClientRect())?void 0:r.height)?u:0})})},[null==m||null==(a=m.current)||null==(l=a.getBoundingClientRect())?void 0:l.height]),(0,o.useLayoutEffect)(function(){var e,r;(null==S||null==(r=S.current)||null==(e=r.getBoundingClientRect())?void 0:e.height)!==void 0&&T(function(e){var r,l,u;return n(t({},e),{footerHeight:null!=(u=null==S||null==(l=S.current)||null==(r=l.getBoundingClientRect())?void 0:r.height)?u:0})})},[null==S||null==(d=S.current)||null==(f=d.getBoundingClientRect())?void 0:f.height]),(0,o.useEffect)(function(){if(null==p?void 0:p.current){var e,t;q(null==p||null==(e=p.current)?void 0:e.scrollHeight),k((null==p||null==(t=p.current)?void 0:t.scrollHeight)-window.innerHeight)}},[K,null==p?void 0:p.current,window.innerHeight]),(0,o.useEffect)(function(){window.addEventListener("resize",function(){q(function(e){return k(e-window.innerHeight),e})})},[]);var z=(0,o.useCallback)(function(e){return w&&v?(0,u.jsx)("div",{className:"modal-mobile-container",ref:p,children:e}):e},[w,v]);return{modalMobileContainerRef:p,modalMobileHeaderRef:m,modalMobileBodyRef:E,modalMobileFooterRef:S,MODALS_LOGIC:D,SCROLL_DIRECTION:c,scrollTop:K,scrollHeight:W,renderModal:z,isMobile:w}}
1
+ /* eslint-disable react-web-api/no-leaked-event-listener */ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return useMobileModal;
9
+ }
10
+ });
11
+ const _jsxruntime = require("react/jsx-runtime");
12
+ const _react = require("react");
13
+ const _useIsMobile = /*#__PURE__*/ _interop_require_default(require("../../../../Functions/useIsMobile/useIsMobile"));
14
+ function _interop_require_default(obj) {
15
+ return obj && obj.__esModule ? obj : {
16
+ default: obj
17
+ };
18
+ }
19
+ const SCROLL_DIRECTION = {
20
+ UP: 'up',
21
+ DOWN: 'down'
22
+ };
23
+ function useMobileModal({ modalRef, withMobileLogic = false, withFixedFooter = false, isOpen = false }) {
24
+ var _modalMobileHeaderRef_current_getBoundingClientRect, _modalMobileHeaderRef_current, _modalMobileFooterRef_current_getBoundingClientRect, _modalMobileFooterRef_current;
25
+ const modalMobileContainerRef = (0, _react.useRef)(null);
26
+ const modalMobileHeaderRef = (0, _react.useRef)(null);
27
+ const modalMobileFooterRef = (0, _react.useRef)(null);
28
+ const modalMobileBodyRef = (0, _react.useRef)(null);
29
+ const { isMobile } = (0, _useIsMobile.default)();
30
+ const [modalHeight, setModalHeight] = (0, _react.useState)(0);
31
+ const [modalsLogic, setModalsLogic] = (0, _react.useState)({
32
+ IS_HEADER_HIDDEN: false,
33
+ IS_HEADER_STICKY: false,
34
+ IS_FOOTER_HIDDEN: false,
35
+ IS_FOOTER_STICKY: withFixedFooter
36
+ });
37
+ const [modalsLogicProps, setModalsLogicProps] = (0, _react.useState)({
38
+ headerHeight: 0,
39
+ footerHeight: 0
40
+ });
41
+ const [scrollDirection, setScrollDirection] = (0, _react.useState)(SCROLL_DIRECTION.UP);
42
+ const [scrollTopPrev, setScrollTopPrev] = (0, _react.useState)(0);
43
+ const [scrollTop, setScrollTop] = (0, _react.useState)(0);
44
+ const [scrollHeight, setScrollHeight] = (0, _react.useState)(1);
45
+ const [, setContainerScrollHeight] = (0, _react.useState)(1);
46
+ /* MODALS LOGIC | BEGIN */ // Count ScrollTop
47
+ (0, _react.useLayoutEffect)(()=>{
48
+ const el = modalMobileContainerRef === null || modalMobileContainerRef === void 0 ? void 0 : modalMobileContainerRef.current;
49
+ if (el) {
50
+ el.addEventListener('scroll', ()=>{
51
+ setScrollTop((scrollTop)=>{
52
+ if (scrollTop !== el.scrollTop) setScrollTopPrev(scrollTop);
53
+ return el.scrollTop;
54
+ });
55
+ });
56
+ }
57
+ }, [
58
+ modalMobileContainerRef === null || modalMobileContainerRef === void 0 ? void 0 : modalMobileContainerRef.current
59
+ ]);
60
+ // Count ScrollDirection
61
+ (0, _react.useEffect)(()=>{
62
+ setScrollDirection((prevScrollDirection)=>scrollTop < scrollTopPrev ? SCROLL_DIRECTION.UP : scrollTop > scrollTopPrev ? SCROLL_DIRECTION.DOWN : prevScrollDirection);
63
+ }, [
64
+ scrollTop,
65
+ scrollTopPrev
66
+ ]);
67
+ // Dynamic Modal Positioning
68
+ (0, _react.useLayoutEffect)(()=>{
69
+ if (isOpen) {
70
+ const modalStyle = (modalRef === null || modalRef === void 0 ? void 0 : modalRef.current) ? (modalRef === null || modalRef === void 0 ? void 0 : modalRef.current.style) || window.getComputedStyle(modalRef === null || modalRef === void 0 ? void 0 : modalRef.current) : {};
71
+ const computedModalHeight = (modalRef === null || modalRef === void 0 ? void 0 : modalRef.current) ? modalHeight + Number.parseFloat((modalStyle === null || modalStyle === void 0 ? void 0 : modalStyle.marginTop) || '0') : 0;
72
+ const windowHeight = document.documentElement.clientHeight || window.screen.availHeight || window.screen.height;
73
+ if (modalMobileContainerRef === null || modalMobileContainerRef === void 0 ? void 0 : modalMobileContainerRef.current) {
74
+ if (computedModalHeight <= windowHeight) {
75
+ modalMobileContainerRef.current.style.display = 'flex';
76
+ modalMobileContainerRef.current.style.alignItems = 'flex-end';
77
+ } else {
78
+ var _modalMobileContainerRef_current_style, _modalMobileContainerRef_current, _modalMobileContainerRef_current_style1, _modalMobileContainerRef_current1;
79
+ (_modalMobileContainerRef_current = modalMobileContainerRef.current) === null || _modalMobileContainerRef_current === void 0 ? void 0 : (_modalMobileContainerRef_current_style = _modalMobileContainerRef_current.style) === null || _modalMobileContainerRef_current_style === void 0 ? void 0 : _modalMobileContainerRef_current_style.removeProperty('display');
80
+ (_modalMobileContainerRef_current1 = modalMobileContainerRef.current) === null || _modalMobileContainerRef_current1 === void 0 ? void 0 : (_modalMobileContainerRef_current_style1 = _modalMobileContainerRef_current1.style) === null || _modalMobileContainerRef_current_style1 === void 0 ? void 0 : _modalMobileContainerRef_current_style1.removeProperty('align-items');
81
+ }
82
+ }
83
+ }
84
+ }, [
85
+ modalsLogicProps,
86
+ isOpen,
87
+ isMobile,
88
+ modalHeight
89
+ ]);
90
+ // Calculating
91
+ (0, _react.useLayoutEffect)(()=>{
92
+ if (isMobile && isOpen) {
93
+ var _modalRef_current_getBoundingClientRect, _modalRef_current;
94
+ const newModalHeight = modalRef === null || modalRef === void 0 ? void 0 : (_modalRef_current = modalRef.current) === null || _modalRef_current === void 0 ? void 0 : (_modalRef_current_getBoundingClientRect = _modalRef_current.getBoundingClientRect()) === null || _modalRef_current_getBoundingClientRect === void 0 ? void 0 : _modalRef_current_getBoundingClientRect.height;
95
+ if (newModalHeight && modalHeight !== newModalHeight) {
96
+ setModalHeight(newModalHeight);
97
+ }
98
+ }
99
+ });
100
+ (0, _react.useEffect)(()=>{
101
+ if (isMobile && withMobileLogic) {
102
+ const { footerHeight, headerHeight } = modalsLogicProps;
103
+ setModalsLogic((prevStickyLogic)=>({
104
+ IS_HEADER_HIDDEN: scrollDirection === SCROLL_DIRECTION.DOWN || scrollTop === 0,
105
+ IS_HEADER_STICKY: scrollDirection === SCROLL_DIRECTION.UP && scrollTop !== 0 && (scrollTop >= headerHeight || prevStickyLogic.IS_HEADER_STICKY),
106
+ IS_FOOTER_HIDDEN: !withFixedFooter && (scrollDirection === SCROLL_DIRECTION.UP || scrollHeight === Math.round(scrollTop)),
107
+ IS_FOOTER_STICKY: withFixedFooter && scrollHeight > 1 || scrollDirection === SCROLL_DIRECTION.DOWN && (scrollHeight - Math.round(scrollTop) >= footerHeight || prevStickyLogic.IS_FOOTER_STICKY)
108
+ }));
109
+ }
110
+ }, [
111
+ scrollTop,
112
+ scrollHeight,
113
+ isMobile,
114
+ withMobileLogic,
115
+ scrollDirection,
116
+ modalsLogicProps,
117
+ modalHeight,
118
+ window.innerHeight
119
+ ]);
120
+ (0, _react.useLayoutEffect)(()=>{
121
+ var _modalMobileHeaderRef_current_getBoundingClientRect, _modalMobileHeaderRef_current;
122
+ if ((modalMobileHeaderRef === null || modalMobileHeaderRef === void 0 ? void 0 : (_modalMobileHeaderRef_current = modalMobileHeaderRef.current) === null || _modalMobileHeaderRef_current === void 0 ? void 0 : (_modalMobileHeaderRef_current_getBoundingClientRect = _modalMobileHeaderRef_current.getBoundingClientRect()) === null || _modalMobileHeaderRef_current_getBoundingClientRect === void 0 ? void 0 : _modalMobileHeaderRef_current_getBoundingClientRect.height) !== undefined) {
123
+ setModalsLogicProps((state)=>{
124
+ var _modalMobileHeaderRef_current_getBoundingClientRect, _modalMobileHeaderRef_current;
125
+ var _modalMobileHeaderRef_current_getBoundingClientRect_height;
126
+ return {
127
+ ...state,
128
+ headerHeight: (_modalMobileHeaderRef_current_getBoundingClientRect_height = modalMobileHeaderRef === null || modalMobileHeaderRef === void 0 ? void 0 : (_modalMobileHeaderRef_current = modalMobileHeaderRef.current) === null || _modalMobileHeaderRef_current === void 0 ? void 0 : (_modalMobileHeaderRef_current_getBoundingClientRect = _modalMobileHeaderRef_current.getBoundingClientRect()) === null || _modalMobileHeaderRef_current_getBoundingClientRect === void 0 ? void 0 : _modalMobileHeaderRef_current_getBoundingClientRect.height) !== null && _modalMobileHeaderRef_current_getBoundingClientRect_height !== void 0 ? _modalMobileHeaderRef_current_getBoundingClientRect_height : 0
129
+ };
130
+ });
131
+ }
132
+ }, [
133
+ modalMobileHeaderRef === null || modalMobileHeaderRef === void 0 ? void 0 : (_modalMobileHeaderRef_current = modalMobileHeaderRef.current) === null || _modalMobileHeaderRef_current === void 0 ? void 0 : (_modalMobileHeaderRef_current_getBoundingClientRect = _modalMobileHeaderRef_current.getBoundingClientRect()) === null || _modalMobileHeaderRef_current_getBoundingClientRect === void 0 ? void 0 : _modalMobileHeaderRef_current_getBoundingClientRect.height
134
+ ]);
135
+ (0, _react.useLayoutEffect)(()=>{
136
+ var _modalMobileFooterRef_current_getBoundingClientRect, _modalMobileFooterRef_current;
137
+ if ((modalMobileFooterRef === null || modalMobileFooterRef === void 0 ? void 0 : (_modalMobileFooterRef_current = modalMobileFooterRef.current) === null || _modalMobileFooterRef_current === void 0 ? void 0 : (_modalMobileFooterRef_current_getBoundingClientRect = _modalMobileFooterRef_current.getBoundingClientRect()) === null || _modalMobileFooterRef_current_getBoundingClientRect === void 0 ? void 0 : _modalMobileFooterRef_current_getBoundingClientRect.height) !== undefined) {
138
+ setModalsLogicProps((state)=>{
139
+ var _modalMobileFooterRef_current_getBoundingClientRect, _modalMobileFooterRef_current;
140
+ var _modalMobileFooterRef_current_getBoundingClientRect_height;
141
+ return {
142
+ ...state,
143
+ footerHeight: (_modalMobileFooterRef_current_getBoundingClientRect_height = modalMobileFooterRef === null || modalMobileFooterRef === void 0 ? void 0 : (_modalMobileFooterRef_current = modalMobileFooterRef.current) === null || _modalMobileFooterRef_current === void 0 ? void 0 : (_modalMobileFooterRef_current_getBoundingClientRect = _modalMobileFooterRef_current.getBoundingClientRect()) === null || _modalMobileFooterRef_current_getBoundingClientRect === void 0 ? void 0 : _modalMobileFooterRef_current_getBoundingClientRect.height) !== null && _modalMobileFooterRef_current_getBoundingClientRect_height !== void 0 ? _modalMobileFooterRef_current_getBoundingClientRect_height : 0
144
+ };
145
+ });
146
+ }
147
+ }, [
148
+ modalMobileFooterRef === null || modalMobileFooterRef === void 0 ? void 0 : (_modalMobileFooterRef_current = modalMobileFooterRef.current) === null || _modalMobileFooterRef_current === void 0 ? void 0 : (_modalMobileFooterRef_current_getBoundingClientRect = _modalMobileFooterRef_current.getBoundingClientRect()) === null || _modalMobileFooterRef_current_getBoundingClientRect === void 0 ? void 0 : _modalMobileFooterRef_current_getBoundingClientRect.height
149
+ ]);
150
+ (0, _react.useEffect)(()=>{
151
+ if (modalMobileContainerRef === null || modalMobileContainerRef === void 0 ? void 0 : modalMobileContainerRef.current) {
152
+ var _modalMobileContainerRef_current, _modalMobileContainerRef_current1;
153
+ setContainerScrollHeight(modalMobileContainerRef === null || modalMobileContainerRef === void 0 ? void 0 : (_modalMobileContainerRef_current = modalMobileContainerRef.current) === null || _modalMobileContainerRef_current === void 0 ? void 0 : _modalMobileContainerRef_current.scrollHeight);
154
+ setScrollHeight((modalMobileContainerRef === null || modalMobileContainerRef === void 0 ? void 0 : (_modalMobileContainerRef_current1 = modalMobileContainerRef.current) === null || _modalMobileContainerRef_current1 === void 0 ? void 0 : _modalMobileContainerRef_current1.scrollHeight) - window.innerHeight);
155
+ }
156
+ }, [
157
+ scrollTop,
158
+ modalMobileContainerRef === null || modalMobileContainerRef === void 0 ? void 0 : modalMobileContainerRef.current,
159
+ window.innerHeight
160
+ ]);
161
+ (0, _react.useEffect)(()=>{
162
+ window.addEventListener('resize', ()=>{
163
+ setContainerScrollHeight((containerScrollHeight)=>{
164
+ setScrollHeight(containerScrollHeight - window.innerHeight);
165
+ return containerScrollHeight;
166
+ });
167
+ });
168
+ }, []);
169
+ /* MODALS LOGIC | END */ const renderModal = (0, _react.useCallback)((modal)=>{
170
+ if (!isMobile || !withMobileLogic) return modal;
171
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
172
+ className: "modal-mobile-container",
173
+ ref: modalMobileContainerRef,
174
+ children: modal
175
+ });
176
+ }, [
177
+ isMobile,
178
+ withMobileLogic
179
+ ]);
180
+ return {
181
+ modalMobileContainerRef,
182
+ modalMobileHeaderRef,
183
+ modalMobileBodyRef,
184
+ modalMobileFooterRef,
185
+ MODALS_LOGIC: modalsLogic,
186
+ SCROLL_DIRECTION,
187
+ scrollTop,
188
+ scrollHeight,
189
+ renderModal,
190
+ isMobile
191
+ };
192
+ }
@@ -1 +1,75 @@
1
- function e(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){var o;o=n[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}function t(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}import{jsx as n}from"react/jsx-runtime";import{fireEvent as o,render as r,screen as c}from"@testing-library/react";import i from"./MonoAccordion";describe("monoAccordion",function(){var d={titleJSX:n("div",{children:"Accordion Title"}),icon:n("span",{children:"▼"}),isOpen:!1,onClick:jest.fn(),testId:"test-accordion"};it("renders correctly with default props",function(){r(n(i,t(e({},d),{children:n("div",{children:"Accordion Content"})}))),expect(c.getByTestId("test-accordion")).toBeInTheDocument(),expect(c.getByText("Accordion Title")).toBeInTheDocument()}),it("handles click events correctly",function(){r(n(i,t(e({},d),{children:n("div",{children:"Accordion Content"})}))),o.click(c.getByRole("button")),expect(d.onClick).toHaveBeenCalled()}),it("applies correct classes when open",function(){r(n(i,t(e({},d),{isOpen:!0,children:n("div",{children:"Accordion Content"})}))),expect(c.getByTestId("test-accordion")).toHaveClass("mono-accordion--is-open")}),it("applies disabled state correctly",function(){r(n(i,t(e({},d),{disabled:!0,children:n("div",{children:"Accordion Content"})}))),expect(c.getByRole("button")).toBeDisabled(),expect(c.getByTestId("test-accordion")).toHaveClass("mono-accordion--disabled")}),it("handles aria attributes correctly",function(){var o=r(n(i,t(e({},d),{children:n("div",{children:"Accordion Content"})}))).rerender;expect(c.getByRole("button")).toHaveAttribute("aria-expanded","false"),o(n(i,t(e({},d),{isOpen:!0,children:n("div",{children:"Accordion Content"})}))),expect(c.getByRole("button")).toHaveAttribute("aria-expanded","true")})});
1
+ import { fireEvent, render, screen } from '@testing-library/react';
2
+
3
+ import MonoAccordion from './MonoAccordion';
4
+
5
+ describe('monoAccordion', () => {
6
+ const defaultProps = {
7
+ titleJSX: <div>Accordion Title</div>,
8
+ icon: <span>▼</span>,
9
+ isOpen: false,
10
+ onClick: jest.fn(),
11
+ testId: 'test-accordion',
12
+ };
13
+
14
+ it('renders correctly with default props', () => {
15
+ render(
16
+ <MonoAccordion {...defaultProps}>
17
+ <div>Accordion Content</div>
18
+ </MonoAccordion>,
19
+ );
20
+
21
+ expect(screen.getByTestId('test-accordion')).toBeInTheDocument();
22
+ expect(screen.getByText('Accordion Title')).toBeInTheDocument();
23
+ });
24
+
25
+ it('handles click events correctly', () => {
26
+ render(
27
+ <MonoAccordion {...defaultProps}>
28
+ <div>Accordion Content</div>
29
+ </MonoAccordion>,
30
+ );
31
+
32
+ fireEvent.click(screen.getByRole('button'));
33
+ expect(defaultProps.onClick).toHaveBeenCalled();
34
+ });
35
+
36
+ it('applies correct classes when open', () => {
37
+ render(
38
+ <MonoAccordion {...defaultProps} isOpen={true}>
39
+ <div>Accordion Content</div>
40
+ </MonoAccordion>,
41
+ );
42
+
43
+ expect(screen.getByTestId('test-accordion')).toHaveClass('mono-accordion--is-open');
44
+ });
45
+
46
+ it('applies disabled state correctly', () => {
47
+ render(
48
+ <MonoAccordion {...defaultProps} disabled={true}>
49
+ <div>Accordion Content</div>
50
+ </MonoAccordion>,
51
+ );
52
+
53
+ const button = screen.getByRole('button');
54
+ expect(button).toBeDisabled();
55
+ expect(screen.getByTestId('test-accordion')).toHaveClass('mono-accordion--disabled');
56
+ });
57
+
58
+ it('handles aria attributes correctly', () => {
59
+ const { rerender } = render(
60
+ <MonoAccordion {...defaultProps}>
61
+ <div>Accordion Content</div>
62
+ </MonoAccordion>,
63
+ );
64
+
65
+ expect(screen.getByRole('button')).toHaveAttribute('aria-expanded', 'false');
66
+
67
+ rerender(
68
+ <MonoAccordion {...defaultProps} isOpen={true}>
69
+ <div>Accordion Content</div>
70
+ </MonoAccordion>,
71
+ );
72
+
73
+ expect(screen.getByRole('button')).toHaveAttribute('aria-expanded', 'true');
74
+ });
75
+ });
@@ -1 +1,80 @@
1
- function t(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function r(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useEffect as o,useRef as c,useState as i}from"react";import a from"classnames";import"./MonoAccordion.scss";var l="mono-accordion";export default function(u){var s,f,d,p,m=u.titleJSX,y=u.icon,b=u.children,v=u.isOpen,h=u.onClick,O=u.className,g=u.disabled,j=u.testId,P=u.datasetProp,w=(s=i(),function(t){if(Array.isArray(t))return t}(s)||function(t,r){var e,n,o=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=o){var c=[],i=!0,a=!1;try{for(o=o.call(t);!(i=(e=o.next()).done)&&(c.push(e.value),c.length!==r);i=!0);}catch(t){a=!0,n=t}finally{try{i||null==o.return||o.return()}finally{if(a)throw n}}return c}}(s,2)||function(r,e){if(r){if("string"==typeof r)return t(r,2);var n=Object.prototype.toString.call(r).slice(8,-1);if("Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return t(r,e)}}(s,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),_=w[0],S=w[1],A=c(),N=c(),x=function(t){void 0!==t?S(function(r){return"".concat(t,"px")}):S(function(t){var r,e,n;return"".concat(null==(e=Array.from(null==(n=N.current)?void 0:n.childNodes))||null==(r=e.reduce)?void 0:r.call(e,function(t,r){return t+r.offsetHeight},0),"px")})};return o(function(){v?x():x(0)},[v,b]),n("div",(f=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),o.forEach(function(e){r(t,e,n[e])})}return t}({},void 0===P?{}:P),d=d={"data-testid":void 0===j?"mono-accordion":j,className:a(l,O,(r(p={},"".concat(l,"_is-open"),v),r(p,"".concat(l,"_disabled"),g),p)),children:[n("div",{className:"".concat(l,"__head"),onClick:function(t){if(Array.from(A.current.childNodes).some(function(r){return r.contains(t.target)}))return t;h(t),null==t||t.preventDefault(),null==t||t.stopPropagation()},children:[e("div",{ref:A,className:"".concat(l,"__tile-container"),children:m}),e("span",{className:"".concat(l,"__icon-container"),children:y})]}),e("div",{ref:N,style:{maxHeight:_},className:a("".concat(l,"__container")),children:e("div",{className:"".concat(l,"__content-wrapper"),children:b})})]},Object.getOwnPropertyDescriptors?Object.defineProperties(f,Object.getOwnPropertyDescriptors(d)):(function(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e.push.apply(e,n)}return e})(Object(d)).forEach(function(t){Object.defineProperty(f,t,Object.getOwnPropertyDescriptor(d,t))}),f))}
1
+ import React, { useEffect, useRef, useState } from "react";
2
+
3
+ import cn from "classnames";
4
+
5
+ import "./MonoAccordion.scss";
6
+
7
+ const RC = "mono-accordion";
8
+
9
+ const MonoAccordion = ({
10
+ titleJSX,
11
+ icon,
12
+ children,
13
+ isOpen,
14
+ onClick,
15
+ className,
16
+ disabled,
17
+ testId = "mono-accordion",
18
+ datasetProp = {},
19
+ }) => {
20
+ const [maxHeight, setMaxHeight] = useState();
21
+ const titleRef = useRef();
22
+ const containerRef = useRef();
23
+
24
+ const setHeight = (value) => {
25
+ if (value !== undefined) setMaxHeight((state) => `${value}px`);
26
+ else
27
+ setMaxHeight(
28
+ (state) =>
29
+ `${Array.from(containerRef.current?.childNodes)?.reduce?.((acc, el) => acc + el.offsetHeight, 0)}px`,
30
+ );
31
+ };
32
+
33
+ const handleClick = (e) => {
34
+ if (
35
+ !Array.from(titleRef.current.childNodes).some((el) =>
36
+ el.contains(e.target),
37
+ )
38
+ ) {
39
+ onClick(e);
40
+ e?.preventDefault();
41
+ e?.stopPropagation();
42
+ } else return e;
43
+ };
44
+
45
+ useEffect(() => {
46
+ if (!isOpen) setHeight(0);
47
+ else setHeight();
48
+ }, [isOpen, children]);
49
+
50
+ return (
51
+ <div
52
+ {...datasetProp}
53
+ data-testid={testId}
54
+ className={cn(RC, className, {
55
+ [`${RC}_is-open`]: isOpen,
56
+ [`${RC}_disabled`]: disabled,
57
+ })}
58
+ >
59
+ <div
60
+ className={`${RC}__head`}
61
+ onClick={handleClick}
62
+ >
63
+ <div ref={titleRef} className={`${RC}__tile-container`}>
64
+ {titleJSX}
65
+ </div>
66
+ <span className={`${RC}__icon-container`}>{icon}</span>
67
+ </div>
68
+
69
+ <div
70
+ ref={containerRef}
71
+ style={{ maxHeight }}
72
+ className={cn(`${RC}__container`)}
73
+ >
74
+ <div className={`${RC}__content-wrapper`}>{children}</div>
75
+ </div>
76
+ </div>
77
+ );
78
+ };
79
+
80
+ export default MonoAccordion;