@sbcrmweb/sbcrmweb-tma-core 0.0.59

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 (239) hide show
  1. package/README.md +419 -0
  2. package/dist/cjs/components/TMAActionBar/TMAActionBar.d.ts +10 -0
  3. package/dist/cjs/components/TMAActionBar/TMAActionBar.d.ts.map +1 -0
  4. package/dist/cjs/components/TMAActionBar/TMAActionBar.js +40 -0
  5. package/dist/cjs/components/TMABannersFeed/StoryDrawer.d.ts +12 -0
  6. package/dist/cjs/components/TMABannersFeed/StoryDrawer.d.ts.map +1 -0
  7. package/dist/cjs/components/TMABannersFeed/StoryDrawer.js +121 -0
  8. package/dist/cjs/components/TMABannersFeed/StoryProgress.d.ts +11 -0
  9. package/dist/cjs/components/TMABannersFeed/StoryProgress.d.ts.map +1 -0
  10. package/dist/cjs/components/TMABannersFeed/StoryProgress.js +81 -0
  11. package/dist/cjs/components/TMABannersFeed/TMABannerFeed.d.ts +28 -0
  12. package/dist/cjs/components/TMABannersFeed/TMABannerFeed.d.ts.map +1 -0
  13. package/dist/cjs/components/TMABannersFeed/TMABannerFeed.js +87 -0
  14. package/dist/cjs/components/TMABannersFeed/TMABannerFeedPropsContext.d.ts +5 -0
  15. package/dist/cjs/components/TMABannersFeed/TMABannerFeedPropsContext.d.ts.map +1 -0
  16. package/dist/cjs/components/TMABannersFeed/TMABannerFeedPropsContext.js +11 -0
  17. package/dist/cjs/components/TMABannersFeed/TMAStoryDrawer.d.ts +11 -0
  18. package/dist/cjs/components/TMABannersFeed/TMAStoryDrawer.d.ts.map +1 -0
  19. package/dist/cjs/components/TMABannersFeed/TMAStoryDrawer.js +126 -0
  20. package/dist/cjs/components/TMABannersFeed/propsContext.d.ts +5 -0
  21. package/dist/cjs/components/TMABannersFeed/propsContext.d.ts.map +1 -0
  22. package/dist/cjs/components/TMABannersFeed/propsContext.js +10 -0
  23. package/dist/cjs/components/TMABarChart/ItemTooltip.d.ts +12 -0
  24. package/dist/cjs/components/TMABarChart/ItemTooltip.d.ts.map +1 -0
  25. package/dist/cjs/components/TMABarChart/ItemTooltip.js +39 -0
  26. package/dist/cjs/components/TMABarChart/TMABarChart.d.ts +10 -0
  27. package/dist/cjs/components/TMABarChart/TMABarChart.d.ts.map +1 -0
  28. package/dist/cjs/components/TMABarChart/TMABarChart.js +131 -0
  29. package/dist/cjs/components/TMABaseSection/TMABaseSection.d.ts +7 -0
  30. package/dist/cjs/components/TMABaseSection/TMABaseSection.d.ts.map +1 -0
  31. package/dist/cjs/components/TMABaseSection/TMABaseSection.js +18 -0
  32. package/dist/cjs/components/TMACell/TMACell.d.ts +12 -0
  33. package/dist/cjs/components/TMACell/TMACell.d.ts.map +1 -0
  34. package/dist/cjs/components/TMACell/TMACell.js +18 -0
  35. package/dist/cjs/components/TMACellList/TMACellList.d.ts +6 -0
  36. package/dist/cjs/components/TMACellList/TMACellList.d.ts.map +1 -0
  37. package/dist/cjs/components/TMACellList/TMACellList.js +18 -0
  38. package/dist/cjs/components/TMACheckbox/TMACheckbox.d.ts +7 -0
  39. package/dist/cjs/components/TMACheckbox/TMACheckbox.d.ts.map +1 -0
  40. package/dist/cjs/components/TMACheckbox/TMACheckbox.js +11 -0
  41. package/dist/cjs/components/TMACounter/TMACountInput.d.ts +9 -0
  42. package/dist/cjs/components/TMACounter/TMACountInput.d.ts.map +1 -0
  43. package/dist/cjs/components/TMACounter/TMACountInput.js +36 -0
  44. package/dist/cjs/components/TMACounter/TMACounter.d.ts +11 -0
  45. package/dist/cjs/components/TMACounter/TMACounter.d.ts.map +1 -0
  46. package/dist/cjs/components/TMACounter/TMACounter.js +33 -0
  47. package/dist/cjs/components/TMADrawerFilter/TMADrawerFilter.d.ts +29 -0
  48. package/dist/cjs/components/TMADrawerFilter/TMADrawerFilter.d.ts.map +1 -0
  49. package/dist/cjs/components/TMADrawerFilter/TMADrawerFilter.js +47 -0
  50. package/dist/cjs/components/TMADrawerFilter/TMARightDrawerFilter.d.ts +4 -0
  51. package/dist/cjs/components/TMADrawerFilter/TMARightDrawerFilter.d.ts.map +1 -0
  52. package/dist/cjs/components/TMADrawerFilter/TMARightDrawerFilter.js +12 -0
  53. package/dist/cjs/components/TMADrawerFilter/TMATopDrawerFilter.d.ts +4 -0
  54. package/dist/cjs/components/TMADrawerFilter/TMATopDrawerFilter.d.ts.map +1 -0
  55. package/dist/cjs/components/TMADrawerFilter/TMATopDrawerFilter.js +11 -0
  56. package/dist/cjs/components/TMADrawerHeader/TMADrawerHeader.d.ts +6 -0
  57. package/dist/cjs/components/TMADrawerHeader/TMADrawerHeader.d.ts.map +1 -0
  58. package/dist/cjs/components/TMADrawerHeader/TMADrawerHeader.js +29 -0
  59. package/dist/cjs/components/TMALoadable/TMALoadable.d.ts +15 -0
  60. package/dist/cjs/components/TMALoadable/TMALoadable.d.ts.map +1 -0
  61. package/dist/cjs/components/TMALoadable/TMALoadable.js +25 -0
  62. package/dist/cjs/components/TMAMultiSelectWithTags/TMAMultiSelectWithTags.d.ts +34 -0
  63. package/dist/cjs/components/TMAMultiSelectWithTags/TMAMultiSelectWithTags.d.ts.map +1 -0
  64. package/dist/cjs/components/TMAMultiSelectWithTags/TMAMultiSelectWithTags.js +188 -0
  65. package/dist/cjs/components/TMASelect/TMASelect.d.ts +20 -0
  66. package/dist/cjs/components/TMASelect/TMASelect.d.ts.map +1 -0
  67. package/dist/cjs/components/TMASelect/TMASelect.js +152 -0
  68. package/dist/cjs/components/TMASelect/TMASelectOption.d.ts +8 -0
  69. package/dist/cjs/components/TMASelect/TMASelectOption.d.ts.map +1 -0
  70. package/dist/cjs/components/TMASelect/TMASelectOption.js +15 -0
  71. package/dist/cjs/components/TMAStatisticsCard/TMAStatisticsCard.d.ts +12 -0
  72. package/dist/cjs/components/TMAStatisticsCard/TMAStatisticsCard.d.ts.map +1 -0
  73. package/dist/cjs/components/TMAStatisticsCard/TMAStatisticsCard.js +30 -0
  74. package/dist/cjs/components/TMATabs/TMATabs.d.ts +14 -0
  75. package/dist/cjs/components/TMATabs/TMATabs.d.ts.map +1 -0
  76. package/dist/cjs/components/TMATabs/TMATabs.js +32 -0
  77. package/dist/cjs/components/TMATextField/TMATextField.d.ts +9 -0
  78. package/dist/cjs/components/TMATextField/TMATextField.d.ts.map +1 -0
  79. package/dist/cjs/components/TMATextField/TMATextField.js +30 -0
  80. package/dist/cjs/components/TMATextWithTitle/TMATextWithTitle.d.ts +7 -0
  81. package/dist/cjs/components/TMATextWithTitle/TMATextWithTitle.d.ts.map +1 -0
  82. package/dist/cjs/components/TMATextWithTitle/TMATextWithTitle.js +21 -0
  83. package/dist/cjs/components/TMAToast/TMAToast.d.ts +14 -0
  84. package/dist/cjs/components/TMAToast/TMAToast.d.ts.map +1 -0
  85. package/dist/cjs/components/TMAToast/TMAToast.js +45 -0
  86. package/dist/cjs/components/TMATooltip/TMATooltip.d.ts +11 -0
  87. package/dist/cjs/components/TMATooltip/TMATooltip.d.ts.map +1 -0
  88. package/dist/cjs/components/TMATooltip/TMATooltip.js +12 -0
  89. package/dist/cjs/components/index.d.ts +28 -0
  90. package/dist/cjs/components/index.d.ts.map +1 -0
  91. package/dist/cjs/components/index.js +55 -0
  92. package/dist/cjs/context/BackButtonContext/BackButtonContext.d.ts +7 -0
  93. package/dist/cjs/context/BackButtonContext/BackButtonContext.d.ts.map +1 -0
  94. package/dist/cjs/context/BackButtonContext/BackButtonContext.js +16 -0
  95. package/dist/cjs/context/index.d.ts +2 -0
  96. package/dist/cjs/context/index.d.ts.map +1 -0
  97. package/dist/cjs/context/index.js +17 -0
  98. package/dist/cjs/context/theme.d.ts +7 -0
  99. package/dist/cjs/context/theme.d.ts.map +1 -0
  100. package/dist/cjs/context/theme.js +16 -0
  101. package/dist/cjs/fonts.d.ts +4 -0
  102. package/dist/cjs/fonts.d.ts.map +1 -0
  103. package/dist/cjs/fonts.js +80 -0
  104. package/dist/cjs/hooks/index.d.ts +3 -0
  105. package/dist/cjs/hooks/index.d.ts.map +1 -0
  106. package/dist/cjs/hooks/index.js +23 -0
  107. package/dist/cjs/hooks/useBackButton.d.ts +2 -0
  108. package/dist/cjs/hooks/useBackButton.d.ts.map +1 -0
  109. package/dist/cjs/hooks/useBackButton.js +28 -0
  110. package/dist/cjs/hooks/useTMALongPress.d.ts +13 -0
  111. package/dist/cjs/hooks/useTMALongPress.d.ts.map +1 -0
  112. package/dist/cjs/hooks/useTMALongPress.js +63 -0
  113. package/dist/cjs/index.d.ts +7 -0
  114. package/dist/cjs/index.d.ts.map +1 -0
  115. package/dist/cjs/index.js +50 -0
  116. package/dist/cjs/theme.d.ts +541 -0
  117. package/dist/cjs/theme.d.ts.map +1 -0
  118. package/dist/cjs/theme.js +769 -0
  119. package/dist/components/TMAActionBar/TMAActionBar.d.ts +10 -0
  120. package/dist/components/TMAActionBar/TMAActionBar.d.ts.map +1 -0
  121. package/dist/components/TMAActionBar/TMAActionBar.js +33 -0
  122. package/dist/components/TMABannersFeed/StoryDrawer.d.ts +12 -0
  123. package/dist/components/TMABannersFeed/StoryDrawer.d.ts.map +1 -0
  124. package/dist/components/TMABannersFeed/StoryDrawer.js +114 -0
  125. package/dist/components/TMABannersFeed/StoryProgress.d.ts +11 -0
  126. package/dist/components/TMABannersFeed/StoryProgress.d.ts.map +1 -0
  127. package/dist/components/TMABannersFeed/StoryProgress.js +77 -0
  128. package/dist/components/TMABannersFeed/TMABannerFeed.d.ts +28 -0
  129. package/dist/components/TMABannersFeed/TMABannerFeed.d.ts.map +1 -0
  130. package/dist/components/TMABannersFeed/TMABannerFeed.js +80 -0
  131. package/dist/components/TMABannersFeed/TMABannerFeedPropsContext.d.ts +5 -0
  132. package/dist/components/TMABannersFeed/TMABannerFeedPropsContext.d.ts.map +1 -0
  133. package/dist/components/TMABannersFeed/TMABannerFeedPropsContext.js +7 -0
  134. package/dist/components/TMABannersFeed/TMAStoryDrawer.d.ts +11 -0
  135. package/dist/components/TMABannersFeed/TMAStoryDrawer.d.ts.map +1 -0
  136. package/dist/components/TMABannersFeed/TMAStoryDrawer.js +119 -0
  137. package/dist/components/TMABannersFeed/propsContext.d.ts +5 -0
  138. package/dist/components/TMABannersFeed/propsContext.d.ts.map +1 -0
  139. package/dist/components/TMABannersFeed/propsContext.js +6 -0
  140. package/dist/components/TMABarChart/ItemTooltip.d.ts +12 -0
  141. package/dist/components/TMABarChart/ItemTooltip.d.ts.map +1 -0
  142. package/dist/components/TMABarChart/ItemTooltip.js +33 -0
  143. package/dist/components/TMABarChart/TMABarChart.d.ts +10 -0
  144. package/dist/components/TMABarChart/TMABarChart.d.ts.map +1 -0
  145. package/dist/components/TMABarChart/TMABarChart.js +91 -0
  146. package/dist/components/TMABaseSection/TMABaseSection.d.ts +7 -0
  147. package/dist/components/TMABaseSection/TMABaseSection.d.ts.map +1 -0
  148. package/dist/components/TMABaseSection/TMABaseSection.js +11 -0
  149. package/dist/components/TMACell/TMACell.d.ts +12 -0
  150. package/dist/components/TMACell/TMACell.d.ts.map +1 -0
  151. package/dist/components/TMACell/TMACell.js +11 -0
  152. package/dist/components/TMACellList/TMACellList.d.ts +6 -0
  153. package/dist/components/TMACellList/TMACellList.d.ts.map +1 -0
  154. package/dist/components/TMACellList/TMACellList.js +11 -0
  155. package/dist/components/TMACheckbox/TMACheckbox.d.ts +7 -0
  156. package/dist/components/TMACheckbox/TMACheckbox.d.ts.map +1 -0
  157. package/dist/components/TMACheckbox/TMACheckbox.js +7 -0
  158. package/dist/components/TMACounter/TMACountInput.d.ts +9 -0
  159. package/dist/components/TMACounter/TMACountInput.d.ts.map +1 -0
  160. package/dist/components/TMACounter/TMACountInput.js +34 -0
  161. package/dist/components/TMACounter/TMACounter.d.ts +11 -0
  162. package/dist/components/TMACounter/TMACounter.d.ts.map +1 -0
  163. package/dist/components/TMACounter/TMACounter.js +26 -0
  164. package/dist/components/TMADrawerFilter/TMADrawerFilter.d.ts +29 -0
  165. package/dist/components/TMADrawerFilter/TMADrawerFilter.d.ts.map +1 -0
  166. package/dist/components/TMADrawerFilter/TMADrawerFilter.js +40 -0
  167. package/dist/components/TMADrawerFilter/TMARightDrawerFilter.d.ts +4 -0
  168. package/dist/components/TMADrawerFilter/TMARightDrawerFilter.d.ts.map +1 -0
  169. package/dist/components/TMADrawerFilter/TMARightDrawerFilter.js +8 -0
  170. package/dist/components/TMADrawerFilter/TMATopDrawerFilter.d.ts +4 -0
  171. package/dist/components/TMADrawerFilter/TMATopDrawerFilter.d.ts.map +1 -0
  172. package/dist/components/TMADrawerFilter/TMATopDrawerFilter.js +7 -0
  173. package/dist/components/TMADrawerHeader/TMADrawerHeader.d.ts +6 -0
  174. package/dist/components/TMADrawerHeader/TMADrawerHeader.d.ts.map +1 -0
  175. package/dist/components/TMADrawerHeader/TMADrawerHeader.js +22 -0
  176. package/dist/components/TMALoadable/TMALoadable.d.ts +15 -0
  177. package/dist/components/TMALoadable/TMALoadable.d.ts.map +1 -0
  178. package/dist/components/TMALoadable/TMALoadable.js +18 -0
  179. package/dist/components/TMAMultiSelectWithTags/TMAMultiSelectWithTags.d.ts +34 -0
  180. package/dist/components/TMAMultiSelectWithTags/TMAMultiSelectWithTags.d.ts.map +1 -0
  181. package/dist/components/TMAMultiSelectWithTags/TMAMultiSelectWithTags.js +181 -0
  182. package/dist/components/TMASelect/TMASelect.d.ts +20 -0
  183. package/dist/components/TMASelect/TMASelect.d.ts.map +1 -0
  184. package/dist/components/TMASelect/TMASelect.js +145 -0
  185. package/dist/components/TMASelect/TMASelectOption.d.ts +8 -0
  186. package/dist/components/TMASelect/TMASelectOption.d.ts.map +1 -0
  187. package/dist/components/TMASelect/TMASelectOption.js +8 -0
  188. package/dist/components/TMAStatisticsCard/TMAStatisticsCard.d.ts +12 -0
  189. package/dist/components/TMAStatisticsCard/TMAStatisticsCard.d.ts.map +1 -0
  190. package/dist/components/TMAStatisticsCard/TMAStatisticsCard.js +23 -0
  191. package/dist/components/TMATabs/TMATabs.d.ts +14 -0
  192. package/dist/components/TMATabs/TMATabs.d.ts.map +1 -0
  193. package/dist/components/TMATabs/TMATabs.js +25 -0
  194. package/dist/components/TMATextField/TMATextField.d.ts +9 -0
  195. package/dist/components/TMATextField/TMATextField.d.ts.map +1 -0
  196. package/dist/components/TMATextField/TMATextField.js +23 -0
  197. package/dist/components/TMATextWithTitle/TMATextWithTitle.d.ts +7 -0
  198. package/dist/components/TMATextWithTitle/TMATextWithTitle.d.ts.map +1 -0
  199. package/dist/components/TMATextWithTitle/TMATextWithTitle.js +14 -0
  200. package/dist/components/TMAToast/TMAToast.d.ts +14 -0
  201. package/dist/components/TMAToast/TMAToast.d.ts.map +1 -0
  202. package/dist/components/TMAToast/TMAToast.js +38 -0
  203. package/dist/components/TMATooltip/TMATooltip.d.ts +11 -0
  204. package/dist/components/TMATooltip/TMATooltip.d.ts.map +1 -0
  205. package/dist/components/TMATooltip/TMATooltip.js +5 -0
  206. package/dist/components/index.d.ts +28 -0
  207. package/dist/components/index.d.ts.map +1 -0
  208. package/dist/components/index.js +25 -0
  209. package/dist/context/BackButtonContext/BackButtonContext.d.ts +7 -0
  210. package/dist/context/BackButtonContext/BackButtonContext.d.ts.map +1 -0
  211. package/dist/context/BackButtonContext/BackButtonContext.js +12 -0
  212. package/dist/context/index.d.ts +2 -0
  213. package/dist/context/index.d.ts.map +1 -0
  214. package/dist/context/index.js +1 -0
  215. package/dist/context/theme.d.ts +7 -0
  216. package/dist/context/theme.d.ts.map +1 -0
  217. package/dist/context/theme.js +10 -0
  218. package/dist/fonts.d.ts +4 -0
  219. package/dist/fonts.d.ts.map +1 -0
  220. package/dist/fonts.js +74 -0
  221. package/dist/hooks/index.d.ts +3 -0
  222. package/dist/hooks/index.d.ts.map +1 -0
  223. package/dist/hooks/index.js +2 -0
  224. package/dist/hooks/useBackButton.d.ts +2 -0
  225. package/dist/hooks/useBackButton.d.ts.map +1 -0
  226. package/dist/hooks/useBackButton.js +24 -0
  227. package/dist/hooks/useTMALongPress.d.ts +13 -0
  228. package/dist/hooks/useTMALongPress.d.ts.map +1 -0
  229. package/dist/hooks/useTMALongPress.js +61 -0
  230. package/dist/index.d.ts +7 -0
  231. package/dist/index.d.ts.map +1 -0
  232. package/dist/index.js +6 -0
  233. package/dist/theme.d.ts +541 -0
  234. package/dist/theme.d.ts.map +1 -0
  235. package/dist/theme.js +766 -0
  236. package/fonts/Inter.ttf +0 -0
  237. package/fonts/SF-Pro.ttf +0 -0
  238. package/fonts/SFMono-Medium.otf +0 -0
  239. package/package.json +65 -0
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { SwipeableDrawerProps } from '@mui/material/SwipeableDrawer';
3
+ export interface TMAActionBarProps extends Omit<SwipeableDrawerProps, 'onOpen'> {
4
+ onOpen?: () => void;
5
+ isSwipeable?: boolean;
6
+ isOpen?: boolean;
7
+ children: React.ReactNode;
8
+ }
9
+ export declare const TMAActionBar: ({ children, sx, isSwipeable, isOpen, onClose, onOpen, ...props }: TMAActionBarProps) => import("react/jsx-runtime").JSX.Element;
10
+ //# sourceMappingURL=TMAActionBar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TMAActionBar.d.ts","sourceRoot":"","sources":["../../../src/components/TMAActionBar/TMAActionBar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAwB,EACtB,oBAAoB,EACrB,MAAM,+BAA+B,CAAC;AAEvC,MAAM,WAAW,iBACf,SAAQ,IAAI,CAAC,oBAAoB,EAAE,QAAQ,CAAC;IAC5C,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,YAAY,qEAQtB,iBAAiB,4CA+CnB,CAAC"}
@@ -0,0 +1,33 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import Stack from '@mui/material/Stack';
4
+ import { useEffect, useRef } from 'react';
5
+ import SwipeableDrawer from '@mui/material/SwipeableDrawer';
6
+ export const TMAActionBar = ({ children, sx, isSwipeable = false, isOpen = true, onClose, onOpen = () => { }, ...props }) => {
7
+ const contentRef = useRef(null);
8
+ useEffect(() => {
9
+ if (!isSwipeable && contentRef.current) {
10
+ const height = contentRef.current.getBoundingClientRect().height;
11
+ document.body.style.paddingBottom = `${height}px`;
12
+ }
13
+ }, [isSwipeable, children]);
14
+ useEffect(() => {
15
+ if (!isSwipeable && contentRef.current) {
16
+ return () => {
17
+ document.body.style.paddingBottom = '0px';
18
+ };
19
+ }
20
+ }, []);
21
+ return (_jsx(SwipeableDrawer, { variant: isSwipeable ? 'temporary' : 'permanent', hideBackdrop: !isSwipeable, open: isSwipeable ? isOpen : true, onClose: onClose, onOpen: onOpen, anchor: "bottom", slotProps: {
22
+ root: {
23
+ keepMounted: isSwipeable,
24
+ },
25
+ }, children: _jsx(Stack, { ref: contentRef, sx: {
26
+ px: 2,
27
+ pt: 2,
28
+ bgcolor: 'bg_color.main',
29
+ borderTopLeftRadius: 12,
30
+ borderTopRightRadius: 12,
31
+ ...sx,
32
+ }, ...props, children: children }) }));
33
+ };
@@ -0,0 +1,12 @@
1
+ import { SxProps } from '@mui/material/styles';
2
+ import { TMAStory } from './TMABannerFeed';
3
+ interface StoryDrawerProps {
4
+ sx?: SxProps;
5
+ onClose: () => void;
6
+ story: TMAStory | null;
7
+ onFinished?: () => void;
8
+ onPrev?: () => void;
9
+ }
10
+ export declare const StoryDrawer: ({ story, onClose, onFinished, onPrev, }: StoryDrawerProps) => import("react/jsx-runtime").JSX.Element;
11
+ export {};
12
+ //# sourceMappingURL=StoryDrawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StoryDrawer.d.ts","sourceRoot":"","sources":["../../../src/components/TMABannersFeed/StoryDrawer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAU,MAAM,sBAAsB,CAAC;AASvD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAM3C,UAAU,gBAAgB;IACxB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAWD,eAAO,MAAM,WAAW,4CAKrB,gBAAgB,4CA8KlB,CAAC"}
@@ -0,0 +1,114 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useMemo, useRef, useState } from 'react';
4
+ import { styled } from '@mui/material/styles';
5
+ import Box from '@mui/material/Box';
6
+ import Drawer from '@mui/material/Drawer';
7
+ import Stack from '@mui/material/Stack';
8
+ import Typography from '@mui/material/Typography';
9
+ import CloseOutlined from '@mui/icons-material/CloseOutlined';
10
+ import { Swiper, SwiperSlide } from 'swiper/react';
11
+ import { Navigation } from 'swiper/modules';
12
+ import { StoryProgress } from './StoryProgress';
13
+ import useTMALongPress from '../../hooks/useTMALongPress';
14
+ import { useTMABannerFeedPropsContext } from './propsContext';
15
+ import { BASE_SPACING } from '../../theme';
16
+ const StyledSwiper = styled(Swiper)(({ theme }) => ({
17
+ height: '100vh',
18
+ width: '100%',
19
+ background: 'linear-gradient(0deg, #0078EE, #5FC1FF)',
20
+ '& .story-item-slide': {
21
+ maxHeight: 'calc(100% - 90px)',
22
+ }
23
+ }));
24
+ export const StoryDrawer = ({ story, onClose, onFinished, onPrev, }) => {
25
+ const { storyItemsSwiperProps = {}, storyItemTitleVariant = 'title3Semibold', storyItemSubtitleVariant = 'textRegular', } = useTMABannerFeedPropsContext();
26
+ const [activeStoryItemIndex, setActiveStoryItemIndex] = useState(0);
27
+ const swiperRef = useRef(null);
28
+ const timerRef = useRef(null);
29
+ const goToSlide = (index = 0) => {
30
+ setActiveStoryItemIndex(index);
31
+ setTimeout(() => swiperRef.current?.slideTo(index), 0);
32
+ };
33
+ const goToSlidePrev = () => {
34
+ setTimeout(() => swiperRef.current?.slidePrev(), 0);
35
+ };
36
+ const handleNextStep = () => {
37
+ if (!story) {
38
+ return;
39
+ }
40
+ if (activeStoryItemIndex !== story.items.length - 1) {
41
+ goToSlide(activeStoryItemIndex + 1);
42
+ }
43
+ else if (onFinished) {
44
+ setActiveStoryItemIndex(0);
45
+ goToSlide();
46
+ onFinished();
47
+ }
48
+ else {
49
+ onClose();
50
+ }
51
+ };
52
+ const handlePreviousStep = () => {
53
+ if (!story) {
54
+ return;
55
+ }
56
+ if (activeStoryItemIndex) {
57
+ goToSlidePrev();
58
+ }
59
+ else if (onPrev) {
60
+ setActiveStoryItemIndex(0);
61
+ goToSlide();
62
+ onPrev();
63
+ }
64
+ else {
65
+ timerRef.current.resetTimer();
66
+ }
67
+ };
68
+ const handleLongPressHandleStart = () => {
69
+ timerRef.current.pause();
70
+ };
71
+ const handleLongPressHandleEnd = () => {
72
+ timerRef.current.resume();
73
+ };
74
+ const handleClick = (event) => {
75
+ const isNext = event.touches.startX > event.width / 2;
76
+ if (isNext) {
77
+ handleNextStep();
78
+ return;
79
+ }
80
+ handlePreviousStep();
81
+ };
82
+ const longPressEvents = useTMALongPress(handleLongPressHandleStart, handleLongPressHandleEnd, handleClick);
83
+ const swiperMemoized = useMemo(() => {
84
+ return (_jsx(StyledSwiper, { className: "story-item-swiper", onBeforeInit: (swiper) => {
85
+ swiperRef.current = swiper;
86
+ }, onSlideChange: (sw) => setActiveStoryItemIndex(sw.activeIndex), modules: [Navigation], slidesPerView: 1, speed: 400, ...longPressEvents, ...storyItemsSwiperProps, children: story?.items.map(({ image, subtitle, title, component }) => {
87
+ const haveComponent = Boolean(component);
88
+ return (_jsxs(SwiperSlide, { className: "story-item-slide", children: [haveComponent && component, !haveComponent && (_jsxs(Stack, { className: "story-item-wrapper", p: 2, rowGap: 6, pt: 90 / BASE_SPACING, sx: { height: '100%' }, children: [_jsx(Box, { sx: {
89
+ marginX: 'auto',
90
+ height: '70%',
91
+ }, component: "img", src: image }), _jsxs(Stack, { sx: { minHeight: 300 }, rowGap: 12 / BASE_SPACING, children: [_jsx(Typography, { className: "story-item-title", variant: storyItemTitleVariant, sx: { fontWeight: 590 }, children: title }), _jsx(Typography, { className: "story-item-subtitle", sx: { whiteSpace: 'pre-wrap', lineHeight: '22px' }, variant: storyItemSubtitleVariant, children: subtitle })] })] }))] }, subtitle));
92
+ }) }));
93
+ }, [story, longPressEvents, storyItemsSwiperProps]);
94
+ return (_jsxs(Drawer, { className: "story-drawer", anchor: "bottom", onTouchStart: timerRef.current?.pause, onTouchEnd: timerRef.current?.resume, open: Boolean(story), ModalProps: { onBackdropClick: onClose }, sx: {
95
+ '& .MuiDrawer-paperAnchorBottom.MuiPaper-root': {
96
+ borderTopLeftRadius: 0,
97
+ borderTopRightRadius: 0,
98
+ pb: 0,
99
+ },
100
+ }, children: [_jsx(StoryProgress, { activeStoryItemIndex: activeStoryItemIndex, onExpirationTimer: handleNextStep, onItemClick: (index) => swiperRef.current?.slideTo(index), story: story, timerRef: timerRef }), _jsx(Stack, { className: "story-drawer-closer", justifyContent: "center", alignItems: "center", onClick: (event) => {
101
+ event.preventDefault();
102
+ onClose();
103
+ }, sx: {
104
+ height: 40,
105
+ width: 40,
106
+ position: 'absolute',
107
+ zIndex: 1000,
108
+ top: 42,
109
+ right: 16,
110
+ borderRadius: '10px',
111
+ cursor: 'pointer',
112
+ background: '#2990FF26',
113
+ }, children: _jsx(CloseOutlined, {}) }), swiperMemoized] }));
114
+ };
@@ -0,0 +1,11 @@
1
+ import { TMAStory } from './TMABannerFeed';
2
+ interface StoryProgressProps {
3
+ story: TMAStory | null;
4
+ activeStoryItemIndex: number;
5
+ onExpirationTimer: () => void;
6
+ onItemClick: (index: number) => void;
7
+ timerRef?: any;
8
+ }
9
+ export declare const StoryProgress: ({ story, activeStoryItemIndex, onExpirationTimer, onItemClick, timerRef, }: StoryProgressProps) => import("react/jsx-runtime").JSX.Element;
10
+ export {};
11
+ //# sourceMappingURL=StoryProgress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StoryProgress.d.ts","sourceRoot":"","sources":["../../../src/components/TMABannersFeed/StoryProgress.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAK3C,UAAU,kBAAkB;IAC1B,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC;IACvB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB;AAID,eAAO,MAAM,aAAa,+EAMvB,kBAAkB,4CA4GpB,CAAC"}
@@ -0,0 +1,77 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useCallback, useEffect } from 'react';
4
+ import { Box, LinearProgress, Stack } from '@mui/material';
5
+ import { useTimer } from 'react-timer-hook';
6
+ import { BASE_SPACING } from '../../theme';
7
+ import { useTMABannerFeedPropsContext } from './TMABannerFeedPropsContext';
8
+ const MAX_TIME_OF_STORY = 10;
9
+ export const StoryProgress = ({ story, activeStoryItemIndex, onExpirationTimer, onItemClick, timerRef, }) => {
10
+ const { maxStoryTimeSeconds = MAX_TIME_OF_STORY } = useTMABannerFeedPropsContext();
11
+ const maxStoryTimeMilliseconds = maxStoryTimeSeconds * 1000;
12
+ const getTimerOffset = useCallback(() => {
13
+ const newOffsetDate = new Date();
14
+ newOffsetDate.setMilliseconds(newOffsetDate.getMilliseconds() + maxStoryTimeMilliseconds);
15
+ return newOffsetDate;
16
+ }, [maxStoryTimeMilliseconds]);
17
+ const resetTimer = () => {
18
+ restart(getTimerOffset(), true);
19
+ };
20
+ const handleExpirationTimer = () => {
21
+ if (!story) {
22
+ return;
23
+ }
24
+ if (activeStoryItemIndex !== story.items.length - 1) {
25
+ resetTimer();
26
+ }
27
+ onExpirationTimer();
28
+ };
29
+ const timer = useTimer({
30
+ autoStart: true,
31
+ interval: maxStoryTimeSeconds,
32
+ expiryTimestamp: getTimerOffset(),
33
+ onExpire: handleExpirationTimer,
34
+ });
35
+ if (timerRef) {
36
+ timerRef.current = {
37
+ ...timer,
38
+ resetTimer,
39
+ };
40
+ }
41
+ const { totalMilliseconds: time, pause, restart } = timer;
42
+ const stopTimer = () => {
43
+ pause();
44
+ };
45
+ useEffect(() => {
46
+ if (story) {
47
+ resetTimer();
48
+ return;
49
+ }
50
+ stopTimer();
51
+ }, [story, activeStoryItemIndex]);
52
+ const getProgressBarValue = (currentIndex) => {
53
+ if (currentIndex === activeStoryItemIndex) {
54
+ return (1 - time / maxStoryTimeMilliseconds) * 100;
55
+ }
56
+ return currentIndex > activeStoryItemIndex ? 0 : 100;
57
+ };
58
+ return (_jsx(Stack, { className: "story-progress", onClick: (event) => event.stopPropagation(), gap: 4 / BASE_SPACING, sx: {
59
+ position: 'absolute',
60
+ top: 0,
61
+ left: 0,
62
+ right: 0,
63
+ zIndex: 1000,
64
+ mt: 2,
65
+ mx: 2,
66
+ }, direction: "row", children: story?.items.map((storyItem, index) => (_jsx(Box, { className: "story-progress-item-wrapper", onClick: () => onItemClick(index), flex: 1, height: 25, display: "flex", justifyItems: "center", children: _jsx(LinearProgress, { className: "story-progress-item", variant: "determinate", sx: {
67
+ width: '100%',
68
+ borderRadius: 1,
69
+ '& .MuiLinearProgress-bar': {
70
+ transition: 'none',
71
+ background: 'white',
72
+ },
73
+ '&.MuiLinearProgress-root': {
74
+ background: '#FFFFFF1A',
75
+ },
76
+ }, value: getProgressBarValue(index) }) }, storyItem.subtitle))) }));
77
+ };
@@ -0,0 +1,28 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { SxProps, Theme } from '@mui/material/styles';
3
+ import { TypographyProps } from '@mui/material/Typography';
4
+ import { SwiperProps } from 'swiper/react';
5
+ export type TMAStoryItem = {
6
+ title?: string;
7
+ subtitle?: string;
8
+ image?: string;
9
+ component?: ReactNode;
10
+ };
11
+ export interface TMAStory {
12
+ title: string;
13
+ image?: React.ReactElement;
14
+ items: TMAStoryItem[];
15
+ isGray?: boolean;
16
+ }
17
+ export interface TMABannersFeedProps {
18
+ stories?: TMAStory[];
19
+ sx?: SxProps<Theme>;
20
+ maxStoryTimeSeconds?: number;
21
+ storiesSwiperProps?: SwiperProps;
22
+ storyTitleVariant?: TypographyProps['variant'];
23
+ storyItemsSwiperProps?: SwiperProps;
24
+ storyItemTitleVariant?: TypographyProps['variant'];
25
+ storyItemSubtitleVariant?: TypographyProps['variant'];
26
+ }
27
+ export declare const TMABannersFeed: (props: TMABannersFeedProps) => import("react/jsx-runtime").JSX.Element;
28
+ //# sourceMappingURL=TMABannerFeed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TMABannerFeed.d.ts","sourceRoot":"","sources":["../../../src/components/TMABannersFeed/TMABannerFeed.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AACnD,OAAO,EAAU,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAG9D,OAAmB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAEL,WAAW,EAGZ,MAAM,cAAc,CAAC;AAKtB,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC3B,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;IACrB,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kBAAkB,CAAC,EAAE,WAAW,CAAC;IACjC,iBAAiB,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IAC/C,qBAAqB,CAAC,EAAE,WAAW,CAAC;IACpC,qBAAqB,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IACnD,wBAAwB,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;CACvD;AA2DD,eAAO,MAAM,cAAc,UAAW,mBAAmB,4CA+ExD,CAAC"}
@@ -0,0 +1,80 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useState } from 'react';
4
+ import { styled } from '@mui/material/styles';
5
+ import Box from '@mui/material/Box';
6
+ import Stack from '@mui/material/Stack';
7
+ import Typography from '@mui/material/Typography';
8
+ import { Swiper, SwiperSlide, } from 'swiper/react';
9
+ import { TMAStoryDrawer } from './TMAStoryDrawer';
10
+ import { BASE_SPACING } from '../../theme';
11
+ import { TMABannerFeedPropsContext } from './TMABannerFeedPropsContext';
12
+ const StyledBannerWrapper = styled(Stack)(({ theme }) => theme.unstable_sx({
13
+ borderRadius: '12px',
14
+ width: 103,
15
+ height: 103,
16
+ borderColor: theme.palette?.accent_text_color.main,
17
+ borderWidth: 2,
18
+ borderStyle: 'solid',
19
+ position: 'relative',
20
+ marginRight: 12 / BASE_SPACING,
21
+ }));
22
+ const StyledBanner = styled(Stack, {
23
+ shouldForwardProp: (prop) => ['isGray'].every((key) => key !== prop),
24
+ })(({ theme, isGray }) => theme.unstable_sx({
25
+ background: isGray
26
+ ? 'linear-gradient(180deg, #E6FFEE, #A3A9A7)'
27
+ : 'linear-gradient(180deg, #5FC1FF 0%, #0078EE 100%)',
28
+ borderRadius: '12px',
29
+ borderColor: theme.palette?.bg_color.main,
30
+ borderWidth: 2,
31
+ borderStyle: 'solid',
32
+ width: 99,
33
+ height: 99,
34
+ p: 6 / BASE_SPACING,
35
+ position: 'relative',
36
+ alignItems: 'center',
37
+ '&:after': {
38
+ content: "''",
39
+ zIndex: 1,
40
+ position: 'absolute',
41
+ height: 40,
42
+ width: 95,
43
+ borderRadius: '12px',
44
+ background: 'linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.5) 100%)',
45
+ bottom: -1,
46
+ },
47
+ }));
48
+ const StyledSwiper = styled(Swiper)(({ theme }) => ({
49
+ '& .swiper-wrapper': {
50
+ width: 'fit-content',
51
+ maxWidth: 'fit-content',
52
+ },
53
+ }));
54
+ const StyledSwiperSlide = styled(SwiperSlide)(({ theme }) => ({
55
+ width: 'fit-content',
56
+ flex: 1,
57
+ }));
58
+ export const TMABannersFeed = (props) => {
59
+ const { stories, sx = {}, storiesSwiperProps = {}, storyTitleVariant = 'caption3Semibold', } = props;
60
+ const [activeStoryIndex, setActiveStoryIndex] = useState(null);
61
+ const handleFinishedStory = () => {
62
+ setActiveStoryIndex(Number(activeStoryIndex) + 1);
63
+ };
64
+ const handlePrevStory = () => {
65
+ setActiveStoryIndex(Number(activeStoryIndex) - 1);
66
+ };
67
+ const haveStories = Boolean(stories?.length);
68
+ return (_jsx(Box, { sx: sx, children: _jsxs(TMABannerFeedPropsContext.Provider, { value: props, children: [_jsx(StyledSwiper, { className: "story-swiper", allowTouchMove: true, slidesPerView: "auto", speed: 400, ...storiesSwiperProps, children: stories?.map((story, index) => (_jsx(StyledSwiperSlide, { className: "story-slide", children: _jsx(StyledBannerWrapper, { alignItems: "center", justifyContent: "center", className: "story-banner-wrapper", children: _jsxs(StyledBanner, { isGray: story.isGray, onClick: () => setActiveStoryIndex(index), className: "story-banner", children: [story.image, _jsx(Typography, { className: "story-banner-title", variant: storyTitleVariant, sx: {
69
+ width: '85%',
70
+ position: 'absolute',
71
+ bottom: 6,
72
+ left: 6,
73
+ fontSize: 10,
74
+ fontWeight: 600,
75
+ lineHeight: '107%',
76
+ zIndex: 2,
77
+ }, children: story.title })] }) }) }, story.title))) }), activeStoryIndex !== null && haveStories && (_jsx(TMAStoryDrawer, { onFinished: activeStoryIndex !== stories.length - 1
78
+ ? handleFinishedStory
79
+ : undefined, onPrev: activeStoryIndex ? handlePrevStory : undefined, onClose: () => setActiveStoryIndex(null), story: stories[activeStoryIndex] }))] }) }));
80
+ };
@@ -0,0 +1,5 @@
1
+ import { TMABannersFeedProps } from './TMABannerFeed';
2
+ export type TMABannerFeedPropsContextType = TMABannersFeedProps;
3
+ export declare const TMABannerFeedPropsContext: import("react").Context<TMABannersFeedProps>;
4
+ export declare const useTMABannerFeedPropsContext: () => TMABannersFeedProps;
5
+ //# sourceMappingURL=TMABannerFeedPropsContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TMABannerFeedPropsContext.d.ts","sourceRoot":"","sources":["../../../src/components/TMABannersFeed/TMABannerFeedPropsContext.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,MAAM,6BAA6B,GAAG,mBAAmB,CAAC;AAEhE,eAAO,MAAM,yBAAyB,8CACe,CAAC;AAEtD,eAAO,MAAM,4BAA4B,2BAKxC,CAAC"}
@@ -0,0 +1,7 @@
1
+ 'use client';
2
+ import { createContext, useContext, useMemo } from 'react';
3
+ export const TMABannerFeedPropsContext = createContext(null);
4
+ export const useTMABannerFeedPropsContext = () => {
5
+ const value = useContext(TMABannerFeedPropsContext);
6
+ return useMemo(() => value, [value]);
7
+ };
@@ -0,0 +1,11 @@
1
+ import { SxProps } from '@mui/material/styles';
2
+ import { TMAStory } from './TMABannerFeed';
3
+ export interface TMAStoryDrawerProps {
4
+ sx?: SxProps;
5
+ onClose: () => void;
6
+ story: TMAStory | null;
7
+ onFinished?: () => void;
8
+ onPrev?: () => void;
9
+ }
10
+ export declare const TMAStoryDrawer: ({ story, onClose, onFinished, onPrev, }: TMAStoryDrawerProps) => import("react/jsx-runtime").JSX.Element;
11
+ //# sourceMappingURL=TMAStoryDrawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TMAStoryDrawer.d.ts","sourceRoot":"","sources":["../../../src/components/TMABannersFeed/TMAStoryDrawer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAU,MAAM,sBAAsB,CAAC;AAUvD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAM3C,MAAM,WAAW,mBAAmB;IAClC,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAWD,eAAO,MAAM,cAAc,4CAKxB,mBAAmB,4CAkMrB,CAAC"}
@@ -0,0 +1,119 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useMemo, useRef, useState } from 'react';
4
+ import { styled } from '@mui/material/styles';
5
+ import Box from '@mui/material/Box';
6
+ import Image from 'next/image';
7
+ import Drawer from '@mui/material/Drawer';
8
+ import Stack from '@mui/material/Stack';
9
+ import Typography from '@mui/material/Typography';
10
+ import CloseOutlined from '@mui/icons-material/CloseOutlined';
11
+ import { Swiper, SwiperSlide } from 'swiper/react';
12
+ import { Navigation } from 'swiper/modules';
13
+ import { StoryProgress } from './StoryProgress';
14
+ import useTMALongPress from '../../hooks/useTMALongPress';
15
+ import { useTMABannerFeedPropsContext } from './TMABannerFeedPropsContext';
16
+ import { BASE_SPACING } from '../../theme';
17
+ const StyledSwiper = styled(Swiper)(({ theme }) => ({
18
+ height: '100vh',
19
+ width: '100%',
20
+ background: 'linear-gradient(0deg, #0078EE, #5FC1FF)',
21
+ '& .story-item-slide': {
22
+ maxHeight: 'calc(100% - 90px)',
23
+ },
24
+ }));
25
+ export const TMAStoryDrawer = ({ story, onClose, onFinished, onPrev, }) => {
26
+ const { storyItemsSwiperProps = {}, storyItemTitleVariant = 'title3Semibold', storyItemSubtitleVariant = 'textRegular', } = useTMABannerFeedPropsContext();
27
+ const [activeStoryItemIndex, setActiveStoryItemIndex] = useState(0);
28
+ const swiperRef = useRef(null);
29
+ const timerRef = useRef(null);
30
+ const goToSlide = (index = 0) => {
31
+ setActiveStoryItemIndex(index);
32
+ setTimeout(() => swiperRef.current?.slideTo(index), 0);
33
+ };
34
+ const goToSlidePrev = () => {
35
+ setTimeout(() => swiperRef.current?.slidePrev(), 0);
36
+ };
37
+ const handleNextStep = () => {
38
+ if (!story) {
39
+ return;
40
+ }
41
+ if (activeStoryItemIndex !== story.items.length - 1) {
42
+ goToSlide(activeStoryItemIndex + 1);
43
+ }
44
+ else if (onFinished) {
45
+ setActiveStoryItemIndex(0);
46
+ setTimeout(() => swiperRef.current?.slideTo(0, 0), 0);
47
+ onFinished();
48
+ }
49
+ else {
50
+ onClose();
51
+ }
52
+ };
53
+ const handlePreviousStep = () => {
54
+ if (!story) {
55
+ return;
56
+ }
57
+ if (activeStoryItemIndex) {
58
+ goToSlidePrev();
59
+ }
60
+ else if (onPrev) {
61
+ setActiveStoryItemIndex(0);
62
+ goToSlide();
63
+ onPrev();
64
+ }
65
+ else {
66
+ timerRef.current.resetTimer();
67
+ }
68
+ };
69
+ const handleLongPressHandleStart = () => {
70
+ timerRef.current.pause();
71
+ };
72
+ const handleLongPressHandleEnd = () => {
73
+ timerRef.current.resume();
74
+ };
75
+ const handleClick = (event) => {
76
+ const isNext = event.touches.startX > event.width / 2;
77
+ if (isNext) {
78
+ handleNextStep();
79
+ return;
80
+ }
81
+ handlePreviousStep();
82
+ };
83
+ const longPressEvents = useTMALongPress(handleLongPressHandleStart, handleLongPressHandleEnd, handleClick);
84
+ const swiperMemoized = useMemo(() => {
85
+ return (_jsx(StyledSwiper, { className: "story-item-swiper", onBeforeInit: (swiper) => {
86
+ swiperRef.current = swiper;
87
+ }, onSlideChange: (sw) => setActiveStoryItemIndex(sw.activeIndex), modules: [Navigation], slidesPerView: 1, speed: 400, ...longPressEvents, ...storyItemsSwiperProps, children: story?.items.map(({ image, subtitle, title, component }) => {
88
+ const haveComponent = Boolean(component);
89
+ return (_jsxs(SwiperSlide, { className: "story-item-slide", children: [haveComponent && component, !haveComponent && (_jsxs(Stack, { className: "story-item-wrapper", p: 2, rowGap: 6, pt: 90 / BASE_SPACING, sx: { height: '100%' }, children: [_jsx(Box, { sx: {
90
+ marginX: 'auto',
91
+ height: '70%',
92
+ minHeight: '70%',
93
+ maxHeight: '70%',
94
+ width: '100%',
95
+ position: 'relative',
96
+ }, children: image && (_jsx(Image, { src: image, alt: title ?? '', fill: true, sizes: "100vw", style: { objectFit: 'contain' }, priority: true })) }), _jsxs(Stack, { sx: { minHeight: 300 }, rowGap: 12 / BASE_SPACING, children: [_jsx(Typography, { className: "story-item-title", variant: storyItemTitleVariant, sx: { fontWeight: 590 }, children: title }), _jsx(Typography, { className: "story-item-subtitle", sx: { whiteSpace: 'pre-wrap', lineHeight: '22px' }, variant: storyItemSubtitleVariant, children: subtitle })] })] }))] }, subtitle));
97
+ }) }));
98
+ }, [story, longPressEvents, storyItemsSwiperProps]);
99
+ return (_jsxs(Drawer, { className: "story-drawer", anchor: "bottom", onTouchStart: timerRef.current?.pause, onTouchEnd: timerRef.current?.resume, open: Boolean(story), ModalProps: { onBackdropClick: onClose }, sx: {
100
+ '& .MuiDrawer-paperAnchorBottom.MuiPaper-root': {
101
+ borderTopLeftRadius: 0,
102
+ borderTopRightRadius: 0,
103
+ pb: 0,
104
+ },
105
+ }, children: [_jsx(StoryProgress, { activeStoryItemIndex: activeStoryItemIndex, onExpirationTimer: handleNextStep, onItemClick: (index) => swiperRef.current?.slideTo(index), story: story, timerRef: timerRef }), _jsx(Stack, { className: "story-drawer-closer", justifyContent: "center", alignItems: "center", onClick: (event) => {
106
+ event.preventDefault();
107
+ onClose();
108
+ }, sx: {
109
+ height: 40,
110
+ width: 40,
111
+ position: 'absolute',
112
+ zIndex: 1000,
113
+ top: 42,
114
+ right: 16,
115
+ borderRadius: '10px',
116
+ cursor: 'pointer',
117
+ background: '#2990FF26',
118
+ }, children: _jsx(CloseOutlined, {}) }), swiperMemoized] }));
119
+ };
@@ -0,0 +1,5 @@
1
+ import { TMABannersFeedProps } from './TMABannerFeed';
2
+ export type TMABannerFeedPropsContextType = TMABannersFeedProps;
3
+ export declare const tmaBannerFeedPropsContext: import("react").Context<TMABannersFeedProps>;
4
+ export declare const useTMABannerFeedPropsContext: () => TMABannersFeedProps;
5
+ //# sourceMappingURL=propsContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"propsContext.d.ts","sourceRoot":"","sources":["../../../src/components/TMABannersFeed/propsContext.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,MAAM,6BAA6B,GAAG,mBAAmB,CAAC;AAEhE,eAAO,MAAM,yBAAyB,8CAAsD,CAAC;AAE7F,eAAO,MAAM,4BAA4B,2BAGxC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { createContext, useContext, useMemo } from 'react';
2
+ export const tmaBannerFeedPropsContext = createContext(null);
3
+ export const useTMABannerFeedPropsContext = () => {
4
+ const value = useContext(tmaBannerFeedPropsContext);
5
+ return useMemo(() => value, [value]);
6
+ };
@@ -0,0 +1,12 @@
1
+ export interface ItemTooltipProps {
2
+ value: number | string;
3
+ position: {
4
+ x: number;
5
+ y: number;
6
+ };
7
+ id?: number;
8
+ isFirst?: boolean;
9
+ isLast?: boolean;
10
+ }
11
+ export declare function ItemTooltip(props: ItemTooltipProps): import("react/jsx-runtime").JSX.Element;
12
+ //# sourceMappingURL=ItemTooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ItemTooltip.d.ts","sourceRoot":"","sources":["../../../src/components/TMABarChart/ItemTooltip.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAmDlD"}
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useMemo } from 'react';
3
+ import { NoSsr, Paper } from '@mui/material';
4
+ import Popper from '@mui/material/Popper';
5
+ import { BASE_SPACING, commonColors } from '../../theme';
6
+ import Stack from '@mui/material/Stack';
7
+ import Typography from '@mui/material/Typography';
8
+ export function ItemTooltip(props) {
9
+ const { position, isFirst, isLast, value } = props;
10
+ const tooltipPosition = useMemo(() => ({
11
+ x: position.x,
12
+ y: position.y,
13
+ }), [position]);
14
+ return (_jsx(NoSsr, { children: _jsx(Popper, { sx: {
15
+ pointerEvents: 'none',
16
+ zIndex: (theme) => theme.zIndex.modal,
17
+ }, open: true, placement: isFirst ? 'top-start' : isLast ? 'top-end' : 'top', anchorEl: {
18
+ getBoundingClientRect: () => ({
19
+ x: tooltipPosition.x,
20
+ y: tooltipPosition.y,
21
+ width: 0,
22
+ height: 0,
23
+ top: tooltipPosition.y,
24
+ right: tooltipPosition.x,
25
+ bottom: tooltipPosition.y,
26
+ left: tooltipPosition.x,
27
+ }),
28
+ }, children: _jsx(Paper, { elevation: 0, sx: {
29
+ p: 10 / BASE_SPACING,
30
+ backgroundColor: commonColors.card_bg_color.dark,
31
+ borderRadius: (12 / BASE_SPACING) * 2,
32
+ }, children: _jsx(Stack, { direction: "row", alignItems: "center", children: _jsx(Typography, { variant: "caption1Regular", color: "white", children: value }) }) }) }) }));
33
+ }
@@ -0,0 +1,10 @@
1
+ export interface TMABarChartProps {
2
+ xTickLabels: any[];
3
+ data: number[];
4
+ tooltipSuffix?: string;
5
+ width?: number | string;
6
+ height?: number;
7
+ fullWidth?: boolean;
8
+ }
9
+ export declare const TMABarChart: (props: TMABarChartProps) => import("react/jsx-runtime").JSX.Element;
10
+ //# sourceMappingURL=TMABarChart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TMABarChart.d.ts","sourceRoot":"","sources":["../../../src/components/TMABarChart/TMABarChart.tsx"],"names":[],"mappings":"AAeA,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,GAAG,EAAE,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AASD,eAAO,MAAM,WAAW,UAAW,gBAAgB,4CA+HlD,CAAC"}