@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
package/README.md
ADDED
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
# ui-core lib (for NextJs apps)
|
|
2
|
+
## 1. How to connect:
|
|
3
|
+
#### app routing
|
|
4
|
+
```typescript jsx
|
|
5
|
+
// app/layout.tsx
|
|
6
|
+
import { ThemeProvider } from "sbcrmweb-tma-core";
|
|
7
|
+
|
|
8
|
+
export default function AppLayout({ children }) {
|
|
9
|
+
return (
|
|
10
|
+
<html lang="ru" suppressHydrationWarning>
|
|
11
|
+
<body>
|
|
12
|
+
<ThemeProvider>
|
|
13
|
+
{children}
|
|
14
|
+
</ThemeProvider>
|
|
15
|
+
</body>
|
|
16
|
+
</html>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
#### app routing & custom theme
|
|
21
|
+
```typescript
|
|
22
|
+
import { createTheme } from "@mui/material/styles";
|
|
23
|
+
import { theme } from "sbcrmweb-tma-core";
|
|
24
|
+
|
|
25
|
+
export default createTheme(theme, {
|
|
26
|
+
// .... override theme
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
```typescript jsx
|
|
30
|
+
// components/ThemeProvider
|
|
31
|
+
"use client";
|
|
32
|
+
import { ThemeProvider as BaseThemeProvider } from "sbcrmweb-tma-core";
|
|
33
|
+
import theme from "@/theme";
|
|
34
|
+
import { PropsWithChildren } from "react";
|
|
35
|
+
|
|
36
|
+
export default function ThemeProvider({ children }: PropsWithChildren) {
|
|
37
|
+
return <BaseThemeProvider theme={theme}>{children}</BaseThemeProvider>;
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
```typescript jsx
|
|
41
|
+
// app/layout.tsx
|
|
42
|
+
import ThemeProvider from "@/components/ThemeProvider";
|
|
43
|
+
|
|
44
|
+
export default function RootLayout({ children }: Readonly<RootLayoutProps>) {
|
|
45
|
+
return (
|
|
46
|
+
<html lang="ru" suppressHydrationWarning>
|
|
47
|
+
<body>
|
|
48
|
+
<ThemeProvider>{children}</ThemeProvider>
|
|
49
|
+
</body>
|
|
50
|
+
</html>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## 2. Usage
|
|
56
|
+
```typescript jsx
|
|
57
|
+
// use theme parameters
|
|
58
|
+
|
|
59
|
+
import { themeParams } from "sbcrmweb-tma-core";
|
|
60
|
+
|
|
61
|
+
const { BASE_SPACING } = themeParams;
|
|
62
|
+
// ...
|
|
63
|
+
return (
|
|
64
|
+
<Stack sx={{ py: 12 / BASE_SPACING, px: 8 / BASE_SPACING }}>
|
|
65
|
+
// ...
|
|
66
|
+
</Stack>
|
|
67
|
+
);
|
|
68
|
+
```
|
|
69
|
+
```typescript jsx
|
|
70
|
+
// use components
|
|
71
|
+
|
|
72
|
+
import { TMACounter } from 'sbcrmweb-tma-core';
|
|
73
|
+
// ...
|
|
74
|
+
return (
|
|
75
|
+
<TMACounter
|
|
76
|
+
onLeave={(lastValue) => {
|
|
77
|
+
console.log({ lastValue });
|
|
78
|
+
}}
|
|
79
|
+
onChange={(nextValue) => {
|
|
80
|
+
console.log({ nextValue });
|
|
81
|
+
}}
|
|
82
|
+
/>
|
|
83
|
+
);
|
|
84
|
+
```
|
|
85
|
+
## Colors
|
|
86
|
+
```typescript
|
|
87
|
+
export const commonColors: CommonColors = {
|
|
88
|
+
black: '#000000',
|
|
89
|
+
white: '#FFFFFF',
|
|
90
|
+
bg_color: {
|
|
91
|
+
light: '#FFFFFF',
|
|
92
|
+
dark: '#212121',
|
|
93
|
+
},
|
|
94
|
+
accent_text_color: {
|
|
95
|
+
light: '#007AFF',
|
|
96
|
+
dark: '#007AFF',
|
|
97
|
+
},
|
|
98
|
+
button_color: {
|
|
99
|
+
light: '#007AFF',
|
|
100
|
+
dark: '#2990FF',
|
|
101
|
+
},
|
|
102
|
+
button_text_color: {
|
|
103
|
+
light: '#FFFFFF',
|
|
104
|
+
dark: '#FFFFFF',
|
|
105
|
+
},
|
|
106
|
+
destructive_background: {
|
|
107
|
+
light: '#F12E2E05',
|
|
108
|
+
dark: '#F12E2E15',
|
|
109
|
+
},
|
|
110
|
+
destructive_text_color: {
|
|
111
|
+
light: '#E53935',
|
|
112
|
+
dark: '#E53935',
|
|
113
|
+
},
|
|
114
|
+
header_bg_color: {
|
|
115
|
+
light: '#FFFFFF',
|
|
116
|
+
dark: '#212121',
|
|
117
|
+
},
|
|
118
|
+
hint_color: {
|
|
119
|
+
light: '#707579',
|
|
120
|
+
dark: '#AAAAAA',
|
|
121
|
+
},
|
|
122
|
+
link_color: {
|
|
123
|
+
light: '#007AFF',
|
|
124
|
+
dark: '#2990FF',
|
|
125
|
+
},
|
|
126
|
+
secondary_bg_color: {
|
|
127
|
+
light: '#EFEFF4',
|
|
128
|
+
dark: '#0F0F0F',
|
|
129
|
+
},
|
|
130
|
+
section_bg_color: {
|
|
131
|
+
light: '#FFFFFF',
|
|
132
|
+
dark: '#212121',
|
|
133
|
+
},
|
|
134
|
+
section_header_text_color: {
|
|
135
|
+
light: '#707579',
|
|
136
|
+
dark: '#AAAAAA',
|
|
137
|
+
},
|
|
138
|
+
subtitle_text_color: {
|
|
139
|
+
light: '#707579',
|
|
140
|
+
dark: '#AAAAAA',
|
|
141
|
+
},
|
|
142
|
+
text_color: {
|
|
143
|
+
light: '#000000',
|
|
144
|
+
dark: '#FFFFFF',
|
|
145
|
+
},
|
|
146
|
+
divider: {
|
|
147
|
+
light: '#00000015',
|
|
148
|
+
dark: '#FFFFFF05',
|
|
149
|
+
},
|
|
150
|
+
card_bg_color: {
|
|
151
|
+
light: '#FFFFFF',
|
|
152
|
+
dark: '#323232',
|
|
153
|
+
},
|
|
154
|
+
skeleton: {
|
|
155
|
+
light: '#00000003',
|
|
156
|
+
dark: '#FFFFFF03',
|
|
157
|
+
},
|
|
158
|
+
secondary_fill: {
|
|
159
|
+
light: '#4378FF10',
|
|
160
|
+
dark: '#2990FF15',
|
|
161
|
+
},
|
|
162
|
+
secondary_hint_color: {
|
|
163
|
+
light: '#A2ACB0',
|
|
164
|
+
dark: '#78797E',
|
|
165
|
+
},
|
|
166
|
+
outline: {
|
|
167
|
+
light: '#00000005',
|
|
168
|
+
dark: '#FFFFFF10',
|
|
169
|
+
},
|
|
170
|
+
plain_foreground: {
|
|
171
|
+
light: '#00000080',
|
|
172
|
+
dark: '#FFFFFF95',
|
|
173
|
+
},
|
|
174
|
+
plain_background: {
|
|
175
|
+
light: '#00000004',
|
|
176
|
+
dark: '#FFFFFF0A',
|
|
177
|
+
},
|
|
178
|
+
toast_accent_color: {
|
|
179
|
+
light: '#55A6FF',
|
|
180
|
+
dark: '#55A6FF',
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
```
|
|
184
|
+
## Typography
|
|
185
|
+
```typescript
|
|
186
|
+
const typography = {
|
|
187
|
+
largeTitleRegular: {
|
|
188
|
+
fontFamily: SFPro.style.fontFamily,
|
|
189
|
+
fontSize: 34,
|
|
190
|
+
fontWeight: 400,
|
|
191
|
+
lineHeight: 1.3,
|
|
192
|
+
letterSpacing: 0.25,
|
|
193
|
+
},
|
|
194
|
+
largeTitleSemibold: {
|
|
195
|
+
fontFamily: SFPro.style.fontFamily,
|
|
196
|
+
fontSize: 34,
|
|
197
|
+
fontWeight: 600,
|
|
198
|
+
lineHeight: 1.3,
|
|
199
|
+
letterSpacing: 0.25,
|
|
200
|
+
},
|
|
201
|
+
largeTitleBold: {
|
|
202
|
+
fontFamily: SFPro.style.fontFamily,
|
|
203
|
+
fontSize: 34,
|
|
204
|
+
fontWeight: 700,
|
|
205
|
+
lineHeight: 1.3,
|
|
206
|
+
letterSpacing: 0.25,
|
|
207
|
+
},
|
|
208
|
+
title1Regular: {
|
|
209
|
+
fontFamily: SFPro.style.fontFamily,
|
|
210
|
+
fontSize: 28,
|
|
211
|
+
fontWeight: 400,
|
|
212
|
+
lineHeight: 1.12,
|
|
213
|
+
letterSpacing: 0.1,
|
|
214
|
+
},
|
|
215
|
+
title1Semibold: {
|
|
216
|
+
fontFamily: SFPro.style.fontFamily,
|
|
217
|
+
fontSize: 28,
|
|
218
|
+
fontWeight: 600,
|
|
219
|
+
lineHeight: 1.12,
|
|
220
|
+
letterSpacing: 0.1,
|
|
221
|
+
},
|
|
222
|
+
title1Bold: {
|
|
223
|
+
fontFamily: SFPro.style.fontFamily,
|
|
224
|
+
fontSize: 28,
|
|
225
|
+
fontWeight: 700,
|
|
226
|
+
lineHeight: 1.12,
|
|
227
|
+
letterSpacing: 0.1,
|
|
228
|
+
},
|
|
229
|
+
title2Regular: {
|
|
230
|
+
fontFamily: SFPro.style.fontFamily,
|
|
231
|
+
fontSize: 24,
|
|
232
|
+
fontWeight: 400,
|
|
233
|
+
lineHeight: 1.5,
|
|
234
|
+
letterSpacing: 0,
|
|
235
|
+
},
|
|
236
|
+
title2Semibold: {
|
|
237
|
+
fontFamily: SFPro.style.fontFamily,
|
|
238
|
+
fontSize: 24,
|
|
239
|
+
fontWeight: 600,
|
|
240
|
+
lineHeight: 1.5,
|
|
241
|
+
letterSpacing: 0,
|
|
242
|
+
},
|
|
243
|
+
title2Bold: {
|
|
244
|
+
fontFamily: SFPro.style.fontFamily,
|
|
245
|
+
fontSize: 24,
|
|
246
|
+
fontWeight: 700,
|
|
247
|
+
lineHeight: 1.5,
|
|
248
|
+
letterSpacing: 0,
|
|
249
|
+
},
|
|
250
|
+
title3Regular: {
|
|
251
|
+
fontFamily: SFPro.style.fontFamily,
|
|
252
|
+
fontSize: 20,
|
|
253
|
+
fontWeight: 400,
|
|
254
|
+
lineHeight: 1.5,
|
|
255
|
+
letterSpacing: 0.15,
|
|
256
|
+
},
|
|
257
|
+
title3Semibold: {
|
|
258
|
+
fontFamily: SFPro.style.fontFamily,
|
|
259
|
+
fontSize: 20,
|
|
260
|
+
fontWeight: 400,
|
|
261
|
+
lineHeight: 1.5,
|
|
262
|
+
letterSpacing: 0.15,
|
|
263
|
+
},
|
|
264
|
+
title3Bold: {
|
|
265
|
+
fontFamily: SFPro.style.fontFamily,
|
|
266
|
+
fontSize: 20,
|
|
267
|
+
fontWeight: 400,
|
|
268
|
+
lineHeight: 1.5,
|
|
269
|
+
letterSpacing: 0.15,
|
|
270
|
+
},
|
|
271
|
+
headlineRegular: {
|
|
272
|
+
fontFamily: SFPro.style.fontFamily,
|
|
273
|
+
fontSize: 19,
|
|
274
|
+
fontWeight: 400,
|
|
275
|
+
lineHeight: 1.75,
|
|
276
|
+
letterSpacing: 0.15,
|
|
277
|
+
},
|
|
278
|
+
headlineSemibold: {
|
|
279
|
+
fontFamily: SFPro.style.fontFamily,
|
|
280
|
+
fontSize: 19,
|
|
281
|
+
fontWeight: 600,
|
|
282
|
+
lineHeight: 1.75,
|
|
283
|
+
letterSpacing: 0.15,
|
|
284
|
+
},
|
|
285
|
+
headlineBold: {
|
|
286
|
+
fontFamily: SFPro.style.fontFamily,
|
|
287
|
+
fontSize: 19,
|
|
288
|
+
fontWeight: 700,
|
|
289
|
+
lineHeight: 1.75,
|
|
290
|
+
letterSpacing: 0.15,
|
|
291
|
+
},
|
|
292
|
+
textRegular: {
|
|
293
|
+
fontFamily: SFPro.style.fontFamily,
|
|
294
|
+
fontSize: 17,
|
|
295
|
+
fontWeight: 400,
|
|
296
|
+
lineHeight: 1.37,
|
|
297
|
+
letterSpacing: 0.15,
|
|
298
|
+
},
|
|
299
|
+
textMedium: {
|
|
300
|
+
fontFamily: SFPro.style.fontFamily,
|
|
301
|
+
fontSize: 17,
|
|
302
|
+
fontWeight: 500,
|
|
303
|
+
lineHeight: 1.37,
|
|
304
|
+
letterSpacing: 0.15,
|
|
305
|
+
},
|
|
306
|
+
textSemibold: {
|
|
307
|
+
fontFamily: SFPro.style.fontFamily,
|
|
308
|
+
fontSize: 17,
|
|
309
|
+
fontWeight: 600,
|
|
310
|
+
lineHeight: 1.37,
|
|
311
|
+
letterSpacing: 0.15,
|
|
312
|
+
},
|
|
313
|
+
textBold: {
|
|
314
|
+
fontFamily: SFPro.style.fontFamily,
|
|
315
|
+
fontSize: 17,
|
|
316
|
+
fontWeight: 700,
|
|
317
|
+
lineHeight: 1.37,
|
|
318
|
+
letterSpacing: 0.15,
|
|
319
|
+
},
|
|
320
|
+
subheadline1Regular: {
|
|
321
|
+
fontFamily: SFPro.style.fontFamily,
|
|
322
|
+
fontSize: 16,
|
|
323
|
+
fontWeight: 400,
|
|
324
|
+
lineHeight: 1.75,
|
|
325
|
+
letterSpacing: 0.15,
|
|
326
|
+
},
|
|
327
|
+
subheadline1Mono: {
|
|
328
|
+
fontFamily: SFProMono.style.fontFamily,
|
|
329
|
+
fontSize: 16,
|
|
330
|
+
fontWeight: 400,
|
|
331
|
+
lineHeight: 1.75,
|
|
332
|
+
letterSpacing: 0.15,
|
|
333
|
+
},
|
|
334
|
+
subheadline1Semibold: {
|
|
335
|
+
fontFamily: SFPro.style.fontFamily,
|
|
336
|
+
fontSize: 16,
|
|
337
|
+
fontWeight: 600,
|
|
338
|
+
lineHeight: 1.75,
|
|
339
|
+
letterSpacing: 0.15,
|
|
340
|
+
},
|
|
341
|
+
subheadline1Bold: {
|
|
342
|
+
fontFamily: SFPro.style.fontFamily,
|
|
343
|
+
fontSize: 16,
|
|
344
|
+
fontWeight: 700,
|
|
345
|
+
lineHeight: 1.75,
|
|
346
|
+
letterSpacing: 0.15,
|
|
347
|
+
},
|
|
348
|
+
subheadline2Regular: {
|
|
349
|
+
fontFamily: SFPro.style.fontFamily,
|
|
350
|
+
fontSize: 15,
|
|
351
|
+
fontWeight: 400,
|
|
352
|
+
lineHeight: 1.75,
|
|
353
|
+
letterSpacing: 0.15,
|
|
354
|
+
},
|
|
355
|
+
subheadline2Mono: {
|
|
356
|
+
fontFamily: SFProMono.style.fontFamily,
|
|
357
|
+
fontSize: 15,
|
|
358
|
+
fontWeight: 400,
|
|
359
|
+
lineHeight: 1.75,
|
|
360
|
+
letterSpacing: 0.15,
|
|
361
|
+
},
|
|
362
|
+
subheadline2Semibold: {
|
|
363
|
+
fontFamily: SFPro.style.fontFamily,
|
|
364
|
+
fontSize: 15,
|
|
365
|
+
fontWeight: 600,
|
|
366
|
+
lineHeight: 1.75,
|
|
367
|
+
letterSpacing: 0.15,
|
|
368
|
+
},
|
|
369
|
+
subheadline2Bold: {
|
|
370
|
+
fontFamily: SFPro.style.fontFamily,
|
|
371
|
+
fontSize: 15,
|
|
372
|
+
fontWeight: 700,
|
|
373
|
+
lineHeight: 1.75,
|
|
374
|
+
letterSpacing: 0.15,
|
|
375
|
+
},
|
|
376
|
+
caption1Regular: {
|
|
377
|
+
fontFamily: SFPro.style.fontFamily,
|
|
378
|
+
fontSize: 13,
|
|
379
|
+
fontWeight: 400,
|
|
380
|
+
lineHeight: 1.75,
|
|
381
|
+
letterSpacing: 0.15,
|
|
382
|
+
},
|
|
383
|
+
caption1Semibold: {
|
|
384
|
+
fontFamily: SFPro.style.fontFamily,
|
|
385
|
+
fontSize: 13,
|
|
386
|
+
fontWeight: 600,
|
|
387
|
+
lineHeight: 1.75,
|
|
388
|
+
letterSpacing: 0.15,
|
|
389
|
+
},
|
|
390
|
+
caption1Bold: {
|
|
391
|
+
fontFamily: SFPro.style.fontFamily,
|
|
392
|
+
fontSize: 13,
|
|
393
|
+
fontWeight: 700,
|
|
394
|
+
lineHeight: 1.75,
|
|
395
|
+
letterSpacing: 0.15,
|
|
396
|
+
},
|
|
397
|
+
caption2Regular: {
|
|
398
|
+
fontFamily: SFPro.style.fontFamily,
|
|
399
|
+
fontSize: 10,
|
|
400
|
+
fontWeight: 400,
|
|
401
|
+
lineHeight: 1.75,
|
|
402
|
+
letterSpacing: 0.15,
|
|
403
|
+
},
|
|
404
|
+
caption2Semibold: {
|
|
405
|
+
fontFamily: SFPro.style.fontFamily,
|
|
406
|
+
fontSize: 10,
|
|
407
|
+
fontWeight: 600,
|
|
408
|
+
lineHeight: 1.75,
|
|
409
|
+
letterSpacing: 0.15,
|
|
410
|
+
},
|
|
411
|
+
caption2Bold: {
|
|
412
|
+
fontFamily: SFPro.style.fontFamily,
|
|
413
|
+
fontSize: 10,
|
|
414
|
+
fontWeight: 700,
|
|
415
|
+
lineHeight: 1.75,
|
|
416
|
+
letterSpacing: 0.15,
|
|
417
|
+
},
|
|
418
|
+
};
|
|
419
|
+
```
|
|
@@ -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,40 @@
|
|
|
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.TMAActionBar = void 0;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const Stack_1 = __importDefault(require("@mui/material/Stack"));
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const SwipeableDrawer_1 = __importDefault(require("@mui/material/SwipeableDrawer"));
|
|
12
|
+
const TMAActionBar = ({ children, sx, isSwipeable = false, isOpen = true, onClose, onOpen = () => { }, ...props }) => {
|
|
13
|
+
const contentRef = (0, react_1.useRef)(null);
|
|
14
|
+
(0, react_1.useEffect)(() => {
|
|
15
|
+
if (!isSwipeable && contentRef.current) {
|
|
16
|
+
const height = contentRef.current.getBoundingClientRect().height;
|
|
17
|
+
document.body.style.paddingBottom = `${height}px`;
|
|
18
|
+
}
|
|
19
|
+
}, [isSwipeable, children]);
|
|
20
|
+
(0, react_1.useEffect)(() => {
|
|
21
|
+
if (!isSwipeable && contentRef.current) {
|
|
22
|
+
return () => {
|
|
23
|
+
document.body.style.paddingBottom = '0px';
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}, []);
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)(SwipeableDrawer_1.default, { variant: isSwipeable ? 'temporary' : 'permanent', hideBackdrop: !isSwipeable, open: isSwipeable ? isOpen : true, onClose: onClose, onOpen: onOpen, anchor: "bottom", slotProps: {
|
|
28
|
+
root: {
|
|
29
|
+
keepMounted: isSwipeable,
|
|
30
|
+
},
|
|
31
|
+
}, children: (0, jsx_runtime_1.jsx)(Stack_1.default, { ref: contentRef, sx: {
|
|
32
|
+
px: 2,
|
|
33
|
+
pt: 2,
|
|
34
|
+
bgcolor: 'bg_color.main',
|
|
35
|
+
borderTopLeftRadius: 12,
|
|
36
|
+
borderTopRightRadius: 12,
|
|
37
|
+
...sx,
|
|
38
|
+
}, ...props, children: children }) }));
|
|
39
|
+
};
|
|
40
|
+
exports.TMAActionBar = TMAActionBar;
|
|
@@ -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,121 @@
|
|
|
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.StoryDrawer = 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 Drawer_1 = __importDefault(require("@mui/material/Drawer"));
|
|
13
|
+
const Stack_1 = __importDefault(require("@mui/material/Stack"));
|
|
14
|
+
const Typography_1 = __importDefault(require("@mui/material/Typography"));
|
|
15
|
+
const CloseOutlined_1 = __importDefault(require("@mui/icons-material/CloseOutlined"));
|
|
16
|
+
const react_2 = require("swiper/react");
|
|
17
|
+
const modules_1 = require("swiper/modules");
|
|
18
|
+
const StoryProgress_1 = require("./StoryProgress");
|
|
19
|
+
const useTMALongPress_1 = __importDefault(require("../../hooks/useTMALongPress"));
|
|
20
|
+
const propsContext_1 = require("./propsContext");
|
|
21
|
+
const theme_1 = require("../../theme");
|
|
22
|
+
const StyledSwiper = (0, styles_1.styled)(react_2.Swiper)(({ theme }) => ({
|
|
23
|
+
height: '100vh',
|
|
24
|
+
width: '100%',
|
|
25
|
+
background: 'linear-gradient(0deg, #0078EE, #5FC1FF)',
|
|
26
|
+
'& .story-item-slide': {
|
|
27
|
+
maxHeight: 'calc(100% - 90px)',
|
|
28
|
+
}
|
|
29
|
+
}));
|
|
30
|
+
const StoryDrawer = ({ story, onClose, onFinished, onPrev, }) => {
|
|
31
|
+
const { storyItemsSwiperProps = {}, storyItemTitleVariant = 'title3Semibold', storyItemSubtitleVariant = 'textRegular', } = (0, propsContext_1.useTMABannerFeedPropsContext)();
|
|
32
|
+
const [activeStoryItemIndex, setActiveStoryItemIndex] = (0, react_1.useState)(0);
|
|
33
|
+
const swiperRef = (0, react_1.useRef)(null);
|
|
34
|
+
const timerRef = (0, react_1.useRef)(null);
|
|
35
|
+
const goToSlide = (index = 0) => {
|
|
36
|
+
setActiveStoryItemIndex(index);
|
|
37
|
+
setTimeout(() => swiperRef.current?.slideTo(index), 0);
|
|
38
|
+
};
|
|
39
|
+
const goToSlidePrev = () => {
|
|
40
|
+
setTimeout(() => swiperRef.current?.slidePrev(), 0);
|
|
41
|
+
};
|
|
42
|
+
const handleNextStep = () => {
|
|
43
|
+
if (!story) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (activeStoryItemIndex !== story.items.length - 1) {
|
|
47
|
+
goToSlide(activeStoryItemIndex + 1);
|
|
48
|
+
}
|
|
49
|
+
else if (onFinished) {
|
|
50
|
+
setActiveStoryItemIndex(0);
|
|
51
|
+
goToSlide();
|
|
52
|
+
onFinished();
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
onClose();
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const handlePreviousStep = () => {
|
|
59
|
+
if (!story) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (activeStoryItemIndex) {
|
|
63
|
+
goToSlidePrev();
|
|
64
|
+
}
|
|
65
|
+
else if (onPrev) {
|
|
66
|
+
setActiveStoryItemIndex(0);
|
|
67
|
+
goToSlide();
|
|
68
|
+
onPrev();
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
timerRef.current.resetTimer();
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const handleLongPressHandleStart = () => {
|
|
75
|
+
timerRef.current.pause();
|
|
76
|
+
};
|
|
77
|
+
const handleLongPressHandleEnd = () => {
|
|
78
|
+
timerRef.current.resume();
|
|
79
|
+
};
|
|
80
|
+
const handleClick = (event) => {
|
|
81
|
+
const isNext = event.touches.startX > event.width / 2;
|
|
82
|
+
if (isNext) {
|
|
83
|
+
handleNextStep();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
handlePreviousStep();
|
|
87
|
+
};
|
|
88
|
+
const longPressEvents = (0, useTMALongPress_1.default)(handleLongPressHandleStart, handleLongPressHandleEnd, handleClick);
|
|
89
|
+
const swiperMemoized = (0, react_1.useMemo)(() => {
|
|
90
|
+
return ((0, jsx_runtime_1.jsx)(StyledSwiper, { className: "story-item-swiper", onBeforeInit: (swiper) => {
|
|
91
|
+
swiperRef.current = swiper;
|
|
92
|
+
}, onSlideChange: (sw) => setActiveStoryItemIndex(sw.activeIndex), modules: [modules_1.Navigation], slidesPerView: 1, speed: 400, ...longPressEvents, ...storyItemsSwiperProps, children: story?.items.map(({ image, subtitle, title, component }) => {
|
|
93
|
+
const haveComponent = Boolean(component);
|
|
94
|
+
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: {
|
|
95
|
+
marginX: 'auto',
|
|
96
|
+
height: '70%',
|
|
97
|
+
}, component: "img", src: image }), (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));
|
|
98
|
+
}) }));
|
|
99
|
+
}, [story, longPressEvents, storyItemsSwiperProps]);
|
|
100
|
+
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: {
|
|
101
|
+
'& .MuiDrawer-paperAnchorBottom.MuiPaper-root': {
|
|
102
|
+
borderTopLeftRadius: 0,
|
|
103
|
+
borderTopRightRadius: 0,
|
|
104
|
+
pb: 0,
|
|
105
|
+
},
|
|
106
|
+
}, 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) => {
|
|
107
|
+
event.preventDefault();
|
|
108
|
+
onClose();
|
|
109
|
+
}, sx: {
|
|
110
|
+
height: 40,
|
|
111
|
+
width: 40,
|
|
112
|
+
position: 'absolute',
|
|
113
|
+
zIndex: 1000,
|
|
114
|
+
top: 42,
|
|
115
|
+
right: 16,
|
|
116
|
+
borderRadius: '10px',
|
|
117
|
+
cursor: 'pointer',
|
|
118
|
+
background: '#2990FF26',
|
|
119
|
+
}, children: (0, jsx_runtime_1.jsx)(CloseOutlined_1.default, {}) }), swiperMemoized] }));
|
|
120
|
+
};
|
|
121
|
+
exports.StoryDrawer = StoryDrawer;
|
|
@@ -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"}
|