@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.
- package/README.md +419 -0
- package/dist/cjs/components/TMAActionBar/TMAActionBar.d.ts +10 -0
- package/dist/cjs/components/TMAActionBar/TMAActionBar.d.ts.map +1 -0
- package/dist/cjs/components/TMAActionBar/TMAActionBar.js +40 -0
- package/dist/cjs/components/TMABannersFeed/StoryDrawer.d.ts +12 -0
- package/dist/cjs/components/TMABannersFeed/StoryDrawer.d.ts.map +1 -0
- package/dist/cjs/components/TMABannersFeed/StoryDrawer.js +121 -0
- package/dist/cjs/components/TMABannersFeed/StoryProgress.d.ts +11 -0
- package/dist/cjs/components/TMABannersFeed/StoryProgress.d.ts.map +1 -0
- package/dist/cjs/components/TMABannersFeed/StoryProgress.js +81 -0
- package/dist/cjs/components/TMABannersFeed/TMABannerFeed.d.ts +28 -0
- package/dist/cjs/components/TMABannersFeed/TMABannerFeed.d.ts.map +1 -0
- package/dist/cjs/components/TMABannersFeed/TMABannerFeed.js +87 -0
- package/dist/cjs/components/TMABannersFeed/TMABannerFeedPropsContext.d.ts +5 -0
- package/dist/cjs/components/TMABannersFeed/TMABannerFeedPropsContext.d.ts.map +1 -0
- package/dist/cjs/components/TMABannersFeed/TMABannerFeedPropsContext.js +11 -0
- package/dist/cjs/components/TMABannersFeed/TMAStoryDrawer.d.ts +11 -0
- package/dist/cjs/components/TMABannersFeed/TMAStoryDrawer.d.ts.map +1 -0
- package/dist/cjs/components/TMABannersFeed/TMAStoryDrawer.js +126 -0
- package/dist/cjs/components/TMABannersFeed/propsContext.d.ts +5 -0
- package/dist/cjs/components/TMABannersFeed/propsContext.d.ts.map +1 -0
- package/dist/cjs/components/TMABannersFeed/propsContext.js +10 -0
- package/dist/cjs/components/TMABarChart/ItemTooltip.d.ts +12 -0
- package/dist/cjs/components/TMABarChart/ItemTooltip.d.ts.map +1 -0
- package/dist/cjs/components/TMABarChart/ItemTooltip.js +39 -0
- package/dist/cjs/components/TMABarChart/TMABarChart.d.ts +10 -0
- package/dist/cjs/components/TMABarChart/TMABarChart.d.ts.map +1 -0
- package/dist/cjs/components/TMABarChart/TMABarChart.js +131 -0
- package/dist/cjs/components/TMABaseSection/TMABaseSection.d.ts +7 -0
- package/dist/cjs/components/TMABaseSection/TMABaseSection.d.ts.map +1 -0
- package/dist/cjs/components/TMABaseSection/TMABaseSection.js +18 -0
- package/dist/cjs/components/TMACell/TMACell.d.ts +12 -0
- package/dist/cjs/components/TMACell/TMACell.d.ts.map +1 -0
- package/dist/cjs/components/TMACell/TMACell.js +18 -0
- package/dist/cjs/components/TMACellList/TMACellList.d.ts +6 -0
- package/dist/cjs/components/TMACellList/TMACellList.d.ts.map +1 -0
- package/dist/cjs/components/TMACellList/TMACellList.js +18 -0
- package/dist/cjs/components/TMACheckbox/TMACheckbox.d.ts +7 -0
- package/dist/cjs/components/TMACheckbox/TMACheckbox.d.ts.map +1 -0
- package/dist/cjs/components/TMACheckbox/TMACheckbox.js +11 -0
- package/dist/cjs/components/TMACounter/TMACountInput.d.ts +9 -0
- package/dist/cjs/components/TMACounter/TMACountInput.d.ts.map +1 -0
- package/dist/cjs/components/TMACounter/TMACountInput.js +36 -0
- package/dist/cjs/components/TMACounter/TMACounter.d.ts +11 -0
- package/dist/cjs/components/TMACounter/TMACounter.d.ts.map +1 -0
- package/dist/cjs/components/TMACounter/TMACounter.js +33 -0
- package/dist/cjs/components/TMADrawerFilter/TMADrawerFilter.d.ts +29 -0
- package/dist/cjs/components/TMADrawerFilter/TMADrawerFilter.d.ts.map +1 -0
- package/dist/cjs/components/TMADrawerFilter/TMADrawerFilter.js +47 -0
- package/dist/cjs/components/TMADrawerFilter/TMARightDrawerFilter.d.ts +4 -0
- package/dist/cjs/components/TMADrawerFilter/TMARightDrawerFilter.d.ts.map +1 -0
- package/dist/cjs/components/TMADrawerFilter/TMARightDrawerFilter.js +12 -0
- package/dist/cjs/components/TMADrawerFilter/TMATopDrawerFilter.d.ts +4 -0
- package/dist/cjs/components/TMADrawerFilter/TMATopDrawerFilter.d.ts.map +1 -0
- package/dist/cjs/components/TMADrawerFilter/TMATopDrawerFilter.js +11 -0
- package/dist/cjs/components/TMADrawerHeader/TMADrawerHeader.d.ts +6 -0
- package/dist/cjs/components/TMADrawerHeader/TMADrawerHeader.d.ts.map +1 -0
- package/dist/cjs/components/TMADrawerHeader/TMADrawerHeader.js +29 -0
- package/dist/cjs/components/TMALoadable/TMALoadable.d.ts +15 -0
- package/dist/cjs/components/TMALoadable/TMALoadable.d.ts.map +1 -0
- package/dist/cjs/components/TMALoadable/TMALoadable.js +25 -0
- package/dist/cjs/components/TMAMultiSelectWithTags/TMAMultiSelectWithTags.d.ts +34 -0
- package/dist/cjs/components/TMAMultiSelectWithTags/TMAMultiSelectWithTags.d.ts.map +1 -0
- package/dist/cjs/components/TMAMultiSelectWithTags/TMAMultiSelectWithTags.js +188 -0
- package/dist/cjs/components/TMASelect/TMASelect.d.ts +20 -0
- package/dist/cjs/components/TMASelect/TMASelect.d.ts.map +1 -0
- package/dist/cjs/components/TMASelect/TMASelect.js +152 -0
- package/dist/cjs/components/TMASelect/TMASelectOption.d.ts +8 -0
- package/dist/cjs/components/TMASelect/TMASelectOption.d.ts.map +1 -0
- package/dist/cjs/components/TMASelect/TMASelectOption.js +15 -0
- package/dist/cjs/components/TMAStatisticsCard/TMAStatisticsCard.d.ts +12 -0
- package/dist/cjs/components/TMAStatisticsCard/TMAStatisticsCard.d.ts.map +1 -0
- package/dist/cjs/components/TMAStatisticsCard/TMAStatisticsCard.js +30 -0
- package/dist/cjs/components/TMATabs/TMATabs.d.ts +14 -0
- package/dist/cjs/components/TMATabs/TMATabs.d.ts.map +1 -0
- package/dist/cjs/components/TMATabs/TMATabs.js +32 -0
- package/dist/cjs/components/TMATextField/TMATextField.d.ts +9 -0
- package/dist/cjs/components/TMATextField/TMATextField.d.ts.map +1 -0
- package/dist/cjs/components/TMATextField/TMATextField.js +30 -0
- package/dist/cjs/components/TMATextWithTitle/TMATextWithTitle.d.ts +7 -0
- package/dist/cjs/components/TMATextWithTitle/TMATextWithTitle.d.ts.map +1 -0
- package/dist/cjs/components/TMATextWithTitle/TMATextWithTitle.js +21 -0
- package/dist/cjs/components/TMAToast/TMAToast.d.ts +14 -0
- package/dist/cjs/components/TMAToast/TMAToast.d.ts.map +1 -0
- package/dist/cjs/components/TMAToast/TMAToast.js +45 -0
- package/dist/cjs/components/TMATooltip/TMATooltip.d.ts +11 -0
- package/dist/cjs/components/TMATooltip/TMATooltip.d.ts.map +1 -0
- package/dist/cjs/components/TMATooltip/TMATooltip.js +12 -0
- package/dist/cjs/components/index.d.ts +28 -0
- package/dist/cjs/components/index.d.ts.map +1 -0
- package/dist/cjs/components/index.js +55 -0
- package/dist/cjs/context/BackButtonContext/BackButtonContext.d.ts +7 -0
- package/dist/cjs/context/BackButtonContext/BackButtonContext.d.ts.map +1 -0
- package/dist/cjs/context/BackButtonContext/BackButtonContext.js +16 -0
- package/dist/cjs/context/index.d.ts +2 -0
- package/dist/cjs/context/index.d.ts.map +1 -0
- package/dist/cjs/context/index.js +17 -0
- package/dist/cjs/context/theme.d.ts +7 -0
- package/dist/cjs/context/theme.d.ts.map +1 -0
- package/dist/cjs/context/theme.js +16 -0
- package/dist/cjs/fonts.d.ts +4 -0
- package/dist/cjs/fonts.d.ts.map +1 -0
- package/dist/cjs/fonts.js +80 -0
- package/dist/cjs/hooks/index.d.ts +3 -0
- package/dist/cjs/hooks/index.d.ts.map +1 -0
- package/dist/cjs/hooks/index.js +23 -0
- package/dist/cjs/hooks/useBackButton.d.ts +2 -0
- package/dist/cjs/hooks/useBackButton.d.ts.map +1 -0
- package/dist/cjs/hooks/useBackButton.js +28 -0
- package/dist/cjs/hooks/useTMALongPress.d.ts +13 -0
- package/dist/cjs/hooks/useTMALongPress.d.ts.map +1 -0
- package/dist/cjs/hooks/useTMALongPress.js +63 -0
- package/dist/cjs/index.d.ts +7 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +50 -0
- package/dist/cjs/theme.d.ts +541 -0
- package/dist/cjs/theme.d.ts.map +1 -0
- package/dist/cjs/theme.js +769 -0
- package/dist/components/TMAActionBar/TMAActionBar.d.ts +10 -0
- package/dist/components/TMAActionBar/TMAActionBar.d.ts.map +1 -0
- package/dist/components/TMAActionBar/TMAActionBar.js +33 -0
- package/dist/components/TMABannersFeed/StoryDrawer.d.ts +12 -0
- package/dist/components/TMABannersFeed/StoryDrawer.d.ts.map +1 -0
- package/dist/components/TMABannersFeed/StoryDrawer.js +114 -0
- package/dist/components/TMABannersFeed/StoryProgress.d.ts +11 -0
- package/dist/components/TMABannersFeed/StoryProgress.d.ts.map +1 -0
- package/dist/components/TMABannersFeed/StoryProgress.js +77 -0
- package/dist/components/TMABannersFeed/TMABannerFeed.d.ts +28 -0
- package/dist/components/TMABannersFeed/TMABannerFeed.d.ts.map +1 -0
- package/dist/components/TMABannersFeed/TMABannerFeed.js +80 -0
- package/dist/components/TMABannersFeed/TMABannerFeedPropsContext.d.ts +5 -0
- package/dist/components/TMABannersFeed/TMABannerFeedPropsContext.d.ts.map +1 -0
- package/dist/components/TMABannersFeed/TMABannerFeedPropsContext.js +7 -0
- package/dist/components/TMABannersFeed/TMAStoryDrawer.d.ts +11 -0
- package/dist/components/TMABannersFeed/TMAStoryDrawer.d.ts.map +1 -0
- package/dist/components/TMABannersFeed/TMAStoryDrawer.js +119 -0
- package/dist/components/TMABannersFeed/propsContext.d.ts +5 -0
- package/dist/components/TMABannersFeed/propsContext.d.ts.map +1 -0
- package/dist/components/TMABannersFeed/propsContext.js +6 -0
- package/dist/components/TMABarChart/ItemTooltip.d.ts +12 -0
- package/dist/components/TMABarChart/ItemTooltip.d.ts.map +1 -0
- package/dist/components/TMABarChart/ItemTooltip.js +33 -0
- package/dist/components/TMABarChart/TMABarChart.d.ts +10 -0
- package/dist/components/TMABarChart/TMABarChart.d.ts.map +1 -0
- package/dist/components/TMABarChart/TMABarChart.js +91 -0
- package/dist/components/TMABaseSection/TMABaseSection.d.ts +7 -0
- package/dist/components/TMABaseSection/TMABaseSection.d.ts.map +1 -0
- package/dist/components/TMABaseSection/TMABaseSection.js +11 -0
- package/dist/components/TMACell/TMACell.d.ts +12 -0
- package/dist/components/TMACell/TMACell.d.ts.map +1 -0
- package/dist/components/TMACell/TMACell.js +11 -0
- package/dist/components/TMACellList/TMACellList.d.ts +6 -0
- package/dist/components/TMACellList/TMACellList.d.ts.map +1 -0
- package/dist/components/TMACellList/TMACellList.js +11 -0
- package/dist/components/TMACheckbox/TMACheckbox.d.ts +7 -0
- package/dist/components/TMACheckbox/TMACheckbox.d.ts.map +1 -0
- package/dist/components/TMACheckbox/TMACheckbox.js +7 -0
- package/dist/components/TMACounter/TMACountInput.d.ts +9 -0
- package/dist/components/TMACounter/TMACountInput.d.ts.map +1 -0
- package/dist/components/TMACounter/TMACountInput.js +34 -0
- package/dist/components/TMACounter/TMACounter.d.ts +11 -0
- package/dist/components/TMACounter/TMACounter.d.ts.map +1 -0
- package/dist/components/TMACounter/TMACounter.js +26 -0
- package/dist/components/TMADrawerFilter/TMADrawerFilter.d.ts +29 -0
- package/dist/components/TMADrawerFilter/TMADrawerFilter.d.ts.map +1 -0
- package/dist/components/TMADrawerFilter/TMADrawerFilter.js +40 -0
- package/dist/components/TMADrawerFilter/TMARightDrawerFilter.d.ts +4 -0
- package/dist/components/TMADrawerFilter/TMARightDrawerFilter.d.ts.map +1 -0
- package/dist/components/TMADrawerFilter/TMARightDrawerFilter.js +8 -0
- package/dist/components/TMADrawerFilter/TMATopDrawerFilter.d.ts +4 -0
- package/dist/components/TMADrawerFilter/TMATopDrawerFilter.d.ts.map +1 -0
- package/dist/components/TMADrawerFilter/TMATopDrawerFilter.js +7 -0
- package/dist/components/TMADrawerHeader/TMADrawerHeader.d.ts +6 -0
- package/dist/components/TMADrawerHeader/TMADrawerHeader.d.ts.map +1 -0
- package/dist/components/TMADrawerHeader/TMADrawerHeader.js +22 -0
- package/dist/components/TMALoadable/TMALoadable.d.ts +15 -0
- package/dist/components/TMALoadable/TMALoadable.d.ts.map +1 -0
- package/dist/components/TMALoadable/TMALoadable.js +18 -0
- package/dist/components/TMAMultiSelectWithTags/TMAMultiSelectWithTags.d.ts +34 -0
- package/dist/components/TMAMultiSelectWithTags/TMAMultiSelectWithTags.d.ts.map +1 -0
- package/dist/components/TMAMultiSelectWithTags/TMAMultiSelectWithTags.js +181 -0
- package/dist/components/TMASelect/TMASelect.d.ts +20 -0
- package/dist/components/TMASelect/TMASelect.d.ts.map +1 -0
- package/dist/components/TMASelect/TMASelect.js +145 -0
- package/dist/components/TMASelect/TMASelectOption.d.ts +8 -0
- package/dist/components/TMASelect/TMASelectOption.d.ts.map +1 -0
- package/dist/components/TMASelect/TMASelectOption.js +8 -0
- package/dist/components/TMAStatisticsCard/TMAStatisticsCard.d.ts +12 -0
- package/dist/components/TMAStatisticsCard/TMAStatisticsCard.d.ts.map +1 -0
- package/dist/components/TMAStatisticsCard/TMAStatisticsCard.js +23 -0
- package/dist/components/TMATabs/TMATabs.d.ts +14 -0
- package/dist/components/TMATabs/TMATabs.d.ts.map +1 -0
- package/dist/components/TMATabs/TMATabs.js +25 -0
- package/dist/components/TMATextField/TMATextField.d.ts +9 -0
- package/dist/components/TMATextField/TMATextField.d.ts.map +1 -0
- package/dist/components/TMATextField/TMATextField.js +23 -0
- package/dist/components/TMATextWithTitle/TMATextWithTitle.d.ts +7 -0
- package/dist/components/TMATextWithTitle/TMATextWithTitle.d.ts.map +1 -0
- package/dist/components/TMATextWithTitle/TMATextWithTitle.js +14 -0
- package/dist/components/TMAToast/TMAToast.d.ts +14 -0
- package/dist/components/TMAToast/TMAToast.d.ts.map +1 -0
- package/dist/components/TMAToast/TMAToast.js +38 -0
- package/dist/components/TMATooltip/TMATooltip.d.ts +11 -0
- package/dist/components/TMATooltip/TMATooltip.d.ts.map +1 -0
- package/dist/components/TMATooltip/TMATooltip.js +5 -0
- package/dist/components/index.d.ts +28 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +25 -0
- package/dist/context/BackButtonContext/BackButtonContext.d.ts +7 -0
- package/dist/context/BackButtonContext/BackButtonContext.d.ts.map +1 -0
- package/dist/context/BackButtonContext/BackButtonContext.js +12 -0
- package/dist/context/index.d.ts +2 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +1 -0
- package/dist/context/theme.d.ts +7 -0
- package/dist/context/theme.d.ts.map +1 -0
- package/dist/context/theme.js +10 -0
- package/dist/fonts.d.ts +4 -0
- package/dist/fonts.d.ts.map +1 -0
- package/dist/fonts.js +74 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/useBackButton.d.ts +2 -0
- package/dist/hooks/useBackButton.d.ts.map +1 -0
- package/dist/hooks/useBackButton.js +24 -0
- package/dist/hooks/useTMALongPress.d.ts +13 -0
- package/dist/hooks/useTMALongPress.d.ts.map +1 -0
- package/dist/hooks/useTMALongPress.js +61 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/theme.d.ts +541 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +766 -0
- package/fonts/Inter.ttf +0 -0
- package/fonts/SF-Pro.ttf +0 -0
- package/fonts/SFMono-Medium.otf +0 -0
- package/package.json +65 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.StoryProgress = void 0;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const material_1 = require("@mui/material");
|
|
8
|
+
const react_timer_hook_1 = require("react-timer-hook");
|
|
9
|
+
const theme_1 = require("../../theme");
|
|
10
|
+
const TMABannerFeedPropsContext_1 = require("./TMABannerFeedPropsContext");
|
|
11
|
+
const MAX_TIME_OF_STORY = 10;
|
|
12
|
+
const StoryProgress = ({ story, activeStoryItemIndex, onExpirationTimer, onItemClick, timerRef, }) => {
|
|
13
|
+
const { maxStoryTimeSeconds = MAX_TIME_OF_STORY } = (0, TMABannerFeedPropsContext_1.useTMABannerFeedPropsContext)();
|
|
14
|
+
const maxStoryTimeMilliseconds = maxStoryTimeSeconds * 1000;
|
|
15
|
+
const getTimerOffset = (0, react_1.useCallback)(() => {
|
|
16
|
+
const newOffsetDate = new Date();
|
|
17
|
+
newOffsetDate.setMilliseconds(newOffsetDate.getMilliseconds() + maxStoryTimeMilliseconds);
|
|
18
|
+
return newOffsetDate;
|
|
19
|
+
}, [maxStoryTimeMilliseconds]);
|
|
20
|
+
const resetTimer = () => {
|
|
21
|
+
restart(getTimerOffset(), true);
|
|
22
|
+
};
|
|
23
|
+
const handleExpirationTimer = () => {
|
|
24
|
+
if (!story) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (activeStoryItemIndex !== story.items.length - 1) {
|
|
28
|
+
resetTimer();
|
|
29
|
+
}
|
|
30
|
+
onExpirationTimer();
|
|
31
|
+
};
|
|
32
|
+
const timer = (0, react_timer_hook_1.useTimer)({
|
|
33
|
+
autoStart: true,
|
|
34
|
+
interval: maxStoryTimeSeconds,
|
|
35
|
+
expiryTimestamp: getTimerOffset(),
|
|
36
|
+
onExpire: handleExpirationTimer,
|
|
37
|
+
});
|
|
38
|
+
if (timerRef) {
|
|
39
|
+
timerRef.current = {
|
|
40
|
+
...timer,
|
|
41
|
+
resetTimer,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const { totalMilliseconds: time, pause, restart } = timer;
|
|
45
|
+
const stopTimer = () => {
|
|
46
|
+
pause();
|
|
47
|
+
};
|
|
48
|
+
(0, react_1.useEffect)(() => {
|
|
49
|
+
if (story) {
|
|
50
|
+
resetTimer();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
stopTimer();
|
|
54
|
+
}, [story, activeStoryItemIndex]);
|
|
55
|
+
const getProgressBarValue = (currentIndex) => {
|
|
56
|
+
if (currentIndex === activeStoryItemIndex) {
|
|
57
|
+
return (1 - time / maxStoryTimeMilliseconds) * 100;
|
|
58
|
+
}
|
|
59
|
+
return currentIndex > activeStoryItemIndex ? 0 : 100;
|
|
60
|
+
};
|
|
61
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Stack, { className: "story-progress", onClick: (event) => event.stopPropagation(), gap: 4 / theme_1.BASE_SPACING, sx: {
|
|
62
|
+
position: 'absolute',
|
|
63
|
+
top: 0,
|
|
64
|
+
left: 0,
|
|
65
|
+
right: 0,
|
|
66
|
+
zIndex: 1000,
|
|
67
|
+
mt: 2,
|
|
68
|
+
mx: 2,
|
|
69
|
+
}, direction: "row", children: story?.items.map((storyItem, index) => ((0, jsx_runtime_1.jsx)(material_1.Box, { className: "story-progress-item-wrapper", onClick: () => onItemClick(index), flex: 1, height: 25, display: "flex", justifyItems: "center", children: (0, jsx_runtime_1.jsx)(material_1.LinearProgress, { className: "story-progress-item", variant: "determinate", sx: {
|
|
70
|
+
width: '100%',
|
|
71
|
+
borderRadius: 1,
|
|
72
|
+
'& .MuiLinearProgress-bar': {
|
|
73
|
+
transition: 'none',
|
|
74
|
+
background: 'white',
|
|
75
|
+
},
|
|
76
|
+
'&.MuiLinearProgress-root': {
|
|
77
|
+
background: '#FFFFFF1A',
|
|
78
|
+
},
|
|
79
|
+
}, value: getProgressBarValue(index) }) }, storyItem.subtitle))) }));
|
|
80
|
+
};
|
|
81
|
+
exports.StoryProgress = StoryProgress;
|
|
@@ -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,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.TMABannersFeed = void 0;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const styles_1 = require("@mui/material/styles");
|
|
11
|
+
const Box_1 = __importDefault(require("@mui/material/Box"));
|
|
12
|
+
const Stack_1 = __importDefault(require("@mui/material/Stack"));
|
|
13
|
+
const Typography_1 = __importDefault(require("@mui/material/Typography"));
|
|
14
|
+
const react_2 = require("swiper/react");
|
|
15
|
+
const TMAStoryDrawer_1 = require("./TMAStoryDrawer");
|
|
16
|
+
const theme_1 = require("../../theme");
|
|
17
|
+
const TMABannerFeedPropsContext_1 = require("./TMABannerFeedPropsContext");
|
|
18
|
+
const StyledBannerWrapper = (0, styles_1.styled)(Stack_1.default)(({ theme }) => theme.unstable_sx({
|
|
19
|
+
borderRadius: '12px',
|
|
20
|
+
width: 103,
|
|
21
|
+
height: 103,
|
|
22
|
+
borderColor: theme.palette?.accent_text_color.main,
|
|
23
|
+
borderWidth: 2,
|
|
24
|
+
borderStyle: 'solid',
|
|
25
|
+
position: 'relative',
|
|
26
|
+
marginRight: 12 / theme_1.BASE_SPACING,
|
|
27
|
+
}));
|
|
28
|
+
const StyledBanner = (0, styles_1.styled)(Stack_1.default, {
|
|
29
|
+
shouldForwardProp: (prop) => ['isGray'].every((key) => key !== prop),
|
|
30
|
+
})(({ theme, isGray }) => theme.unstable_sx({
|
|
31
|
+
background: isGray
|
|
32
|
+
? 'linear-gradient(180deg, #E6FFEE, #A3A9A7)'
|
|
33
|
+
: 'linear-gradient(180deg, #5FC1FF 0%, #0078EE 100%)',
|
|
34
|
+
borderRadius: '12px',
|
|
35
|
+
borderColor: theme.palette?.bg_color.main,
|
|
36
|
+
borderWidth: 2,
|
|
37
|
+
borderStyle: 'solid',
|
|
38
|
+
width: 99,
|
|
39
|
+
height: 99,
|
|
40
|
+
p: 6 / theme_1.BASE_SPACING,
|
|
41
|
+
position: 'relative',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
'&:after': {
|
|
44
|
+
content: "''",
|
|
45
|
+
zIndex: 1,
|
|
46
|
+
position: 'absolute',
|
|
47
|
+
height: 40,
|
|
48
|
+
width: 95,
|
|
49
|
+
borderRadius: '12px',
|
|
50
|
+
background: 'linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.5) 100%)',
|
|
51
|
+
bottom: -1,
|
|
52
|
+
},
|
|
53
|
+
}));
|
|
54
|
+
const StyledSwiper = (0, styles_1.styled)(react_2.Swiper)(({ theme }) => ({
|
|
55
|
+
'& .swiper-wrapper': {
|
|
56
|
+
width: 'fit-content',
|
|
57
|
+
maxWidth: 'fit-content',
|
|
58
|
+
},
|
|
59
|
+
}));
|
|
60
|
+
const StyledSwiperSlide = (0, styles_1.styled)(react_2.SwiperSlide)(({ theme }) => ({
|
|
61
|
+
width: 'fit-content',
|
|
62
|
+
flex: 1,
|
|
63
|
+
}));
|
|
64
|
+
const TMABannersFeed = (props) => {
|
|
65
|
+
const { stories, sx = {}, storiesSwiperProps = {}, storyTitleVariant = 'caption3Semibold', } = props;
|
|
66
|
+
const [activeStoryIndex, setActiveStoryIndex] = (0, react_1.useState)(null);
|
|
67
|
+
const handleFinishedStory = () => {
|
|
68
|
+
setActiveStoryIndex(Number(activeStoryIndex) + 1);
|
|
69
|
+
};
|
|
70
|
+
const handlePrevStory = () => {
|
|
71
|
+
setActiveStoryIndex(Number(activeStoryIndex) - 1);
|
|
72
|
+
};
|
|
73
|
+
const haveStories = Boolean(stories?.length);
|
|
74
|
+
return ((0, jsx_runtime_1.jsx)(Box_1.default, { sx: sx, children: (0, jsx_runtime_1.jsxs)(TMABannerFeedPropsContext_1.TMABannerFeedPropsContext.Provider, { value: props, children: [(0, jsx_runtime_1.jsx)(StyledSwiper, { className: "story-swiper", allowTouchMove: true, slidesPerView: "auto", speed: 400, ...storiesSwiperProps, children: stories?.map((story, index) => ((0, jsx_runtime_1.jsx)(StyledSwiperSlide, { className: "story-slide", children: (0, jsx_runtime_1.jsx)(StyledBannerWrapper, { alignItems: "center", justifyContent: "center", className: "story-banner-wrapper", children: (0, jsx_runtime_1.jsxs)(StyledBanner, { isGray: story.isGray, onClick: () => setActiveStoryIndex(index), className: "story-banner", children: [story.image, (0, jsx_runtime_1.jsx)(Typography_1.default, { className: "story-banner-title", variant: storyTitleVariant, sx: {
|
|
75
|
+
width: '85%',
|
|
76
|
+
position: 'absolute',
|
|
77
|
+
bottom: 6,
|
|
78
|
+
left: 6,
|
|
79
|
+
fontSize: 10,
|
|
80
|
+
fontWeight: 600,
|
|
81
|
+
lineHeight: '107%',
|
|
82
|
+
zIndex: 2,
|
|
83
|
+
}, children: story.title })] }) }) }, story.title))) }), activeStoryIndex !== null && haveStories && ((0, jsx_runtime_1.jsx)(TMAStoryDrawer_1.TMAStoryDrawer, { onFinished: activeStoryIndex !== stories.length - 1
|
|
84
|
+
? handleFinishedStory
|
|
85
|
+
: undefined, onPrev: activeStoryIndex ? handlePrevStory : undefined, onClose: () => setActiveStoryIndex(null), story: stories[activeStoryIndex] }))] }) }));
|
|
86
|
+
};
|
|
87
|
+
exports.TMABannersFeed = TMABannersFeed;
|
|
@@ -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,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.useTMABannerFeedPropsContext = exports.TMABannerFeedPropsContext = void 0;
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
exports.TMABannerFeedPropsContext = (0, react_1.createContext)(null);
|
|
7
|
+
const useTMABannerFeedPropsContext = () => {
|
|
8
|
+
const value = (0, react_1.useContext)(exports.TMABannerFeedPropsContext);
|
|
9
|
+
return (0, react_1.useMemo)(() => value, [value]);
|
|
10
|
+
};
|
|
11
|
+
exports.useTMABannerFeedPropsContext = useTMABannerFeedPropsContext;
|
|
@@ -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,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.TMAStoryDrawer = void 0;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const styles_1 = require("@mui/material/styles");
|
|
11
|
+
const Box_1 = __importDefault(require("@mui/material/Box"));
|
|
12
|
+
const image_1 = __importDefault(require("next/image"));
|
|
13
|
+
const Drawer_1 = __importDefault(require("@mui/material/Drawer"));
|
|
14
|
+
const Stack_1 = __importDefault(require("@mui/material/Stack"));
|
|
15
|
+
const Typography_1 = __importDefault(require("@mui/material/Typography"));
|
|
16
|
+
const CloseOutlined_1 = __importDefault(require("@mui/icons-material/CloseOutlined"));
|
|
17
|
+
const react_2 = require("swiper/react");
|
|
18
|
+
const modules_1 = require("swiper/modules");
|
|
19
|
+
const StoryProgress_1 = require("./StoryProgress");
|
|
20
|
+
const useTMALongPress_1 = __importDefault(require("../../hooks/useTMALongPress"));
|
|
21
|
+
const TMABannerFeedPropsContext_1 = require("./TMABannerFeedPropsContext");
|
|
22
|
+
const theme_1 = require("../../theme");
|
|
23
|
+
const StyledSwiper = (0, styles_1.styled)(react_2.Swiper)(({ theme }) => ({
|
|
24
|
+
height: '100vh',
|
|
25
|
+
width: '100%',
|
|
26
|
+
background: 'linear-gradient(0deg, #0078EE, #5FC1FF)',
|
|
27
|
+
'& .story-item-slide': {
|
|
28
|
+
maxHeight: 'calc(100% - 90px)',
|
|
29
|
+
},
|
|
30
|
+
}));
|
|
31
|
+
const TMAStoryDrawer = ({ story, onClose, onFinished, onPrev, }) => {
|
|
32
|
+
const { storyItemsSwiperProps = {}, storyItemTitleVariant = 'title3Semibold', storyItemSubtitleVariant = 'textRegular', } = (0, TMABannerFeedPropsContext_1.useTMABannerFeedPropsContext)();
|
|
33
|
+
const [activeStoryItemIndex, setActiveStoryItemIndex] = (0, react_1.useState)(0);
|
|
34
|
+
const swiperRef = (0, react_1.useRef)(null);
|
|
35
|
+
const timerRef = (0, react_1.useRef)(null);
|
|
36
|
+
const goToSlide = (index = 0) => {
|
|
37
|
+
setActiveStoryItemIndex(index);
|
|
38
|
+
setTimeout(() => swiperRef.current?.slideTo(index), 0);
|
|
39
|
+
};
|
|
40
|
+
const goToSlidePrev = () => {
|
|
41
|
+
setTimeout(() => swiperRef.current?.slidePrev(), 0);
|
|
42
|
+
};
|
|
43
|
+
const handleNextStep = () => {
|
|
44
|
+
if (!story) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (activeStoryItemIndex !== story.items.length - 1) {
|
|
48
|
+
goToSlide(activeStoryItemIndex + 1);
|
|
49
|
+
}
|
|
50
|
+
else if (onFinished) {
|
|
51
|
+
setActiveStoryItemIndex(0);
|
|
52
|
+
setTimeout(() => swiperRef.current?.slideTo(0, 0), 0);
|
|
53
|
+
onFinished();
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
onClose();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const handlePreviousStep = () => {
|
|
60
|
+
if (!story) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (activeStoryItemIndex) {
|
|
64
|
+
goToSlidePrev();
|
|
65
|
+
}
|
|
66
|
+
else if (onPrev) {
|
|
67
|
+
setActiveStoryItemIndex(0);
|
|
68
|
+
goToSlide();
|
|
69
|
+
onPrev();
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
timerRef.current.resetTimer();
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const handleLongPressHandleStart = () => {
|
|
76
|
+
timerRef.current.pause();
|
|
77
|
+
};
|
|
78
|
+
const handleLongPressHandleEnd = () => {
|
|
79
|
+
timerRef.current.resume();
|
|
80
|
+
};
|
|
81
|
+
const handleClick = (event) => {
|
|
82
|
+
const isNext = event.touches.startX > event.width / 2;
|
|
83
|
+
if (isNext) {
|
|
84
|
+
handleNextStep();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
handlePreviousStep();
|
|
88
|
+
};
|
|
89
|
+
const longPressEvents = (0, useTMALongPress_1.default)(handleLongPressHandleStart, handleLongPressHandleEnd, handleClick);
|
|
90
|
+
const swiperMemoized = (0, react_1.useMemo)(() => {
|
|
91
|
+
return ((0, jsx_runtime_1.jsx)(StyledSwiper, { className: "story-item-swiper", onBeforeInit: (swiper) => {
|
|
92
|
+
swiperRef.current = swiper;
|
|
93
|
+
}, onSlideChange: (sw) => setActiveStoryItemIndex(sw.activeIndex), modules: [modules_1.Navigation], slidesPerView: 1, speed: 400, ...longPressEvents, ...storyItemsSwiperProps, children: story?.items.map(({ image, subtitle, title, component }) => {
|
|
94
|
+
const haveComponent = Boolean(component);
|
|
95
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.SwiperSlide, { className: "story-item-slide", children: [haveComponent && component, !haveComponent && ((0, jsx_runtime_1.jsxs)(Stack_1.default, { className: "story-item-wrapper", p: 2, rowGap: 6, pt: 90 / theme_1.BASE_SPACING, sx: { height: '100%' }, children: [(0, jsx_runtime_1.jsx)(Box_1.default, { sx: {
|
|
96
|
+
marginX: 'auto',
|
|
97
|
+
height: '70%',
|
|
98
|
+
minHeight: '70%',
|
|
99
|
+
maxHeight: '70%',
|
|
100
|
+
width: '100%',
|
|
101
|
+
position: 'relative',
|
|
102
|
+
}, children: image && ((0, jsx_runtime_1.jsx)(image_1.default, { src: image, alt: title ?? '', fill: true, sizes: "100vw", style: { objectFit: 'contain' }, priority: true })) }), (0, jsx_runtime_1.jsxs)(Stack_1.default, { sx: { minHeight: 300 }, rowGap: 12 / theme_1.BASE_SPACING, children: [(0, jsx_runtime_1.jsx)(Typography_1.default, { className: "story-item-title", variant: storyItemTitleVariant, sx: { fontWeight: 590 }, children: title }), (0, jsx_runtime_1.jsx)(Typography_1.default, { className: "story-item-subtitle", sx: { whiteSpace: 'pre-wrap', lineHeight: '22px' }, variant: storyItemSubtitleVariant, children: subtitle })] })] }))] }, subtitle));
|
|
103
|
+
}) }));
|
|
104
|
+
}, [story, longPressEvents, storyItemsSwiperProps]);
|
|
105
|
+
return ((0, jsx_runtime_1.jsxs)(Drawer_1.default, { className: "story-drawer", anchor: "bottom", onTouchStart: timerRef.current?.pause, onTouchEnd: timerRef.current?.resume, open: Boolean(story), ModalProps: { onBackdropClick: onClose }, sx: {
|
|
106
|
+
'& .MuiDrawer-paperAnchorBottom.MuiPaper-root': {
|
|
107
|
+
borderTopLeftRadius: 0,
|
|
108
|
+
borderTopRightRadius: 0,
|
|
109
|
+
pb: 0,
|
|
110
|
+
},
|
|
111
|
+
}, children: [(0, jsx_runtime_1.jsx)(StoryProgress_1.StoryProgress, { activeStoryItemIndex: activeStoryItemIndex, onExpirationTimer: handleNextStep, onItemClick: (index) => swiperRef.current?.slideTo(index), story: story, timerRef: timerRef }), (0, jsx_runtime_1.jsx)(Stack_1.default, { className: "story-drawer-closer", justifyContent: "center", alignItems: "center", onClick: (event) => {
|
|
112
|
+
event.preventDefault();
|
|
113
|
+
onClose();
|
|
114
|
+
}, sx: {
|
|
115
|
+
height: 40,
|
|
116
|
+
width: 40,
|
|
117
|
+
position: 'absolute',
|
|
118
|
+
zIndex: 1000,
|
|
119
|
+
top: 42,
|
|
120
|
+
right: 16,
|
|
121
|
+
borderRadius: '10px',
|
|
122
|
+
cursor: 'pointer',
|
|
123
|
+
background: '#2990FF26',
|
|
124
|
+
}, children: (0, jsx_runtime_1.jsx)(CloseOutlined_1.default, {}) }), swiperMemoized] }));
|
|
125
|
+
};
|
|
126
|
+
exports.TMAStoryDrawer = TMAStoryDrawer;
|
|
@@ -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,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useTMABannerFeedPropsContext = exports.tmaBannerFeedPropsContext = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
exports.tmaBannerFeedPropsContext = (0, react_1.createContext)(null);
|
|
6
|
+
const useTMABannerFeedPropsContext = () => {
|
|
7
|
+
const value = (0, react_1.useContext)(exports.tmaBannerFeedPropsContext);
|
|
8
|
+
return (0, react_1.useMemo)(() => value, [value]);
|
|
9
|
+
};
|
|
10
|
+
exports.useTMABannerFeedPropsContext = useTMABannerFeedPropsContext;
|
|
@@ -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,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ItemTooltip = ItemTooltip;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const material_1 = require("@mui/material");
|
|
10
|
+
const Popper_1 = __importDefault(require("@mui/material/Popper"));
|
|
11
|
+
const theme_1 = require("../../theme");
|
|
12
|
+
const Stack_1 = __importDefault(require("@mui/material/Stack"));
|
|
13
|
+
const Typography_1 = __importDefault(require("@mui/material/Typography"));
|
|
14
|
+
function ItemTooltip(props) {
|
|
15
|
+
const { position, isFirst, isLast, value } = props;
|
|
16
|
+
const tooltipPosition = (0, react_1.useMemo)(() => ({
|
|
17
|
+
x: position.x,
|
|
18
|
+
y: position.y,
|
|
19
|
+
}), [position]);
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(material_1.NoSsr, { children: (0, jsx_runtime_1.jsx)(Popper_1.default, { sx: {
|
|
21
|
+
pointerEvents: 'none',
|
|
22
|
+
zIndex: (theme) => theme.zIndex.modal,
|
|
23
|
+
}, open: true, placement: isFirst ? 'top-start' : isLast ? 'top-end' : 'top', anchorEl: {
|
|
24
|
+
getBoundingClientRect: () => ({
|
|
25
|
+
x: tooltipPosition.x,
|
|
26
|
+
y: tooltipPosition.y,
|
|
27
|
+
width: 0,
|
|
28
|
+
height: 0,
|
|
29
|
+
top: tooltipPosition.y,
|
|
30
|
+
right: tooltipPosition.x,
|
|
31
|
+
bottom: tooltipPosition.y,
|
|
32
|
+
left: tooltipPosition.x,
|
|
33
|
+
}),
|
|
34
|
+
}, children: (0, jsx_runtime_1.jsx)(material_1.Paper, { elevation: 0, sx: {
|
|
35
|
+
p: 10 / theme_1.BASE_SPACING,
|
|
36
|
+
backgroundColor: theme_1.commonColors.card_bg_color.dark,
|
|
37
|
+
borderRadius: (12 / theme_1.BASE_SPACING) * 2,
|
|
38
|
+
}, children: (0, jsx_runtime_1.jsx)(Stack_1.default, { direction: "row", alignItems: "center", children: (0, jsx_runtime_1.jsx)(Typography_1.default, { variant: "caption1Regular", color: "white", children: value }) }) }) }) }));
|
|
39
|
+
}
|
|
@@ -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"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.TMABarChart = void 0;
|
|
41
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
42
|
+
const react_1 = __importStar(require("react"));
|
|
43
|
+
const theme_1 = require("../../theme");
|
|
44
|
+
const x_charts_1 = require("@mui/x-charts");
|
|
45
|
+
const material_1 = require("@mui/material");
|
|
46
|
+
const ItemTooltip_1 = require("./ItemTooltip");
|
|
47
|
+
const Box_1 = __importDefault(require("@mui/material/Box"));
|
|
48
|
+
const formatNumberToK = (value) => {
|
|
49
|
+
if (value >= 1000) {
|
|
50
|
+
return `${value / 1000}K`;
|
|
51
|
+
}
|
|
52
|
+
return value.toString();
|
|
53
|
+
};
|
|
54
|
+
const TMABarChart = (props) => {
|
|
55
|
+
const { xTickLabels, data, tooltipSuffix, width = 400, height = 300, fullWidth, } = props;
|
|
56
|
+
const [tooltipData, setTooltipData] = (0, react_1.useState)(null);
|
|
57
|
+
const [selectedBarIndex, setSelectedBarIndex] = (0, react_1.useState)(null);
|
|
58
|
+
const chartRef = (0, react_1.useRef)(null);
|
|
59
|
+
const handleCloseTooltip = () => {
|
|
60
|
+
setTooltipData(null);
|
|
61
|
+
setSelectedBarIndex(null);
|
|
62
|
+
};
|
|
63
|
+
const handleToggleTooltip = (event, itemIdentifier) => {
|
|
64
|
+
event.preventDefault();
|
|
65
|
+
if (Number(tooltipData?.id) === itemIdentifier.dataIndex) {
|
|
66
|
+
handleCloseTooltip();
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
setSelectedBarIndex(itemIdentifier.dataIndex);
|
|
70
|
+
let x = event.clientX;
|
|
71
|
+
let y = event.clientY;
|
|
72
|
+
const isFirst = itemIdentifier.dataIndex === 0;
|
|
73
|
+
const isLast = itemIdentifier.dataIndex === data.length - 1;
|
|
74
|
+
if (chartRef.current) {
|
|
75
|
+
const bars = chartRef.current.querySelectorAll('.MuiBarElement-root');
|
|
76
|
+
const bar = bars?.[itemIdentifier.dataIndex];
|
|
77
|
+
if (bar) {
|
|
78
|
+
const rect = bar.getBoundingClientRect();
|
|
79
|
+
x =
|
|
80
|
+
rect.left + rect.width / 2 + (isFirst ? -15 : 0) + (isLast ? 15 : 0);
|
|
81
|
+
y = rect.top - 5;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
setTooltipData({
|
|
85
|
+
value: `${data[itemIdentifier.dataIndex]}${tooltipSuffix ? ` ${tooltipSuffix}` : ''}`,
|
|
86
|
+
position: { x, y },
|
|
87
|
+
id: itemIdentifier.dataIndex,
|
|
88
|
+
isFirst,
|
|
89
|
+
isLast,
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
(0, react_1.useEffect)(() => {
|
|
93
|
+
window.addEventListener('scroll', handleCloseTooltip);
|
|
94
|
+
return () => {
|
|
95
|
+
window.removeEventListener('scroll', handleCloseTooltip);
|
|
96
|
+
};
|
|
97
|
+
}, []);
|
|
98
|
+
const barColors = (0, react_1.useMemo)(() => data.map((_, index) => selectedBarIndex === index
|
|
99
|
+
? theme_1.commonColors.accent_text_color.light
|
|
100
|
+
: theme_1.commonColors.section_header_text_color.light), [selectedBarIndex, data]);
|
|
101
|
+
const clipPathId = `${react_1.default.useId()}-clip-path`;
|
|
102
|
+
return ((0, jsx_runtime_1.jsx)(material_1.NoSsr, { children: (0, jsx_runtime_1.jsx)(Box_1.default, { onScroll: handleCloseTooltip, width: fullWidth ? '100%' : width, children: (0, jsx_runtime_1.jsxs)(x_charts_1.ResponsiveChartContainer, { height: height, margin: { bottom: 35, left: 40, right: 35, top: 35 }, ref: chartRef, xAxis: [
|
|
103
|
+
{
|
|
104
|
+
scaleType: 'band',
|
|
105
|
+
tickLabelStyle: {
|
|
106
|
+
angle: -90,
|
|
107
|
+
position: 'absolute',
|
|
108
|
+
textAnchor: 'end',
|
|
109
|
+
...theme_1.typography.caption2Regular,
|
|
110
|
+
},
|
|
111
|
+
data: xTickLabels,
|
|
112
|
+
colorMap: {
|
|
113
|
+
type: 'ordinal',
|
|
114
|
+
colors: barColors,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
], yAxis: [
|
|
118
|
+
{
|
|
119
|
+
valueFormatter: (value) => formatNumberToK(value),
|
|
120
|
+
tickLabelStyle: {
|
|
121
|
+
...theme_1.typography.caption1Regular,
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
], series: [
|
|
125
|
+
{
|
|
126
|
+
type: 'bar',
|
|
127
|
+
data,
|
|
128
|
+
},
|
|
129
|
+
], children: [(0, jsx_runtime_1.jsx)(x_charts_1.ChartsClipPath, { id: clipPathId }), (0, jsx_runtime_1.jsx)("g", { clipPath: clipPathId, children: (0, jsx_runtime_1.jsx)(x_charts_1.BarPlot, { onItemClick: handleToggleTooltip, borderRadius: 2 }) }), (0, jsx_runtime_1.jsx)(x_charts_1.ChartsXAxis, { disableTicks: true, disableLine: true }), (0, jsx_runtime_1.jsx)(x_charts_1.ChartsYAxis, { disableTicks: true, disableLine: true }), tooltipData && (0, jsx_runtime_1.jsx)(ItemTooltip_1.ItemTooltip, { ...(tooltipData || {}) })] }) }) }));
|
|
130
|
+
};
|
|
131
|
+
exports.TMABarChart = TMABarChart;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ContainerProps } from '@mui/material/Container';
|
|
3
|
+
export interface TMABaseSectionProps extends ContainerProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export declare const TMABaseSection: ({ children, sx, ...props }: TMABaseSectionProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=TMABaseSection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TMABaseSection.d.ts","sourceRoot":"","sources":["../../../../src/components/TMABaseSection/TMABaseSection.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAkB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEpE,MAAM,WAAW,mBAAoB,SAAQ,cAAc;IACzD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,cAAc,+BAIxB,mBAAmB,4CAerB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TMABaseSection = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const Container_1 = __importDefault(require("@mui/material/Container"));
|
|
9
|
+
const TMABaseSection = ({ children, sx, ...props }) => {
|
|
10
|
+
return ((0, jsx_runtime_1.jsx)(Container_1.default, { sx: {
|
|
11
|
+
pt: 0,
|
|
12
|
+
pb: 4,
|
|
13
|
+
bgcolor: 'secondary_bg_color.main',
|
|
14
|
+
minHeight: '100dvh',
|
|
15
|
+
...sx,
|
|
16
|
+
}, ...props, children: children }));
|
|
17
|
+
};
|
|
18
|
+
exports.TMABaseSection = TMABaseSection;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LinkProps } from '@mui/material/Link';
|
|
3
|
+
export interface TMACellProps {
|
|
4
|
+
title: string;
|
|
5
|
+
href: string;
|
|
6
|
+
LinkComponent?: LinkProps['component'];
|
|
7
|
+
image?: string;
|
|
8
|
+
imageComponent?: React.ReactNode;
|
|
9
|
+
shouldOpenInBlank?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const TMACell: ({ title, href, LinkComponent, image, imageComponent, shouldOpenInBlank, }: TMACellProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=TMACell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TMACell.d.ts","sourceRoot":"","sources":["../../../../src/components/TMACell/TMACell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAOrD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACjC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,eAAO,MAAM,OAAO,8EAOjB,YAAY,4CAoBd,CAAC"}
|