@e1011/es-kit 1.1.24 → 1.1.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/dist/hooks/esm/index.css +310 -305
  2. package/dist/hooks/esm/node_modules/gsap/CSSPlugin.js +11 -0
  3. package/dist/hooks/esm/node_modules/gsap/CSSPlugin.js.map +1 -0
  4. package/dist/hooks/esm/node_modules/gsap/gsap-core.js +11 -0
  5. package/dist/hooks/esm/node_modules/gsap/gsap-core.js.map +1 -0
  6. package/dist/hooks/esm/node_modules/gsap/index.js +2 -0
  7. package/dist/hooks/esm/node_modules/gsap/index.js.map +1 -0
  8. package/dist/hooks/esm/src/core/hooks/index.js +1 -1
  9. package/dist/hooks/esm/src/core/hooks/useAnimation.js +2 -0
  10. package/dist/hooks/esm/src/core/hooks/useAnimation.js.map +1 -0
  11. package/dist/hooks/esm/src/core/hooks/useClassNames.js.map +1 -1
  12. package/dist/hooks/esm/src/core/hooks/useIntersectionObserver.js +2 -0
  13. package/dist/hooks/esm/src/core/hooks/useIntersectionObserver.js.map +1 -0
  14. package/dist/hooks/esm/src/core/hooks/useOutsideClick.js.map +1 -1
  15. package/dist/hooks/esm/src/core/hooks/useParseProps.js.map +1 -1
  16. package/dist/hooks/esm/src/core/hooks/useResize.js.map +1 -1
  17. package/dist/hooks/esm/src/core/hooks/useThemePreference.js +1 -1
  18. package/dist/hooks/esm/src/core/hooks/useThemePreference.js.map +1 -1
  19. package/dist/hooks/esm/src/core/hooks/useToggle.js.map +1 -1
  20. package/dist/hooks/index.css +310 -305
  21. package/dist/hooks/node_modules/gsap/CSSPlugin.js +11 -0
  22. package/dist/hooks/node_modules/gsap/CSSPlugin.js.map +1 -0
  23. package/dist/hooks/node_modules/gsap/gsap-core.js +11 -0
  24. package/dist/hooks/node_modules/gsap/gsap-core.js.map +1 -0
  25. package/dist/hooks/node_modules/gsap/index.js +2 -0
  26. package/dist/hooks/node_modules/gsap/index.js.map +1 -0
  27. package/dist/hooks/src/core/hooks/index.js +1 -1
  28. package/dist/hooks/src/core/hooks/useAnimation.js +2 -0
  29. package/dist/hooks/src/core/hooks/useAnimation.js.map +1 -0
  30. package/dist/hooks/src/core/hooks/useClassNames.js.map +1 -1
  31. package/dist/hooks/src/core/hooks/useIntersectionObserver.js +2 -0
  32. package/dist/hooks/src/core/hooks/useIntersectionObserver.js.map +1 -0
  33. package/dist/hooks/src/core/hooks/useOutsideClick.js.map +1 -1
  34. package/dist/hooks/src/core/hooks/useParseProps.js.map +1 -1
  35. package/dist/hooks/src/core/hooks/useResize.js.map +1 -1
  36. package/dist/hooks/src/core/hooks/useThemePreference.js +1 -1
  37. package/dist/hooks/src/core/hooks/useThemePreference.js.map +1 -1
  38. package/dist/hooks/src/core/hooks/useToggle.js.map +1 -1
  39. package/dist/lib/cjs/index.css +5 -0
  40. package/dist/lib/cjs/node_modules/gsap/CSSPlugin.js +11 -0
  41. package/dist/lib/cjs/node_modules/gsap/CSSPlugin.js.map +1 -0
  42. package/dist/lib/cjs/node_modules/gsap/gsap-core.js +11 -0
  43. package/dist/lib/cjs/node_modules/gsap/gsap-core.js.map +1 -0
  44. package/dist/lib/cjs/node_modules/gsap/index.js +2 -0
  45. package/dist/lib/cjs/node_modules/gsap/index.js.map +1 -0
  46. package/dist/lib/cjs/src/core/hooks/useAnimation.js +2 -0
  47. package/dist/lib/cjs/src/core/hooks/useAnimation.js.map +1 -0
  48. package/dist/lib/cjs/src/core/hooks/useClassNames.js.map +1 -1
  49. package/dist/lib/cjs/src/core/hooks/useIntersectionObserver.js +2 -0
  50. package/dist/lib/cjs/src/core/hooks/useIntersectionObserver.js.map +1 -0
  51. package/dist/lib/cjs/src/core/hooks/useOutsideClick.js.map +1 -1
  52. package/dist/lib/cjs/src/core/hooks/useParseProps.js.map +1 -1
  53. package/dist/lib/cjs/src/core/hooks/useResize.js.map +1 -1
  54. package/dist/lib/cjs/src/core/hooks/useThemePreference.js +1 -1
  55. package/dist/lib/cjs/src/core/hooks/useThemePreference.js.map +1 -1
  56. package/dist/lib/cjs/src/core/hooks/useToggle.js.map +1 -1
  57. package/dist/lib/cjs/src/core/ui/components/atoms/icons.js.map +1 -1
  58. package/dist/lib/cjs/src/core/ui/components/atoms/text/Headline.js.map +1 -1
  59. package/dist/lib/cjs/src/core/ui/components/atoms/text/Link.js.map +1 -1
  60. package/dist/lib/cjs/src/core/ui/components/atoms/text/Paragraph.js.map +1 -1
  61. package/dist/lib/cjs/src/core/ui/components/atoms/text/Text.js.map +1 -1
  62. package/dist/lib/cjs/src/core/ui/components/atoms/textAndContent/TextAndContent.js +2 -0
  63. package/dist/lib/cjs/src/core/ui/components/atoms/textAndContent/TextAndContent.js.map +1 -0
  64. package/dist/lib/cjs/src/core/ui/components/atoms/textAndContent/textAndContent.module.scss.js +2 -0
  65. package/dist/lib/cjs/src/core/ui/components/atoms/textAndContent/textAndContent.module.scss.js.map +1 -0
  66. package/dist/lib/cjs/src/core/ui/components/container/layoutBox/LayoutBox.js.map +1 -1
  67. package/dist/lib/cjs/src/core/ui/components/error/propsValidationError.js +2 -0
  68. package/dist/lib/cjs/src/core/ui/components/error/propsValidationError.js.map +1 -0
  69. package/dist/lib/cjs/src/core/ui/components/icon/IconBase.js.map +1 -1
  70. package/dist/lib/cjs/src/core/ui/components/icon/IconWC.js.map +1 -1
  71. package/dist/lib/cjs/src/core/ui/components/molecules/popup/Popup.js.map +1 -1
  72. package/dist/lib/cjs/src/core/utils/appState/peregrineMQ/peregrineMQ.js.map +1 -1
  73. package/dist/lib/cjs/src/core/utils/appState/store/store.vanillajs.js.map +1 -1
  74. package/dist/lib/cjs/src/index.js +1 -1
  75. package/dist/lib/esm/index.css +5 -0
  76. package/dist/lib/esm/node_modules/gsap/CSSPlugin.js +11 -0
  77. package/dist/lib/esm/node_modules/gsap/CSSPlugin.js.map +1 -0
  78. package/dist/lib/esm/node_modules/gsap/gsap-core.js +11 -0
  79. package/dist/lib/esm/node_modules/gsap/gsap-core.js.map +1 -0
  80. package/dist/lib/esm/node_modules/gsap/index.js +2 -0
  81. package/dist/lib/esm/node_modules/gsap/index.js.map +1 -0
  82. package/dist/lib/esm/src/core/hooks/useAnimation.js +2 -0
  83. package/dist/lib/esm/src/core/hooks/useAnimation.js.map +1 -0
  84. package/dist/lib/esm/src/core/hooks/useClassNames.js.map +1 -1
  85. package/dist/lib/esm/src/core/hooks/useIntersectionObserver.js +2 -0
  86. package/dist/lib/esm/src/core/hooks/useIntersectionObserver.js.map +1 -0
  87. package/dist/lib/esm/src/core/hooks/useOutsideClick.js.map +1 -1
  88. package/dist/lib/esm/src/core/hooks/useParseProps.js.map +1 -1
  89. package/dist/lib/esm/src/core/hooks/useResize.js.map +1 -1
  90. package/dist/lib/esm/src/core/hooks/useThemePreference.js +1 -1
  91. package/dist/lib/esm/src/core/hooks/useThemePreference.js.map +1 -1
  92. package/dist/lib/esm/src/core/hooks/useToggle.js.map +1 -1
  93. package/dist/lib/esm/src/core/ui/components/atoms/icons.js.map +1 -1
  94. package/dist/lib/esm/src/core/ui/components/atoms/text/Headline.js.map +1 -1
  95. package/dist/lib/esm/src/core/ui/components/atoms/text/Link.js.map +1 -1
  96. package/dist/lib/esm/src/core/ui/components/atoms/text/Paragraph.js.map +1 -1
  97. package/dist/lib/esm/src/core/ui/components/atoms/text/Text.js.map +1 -1
  98. package/dist/lib/esm/src/core/ui/components/atoms/textAndContent/TextAndContent.js +2 -0
  99. package/dist/lib/esm/src/core/ui/components/atoms/textAndContent/TextAndContent.js.map +1 -0
  100. package/dist/lib/esm/src/core/ui/components/atoms/textAndContent/textAndContent.module.scss.js +2 -0
  101. package/dist/lib/esm/src/core/ui/components/atoms/textAndContent/textAndContent.module.scss.js.map +1 -0
  102. package/dist/lib/esm/src/core/ui/components/container/layoutBox/LayoutBox.js.map +1 -1
  103. package/dist/lib/esm/src/core/ui/components/error/propsValidationError.js +2 -0
  104. package/dist/lib/esm/src/core/ui/components/error/propsValidationError.js.map +1 -0
  105. package/dist/lib/esm/src/core/ui/components/icon/IconBase.js.map +1 -1
  106. package/dist/lib/esm/src/core/ui/components/icon/IconWC.js.map +1 -1
  107. package/dist/lib/esm/src/core/ui/components/molecules/popup/Popup.js.map +1 -1
  108. package/dist/lib/esm/src/core/utils/appState/peregrineMQ/peregrineMQ.js.map +1 -1
  109. package/dist/lib/esm/src/core/utils/appState/store/store.vanillajs.js.map +1 -1
  110. package/dist/lib/esm/src/index.js +1 -1
  111. package/dist/lib/tsconfig.tsbuildinfo +1 -1
  112. package/dist/types/src/core/hooks/index.d.ts +2 -0
  113. package/dist/types/src/core/hooks/index.d.ts.map +1 -1
  114. package/dist/types/src/core/hooks/useAnimation.d.ts +23 -0
  115. package/dist/types/src/core/hooks/useAnimation.d.ts.map +1 -0
  116. package/dist/types/src/core/hooks/useClassNames.d.ts +6 -0
  117. package/dist/types/src/core/hooks/useClassNames.d.ts.map +1 -1
  118. package/dist/types/src/core/hooks/useIntersectionObserver.d.ts +28 -0
  119. package/dist/types/src/core/hooks/useIntersectionObserver.d.ts.map +1 -0
  120. package/dist/types/src/core/hooks/useOutsideClick.d.ts +14 -0
  121. package/dist/types/src/core/hooks/useOutsideClick.d.ts.map +1 -1
  122. package/dist/types/src/core/hooks/useParseProps.d.ts +5 -0
  123. package/dist/types/src/core/hooks/useParseProps.d.ts.map +1 -1
  124. package/dist/types/src/core/hooks/useResize.d.ts +23 -0
  125. package/dist/types/src/core/hooks/useResize.d.ts.map +1 -1
  126. package/dist/types/src/core/hooks/useThemePreference.d.ts +37 -1
  127. package/dist/types/src/core/hooks/useThemePreference.d.ts.map +1 -1
  128. package/dist/types/src/core/hooks/useToggle.d.ts +17 -2
  129. package/dist/types/src/core/hooks/useToggle.d.ts.map +1 -1
  130. package/dist/types/src/core/ui/components/atoms/button/button.stories.d.ts +1 -1
  131. package/dist/types/src/core/ui/components/atoms/button/button.stories.d.ts.map +1 -1
  132. package/dist/types/src/core/ui/components/atoms/icons.d.ts +5 -0
  133. package/dist/types/src/core/ui/components/atoms/icons.d.ts.map +1 -1
  134. package/dist/types/src/core/ui/components/atoms/index.d.ts +1 -0
  135. package/dist/types/src/core/ui/components/atoms/index.d.ts.map +1 -1
  136. package/dist/types/src/core/ui/components/atoms/tag/Tag.d.ts +38 -0
  137. package/dist/types/src/core/ui/components/atoms/tag/Tag.d.ts.map +1 -0
  138. package/dist/types/src/core/ui/components/atoms/tag/Tag.test.d.ts +5 -0
  139. package/dist/types/src/core/ui/components/atoms/tag/Tag.test.d.ts.map +1 -0
  140. package/dist/types/src/core/ui/components/atoms/tag/tag.stories.d.ts +6 -0
  141. package/dist/types/src/core/ui/components/atoms/tag/tag.stories.d.ts.map +1 -0
  142. package/dist/types/src/core/ui/components/atoms/text/Headline.d.ts +1 -1
  143. package/dist/types/src/core/ui/components/atoms/text/Headline.d.ts.map +1 -1
  144. package/dist/types/src/core/ui/components/atoms/text/Link.d.ts +1 -1
  145. package/dist/types/src/core/ui/components/atoms/text/Link.d.ts.map +1 -1
  146. package/dist/types/src/core/ui/components/atoms/text/Paragraph.d.ts +1 -1
  147. package/dist/types/src/core/ui/components/atoms/text/Paragraph.d.ts.map +1 -1
  148. package/dist/types/src/core/ui/components/atoms/text/Text.d.ts +2 -15
  149. package/dist/types/src/core/ui/components/atoms/text/Text.d.ts.map +1 -1
  150. package/dist/types/src/core/ui/components/atoms/text/anchor-link/anchorLink.stories.d.ts +1 -1
  151. package/dist/types/src/core/ui/components/atoms/text/anchor-link/anchorLink.stories.d.ts.map +1 -1
  152. package/dist/types/src/core/ui/components/atoms/text/anchor-link/anchorLink.types.d.ts +1 -1
  153. package/dist/types/src/core/ui/components/atoms/text/anchor-link/anchorLink.types.d.ts.map +1 -1
  154. package/dist/types/src/core/ui/components/atoms/text/text.types.d.ts +16 -0
  155. package/dist/types/src/core/ui/components/atoms/text/text.types.d.ts.map +1 -0
  156. package/dist/types/src/core/ui/components/atoms/textAndContent/TextAndContent.d.ts +17 -0
  157. package/dist/types/src/core/ui/components/atoms/textAndContent/TextAndContent.d.ts.map +1 -0
  158. package/dist/types/src/core/ui/components/atoms/textAndContent/index.d.ts +3 -0
  159. package/dist/types/src/core/ui/components/atoms/textAndContent/index.d.ts.map +1 -0
  160. package/dist/types/src/core/ui/components/atoms/textAndContent/textAndContent.stories.d.ts +8 -0
  161. package/dist/types/src/core/ui/components/atoms/textAndContent/textAndContent.stories.d.ts.map +1 -0
  162. package/dist/types/src/core/ui/components/atoms/textAndContent/textAndContent.test.d.ts +5 -0
  163. package/dist/types/src/core/ui/components/atoms/textAndContent/textAndContent.test.d.ts.map +1 -0
  164. package/dist/types/src/core/ui/components/atoms/textAndContent/textAndContent.types.d.ts +24 -0
  165. package/dist/types/src/core/ui/components/atoms/textAndContent/textAndContent.types.d.ts.map +1 -0
  166. package/dist/types/src/core/ui/components/error/errorBoundary.stories.d.ts +3 -3
  167. package/dist/types/src/core/ui/components/error/errorBoundary.stories.d.ts.map +1 -1
  168. package/dist/types/src/core/ui/components/error/propsValidationError.d.ts +4 -0
  169. package/dist/types/src/core/ui/components/error/propsValidationError.d.ts.map +1 -0
  170. package/dist/types/src/core/ui/components/molecules/popup/popup.stories.d.ts +2 -2
  171. package/dist/types/src/core/ui/components/molecules/popup/popup.stories.d.ts.map +1 -1
  172. package/dist/types/src/core/utils/appState/peregrineMQ/peregrineMQ.stories.d.ts +1 -1
  173. package/dist/types/src/core/utils/appState/peregrineMQ/peregrineMQ.stories.d.ts.map +1 -1
  174. package/dist/types/src/core/utils/appState/store/store.stories.d.ts +1 -1
  175. package/dist/types/src/core/utils/appState/store/store.stories.d.ts.map +1 -1
  176. package/dist/ui/esm/index.css +5 -0
  177. package/dist/ui/esm/src/core/hooks/useOutsideClick.js.map +1 -1
  178. package/dist/ui/esm/src/core/hooks/useParseProps.js.map +1 -1
  179. package/dist/ui/esm/src/core/hooks/useResize.js.map +1 -1
  180. package/dist/ui/esm/src/core/ui/components/atoms/icons.js.map +1 -1
  181. package/dist/ui/esm/src/core/ui/components/atoms/text/Headline.js.map +1 -1
  182. package/dist/ui/esm/src/core/ui/components/atoms/text/Link.js.map +1 -1
  183. package/dist/ui/esm/src/core/ui/components/atoms/text/Paragraph.js.map +1 -1
  184. package/dist/ui/esm/src/core/ui/components/atoms/text/Text.js.map +1 -1
  185. package/dist/ui/esm/src/core/ui/components/atoms/textAndContent/TextAndContent.js +2 -0
  186. package/dist/ui/esm/src/core/ui/components/atoms/textAndContent/TextAndContent.js.map +1 -0
  187. package/dist/ui/esm/src/core/ui/components/atoms/textAndContent/textAndContent.module.scss.js +2 -0
  188. package/dist/ui/esm/src/core/ui/components/atoms/textAndContent/textAndContent.module.scss.js.map +1 -0
  189. package/dist/ui/esm/src/core/ui/components/container/layoutBox/LayoutBox.js.map +1 -1
  190. package/dist/ui/esm/src/core/ui/components/error/propsValidationError.js +2 -0
  191. package/dist/ui/esm/src/core/ui/components/error/propsValidationError.js.map +1 -0
  192. package/dist/ui/esm/src/core/ui/components/icon/IconBase.js.map +1 -1
  193. package/dist/ui/esm/src/core/ui/components/icon/IconWC.js.map +1 -1
  194. package/dist/ui/esm/src/core/ui/components/molecules/popup/Popup.js.map +1 -1
  195. package/dist/ui/esm/src/core/ui/index.js +1 -1
  196. package/dist/ui/index.css +5 -0
  197. package/dist/ui/src/core/hooks/useOutsideClick.js.map +1 -1
  198. package/dist/ui/src/core/hooks/useParseProps.js.map +1 -1
  199. package/dist/ui/src/core/hooks/useResize.js.map +1 -1
  200. package/dist/ui/src/core/ui/components/atoms/icons.js.map +1 -1
  201. package/dist/ui/src/core/ui/components/atoms/text/Headline.js.map +1 -1
  202. package/dist/ui/src/core/ui/components/atoms/text/Link.js.map +1 -1
  203. package/dist/ui/src/core/ui/components/atoms/text/Paragraph.js.map +1 -1
  204. package/dist/ui/src/core/ui/components/atoms/text/Text.js.map +1 -1
  205. package/dist/ui/src/core/ui/components/atoms/textAndContent/TextAndContent.js +2 -0
  206. package/dist/ui/src/core/ui/components/atoms/textAndContent/TextAndContent.js.map +1 -0
  207. package/dist/ui/src/core/ui/components/atoms/textAndContent/textAndContent.module.scss.js +2 -0
  208. package/dist/ui/src/core/ui/components/atoms/textAndContent/textAndContent.module.scss.js.map +1 -0
  209. package/dist/ui/src/core/ui/components/container/layoutBox/LayoutBox.js.map +1 -1
  210. package/dist/ui/src/core/ui/components/error/propsValidationError.js +2 -0
  211. package/dist/ui/src/core/ui/components/error/propsValidationError.js.map +1 -0
  212. package/dist/ui/src/core/ui/components/icon/IconBase.js.map +1 -1
  213. package/dist/ui/src/core/ui/components/icon/IconWC.js.map +1 -1
  214. package/dist/ui/src/core/ui/components/molecules/popup/Popup.js.map +1 -1
  215. package/dist/ui/src/core/ui/index.js +1 -1
  216. package/dist/utils/esm/index.css +310 -305
  217. package/dist/utils/esm/src/core/utils/appState/peregrineMQ/peregrineMQ.js.map +1 -1
  218. package/dist/utils/esm/src/core/utils/appState/store/store.vanillajs.js.map +1 -1
  219. package/dist/utils/index.css +310 -305
  220. package/dist/utils/src/core/utils/appState/peregrineMQ/peregrineMQ.js.map +1 -1
  221. package/dist/utils/src/core/utils/appState/store/store.vanillajs.js.map +1 -1
  222. package/package.json +20 -11
@@ -0,0 +1,2 @@
1
+ import{gsap as e}from"./gsap-core.js";export{Timeline as TimelineLite,Timeline as TimelineMax,Tween as TweenLite}from"./gsap-core.js";import{CSSPlugin as i}from"./CSSPlugin.js";var r=e.registerPlugin(i)||e;r.core.Tween;export{i as CSSPlugin,r as default,r as gsap};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../node_modules/gsap/index.js"],"sourcesContent":["import { gsap, Power0, Power1, Power2, Power3, Power4, Linear, Quad, Cubic, Quart, Quint, Strong, Elastic, Back, SteppedEase, Bounce, Sine, Expo, Circ, TweenLite, TimelineLite, TimelineMax } from \"./gsap-core.js\";\nimport { CSSPlugin } from \"./CSSPlugin.js\";\nvar gsapWithCSS = gsap.registerPlugin(CSSPlugin) || gsap,\n // to protect from tree shaking\nTweenMaxWithCSS = gsapWithCSS.core.Tween;\nexport { gsapWithCSS as gsap, gsapWithCSS as default, CSSPlugin, TweenMaxWithCSS as TweenMax, TweenLite, TimelineMax, TimelineLite, Power0, Power1, Power2, Power3, Power4, Linear, Quad, Cubic, Quart, Quint, Strong, Elastic, Back, SteppedEase, Bounce, Sine, Expo, Circ };"],"names":["gsapWithCSS","gsap","registerPlugin","CSSPlugin","core","Tween"],"mappings":"iLAEG,IAACA,EAAcC,EAAKC,eAAeC,IAAcF,EAElCD,EAAYI,KAAKC","x_google_ignoreList":[0]}
@@ -0,0 +1,2 @@
1
+ import{gsap as r}from"../../../node_modules/gsap/index.js";import{useState as t,useRef as e,useEffect as o,useLayoutEffect as n}from"react";const a=a=>{let{start:s,end:d,duration:u,ease:p="expo.inOut",rounded:c}=a;const[i,l]=t(d),m=e(s);return o((()=>{m.current=i}),[i]),n((()=>{const t={val:m.current},e=r.context((()=>{r.to(t,u,{val:d,ease:p,duration:u,...c?{roundProps:"val"}:{},onUpdate(){l(t.val)}})}));return()=>e.revert()}),[u,p,d,c,s]),i};export{a as useAnimation};
2
+ //# sourceMappingURL=useAnimation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAnimation.js","sources":["../../../../../../src/core/hooks/useAnimation.ts"],"sourcesContent":["import gsap from 'gsap'\nimport { useEffect, useLayoutEffect, useRef, useState } from 'react'\n\n/**\n * Type definition for the parameters used in the `useAnimation` hook.\n * @typedef {Object} UseAnimationType\n * @property {number} start - The starting value of the animation.\n * @property {number} end - The ending value of the animation.\n * @property {number} duration - The duration of the animation in seconds.\n * @property {string} [ease='expo.inOut'] - The easing function for the animation.\n * @property {boolean} [rounded] - Flag to determine if the value should be rounded during the animation.\n */\nexport type UseAnimationType = {\n start: number\n end: number\n duration: number\n ease?: string\n rounded?: boolean\n}\n\n/**\n * Custom hook to create an animation using GSAP.\n * @param {UseAnimationType} params - The parameters for the animation.\n * @returns {number} The current value of the animation.\n */\nexport const useAnimation = ({ start, end, duration, ease = 'expo.inOut', rounded }: UseAnimationType): number => {\n const [val, setVal] = useState(end)\n\n const startValueRef = useRef(start)\n\n useEffect(() => {\n startValueRef.current = val\n }, [val])\n\n useLayoutEffect(() => {\n const valObj = { val: startValueRef.current }\n\n const gsapCtx = gsap.context(() => {\n gsap.to(valObj, duration, {\n val: end,\n ease,\n duration,\n ...(rounded ? { roundProps: 'val' } : {}),\n onUpdate () {\n setVal(valObj.val)\n },\n })\n })\n\n return (): void => gsapCtx.revert()\n }, [duration, ease, end, rounded, start])\n\n return val\n}\n"],"names":["useAnimation","_ref","start","end","duration","ease","rounded","val","setVal","useState","startValueRef","useRef","useEffect","current","useLayoutEffect","valObj","gsapCtx","gsap","context","to","roundProps","onUpdate","revert"],"mappings":"4IAyBaA,MAAAA,EAAeC,IAAsF,IAArFC,MAAEA,EAAKC,IAAEA,EAAGC,SAAEA,EAAQC,KAAEA,EAAO,aAAYC,QAAEA,GAA2BL,EACnG,MAAOM,EAAKC,GAAUC,EAASN,GAEzBO,EAAgBC,EAAOT,GAwB7B,OAtBAU,GAAU,KACRF,EAAcG,QAAUN,CAAG,GAC1B,CAACA,IAEJO,GAAgB,KACd,MAAMC,EAAS,CAAER,IAAKG,EAAcG,SAE9BG,EAAUC,EAAKC,SAAQ,KAC3BD,EAAKE,GAAGJ,EAAQX,EAAU,CACxBG,IAAKJ,EACLE,OACAD,cACIE,EAAU,CAAEc,WAAY,OAAU,GACtCC,QAAAA,GACEb,EAAOO,EAAOR,IAChB,GACA,IAGJ,MAAO,IAAYS,EAAQM,QAAQ,GAClC,CAAClB,EAAUC,EAAMF,EAAKG,EAASJ,IAE3BK,CAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"useClassNames.js","sources":["../../../../../../src/core/hooks/useClassNames.ts"],"sourcesContent":["import { useMemo } from 'react'\n\nimport { classNames, TClassName } from '../utils/helpers/ui'\n\nexport const useClassNames = (\n classes: TClassName[],\n deps: unknown[],\n// eslint-disable-next-line react-hooks/exhaustive-deps\n): ReturnType<typeof classNames> => useMemo(() => classNames(...classes), [classes, deps])\n"],"names":["useClassNames","classes","deps","useMemo","classNames"],"mappings":"oFAIaA,MAAAA,EAAgBA,CAC3BC,EACAC,IAEkCC,GAAQ,IAAMC,KAAcH,IAAU,CAACA,EAASC"}
1
+ {"version":3,"file":"useClassNames.js","sources":["../../../../../../src/core/hooks/useClassNames.ts"],"sourcesContent":["import { useMemo } from 'react'\n\nimport { classNames, TClassName } from '../utils/helpers/ui'\n\n\n/**\n * Custom hook to memoize class names.\n * @param {TClassName[]} classes - Array of class names or conditions to be applied.\n * @param {unknown[]} deps - Dependencies array for the `useMemo` hook.\n * @returns {ReturnType<typeof classNames>} The computed class names as a string.\n */\nexport const useClassNames = (\n classes: TClassName[],\n deps: unknown[],\n// eslint-disable-next-line react-hooks/exhaustive-deps\n): ReturnType<typeof classNames> => useMemo(() => classNames(...classes), [classes, deps])\n"],"names":["useClassNames","classes","deps","useMemo","classNames"],"mappings":"oFAWaA,MAAAA,EAAgBA,CAC3BC,EACAC,IAEkCC,GAAQ,IAAMC,KAAcH,IAAU,CAACA,EAASC"}
@@ -0,0 +1,2 @@
1
+ import{useRef as n,useCallback as r,useEffect as t}from"react";const e={root:null,rootMargin:"0px",threshold:.5},c=c=>{let{callback:o,notIntersectingCallback:s,options:i={},granular:l}=c;const u=n(null),a=n(),g=r((n=>{!function(n,r,t){arguments.length>3&&void 0!==arguments[3]&&arguments[3]?n.forEach((n=>{n.isIntersecting?r():t?.()})):n[0].isIntersecting?r():t?.()}(n,o,s,l)}),[o,l,s]);return t((()=>{a.current?.disconnect();const n=u.current;return a.current=new IntersectionObserver(g,{...e,...i}),n&&a.current.observe(n),()=>{a.current?.disconnect()}}),[g,i]),u};export{c as useIntersectionObserver};
2
+ //# sourceMappingURL=useIntersectionObserver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIntersectionObserver.js","sources":["../../../../../../src/core/hooks/useIntersectionObserver.ts"],"sourcesContent":["import { MutableRefObject, useCallback, useEffect, useRef } from 'react'\n\nconst defaultOptions = {\n root: null,\n rootMargin: '0px',\n threshold: 0.5,\n}\n\n/**\n * Type definition for the parameters used in the `useIntersectionObserver` hook.\n * @typedef {Object} UseIntersectionObserverType\n * @property {() => void} callback - Function to be called when the element intersects.\n * @property {() => void} [notIntersectingCallback] - Optional function to be called\n * when the element is not intersecting.\n * @property {Partial<{ root: HTMLElement | null; rootMargin: string; threshold: number }>} [options] -\n * Optional IntersectionObserver options.\n * @property {boolean} [granular] - Flag to determine if each entry should be checked individually.\n */\nexport type UseIntersectionObserverType = {\n callback: () => void\n notIntersectingCallback?: () => void\n options?: Partial<{\n root: HTMLElement | null\n rootMargin: string\n threshold: number\n }>\n granular?: boolean\n}\n\n/**\n * Default handler for intersection changes.\n * @param {IntersectionObserverEntry[]} entries - Array of intersection observer entries.\n * @param {() => void} callback - Function to be called when the element intersects.\n * @param {() => void} [notIntersectingCallback] - Optional function to be called when the element is not intersecting.\n * @param {boolean} [granular=false] - Flag to determine if each entry should be checked individually.\n */\nconst defaultIntersectionHandler = (\n entries: IntersectionObserverEntry[],\n callback: UseIntersectionObserverType['callback'],\n notIntersectingCallback: UseIntersectionObserverType['notIntersectingCallback'],\n granular = false,\n): void => {\n if (granular) {\n entries.forEach((entry) => {\n if (entry.isIntersecting) {\n callback()\n } else {\n notIntersectingCallback?.()\n }\n })\n } else {\n // eslint-disable-next-line no-lonely-if\n if (entries[0].isIntersecting) {\n callback()\n } else {\n notIntersectingCallback?.()\n }\n }\n}\n\n/**\n * Custom hook to observe the intersection of an element.\n * @param {UseIntersectionObserverType} params - The parameters for the intersection observer.\n * @returns {MutableRefObject<T | null>} Ref object for the observed element.\n */\nexport const useIntersectionObserver = <T extends Element = Element>({\n callback, notIntersectingCallback, options = {}, granular,\n}: UseIntersectionObserverType): MutableRefObject<T | null> => {\n const elementRef = useRef<T | null>(null)\n\n const observerRef = useRef<IntersectionObserver>()\n\n // entries: IntersectionObserverEntry[], observer: IntersectionObserver)\n const intersectionHandler = useCallback((entries: IntersectionObserverEntry[]) => {\n defaultIntersectionHandler(entries, callback, notIntersectingCallback, granular)\n }, [callback, granular, notIntersectingCallback])\n\n useEffect(() => {\n observerRef.current?.disconnect()\n\n const observeElement = elementRef.current\n\n observerRef.current = new IntersectionObserver(intersectionHandler, { ...defaultOptions, ...options })\n\n if (observeElement) {\n observerRef.current.observe(observeElement)\n }\n\n return (): void => {\n observerRef.current?.disconnect()\n }\n }, [intersectionHandler, options])\n\n return elementRef\n}\n"],"names":["defaultOptions","root","rootMargin","threshold","useIntersectionObserver","_ref","callback","notIntersectingCallback","options","granular","elementRef","useRef","observerRef","intersectionHandler","useCallback","entries","arguments","length","undefined","forEach","entry","isIntersecting","defaultIntersectionHandler","useEffect","current","disconnect","observeElement","IntersectionObserver","observe"],"mappings":"+DAEA,MAAMA,EAAiB,CACrBC,KAAM,KACNC,WAAY,MACZC,UAAW,IA4DAC,EAA0BC,IAEwB,IAFMC,SACnEA,EAAQC,wBAAEA,EAAuBC,QAAEA,EAAU,CAAE,EAAAC,SAAEA,GACrBJ,EAC5B,MAAMK,EAAaC,EAAiB,MAE9BC,EAAcD,IAGdE,EAAsBC,GAAaC,KArCR,SACjCA,EACAT,EACAC,GACQS,UAAAC,OAAA,QAAAC,IAAAF,UAAA,IAAAA,UAAA,GAGND,EAAQI,SAASC,IACXA,EAAMC,eACRf,IAEAC,KACF,IAIEQ,EAAQ,GAAGM,eACbf,IAEAC,KAGN,CAgBIe,CAA2BP,EAAST,EAAUC,EAAyBE,EAAS,GAC/E,CAACH,EAAUG,EAAUF,IAkBxB,OAhBAgB,GAAU,KACRX,EAAYY,SAASC,aAErB,MAAMC,EAAiBhB,EAAWc,QAQlC,OANAZ,EAAYY,QAAU,IAAIG,qBAAqBd,EAAqB,IAAKb,KAAmBQ,IAExFkB,GACFd,EAAYY,QAAQI,QAAQF,GAGvB,KACLd,EAAYY,SAASC,YAAY,CAClC,GACA,CAACZ,EAAqBL,IAElBE,CAAU"}
@@ -1 +1 @@
1
- {"version":3,"file":"useOutsideClick.js","sources":["../../../../../../src/core/hooks/useOutsideClick.ts"],"sourcesContent":["import { useEffect, useCallback } from 'react'\n\nimport { EventName } from '../constants/ui.constants'\nimport { handleClickOutside as defaultHandleClickOutside } from '../ui/utils/clickOutside'\n\ntype Element = HTMLElement | null | (() => HTMLElement)\ntype CallbackFunction = (target: HTMLElement | null) => void\n\nexport function useOutsideClick(\n element: Element,\n callback?: CallbackFunction,\n handleClickOutside = defaultHandleClickOutside(element, callback),\n): () => void {\n const unsubscriber = useCallback(\n () => document.removeEventListener(EventName.Click, handleClickOutside), [handleClickOutside],\n )\n\n useEffect(() => {\n unsubscriber()\n document.addEventListener(EventName.Click, handleClickOutside)\n\n return unsubscriber\n }, [element, handleClickOutside, unsubscriber])\n\n return unsubscriber\n}\n\nexport function outsideClickHandler(\n element: Element,\n callback?: CallbackFunction,\n handleClickOutside = defaultHandleClickOutside(element, callback),\n): () => void {\n const unsubscriber = (): void => document.removeEventListener(EventName.Click, handleClickOutside)\n\n document.addEventListener(EventName.Click, handleClickOutside)\n\n return unsubscriber\n}\n"],"names":["useOutsideClick","element","callback","handleClickOutside","arguments","length","undefined","defaultHandleClickOutside","unsubscriber","useCallback","document","removeEventListener","EventName","Click","useEffect","addEventListener","outsideClickHandler"],"mappings":"6KAQO,SAASA,EACdC,EACAC,GAEY,IADZC,EAAkBC,UAAAC,eAAAC,IAAAF,UAAA,GAAAA,UAAGG,GAAAA,EAA0BN,EAASC,GAExD,MAAMM,EAAeC,GACnB,IAAMC,SAASC,oBAAoBC,EAAUC,MAAOV,IAAqB,CAACA,IAU5E,OAPAW,GAAU,KACRN,IACAE,SAASK,iBAAiBH,EAAUC,MAAOV,GAEpCK,IACN,CAACP,EAASE,EAAoBK,IAE1BA,CACT,CAEO,SAASQ,EACdf,EACAC,GAEY,IADZC,EAAkBC,UAAAC,eAAAC,IAAAF,UAAA,GAAAA,UAAGG,GAAAA,EAA0BN,EAASC,GAMxD,OAFAQ,SAASK,iBAAiBH,EAAUC,MAAOV,GAFtBK,IAAYE,SAASC,oBAAoBC,EAAUC,MAAOV,EAKjF"}
1
+ {"version":3,"file":"useOutsideClick.js","sources":["../../../../../../src/core/hooks/useOutsideClick.ts"],"sourcesContent":["import { useEffect, useCallback } from 'react'\n\nimport { EventName } from '../constants/ui.constants'\nimport { handleClickOutside as defaultHandleClickOutside } from '../ui/utils/clickOutside'\n\ntype Element = HTMLElement | null | (() => HTMLElement)\ntype CallbackFunction = (target: HTMLElement | null) => void\n\n/**\n * Custom hook to handle clicks outside a specified element.\n * @param {Element} element - The element to detect outside clicks for.\n * @param {CallbackFunction} [callback] - Optional callback function to execute when an outside click is detected.\n * @param {Function} [handleClickOutside=defaultHandleClickOutside] - Optional custom function to handle outside clicks.\n * @returns {() => void} Function to unsubscribe the event listener.\n */\nexport function useOutsideClick(\n element: Element,\n callback?: CallbackFunction,\n handleClickOutside = defaultHandleClickOutside(element, callback),\n): () => void {\n const unsubscriber = useCallback(\n () => document.removeEventListener(EventName.Click, handleClickOutside), [handleClickOutside],\n )\n\n useEffect(() => {\n unsubscriber()\n document.addEventListener(EventName.Click, handleClickOutside)\n\n return unsubscriber\n }, [element, handleClickOutside, unsubscriber])\n\n return unsubscriber\n}\n\n/**\n * Function to handle clicks outside a specified element.\n * @param {Element} element - The element to detect outside clicks for.\n * @param {CallbackFunction} [callback] - Optional callback function to execute when an outside click is detected.\n * @param {Function} [handleClickOutside=defaultHandleClickOutside] - Optional custom function to handle outside clicks.\n * @returns {() => void} Function to unsubscribe the event listener.\n */\nexport function outsideClickHandler(\n element: Element,\n callback?: CallbackFunction,\n handleClickOutside = defaultHandleClickOutside(element, callback),\n): () => void {\n const unsubscriber = (): void => document.removeEventListener(EventName.Click, handleClickOutside)\n\n document.addEventListener(EventName.Click, handleClickOutside)\n\n return unsubscriber\n}\n"],"names":["useOutsideClick","element","callback","handleClickOutside","arguments","length","undefined","defaultHandleClickOutside","unsubscriber","useCallback","document","removeEventListener","EventName","Click","useEffect","addEventListener","outsideClickHandler"],"mappings":"6KAeO,SAASA,EACdC,EACAC,GAEY,IADZC,EAAkBC,UAAAC,eAAAC,IAAAF,UAAA,GAAAA,UAAGG,GAAAA,EAA0BN,EAASC,GAExD,MAAMM,EAAeC,GACnB,IAAMC,SAASC,oBAAoBC,EAAUC,MAAOV,IAAqB,CAACA,IAU5E,OAPAW,GAAU,KACRN,IACAE,SAASK,iBAAiBH,EAAUC,MAAOV,GAEpCK,IACN,CAACP,EAASE,EAAoBK,IAE1BA,CACT,CASO,SAASQ,EACdf,EACAC,GAEY,IADZC,EAAkBC,UAAAC,eAAAC,IAAAF,UAAA,GAAAA,UAAGG,GAAAA,EAA0BN,EAASC,GAMxD,OAFAQ,SAASK,iBAAiBH,EAAUC,MAAOV,GAFtBK,IAAYE,SAASC,oBAAoBC,EAAUC,MAAOV,EAKjF"}
@@ -1 +1 @@
1
- {"version":3,"file":"useParseProps.js","sources":["../../../../../../src/core/hooks/useParseProps.ts"],"sourcesContent":["import { useMemo } from 'react'\n\nimport { parseProps } from '../utils/helpers/ui'\n\n\nexport const useParseProps = (props: Record<string, unknown>): ReturnType<typeof parseProps> => {\n const propsCategories = useMemo(() => parseProps(props), [props])\n\n return propsCategories\n}\n"],"names":["useParseProps","props","useMemo","parseProps"],"mappings":"oFAKaA,MAAAA,EAAiBC,GACJC,GAAQ,IAAMC,EAAWF,IAAQ,CAACA"}
1
+ {"version":3,"file":"useParseProps.js","sources":["../../../../../../src/core/hooks/useParseProps.ts"],"sourcesContent":["import { useMemo } from 'react'\n\nimport { parseProps } from '../utils/helpers/ui'\n\n/**\n * Custom hook to parse properties using the `parseProps` utility function.\n * @param {Record<string, unknown>} props - The properties to be parsed.\n * @returns {ReturnType<typeof parseProps>} The parsed properties categorized by the `parseProps` function.\n */\nexport const useParseProps = (props: Record<string, unknown>): ReturnType<typeof parseProps> => {\n const propsCategories = useMemo(() => parseProps(props), [props])\n\n return propsCategories\n}\n"],"names":["useParseProps","props","useMemo","parseProps"],"mappings":"oFASaA,MAAAA,EAAiBC,GACJC,GAAQ,IAAMC,EAAWF,IAAQ,CAACA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useResize.js","sources":["../../../../../../src/core/hooks/useResize.ts"],"sourcesContent":["import { MutableRefObject, useLayoutEffect, useMemo, useState, useRef } from 'react'\nimport debounce from 'lodash-es/debounce'\n\nexport type WrapperSize = {width: undefined | number; height: undefined | number}\n\n\ntype Unobserver = () => (null | void)\n\nexport type UseResizeCallBack = (wrapperSize: WrapperSize) => void\n\n// eslint-disable-next-line default-param-last\nexport const useResize = (debounceDelay = 250, callBack?: UseResizeCallBack): [\n MutableRefObject<HTMLElement | null | undefined>, WrapperSize, Unobserver | undefined] => {\n const [containerSize, setContainerSize]\n = useState<WrapperSize>({ width: undefined, height: undefined })\n\n const lastResizeWidthRef = useRef<WrapperSize>({ width: 0, height: 0 })\n const containerRef: MutableRefObject<HTMLElement | undefined | null> = useRef<HTMLElement | undefined | null>()\n const unobserverRef = useRef<Unobserver>()\n\n const debouncedResizeWrapper = useMemo(() => debounce((entries) => {\n const newResizeWidth = entries[0].contentRect.width\n const newResizeHeight = entries[0].contentRect.height\n\n if (lastResizeWidthRef.current?.width === newResizeWidth\n && lastResizeWidthRef.current?.height === newResizeHeight) {\n return\n }\n lastResizeWidthRef.current = { width: newResizeWidth, height: newResizeHeight }\n\n // eslint-disable-next-line semi-style\n ;(callBack || setContainerSize)({\n width: containerRef?.current?.clientWidth,\n height: containerRef?.current?.clientHeight,\n })\n }, debounceDelay), [callBack, debounceDelay])\n\n useLayoutEffect(() => {\n let resizeObserver: ResizeObserver\n let containerElement: HTMLElement\n\n if (containerRef?.current) {\n containerElement = containerRef?.current\n resizeObserver = new ResizeObserver(debouncedResizeWrapper)\n resizeObserver.observe(containerElement as Element)\n\n // eslint-disable-next-line semi-style\n ;(callBack || setContainerSize)({\n width: containerRef?.current?.clientWidth,\n height: containerRef?.current?.clientHeight,\n })\n }\n\n const unobserver = (): void => {\n resizeObserver?.unobserve?.(containerElement as Element)\n }\n\n // setUnobserver(unobserver)\n unobserverRef.current = unobserver\n\n return unobserver\n }, [debouncedResizeWrapper, containerRef, callBack])\n\n return [containerRef, containerSize, unobserverRef.current]\n}\n"],"names":["useResize","debounceDelay","arguments","length","undefined","callBack","containerSize","setContainerSize","useState","width","height","lastResizeWidthRef","useRef","containerRef","unobserverRef","debouncedResizeWrapper","useMemo","debounce","entries","newResizeWidth","contentRect","newResizeHeight","current","clientWidth","clientHeight","useLayoutEffect","resizeObserver","containerElement","ResizeObserver","observe","unobserver","unobserve"],"mappings":"0IAWaA,MAAAA,EAAY,WACmE,IADlEC,EAAaC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,IAAKG,EAA4BH,UAAAC,OAAAD,EAAAA,kBAAAE,EAEzE,MAAOE,EAAeC,GAClBC,EAAsB,CAAEC,WAAOL,EAAWM,YAAQN,IAEhDO,EAAqBC,EAAoB,CAAEH,MAAO,EAAGC,OAAQ,IAC7DG,EAAiED,IACjEE,EAAgBF,IAEhBG,EAAyBC,GAAQ,IAAMC,GAAUC,IACrD,MAAMC,EAAiBD,EAAQ,GAAGE,YAAYX,MACxCY,EAAkBH,EAAQ,GAAGE,YAAYV,OAE3CC,EAAmBW,SAASb,QAAUU,GACrCR,EAAmBW,SAASZ,SAAWW,IAG5CV,EAAmBW,QAAU,CAAEb,MAAOU,EAAgBT,OAAQW,IAG5DhB,GAAYE,GAAkB,CAC9BE,MAAOI,GAAcS,SAASC,YAC9Bb,OAAQG,GAAcS,SAASE,eAC/B,GACDvB,IAAgB,CAACI,EAAUJ,IA4B9B,OA1BAwB,GAAgB,KACd,IAAIC,EACAC,EAEAd,GAAcS,UAChBK,EAAmBd,GAAcS,QACjCI,EAAiB,IAAIE,eAAeb,GACpCW,EAAeG,QAAQF,IAGrBtB,GAAYE,GAAkB,CAC9BE,MAAOI,GAAcS,SAASC,YAC9Bb,OAAQG,GAAcS,SAASE,gBAInC,MAAMM,EAAaA,KACjBJ,GAAgBK,YAAYJ,EAA4B,EAM1D,OAFAb,EAAcQ,QAAUQ,EAEjBA,CAAU,GAChB,CAACf,EAAwBF,EAAcR,IAEnC,CAACQ,EAAcP,EAAeQ,EAAcQ,QACrD"}
1
+ {"version":3,"file":"useResize.js","sources":["../../../../../../src/core/hooks/useResize.ts"],"sourcesContent":["import { MutableRefObject, useLayoutEffect, useMemo, useState, useRef } from 'react'\nimport debounce from 'lodash-es/debounce'\n\n/**\n * Type definition for the size of the wrapper element.\n * @typedef {Object} WrapperSize\n * @property {undefined | number} width - The width of the wrapper element.\n * @property {undefined | number} height - The height of the wrapper element.\n */\nexport type WrapperSize = { width: undefined | number; height: undefined | number }\n\n/**\n * Type definition for the unobserver function.\n * @typedef {() => (null | void)} Unobserver\n */\ntype Unobserver = () => (null | void)\n\n/**\n * Type definition for the resize callback function.\n * @typedef {(wrapperSize: WrapperSize) => void} UseResizeCallBack\n */\nexport type UseResizeCallBack = (wrapperSize: WrapperSize) => void\n\n/**\n * Custom hook to observe the resize event of an HTML element\n * and execute a callback or update the state with the new size.\n * @param {number} [debounceDelay=250] - The delay in milliseconds for debouncing the resize event.\n * @param {UseResizeCallBack} [callBack] - Optional callback function to execute when the element is resized.\n * @returns {[MutableRefObject<HTMLElement | null | undefined>, WrapperSize, Unobserver | undefined]}\n * An array containing the ref object for the container element,\n * the current size of the container, and an unobserver function.\n */\n// eslint-disable-next-line default-param-last\nexport const useResize = (debounceDelay = 250, callBack?: UseResizeCallBack): [\n MutableRefObject<HTMLElement | null | undefined>, WrapperSize, Unobserver | undefined] => {\n const [containerSize, setContainerSize] = useState<WrapperSize>({ width: undefined, height: undefined })\n\n const lastResizeWidthRef = useRef<WrapperSize>({ width: 0, height: 0 })\n const containerRef: MutableRefObject<HTMLElement | undefined | null> = useRef<HTMLElement | undefined | null>()\n const unobserverRef = useRef<Unobserver>()\n\n const debouncedResizeWrapper = useMemo(() => debounce((entries) => {\n const newResizeWidth = entries[0].contentRect.width\n const newResizeHeight = entries[0].contentRect.height\n\n if (lastResizeWidthRef.current?.width === newResizeWidth\n && lastResizeWidthRef.current?.height === newResizeHeight) {\n return\n }\n lastResizeWidthRef.current = { width: newResizeWidth, height: newResizeHeight }\n\n // eslint-disable-next-line semi-style\n ;(callBack || setContainerSize)({\n width: containerRef?.current?.clientWidth,\n height: containerRef?.current?.clientHeight,\n })\n }, debounceDelay), [callBack, debounceDelay])\n\n useLayoutEffect(() => {\n let resizeObserver: ResizeObserver\n let containerElement: HTMLElement\n\n if (containerRef?.current) {\n containerElement = containerRef?.current\n resizeObserver = new ResizeObserver(debouncedResizeWrapper)\n resizeObserver.observe(containerElement as Element)\n\n // eslint-disable-next-line semi-style\n ;(callBack || setContainerSize)({\n width: containerRef?.current?.clientWidth,\n height: containerRef?.current?.clientHeight,\n })\n }\n\n const unobserver = (): void => {\n resizeObserver?.unobserve?.(containerElement as Element)\n }\n\n // setUnobserver(unobserver)\n unobserverRef.current = unobserver\n\n return unobserver\n }, [debouncedResizeWrapper, containerRef, callBack])\n\n return [containerRef, containerSize, unobserverRef.current]\n}\n"],"names":["useResize","debounceDelay","arguments","length","undefined","callBack","containerSize","setContainerSize","useState","width","height","lastResizeWidthRef","useRef","containerRef","unobserverRef","debouncedResizeWrapper","useMemo","debounce","entries","newResizeWidth","contentRect","newResizeHeight","current","clientWidth","clientHeight","useLayoutEffect","resizeObserver","containerElement","ResizeObserver","observe","unobserver","unobserve"],"mappings":"0IAiCaA,MAAAA,EAAY,WACmE,IADlEC,EAAaC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,IAAKG,EAA4BH,UAAAC,OAAAD,EAAAA,kBAAAE,EAEzE,MAAOE,EAAeC,GAAoBC,EAAsB,CAAEC,WAAOL,EAAWM,YAAQN,IAEtFO,EAAqBC,EAAoB,CAAEH,MAAO,EAAGC,OAAQ,IAC7DG,EAAiED,IACjEE,EAAgBF,IAEhBG,EAAyBC,GAAQ,IAAMC,GAAUC,IACrD,MAAMC,EAAiBD,EAAQ,GAAGE,YAAYX,MACxCY,EAAkBH,EAAQ,GAAGE,YAAYV,OAE3CC,EAAmBW,SAASb,QAAUU,GACrCR,EAAmBW,SAASZ,SAAWW,IAG5CV,EAAmBW,QAAU,CAAEb,MAAOU,EAAgBT,OAAQW,IAG5DhB,GAAYE,GAAkB,CAC9BE,MAAOI,GAAcS,SAASC,YAC9Bb,OAAQG,GAAcS,SAASE,eAC/B,GACDvB,IAAgB,CAACI,EAAUJ,IA4B9B,OA1BAwB,GAAgB,KACd,IAAIC,EACAC,EAEAd,GAAcS,UAChBK,EAAmBd,GAAcS,QACjCI,EAAiB,IAAIE,eAAeb,GACpCW,EAAeG,QAAQF,IAGrBtB,GAAYE,GAAkB,CAC9BE,MAAOI,GAAcS,SAASC,YAC9Bb,OAAQG,GAAcS,SAASE,gBAInC,MAAMM,EAAaA,KACjBJ,GAAgBK,YAAYJ,EAA4B,EAM1D,OAFAb,EAAcQ,QAAUQ,EAEjBA,CAAU,GAChB,CAACf,EAAwBF,EAAcR,IAEnC,CAACQ,EAAcP,EAAeQ,EAAcQ,QACrD"}
@@ -1,2 +1,2 @@
1
- import{useEffect as e}from"react";const o="change",t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;const s=o=>{const s=e();a?.(o,s),t?.(o)},r=e=>{s(e.matches)},c=e=>{s(!e.matches)},d=window.matchMedia("(prefers-color-scheme: dark)");try{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(o,r),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(o,c)}catch(e){}return s(d?.matches),window.matchMedia("(prefers-color-scheme: dark)").addEventListener(o,r),window.matchMedia("(prefers-color-scheme: light)").addEventListener(o,c),()=>{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(o,r),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(o,c)}},s=function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;e((()=>t(o,s)),[o,s])};let r={dark:"theme-dark",light:"theme-light"};const c=()=>r,d=e=>{r=e},a=function(e,o){let t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=e?r.light:r.dark,c=e?r.dark:r.light;o&&(o.classList.remove(s),o.classList.remove(c),o.classList.add(c)),"undefined"!=typeof document&&(document.querySelectorAll(`.${s}`).forEach((e=>{e.classList.add(`.${c}`),e.classList.remove(`.${s}`)})),t&&(document.querySelectorAll(".shadow-div").forEach((e=>{e.shadowRoot?.querySelector(`.${s}`)?.classList.add(c),e.shadowRoot?.querySelector(`.${s}`)?.classList.remove(s)})),document.querySelectorAll("esmf-wrapper").forEach((e=>{e.shadowRoot?.querySelector(`.${s}`)?.classList.add(c),e.shadowRoot?.querySelector(`.${s}`)?.classList.remove(s);const o=e.shadowRoot?.childNodes[0];o&&(o.classList.add(c),o.classList.remove(s))}))))},i=(e,o)=>{let t=e||!1;"undefined"!=typeof document&&void 0===e&&(t=document.body.classList.contains(r.dark)),a(t,o||document.body)};export{c as getBaseThemes,t as observeThemePreference,d as setTHemeClassNames,a as switchColorTheme,i as updateColorTheme,s as useThemePreference};
1
+ import{useEffect as e}from"react";const o="change",t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;const s=o=>{const s=e();a?.(o,s),t?.(o)},r=e=>{s(e.matches)},c=e=>{s(!e.matches)},d=window.matchMedia("(prefers-color-scheme: dark)");try{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(o,r),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(o,c)}catch(e){}return s(d?.matches),window.matchMedia("(prefers-color-scheme: dark)").addEventListener(o,r),window.matchMedia("(prefers-color-scheme: light)").addEventListener(o,c),()=>{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(o,r),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(o,c)}},s=function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;e((()=>t(o,s)),[o,s])};let r={dark:"theme-dark",light:"theme-light"};const c=()=>r,d=e=>{r=e},a=function(e,o){let t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=e?r.light:r.dark,c=e?r.dark:r.light;o&&(o.classList.remove(s),o.classList.remove(c),o.classList.add(c)),"undefined"!=typeof document&&(document.querySelectorAll(`.${s}`).forEach((e=>{e.classList.add(`.${c}`),e.classList.remove(`.${s}`)})),t&&(document.querySelectorAll(".shadow-div").forEach((e=>{e.shadowRoot?.querySelector(`.${s}`)?.classList.add(c),e.shadowRoot?.querySelector(`.${s}`)?.classList.remove(s)})),document.querySelectorAll("esmf-wrapper").forEach((e=>{e.shadowRoot?.querySelector(`.${s}`)?.classList.add(c),e.shadowRoot?.querySelector(`.${s}`)?.classList.remove(s);const o=e.shadowRoot?.childNodes[0];o&&(o.classList.add(c),o.classList.remove(s))}))))},i=(e,o)=>{let t=e||!1;"undefined"!=typeof document&&void 0===e&&(t=document.body.classList.contains(r.dark)),a(t,o||document.body)};export{c as getBaseThemes,t as observeThemePreference,d as setThemeClassNames,a as switchColorTheme,i as updateColorTheme,s as useThemePreference};
2
2
  //# sourceMappingURL=useThemePreference.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useThemePreference.js","sources":["../../../../../../src/core/hooks/useThemePreference.ts"],"sourcesContent":["import { useEffect } from 'react'\n\n\nconst windowMatchMediaChangeEventType = 'change'\n\nexport const observeThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): () => void => {\n const switchColorThemeHandler = (isDark: boolean): void => {\n const htmlElement = getHtmlElement()\n\n switchColorTheme?.(isDark, htmlElement)\n switchCallback?.(isDark)\n }\n\n const changeDarkColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(event.matches)\n }\n\n const changeLightColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(!event.matches)\n }\n\n const isDark = window.matchMedia('(prefers-color-scheme: dark)')\n\n try {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n } catch (error) {\n console.error(`Error::observeThemePreference::removeEventListener: ${error}`)\n }\n\n switchColorThemeHandler(isDark?.matches)\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').addEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n\n return () => {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n }\n}\n\nexport const useThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): void => {\n useEffect(() => observeThemePreference(getHtmlElement, switchCallback), [getHtmlElement, switchCallback])\n}\n\ntype ThemeMap = {\n dark: string\n light: string\n}\n\nlet baseThemes: ThemeMap = {\n dark: 'theme-dark',\n light: 'theme-light',\n}\n\n\nexport const getBaseThemes = (): ThemeMap => baseThemes\n\nexport const setTHemeClassNames = (themes: ThemeMap): void => {\n baseThemes = themes\n}\n\nexport const switchColorTheme = (isDark: boolean, htmlElement?: HTMLElement, findShadows = true): void => {\n const oldClass = isDark ? baseThemes.light : baseThemes.dark\n const newClass = isDark ? baseThemes.dark : baseThemes.light\n\n if (htmlElement) {\n htmlElement.classList.remove(oldClass)\n htmlElement.classList.remove(newClass)\n htmlElement.classList.add(newClass)\n }\n\n if (typeof document !== 'undefined') {\n document.querySelectorAll(`.${oldClass}`).forEach((element) => {\n element.classList.add(`.${newClass}`)\n element.classList.remove(`.${oldClass}`)\n })\n\n if (findShadows) {\n document.querySelectorAll('.shadow-div').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n })\n\n document.querySelectorAll('esmf-wrapper').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n\n const firstChild: HTMLElement = element.shadowRoot?.childNodes[0] as HTMLElement\n\n if (firstChild) {\n firstChild.classList.add(newClass)\n firstChild.classList.remove(oldClass)\n }\n })\n }\n }\n}\n\nexport const updateColorTheme = (isDark?: boolean, htmlElement?: HTMLElement): void => {\n let resolvedIsDark: boolean = isDark || false\n\n if (typeof document !== 'undefined' && isDark === undefined) {\n resolvedIsDark = document.body.classList.contains(baseThemes.dark)\n }\n switchColorTheme(resolvedIsDark, htmlElement || document.body)\n}\n"],"names":["windowMatchMediaChangeEventType","observeThemePreference","getHtmlElement","arguments","length","undefined","document","body","switchCallback","isDark","switchColorThemeHandler","htmlElement","switchColorTheme","changeDarkColorThemeHandler","event","matches","changeLightColorThemeHandler","window","matchMedia","removeEventListener","error","addEventListener","useThemePreference","useEffect","baseThemes","dark","light","getBaseThemes","setTHemeClassNames","themes","findShadows","oldClass","newClass","classList","remove","add","querySelectorAll","forEach","element","shadowRoot","querySelector","firstChild","childNodes","updateColorTheme","resolvedIsDark","contains"],"mappings":"kCAGA,MAAMA,EAAkC,SAE3BC,EAAyB,WAGrB,IAFfC,EAAiCC,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAA,GAAG,IAAmBG,SAASC,KAChEC,EAAyCL,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAIM,GAAAA,GAA6BA,EAE1E,MAAMC,EAA2BD,IAC/B,MAAME,EAAcT,IAEpBU,IAAmBH,EAAQE,GAC3BH,IAAiBC,EAAO,EAGpBI,EAA+BC,IACnCJ,EAAwBI,EAAMC,QAAQ,EAGlCC,EAAgCF,IACpCJ,GAAyBI,EAAMC,QAAQ,EAGnCN,EAASQ,OAAOC,WAAW,gCAEjC,IACED,OAAOC,WAAW,gCAAgCC,oBAChDnB,EAAiCa,GAEnCI,OAAOC,WAAW,iCAAiCC,oBACjDnB,EAAiCgB,EAErC,CAAE,MAAOI,GAET,CAUA,OARAV,EAAwBD,GAAQM,SAChCE,OAAOC,WAAW,gCAAgCG,iBAChDrB,EAAiCa,GAEnCI,OAAOC,WAAW,iCAAiCG,iBACjDrB,EAAiCgB,GAG5B,KACLC,OAAOC,WAAW,gCAAgCC,oBAChDnB,EAAiCa,GAEnCI,OAAOC,WAAW,iCAAiCC,oBACjDnB,EAAiCgB,EAClC,CAEL,EAEaM,EAAqB,WAGvB,IAFTpB,EAAiCC,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAA,GAAG,IAAmBG,SAASC,KAChEC,EAAyCL,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAIM,GAAAA,GAA6BA,EAE1Ec,GAAU,IAAMtB,EAAuBC,EAAgBM,IAAiB,CAACN,EAAgBM,GAC3F,EAOA,IAAIgB,EAAuB,CACzBC,KAAM,aACNC,MAAO,eAIIC,MAAAA,EAAgBA,IAAgBH,EAEhCI,EAAsBC,IACjCL,EAAaK,CAAM,EAGRjB,EAAmB,SAACH,EAAiBE,GAAwD,IAA7BmB,IAAW3B,UAAAC,OAAA,QAAAC,IAAAF,UAAA,KAAAA,UAAA,GACtF,MAAM4B,EAAWtB,EAASe,EAAWE,MAAQF,EAAWC,KAClDO,EAAWvB,EAASe,EAAWC,KAAOD,EAAWE,MAEnDf,IACFA,EAAYsB,UAAUC,OAAOH,GAC7BpB,EAAYsB,UAAUC,OAAOF,GAC7BrB,EAAYsB,UAAUE,IAAIH,IAGJ,oBAAb1B,WACTA,SAAS8B,iBAAiB,IAAIL,KAAYM,SAASC,IACjDA,EAAQL,UAAUE,IAAI,IAAIH,KAC1BM,EAAQL,UAAUC,OAAO,IAAIH,IAAW,IAGtCD,IACFxB,SAAS8B,iBAAiB,eAAeC,SAASC,IAChDA,EAAQC,YAAYC,cAAc,IAAIT,MAAaE,UAAUE,IAAIH,GACjEM,EAAQC,YAAYC,cAAc,IAAIT,MAAaE,UAAUC,OAAOH,EAAS,IAG/EzB,SAAS8B,iBAAiB,gBAAgBC,SAASC,IACjDA,EAAQC,YAAYC,cAAc,IAAIT,MAAaE,UAAUE,IAAIH,GACjEM,EAAQC,YAAYC,cAAc,IAAIT,MAAaE,UAAUC,OAAOH,GAEpE,MAAMU,EAA0BH,EAAQC,YAAYG,WAAW,GAE3DD,IACFA,EAAWR,UAAUE,IAAIH,GACzBS,EAAWR,UAAUC,OAAOH,GAC9B,KAIR,EAEaY,EAAmBA,CAAClC,EAAkBE,KACjD,IAAIiC,EAA0BnC,IAAU,EAEhB,oBAAbH,eAAuCD,IAAXI,IACrCmC,EAAiBtC,SAASC,KAAK0B,UAAUY,SAASrB,EAAWC,OAE/Db,EAAiBgC,EAAgBjC,GAAeL,SAASC,KAAK"}
1
+ {"version":3,"file":"useThemePreference.js","sources":["../../../../../../src/core/hooks/useThemePreference.ts"],"sourcesContent":["import { useEffect } from 'react'\n\n\nconst windowMatchMediaChangeEventType = 'change'\n\n/**\n * Observes the user's theme preference and applies the appropriate theme.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n * @returns {() => void} Function to stop observing the theme preference.\n */\nexport const observeThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): () => void => {\n const switchColorThemeHandler = (isDark: boolean): void => {\n const htmlElement = getHtmlElement()\n\n switchColorTheme?.(isDark, htmlElement)\n switchCallback?.(isDark)\n }\n\n const changeDarkColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(event.matches)\n }\n\n const changeLightColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(!event.matches)\n }\n\n const isDark = window.matchMedia('(prefers-color-scheme: dark)')\n\n try {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n } catch (error) {\n console.error(`Error::observeThemePreference::removeEventListener: ${error}`)\n }\n\n switchColorThemeHandler(isDark?.matches)\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').addEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n\n return () => {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n }\n}\n\n/**\n * Custom hook to use theme preference in a React component.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n */\nexport const useThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): void => {\n useEffect(() => observeThemePreference(getHtmlElement, switchCallback), [getHtmlElement, switchCallback])\n}\n\n/**\n * Type definition for theme map.\n * @typedef {Object} ThemeMap\n * @property {string} dark - CSS class for the dark theme.\n * @property {string} light - CSS class for the light theme.\n */\ntype ThemeMap = {\n dark: string\n light: string\n}\n\nlet baseThemes: ThemeMap = {\n dark: 'theme-dark',\n light: 'theme-light',\n}\n\n/**\n * Gets the base themes.\n * @returns {ThemeMap} The current base themes.\n */\nexport const getBaseThemes = (): ThemeMap => baseThemes\n\n/**\n * Sets the base theme class names.\n * @param {ThemeMap} themes - Object containing the CSS classes for dark and light themes.\n */\nexport const setThemeClassNames = (themes: ThemeMap): void => {\n baseThemes = themes\n}\n\n/**\n * Switches the color theme of the document.\n * @param {boolean} isDark - Flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n * @param {boolean} [findShadows=true] - Flag to determine if shadow DOM elements should also be themed.\n */\nexport const switchColorTheme = (isDark: boolean, htmlElement?: HTMLElement, findShadows = true): void => {\n const oldClass = isDark ? baseThemes.light : baseThemes.dark\n const newClass = isDark ? baseThemes.dark : baseThemes.light\n\n if (htmlElement) {\n htmlElement.classList.remove(oldClass)\n htmlElement.classList.remove(newClass)\n htmlElement.classList.add(newClass)\n }\n\n if (typeof document !== 'undefined') {\n document.querySelectorAll(`.${oldClass}`).forEach((element) => {\n element.classList.add(`.${newClass}`)\n element.classList.remove(`.${oldClass}`)\n })\n\n if (findShadows) {\n document.querySelectorAll('.shadow-div').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n })\n\n document.querySelectorAll('esmf-wrapper').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n\n const firstChild: HTMLElement = element.shadowRoot?.childNodes[0] as HTMLElement\n\n if (firstChild) {\n firstChild.classList.add(newClass)\n firstChild.classList.remove(oldClass)\n }\n })\n }\n }\n}\n\n/**\n * Updates the color theme of the document.\n * @param {boolean} [isDark] - Optional flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n */\nexport const updateColorTheme = (isDark?: boolean, htmlElement?: HTMLElement): void => {\n let resolvedIsDark: boolean = isDark || false\n\n if (typeof document !== 'undefined' && isDark === undefined) {\n resolvedIsDark = document.body.classList.contains(baseThemes.dark)\n }\n switchColorTheme(resolvedIsDark, htmlElement || document.body)\n}\n"],"names":["windowMatchMediaChangeEventType","observeThemePreference","getHtmlElement","arguments","length","undefined","document","body","switchCallback","isDark","switchColorThemeHandler","htmlElement","switchColorTheme","changeDarkColorThemeHandler","event","matches","changeLightColorThemeHandler","window","matchMedia","removeEventListener","error","addEventListener","useThemePreference","useEffect","baseThemes","dark","light","getBaseThemes","setThemeClassNames","themes","findShadows","oldClass","newClass","classList","remove","add","querySelectorAll","forEach","element","shadowRoot","querySelector","firstChild","childNodes","updateColorTheme","resolvedIsDark","contains"],"mappings":"kCAGA,MAAMA,EAAkC,SAQ3BC,EAAyB,WAGrB,IAFfC,EAAiCC,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAA,GAAG,IAAmBG,SAASC,KAChEC,EAAyCL,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAIM,GAAAA,GAA6BA,EAE1E,MAAMC,EAA2BD,IAC/B,MAAME,EAAcT,IAEpBU,IAAmBH,EAAQE,GAC3BH,IAAiBC,EAAO,EAGpBI,EAA+BC,IACnCJ,EAAwBI,EAAMC,QAAQ,EAGlCC,EAAgCF,IACpCJ,GAAyBI,EAAMC,QAAQ,EAGnCN,EAASQ,OAAOC,WAAW,gCAEjC,IACED,OAAOC,WAAW,gCAAgCC,oBAChDnB,EAAiCa,GAEnCI,OAAOC,WAAW,iCAAiCC,oBACjDnB,EAAiCgB,EAErC,CAAE,MAAOI,GAET,CAUA,OARAV,EAAwBD,GAAQM,SAChCE,OAAOC,WAAW,gCAAgCG,iBAChDrB,EAAiCa,GAEnCI,OAAOC,WAAW,iCAAiCG,iBACjDrB,EAAiCgB,GAG5B,KACLC,OAAOC,WAAW,gCAAgCC,oBAChDnB,EAAiCa,GAEnCI,OAAOC,WAAW,iCAAiCC,oBACjDnB,EAAiCgB,EAClC,CAEL,EAOaM,EAAqB,WAGvB,IAFTpB,EAAiCC,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAA,GAAG,IAAmBG,SAASC,KAChEC,EAAyCL,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAIM,GAAAA,GAA6BA,EAE1Ec,GAAU,IAAMtB,EAAuBC,EAAgBM,IAAiB,CAACN,EAAgBM,GAC3F,EAaA,IAAIgB,EAAuB,CACzBC,KAAM,aACNC,MAAO,eAOIC,MAAAA,EAAgBA,IAAgBH,EAMhCI,EAAsBC,IACjCL,EAAaK,CAAM,EASRjB,EAAmB,SAACH,EAAiBE,GAAwD,IAA7BmB,IAAW3B,UAAAC,OAAA,QAAAC,IAAAF,UAAA,KAAAA,UAAA,GACtF,MAAM4B,EAAWtB,EAASe,EAAWE,MAAQF,EAAWC,KAClDO,EAAWvB,EAASe,EAAWC,KAAOD,EAAWE,MAEnDf,IACFA,EAAYsB,UAAUC,OAAOH,GAC7BpB,EAAYsB,UAAUC,OAAOF,GAC7BrB,EAAYsB,UAAUE,IAAIH,IAGJ,oBAAb1B,WACTA,SAAS8B,iBAAiB,IAAIL,KAAYM,SAASC,IACjDA,EAAQL,UAAUE,IAAI,IAAIH,KAC1BM,EAAQL,UAAUC,OAAO,IAAIH,IAAW,IAGtCD,IACFxB,SAAS8B,iBAAiB,eAAeC,SAASC,IAChDA,EAAQC,YAAYC,cAAc,IAAIT,MAAaE,UAAUE,IAAIH,GACjEM,EAAQC,YAAYC,cAAc,IAAIT,MAAaE,UAAUC,OAAOH,EAAS,IAG/EzB,SAAS8B,iBAAiB,gBAAgBC,SAASC,IACjDA,EAAQC,YAAYC,cAAc,IAAIT,MAAaE,UAAUE,IAAIH,GACjEM,EAAQC,YAAYC,cAAc,IAAIT,MAAaE,UAAUC,OAAOH,GAEpE,MAAMU,EAA0BH,EAAQC,YAAYG,WAAW,GAE3DD,IACFA,EAAWR,UAAUE,IAAIH,GACzBS,EAAWR,UAAUC,OAAOH,GAC9B,KAIR,EAOaY,EAAmBA,CAAClC,EAAkBE,KACjD,IAAIiC,EAA0BnC,IAAU,EAEhB,oBAAbH,eAAuCD,IAAXI,IACrCmC,EAAiBtC,SAASC,KAAK0B,UAAUY,SAASrB,EAAWC,OAE/Db,EAAiBgC,EAAgBjC,GAAeL,SAASC,KAAK"}
@@ -1 +1 @@
1
- {"version":3,"file":"useToggle.js","sources":["../../../../../../src/core/hooks/useToggle.ts"],"sourcesContent":["import { useState, useCallback } from 'react'\n\n\nexport type useTogggleReturnType = [\n boolean,\n (value?: any | boolean) => void,\n (value?: any | boolean) => void,\n (value?: any | boolean) => void\n]\n\nexport const useToggle = (defaultValue: boolean, async = true): useTogggleReturnType => {\n const [toggled, setToggled] = useState(defaultValue)\n\n const handleToggle: (value?: any | boolean) => void = useCallback((value?: any | boolean) => {\n if (async) {\n setToggled((prevToggled) => (typeof (value) === 'boolean' ? value : !prevToggled))\n } else {\n setToggled((value !== undefined && value !== null ? value : !toggled))\n }\n }, [async, toggled, setToggled])\n\n const handleToggleTrue = useCallback(\n (forceValue?: boolean) => handleToggle(forceValue === undefined ? true : forceValue), [handleToggle],\n )\n\n const handleToggleFalse = useCallback(\n (forceValue?: boolean) => handleToggle(forceValue === undefined ? false : forceValue), [handleToggle],\n )\n\n return [toggled, handleToggle, handleToggleTrue, handleToggleFalse]\n}\n"],"names":["useToggle","defaultValue","async","arguments","length","undefined","toggled","setToggled","useState","handleToggle","useCallback","value","prevToggled","handleToggleTrue","forceValue","handleToggleFalse"],"mappings":"wDAUaA,EAAY,SAACC,GAA8D,IAAvCC,IAAKC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,KAAAA,UAAA,GACpD,MAAOG,EAASC,GAAcC,EAASP,GAEjCQ,EAAgDC,GAAaC,IAE/DJ,EADEL,EACUU,GAAoC,kBAAXD,EAAuBA,GAASC,EAEzDD,QAAwCA,GAASL,EAC/D,GACC,CAACJ,EAAOI,EAASC,IAEdM,EAAmBH,GACtBI,GAAyBL,OAA4BJ,IAAfS,GAAkCA,IAAa,CAACL,IAGnFM,EAAoBL,GACvBI,GAAyBL,OAA4BJ,IAAfS,GAAmCA,IAAa,CAACL,IAG1F,MAAO,CAACH,EAASG,EAAcI,EAAkBE,EACnD"}
1
+ {"version":3,"file":"useToggle.js","sources":["../../../../../../src/core/hooks/useToggle.ts"],"sourcesContent":["import { useState, useCallback } from 'react'\n\n/**\n * Type definition for the return value of the `useToggle` hook.\n * @typedef {Array} useToggleReturnType\n * @property {boolean} 0 - The current toggled state.\n * @property {(value?: any | boolean) => void} 1 - Function to toggle the state.\n * @property {(value?: any | boolean) => void} 2 - Function to forcefully set the state to true.\n * @property {(value?: any | boolean) => void} 3 - Function to forcefully set the state to false.\n */\nexport type useToggleReturnType = [\n boolean,\n (value?: any | boolean) => void,\n (value?: any | boolean) => void,\n (value?: any | boolean) => void\n]\n\n/**\n * Custom hook to manage a boolean state with toggle functionality.\n * @param {boolean} defaultValue - The initial value of the toggled state.\n * @param {boolean} [async=true] - Flag to determine if the toggle should be asynchronous.\n * @returns {useToggleReturnType} An array containing the current state, a toggle function,\n * and functions to set the state to true or false.\n */\nexport const useToggle = (defaultValue: boolean, async = true): useToggleReturnType => {\n const [toggled, setToggled] = useState(defaultValue)\n\n /**\n * Function to toggle the state.\n * @param {any | boolean} [value] - Optional value to set the state. If not provided, the state will be toggled.\n */\n const handleToggle: (value?: any | boolean) => void = useCallback((value?: any | boolean) => {\n if (async) {\n setToggled((prevToggled) => (typeof (value) === 'boolean' ? value : !prevToggled))\n } else {\n setToggled((value !== undefined && value !== null ? value : !toggled))\n }\n }, [async, toggled, setToggled])\n\n /**\n * Function to set the state to true.\n * @param {boolean} [forceValue] - Optional value to forcefully set the state.\n * If not provided, the state will be set to true.\n */\n const handleToggleTrue = useCallback(\n (forceValue?: boolean) => handleToggle(forceValue === undefined ? true : forceValue), [handleToggle],\n )\n\n /**\n * Function to set the state to false.\n * @param {boolean} [forceValue] - Optional value to forcefully set the state.\n * If not provided, the state will be set to false.\n */\n const handleToggleFalse = useCallback(\n (forceValue?: boolean) => handleToggle(forceValue === undefined ? false : forceValue), [handleToggle],\n )\n\n return [toggled, handleToggle, handleToggleTrue, handleToggleFalse]\n}\n"],"names":["useToggle","defaultValue","async","arguments","length","undefined","toggled","setToggled","useState","handleToggle","useCallback","value","prevToggled","handleToggleTrue","forceValue","handleToggleFalse"],"mappings":"wDAwBaA,EAAY,SAACC,GAA6D,IAAtCC,IAAKC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,KAAAA,UAAA,GACpD,MAAOG,EAASC,GAAcC,EAASP,GAMjCQ,EAAgDC,GAAaC,IAE/DJ,EADEL,EACUU,GAAoC,kBAAXD,EAAuBA,GAASC,EAEzDD,QAAwCA,GAASL,EAC/D,GACC,CAACJ,EAAOI,EAASC,IAOdM,EAAmBH,GACtBI,GAAyBL,OAA4BJ,IAAfS,GAAkCA,IAAa,CAACL,IAQnFM,EAAoBL,GACvBI,GAAyBL,OAA4BJ,IAAfS,GAAmCA,IAAa,CAACL,IAG1F,MAAO,CAACH,EAASG,EAAcI,EAAkBE,EACnD"}
@@ -1 +1 @@
1
- {"version":3,"file":"icons.js","sources":["../../../../../../../../src/core/ui/components/atoms/icons.tsx"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport React from 'react'\n\nexport const closeIconJSX = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path d='M336.1 175c-9.375-9.375-24.56-9.375-33.94 0L256 222.1L208.1 175c-9.375-9.375-24.56-9.375-33.94 0s-9.375 24.56 0 33.94l47.03 47.03L175 303c-9.375 9.375-9.375 24.56 0 33.94c9.373 9.373 24.56 9.381 33.94 0L256 289.9l47.03 47.03c9.373 9.373 24.56 9.381 33.94 0c9.375-9.375 9.375-24.56 0-33.94l-47.03-47.03l47.03-47.03C346.3 199.6 346.3 184.4 336.1 175zM256 0C114.6 0 0 114.6 0 256s114.6 256 256 256S512 397.4 512 256S397.4 0 256 0zM256 464c-114.7 0-208-93.31-208-208S141.3 48 256 48s208 93.31 208 208S370.7 464 256 464z' /></svg>\n)\nexport const infoIconJSX = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path d='M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 128c17.67 0 32 14.33 32 32c0 17.67-14.33 32-32 32S224 177.7 224 160C224 142.3 238.3 128 256 128zM296 384h-80C202.8 384 192 373.3 192 360s10.75-24 24-24h16v-64H224c-13.25 0-24-10.75-24-24S210.8 224 224 224h32c13.25 0 24 10.75 24 24v88h16c13.25 0 24 10.75 24 24S309.3 384 296 384z' /></svg>\n\n)\n"],"names":["closeIconJSX","React","createElement","xmlns","viewBox","d","infoIconJSX"],"mappings":"qBAIaA,MAAAA,EACXC,EAAAC,cAAA,MAAA,CAAKC,MAAM,6BAA6BC,QAAQ,eAAcH,EAAAC,cAAA,OAAA,CAAMG,EAAE,ygBAE3DC,EACXL,EAAAC,cAAA,MAAA,CAAKC,MAAM,6BAA6BC,QAAQ,eAAcH,EAAAC,cAAA,OAAA,CAAMG,EAAE"}
1
+ {"version":3,"file":"icons.js","sources":["../../../../../../../../src/core/ui/components/atoms/icons.tsx"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport React from 'react'\n\nexport const closeIconJSX = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path d='M336.1 175c-9.375-9.375-24.56-9.375-33.94 0L256 222.1L208.1 175c-9.375-9.375-24.56-9.375-33.94 0s-9.375 24.56 0 33.94l47.03 47.03L175 303c-9.375 9.375-9.375 24.56 0 33.94c9.373 9.373 24.56 9.381 33.94 0L256 289.9l47.03 47.03c9.373 9.373 24.56 9.381 33.94 0c9.375-9.375 9.375-24.56 0-33.94l-47.03-47.03l47.03-47.03C346.3 199.6 346.3 184.4 336.1 175zM256 0C114.6 0 0 114.6 0 256s114.6 256 256 256S512 397.4 512 256S397.4 0 256 0zM256 464c-114.7 0-208-93.31-208-208S141.3 48 256 48s208 93.31 208 208S370.7 464 256 464z' /></svg>\n)\nexport const infoIconJSX = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path d='M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 128c17.67 0 32 14.33 32 32c0 17.67-14.33 32-32 32S224 177.7 224 160C224 142.3 238.3 128 256 128zM296 384h-80C202.8 384 192 373.3 192 360s10.75-24 24-24h16v-64H224c-13.25 0-24-10.75-24-24S210.8 224 224 224h32c13.25 0 24 10.75 24 24v88h16c13.25 0 24 10.75 24 24S309.3 384 296 384z' /></svg>\n\n)\n\n\nexport const appStoreIcon = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path d='M255.9 120.9l9.1-15.7c5.6-9.8 18.1-13.1 27.9-7.5 9.8 5.6 13.1 18.1 7.5 27.9l-87.5 151.5h63.3c20.5 0 32 24.1 23.1 40.8H113.8c-11.3 0-20.4-9.1-20.4-20.4 0-11.3 9.1-20.4 20.4-20.4h52l66.6-115.4-20.8-36.1c-5.6-9.8-2.3-22.2 7.5-27.9 9.8-5.6 22.2-2.3 27.9 7.5l8.9 15.7zm-78.7 218l-19.6 34c-5.6 9.8-18.1 13.1-27.9 7.5-9.8-5.6-13.1-18.1-7.5-27.9l14.6-25.2c16.4-5.1 29.8-1.2 40.4 11.6zm168.9-61.7h53.1c11.3 0 20.4 9.1 20.4 20.4 0 11.3-9.1 20.4-20.4 20.4h-29.5l19.9 34.5c5.6 9.8 2.3 22.2-7.5 27.9-9.8 5.6-22.2 2.3-27.9-7.5-33.5-58.1-58.7-101.6-75.4-130.6-17.1-29.5-4.9-59.1 7.2-69.1 13.4 23 33.4 57.7 60.1 104zM256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm216 248c0 118.7-96.1 216-216 216-118.7 0-216-96.1-216-216 0-118.7 96.1-216 216-216 118.7 0 216 96.1 216 216z' /></svg>\n)\n\n\nexport const batteryEmptyIcon = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 576 512'><path d='M544 192V160c0-35.35-28.65-64-64-64H64C28.65 96 0 124.7 0 160v192c0 35.35 28.65 64 64 64h416c35.35 0 64-28.65 64-64v-32c17.67 0 32-14.33 32-32V224C576 206.3 561.7 192 544 192zM480 352H64V160h416V352z' /></svg>\n)\n\n\nexport const elementorIcon = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M425.6 32H22.4C10 32 0 42 0 54.4v403.2C0 470 10 480 22.4 480h403.2c12.4 0 22.4-10 22.4-22.4V54.4C448 42 438 32 425.6 32M164.3 355.5h-39.8v-199h39.8v199zm159.3 0H204.1v-39.8h119.5v39.8zm0-79.6H204.1v-39.8h119.5v39.8zm0-79.7H204.1v-39.8h119.5v39.8z' /></svg>\n)\n\nexport const squareCheckIcon = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M384 32H64C28.65 32 0 60.65 0 96v320c0 35.35 28.65 64 64 64h320c35.35 0 64-28.65 64-64V96C448 60.65 419.3 32 384 32zM400 416c0 8.836-7.164 16-16 16H64c-8.836 0-16-7.164-16-16V96c0-8.838 7.164-16 16-16h320c8.836 0 16 7.162 16 16V416zM303 175L192 286.1L144.1 239c-9.375-9.375-24.56-9.375-33.94 0s-9.375 24.56 0 33.94l64 64C179.7 341.7 185.8 344 192 344s12.28-2.344 16.97-7.031l128-128c9.375-9.375 9.375-24.56 0-33.94S312.4 165.7 303 175z' /></svg>\n)\n\nexport const pencilIcon = (\n <svg width='10' height='10' viewBox='0 0 10 10' fill='none' xmlns='http://www.w3.org/2000/svg'>\n <path d='M8.91878 3.38356L6.59333 1.08219L7.35936 0.315069C7.56911 0.105023 7.82682 0 8.13251 0C8.43782 0 8.69536 0.105023 8.9051 0.315069L9.67113 1.08219C9.88088 1.29224 9.99031 1.54575 9.99943 1.84274C10.0086 2.13936 9.90824 2.39269 9.69849 2.60274L8.91878 3.38356ZM8.12539 4.19178L2.32545 10H0V7.67123L5.79994 1.86301L8.12539 4.19178Z' fill='#E2E369' />\n </svg>\n\n)\n"],"names":["closeIconJSX","React","createElement","xmlns","viewBox","d","infoIconJSX"],"mappings":"qBAIaA,MAAAA,EACXC,EAAAC,cAAA,MAAA,CAAKC,MAAM,6BAA6BC,QAAQ,eAAcH,EAAAC,cAAA,OAAA,CAAMG,EAAE,ygBAE3DC,EACXL,EAAAC,cAAA,MAAA,CAAKC,MAAM,6BAA6BC,QAAQ,eAAcH,EAAAC,cAAA,OAAA,CAAMG,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"Headline.js","sources":["../../../../../../../../../src/core/ui/components/atoms/text/Headline.tsx"],"sourcesContent":["import { memo } from 'react'\n\nimport { ITextProps, Text } from './Text'\nimport classes from './typography.module.scss'\n\n\nexport const Headline = memo(\n ({ children, text, className = '', ...props }: ITextProps) => (\n <Text {...props} className={`${classes.headline} ${className}`} element='h1'>\n {children && children}\n {(!children && text) && text}\n </Text>\n ),\n)\n\nHeadline.displayName = 'Headline'\n\n\nexport const HeadlineSecondary = memo(\n ({ children, text, className = '', ...props }: ITextProps) => (\n <Text {...props} className={`${classes.headlineSecondary} ${className}`} element='h2'>\n {children && children}\n {(!children && text) && text}\n </Text>\n ),\n)\n\nHeadlineSecondary.displayName = 'HeadlineSecondary'\n\n\nexport const HeadlineTertiary = memo(\n ({ children, text, className = '', ...props }: ITextProps) => (\n <Text {...props} className={`${classes.headlineTertiary} ${className}`} element='h3'>\n {children && children}\n {(!children && text) && text}\n </Text>\n ),\n)\n\nHeadlineTertiary.displayName = 'HeadlineTertiary'\n"],"names":["Headline","memo","_ref","children","text","className","props","React","createElement","Text","_extends","classes","headline","element","displayName","HeadlineSecondary","_ref2","headlineSecondary","HeadlineTertiary","_ref3","headlineTertiary"],"mappings":"2LAMaA,MAAAA,EAAWC,GACtBC,IAAA,IAACC,SAAEA,EAAQC,KAAEA,EAAIC,UAAEA,EAAY,MAAOC,GAAmBJ,EAAA,OACvDK,MAAAC,cAACC,EAAIC,KAAKJ,EAAK,CAAED,UAAW,GAAGM,EAAQC,YAAYP,IAAaQ,QAAQ,OACrEV,GAAYA,GACVA,GAAYC,GAASA,EACnB,IAIXJ,EAASc,YAAc,WAGVC,MAAAA,EAAoBd,GAC/Be,IAAA,IAACb,SAAEA,EAAQC,KAAEA,EAAIC,UAAEA,EAAY,MAAOC,GAAmBU,EAAA,OACvDT,MAAAC,cAACC,EAAIC,KAAKJ,EAAK,CAAED,UAAW,GAAGM,EAAQM,qBAAqBZ,IAAaQ,QAAQ,OAC9EV,GAAYA,GACVA,GAAYC,GAASA,EACnB,IAIXW,EAAkBD,YAAc,oBAGnBI,MAAAA,EAAmBjB,GAC9BkB,IAAA,IAAChB,SAAEA,EAAQC,KAAEA,EAAIC,UAAEA,EAAY,MAAOC,GAAmBa,EAAA,OACvDZ,MAAAC,cAACC,EAAIC,KAAKJ,EAAK,CAAED,UAAW,GAAGM,EAAQS,oBAAoBf,IAAaQ,QAAQ,OAC7EV,GAAYA,GACVA,GAAYC,GAASA,EACnB,IAIXc,EAAiBJ,YAAc"}
1
+ {"version":3,"file":"Headline.js","sources":["../../../../../../../../../src/core/ui/components/atoms/text/Headline.tsx"],"sourcesContent":["import { memo } from 'react'\n\nimport { ITextProps } from './text.types'\nimport { Text } from './Text'\nimport classes from './typography.module.scss'\n\n\nexport const Headline = memo(\n ({ children, text, className = '', ...props }: ITextProps) => (\n <Text {...props} className={`${classes.headline} ${className}`} element='h1'>\n {children && children}\n {(!children && text) && text}\n </Text>\n ),\n)\n\nHeadline.displayName = 'Headline'\n\n\nexport const HeadlineSecondary = memo(\n ({ children, text, className = '', ...props }: ITextProps) => (\n <Text {...props} className={`${classes.headlineSecondary} ${className}`} element='h2'>\n {children && children}\n {(!children && text) && text}\n </Text>\n ),\n)\n\nHeadlineSecondary.displayName = 'HeadlineSecondary'\n\n\nexport const HeadlineTertiary = memo(\n ({ children, text, className = '', ...props }: ITextProps) => (\n <Text {...props} className={`${classes.headlineTertiary} ${className}`} element='h3'>\n {children && children}\n {(!children && text) && text}\n </Text>\n ),\n)\n\nHeadlineTertiary.displayName = 'HeadlineTertiary'\n"],"names":["Headline","memo","_ref","children","text","className","props","React","createElement","Text","_extends","classes","headline","element","displayName","HeadlineSecondary","_ref2","headlineSecondary","HeadlineTertiary","_ref3","headlineTertiary"],"mappings":"2LAOaA,MAAAA,EAAWC,GACtBC,IAAA,IAACC,SAAEA,EAAQC,KAAEA,EAAIC,UAAEA,EAAY,MAAOC,GAAmBJ,EAAA,OACvDK,MAAAC,cAACC,EAAIC,KAAKJ,EAAK,CAAED,UAAW,GAAGM,EAAQC,YAAYP,IAAaQ,QAAQ,OACrEV,GAAYA,GACVA,GAAYC,GAASA,EACnB,IAIXJ,EAASc,YAAc,WAGVC,MAAAA,EAAoBd,GAC/Be,IAAA,IAACb,SAAEA,EAAQC,KAAEA,EAAIC,UAAEA,EAAY,MAAOC,GAAmBU,EAAA,OACvDT,MAAAC,cAACC,EAAIC,KAAKJ,EAAK,CAAED,UAAW,GAAGM,EAAQM,qBAAqBZ,IAAaQ,QAAQ,OAC9EV,GAAYA,GACVA,GAAYC,GAASA,EACnB,IAIXW,EAAkBD,YAAc,oBAGnBI,MAAAA,EAAmBjB,GAC9BkB,IAAA,IAAChB,SAAEA,EAAQC,KAAEA,EAAIC,UAAEA,EAAY,MAAOC,GAAmBa,EAAA,OACvDZ,MAAAC,cAACC,EAAIC,KAAKJ,EAAK,CAAED,UAAW,GAAGM,EAAQS,oBAAoBf,IAAaQ,QAAQ,OAC7EV,GAAYA,GACVA,GAAYC,GAASA,EACnB,IAIXc,EAAiBJ,YAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"Link.js","sources":["../../../../../../../../../src/core/ui/components/atoms/text/Link.tsx"],"sourcesContent":["import { memo } from 'react'\n\nimport { ITextProps, Text } from './Text'\nimport classes from './typography.module.scss'\n\n\nexport const Link = memo(\n ({ children, text, className = '', ...props }: ITextProps) => (\n <Text {...props} className={`${classes.link} ${className}`} element='a'>\n {children && children}\n {(!children && text) && text}\n </Text>\n ),\n)\n\nLink.displayName = 'Link'\n\n"],"names":["Link","memo","_ref","children","text","className","props","React","createElement","Text","_extends","classes","link","element","displayName"],"mappings":"2LAMaA,MAAAA,EAAOC,GAClBC,IAAA,IAACC,SAAEA,EAAQC,KAAEA,EAAIC,UAAEA,EAAY,MAAOC,GAAmBJ,EAAA,OACvDK,MAAAC,cAACC,EAAIC,KAAKJ,EAAK,CAAED,UAAW,GAAGM,EAAQC,QAAQP,IAAaQ,QAAQ,MACjEV,GAAYA,GACVA,GAAYC,GAASA,EACnB,IAIXJ,EAAKc,YAAc"}
1
+ {"version":3,"file":"Link.js","sources":["../../../../../../../../../src/core/ui/components/atoms/text/Link.tsx"],"sourcesContent":["import { memo } from 'react'\n\nimport { ITextProps } from './text.types'\nimport { Text } from './Text'\nimport classes from './typography.module.scss'\n\n\nexport const Link = memo(\n ({ children, text, className = '', ...props }: ITextProps) => (\n <Text {...props} className={`${classes.link} ${className}`} element='a'>\n {children && children}\n {(!children && text) && text}\n </Text>\n ),\n)\n\nLink.displayName = 'Link'\n\n"],"names":["Link","memo","_ref","children","text","className","props","React","createElement","Text","_extends","classes","link","element","displayName"],"mappings":"2LAOaA,MAAAA,EAAOC,GAClBC,IAAA,IAACC,SAAEA,EAAQC,KAAEA,EAAIC,UAAEA,EAAY,MAAOC,GAAmBJ,EAAA,OACvDK,MAAAC,cAACC,EAAIC,KAAKJ,EAAK,CAAED,UAAW,GAAGM,EAAQC,QAAQP,IAAaQ,QAAQ,MACjEV,GAAYA,GACVA,GAAYC,GAASA,EACnB,IAIXJ,EAAKc,YAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"Paragraph.js","sources":["../../../../../../../../../src/core/ui/components/atoms/text/Paragraph.tsx"],"sourcesContent":["import { memo } from 'react'\n\nimport { ITextProps, Text } from './Text'\nimport classes from './typography.module.scss'\n\n\nexport const Paragraph = memo(\n ({ children, text, className = '', ...props }: ITextProps) => (\n <Text {...props} className={`${classes.paragraph} ${className}`} element='p'>\n {children && children}\n {(!children && text) && text}\n </Text>\n ),\n)\n\nParagraph.displayName = 'Paragraph'\n\n\nexport const ParagraphSmall = memo(\n ({ children, text, className = '', ...props }: ITextProps) => (\n <Text {...props} className={`${classes.paragraphSmall} ${className}`} element='p'>\n {children && children}\n {(!children && text) && text}\n </Text>\n ),\n)\n\nParagraphSmall.displayName = 'ParagraphSmall'\n\n\nexport const ParagraphBold = memo(\n ({ children, text, className = '', ...props }: ITextProps) => (\n <Text {...props} className={`${classes.paragraphBold} ${className}`} element='p'>\n {children && children}\n {(!children && text) && text}\n </Text>\n ),\n)\n\nParagraphBold.displayName = 'ParagraphBold'\n\n\nexport const ParagraphBoldSmall = memo(\n ({ children, text, className = '', ...props }: ITextProps) => (\n <Text {...props} className={`${classes.paragraphBoldSmall} ${className}`} element='p'>\n {children && children}\n {(!children && text) && text}\n </Text>\n ),\n)\n\nParagraphBoldSmall.displayName = 'ParagraphBoldSmall'\n"],"names":["Paragraph","memo","_ref","children","text","className","props","React","createElement","Text","_extends","classes","paragraph","element","displayName","ParagraphSmall","_ref2","paragraphSmall","ParagraphBold","_ref3","paragraphBold","ParagraphBoldSmall","_ref4","paragraphBoldSmall"],"mappings":"2LAMaA,MAAAA,EAAYC,GACvBC,IAAA,IAACC,SAAEA,EAAQC,KAAEA,EAAIC,UAAEA,EAAY,MAAOC,GAAmBJ,EAAA,OACvDK,MAAAC,cAACC,EAAIC,KAAKJ,EAAK,CAAED,UAAW,GAAGM,EAAQC,aAAaP,IAAaQ,QAAQ,MACtEV,GAAYA,GACVA,GAAYC,GAASA,EACnB,IAIXJ,EAAUc,YAAc,YAGXC,MAAAA,EAAiBd,GAC5Be,IAAA,IAACb,SAAEA,EAAQC,KAAEA,EAAIC,UAAEA,EAAY,MAAOC,GAAmBU,EAAA,OACvDT,MAAAC,cAACC,EAAIC,KAAKJ,EAAK,CAAED,UAAW,GAAGM,EAAQM,kBAAkBZ,IAAaQ,QAAQ,MAC3EV,GAAYA,GACVA,GAAYC,GAASA,EACnB,IAIXW,EAAeD,YAAc,iBAGhBI,MAAAA,EAAgBjB,GAC3BkB,IAAA,IAAChB,SAAEA,EAAQC,KAAEA,EAAIC,UAAEA,EAAY,MAAOC,GAAmBa,EAAA,OACvDZ,MAAAC,cAACC,EAAIC,KAAKJ,EAAK,CAAED,UAAW,GAAGM,EAAQS,iBAAiBf,IAAaQ,QAAQ,MAC1EV,GAAYA,GACVA,GAAYC,GAASA,EACnB,IAIXc,EAAcJ,YAAc,gBAGfO,MAAAA,EAAqBpB,GAChCqB,IAAA,IAACnB,SAAEA,EAAQC,KAAEA,EAAIC,UAAEA,EAAY,MAAOC,GAAmBgB,EAAA,OACvDf,MAAAC,cAACC,EAAIC,KAAKJ,EAAK,CAAED,UAAW,GAAGM,EAAQY,sBAAsBlB,IAAaQ,QAAQ,MAC/EV,GAAYA,GACVA,GAAYC,GAASA,EACnB,IAIXiB,EAAmBP,YAAc"}
1
+ {"version":3,"file":"Paragraph.js","sources":["../../../../../../../../../src/core/ui/components/atoms/text/Paragraph.tsx"],"sourcesContent":["import { memo } from 'react'\n\nimport { ITextProps } from './text.types'\nimport { Text } from './Text'\nimport classes from './typography.module.scss'\n\n\nexport const Paragraph = memo(\n ({ children, text, className = '', ...props }: ITextProps) => (\n <Text {...props} className={`${classes.paragraph} ${className}`} element='p'>\n {children && children}\n {(!children && text) && text}\n </Text>\n ),\n)\n\nParagraph.displayName = 'Paragraph'\n\n\nexport const ParagraphSmall = memo(\n ({ children, text, className = '', ...props }: ITextProps) => (\n <Text {...props} className={`${classes.paragraphSmall} ${className}`} element='p'>\n {children && children}\n {(!children && text) && text}\n </Text>\n ),\n)\n\nParagraphSmall.displayName = 'ParagraphSmall'\n\n\nexport const ParagraphBold = memo(\n ({ children, text, className = '', ...props }: ITextProps) => (\n <Text {...props} className={`${classes.paragraphBold} ${className}`} element='p'>\n {children && children}\n {(!children && text) && text}\n </Text>\n ),\n)\n\nParagraphBold.displayName = 'ParagraphBold'\n\n\nexport const ParagraphBoldSmall = memo(\n ({ children, text, className = '', ...props }: ITextProps) => (\n <Text {...props} className={`${classes.paragraphBoldSmall} ${className}`} element='p'>\n {children && children}\n {(!children && text) && text}\n </Text>\n ),\n)\n\nParagraphBoldSmall.displayName = 'ParagraphBoldSmall'\n"],"names":["Paragraph","memo","_ref","children","text","className","props","React","createElement","Text","_extends","classes","paragraph","element","displayName","ParagraphSmall","_ref2","paragraphSmall","ParagraphBold","_ref3","paragraphBold","ParagraphBoldSmall","_ref4","paragraphBoldSmall"],"mappings":"2LAOaA,MAAAA,EAAYC,GACvBC,IAAA,IAACC,SAAEA,EAAQC,KAAEA,EAAIC,UAAEA,EAAY,MAAOC,GAAmBJ,EAAA,OACvDK,MAAAC,cAACC,EAAIC,KAAKJ,EAAK,CAAED,UAAW,GAAGM,EAAQC,aAAaP,IAAaQ,QAAQ,MACtEV,GAAYA,GACVA,GAAYC,GAASA,EACnB,IAIXJ,EAAUc,YAAc,YAGXC,MAAAA,EAAiBd,GAC5Be,IAAA,IAACb,SAAEA,EAAQC,KAAEA,EAAIC,UAAEA,EAAY,MAAOC,GAAmBU,EAAA,OACvDT,MAAAC,cAACC,EAAIC,KAAKJ,EAAK,CAAED,UAAW,GAAGM,EAAQM,kBAAkBZ,IAAaQ,QAAQ,MAC3EV,GAAYA,GACVA,GAAYC,GAASA,EACnB,IAIXW,EAAeD,YAAc,iBAGhBI,MAAAA,EAAgBjB,GAC3BkB,IAAA,IAAChB,SAAEA,EAAQC,KAAEA,EAAIC,UAAEA,EAAY,MAAOC,GAAmBa,EAAA,OACvDZ,MAAAC,cAACC,EAAIC,KAAKJ,EAAK,CAAED,UAAW,GAAGM,EAAQS,iBAAiBf,IAAaQ,QAAQ,MAC1EV,GAAYA,GACVA,GAAYC,GAASA,EACnB,IAIXc,EAAcJ,YAAc,gBAGfO,MAAAA,EAAqBpB,GAChCqB,IAAA,IAACnB,SAAEA,EAAQC,KAAEA,EAAIC,UAAEA,EAAY,MAAOC,GAAmBgB,EAAA,OACvDf,MAAAC,cAACC,EAAIC,KAAKJ,EAAK,CAAED,UAAW,GAAGM,EAAQY,sBAAsBlB,IAAaQ,QAAQ,MAC/EV,GAAYA,GACVA,GAAYC,GAASA,EACnB,IAIXiB,EAAmBP,YAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"Text.js","sources":["../../../../../../../../../src/core/ui/components/atoms/text/Text.tsx"],"sourcesContent":["import React, { memo, PropsWithChildren, CSSProperties, FC, MouseEventHandler, useMemo } from 'react'\n\nimport { CommonProps } from '../../../types/CommonProps'\nimport { composeId } from '../../../../utils'\nimport { useParseProps } from '../../../../hooks'\n\n\nexport interface ITextProps extends PropsWithChildren, CSSProperties, CommonProps {\n element?: string | FC\n className?: string\n text?: string\n href?: string\n target?: string\n onClick?: MouseEventHandler\n disabled?: boolean\n}\n\nexport type TextProps = ITextProps & { style?: CSSProperties; 'data-testid'?: string }\n\n\nexport const Text: FC<TextProps> = memo<ITextProps>((\n { element = 'span', children, href, target, className = '', id, onClick, text, ...rest }: ITextProps,\n) => {\n const { dataProps, restProps } = useParseProps(rest)\n const textFromChildren: string | undefined = text || children?.toString()\n\n const onClickProps = useMemo(() => (onClick ? ({\n onClick,\n onKeyDown: onClick,\n role: 'button',\n tabIndex: -1,\n }) : {}), [onClick])\n\n return React.createElement<TextProps>(\n element,\n {\n id: `${id || (textFromChildren && composeId(textFromChildren))}`,\n href,\n text,\n target,\n className,\n ...onClickProps,\n style: restProps,\n ...dataProps,\n 'data-testid':\n `${dataProps.dataTestId || dataProps['data-testid'] || id || (textFromChildren && composeId(textFromChildren))}`,\n },\n children,\n )\n})\n\nText.displayName = 'Text'\n"],"names":["Text","memo","_ref","element","children","href","target","className","id","onClick","text","rest","dataProps","restProps","useParseProps","textFromChildren","toString","onClickProps","useMemo","onKeyDown","role","tabIndex","React","createElement","composeId","style","dataTestId","displayName"],"mappings":"oLAoBaA,EAAsBC,GAAiBC,IAE/C,IADHC,QAAEA,EAAU,OAAMC,SAAEA,EAAQC,KAAEA,EAAIC,OAAEA,EAAMC,UAAEA,EAAY,GAAEC,GAAEA,EAAEC,QAAEA,EAAOC,KAAEA,KAASC,GAAkBT,EAEpG,MAAMU,UAAEA,EAASC,UAAEA,GAAcC,EAAcH,GACzCI,EAAuCL,GAAQN,GAAUY,WAEzDC,EAAeC,GAAQ,IAAOT,EAAW,CAC7CA,UACAU,UAAWV,EACXW,KAAM,SACNC,UAAW,GACR,CAAG,GAAE,CAACZ,IAEX,OAAOa,EAAMC,cACXpB,EACA,CACEK,GAAI,GAAGA,GAAOO,GAAoBS,EAAUT,KAC5CV,OACAK,OACAJ,SACAC,eACGU,EACHQ,MAAOZ,KACJD,EACH,cACA,GAAGA,EAAUc,YAAcd,EAAU,gBAAkBJ,GAAOO,GAAoBS,EAAUT,MAE9FX,EACD,IAGHJ,EAAK2B,YAAc"}
1
+ {"version":3,"file":"Text.js","sources":["../../../../../../../../../src/core/ui/components/atoms/text/Text.tsx"],"sourcesContent":["import React, { memo, FC, useMemo } from 'react'\n\nimport { composeId } from '../../../../utils'\nimport { useParseProps } from '../../../../hooks'\n\nimport { ITextProps, TextProps } from './text.types'\n\n\nexport const Text: FC<TextProps> = memo<ITextProps>((\n { element = 'span', children, href, target, className = '', id, onClick, text, ...rest }: ITextProps,\n) => {\n const { dataProps, restProps } = useParseProps(rest)\n const textFromChildren: string | undefined = text || children?.toString()\n\n const onClickProps = useMemo(() => (onClick ? ({\n onClick,\n onKeyDown: onClick,\n role: 'button',\n tabIndex: -1,\n }) : {}), [onClick])\n\n return React.createElement<TextProps>(\n element,\n {\n id: `${id || (textFromChildren && composeId(textFromChildren))}`,\n href,\n text,\n target,\n className,\n ...onClickProps,\n style: restProps,\n ...dataProps,\n 'data-testid':\n `${dataProps.dataTestId || dataProps['data-testid'] || id || (textFromChildren && composeId(textFromChildren))}`,\n },\n children,\n )\n})\n\nText.displayName = 'Text'\n"],"names":["Text","memo","_ref","element","children","href","target","className","id","onClick","text","rest","dataProps","restProps","useParseProps","textFromChildren","toString","onClickProps","useMemo","onKeyDown","role","tabIndex","React","createElement","composeId","style","dataTestId","displayName"],"mappings":"oLAQaA,EAAsBC,GAAiBC,IAE/C,IADHC,QAAEA,EAAU,OAAMC,SAAEA,EAAQC,KAAEA,EAAIC,OAAEA,EAAMC,UAAEA,EAAY,GAAEC,GAAEA,EAAEC,QAAEA,EAAOC,KAAEA,KAASC,GAAkBT,EAEpG,MAAMU,UAAEA,EAASC,UAAEA,GAAcC,EAAcH,GACzCI,EAAuCL,GAAQN,GAAUY,WAEzDC,EAAeC,GAAQ,IAAOT,EAAW,CAC7CA,UACAU,UAAWV,EACXW,KAAM,SACNC,UAAW,GACR,CAAG,GAAE,CAACZ,IAEX,OAAOa,EAAMC,cACXpB,EACA,CACEK,GAAI,GAAGA,GAAOO,GAAoBS,EAAUT,KAC5CV,OACAK,OACAJ,SACAC,eACGU,EACHQ,MAAOZ,KACJD,EACH,cACA,GAAGA,EAAUc,YAAcd,EAAU,gBAAkBJ,GAAOO,GAAoBS,EAAUT,MAE9FX,EACD,IAGHJ,EAAK2B,YAAc"}
@@ -0,0 +1,2 @@
1
+ import{extends as t}from"../../../../../../_virtual/_rollupPluginBabelHelpers.js";import{memo as e,useMemo as o}from"react";import{PropsValidationError as n}from"../../error/propsValidationError.js";import{Text as r}from"../text/Text.js";import c from"./textAndContent.module.scss.js";import{LayoutBox as i}from"../../container/layoutBox/LayoutBox.js";import{IconBase as l}from"../../icon/IconBase.js";const a=e((e=>{let{text:o,children:l,components:a,leftContent:s,rightContent:m,textProps:x={},className:p="",...d}=e;if(null==o&&!l)throw new n("Missing `text or children` property!");const f=a?.TextComponent||r;return React.createElement(i,t({className:`${c.textAndContent} ${p}`},d),s&&s,React.createElement(f,t({className:"text-truncate"},x,{"data-testid":"text-content-text-component"}),o||l),m&&m)}));a.displayName="TextAndContent";const s=e((e=>{let{iconSize:n,iconColor:r,iconLeft:c,iconRight:i,iconLeftUrl:s,iconRightUrl:m,onLeftIconClick:x,onRightIconClick:p,...d}=e;const[f,u]=o((()=>{let e,o;if(c||s){const o=x?{onClick:x,onKeyDown:x,role:"button",tabIndex:-1,"data-testid":"text-content-icon-left"}:{};e=React.createElement(l,t({iconUrl:s,size:n,color:r},o),c&&c)}if(i||m){const e=p?{onClick:p,onKeyDown:p,role:"button",tabIndex:-1,"data-testid":"text-content-icon-right"}:{};o=React.createElement(l,t({iconUrl:m,size:n,color:r},e),i&&i)}return[e,o]}),[r,c,s,i,m,n,x,p]);return React.createElement(a,t({leftContent:f,rightContent:u},d))}));s.displayName="TextAndIcons";export{a as TextAndContent,s as TextAndIcons};
2
+ //# sourceMappingURL=TextAndContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextAndContent.js","sources":["../../../../../../../../../src/core/ui/components/atoms/textAndContent/TextAndContent.tsx"],"sourcesContent":["import { memo, FC, useMemo } from 'react'\n\nimport { PropsValidationError } from '../../error/propsValidationError'\nimport { IconBase } from '../../icon'\nimport { LayoutBox } from '../../container'\nimport { Text as BodyText } from '../text/Text'\n\nimport type { TextAndContentProps, TextAndIconsProps } from './textAndContent.types'\nimport classes from './textAndContent.module.scss'\n\n\n/**\n * TextAndContent component.\n *\n * @type {React.FC<TextAndContentProps>}\n * @returns {React.ReactElement} The TextAndContent.\n */\nexport const TextAndContent: FC<TextAndContentProps> = memo<TextAndContentProps>(({\n text,\n children,\n components,\n leftContent,\n rightContent,\n textProps = {},\n className = '',\n ...props\n}: TextAndContentProps) => {\n if ((text === undefined || text === null) && !children) {\n throw new PropsValidationError('Missing `text or children` property!')\n }\n\n const TextComponent = components?.TextComponent || BodyText\n\n return (\n <LayoutBox\n className={`${classes.textAndContent} ${className}`}\n {...props}\n >\n {leftContent && leftContent}\n <TextComponent className='text-truncate' {...textProps} data-testid='text-content-text-component'>{text || children}</TextComponent>\n {rightContent && rightContent}\n </LayoutBox>\n )\n})\n\nTextAndContent.displayName = 'TextAndContent'\n\n\n/**\n * TextAndIcons component.\n *\n * @type {React.FC<TextAndIconsProps>}\n * @returns {React.ReactElement} The TextAndIcons.\n */\nexport const TextAndIcons: FC<TextAndIconsProps> = memo<TextAndIconsProps>(({\n iconSize,\n iconColor,\n iconLeft,\n iconRight,\n iconLeftUrl,\n iconRightUrl,\n onLeftIconClick,\n onRightIconClick,\n ...props\n}: TextAndIconsProps) => {\n const [leftContent, rightContent] = useMemo(() => {\n let leftContent\n let rightContent\n\n if (iconLeft || iconLeftUrl) {\n const onLeftIconClickProps = onLeftIconClick ? ({\n onClick: onLeftIconClick,\n onKeyDown: onLeftIconClick,\n role: 'button',\n tabIndex: -1,\n 'data-testid': 'text-content-icon-left',\n }) : {}\n\n leftContent = (\n <IconBase iconUrl={iconLeftUrl} size={iconSize} color={iconColor} {...onLeftIconClickProps}>\n {iconLeft && iconLeft}\n </IconBase>)\n }\n if (iconRight || iconRightUrl) {\n const onRightIconClickProps = onRightIconClick ? ({\n onClick: onRightIconClick,\n onKeyDown: onRightIconClick,\n role: 'button',\n tabIndex: -1,\n 'data-testid': 'text-content-icon-right',\n }) : {}\n\n rightContent = (\n <IconBase iconUrl={iconRightUrl} size={iconSize} color={iconColor} {...onRightIconClickProps}>\n {iconRight && iconRight}\n </IconBase>)\n }\n return [leftContent, rightContent]\n }, [iconColor, iconLeft, iconLeftUrl, iconRight, iconRightUrl, iconSize, onLeftIconClick, onRightIconClick])\n\n\n return (\n <TextAndContent\n leftContent={leftContent}\n rightContent={rightContent}\n {...props}\n />\n )\n})\n\nTextAndIcons.displayName = 'TextAndIcons'\n"],"names":["TextAndContent","memo","_ref","text","children","components","leftContent","rightContent","textProps","className","props","PropsValidationError","TextComponent","BodyText","React","createElement","LayoutBox","_extends","classes","textAndContent","displayName","TextAndIcons","_ref2","iconSize","iconColor","iconLeft","iconRight","iconLeftUrl","iconRightUrl","onLeftIconClick","onRightIconClick","useMemo","onLeftIconClickProps","onClick","onKeyDown","role","tabIndex","IconBase","iconUrl","size","color","onRightIconClickProps"],"mappings":"wZAiBaA,EAA0CC,GAA0BC,IAStD,IATuDC,KAChFA,EAAIC,SACJA,EAAQC,WACRA,EAAUC,YACVA,EAAWC,aACXA,EAAYC,UACZA,EAAY,CAAE,EAAAC,UACdA,EAAY,MACTC,GACiBR,EACpB,GAAI,MAACC,IAAyCC,EAC5C,MAAM,IAAIO,EAAqB,wCAGjC,MAAMC,EAAgBP,GAAYO,eAAiBC,EAEnD,OACEC,MAAAC,cAACC,EAASC,EAAA,CACRR,UAAW,GAAGS,EAAQC,kBAAkBV,KACpCC,GAEHJ,GAAeA,EAChBQ,MAAAC,cAACH,EAAaK,EAAA,CAACR,UAAU,iBAAoBD,EAAS,CAAE,cAAY,gCAA+BL,GAAQC,GAC1GG,GAAgBA,EACP,IAIhBP,EAAeoB,YAAc,uBAShBC,EAAsCpB,GAAwBqB,IAUlD,IAVmDC,SAC1EA,EAAQC,UACRA,EAASC,SACTA,EAAQC,UACRA,EAASC,YACTA,EAAWC,aACXA,EAAYC,gBACZA,EAAeC,iBACfA,KACGpB,GACeY,EAClB,MAAOhB,EAAaC,GAAgBwB,GAAQ,KAC1C,IAAIzB,EACAC,EAEJ,GAAIkB,GAAYE,EAAa,CAC3B,MAAMK,EAAuBH,EAAmB,CAC9CI,QAASJ,EACTK,UAAWL,EACXM,KAAM,SACNC,UAAW,EACX,cAAe,0BACZ,GAEL9B,EACEQ,MAAAC,cAACsB,EAAQpB,EAAA,CAACqB,QAASX,EAAaY,KAAMhB,EAAUiB,MAAOhB,GAAeQ,GACnEP,GAAYA,EAEnB,CACA,GAAIC,GAAaE,EAAc,CAC7B,MAAMa,EAAwBX,EAAoB,CAChDG,QAASH,EACTI,UAAWJ,EACXK,KAAM,SACNC,UAAW,EACX,cAAe,2BACZ,GAEL7B,EACEO,MAAAC,cAACsB,EAAQpB,EAAA,CAACqB,QAASV,EAAcW,KAAMhB,EAAUiB,MAAOhB,GAAeiB,GACpEf,GAAaA,EAEpB,CACA,MAAO,CAACpB,EAAaC,EAAa,GACjC,CAACiB,EAAWC,EAAUE,EAAaD,EAAWE,EAAcL,EAAUM,EAAiBC,IAG1F,OACEhB,MAAAC,cAACf,EAAciB,EAAA,CACbX,YAAaA,EACbC,aAAcA,GACVG,GACJ,IAINW,EAAaD,YAAc"}
@@ -0,0 +1,2 @@
1
+ var t={textAndContent:"textAndContent-module_textAndContent__X5P1n"};export{t as default};
2
+ //# sourceMappingURL=textAndContent.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textAndContent.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"LayoutBox.js","sources":["../../../../../../../../../src/core/ui/components/container/layoutBox/LayoutBox.tsx"],"sourcesContent":["import { memo, FC, useMemo, CSSProperties, forwardRef, LegacyRef } from 'react'\n\nimport { useParseProps } from '../../../../hooks/useParseProps'\nimport { classNames } from '../../../../utils/helpers/ui'\n\nimport classes from './layoutBox.module.scss'\nimport { LayoutDirection, LayoutBoxProps } from './layoutBox.types'\n\n/**\n * Map of flex values for resolving flex alignment and justification.\n * @type {Record<string, string>}\n */\nconst flexValueMap: Record<string, string> = {\n start: 'flex-start',\n 'flex-start': 'flex-start',\n end: 'flex-end',\n 'flex-end': 'flex-end',\n}\n\n/**\n * Resolves flex alignment and justification properties based on the provided value.\n * @param {string | undefined} value - The value to resolve.\n * @returns {string | undefined} - Resolved flex property value.\n */\nconst resolveFlexProps = (value?: string): string | undefined => (value ? (flexValueMap[value] || value) : value)\n\n/**\n * Forwarded ref version of the LayoutBox component.\n * @param {LayoutBoxProps} props - Props for the LayoutBox component.\n * @param {LegacyRef<HTMLDivElement> | undefined} ref - Ref for accessing the underlying DOM element.\n * @returns {JSX.Element} - Rendered LayoutBox component.\n */\nconst LayoutBoxRefForwarded = forwardRef(({\n id, style, children, tabIndex, className = '', onClick, column, ...props\n}: LayoutBoxProps, ref: LegacyRef<HTMLDivElement> | undefined | null) => {\n const { dataProps, restProps } = useParseProps(props)\n\n /**\n * Memoized onClick event properties.\n * @type {{ onClick?: () => void; onKeyDown?: () => void; role?: string; tabIndex?: number }}\n */\n const onClickProps = useMemo(() => (onClick ? ({\n onClick,\n onKeyDown: onClick,\n role: 'button',\n tabIndex: -1,\n }) : {}), [onClick])\n\n /**\n * Memoized resolved direction based on the column prop.\n * @type {LayoutDirection}\n */\n const resolvedColumn = useMemo(() => ((\n column !== undefined && column === true)\n ? LayoutDirection.COLUMN\n : null), [column])\n\n /**\n * Memoized styles combining parsed props and additional styles.\n * @type {CSSProperties}\n */\n const styles = useMemo(() => (\n {\n ...restProps,\n ...(restProps.align ? { alignItems: resolveFlexProps(restProps.align as string) } : {}),\n ...(restProps.justify ? { justifyContent: resolveFlexProps(restProps.justify as string) } : {}),\n ...(restProps.direction || resolvedColumn ? { flexDirection: restProps.direction || resolvedColumn } : {}),\n ...style,\n }\n ), [resolvedColumn, restProps, style])\n\n return (\n <div\n {...(id ? { id: `${id}` } : {})}\n ref={ref}\n tabIndex={tabIndex}\n className={classNames(\n classes['layout-box'],\n className,\n )}\n style={styles as CSSProperties}\n {...dataProps}\n data-testid={dataProps.dataTestId || dataProps['data-testid'] || id}\n {...onClickProps}\n >\n {children}\n </div>\n )\n})\n\nLayoutBoxRefForwarded.displayName = 'LayoutBoxRefForwarded'\n\n/**\n * Memoized and memoized LayoutBox component.\n * @type {FC<LayoutBoxProps>}\n */\nexport const LayoutBox: FC<LayoutBoxProps> = memo<LayoutBoxProps>(LayoutBoxRefForwarded)\n\nLayoutBox.displayName = 'LayoutBox'\n"],"names":["flexValueMap","start","end","resolveFlexProps","value","LayoutBoxRefForwarded","forwardRef","_ref","ref","id","style","children","tabIndex","className","onClick","column","props","dataProps","restProps","useParseProps","onClickProps","useMemo","onKeyDown","role","resolvedColumn","undefined","LayoutDirection","COLUMN","styles","align","alignItems","justify","justifyContent","direction","flexDirection","React","createElement","_extends","classNames","classes","dataTestId","displayName","LayoutBox","memo"],"mappings":"6WAYA,MAAMA,EAAuC,CAC3CC,MAAO,aACP,aAAc,aACdC,IAAK,WACL,WAAY,YAQRC,EAAoBC,GAAwCA,GAASJ,EAAaI,IAAmBA,EAQrGC,EAAwBC,GAAW,CAAAC,EAEtBC,KAAsD,IAF/BC,GACxCA,EAAEC,MAAEA,EAAKC,SAAEA,EAAQC,SAAEA,EAAQC,UAAEA,EAAY,GAAEC,QAAEA,EAAOC,OAAEA,KAAWC,GACpDT,EACf,MAAMU,UAAEA,EAASC,UAAEA,GAAcC,EAAcH,GAMzCI,EAAeC,GAAQ,IAAOP,EAAW,CAC7CA,UACAQ,UAAWR,EACXS,KAAM,SACNX,UAAW,GACR,CAAG,GAAE,CAACE,IAMLU,EAAiBH,GAAQ,SAClBI,IAAXV,IAAmC,IAAXA,EACtBW,EAAgBC,OAChB,MAAO,CAACZ,IAMNa,EAASP,GAAQ,KACrB,IACKH,KACCA,EAAUW,MAAQ,CAAEC,WAAY3B,EAAiBe,EAAUW,QAAqB,CAAE,KAClFX,EAAUa,QAAU,CAAEC,eAAgB7B,EAAiBe,EAAUa,UAAuB,CAAE,KAC1Fb,EAAUe,WAAaT,EAAiB,CAAEU,cAAehB,EAAUe,WAAaT,GAAmB,CAAE,KACtGd,KAEJ,CAACc,EAAgBN,EAAWR,IAE/B,OACEyB,MAAAC,oBAAAC,EAAA,CAAA,EACO5B,EAAK,CAAEA,GAAI,GAAGA,KAAS,GAAE,CAC9BD,IAAKA,EACLI,SAAUA,EACVC,UAAWyB,EACTC,EAAQ,cACR1B,GAEFH,MAAOkB,GACHX,EAAS,CACb,cAAaA,EAAUuB,YAAcvB,EAAU,gBAAkBR,GAC7DW,GAEHT,EACG,IAIVN,EAAsBoC,YAAc,8BAMvBC,EAAgCC,EAAqBtC,GAElEqC,EAAUD,YAAc"}
1
+ {"version":3,"file":"LayoutBox.js","sources":["../../../../../../../../../src/core/ui/components/container/layoutBox/LayoutBox.tsx"],"sourcesContent":["import { memo, FC, useMemo, CSSProperties, forwardRef, LegacyRef } from 'react'\n\nimport { useParseProps } from '../../../../hooks/useParseProps'\nimport { classNames } from '../../../../utils/helpers/ui'\n\nimport classes from './layoutBox.module.scss'\nimport { LayoutDirection, LayoutBoxProps } from './layoutBox.types'\n\n/**\n * Map of flex values for resolving flex alignment and justification.\n * @type {Record<string, string>}\n */\nconst flexValueMap: Record<string, string> = {\n start: 'flex-start',\n 'flex-start': 'flex-start',\n end: 'flex-end',\n 'flex-end': 'flex-end',\n}\n\n/**\n * Resolves flex alignment and justification properties based on the provided value.\n * @param {string | undefined} value - The value to resolve.\n * @returns {string | undefined} - Resolved flex property value.\n */\nconst resolveFlexProps = (value?: string): string | undefined => (value ? (flexValueMap[value] || value) : value)\n\n/**\n * Forwarded ref version of the LayoutBox component.\n * @param {LayoutBoxProps} props - Props for the LayoutBox component.\n * @param {LegacyRef<HTMLDivElement> | undefined} ref - Ref for accessing the underlying DOM element.\n * @returns {JSX.Element} - Rendered LayoutBox component.\n */\nconst LayoutBoxRefForwarded = forwardRef(({\n id, style, children, tabIndex, className = '', onClick, column, ...props\n}: LayoutBoxProps, ref: LegacyRef<HTMLDivElement> | undefined | null) => {\n const { dataProps, restProps } = useParseProps(props)\n\n /**\n * Memoized onClick event properties.\n * @type {{ onClick?: () => void; onKeyDown?: () => void; role?: string; tabIndex?: number }}\n */\n const onClickProps = useMemo(() => (onClick ? ({\n onClick,\n onKeyDown: onClick,\n role: 'button',\n tabIndex: -1,\n }) : {}), [onClick])\n\n /**\n * Memoized resolved direction based on the column prop.\n * @type {LayoutDirection}\n */\n const resolvedColumn = useMemo(() => ((\n column !== undefined && column === true)\n ? LayoutDirection.COLUMN\n : null), [column])\n\n /**\n * Memoized styles combining parsed props and additional styles.\n * @type {CSSProperties}\n */\n const styles = useMemo(() => (\n {\n ...restProps,\n ...(restProps.align ? { alignItems: resolveFlexProps(restProps.align as string) } : {}),\n ...(restProps.justify ? { justifyContent: resolveFlexProps(restProps.justify as string) } : {}),\n ...(restProps.direction || resolvedColumn ? { flexDirection: restProps.direction || resolvedColumn } : {}),\n ...style,\n }\n ), [resolvedColumn, restProps, style])\n\n return (\n <div\n {...(id ? { id: `${id}` } : {})}\n ref={ref}\n tabIndex={tabIndex}\n className={classNames(\n classes['layout-box'],\n className,\n )}\n style={styles as CSSProperties}\n {...dataProps}\n data-testid={dataProps.dataTestId || dataProps['data-testid'] || id}\n {...onClickProps}\n >\n {children}\n </div>\n )\n})\n\nLayoutBoxRefForwarded.displayName = 'LayoutBoxRefForwarded'\n\n/**\n * Memoized and memoized LayoutBox component.\n * @type {FC<LayoutBoxProps>}\n */\nexport const LayoutBox: FC<LayoutBoxProps> = memo<LayoutBoxProps>(LayoutBoxRefForwarded)\n\nLayoutBox.displayName = 'LayoutBox'\n"],"names":["flexValueMap","start","end","resolveFlexProps","value","LayoutBoxRefForwarded","forwardRef","_ref","ref","id","style","children","tabIndex","className","onClick","column","props","dataProps","restProps","useParseProps","onClickProps","useMemo","onKeyDown","role","resolvedColumn","undefined","LayoutDirection","COLUMN","styles","align","alignItems","justify","justifyContent","direction","flexDirection","React","createElement","_extends","classNames","classes","dataTestId","displayName","LayoutBox","memo"],"mappings":"6WAYA,MAAMA,EAAuC,CAC3CC,MAAO,aACP,aAAc,aACdC,IAAK,WACL,WAAY,YAQRC,EAAoBC,GAAwCA,GAASJ,EAAaI,IAAmBA,EAQrGC,EAAwBC,GAAW,CAAAC,EAEtBC,KAAsD,IAF/BC,GACxCA,EAAEC,MAAEA,EAAKC,SAAEA,EAAQC,SAAEA,EAAQC,UAAEA,EAAY,GAAEC,QAAEA,EAAOC,OAAEA,KAAWC,GACpDT,EACf,MAAMU,UAAEA,EAASC,UAAEA,GAAcC,EAAcH,GAMzCI,EAAeC,GAAQ,IAAOP,EAAW,CAC7CA,UACAQ,UAAWR,EACXS,KAAM,SACNX,UAAW,GACR,CAAG,GAAE,CAACE,IAMLU,EAAiBH,GAAQ,SAClBI,IAAXV,IAAmC,IAAXA,EACtBW,EAAgBC,OAChB,MAAO,CAACZ,IAMNa,EAASP,GAAQ,KACrB,IACKH,KACCA,EAAUW,MAAQ,CAAEC,WAAY3B,EAAiBe,EAAUW,QAAqB,MAChFX,EAAUa,QAAU,CAAEC,eAAgB7B,EAAiBe,EAAUa,UAAuB,MACxFb,EAAUe,WAAaT,EAAiB,CAAEU,cAAehB,EAAUe,WAAaT,GAAmB,MACpGd,KAEJ,CAACc,EAAgBN,EAAWR,IAE/B,OACEyB,MAAAC,oBAAAC,EAAA,CAAA,EACO5B,EAAK,CAAEA,GAAI,GAAGA,KAAS,GAAE,CAC9BD,IAAKA,EACLI,SAAUA,EACVC,UAAWyB,EACTC,EAAQ,cACR1B,GAEFH,MAAOkB,GACHX,EAAS,CACb,cAAaA,EAAUuB,YAAcvB,EAAU,gBAAkBR,GAC7DW,GAEHT,EACG,IAIVN,EAAsBoC,YAAc,8BAMvBC,EAAgCC,EAAqBtC,GAElEqC,EAAUD,YAAc"}
@@ -0,0 +1,2 @@
1
+ class r extends Error{constructor(r){super(r),this.name="PropsValidationError"}}export{r as PropsValidationError};
2
+ //# sourceMappingURL=propsValidationError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"propsValidationError.js","sources":["../../../../../../../../src/core/ui/components/error/propsValidationError.ts"],"sourcesContent":["export class PropsValidationError extends Error {\n constructor(message:string) {\n super(message)\n this.name = 'PropsValidationError'\n }\n}\n"],"names":["PropsValidationError","Error","constructor","message","super","this","name"],"mappings":"AAAO,MAAMA,UAA6BC,MACxCC,WAAAA,CAAYC,GACVC,MAAMD,GACNE,KAAKC,KAAO,sBACd"}
@@ -1 +1 @@
1
- {"version":3,"file":"IconBase.js","sources":["../../../../../../../../src/core/ui/components/icon/IconBase.tsx"],"sourcesContent":["import { CSSProperties, memo, useMemo, FC, PropsWithChildren, MouseEvent } from 'react'\n\nimport classes from './icon.module.scss'\nimport { unifyIconUrl } from './unifyIconUrl'\n\n\nexport type IconBaseType = PropsWithChildren<unknown> & {\n id?: string\n iconUrl?: string | null\n minWidth?: string | null\n minHeight?: string | null\n width?: string | null\n height?: string | null\n size?: string | null\n fontSize?: string | null\n color?: string | null\n className?: string | null\n style?: CSSProperties | null\n onClick?: (event?: MouseEvent<HTMLSpanElement> | undefined) => void\n}\n\nexport const IconBase: FC<IconBaseType> = memo<IconBaseType>(({\n iconUrl, minWidth, minHeight, size,\n fontSize, width, height, color = 'currentColor', className = '', children, style, onClick, ...props\n}: IconBaseType) => {\n const unifiedIconUrl = iconUrl && unifyIconUrl(iconUrl)\n\n const styles = useMemo(() => (\n {\n '--min-width': minWidth || size || width || 'auto',\n '--min-height': minHeight || size || height || 'auto',\n '--width': size || width || '1rem',\n '--height': size || height || '1rem',\n ...(fontSize ? { fontSize } : {}),\n ...(unifiedIconUrl ? { '--icon-url': `url(${unifiedIconUrl})` } : {}),\n ...(unifiedIconUrl ? { '--icon-color': color } : { '--icon-content-color': color }),\n ...(onClick ? { cursor: 'pointer' } : {}),\n ...style,\n }\n ), [minWidth, size, width, minHeight, height, fontSize, unifiedIconUrl, color, onClick, style])\n\n const onClickProps = useMemo(() => (onClick ? ({\n onClick,\n role: 'button',\n tabIndex: -1,\n }) : {}), [onClick])\n\n return (\n <span\n {...props}\n {...onClickProps}\n className={`${classes['icon-base']} icon-base ${className}`}\n style={styles as CSSProperties}\n >\n {(!unifiedIconUrl && children) && children}\n </span>\n )\n})\n\nIconBase.displayName = 'IconBase'\n"],"names":["IconBase","memo","_ref","iconUrl","minWidth","minHeight","size","fontSize","width","height","color","className","children","style","onClick","props","unifiedIconUrl","unifyIconUrl","styles","useMemo","cursor","onClickProps","role","tabIndex","React","createElement","_extends","classes","displayName"],"mappings":"qNAqBaA,EAA6BC,GAAmBC,IAGzC,IAH0CC,QAC5DA,EAAOC,SAAEA,EAAQC,UAAEA,EAASC,KAAEA,EAAIC,SAClCA,EAAQC,MAAEA,EAAKC,OAAEA,EAAMC,MAAEA,EAAQ,eAAcC,UAAEA,EAAY,GAAEC,SAAEA,EAAQC,MAAEA,EAAKC,QAAEA,KAAYC,GACjFb,EACb,MAAMc,EAAiBb,GAAWc,EAAad,GAEzCe,EAASC,GAAQ,KACrB,CACE,cAAef,GAAYE,GAAQE,GAAS,OAC5C,eAAgBH,GAAaC,GAAQG,GAAU,OAC/C,UAAWH,GAAQE,GAAS,OAC5B,WAAYF,GAAQG,GAAU,UAC1BF,EAAW,CAAEA,YAAa,CAAE,KAC5BS,EAAiB,CAAE,aAAc,OAAOA,MAAsB,CAAE,KAChEA,EAAiB,CAAE,eAAgBN,GAAU,CAAE,uBAAwBA,MACvEI,EAAU,CAAEM,OAAQ,WAAc,CAAE,KACrCP,KAEJ,CAACT,EAAUE,EAAME,EAAOH,EAAWI,EAAQF,EAAUS,EAAgBN,EAAOI,EAASD,IAElFQ,EAAeF,GAAQ,IAAOL,EAAW,CAC7CA,UACAQ,KAAM,SACNC,UAAW,GACR,CAAG,GAAE,CAACT,IAEX,OACEU,MAAAC,cAAA,OAAAC,EACMX,CAAAA,EAAAA,EACAM,EAAY,CAChBV,UAAW,GAAGgB,EAAQ,0BAA0BhB,IAChDE,MAAOK,KAEJF,GAAkBJ,GAAaA,EAC7B,IAIXZ,EAAS4B,YAAc"}
1
+ {"version":3,"file":"IconBase.js","sources":["../../../../../../../../src/core/ui/components/icon/IconBase.tsx"],"sourcesContent":["import { CSSProperties, memo, useMemo, FC, PropsWithChildren, MouseEvent } from 'react'\n\nimport classes from './icon.module.scss'\nimport { unifyIconUrl } from './unifyIconUrl'\n\n\nexport type IconBaseType = PropsWithChildren<unknown> & {\n id?: string\n iconUrl?: string | null\n minWidth?: string | null\n minHeight?: string | null\n width?: string | null\n height?: string | null\n size?: string | null\n fontSize?: string | null\n color?: string | null\n className?: string | null\n style?: CSSProperties | null\n onClick?: (event?: MouseEvent<HTMLSpanElement> | undefined) => void\n}\n\nexport const IconBase: FC<IconBaseType> = memo<IconBaseType>(({\n iconUrl, minWidth, minHeight, size,\n fontSize, width, height, color = 'currentColor', className = '', children, style, onClick, ...props\n}: IconBaseType) => {\n const unifiedIconUrl = iconUrl && unifyIconUrl(iconUrl)\n\n const styles = useMemo(() => (\n {\n '--min-width': minWidth || size || width || 'auto',\n '--min-height': minHeight || size || height || 'auto',\n '--width': size || width || '1rem',\n '--height': size || height || '1rem',\n ...(fontSize ? { fontSize } : {}),\n ...(unifiedIconUrl ? { '--icon-url': `url(${unifiedIconUrl})` } : {}),\n ...(unifiedIconUrl ? { '--icon-color': color } : { '--icon-content-color': color }),\n ...(onClick ? { cursor: 'pointer' } : {}),\n ...style,\n }\n ), [minWidth, size, width, minHeight, height, fontSize, unifiedIconUrl, color, onClick, style])\n\n const onClickProps = useMemo(() => (onClick ? ({\n onClick,\n role: 'button',\n tabIndex: -1,\n }) : {}), [onClick])\n\n return (\n <span\n {...props}\n {...onClickProps}\n className={`${classes['icon-base']} icon-base ${className}`}\n style={styles as CSSProperties}\n >\n {(!unifiedIconUrl && children) && children}\n </span>\n )\n})\n\nIconBase.displayName = 'IconBase'\n"],"names":["IconBase","memo","_ref","iconUrl","minWidth","minHeight","size","fontSize","width","height","color","className","children","style","onClick","props","unifiedIconUrl","unifyIconUrl","styles","useMemo","cursor","onClickProps","role","tabIndex","React","createElement","_extends","classes","displayName"],"mappings":"qNAqBaA,EAA6BC,GAAmBC,IAGzC,IAH0CC,QAC5DA,EAAOC,SAAEA,EAAQC,UAAEA,EAASC,KAAEA,EAAIC,SAClCA,EAAQC,MAAEA,EAAKC,OAAEA,EAAMC,MAAEA,EAAQ,eAAcC,UAAEA,EAAY,GAAEC,SAAEA,EAAQC,MAAEA,EAAKC,QAAEA,KAAYC,GACjFb,EACb,MAAMc,EAAiBb,GAAWc,EAAad,GAEzCe,EAASC,GAAQ,KACrB,CACE,cAAef,GAAYE,GAAQE,GAAS,OAC5C,eAAgBH,GAAaC,GAAQG,GAAU,OAC/C,UAAWH,GAAQE,GAAS,OAC5B,WAAYF,GAAQG,GAAU,UAC1BF,EAAW,CAAEA,YAAa,MAC1BS,EAAiB,CAAE,aAAc,OAAOA,MAAsB,MAC9DA,EAAiB,CAAE,eAAgBN,GAAU,CAAE,uBAAwBA,MACvEI,EAAU,CAAEM,OAAQ,WAAc,MACnCP,KAEJ,CAACT,EAAUE,EAAME,EAAOH,EAAWI,EAAQF,EAAUS,EAAgBN,EAAOI,EAASD,IAElFQ,EAAeF,GAAQ,IAAOL,EAAW,CAC7CA,UACAQ,KAAM,SACNC,UAAW,GACR,CAAG,GAAE,CAACT,IAEX,OACEU,MAAAC,cAAA,OAAAC,EACMX,CAAAA,EAAAA,EACAM,EAAY,CAChBV,UAAW,GAAGgB,EAAQ,0BAA0BhB,IAChDE,MAAOK,KAEJF,GAAkBJ,GAAaA,EAC7B,IAIXZ,EAAS4B,YAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"IconWC.js","sources":["../../../../../../../../src/core/ui/components/icon/IconWC.ts"],"sourcesContent":["import { ced, resolveAttributes } from '../../../utils/webComponents/webComponent.utils'\n\nimport classes from './icon.module.scss'\n\n\nconst template = document.createElement('template')\n\ntemplate.innerHTML = '<span class=\"icon-base\"></span>'\n\nexport type IconBaseWCType = {\n iconUrl?: string\n minWidth?: string\n minHeight?: string\n width?: string\n height?: string\n size?: string\n fontSize?: string\n color?: string\n className?: string\n}\n\n@ced('icon-base')\nexport class ESIcon extends HTMLElement {\n content: string | null\n\n mainElement: HTMLElement\n\n iconUrl?: string | null\n\n minWidth?: string | null\n\n minHeight?: string | null\n\n width?: string | null\n\n height?: string | null\n\n size?: string | null\n\n fontSize?: string | null\n\n color?: string | null\n\n static get observedAttributes(): string[] {\n return ['iconUrl', 'minWidth', 'minHeight', 'width', 'height', 'size', 'fontSize', 'color', 'className']\n }\n\n connectedCallback(): void {\n if (this.content || this.innerHTML) {\n this.content = this.content || this.innerHTML || this.getAttribute('content')\n }\n\n this.innerHTML = template.innerHTML\n\n resolveAttributes(this, ESIcon.observedAttributes)\n\n this.render()\n }\n\n attributeChangedCallback(attrName: string, oldVal: string | number | null, newVal: string | number | null): void {\n if (attrName === 'className' || attrName === 'classname' || attrName === 'class') {\n if (typeof newVal === 'string') {\n this.classList.remove(newVal as string)\n this.classList.add(newVal as string)\n }\n }\n if (!this.color) {\n this.color = 'currentColor'\n }\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this[attrName] = (newVal as string) || ''\n this.render()\n }\n\n render = (): void => {\n this.mainElement = this.mainElement || this.querySelector('.icon-base') as HTMLElement\n if (!this.mainElement) {\n return\n }\n this.classList.add(classes['icon-base-parent'])\n this.mainElement.classList.add(classes['icon-base'])\n\n const styles = {\n '--min-width': this.minWidth || this.size || this.width || 'auto',\n '--min-height': this.minHeight || this.size || this.height || 'auto',\n '--width': this.size || this.width || '1rem',\n '--height': this.size || this.height || '1rem',\n ...(this.fontSize ? { 'font-size': this.fontSize || 'unset' } : {}),\n ...(this.iconUrl ? { '--icon-url': `url(${this.iconUrl})` } : {}),\n ...(this.iconUrl ? { '--icon-color': this.color } : { '--icon-content-color': this.color }),\n }\n\n this.mainElement.innerHTML = this.iconUrl ? '' : (this.content || '')\n\n this.mainElement.setAttribute('style', Object.entries(styles).map(([key, value]) => `${key}: ${value};`).join(' '))\n }\n}\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n 'icon-base': any\n }\n }\n}\n\nexport const ESIconBase = {\n ESIconBase: ESIcon,\n}\n"],"names":["template","document","createElement","innerHTML","ESIcon","ced","_dec","_class","HTMLElement","constructor","super","arguments","this","content","mainElement","iconUrl","minWidth","minHeight","width","height","size","fontSize","color","render","querySelector","classList","add","classes","styles","setAttribute","Object","entries","map","_ref","key","value","join","observedAttributes","connectedCallback","getAttribute","resolveAttributes","attributeChangedCallback","attrName","oldVal","newVal","remove","ESIconBase"],"mappings":"2IAKA,MAAMA,EAAWC,SAASC,cAAc,YAExCF,EAASG,UAAY,kCAcrB,IACaC,EADZC,EAAI,YAAYC,CAAAC,EAAjB,MACaH,UAAeI,YAAYC,WAAAA,GAAAC,SAAAC,WAAAC,KACtCC,aAAO,EAAAD,KAEPE,iBAAW,EAAAF,KAEXG,aAAO,EAAAH,KAEPI,cAAQ,EAAAJ,KAERK,eAAS,EAAAL,KAETM,WAAK,EAAAN,KAELO,YAAM,EAAAP,KAENQ,UAAI,EAAAR,KAEJS,cAAQ,EAAAT,KAERU,WAAK,EAAAV,KAkCLW,OAAS,KAEP,GADAX,KAAKE,YAAcF,KAAKE,aAAeF,KAAKY,cAAc,eACrDZ,KAAKE,YACR,OAEFF,KAAKa,UAAUC,IAAIC,EAAQ,qBAC3Bf,KAAKE,YAAYW,UAAUC,IAAIC,EAAQ,cAEvC,MAAMC,EAAS,CACb,cAAehB,KAAKI,UAAYJ,KAAKQ,MAAQR,KAAKM,OAAS,OAC3D,eAAgBN,KAAKK,WAAaL,KAAKQ,MAAQR,KAAKO,QAAU,OAC9D,UAAWP,KAAKQ,MAAQR,KAAKM,OAAS,OACtC,WAAYN,KAAKQ,MAAQR,KAAKO,QAAU,UACpCP,KAAKS,SAAW,CAAE,YAAaT,KAAKS,UAAY,SAAY,CAAE,KAC9DT,KAAKG,QAAU,CAAE,aAAc,OAAOH,KAAKG,YAAe,CAAE,KAC5DH,KAAKG,QAAU,CAAE,eAAgBH,KAAKU,OAAU,CAAE,uBAAwBV,KAAKU,QAGrFV,KAAKE,YAAYX,UAAYS,KAAKG,QAAU,GAAMH,KAAKC,SAAW,GAElED,KAAKE,YAAYe,aAAa,QAASC,OAAOC,QAAQH,GAAQI,KAAIC,IAAA,IAAEC,EAAKC,GAAMF,EAAA,MAAK,GAAGC,MAAQC,IAAQ,IAAEC,KAAK,KAAK,CACpH,CArDD,6BAAWC,GACT,MAAO,CAAC,UAAW,WAAY,YAAa,QAAS,SAAU,OAAQ,WAAY,QAAS,YAC9F,CAEAC,iBAAAA,IACM1B,KAAKC,SAAWD,KAAKT,aACvBS,KAAKC,QAAUD,KAAKC,SAAWD,KAAKT,WAAaS,KAAK2B,aAAa,YAGrE3B,KAAKT,UAAYH,EAASG,UAE1BqC,EAAkB5B,KAAMR,EAAOiC,oBAE/BzB,KAAKW,QACP,CAEAkB,wBAAAA,CAAyBC,EAAkBC,EAAgCC,GACxD,cAAbF,GAAyC,cAAbA,GAAyC,UAAbA,GACpC,iBAAXE,IACThC,KAAKa,UAAUoB,OAAOD,GACtBhC,KAAKa,UAAUC,IAAIkB,IAGlBhC,KAAKU,QACRV,KAAKU,MAAQ,gBAIfV,KAAK8B,GAAaE,GAAqB,GACvChC,KAAKW,QACP,KAwBDhB,EAWM,MAAMuC,EAAa,CACxBA,WAAY1C"}
1
+ {"version":3,"file":"IconWC.js","sources":["../../../../../../../../src/core/ui/components/icon/IconWC.ts"],"sourcesContent":["import { ced, resolveAttributes } from '../../../utils/webComponents/webComponent.utils'\n\nimport classes from './icon.module.scss'\n\n\nconst template = document.createElement('template')\n\ntemplate.innerHTML = '<span class=\"icon-base\"></span>'\n\nexport type IconBaseWCType = {\n iconUrl?: string\n minWidth?: string\n minHeight?: string\n width?: string\n height?: string\n size?: string\n fontSize?: string\n color?: string\n className?: string\n}\n\n@ced('icon-base')\nexport class ESIcon extends HTMLElement {\n content: string | null\n\n mainElement: HTMLElement\n\n iconUrl?: string | null\n\n minWidth?: string | null\n\n minHeight?: string | null\n\n width?: string | null\n\n height?: string | null\n\n size?: string | null\n\n fontSize?: string | null\n\n color?: string | null\n\n static get observedAttributes(): string[] {\n return ['iconUrl', 'minWidth', 'minHeight', 'width', 'height', 'size', 'fontSize', 'color', 'className']\n }\n\n connectedCallback(): void {\n if (this.content || this.innerHTML) {\n this.content = this.content || this.innerHTML || this.getAttribute('content')\n }\n\n this.innerHTML = template.innerHTML\n\n resolveAttributes(this, ESIcon.observedAttributes)\n\n this.render()\n }\n\n attributeChangedCallback(attrName: string, oldVal: string | number | null, newVal: string | number | null): void {\n if (attrName === 'className' || attrName === 'classname' || attrName === 'class') {\n if (typeof newVal === 'string') {\n this.classList.remove(newVal as string)\n this.classList.add(newVal as string)\n }\n }\n if (!this.color) {\n this.color = 'currentColor'\n }\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this[attrName] = (newVal as string) || ''\n this.render()\n }\n\n render = (): void => {\n this.mainElement = this.mainElement || this.querySelector('.icon-base') as HTMLElement\n if (!this.mainElement) {\n return\n }\n this.classList.add(classes['icon-base-parent'])\n this.mainElement.classList.add(classes['icon-base'])\n\n const styles = {\n '--min-width': this.minWidth || this.size || this.width || 'auto',\n '--min-height': this.minHeight || this.size || this.height || 'auto',\n '--width': this.size || this.width || '1rem',\n '--height': this.size || this.height || '1rem',\n ...(this.fontSize ? { 'font-size': this.fontSize || 'unset' } : {}),\n ...(this.iconUrl ? { '--icon-url': `url(${this.iconUrl})` } : {}),\n ...(this.iconUrl ? { '--icon-color': this.color } : { '--icon-content-color': this.color }),\n }\n\n this.mainElement.innerHTML = this.iconUrl ? '' : (this.content || '')\n\n this.mainElement.setAttribute('style', Object.entries(styles).map(([key, value]) => `${key}: ${value};`).join(' '))\n }\n}\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n 'icon-base': any\n }\n }\n}\n\nexport const ESIconBase = {\n ESIconBase: ESIcon,\n}\n"],"names":["template","document","createElement","innerHTML","ESIcon","ced","_dec","_class","HTMLElement","constructor","super","arguments","this","content","mainElement","iconUrl","minWidth","minHeight","width","height","size","fontSize","color","render","querySelector","classList","add","classes","styles","setAttribute","Object","entries","map","_ref","key","value","join","observedAttributes","connectedCallback","getAttribute","resolveAttributes","attributeChangedCallback","attrName","oldVal","newVal","remove","ESIconBase"],"mappings":"2IAKA,MAAMA,EAAWC,SAASC,cAAc,YAExCF,EAASG,UAAY,kCAcrB,IACaC,EADZC,EAAI,YAAYC,CAAAC,EAAjB,MACaH,UAAeI,YAAYC,WAAAA,GAAAC,SAAAC,WAAAC,KACtCC,aAAO,EAAAD,KAEPE,iBAAW,EAAAF,KAEXG,aAAO,EAAAH,KAEPI,cAAQ,EAAAJ,KAERK,eAAS,EAAAL,KAETM,WAAK,EAAAN,KAELO,YAAM,EAAAP,KAENQ,UAAI,EAAAR,KAEJS,cAAQ,EAAAT,KAERU,WAAK,EAAAV,KAkCLW,OAAS,KAEP,GADAX,KAAKE,YAAcF,KAAKE,aAAeF,KAAKY,cAAc,eACrDZ,KAAKE,YACR,OAEFF,KAAKa,UAAUC,IAAIC,EAAQ,qBAC3Bf,KAAKE,YAAYW,UAAUC,IAAIC,EAAQ,cAEvC,MAAMC,EAAS,CACb,cAAehB,KAAKI,UAAYJ,KAAKQ,MAAQR,KAAKM,OAAS,OAC3D,eAAgBN,KAAKK,WAAaL,KAAKQ,MAAQR,KAAKO,QAAU,OAC9D,UAAWP,KAAKQ,MAAQR,KAAKM,OAAS,OACtC,WAAYN,KAAKQ,MAAQR,KAAKO,QAAU,UACpCP,KAAKS,SAAW,CAAE,YAAaT,KAAKS,UAAY,SAAY,MAC5DT,KAAKG,QAAU,CAAE,aAAc,OAAOH,KAAKG,YAAe,MAC1DH,KAAKG,QAAU,CAAE,eAAgBH,KAAKU,OAAU,CAAE,uBAAwBV,KAAKU,QAGrFV,KAAKE,YAAYX,UAAYS,KAAKG,QAAU,GAAMH,KAAKC,SAAW,GAElED,KAAKE,YAAYe,aAAa,QAASC,OAAOC,QAAQH,GAAQI,KAAIC,IAAA,IAAEC,EAAKC,GAAMF,EAAA,MAAK,GAAGC,MAAQC,IAAQ,IAAEC,KAAK,KAAK,CACpH,CArDD,6BAAWC,GACT,MAAO,CAAC,UAAW,WAAY,YAAa,QAAS,SAAU,OAAQ,WAAY,QAAS,YAC9F,CAEAC,iBAAAA,IACM1B,KAAKC,SAAWD,KAAKT,aACvBS,KAAKC,QAAUD,KAAKC,SAAWD,KAAKT,WAAaS,KAAK2B,aAAa,YAGrE3B,KAAKT,UAAYH,EAASG,UAE1BqC,EAAkB5B,KAAMR,EAAOiC,oBAE/BzB,KAAKW,QACP,CAEAkB,wBAAAA,CAAyBC,EAAkBC,EAAgCC,GACxD,cAAbF,GAAyC,cAAbA,GAAyC,UAAbA,GACpC,iBAAXE,IACThC,KAAKa,UAAUoB,OAAOD,GACtBhC,KAAKa,UAAUC,IAAIkB,IAGlBhC,KAAKU,QACRV,KAAKU,MAAQ,gBAIfV,KAAK8B,GAAaE,GAAqB,GACvChC,KAAKW,QACP,KAwBDhB,EAWM,MAAMuC,EAAa,CACxBA,WAAY1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"Popup.js","sources":["../../../../../../../../../src/core/ui/components/molecules/popup/Popup.tsx"],"sourcesContent":["import {\n cloneElement, memo, PropsWithChildren, FC, ReactNode, CSSProperties, useMemo, ReactElement,\n} from 'react'\n\nimport { Popover as PopoverLite } from '../popover/PopoverLite'\nimport { HeadlineTertiary as H3 } from '../../atoms/text'\nimport { IconBase } from '../../icon'\nimport { DividerLine } from '../../dividers'\nimport { LayoutBox } from '../../container'\nimport { closeIconJSX } from '../../atoms/icons'\n\nimport classes from './popup.module.scss'\nimport classesOverlay from './popup.overlay.module.scss'\nimport { PopupAnimateVariant, PopupProps } from './popup.types'\n\n\n/**\n * Styles for the Popup component.\n *\n * @typedef {Object} PopupStyles\n * @property {Object} inner - The inner styles for the popup.\n * @property {CSSProperties} content - The styles for the popup content.\n */\n\nconst styles: {\n popup: {\n inner: Record<string, Record<string, string>>\n }\n\n} = {\n popup: {\n inner: {\n [PopupAnimateVariant.SLIDE_DOWN]: { '--slideYFrom': '-48px' },\n [PopupAnimateVariant.SLIDE_UP]: { '--slideYFrom': '48px' },\n [PopupAnimateVariant.SLIDE_RIGHT]: { '--slideXFrom': '-64px' },\n [PopupAnimateVariant.SLIDE_LEFT]: { '--slideXFrom': '64px' },\n },\n },\n}\n\n/**\n * Popup component.\n *\n * @type {React.FC<PopupProps>}\n * @returns {React.ReactElement} The Popup.\n */\nexport const Popup: FC<PopupProps> = memo<PopupProps>(({\n title = 'Popup\\'s title',\n children,\n components = {},\n isModal = true,\n hideOnClickOutside = false,\n hideOnContentClick = false,\n animateVariant = PopupAnimateVariant.SLIDE_UP,\n hasHeader = true,\n hasCloseIcon = true,\n width,\n height,\n style,\n ...props\n}: PopupProps) => {\n /**\n * The ContentComponent to render.\n *\n * @type {ComponentType}\n */\n const ContentComponent = components?.ContentComponent\n\n /**\n * The popup styles.\n *\n * @type {CSSProperties}\n */\n const styles = useMemo(() => ({\n ...(width ? { '--popup-width': width } : {}),\n ...(height ? { '--popup-height': height } : {}),\n ...style,\n }), [height, style, width])\n\n return (\n <PopoverLite\n clickable\n isPopup\n isModal={isModal}\n hideOnContentClick={hideOnContentClick}\n hideOnClickOutside={hideOnClickOutside}\n modalOverlayClassName={classesOverlay['popup-modal-overlay']}\n {...props}\n >\n <p>{/* Placeholder element to avoid error with no children */}</p>\n <PopupContent\n title={title}\n hasHeader={hasHeader}\n hasCloseIcon={hasCloseIcon}\n animateVariant={animateVariant}\n popupStyle={styles}\n >\n {/* Render children if ContentComponent is not provided */}\n {(!ContentComponent && children) && children}\n {/* Render ContentComponent if children are not provided */}\n {(!children && ContentComponent) && <ContentComponent />}\n </PopupContent>\n </PopoverLite>\n )\n})\n\n/**\n * The display name of the Popup component.\n *\n * @type {string}\n */\nPopup.displayName = 'Popup'\n\ntype PopupContentProps = PropsWithChildren<unknown> & {\n title?: string\n forwardedRef?: ForwardedRef['forwardedRef']\n animateVariant?: PopupProps['animateVariant']\n popupStyle?: CSSProperties\n hasHeader?: boolean\n hasCloseIcon?: boolean\n closeIconURL?: string\n hide?: () => void\n}\n\n/**\n * The PopupContent component.\n *\n * @param {PopupContentProps} props The props for the PopupContent component.\n * @returns {React.ReactElement} The PopupContent.\n */\nconst PopupContent = memo(({\n title,\n forwardedRef,\n hide,\n children,\n animateVariant,\n popupStyle,\n hasHeader = true,\n hasCloseIcon = true,\n closeIconURL,\n ...props\n}: PopupContentProps) => {\n /**\n * The ContentRemapped element.\n *\n * @type {React.ReactElement[] | React.ReactElement}\n */\n const ContentRemapped = children && Array.isArray(children)\n ? children.filter((child: ReactNode | ReactElement) => !!child)\n .map((child: ReactElement, index: number) => cloneElement(\n // eslint-disable-next-line react/no-array-index-key\n child, { key: index, ...child.props, hide, ...props },\n ))\n : <div>Pseudo Content</div>\n\n return (\n <div className={`${classes['popup-container']}`} ref={forwardedRef} style={popupStyle}>\n <LayoutBox\n className={`${classes['popup-container-inner']}`}\n style={animateVariant ? styles.popup.inner[animateVariant] : null}\n >\n {hasHeader && (\n <>\n <LayoutBox justify='space-between' align='start' width='100%' padding='20px 20px 16px 20px'>\n <H3>{title}</H3>\n {hasCloseIcon && (\n <div\n onClick={hide}\n onKeyDown={hide}\n role='button'\n tabIndex={-1}\n className={classes['close-button']}\n >\n {closeIconURL && <IconBase iconUrl={closeIconURL} />}\n {!closeIconURL && (\n <IconBase>\n {closeIconJSX}\n </IconBase>\n )}\n </div>\n )}\n </LayoutBox>\n <DividerLine length='100%' />\n </>\n )}\n <div className={classes['popup-container-inner-div']}>\n {ContentRemapped && ContentRemapped}\n </div>\n </LayoutBox>\n </div>\n )\n})\n\n/**\n * The display name of the PopupContent component.\n *\n * @type {string}\n */\nPopupContent.displayName = 'PopupContent'\n"],"names":["styles","popup","inner","PopupAnimateVariant","SLIDE_DOWN","SLIDE_UP","SLIDE_RIGHT","SLIDE_LEFT","Popup","memo","_ref","title","children","components","isModal","hideOnClickOutside","hideOnContentClick","animateVariant","hasHeader","hasCloseIcon","width","height","style","props","ContentComponent","useMemo","React","createElement","PopoverLite","_extends","clickable","isPopup","modalOverlayClassName","classesOverlay","PopupContent","popupStyle","displayName","_ref2","forwardedRef","hide","closeIconURL","ContentRemapped","Array","isArray","filter","child","map","index","cloneElement","key","className","classes","ref","LayoutBox","Fragment","justify","align","padding","H3","onClick","onKeyDown","role","tabIndex","IconBase","iconUrl","closeIconJSX","DividerLine","length"],"mappings":"knBAwBA,MAAMA,EAKF,CACFC,MAAO,CACLC,MAAO,CACL,CAACC,EAAoBC,YAAa,CAAE,eAAgB,SACpD,CAACD,EAAoBE,UAAW,CAAE,eAAgB,QAClD,CAACF,EAAoBG,aAAc,CAAE,eAAgB,SACrD,CAACH,EAAoBI,YAAa,CAAE,eAAgB,WAW7CC,EAAwBC,GAAiBC,IAcpC,IAdqCC,MACrDA,EAAQ,gBAAgBC,SACxBA,EAAQC,WACRA,EAAa,CAAE,EAAAC,QACfA,GAAU,EAAIC,mBACdA,GAAqB,EAAKC,mBAC1BA,GAAqB,EAAKC,eAC1BA,EAAiBd,EAAoBE,SAAQa,UAC7CA,GAAY,EAAIC,aAChBA,GAAe,EAAIC,MACnBA,EAAKC,OACLA,EAAMC,MACNA,KACGC,GACQb,EAMX,MAAMc,EAAmBX,GAAYW,iBAO/BxB,EAASyB,GAAQ,KAAO,IACxBL,EAAQ,CAAE,gBAAiBA,GAAU,CAAE,KACvCC,EAAS,CAAE,iBAAkBA,GAAW,CAAE,KAC3CC,KACD,CAACD,EAAQC,EAAOF,IAEpB,OACEM,MAAAC,cAACC,EAAWC,EAAA,CACVC,WAAS,EACTC,SAAO,EACPjB,QAASA,EACTE,mBAAoBA,EACpBD,mBAAoBA,EACpBiB,sBAAuBC,EAAe,wBAClCV,GAEJG,MAAAC,cAAA,IAAA,MACAD,MAAAC,cAACO,EAAY,CACXvB,MAAOA,EACPO,UAAWA,EACXC,aAAcA,EACdF,eAAgBA,EAChBkB,WAAYnC,IAGTwB,GAAoBZ,GAAaA,GAEjCA,GAAYY,GAAqBE,MAAAC,cAACH,EAAkB,OAE7C,IASlBhB,EAAM4B,YAAc,QAmBpB,MAAMF,EAAezB,GAAK4B,IAWD,IAXE1B,MACzBA,EAAK2B,aACLA,EAAYC,KACZA,EAAI3B,SACJA,EAAQK,eACRA,EAAckB,WACdA,EAAUjB,UACVA,GAAY,EAAIC,aAChBA,GAAe,EAAIqB,aACnBA,KACGjB,GACec,EAMlB,MAAMI,EAAkB7B,GAAY8B,MAAMC,QAAQ/B,GAC9CA,EAASgC,QAAQC,KAAsCA,IACtDC,KAAI,CAACD,EAAqBE,IAAkBC,EAE3CH,EAAO,CAAEI,IAAKF,KAAUF,EAAMtB,MAAOgB,UAAShB,MAEhDG,MAAAC,cAAA,MAAA,KAAK,kBAET,OACED,MAAAC,cAAA,MAAA,CAAKuB,UAAW,GAAGC,EAAQ,qBAAsBC,IAAKd,EAAchB,MAAOa,GACzET,MAAAC,cAAC0B,EAAS,CACRH,UAAW,GAAGC,EAAQ,2BACtB7B,MAAOL,EAAiBjB,EAAOC,MAAMC,MAAMe,GAAkB,MAE5DC,GACCQ,MAAAC,cAAAD,MAAA4B,SACE5B,KAAAA,MAAAC,cAAC0B,EAAS,CAACE,QAAQ,gBAAgBC,MAAM,QAAQpC,MAAM,OAAOqC,QAAQ,uBACpE/B,MAAAC,cAAC+B,EAAE,KAAE/C,GACJQ,GACCO,MAAAC,cAAA,MAAA,CACEgC,QAASpB,EACTqB,UAAWrB,EACXsB,KAAK,SACLC,UAAW,EACXZ,UAAWC,EAAQ,iBAElBX,GAAgBd,MAAAC,cAACoC,EAAQ,CAACC,QAASxB,KAClCA,GACAd,MAAAC,cAACoC,OACEE,KAMXvC,MAAAC,cAACuC,EAAW,CAACC,OAAO,UAGxBzC,MAAAC,cAAA,MAAA,CAAKuB,UAAWC,EAAQ,8BACrBV,GAAmBA,IAGpB,IASVP,EAAaE,YAAc"}
1
+ {"version":3,"file":"Popup.js","sources":["../../../../../../../../../src/core/ui/components/molecules/popup/Popup.tsx"],"sourcesContent":["import {\n cloneElement, memo, PropsWithChildren, FC, ReactNode, CSSProperties, useMemo, ReactElement,\n} from 'react'\n\nimport { Popover as PopoverLite } from '../popover/PopoverLite'\nimport { HeadlineTertiary as H3 } from '../../atoms/text'\nimport { IconBase } from '../../icon'\nimport { DividerLine } from '../../dividers'\nimport { LayoutBox } from '../../container'\nimport { closeIconJSX } from '../../atoms/icons'\n\nimport classes from './popup.module.scss'\nimport classesOverlay from './popup.overlay.module.scss'\nimport { PopupAnimateVariant, PopupProps } from './popup.types'\n\n\n/**\n * Styles for the Popup component.\n *\n * @typedef {Object} PopupStyles\n * @property {Object} inner - The inner styles for the popup.\n * @property {CSSProperties} content - The styles for the popup content.\n */\n\nconst styles: {\n popup: {\n inner: Record<string, Record<string, string>>\n }\n\n} = {\n popup: {\n inner: {\n [PopupAnimateVariant.SLIDE_DOWN]: { '--slideYFrom': '-48px' },\n [PopupAnimateVariant.SLIDE_UP]: { '--slideYFrom': '48px' },\n [PopupAnimateVariant.SLIDE_RIGHT]: { '--slideXFrom': '-64px' },\n [PopupAnimateVariant.SLIDE_LEFT]: { '--slideXFrom': '64px' },\n },\n },\n}\n\n/**\n * Popup component.\n *\n * @type {React.FC<PopupProps>}\n * @returns {React.ReactElement} The Popup.\n */\nexport const Popup: FC<PopupProps> = memo<PopupProps>(({\n title = 'Popup\\'s title',\n children,\n components = {},\n isModal = true,\n hideOnClickOutside = false,\n hideOnContentClick = false,\n animateVariant = PopupAnimateVariant.SLIDE_UP,\n hasHeader = true,\n hasCloseIcon = true,\n width,\n height,\n style,\n ...props\n}: PopupProps) => {\n /**\n * The ContentComponent to render.\n *\n * @type {ComponentType}\n */\n const ContentComponent = components?.ContentComponent\n\n /**\n * The popup styles.\n *\n * @type {CSSProperties}\n */\n const styles = useMemo(() => ({\n ...(width ? { '--popup-width': width } : {}),\n ...(height ? { '--popup-height': height } : {}),\n ...style,\n }), [height, style, width])\n\n return (\n <PopoverLite\n clickable\n isPopup\n isModal={isModal}\n hideOnContentClick={hideOnContentClick}\n hideOnClickOutside={hideOnClickOutside}\n modalOverlayClassName={classesOverlay['popup-modal-overlay']}\n {...props}\n >\n <p>{/* Placeholder element to avoid error with no children */}</p>\n <PopupContent\n title={title}\n hasHeader={hasHeader}\n hasCloseIcon={hasCloseIcon}\n animateVariant={animateVariant}\n popupStyle={styles}\n >\n {/* Render children if ContentComponent is not provided */}\n {(!ContentComponent && children) && children}\n {/* Render ContentComponent if children are not provided */}\n {(!children && ContentComponent) && <ContentComponent />}\n </PopupContent>\n </PopoverLite>\n )\n})\n\n/**\n * The display name of the Popup component.\n *\n * @type {string}\n */\nPopup.displayName = 'Popup'\n\ntype PopupContentProps = PropsWithChildren<unknown> & {\n title?: string\n forwardedRef?: ForwardedRef['forwardedRef']\n animateVariant?: PopupProps['animateVariant']\n popupStyle?: CSSProperties\n hasHeader?: boolean\n hasCloseIcon?: boolean\n closeIconURL?: string\n hide?: () => void\n}\n\n/**\n * The PopupContent component.\n *\n * @param {PopupContentProps} props The props for the PopupContent component.\n * @returns {React.ReactElement} The PopupContent.\n */\nconst PopupContent = memo(({\n title,\n forwardedRef,\n hide,\n children,\n animateVariant,\n popupStyle,\n hasHeader = true,\n hasCloseIcon = true,\n closeIconURL,\n ...props\n}: PopupContentProps) => {\n /**\n * The ContentRemapped element.\n *\n * @type {React.ReactElement[] | React.ReactElement}\n */\n const ContentRemapped = children && Array.isArray(children)\n ? children.filter((child: ReactNode | ReactElement) => !!child)\n .map((child: ReactElement, index: number) => cloneElement(\n // eslint-disable-next-line react/no-array-index-key\n child, { key: index, ...child.props, hide, ...props },\n ))\n : <div>Pseudo Content</div>\n\n return (\n <div className={`${classes['popup-container']}`} ref={forwardedRef} style={popupStyle}>\n <LayoutBox\n className={`${classes['popup-container-inner']}`}\n style={animateVariant ? styles.popup.inner[animateVariant] : null}\n >\n {hasHeader && (\n <>\n <LayoutBox justify='space-between' align='start' width='100%' padding='20px 20px 16px 20px'>\n <H3>{title}</H3>\n {hasCloseIcon && (\n <div\n onClick={hide}\n onKeyDown={hide}\n role='button'\n tabIndex={-1}\n className={classes['close-button']}\n >\n {closeIconURL && <IconBase iconUrl={closeIconURL} />}\n {!closeIconURL && (\n <IconBase>\n {closeIconJSX}\n </IconBase>\n )}\n </div>\n )}\n </LayoutBox>\n <DividerLine length='100%' />\n </>\n )}\n <div className={classes['popup-container-inner-div']}>\n {ContentRemapped && ContentRemapped}\n </div>\n </LayoutBox>\n </div>\n )\n})\n\n/**\n * The display name of the PopupContent component.\n *\n * @type {string}\n */\nPopupContent.displayName = 'PopupContent'\n"],"names":["styles","popup","inner","PopupAnimateVariant","SLIDE_DOWN","SLIDE_UP","SLIDE_RIGHT","SLIDE_LEFT","Popup","memo","_ref","title","children","components","isModal","hideOnClickOutside","hideOnContentClick","animateVariant","hasHeader","hasCloseIcon","width","height","style","props","ContentComponent","useMemo","React","createElement","PopoverLite","_extends","clickable","isPopup","modalOverlayClassName","classesOverlay","PopupContent","popupStyle","displayName","_ref2","forwardedRef","hide","closeIconURL","ContentRemapped","Array","isArray","filter","child","map","index","cloneElement","key","className","classes","ref","LayoutBox","Fragment","justify","align","padding","H3","onClick","onKeyDown","role","tabIndex","IconBase","iconUrl","closeIconJSX","DividerLine","length"],"mappings":"knBAwBA,MAAMA,EAKF,CACFC,MAAO,CACLC,MAAO,CACL,CAACC,EAAoBC,YAAa,CAAE,eAAgB,SACpD,CAACD,EAAoBE,UAAW,CAAE,eAAgB,QAClD,CAACF,EAAoBG,aAAc,CAAE,eAAgB,SACrD,CAACH,EAAoBI,YAAa,CAAE,eAAgB,WAW7CC,EAAwBC,GAAiBC,IAcpC,IAdqCC,MACrDA,EAAQ,gBAAgBC,SACxBA,EAAQC,WACRA,EAAa,CAAE,EAAAC,QACfA,GAAU,EAAIC,mBACdA,GAAqB,EAAKC,mBAC1BA,GAAqB,EAAKC,eAC1BA,EAAiBd,EAAoBE,SAAQa,UAC7CA,GAAY,EAAIC,aAChBA,GAAe,EAAIC,MACnBA,EAAKC,OACLA,EAAMC,MACNA,KACGC,GACQb,EAMX,MAAMc,EAAmBX,GAAYW,iBAO/BxB,EAASyB,GAAQ,KAAO,IACxBL,EAAQ,CAAE,gBAAiBA,GAAU,MACrCC,EAAS,CAAE,iBAAkBA,GAAW,MACzCC,KACD,CAACD,EAAQC,EAAOF,IAEpB,OACEM,MAAAC,cAACC,EAAWC,EAAA,CACVC,WAAS,EACTC,SAAO,EACPjB,QAASA,EACTE,mBAAoBA,EACpBD,mBAAoBA,EACpBiB,sBAAuBC,EAAe,wBAClCV,GAEJG,MAAAC,cAAA,IAAA,MACAD,MAAAC,cAACO,EAAY,CACXvB,MAAOA,EACPO,UAAWA,EACXC,aAAcA,EACdF,eAAgBA,EAChBkB,WAAYnC,IAGTwB,GAAoBZ,GAAaA,GAEjCA,GAAYY,GAAqBE,MAAAC,cAACH,EAAkB,OAE7C,IASlBhB,EAAM4B,YAAc,QAmBpB,MAAMF,EAAezB,GAAK4B,IAWD,IAXE1B,MACzBA,EAAK2B,aACLA,EAAYC,KACZA,EAAI3B,SACJA,EAAQK,eACRA,EAAckB,WACdA,EAAUjB,UACVA,GAAY,EAAIC,aAChBA,GAAe,EAAIqB,aACnBA,KACGjB,GACec,EAMlB,MAAMI,EAAkB7B,GAAY8B,MAAMC,QAAQ/B,GAC9CA,EAASgC,QAAQC,KAAsCA,IACtDC,KAAI,CAACD,EAAqBE,IAAkBC,EAE3CH,EAAO,CAAEI,IAAKF,KAAUF,EAAMtB,MAAOgB,UAAShB,MAEhDG,MAAAC,cAAA,MAAA,KAAK,kBAET,OACED,MAAAC,cAAA,MAAA,CAAKuB,UAAW,GAAGC,EAAQ,qBAAsBC,IAAKd,EAAchB,MAAOa,GACzET,MAAAC,cAAC0B,EAAS,CACRH,UAAW,GAAGC,EAAQ,2BACtB7B,MAAOL,EAAiBjB,EAAOC,MAAMC,MAAMe,GAAkB,MAE5DC,GACCQ,MAAAC,cAAAD,MAAA4B,SACE5B,KAAAA,MAAAC,cAAC0B,EAAS,CAACE,QAAQ,gBAAgBC,MAAM,QAAQpC,MAAM,OAAOqC,QAAQ,uBACpE/B,MAAAC,cAAC+B,EAAE,KAAE/C,GACJQ,GACCO,MAAAC,cAAA,MAAA,CACEgC,QAASpB,EACTqB,UAAWrB,EACXsB,KAAK,SACLC,UAAW,EACXZ,UAAWC,EAAQ,iBAElBX,GAAgBd,MAAAC,cAACoC,EAAQ,CAACC,QAASxB,KAClCA,GACAd,MAAAC,cAACoC,OACEE,KAMXvC,MAAAC,cAACuC,EAAW,CAACC,OAAO,UAGxBzC,MAAAC,cAAA,MAAA,CAAKuB,UAAWC,EAAQ,8BACrBV,GAAmBA,IAGpB,IASVP,EAAaE,YAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"peregrineMQ.js","sources":["../../../../../../../../src/core/utils/appState/peregrineMQ/peregrineMQ.ts"],"sourcesContent":["import { v4 as uuidv4 } from 'uuid'\n\nimport { Callback, Config, PeregrineMQApi, SubscribersSet, UnsubscribeOptions } from './peregrineMQ.types'\n\n\nexport class PeregrineMQClearError extends Error {\n constructor() {\n super('Clearing PeregrineMQ is not allowed. Please read the documentation for more information.')\n this.name = 'PeregrineMQClearError'\n }\n}\n\n/**\n * Represents a message queue with publish/subscribe functionality.\n */\nexport class PeregrineMQ implements PeregrineMQApi {\n private id: string\n\n private config: Config = {\n allowAutoPrune: false,\n pruneInterval: 10000,\n allowClear: false,\n }\n\n /**\n * The map of channels and their subscribers sets.\n */\n private channels: Map<string, SubscribersSet> = new Map()\n\n /**\n * The map of listeners and their subscribed channels.\n */\n private listeners: Map<Callback, SubscribersSet[]> = new Map()\n\n /**\n * Adds a callback as a listener to a channel.\n * @param callback The callback function to add as a listener.\n * @param channel The channel to add the listener to.\n */\n private addListener = (callback: Callback, channel: string): void => {\n const listener = this.listeners.get(callback)\n const subscribersSet = this.channels.get(channel)\n\n if (subscribersSet) {\n if (listener) {\n listener.push(subscribersSet)\n } else {\n this.listeners.set(callback, [subscribersSet])\n }\n }\n }\n\n /**\n * Removes the callback from the listeners collection if it is not subscribed to any channels.\n * @description Removes the callback only when it is not present in any other subscriberSet\n * (Ref to Map<string, SubscribersSet>).\n * @param callback The callback to remove from listeners.\n */\n private removeListener = (callback: Callback): void => {\n const channelSubscriberSets = this.listeners.get(callback)\n let isEmpty = true\n\n // eslint-disable-next-line no-restricted-syntax\n for (const channelSubscriberSet of channelSubscriberSets || []) {\n isEmpty = !channelSubscriberSet.has(callback)\n if (!isEmpty) {\n break\n }\n }\n\n if (isEmpty) {\n this.listeners.delete(callback)\n }\n }\n\n /**\n * Publishes data to a channel.\n * @param channel The channel to publish the data to.\n * @param isParent Indicates if the channel is a parent channel.\n * @param data The data to publish.\n * @returns A boolean indicating if the publication was successful.\n */\n private publishToChannel = (channel: string, isParent: boolean, data?: unknown): boolean => {\n const subscribersSet = this.channels.get(channel)\n\n if (!subscribersSet) {\n return isParent\n }\n\n const iterator = subscribersSet[Symbol.iterator]()\n let subscriberFunc = iterator.next().value\n\n // eslint-disable-next-line no-plusplus\n while (subscriberFunc) {\n subscriberFunc(channel, data)\n subscriberFunc = iterator.next().value\n }\n return true\n }\n\n /**\n * Creates a new instance of PeregrineMQ.\n * @param id Specific instance of PeregrineMQ identifier\n * @param config The configuration options for PeregrineMQ.\n */\n constructor(id?: string, config?: Config) {\n this.id = id || uuidv4()\n this.configure(config || {})\n }\n\n /**\n * Gets the total number of subscribers across all channels.\n */\n get length(): number {\n return [...this.channels.values()].reduce((acc, subscribersList) => acc + subscribersList.size, 0)\n }\n\n /**\n * Configures PeregrineMQ with the specified options.\n * @param config The configuration options for PeregrineMQ.\n * @returns An object containing the prune interval handler (if auto prune is enabled).\n */\n configure = (config: Config): {\n clearPruneInterval?: () => void\n restartPruneInterval?: () => void\n } => {\n this.config = config\n const { allowAutoPrune, pruneInterval } = config\n\n let pruneIntervalHandler: ReturnType<typeof setInterval>\n\n if (allowAutoPrune) {\n pruneIntervalHandler = setInterval(() => {\n this.prune()\n }, pruneInterval)\n }\n\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const instance: PeregrineMQ = this\n\n return {\n ...(allowAutoPrune\n ? {\n clearPruneInterval: (): void => {\n clearInterval(pruneIntervalHandler)\n },\n restartPruneInterval: (): void => {\n clearInterval(pruneIntervalHandler)\n pruneIntervalHandler = setInterval(() => {\n instance.prune()\n }, pruneInterval)\n },\n }\n : {}),\n }\n }\n\n /**\n * Gets an array of all channels.\n * @returns An array of channel names.\n */\n getChannels = (): string[] => [...this.channels.keys()]\n\n /**\n * Prunes the channels with no subscribers.\n * @returns An array of pruned channel names.\n */\n prune = (): string[] => {\n const iterator = this.channels[Symbol.iterator]()\n let subscribersSet = iterator.next().value\n const prunedChannels: string[] = []\n\n // eslint-disable-next-line no-plusplus\n while (subscribersSet) {\n if (subscribersSet[1]?.size === 0) {\n prunedChannels.push(subscribersSet[0])\n this.channels.delete(subscribersSet[0])\n }\n subscribersSet = iterator.next().value\n }\n\n return prunedChannels\n }\n\n /**\n * Removes a channel and its subscribers.\n * @param channel The channel to remove.\n * @returns A boolean indicating if the channel was successfully removed.\n */\n removeChannel = (channel: string): boolean => {\n const subscribersSet = this.channels.get(channel)\n\n if (subscribersSet && subscribersSet.size > 0) {\n const channelListeners = [...subscribersSet || []]\n\n subscribersSet.clear()\n\n let index = channelListeners.length\n\n // eslint-disable-next-line no-plusplus\n while (index--) {\n this.removeListener(channelListeners[index])\n }\n }\n\n return this.channels.delete(channel)\n }\n\n /**\n * Publishes data to a channel.\n * @param channel The channel to publish the data to.\n * @param data The data to publish.\n * @returns A boolean indicating if the publication was successful.\n */\n publish = <T>(channel: string, data?: T): boolean => {\n if (channel.includes('.')) {\n const nestedChannels = channel.split('.')\n\n let { length } = nestedChannels\n let failed = false\n\n // eslint-disable-next-line no-plusplus\n while (length--) {\n const result = this.publishToChannel(\n nestedChannels.slice(0, length + 1).join('.'),\n length !== nestedChannels.length - 1,\n data,\n )\n\n if (!result) {\n failed = true\n }\n }\n return !failed\n }\n\n return this.publishToChannel(channel, false, data)\n }\n\n /**\n * Subscribes a callback to a channel.\n * @param channel The channel to subscribe to.\n * @param callback The callback function to subscribe.\n * @returns A function to unsubscribe the callback.\n */\n subscribe = (channel: string, callback: Callback): () => boolean => {\n const subscribersList = this.channels.get(channel)\n\n if (subscribersList) {\n subscribersList.add(callback)\n } else {\n this.channels.set(channel, new Set([callback]))\n }\n\n this.addListener(callback, channel)\n\n return () => this.unsubscribe(callback, { channel, prune: true })\n }\n\n /**\n * Unsubscribes a callback from a channel or all channels.\n * @param callback The callback function to unsubscribe.\n * @param options Optional unsubscribe options.\n * @returns A boolean indicating if the callback was successfully unsubscribed.\n */\n unsubscribe = (callback: Callback, options?: UnsubscribeOptions): boolean => {\n const { channel, prune } = options || {}\n\n let unsubscribed = false\n\n if (channel) {\n const subscriberSet = this.channels.get(channel)\n\n unsubscribed = subscriberSet ? subscriberSet.delete(callback) : false\n if (prune && subscriberSet?.size === 0) {\n this.channels.delete(channel)\n }\n\n this.removeListener(callback)\n\n return unsubscribed\n }\n\n const subscriberSetArray = this.listeners.get(callback) || []\n\n // remove callback form listeners and all channels\n // TODO remove only if has\n // eslint-disable-next-line no-restricted-syntax\n for (const subscriberSet of subscriberSetArray) {\n unsubscribed = subscriberSet.delete(callback) as boolean\n\n if (prune && subscriberSet.size === 0) {\n this.prune()\n }\n }\n\n this.listeners.delete(callback)\n\n return unsubscribed\n }\n\n /**\n * Checks if a callback is subscribed to a specific channel or any channel.\n * @param callback The callback function to check.\n * @param channel Optional channel name to check subscription for.\n * @returns A boolean indicating if the callback is subscribed.\n */\n isSubscribed = (callback: Callback, channel?: string): boolean => {\n if (channel) {\n const subscribersList = this.channels.get(channel)\n\n return subscribersList ? subscribersList.has(callback) : false\n }\n\n return this.listeners.has(callback)\n }\n\n /**\n * Clears all channels and listeners.\n * @throws {Error} If clearing PeregrineMQ is not allowed.\n */\n clear = (): void => {\n if (this.config.allowClear) {\n this.channels.clear()\n this.listeners.clear()\n } else {\n throw new PeregrineMQClearError()\n }\n }\n\n /**\n * Returns the specific instance of PeregrineMQ.\n * @returns A string identifier of the specific instance of PeregrineMQ.\n */\n getId = (): string => this.id\n}\n"],"names":["PeregrineMQClearError","Error","constructor","super","this","name","PeregrineMQ","id","config","allowAutoPrune","pruneInterval","allowClear","channels","Map","listeners","addListener","callback","channel","listener","get","subscribersSet","push","set","removeListener","channelSubscriberSets","isEmpty","channelSubscriberSet","has","delete","publishToChannel","isParent","data","iterator","Symbol","subscriberFunc","next","value","configure","pruneIntervalHandler","setInterval","prune","instance","clearPruneInterval","clearInterval","restartPruneInterval","getChannels","keys","prunedChannels","size","removeChannel","channelListeners","clear","index","length","publish","includes","nestedChannels","split","failed","slice","join","subscribe","subscribersList","add","Set","unsubscribe","options","unsubscribed","subscriberSet","subscriberSetArray","isSubscribed","getId","uuidv4","values","reduce","acc"],"mappings":"uEAKO,MAAMA,UAA8BC,MACzCC,WAAAA,GACEC,MAAM,4FACNC,KAAKC,KAAO,uBACd,EAMK,MAAMC,EA0FXJ,WAAAA,CAAYK,EAAaC,GAAiBJ,KAzFlCG,QAAE,EAAAH,KAEFI,OAAiB,CACvBC,gBAAgB,EAChBC,cAAe,IACfC,YAAY,GAGdP,KAGQQ,SAAwC,IAAIC,IAEpDT,KAGQU,UAA6C,IAAID,IAEzDT,KAKQW,YAAc,CAACC,EAAoBC,KACzC,MAAMC,EAAWd,KAAKU,UAAUK,IAAIH,GAC9BI,EAAiBhB,KAAKQ,SAASO,IAAIF,GAErCG,IACEF,EACFA,EAASG,KAAKD,GAEdhB,KAAKU,UAAUQ,IAAIN,EAAU,CAACI,IAElC,EAGFhB,KAMQmB,eAAkBP,IACxB,MAAMQ,EAAwBpB,KAAKU,UAAUK,IAAIH,GACjD,IAAIS,GAAU,EAGd,IAAK,MAAMC,KAAwBF,GAAyB,GAE1D,GADAC,GAAWC,EAAqBC,IAAIX,IAC/BS,EACH,MAIAA,GACFrB,KAAKU,UAAUc,OAAOZ,EACxB,EAGFZ,KAOQyB,iBAAmB,CAACZ,EAAiBa,EAAmBC,KAC9D,MAAMX,EAAiBhB,KAAKQ,SAASO,IAAIF,GAEzC,IAAKG,EACH,OAAOU,EAGT,MAAME,EAAWZ,EAAea,OAAOD,YACvC,IAAIE,EAAiBF,EAASG,OAAOC,MAGrC,KAAOF,GACLA,EAAejB,EAASc,GACxBG,EAAiBF,EAASG,OAAOC,MAEnC,OAAO,CAAI,EAoBbhC,KAKAiC,UAAa7B,IAIXJ,KAAKI,OAASA,EACd,MAAMC,eAAEA,EAAcC,cAAEA,GAAkBF,EAE1C,IAAI8B,EAEA7B,IACF6B,EAAuBC,aAAY,KACjCnC,KAAKoC,OAAO,GACX9B,IAIL,MAAM+B,EAAwBrC,KAE9B,MAAO,IACDK,EACA,CACAiC,mBAAoBA,KAClBC,cAAcL,EAAqB,EAErCM,qBAAsBA,KACpBD,cAAcL,GACdA,EAAuBC,aAAY,KACjCE,EAASD,OAAO,GACf9B,EAAc,GAGnB,CAAE,EACP,EAGHN,KAIAyC,YAAc,IAAgB,IAAIzC,KAAKQ,SAASkC,QAEhD1C,KAIAoC,MAAQ,KACN,MAAMR,EAAW5B,KAAKQ,SAASqB,OAAOD,YACtC,IAAIZ,EAAiBY,EAASG,OAAOC,MACrC,MAAMW,EAA2B,GAGjC,KAAO3B,GAC2B,IAA5BA,EAAe,IAAI4B,OACrBD,EAAe1B,KAAKD,EAAe,IACnChB,KAAKQ,SAASgB,OAAOR,EAAe,KAEtCA,EAAiBY,EAASG,OAAOC,MAGnC,OAAOW,CAAc,EAGvB3C,KAKA6C,cAAiBhC,IACf,MAAMG,EAAiBhB,KAAKQ,SAASO,IAAIF,GAEzC,GAAIG,GAAkBA,EAAe4B,KAAO,EAAG,CAC7C,MAAME,EAAmB,IAAI9B,GAAkB,IAE/CA,EAAe+B,QAEf,IAAIC,EAAQF,EAAiBG,OAG7B,KAAOD,KACLhD,KAAKmB,eAAe2B,EAAiBE,GAEzC,CAEA,OAAOhD,KAAKQ,SAASgB,OAAOX,EAAQ,EAGtCb,KAMAkD,QAAU,CAAIrC,EAAiBc,KAC7B,GAAId,EAAQsC,SAAS,KAAM,CACzB,MAAMC,EAAiBvC,EAAQwC,MAAM,KAErC,IAAIJ,OAAEA,GAAWG,EACbE,GAAS,EAGb,KAAOL,KAAU,CACAjD,KAAKyB,iBAClB2B,EAAeG,MAAM,EAAGN,EAAS,GAAGO,KAAK,KACzCP,IAAWG,EAAeH,OAAS,EACnCtB,KAIA2B,GAAS,EAEb,CACA,OAAQA,CACV,CAEA,OAAOtD,KAAKyB,iBAAiBZ,GAAS,EAAOc,EAAK,EAGpD3B,KAMAyD,UAAY,CAAC5C,EAAiBD,KAC5B,MAAM8C,EAAkB1D,KAAKQ,SAASO,IAAIF,GAU1C,OARI6C,EACFA,EAAgBC,IAAI/C,GAEpBZ,KAAKQ,SAASU,IAAIL,EAAS,IAAI+C,IAAI,CAAChD,KAGtCZ,KAAKW,YAAYC,EAAUC,GAEpB,IAAMb,KAAK6D,YAAYjD,EAAU,CAAEC,UAASuB,OAAO,GAAO,EAGnEpC,KAMA6D,YAAc,CAACjD,EAAoBkD,KACjC,MAAMjD,QAAEA,EAAOuB,MAAEA,GAAU0B,GAAW,CAAA,EAEtC,IAAIC,GAAe,EAEnB,GAAIlD,EAAS,CACX,MAAMmD,EAAgBhE,KAAKQ,SAASO,IAAIF,GASxC,OAPAkD,IAAeC,GAAgBA,EAAcxC,OAAOZ,GAChDwB,GAAiC,IAAxB4B,GAAepB,MAC1B5C,KAAKQ,SAASgB,OAAOX,GAGvBb,KAAKmB,eAAeP,GAEbmD,CACT,CAEA,MAAME,EAAqBjE,KAAKU,UAAUK,IAAIH,IAAa,GAK3D,IAAK,MAAMoD,KAAiBC,EAC1BF,EAAeC,EAAcxC,OAAOZ,GAEhCwB,GAAgC,IAAvB4B,EAAcpB,MACzB5C,KAAKoC,QAMT,OAFApC,KAAKU,UAAUc,OAAOZ,GAEfmD,CAAY,EAGrB/D,KAMAkE,aAAe,CAACtD,EAAoBC,KAClC,GAAIA,EAAS,CACX,MAAM6C,EAAkB1D,KAAKQ,SAASO,IAAIF,GAE1C,QAAO6C,GAAkBA,EAAgBnC,IAAIX,EAC/C,CAEA,OAAOZ,KAAKU,UAAUa,IAAIX,EAAS,EAGrCZ,KAIA+C,MAAQ,KACN,IAAI/C,KAAKI,OAAOG,WAId,MAAM,IAAIX,EAHVI,KAAKQ,SAASuC,QACd/C,KAAKU,UAAUqC,OAGjB,EAGF/C,KAIAmE,MAAQ,IAAcnE,KAAKG,GApOzBH,KAAKG,GAAKA,GAAMiE,IAChBpE,KAAKiC,UAAU7B,GAAU,CAAA,EAC3B,CAKA,UAAI6C,GACF,MAAO,IAAIjD,KAAKQ,SAAS6D,UAAUC,QAAO,CAACC,EAAKb,IAAoBa,EAAMb,EAAgBd,MAAM,EAClG"}
1
+ {"version":3,"file":"peregrineMQ.js","sources":["../../../../../../../../src/core/utils/appState/peregrineMQ/peregrineMQ.ts"],"sourcesContent":["import { v4 as uuidv4 } from 'uuid'\n\nimport { Callback, Config, PeregrineMQApi, SubscribersSet, UnsubscribeOptions } from './peregrineMQ.types'\n\n\nexport class PeregrineMQClearError extends Error {\n constructor() {\n super('Clearing PeregrineMQ is not allowed. Please read the documentation for more information.')\n this.name = 'PeregrineMQClearError'\n }\n}\n\n/**\n * Represents a message queue with publish/subscribe functionality.\n */\nexport class PeregrineMQ implements PeregrineMQApi {\n private id: string\n\n private config: Config = {\n allowAutoPrune: false,\n pruneInterval: 10000,\n allowClear: false,\n }\n\n /**\n * The map of channels and their subscribers sets.\n */\n private channels: Map<string, SubscribersSet> = new Map()\n\n /**\n * The map of listeners and their subscribed channels.\n */\n private listeners: Map<Callback, SubscribersSet[]> = new Map()\n\n /**\n * Adds a callback as a listener to a channel.\n * @param callback The callback function to add as a listener.\n * @param channel The channel to add the listener to.\n */\n private addListener = (callback: Callback, channel: string): void => {\n const listener = this.listeners.get(callback)\n const subscribersSet = this.channels.get(channel)\n\n if (subscribersSet) {\n if (listener) {\n listener.push(subscribersSet)\n } else {\n this.listeners.set(callback, [subscribersSet])\n }\n }\n }\n\n /**\n * Removes the callback from the listeners collection if it is not subscribed to any channels.\n * @description Removes the callback only when it is not present in any other subscriberSet\n * (Ref to Map<string, SubscribersSet>).\n * @param callback The callback to remove from listeners.\n */\n private removeListener = (callback: Callback): void => {\n const channelSubscriberSets = this.listeners.get(callback)\n let isEmpty = true\n\n // eslint-disable-next-line no-restricted-syntax\n for (const channelSubscriberSet of channelSubscriberSets || []) {\n isEmpty = !channelSubscriberSet.has(callback)\n if (!isEmpty) {\n break\n }\n }\n\n if (isEmpty) {\n this.listeners.delete(callback)\n }\n }\n\n /**\n * Publishes data to a channel.\n * @param channel The channel to publish the data to.\n * @param isParent Indicates if the channel is a parent channel.\n * @param data The data to publish.\n * @returns A boolean indicating if the publication was successful.\n */\n private publishToChannel = (channel: string, isParent: boolean, data?: unknown): boolean => {\n const subscribersSet = this.channels.get(channel)\n\n if (!subscribersSet) {\n return isParent\n }\n\n const iterator = subscribersSet[Symbol.iterator]()\n let subscriberFunc = iterator.next().value\n\n // eslint-disable-next-line no-plusplus\n while (subscriberFunc) {\n subscriberFunc(channel, data)\n subscriberFunc = iterator.next().value\n }\n return true\n }\n\n /**\n * Creates a new instance of PeregrineMQ.\n * @param id Specific instance of PeregrineMQ identifier\n * @param config The configuration options for PeregrineMQ.\n */\n constructor(id?: string, config?: Config) {\n this.id = id || uuidv4()\n this.configure(config || {})\n }\n\n /**\n * Gets the total number of subscribers across all channels.\n */\n get length(): number {\n return [...this.channels.values()].reduce((acc, subscribersList) => acc + subscribersList.size, 0)\n }\n\n /**\n * Configures PeregrineMQ with the specified options.\n * @param config The configuration options for PeregrineMQ.\n * @returns An object containing the prune interval handler (if auto prune is enabled).\n */\n configure = (config: Config): {\n clearPruneInterval?: () => void\n restartPruneInterval?: () => void\n } => {\n this.config = config\n const { allowAutoPrune, pruneInterval } = config\n\n let pruneIntervalHandler: ReturnType<typeof setInterval>\n\n if (allowAutoPrune) {\n pruneIntervalHandler = setInterval(() => {\n this.prune()\n }, pruneInterval)\n }\n\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const instance: PeregrineMQ = this\n\n return {\n ...(allowAutoPrune\n ? {\n clearPruneInterval: (): void => {\n clearInterval(pruneIntervalHandler)\n },\n restartPruneInterval: (): void => {\n clearInterval(pruneIntervalHandler)\n pruneIntervalHandler = setInterval(() => {\n instance.prune()\n }, pruneInterval)\n },\n }\n : {}),\n }\n }\n\n /**\n * Gets an array of all channels.\n * @returns An array of channel names.\n */\n getChannels = (): string[] => [...this.channels.keys()]\n\n /**\n * Prunes the channels with no subscribers.\n * @returns An array of pruned channel names.\n */\n prune = (): string[] => {\n const iterator = this.channels[Symbol.iterator]()\n let subscribersSet = iterator.next().value\n const prunedChannels: string[] = []\n\n // eslint-disable-next-line no-plusplus\n while (subscribersSet) {\n if (subscribersSet[1]?.size === 0) {\n prunedChannels.push(subscribersSet[0])\n this.channels.delete(subscribersSet[0])\n }\n subscribersSet = iterator.next().value\n }\n\n return prunedChannels\n }\n\n /**\n * Removes a channel and its subscribers.\n * @param channel The channel to remove.\n * @returns A boolean indicating if the channel was successfully removed.\n */\n removeChannel = (channel: string): boolean => {\n const subscribersSet = this.channels.get(channel)\n\n if (subscribersSet && subscribersSet.size > 0) {\n const channelListeners = [...subscribersSet || []]\n\n subscribersSet.clear()\n\n let index = channelListeners.length\n\n // eslint-disable-next-line no-plusplus\n while (index--) {\n this.removeListener(channelListeners[index])\n }\n }\n\n return this.channels.delete(channel)\n }\n\n /**\n * Publishes data to a channel.\n * @param channel The channel to publish the data to.\n * @param data The data to publish.\n * @returns A boolean indicating if the publication was successful.\n */\n publish = <T>(channel: string, data?: T): boolean => {\n if (channel.includes('.')) {\n const nestedChannels = channel.split('.')\n\n let { length } = nestedChannels\n let failed = false\n\n // eslint-disable-next-line no-plusplus\n while (length--) {\n const result = this.publishToChannel(\n nestedChannels.slice(0, length + 1).join('.'),\n length !== nestedChannels.length - 1,\n data,\n )\n\n if (!result) {\n failed = true\n }\n }\n return !failed\n }\n\n return this.publishToChannel(channel, false, data)\n }\n\n /**\n * Subscribes a callback to a channel.\n * @param channel The channel to subscribe to.\n * @param callback The callback function to subscribe.\n * @returns A function to unsubscribe the callback.\n */\n subscribe = (channel: string, callback: Callback): () => boolean => {\n const subscribersList = this.channels.get(channel)\n\n if (subscribersList) {\n subscribersList.add(callback)\n } else {\n this.channels.set(channel, new Set([callback]))\n }\n\n this.addListener(callback, channel)\n\n return () => this.unsubscribe(callback, { channel, prune: true })\n }\n\n /**\n * Unsubscribes a callback from a channel or all channels.\n * @param callback The callback function to unsubscribe.\n * @param options Optional unsubscribe options.\n * @returns A boolean indicating if the callback was successfully unsubscribed.\n */\n unsubscribe = (callback: Callback, options?: UnsubscribeOptions): boolean => {\n const { channel, prune } = options || {}\n\n let unsubscribed = false\n\n if (channel) {\n const subscriberSet = this.channels.get(channel)\n\n unsubscribed = subscriberSet ? subscriberSet.delete(callback) : false\n if (prune && subscriberSet?.size === 0) {\n this.channels.delete(channel)\n }\n\n this.removeListener(callback)\n\n return unsubscribed\n }\n\n const subscriberSetArray = this.listeners.get(callback) || []\n\n // remove callback form listeners and all channels\n // TODO remove only if has\n // eslint-disable-next-line no-restricted-syntax\n for (const subscriberSet of subscriberSetArray) {\n unsubscribed = subscriberSet.delete(callback) as boolean\n\n if (prune && subscriberSet.size === 0) {\n this.prune()\n }\n }\n\n this.listeners.delete(callback)\n\n return unsubscribed\n }\n\n /**\n * Checks if a callback is subscribed to a specific channel or any channel.\n * @param callback The callback function to check.\n * @param channel Optional channel name to check subscription for.\n * @returns A boolean indicating if the callback is subscribed.\n */\n isSubscribed = (callback: Callback, channel?: string): boolean => {\n if (channel) {\n const subscribersList = this.channels.get(channel)\n\n return subscribersList ? subscribersList.has(callback) : false\n }\n\n return this.listeners.has(callback)\n }\n\n /**\n * Clears all channels and listeners.\n * @throws {Error} If clearing PeregrineMQ is not allowed.\n */\n clear = (): void => {\n if (this.config.allowClear) {\n this.channels.clear()\n this.listeners.clear()\n } else {\n throw new PeregrineMQClearError()\n }\n }\n\n /**\n * Returns the specific instance of PeregrineMQ.\n * @returns A string identifier of the specific instance of PeregrineMQ.\n */\n getId = (): string => this.id\n}\n"],"names":["PeregrineMQClearError","Error","constructor","super","this","name","PeregrineMQ","id","config","allowAutoPrune","pruneInterval","allowClear","channels","Map","listeners","addListener","callback","channel","listener","get","subscribersSet","push","set","removeListener","channelSubscriberSets","isEmpty","channelSubscriberSet","has","delete","publishToChannel","isParent","data","iterator","Symbol","subscriberFunc","next","value","configure","pruneIntervalHandler","setInterval","prune","instance","clearPruneInterval","clearInterval","restartPruneInterval","getChannels","keys","prunedChannels","size","removeChannel","channelListeners","clear","index","length","publish","includes","nestedChannels","split","failed","slice","join","subscribe","subscribersList","add","Set","unsubscribe","options","unsubscribed","subscriberSet","subscriberSetArray","isSubscribed","getId","uuidv4","values","reduce","acc"],"mappings":"uEAKO,MAAMA,UAA8BC,MACzCC,WAAAA,GACEC,MAAM,4FACNC,KAAKC,KAAO,uBACd,EAMK,MAAMC,EA0FXJ,WAAAA,CAAYK,EAAaC,GAAiBJ,KAzFlCG,QAAE,EAAAH,KAEFI,OAAiB,CACvBC,gBAAgB,EAChBC,cAAe,IACfC,YAAY,GAGdP,KAGQQ,SAAwC,IAAIC,IAEpDT,KAGQU,UAA6C,IAAID,IAEzDT,KAKQW,YAAc,CAACC,EAAoBC,KACzC,MAAMC,EAAWd,KAAKU,UAAUK,IAAIH,GAC9BI,EAAiBhB,KAAKQ,SAASO,IAAIF,GAErCG,IACEF,EACFA,EAASG,KAAKD,GAEdhB,KAAKU,UAAUQ,IAAIN,EAAU,CAACI,IAElC,EAGFhB,KAMQmB,eAAkBP,IACxB,MAAMQ,EAAwBpB,KAAKU,UAAUK,IAAIH,GACjD,IAAIS,GAAU,EAGd,IAAK,MAAMC,KAAwBF,GAAyB,GAE1D,GADAC,GAAWC,EAAqBC,IAAIX,IAC/BS,EACH,MAIAA,GACFrB,KAAKU,UAAUc,OAAOZ,EACxB,EAGFZ,KAOQyB,iBAAmB,CAACZ,EAAiBa,EAAmBC,KAC9D,MAAMX,EAAiBhB,KAAKQ,SAASO,IAAIF,GAEzC,IAAKG,EACH,OAAOU,EAGT,MAAME,EAAWZ,EAAea,OAAOD,YACvC,IAAIE,EAAiBF,EAASG,OAAOC,MAGrC,KAAOF,GACLA,EAAejB,EAASc,GACxBG,EAAiBF,EAASG,OAAOC,MAEnC,OAAO,CAAI,EAoBbhC,KAKAiC,UAAa7B,IAIXJ,KAAKI,OAASA,EACd,MAAMC,eAAEA,EAAcC,cAAEA,GAAkBF,EAE1C,IAAI8B,EAEA7B,IACF6B,EAAuBC,aAAY,KACjCnC,KAAKoC,OAAO,GACX9B,IAIL,MAAM+B,EAAwBrC,KAE9B,MAAO,IACDK,EACA,CACAiC,mBAAoBA,KAClBC,cAAcL,EAAqB,EAErCM,qBAAsBA,KACpBD,cAAcL,GACdA,EAAuBC,aAAY,KACjCE,EAASD,OAAO,GACf9B,EAAc,GAGnB,GACL,EAGHN,KAIAyC,YAAc,IAAgB,IAAIzC,KAAKQ,SAASkC,QAEhD1C,KAIAoC,MAAQ,KACN,MAAMR,EAAW5B,KAAKQ,SAASqB,OAAOD,YACtC,IAAIZ,EAAiBY,EAASG,OAAOC,MACrC,MAAMW,EAA2B,GAGjC,KAAO3B,GAC2B,IAA5BA,EAAe,IAAI4B,OACrBD,EAAe1B,KAAKD,EAAe,IACnChB,KAAKQ,SAASgB,OAAOR,EAAe,KAEtCA,EAAiBY,EAASG,OAAOC,MAGnC,OAAOW,CAAc,EAGvB3C,KAKA6C,cAAiBhC,IACf,MAAMG,EAAiBhB,KAAKQ,SAASO,IAAIF,GAEzC,GAAIG,GAAkBA,EAAe4B,KAAO,EAAG,CAC7C,MAAME,EAAmB,IAAI9B,GAAkB,IAE/CA,EAAe+B,QAEf,IAAIC,EAAQF,EAAiBG,OAG7B,KAAOD,KACLhD,KAAKmB,eAAe2B,EAAiBE,GAEzC,CAEA,OAAOhD,KAAKQ,SAASgB,OAAOX,EAAQ,EAGtCb,KAMAkD,QAAU,CAAIrC,EAAiBc,KAC7B,GAAId,EAAQsC,SAAS,KAAM,CACzB,MAAMC,EAAiBvC,EAAQwC,MAAM,KAErC,IAAIJ,OAAEA,GAAWG,EACbE,GAAS,EAGb,KAAOL,KAAU,CACAjD,KAAKyB,iBAClB2B,EAAeG,MAAM,EAAGN,EAAS,GAAGO,KAAK,KACzCP,IAAWG,EAAeH,OAAS,EACnCtB,KAIA2B,GAAS,EAEb,CACA,OAAQA,CACV,CAEA,OAAOtD,KAAKyB,iBAAiBZ,GAAS,EAAOc,EAAK,EAGpD3B,KAMAyD,UAAY,CAAC5C,EAAiBD,KAC5B,MAAM8C,EAAkB1D,KAAKQ,SAASO,IAAIF,GAU1C,OARI6C,EACFA,EAAgBC,IAAI/C,GAEpBZ,KAAKQ,SAASU,IAAIL,EAAS,IAAI+C,IAAI,CAAChD,KAGtCZ,KAAKW,YAAYC,EAAUC,GAEpB,IAAMb,KAAK6D,YAAYjD,EAAU,CAAEC,UAASuB,OAAO,GAAO,EAGnEpC,KAMA6D,YAAc,CAACjD,EAAoBkD,KACjC,MAAMjD,QAAEA,EAAOuB,MAAEA,GAAU0B,GAAW,CAAA,EAEtC,IAAIC,GAAe,EAEnB,GAAIlD,EAAS,CACX,MAAMmD,EAAgBhE,KAAKQ,SAASO,IAAIF,GASxC,OAPAkD,IAAeC,GAAgBA,EAAcxC,OAAOZ,GAChDwB,GAAiC,IAAxB4B,GAAepB,MAC1B5C,KAAKQ,SAASgB,OAAOX,GAGvBb,KAAKmB,eAAeP,GAEbmD,CACT,CAEA,MAAME,EAAqBjE,KAAKU,UAAUK,IAAIH,IAAa,GAK3D,IAAK,MAAMoD,KAAiBC,EAC1BF,EAAeC,EAAcxC,OAAOZ,GAEhCwB,GAAgC,IAAvB4B,EAAcpB,MACzB5C,KAAKoC,QAMT,OAFApC,KAAKU,UAAUc,OAAOZ,GAEfmD,CAAY,EAGrB/D,KAMAkE,aAAe,CAACtD,EAAoBC,KAClC,GAAIA,EAAS,CACX,MAAM6C,EAAkB1D,KAAKQ,SAASO,IAAIF,GAE1C,QAAO6C,GAAkBA,EAAgBnC,IAAIX,EAC/C,CAEA,OAAOZ,KAAKU,UAAUa,IAAIX,EAAS,EAGrCZ,KAIA+C,MAAQ,KACN,IAAI/C,KAAKI,OAAOG,WAId,MAAM,IAAIX,EAHVI,KAAKQ,SAASuC,QACd/C,KAAKU,UAAUqC,OAGjB,EAGF/C,KAIAmE,MAAQ,IAAcnE,KAAKG,GApOzBH,KAAKG,GAAKA,GAAMiE,IAChBpE,KAAKiC,UAAU7B,GAAU,CAAA,EAC3B,CAKA,UAAI6C,GACF,MAAO,IAAIjD,KAAKQ,SAAS6D,UAAUC,QAAO,CAACC,EAAKb,IAAoBa,EAAMb,EAAgBd,MAAM,EAClG"}
@@ -1 +1 @@
1
- {"version":3,"file":"store.vanillajs.js","sources":["../../../../../../../../src/core/utils/appState/store/store.vanillajs.ts"],"sourcesContent":["\n// TinyStore, inspired by https://github.com/jherr/syncexternalstore/blob/main/csr/src/store.js\n\nimport { isFunctionAsync } from '../../helpers'\n\n/**\n * Represents the callback function for a store listener.\n */\nexport type ListenerCallBack<T> = (state: Partial<T>) => void\n\n/**\n * Represents a selector function that transforms the store state.\n */\n// export type Selector<T> = (state: Partial<T>) => Partial<T>;\nexport type SelectedValueType<T> = Partial<T> | Partial<keyof T>\n| string | number | boolean | undefined | string[] | number[] | boolean[] | undefined[];\nexport type Selector<T> = (state: Partial<T>) => SelectedValueType<T>;\n\n\n/**\n * Represents a listener for the store.\n */\nexport type Listener<T> = {\n selector?: Selector<T>\n previousValue?: SelectedValueType<T>\n} & ListenerCallBack<T>\n\n/**\n * Represents a store.\n */\nexport type Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState: () => Partial<T>\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState: (state: Partial<T>) => Promise<Partial<T>>\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @param selector - Optional selector function to transform the store state.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>, selector?: Selector<T>) => () => void\n /**\n * Unubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => void\n}\n// & { actions?: { [actionName: string]: ActionHandlerCaller } }\n\n// TODO infer actionNames from createStore arguments\n/**\n * Represents a store with additional actions.\n */\nexport type StoreWithActions<T> = Store<T> & { actions: { [actionName: string]: ActionHandlerCaller<T> } }\n\n/**\n * Represents an action handler function.\n */\nexport type ActionHandler<T> = (\n getState: Store<T>['getState'], // Function to get the current state of the store\n setState: Store<T>['setState'], // Function to set the state of the store\n ...rest: unknown[]\n) => void | Partial<T> | Promise<void | Partial<T>>\n\n/**\n * Represents an reducer function.\n */\nexport type Reducer<T> = (\n state: Partial<T>,\n action: string,\n ...rest: unknown[]\n) => Partial<T>\n\n\n/**\n * Represents a function that calls an action handler.\n */\nexport type ActionHandlerCaller<T> = (...args: unknown[]) => void | Partial<T> | Promise<void | Partial<T>>\n\n\ntype Actions<T> = { [key: string]: ActionHandler<T>}\n/**\n * Creates a new store.\n * @param initialState - The initial state of the store.\n * @param actions - Optional actions for the store.\n * @returns The created store.\n */\nexport const createStore = <T>(\n initialState: Partial<T>,\n actions?: Actions<T>,\n reducer?: Reducer<T>,\n): Store<T> | StoreWithActions<T> => {\n let currentState: Partial<T> = initialState\n const listeners = new Set<Listener<T>>()\n\n /**\n * Gets the current state of the store.\n * @returns The current state of the store.\n */\n const getState = (): Partial<T> => currentState\n\n // TODO debounce, batch? what is the meaningful time between setState ofr UI to be rendered and registerd by User?\n /**\n * Sets the state of the store.\n * @param newState - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n const setState = async (newState: Partial<T>): Promise<Partial<T>> => {\n currentState = newState\n\n // eslint-disable-next-line no-restricted-syntax\n for (const listener of listeners) {\n // has Listener selector?\n const selector: Selector<T> | undefined = listener?.selector\n\n // TODO compare selected value to the previous values of that listener/selector pair\n // if listener.previousValue === selector(currentState) no call\n // else listener.previousValue = selector(currentState) and call\n // l1 cache, weak references?\n const newValue: SelectedValueType<T> = selector ? selector(currentState) : currentState\n\n // TODO plugin equality\n if (listener.previousValue === undefined || listener.previousValue !== newValue) {\n listener.previousValue = newValue\n // eslint-disable-next-line no-await-in-loop\n await listener(newValue as Partial<T>)\n }\n }\n return currentState\n }\n\n /**\n * Represents the basic API of the store.\n */\n const storeBaseicApi: Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState,\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState,\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>, selector?: Selector<T>) => {\n if (selector && listener.selector && listener.selector !== selector) {\n throw new Error('Error, mismatch selector, listener.selector !== selector.')\n }\n if (selector && !listener.selector) {\n // eslint-disable-next-line no-param-reassign\n listener.selector = selector\n }\n\n if (listener.selector) {\n // setting the previousValue for the next cache/equality check\n // eslint-disable-next-line no-param-reassign\n listener.previousValue = listener.selector(getState())\n }\n\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n /**\n * Unsubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => {\n listeners.delete(listener)\n },\n }\n\n /**\n * Resolves the actions and creates action handlers.\n */\n const resolvedActions: Actions<T> | null | undefined\n = actions ? Object.entries(actions)?.reduce(\n (\n aggregator: Record<string, ActionHandlerCaller<T>>,\n [actionName, actionHandler]: [string, ActionHandler<T>],\n ) => ({\n ...aggregator,\n [actionName]: async(...rest: unknown[]): Promise<void | Partial<T>> => {\n // TODO try to not call subscriber too many times becuase of Error and Pending values\n const isAsync = isFunctionAsync(actionHandler as () => unknown)\n\n if (isAsync) {\n setState({\n ...getState(),\n [`${actionName}Error`]: null,\n [`${actionName}Pending`]: true,\n })\n }\n\n try {\n const resultOfAction = await actionHandler(getState, setState, ...rest)\n\n // TODO try to mutate state only once with the results, that means pass custom setState to action,\n // so that it would matk pending and error already inside action\n if (reducer) {\n setState(reducer(getState(), actionName, ...rest))\n }\n\n if (isAsync) {\n setState({ ...getState(), [`${actionName}Pending`]: false })\n }\n\n return resultOfAction\n } catch (error) {\n if (isAsync) {\n setState({\n ...getState(),\n [`${actionName}Pending`]: false,\n [`${actionName}Error`]: error,\n })\n }\n throw error\n }\n },\n }),\n {},\n ) : null\n\n /**\n * Represents the store combined with actions.\n */\n const storeCombinedWithActions = {\n ...storeBaseicApi,\n ...(resolvedActions ? { actions: { ...resolvedActions } } : {}),\n }\n\n return resolvedActions\n ? storeCombinedWithActions as StoreWithActions<T>\n : storeCombinedWithActions as Store<T>\n}\n"],"names":["createStore","initialState","actions","reducer","currentState","listeners","Set","getState","setState","_ref","_asyncToGenerator","newState","listener","selector","newValue","undefined","previousValue","_x","apply","this","arguments","storeBaseicApi","subscribe","Error","add","delete","unsubscribe","resolvedActions","Object","entries","reduce","aggregator","_ref2","actionName","actionHandler","isAsync","isFunctionAsync","_len","length","rest","Array","_key","resultOfAction","error","storeCombinedWithActions"],"mappings":"iJA+FO,MAAMA,EAAcA,CACzBC,EACAC,EACAC,KAEA,IAAIC,EAA2BH,EAC/B,MAAMI,EAAY,IAAIC,IAMhBC,EAAWA,IAAkBH,EAQ7BI,EAAQ,WAAA,IAAAC,EAAAC,GAAG,UAAOC,GACtBP,EAAeO,EAGf,IAAK,MAAMC,KAAYP,EAAW,CAEhC,MAAMQ,EAAoCD,GAAUC,SAM9CC,EAAiCD,EAAWA,EAAST,GAAgBA,OAG5CW,IAA3BH,EAASI,eAA+BJ,EAASI,gBAAkBF,IACrEF,EAASI,cAAgBF,QAEnBF,EAASE,GAEnB,CACA,OAAOV,KACR,OAtBKI,SAAQS,GAAA,OAAAR,EAAAS,MAAAC,KAAAC,UAAA,EAAA,GA2BRC,EAA2B,CAK/Bd,WAMAC,WAMAc,UAAWA,CAACV,EAAuBC,KACjC,GAAIA,GAAYD,EAASC,UAAYD,EAASC,WAAaA,EACzD,MAAM,IAAIU,MAAM,6DAclB,OAZIV,IAAaD,EAASC,WAExBD,EAASC,SAAWA,GAGlBD,EAASC,WAGXD,EAASI,cAAgBJ,EAASC,SAASN,MAG7CF,EAAUmB,IAAIZ,GACP,IAAMP,EAAUoB,OAAOb,EAAS,EAMzCc,YAAcd,IACZP,EAAUoB,OAAOb,EAAS,GAOxBe,EACFzB,EAAU0B,OAAOC,QAAQ3B,IAAU4B,QACnC,CACEC,EAAkDC,KAAA,IACjDC,EAAYC,GAA0CF,EAAA,MACnD,IACDD,EACHE,CAACA,GAAUvB,GAAG,YAEZ,MAAMyB,EAAUC,EAAgBF,GAE5BC,GACF3B,EAAS,IACJD,IACH,CAAC,GAAG0B,UAAoB,KACxB,CAAC,GAAGA,aAAsB,IAI9B,IAAI,IAAA,IAAAI,EAAAjB,UAAAkB,OAZiBC,EAAIC,IAAAA,MAAAH,GAAAI,EAAA,EAAAA,EAAAJ,EAAAI,IAAJF,EAAIE,GAAArB,UAAAqB,GAavB,MAAMC,QAAuBR,EAAc3B,EAAUC,KAAa+B,GAYlE,OARIpC,GACFK,EAASL,EAAQI,IAAY0B,KAAeM,IAG1CJ,GACF3B,EAAS,IAAKD,IAAY,CAAC,GAAG0B,aAAsB,IAG/CS,CACR,CAAC,MAAOC,GAQP,MAPIR,GACF3B,EAAS,IACJD,IACH,CAAC,GAAG0B,aAAsB,EAC1B,CAAC,GAAGA,UAAoBU,IAGtBA,CACR,KAEH,GACD,CAAA,GACE,KAKAC,EAA2B,IAC5BvB,KACCM,EAAkB,CAAEzB,QAAS,IAAKyB,IAAsB,CAAE,GAGhE,OACIiB,CACoC"}
1
+ {"version":3,"file":"store.vanillajs.js","sources":["../../../../../../../../src/core/utils/appState/store/store.vanillajs.ts"],"sourcesContent":["\n// TinyStore, inspired by https://github.com/jherr/syncexternalstore/blob/main/csr/src/store.js\n\nimport { isFunctionAsync } from '../../helpers'\n\n/**\n * Represents the callback function for a store listener.\n */\nexport type ListenerCallBack<T> = (state: Partial<T>) => void\n\n/**\n * Represents a selector function that transforms the store state.\n */\n// export type Selector<T> = (state: Partial<T>) => Partial<T>;\nexport type SelectedValueType<T> = Partial<T> | Partial<keyof T>\n| string | number | boolean | undefined | string[] | number[] | boolean[] | undefined[];\nexport type Selector<T> = (state: Partial<T>) => SelectedValueType<T>;\n\n\n/**\n * Represents a listener for the store.\n */\nexport type Listener<T> = {\n selector?: Selector<T>\n previousValue?: SelectedValueType<T>\n} & ListenerCallBack<T>\n\n/**\n * Represents a store.\n */\nexport type Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState: () => Partial<T>\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState: (state: Partial<T>) => Promise<Partial<T>>\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @param selector - Optional selector function to transform the store state.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>, selector?: Selector<T>) => () => void\n /**\n * Unubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => void\n}\n// & { actions?: { [actionName: string]: ActionHandlerCaller } }\n\n// TODO infer actionNames from createStore arguments\n/**\n * Represents a store with additional actions.\n */\nexport type StoreWithActions<T> = Store<T> & { actions: { [actionName: string]: ActionHandlerCaller<T> } }\n\n/**\n * Represents an action handler function.\n */\nexport type ActionHandler<T> = (\n getState: Store<T>['getState'], // Function to get the current state of the store\n setState: Store<T>['setState'], // Function to set the state of the store\n ...rest: unknown[]\n) => void | Partial<T> | Promise<void | Partial<T>>\n\n/**\n * Represents an reducer function.\n */\nexport type Reducer<T> = (\n state: Partial<T>,\n action: string,\n ...rest: unknown[]\n) => Partial<T>\n\n\n/**\n * Represents a function that calls an action handler.\n */\nexport type ActionHandlerCaller<T> = (...args: unknown[]) => void | Partial<T> | Promise<void | Partial<T>>\n\n\ntype Actions<T> = { [key: string]: ActionHandler<T>}\n/**\n * Creates a new store.\n * @param initialState - The initial state of the store.\n * @param actions - Optional actions for the store.\n * @returns The created store.\n */\nexport const createStore = <T>(\n initialState: Partial<T>,\n actions?: Actions<T>,\n reducer?: Reducer<T>,\n): Store<T> | StoreWithActions<T> => {\n let currentState: Partial<T> = initialState\n const listeners = new Set<Listener<T>>()\n\n /**\n * Gets the current state of the store.\n * @returns The current state of the store.\n */\n const getState = (): Partial<T> => currentState\n\n // TODO debounce, batch? what is the meaningful time between setState ofr UI to be rendered and registerd by User?\n /**\n * Sets the state of the store.\n * @param newState - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n const setState = async (newState: Partial<T>): Promise<Partial<T>> => {\n currentState = newState\n\n // eslint-disable-next-line no-restricted-syntax\n for (const listener of listeners) {\n // has Listener selector?\n const selector: Selector<T> | undefined = listener?.selector\n\n // TODO compare selected value to the previous values of that listener/selector pair\n // if listener.previousValue === selector(currentState) no call\n // else listener.previousValue = selector(currentState) and call\n // l1 cache, weak references?\n const newValue: SelectedValueType<T> = selector ? selector(currentState) : currentState\n\n // TODO plugin equality\n if (listener.previousValue === undefined || listener.previousValue !== newValue) {\n listener.previousValue = newValue\n // eslint-disable-next-line no-await-in-loop\n await listener(newValue as Partial<T>)\n }\n }\n return currentState\n }\n\n /**\n * Represents the basic API of the store.\n */\n const storeBaseicApi: Store<T> = {\n /**\n * Get the current state of the store.\n * @returns The current state of the store.\n */\n getState,\n /**\n * Set the state of the store.\n * @param state - The new state to set.\n * @returns A promise that resolves to the new state.\n */\n setState,\n /**\n * Subscribe a listener to the store.\n * @param listener - The listener function to be subscribed.\n * @returns A function to unsubscribe the listener.\n */\n subscribe: (listener: Listener<T>, selector?: Selector<T>) => {\n if (selector && listener.selector && listener.selector !== selector) {\n throw new Error('Error, mismatch selector, listener.selector !== selector.')\n }\n if (selector && !listener.selector) {\n // eslint-disable-next-line no-param-reassign\n listener.selector = selector\n }\n\n if (listener.selector) {\n // setting the previousValue for the next cache/equality check\n // eslint-disable-next-line no-param-reassign\n listener.previousValue = listener.selector(getState())\n }\n\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n /**\n * Unsubscribe a listener from the store.\n * @param listener - The listener function to be unsubscribed.\n */\n unsubscribe: (listener: Listener<T>) => {\n listeners.delete(listener)\n },\n }\n\n /**\n * Resolves the actions and creates action handlers.\n */\n const resolvedActions: Actions<T> | null | undefined\n = actions ? Object.entries(actions)?.reduce(\n (\n aggregator: Record<string, ActionHandlerCaller<T>>,\n [actionName, actionHandler]: [string, ActionHandler<T>],\n ) => ({\n ...aggregator,\n [actionName]: async(...rest: unknown[]): Promise<void | Partial<T>> => {\n // TODO try to not call subscriber too many times becuase of Error and Pending values\n const isAsync = isFunctionAsync(actionHandler as () => unknown)\n\n if (isAsync) {\n setState({\n ...getState(),\n [`${actionName}Error`]: null,\n [`${actionName}Pending`]: true,\n })\n }\n\n try {\n const resultOfAction = await actionHandler(getState, setState, ...rest)\n\n // TODO try to mutate state only once with the results, that means pass custom setState to action,\n // so that it would matk pending and error already inside action\n if (reducer) {\n setState(reducer(getState(), actionName, ...rest))\n }\n\n if (isAsync) {\n setState({ ...getState(), [`${actionName}Pending`]: false })\n }\n\n return resultOfAction\n } catch (error) {\n if (isAsync) {\n setState({\n ...getState(),\n [`${actionName}Pending`]: false,\n [`${actionName}Error`]: error,\n })\n }\n throw error\n }\n },\n }),\n {},\n ) : null\n\n /**\n * Represents the store combined with actions.\n */\n const storeCombinedWithActions = {\n ...storeBaseicApi,\n ...(resolvedActions ? { actions: { ...resolvedActions } } : {}),\n }\n\n return resolvedActions\n ? storeCombinedWithActions as StoreWithActions<T>\n : storeCombinedWithActions as Store<T>\n}\n"],"names":["createStore","initialState","actions","reducer","currentState","listeners","Set","getState","setState","_ref","_asyncToGenerator","newState","listener","selector","newValue","undefined","previousValue","_x","apply","this","arguments","storeBaseicApi","subscribe","Error","add","delete","unsubscribe","resolvedActions","Object","entries","reduce","aggregator","_ref2","actionName","actionHandler","isAsync","isFunctionAsync","_len","length","rest","Array","_key","resultOfAction","error","storeCombinedWithActions"],"mappings":"iJA+FO,MAAMA,EAAcA,CACzBC,EACAC,EACAC,KAEA,IAAIC,EAA2BH,EAC/B,MAAMI,EAAY,IAAIC,IAMhBC,EAAWA,IAAkBH,EAQ7BI,EAAQ,WAAA,IAAAC,EAAAC,GAAG,UAAOC,GACtBP,EAAeO,EAGf,IAAK,MAAMC,KAAYP,EAAW,CAEhC,MAAMQ,EAAoCD,GAAUC,SAM9CC,EAAiCD,EAAWA,EAAST,GAAgBA,OAG5CW,IAA3BH,EAASI,eAA+BJ,EAASI,gBAAkBF,IACrEF,EAASI,cAAgBF,QAEnBF,EAASE,GAEnB,CACA,OAAOV,KACR,OAtBKI,SAAQS,GAAA,OAAAR,EAAAS,MAAAC,KAAAC,UAAA,EAAA,GA2BRC,EAA2B,CAK/Bd,WAMAC,WAMAc,UAAWA,CAACV,EAAuBC,KACjC,GAAIA,GAAYD,EAASC,UAAYD,EAASC,WAAaA,EACzD,MAAM,IAAIU,MAAM,6DAclB,OAZIV,IAAaD,EAASC,WAExBD,EAASC,SAAWA,GAGlBD,EAASC,WAGXD,EAASI,cAAgBJ,EAASC,SAASN,MAG7CF,EAAUmB,IAAIZ,GACP,IAAMP,EAAUoB,OAAOb,EAAS,EAMzCc,YAAcd,IACZP,EAAUoB,OAAOb,EAAS,GAOxBe,EACFzB,EAAU0B,OAAOC,QAAQ3B,IAAU4B,QACnC,CACEC,EAAkDC,KAAA,IACjDC,EAAYC,GAA0CF,EAAA,MACnD,IACDD,EACHE,CAACA,GAAUvB,GAAG,YAEZ,MAAMyB,EAAUC,EAAgBF,GAE5BC,GACF3B,EAAS,IACJD,IACH,CAAC,GAAG0B,UAAoB,KACxB,CAAC,GAAGA,aAAsB,IAI9B,IAAI,IAAA,IAAAI,EAAAjB,UAAAkB,OAZiBC,EAAIC,IAAAA,MAAAH,GAAAI,EAAA,EAAAA,EAAAJ,EAAAI,IAAJF,EAAIE,GAAArB,UAAAqB,GAavB,MAAMC,QAAuBR,EAAc3B,EAAUC,KAAa+B,GAYlE,OARIpC,GACFK,EAASL,EAAQI,IAAY0B,KAAeM,IAG1CJ,GACF3B,EAAS,IAAKD,IAAY,CAAC,GAAG0B,aAAsB,IAG/CS,CACR,CAAC,MAAOC,GAQP,MAPIR,GACF3B,EAAS,IACJD,IACH,CAAC,GAAG0B,aAAsB,EAC1B,CAAC,GAAGA,UAAoBU,IAGtBA,CACR,KAEH,GACD,CAAA,GACE,KAKAC,EAA2B,IAC5BvB,KACCM,EAAkB,CAAEzB,QAAS,IAAKyB,IAAsB,IAG9D,OACIiB,CACoC"}