@cloud-ru/uikit-product-mobile-layout 0.20.7
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/CHANGELOG.md +1762 -0
- package/LICENSE +201 -0
- package/README.md +8 -0
- package/dist/cjs/components/AdaptiveLayout/AdaptiveLayout.d.ts +23 -0
- package/dist/cjs/components/AdaptiveLayout/AdaptiveLayout.js +68 -0
- package/dist/cjs/components/AdaptiveLayout/index.d.ts +1 -0
- package/dist/cjs/components/AdaptiveLayout/index.js +17 -0
- package/dist/cjs/components/MobileBlockBasic/MobileBlockBasic.d.ts +3 -0
- package/dist/cjs/components/MobileBlockBasic/MobileBlockBasic.js +13 -0
- package/dist/cjs/components/MobileBlockBasic/index.d.ts +1 -0
- package/dist/cjs/components/MobileBlockBasic/index.js +17 -0
- package/dist/cjs/components/MobileBlockBasic/styles.module.css +3 -0
- package/dist/cjs/components/MobileCardBanner/MobileCardBanner.d.ts +14 -0
- package/dist/cjs/components/MobileCardBanner/MobileCardBanner.js +31 -0
- package/dist/cjs/components/MobileCardBanner/index.d.ts +1 -0
- package/dist/cjs/components/MobileCardBanner/index.js +17 -0
- package/dist/cjs/components/MobileCardBanner/styles.module.css +52 -0
- package/dist/cjs/components/MobileEmptyBlock/MobileEmptyBlock.d.ts +17 -0
- package/dist/cjs/components/MobileEmptyBlock/MobileEmptyBlock.js +29 -0
- package/dist/cjs/components/MobileEmptyBlock/components/Footer/Footer.d.ts +14 -0
- package/dist/cjs/components/MobileEmptyBlock/components/Footer/Footer.js +16 -0
- package/dist/cjs/components/MobileEmptyBlock/components/Footer/hooks.d.ts +6 -0
- package/dist/cjs/components/MobileEmptyBlock/components/Footer/hooks.js +13 -0
- package/dist/cjs/components/MobileEmptyBlock/components/Footer/index.d.ts +1 -0
- package/dist/cjs/components/MobileEmptyBlock/components/Footer/index.js +17 -0
- package/dist/cjs/components/MobileEmptyBlock/components/Footer/styles.module.css +7 -0
- package/dist/cjs/components/MobileEmptyBlock/components/index.d.ts +1 -0
- package/dist/cjs/components/MobileEmptyBlock/components/index.js +17 -0
- package/dist/cjs/components/MobileEmptyBlock/index.d.ts +1 -0
- package/dist/cjs/components/MobileEmptyBlock/index.js +17 -0
- package/dist/cjs/components/MobileEmptyBlock/styles.module.css +61 -0
- package/dist/cjs/components/MobilePageCatalog/MobilePageCatalog.d.ts +9 -0
- package/dist/cjs/components/MobilePageCatalog/MobilePageCatalog.js +26 -0
- package/dist/cjs/components/MobilePageCatalog/index.d.ts +1 -0
- package/dist/cjs/components/MobilePageCatalog/index.js +17 -0
- package/dist/cjs/components/MobilePageCatalog/styles.module.css +15 -0
- package/dist/cjs/components/MobilePageForm/MobilePageForm.d.ts +17 -0
- package/dist/cjs/components/MobilePageForm/MobilePageForm.js +72 -0
- package/dist/cjs/components/MobilePageForm/hooks.d.ts +6 -0
- package/dist/cjs/components/MobilePageForm/hooks.js +13 -0
- package/dist/cjs/components/MobilePageForm/index.d.ts +1 -0
- package/dist/cjs/components/MobilePageForm/index.js +17 -0
- package/dist/cjs/components/MobilePageForm/styles.module.css +86 -0
- package/dist/cjs/components/MobilePageServices/MobilePageServices.d.ts +10 -0
- package/dist/cjs/components/MobilePageServices/MobilePageServices.js +26 -0
- package/dist/cjs/components/MobilePageServices/index.d.ts +1 -0
- package/dist/cjs/components/MobilePageServices/index.js +17 -0
- package/dist/cjs/components/MobilePageServices/styles.module.css +25 -0
- package/dist/cjs/components/index.d.ts +7 -0
- package/dist/cjs/components/index.js +23 -0
- package/dist/cjs/helperComponents/Actions/ActionView.d.ts +10 -0
- package/dist/cjs/helperComponents/Actions/ActionView.js +58 -0
- package/dist/cjs/helperComponents/Actions/DesktopActions.d.ts +2 -0
- package/dist/cjs/helperComponents/Actions/DesktopActions.js +19 -0
- package/dist/cjs/helperComponents/Actions/MobileActions.d.ts +2 -0
- package/dist/cjs/helperComponents/Actions/MobileActions.js +107 -0
- package/dist/cjs/helperComponents/Actions/constants.d.ts +11 -0
- package/dist/cjs/helperComponents/Actions/constants.js +14 -0
- package/dist/cjs/helperComponents/Actions/helpers.d.ts +2 -0
- package/dist/cjs/helperComponents/Actions/helpers.js +6 -0
- package/dist/cjs/helperComponents/Actions/index.d.ts +3 -0
- package/dist/cjs/helperComponents/Actions/index.js +19 -0
- package/dist/cjs/helperComponents/Actions/styles.module.css +35 -0
- package/dist/cjs/helperComponents/Actions/types.d.ts +38 -0
- package/dist/cjs/helperComponents/Actions/types.js +2 -0
- package/dist/cjs/helperComponents/ButtonDropdown/ButtonDropdown.d.ts +8 -0
- package/dist/cjs/helperComponents/ButtonDropdown/ButtonDropdown.js +13 -0
- package/dist/cjs/helperComponents/ButtonDropdown/index.d.ts +1 -0
- package/dist/cjs/helperComponents/ButtonDropdown/index.js +17 -0
- package/dist/cjs/helperComponents/ButtonDroplist/ButtonDroplist.d.ts +12 -0
- package/dist/cjs/helperComponents/ButtonDroplist/ButtonDroplist.js +21 -0
- package/dist/cjs/helperComponents/ButtonDroplist/index.d.ts +1 -0
- package/dist/cjs/helperComponents/ButtonDroplist/index.js +17 -0
- package/dist/cjs/helperComponents/ButtonKebab/ButtonKebab.d.ts +8 -0
- package/dist/cjs/helperComponents/ButtonKebab/ButtonKebab.js +15 -0
- package/dist/cjs/helperComponents/ButtonKebab/index.d.ts +1 -0
- package/dist/cjs/helperComponents/ButtonKebab/index.js +17 -0
- package/dist/cjs/helperComponents/Headline/Headline.d.ts +9 -0
- package/dist/cjs/helperComponents/Headline/Headline.js +11 -0
- package/dist/cjs/helperComponents/Headline/index.d.ts +1 -0
- package/dist/cjs/helperComponents/Headline/index.js +17 -0
- package/dist/cjs/helperComponents/Headline/styles.module.css +51 -0
- package/dist/cjs/helperComponents/SidebarSelect/SidebarSelect.d.ts +13 -0
- package/dist/cjs/helperComponents/SidebarSelect/SidebarSelect.js +51 -0
- package/dist/cjs/helperComponents/SidebarSelect/hooks/index.d.ts +3 -0
- package/dist/cjs/helperComponents/SidebarSelect/hooks/index.js +9 -0
- package/dist/cjs/helperComponents/SidebarSelect/hooks/useItemsContent.d.ts +3 -0
- package/dist/cjs/helperComponents/SidebarSelect/hooks/useItemsContent.js +59 -0
- package/dist/cjs/helperComponents/SidebarSelect/hooks/useSearchFilter.d.ts +7 -0
- package/dist/cjs/helperComponents/SidebarSelect/hooks/useSearchFilter.js +42 -0
- package/dist/cjs/helperComponents/SidebarSelect/hooks/useSelectedItem.d.ts +7 -0
- package/dist/cjs/helperComponents/SidebarSelect/hooks/useSelectedItem.js +24 -0
- package/dist/cjs/helperComponents/SidebarSelect/index.d.ts +1 -0
- package/dist/cjs/helperComponents/SidebarSelect/index.js +17 -0
- package/dist/cjs/helperComponents/SidebarSelect/styles.module.css +19 -0
- package/dist/cjs/helperComponents/SidebarSelect/types.d.ts +1 -0
- package/dist/cjs/helperComponents/SidebarSelect/types.js +2 -0
- package/dist/cjs/helperComponents/index.d.ts +3 -0
- package/dist/cjs/helperComponents/index.js +19 -0
- package/dist/cjs/helpers/index.d.ts +1 -0
- package/dist/cjs/helpers/index.js +17 -0
- package/dist/cjs/helpers/useGetButtonLabel.d.ts +2 -0
- package/dist/cjs/helpers/useGetButtonLabel.js +10 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +17 -0
- package/dist/esm/components/AdaptiveLayout/AdaptiveLayout.d.ts +23 -0
- package/dist/esm/components/AdaptiveLayout/AdaptiveLayout.js +60 -0
- package/dist/esm/components/AdaptiveLayout/index.d.ts +1 -0
- package/dist/esm/components/AdaptiveLayout/index.js +1 -0
- package/dist/esm/components/MobileBlockBasic/MobileBlockBasic.d.ts +3 -0
- package/dist/esm/components/MobileBlockBasic/MobileBlockBasic.js +7 -0
- package/dist/esm/components/MobileBlockBasic/index.d.ts +1 -0
- package/dist/esm/components/MobileBlockBasic/index.js +1 -0
- package/dist/esm/components/MobileBlockBasic/styles.module.css +3 -0
- package/dist/esm/components/MobileCardBanner/MobileCardBanner.d.ts +14 -0
- package/dist/esm/components/MobileCardBanner/MobileCardBanner.js +25 -0
- package/dist/esm/components/MobileCardBanner/index.d.ts +1 -0
- package/dist/esm/components/MobileCardBanner/index.js +1 -0
- package/dist/esm/components/MobileCardBanner/styles.module.css +52 -0
- package/dist/esm/components/MobileEmptyBlock/MobileEmptyBlock.d.ts +17 -0
- package/dist/esm/components/MobileEmptyBlock/MobileEmptyBlock.js +23 -0
- package/dist/esm/components/MobileEmptyBlock/components/Footer/Footer.d.ts +14 -0
- package/dist/esm/components/MobileEmptyBlock/components/Footer/Footer.js +10 -0
- package/dist/esm/components/MobileEmptyBlock/components/Footer/hooks.d.ts +6 -0
- package/dist/esm/components/MobileEmptyBlock/components/Footer/hooks.js +10 -0
- package/dist/esm/components/MobileEmptyBlock/components/Footer/index.d.ts +1 -0
- package/dist/esm/components/MobileEmptyBlock/components/Footer/index.js +1 -0
- package/dist/esm/components/MobileEmptyBlock/components/Footer/styles.module.css +7 -0
- package/dist/esm/components/MobileEmptyBlock/components/index.d.ts +1 -0
- package/dist/esm/components/MobileEmptyBlock/components/index.js +1 -0
- package/dist/esm/components/MobileEmptyBlock/index.d.ts +1 -0
- package/dist/esm/components/MobileEmptyBlock/index.js +1 -0
- package/dist/esm/components/MobileEmptyBlock/styles.module.css +61 -0
- package/dist/esm/components/MobilePageCatalog/MobilePageCatalog.d.ts +9 -0
- package/dist/esm/components/MobilePageCatalog/MobilePageCatalog.js +20 -0
- package/dist/esm/components/MobilePageCatalog/index.d.ts +1 -0
- package/dist/esm/components/MobilePageCatalog/index.js +1 -0
- package/dist/esm/components/MobilePageCatalog/styles.module.css +15 -0
- package/dist/esm/components/MobilePageForm/MobilePageForm.d.ts +17 -0
- package/dist/esm/components/MobilePageForm/MobilePageForm.js +65 -0
- package/dist/esm/components/MobilePageForm/hooks.d.ts +6 -0
- package/dist/esm/components/MobilePageForm/hooks.js +10 -0
- package/dist/esm/components/MobilePageForm/index.d.ts +1 -0
- package/dist/esm/components/MobilePageForm/index.js +1 -0
- package/dist/esm/components/MobilePageForm/styles.module.css +86 -0
- package/dist/esm/components/MobilePageServices/MobilePageServices.d.ts +10 -0
- package/dist/esm/components/MobilePageServices/MobilePageServices.js +20 -0
- package/dist/esm/components/MobilePageServices/index.d.ts +1 -0
- package/dist/esm/components/MobilePageServices/index.js +1 -0
- package/dist/esm/components/MobilePageServices/styles.module.css +25 -0
- package/dist/esm/components/index.d.ts +7 -0
- package/dist/esm/components/index.js +7 -0
- package/dist/esm/helperComponents/Actions/ActionView.d.ts +10 -0
- package/dist/esm/helperComponents/Actions/ActionView.js +55 -0
- package/dist/esm/helperComponents/Actions/DesktopActions.d.ts +2 -0
- package/dist/esm/helperComponents/Actions/DesktopActions.js +13 -0
- package/dist/esm/helperComponents/Actions/MobileActions.d.ts +2 -0
- package/dist/esm/helperComponents/Actions/MobileActions.js +101 -0
- package/dist/esm/helperComponents/Actions/constants.d.ts +11 -0
- package/dist/esm/helperComponents/Actions/constants.js +11 -0
- package/dist/esm/helperComponents/Actions/helpers.d.ts +2 -0
- package/dist/esm/helperComponents/Actions/helpers.js +3 -0
- package/dist/esm/helperComponents/Actions/index.d.ts +3 -0
- package/dist/esm/helperComponents/Actions/index.js +3 -0
- package/dist/esm/helperComponents/Actions/styles.module.css +35 -0
- package/dist/esm/helperComponents/Actions/types.d.ts +38 -0
- package/dist/esm/helperComponents/Actions/types.js +1 -0
- package/dist/esm/helperComponents/ButtonDropdown/ButtonDropdown.d.ts +8 -0
- package/dist/esm/helperComponents/ButtonDropdown/ButtonDropdown.js +10 -0
- package/dist/esm/helperComponents/ButtonDropdown/index.d.ts +1 -0
- package/dist/esm/helperComponents/ButtonDropdown/index.js +1 -0
- package/dist/esm/helperComponents/ButtonDroplist/ButtonDroplist.d.ts +12 -0
- package/dist/esm/helperComponents/ButtonDroplist/ButtonDroplist.js +18 -0
- package/dist/esm/helperComponents/ButtonDroplist/index.d.ts +1 -0
- package/dist/esm/helperComponents/ButtonDroplist/index.js +1 -0
- package/dist/esm/helperComponents/ButtonKebab/ButtonKebab.d.ts +8 -0
- package/dist/esm/helperComponents/ButtonKebab/ButtonKebab.js +12 -0
- package/dist/esm/helperComponents/ButtonKebab/index.d.ts +1 -0
- package/dist/esm/helperComponents/ButtonKebab/index.js +1 -0
- package/dist/esm/helperComponents/Headline/Headline.d.ts +9 -0
- package/dist/esm/helperComponents/Headline/Headline.js +5 -0
- package/dist/esm/helperComponents/Headline/index.d.ts +1 -0
- package/dist/esm/helperComponents/Headline/index.js +1 -0
- package/dist/esm/helperComponents/Headline/styles.module.css +51 -0
- package/dist/esm/helperComponents/SidebarSelect/SidebarSelect.d.ts +13 -0
- package/dist/esm/helperComponents/SidebarSelect/SidebarSelect.js +45 -0
- package/dist/esm/helperComponents/SidebarSelect/hooks/index.d.ts +3 -0
- package/dist/esm/helperComponents/SidebarSelect/hooks/index.js +3 -0
- package/dist/esm/helperComponents/SidebarSelect/hooks/useItemsContent.d.ts +3 -0
- package/dist/esm/helperComponents/SidebarSelect/hooks/useItemsContent.js +56 -0
- package/dist/esm/helperComponents/SidebarSelect/hooks/useSearchFilter.d.ts +7 -0
- package/dist/esm/helperComponents/SidebarSelect/hooks/useSearchFilter.js +38 -0
- package/dist/esm/helperComponents/SidebarSelect/hooks/useSelectedItem.d.ts +7 -0
- package/dist/esm/helperComponents/SidebarSelect/hooks/useSelectedItem.js +21 -0
- package/dist/esm/helperComponents/SidebarSelect/index.d.ts +1 -0
- package/dist/esm/helperComponents/SidebarSelect/index.js +1 -0
- package/dist/esm/helperComponents/SidebarSelect/styles.module.css +19 -0
- package/dist/esm/helperComponents/SidebarSelect/types.d.ts +1 -0
- package/dist/esm/helperComponents/SidebarSelect/types.js +1 -0
- package/dist/esm/helperComponents/index.d.ts +3 -0
- package/dist/esm/helperComponents/index.js +3 -0
- package/dist/esm/helpers/index.d.ts +1 -0
- package/dist/esm/helpers/index.js +1 -0
- package/dist/esm/helpers/useGetButtonLabel.d.ts +2 -0
- package/dist/esm/helpers/useGetButtonLabel.js +7 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/package.json +61 -0
- package/src/components/AdaptiveLayout/AdaptiveLayout.tsx +88 -0
- package/src/components/AdaptiveLayout/index.ts +1 -0
- package/src/components/MobileBlockBasic/MobileBlockBasic.tsx +11 -0
- package/src/components/MobileBlockBasic/index.ts +1 -0
- package/src/components/MobileBlockBasic/styles.module.scss +5 -0
- package/src/components/MobileCardBanner/MobileCardBanner.tsx +75 -0
- package/src/components/MobileCardBanner/index.ts +1 -0
- package/src/components/MobileCardBanner/styles.module.scss +48 -0
- package/src/components/MobileEmptyBlock/MobileEmptyBlock.tsx +64 -0
- package/src/components/MobileEmptyBlock/components/Footer/Footer.tsx +29 -0
- package/src/components/MobileEmptyBlock/components/Footer/hooks.tsx +25 -0
- package/src/components/MobileEmptyBlock/components/Footer/index.ts +1 -0
- package/src/components/MobileEmptyBlock/components/Footer/styles.module.scss +11 -0
- package/src/components/MobileEmptyBlock/components/index.ts +1 -0
- package/src/components/MobileEmptyBlock/index.ts +1 -0
- package/src/components/MobileEmptyBlock/styles.module.scss +75 -0
- package/src/components/MobilePageCatalog/MobilePageCatalog.tsx +36 -0
- package/src/components/MobilePageCatalog/index.ts +1 -0
- package/src/components/MobilePageCatalog/styles.module.scss +17 -0
- package/src/components/MobilePageForm/MobilePageForm.tsx +153 -0
- package/src/components/MobilePageForm/hooks.tsx +23 -0
- package/src/components/MobilePageForm/index.ts +1 -0
- package/src/components/MobilePageForm/styles.module.scss +98 -0
- package/src/components/MobilePageServices/MobilePageServices.tsx +50 -0
- package/src/components/MobilePageServices/index.ts +1 -0
- package/src/components/MobilePageServices/styles.module.scss +27 -0
- package/src/components/index.ts +7 -0
- package/src/helperComponents/Actions/ActionView.tsx +81 -0
- package/src/helperComponents/Actions/DesktopActions.tsx +25 -0
- package/src/helperComponents/Actions/MobileActions.tsx +196 -0
- package/src/helperComponents/Actions/constants.ts +11 -0
- package/src/helperComponents/Actions/helpers.ts +5 -0
- package/src/helperComponents/Actions/index.ts +3 -0
- package/src/helperComponents/Actions/styles.module.scss +42 -0
- package/src/helperComponents/Actions/types.ts +39 -0
- package/src/helperComponents/ButtonDropdown/ButtonDropdown.tsx +22 -0
- package/src/helperComponents/ButtonDropdown/index.ts +1 -0
- package/src/helperComponents/ButtonDroplist/ButtonDroplist.tsx +46 -0
- package/src/helperComponents/ButtonDroplist/index.ts +1 -0
- package/src/helperComponents/ButtonKebab/ButtonKebab.tsx +31 -0
- package/src/helperComponents/ButtonKebab/index.ts +1 -0
- package/src/helperComponents/Headline/Headline.tsx +29 -0
- package/src/helperComponents/Headline/index.ts +1 -0
- package/src/helperComponents/Headline/styles.module.scss +49 -0
- package/src/helperComponents/SidebarSelect/SidebarSelect.tsx +78 -0
- package/src/helperComponents/SidebarSelect/hooks/index.ts +3 -0
- package/src/helperComponents/SidebarSelect/hooks/useItemsContent.tsx +89 -0
- package/src/helperComponents/SidebarSelect/hooks/useSearchFilter.tsx +53 -0
- package/src/helperComponents/SidebarSelect/hooks/useSelectedItem.tsx +35 -0
- package/src/helperComponents/SidebarSelect/index.ts +1 -0
- package/src/helperComponents/SidebarSelect/styles.module.scss +17 -0
- package/src/helperComponents/SidebarSelect/types.ts +1 -0
- package/src/helperComponents/index.ts +3 -0
- package/src/helpers/index.ts +1 -0
- package/src/helpers/useGetButtonLabel.ts +10 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { CardBanner, CardBannerProps } from '@cloud-ru/uikit-product-card-predefined';
|
|
2
|
+
import { BlockBasic, BlockBasicProps, EmptyBlock, EmptyBlockProps } from '@cloud-ru/uikit-product-layout';
|
|
3
|
+
import {
|
|
4
|
+
PageCatalog,
|
|
5
|
+
PageCatalogProps,
|
|
6
|
+
PageForm,
|
|
7
|
+
PageFormProps,
|
|
8
|
+
PageServices,
|
|
9
|
+
PageServicesProps,
|
|
10
|
+
} from '@cloud-ru/uikit-product-page-layout';
|
|
11
|
+
import { WithLayoutType } from '@cloud-ru/uikit-product-utils';
|
|
12
|
+
|
|
13
|
+
import { DesktopActions } from '../../helperComponents';
|
|
14
|
+
import { MobileBlockBasic } from '../MobileBlockBasic';
|
|
15
|
+
import { MobileCardBanner } from '../MobileCardBanner';
|
|
16
|
+
import { MobileEmptyBlock } from '../MobileEmptyBlock';
|
|
17
|
+
import { MobilePageCatalog, MobilePageCatalogProps } from '../MobilePageCatalog';
|
|
18
|
+
import { MobilePageForm } from '../MobilePageForm';
|
|
19
|
+
import { MobilePageServices, MobilePageServicesProps } from '../MobilePageServices';
|
|
20
|
+
|
|
21
|
+
export type ButtonVariant = NonNullable<NonNullable<MobilePageServicesProps['actions']>[0]['variant']>;
|
|
22
|
+
|
|
23
|
+
export type Action = Omit<NonNullable<MobilePageServicesProps['actions']>[0], 'variant'> & {
|
|
24
|
+
variant: ButtonVariant;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type AdaptiveBlockBasicProps = WithLayoutType<BlockBasicProps>;
|
|
28
|
+
|
|
29
|
+
export function AdaptiveBlockBasic({ layoutType, ...props }: AdaptiveBlockBasicProps) {
|
|
30
|
+
const isMobile = layoutType === 'mobile';
|
|
31
|
+
return isMobile ? <MobileBlockBasic {...props} /> : <BlockBasic {...props} />;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type AdaptiveCardBannerProps = WithLayoutType<CardBannerProps>;
|
|
35
|
+
|
|
36
|
+
export function AdaptiveCardBanner({ layoutType, ...props }: AdaptiveCardBannerProps) {
|
|
37
|
+
const isMobile = layoutType === 'mobile';
|
|
38
|
+
|
|
39
|
+
return isMobile ? <MobileCardBanner {...props} /> : <CardBanner {...props} />;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type AdaptiveEmptyBlockProps = WithLayoutType<EmptyBlockProps>;
|
|
43
|
+
|
|
44
|
+
export function AdaptiveEmptyBlock({ layoutType, ...props }: AdaptiveEmptyBlockProps) {
|
|
45
|
+
const isMobile = layoutType === 'mobile';
|
|
46
|
+
return isMobile ? <MobileEmptyBlock {...props} /> : <EmptyBlock {...props} />;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type AdaptivePageFormProps = WithLayoutType<PageFormProps>;
|
|
50
|
+
|
|
51
|
+
export function AdaptivePageForm({ layoutType, ...props }: AdaptivePageFormProps) {
|
|
52
|
+
const isMobile = layoutType === 'mobile';
|
|
53
|
+
return isMobile ? <MobilePageForm {...props} /> : <PageForm {...props} />;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export type AdaptivePageServicesProps = WithLayoutType &
|
|
57
|
+
Omit<PageServicesProps, 'actions'> &
|
|
58
|
+
Pick<MobilePageServicesProps, 'actions'>;
|
|
59
|
+
|
|
60
|
+
export function AdaptivePageServices({ layoutType, actions, ...props }: AdaptivePageServicesProps) {
|
|
61
|
+
const isMobile = layoutType === 'mobile';
|
|
62
|
+
|
|
63
|
+
if (isMobile) {
|
|
64
|
+
return <MobilePageServices actions={actions} {...props} />;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const actionsNode = actions ? <DesktopActions items={actions} /> : undefined;
|
|
68
|
+
|
|
69
|
+
return <PageServices {...props} actions={actionsNode} />;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export type AdaptivePageCatalogProps = WithLayoutType &
|
|
73
|
+
Omit<PageCatalogProps, 'actions'> &
|
|
74
|
+
Pick<MobilePageCatalogProps, 'actions'>;
|
|
75
|
+
|
|
76
|
+
export function AdaptivePageCatalog({ layoutType, actions, ...props }: AdaptivePageCatalogProps) {
|
|
77
|
+
const isMobile = layoutType === 'mobile';
|
|
78
|
+
|
|
79
|
+
if (isMobile) {
|
|
80
|
+
return <MobilePageCatalog actions={actions} {...props} />;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const actionsNode = actions ? <DesktopActions items={actions} /> : undefined;
|
|
84
|
+
|
|
85
|
+
return <PageCatalog {...props} actions={actionsNode} />;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export type { BlockBasicProps, CardBannerProps, EmptyBlockProps, PageFormProps, PageServicesProps, PageCatalogProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AdaptiveLayout';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
|
|
3
|
+
import { BlockBasic, BlockBasicProps } from '@cloud-ru/uikit-product-layout';
|
|
4
|
+
|
|
5
|
+
import styles from './styles.module.scss';
|
|
6
|
+
|
|
7
|
+
export type MobileBlockBasicProps = BlockBasicProps;
|
|
8
|
+
|
|
9
|
+
export function MobileBlockBasic(props: MobileBlockBasicProps) {
|
|
10
|
+
return <BlockBasic {...props} className={cn(styles.wrapper, props.className)} data-mobile />;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MobileBlockBasic';
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { MouseEventHandler } from 'react';
|
|
2
|
+
|
|
3
|
+
import { ArrowRightSVG, CrossSVG } from '@cloud-ru/uikit-product-icons';
|
|
4
|
+
import { ButtonTonal } from '@snack-uikit/button';
|
|
5
|
+
import { Card, CardProps } from '@snack-uikit/card';
|
|
6
|
+
import { Typography } from '@snack-uikit/typography';
|
|
7
|
+
import { extractSupportProps, WithSupportProps } from '@snack-uikit/utils';
|
|
8
|
+
|
|
9
|
+
import styles from './styles.module.scss';
|
|
10
|
+
|
|
11
|
+
export type MobileCardBannerProps = WithSupportProps<
|
|
12
|
+
Pick<CardProps, 'onClick' | 'className' | 'disabled' | 'href'> & {
|
|
13
|
+
title: string;
|
|
14
|
+
description: string;
|
|
15
|
+
actionLabel: string;
|
|
16
|
+
image: {
|
|
17
|
+
src: string;
|
|
18
|
+
alt: string;
|
|
19
|
+
};
|
|
20
|
+
onClose?: MouseEventHandler<HTMLElement>;
|
|
21
|
+
}
|
|
22
|
+
>;
|
|
23
|
+
|
|
24
|
+
export function MobileCardBanner({
|
|
25
|
+
href,
|
|
26
|
+
title,
|
|
27
|
+
description,
|
|
28
|
+
onClick,
|
|
29
|
+
actionLabel,
|
|
30
|
+
image,
|
|
31
|
+
className,
|
|
32
|
+
onClose,
|
|
33
|
+
disabled,
|
|
34
|
+
...rest
|
|
35
|
+
}: MobileCardBannerProps) {
|
|
36
|
+
return (
|
|
37
|
+
<Card {...extractSupportProps(rest)} href={href} className={className} onClick={onClick} disabled={disabled}>
|
|
38
|
+
<>
|
|
39
|
+
{onClose && (
|
|
40
|
+
<div className={styles.cardFunctionBadgeWrapper}>
|
|
41
|
+
<ButtonTonal
|
|
42
|
+
icon={<CrossSVG />}
|
|
43
|
+
appearance='neutral'
|
|
44
|
+
onClick={e => {
|
|
45
|
+
e.stopPropagation();
|
|
46
|
+
onClose(e);
|
|
47
|
+
}}
|
|
48
|
+
size='xs'
|
|
49
|
+
/>
|
|
50
|
+
</div>
|
|
51
|
+
)}
|
|
52
|
+
|
|
53
|
+
<div className={styles.cardBannerContent}>
|
|
54
|
+
<div className={styles.cardBannerLeft}>
|
|
55
|
+
<div className={styles.cardBannerTitle}>{title}</div>
|
|
56
|
+
|
|
57
|
+
<Typography.SansBodyM>
|
|
58
|
+
<div data-test-id='card-banner__description' className={styles.cardBannerDescription}>
|
|
59
|
+
{description}
|
|
60
|
+
</div>
|
|
61
|
+
</Typography.SansBodyM>
|
|
62
|
+
|
|
63
|
+
<Card.Footer.CallToAction
|
|
64
|
+
className={styles.cardBannerFooter}
|
|
65
|
+
label={actionLabel}
|
|
66
|
+
icon={<ArrowRightSVG />}
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
<img src={image.src} alt={image.alt} className={styles.cardBannerImage} data-test-id='card-banner__image' />
|
|
71
|
+
</div>
|
|
72
|
+
</>
|
|
73
|
+
</Card>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MobileCardBanner';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
@use '@sbercloud/figma-tokens-cloud-platform/build/scss/styles-theme-variables.scss';
|
|
2
|
+
|
|
3
|
+
.cardBannerContent {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: row;
|
|
6
|
+
justify-content: space-between;
|
|
7
|
+
gap: styles-theme-variables.$dimension-2m;
|
|
8
|
+
width: 100%;
|
|
9
|
+
height: 100%;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.cardBannerLeft {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
flex-grow: 1;
|
|
16
|
+
gap: calc(styles-theme-variables.$dimension-050m + styles-theme-variables.$dimension-1m);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.cardBannerDescription {
|
|
20
|
+
color: styles-theme-variables.$sys-neutral-text-support;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.cardBannerTitle {
|
|
24
|
+
@include styles-theme-variables.composite-var(styles-theme-variables.$sans-title-m);
|
|
25
|
+
|
|
26
|
+
max-width: 100%;
|
|
27
|
+
color: styles-theme-variables.$sys-neutral-text-main;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.cardBannerImage {
|
|
31
|
+
width: calc(styles-theme-variables.$dimension-5m + styles-theme-variables.$dimension-7m);
|
|
32
|
+
flex-shrink: 0;
|
|
33
|
+
object-position: center;
|
|
34
|
+
object-fit: cover;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.cardFunctionBadgeWrapper {
|
|
38
|
+
position: absolute;
|
|
39
|
+
right: styles-theme-variables.$dimension-1m;
|
|
40
|
+
top: styles-theme-variables.$dimension-1m;
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: flex-end;
|
|
43
|
+
justify-content: flex-start;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.cardBannerFooter {
|
|
47
|
+
margin-top: auto;
|
|
48
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
import { IconPredefined, IconPredefinedProps } from '@snack-uikit/icon-predefined';
|
|
5
|
+
import { Typography } from '@snack-uikit/typography';
|
|
6
|
+
import { extractSupportProps, WithSupportProps } from '@snack-uikit/utils';
|
|
7
|
+
|
|
8
|
+
import { Footer, FooterProps } from './components';
|
|
9
|
+
import styles from './styles.module.scss';
|
|
10
|
+
|
|
11
|
+
export type MobileEmptyBlockProps = WithSupportProps<{
|
|
12
|
+
/** Заголовок */
|
|
13
|
+
title?: string;
|
|
14
|
+
/** Подзаголовок */
|
|
15
|
+
description?: ReactNode;
|
|
16
|
+
/** Иконка */
|
|
17
|
+
icon?: Pick<IconPredefinedProps, 'icon' | 'decor' | 'appearance'>;
|
|
18
|
+
|
|
19
|
+
className?: string;
|
|
20
|
+
}> &
|
|
21
|
+
(Pick<FooterProps, 'primaryButton' | 'secondaryButton'> | { primaryButton?: never; secondaryButton?: never });
|
|
22
|
+
|
|
23
|
+
export function MobileEmptyBlock({
|
|
24
|
+
primaryButton,
|
|
25
|
+
secondaryButton,
|
|
26
|
+
className,
|
|
27
|
+
title,
|
|
28
|
+
description,
|
|
29
|
+
icon,
|
|
30
|
+
...rest
|
|
31
|
+
}: MobileEmptyBlockProps) {
|
|
32
|
+
return (
|
|
33
|
+
<div className={cn(styles.emptyBlock, className)} {...extractSupportProps(rest)}>
|
|
34
|
+
<div className={cn(styles.infoBlock, className)} {...extractSupportProps(rest)}>
|
|
35
|
+
{icon && (
|
|
36
|
+
<IconPredefined
|
|
37
|
+
icon={icon.icon}
|
|
38
|
+
appearance={icon.appearance ?? 'primary'}
|
|
39
|
+
decor={icon.decor ?? true}
|
|
40
|
+
size='m'
|
|
41
|
+
/>
|
|
42
|
+
)}
|
|
43
|
+
|
|
44
|
+
<div className={styles.contentLayout}>
|
|
45
|
+
<div className={styles.textWrap}>
|
|
46
|
+
{title && (
|
|
47
|
+
<Typography family='sans' purpose='title' size='m' className={styles.title}>
|
|
48
|
+
{title}
|
|
49
|
+
</Typography>
|
|
50
|
+
)}
|
|
51
|
+
|
|
52
|
+
{description && (
|
|
53
|
+
<Typography family='sans' purpose='body' size='m' className={styles.description}>
|
|
54
|
+
{description}
|
|
55
|
+
</Typography>
|
|
56
|
+
)}
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
{primaryButton && <Footer primaryButton={primaryButton} secondaryButton={secondaryButton} />}
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
|
|
3
|
+
import { MobileTooltipProps } from '@cloud-ru/uikit-product-mobile-tooltip';
|
|
4
|
+
import { ButtonFilled, ButtonFilledProps, ButtonTonal, ButtonTonalProps } from '@snack-uikit/button';
|
|
5
|
+
|
|
6
|
+
import { useButtonWithTooltip } from './hooks';
|
|
7
|
+
import styles from './styles.module.scss';
|
|
8
|
+
|
|
9
|
+
export type FooterProps = {
|
|
10
|
+
/** Основная кнопка */
|
|
11
|
+
primaryButton: Omit<ButtonFilledProps, 'size'> & { tooltip?: MobileTooltipProps };
|
|
12
|
+
/** Дополнительная кнопка */
|
|
13
|
+
secondaryButton?: Omit<ButtonTonalProps, 'size'> & { tooltip?: MobileTooltipProps };
|
|
14
|
+
className?: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export function Footer({ primaryButton, secondaryButton, className }: FooterProps) {
|
|
18
|
+
const PrimaryButton = useButtonWithTooltip({ Button: ButtonFilled, tooltip: primaryButton.tooltip });
|
|
19
|
+
const SecondaryButton = useButtonWithTooltip({ Button: ButtonTonal, tooltip: secondaryButton?.tooltip });
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<div className={cn(styles.infoBlockFooter, className)}>
|
|
23
|
+
<PrimaryButton {...primaryButton} size='m' data-test-id={primaryButton['data-test-id']} fullWidth />
|
|
24
|
+
{secondaryButton && (
|
|
25
|
+
<SecondaryButton {...secondaryButton} size='m' data-test-id={secondaryButton['data-test-id']} fullWidth />
|
|
26
|
+
)}
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { JSXElementConstructor } from 'react';
|
|
2
|
+
|
|
3
|
+
import { MobileTooltip, MobileTooltipProps } from '@cloud-ru/uikit-product-mobile-tooltip';
|
|
4
|
+
|
|
5
|
+
export function useButtonWithTooltip<T>({
|
|
6
|
+
Button,
|
|
7
|
+
tooltip,
|
|
8
|
+
}: {
|
|
9
|
+
tooltip?: MobileTooltipProps;
|
|
10
|
+
Button: JSXElementConstructor<T>;
|
|
11
|
+
}) {
|
|
12
|
+
if (tooltip) {
|
|
13
|
+
return function ButtonWithTooltip(props: T) {
|
|
14
|
+
return (
|
|
15
|
+
<MobileTooltip {...tooltip}>
|
|
16
|
+
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
|
|
17
|
+
{/* @ts-ignore */}
|
|
18
|
+
<Button {...props} />
|
|
19
|
+
</MobileTooltip>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return Button;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Footer';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
@use '@sbercloud/figma-tokens-cloud-platform/build/scss/components/styles-tokens-infoBlock';
|
|
2
|
+
|
|
3
|
+
.infoBlockFooter {
|
|
4
|
+
@include styles-tokens-infoBlock.composite-var(styles-tokens-infoBlock.$info-block-footer);
|
|
5
|
+
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
align-items: center;
|
|
9
|
+
|
|
10
|
+
width: 100%;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Footer';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MobileEmptyBlock';
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
@use '@sbercloud/figma-tokens-cloud-platform/build/scss/components/styles-tokens-infoBlock';
|
|
2
|
+
|
|
3
|
+
div.emptyBlock {
|
|
4
|
+
background-color: styles-tokens-infoBlock.$sys-neutral-background1-level;
|
|
5
|
+
border-radius: calc(styles-tokens-infoBlock.$dimension-1m + styles-tokens-infoBlock.$dimension-050m);
|
|
6
|
+
padding: styles-tokens-infoBlock.$dimension-4m styles-tokens-infoBlock.$dimension-2m;
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
flex-grow: 1;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.contentLayout {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.textWrap {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
|
|
22
|
+
word-wrap: break-all;
|
|
23
|
+
max-width: 100%;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.footer {
|
|
27
|
+
position: relative;
|
|
28
|
+
box-sizing: border-box;
|
|
29
|
+
width: 100%;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.title {
|
|
33
|
+
color: styles-tokens-infoBlock.$sys-neutral-text-main;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.description {
|
|
37
|
+
color: styles-tokens-infoBlock.$sys-neutral-text-support;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.infoBlock {
|
|
41
|
+
display: flex;
|
|
42
|
+
box-sizing: border-box;
|
|
43
|
+
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
align-items: center;
|
|
46
|
+
|
|
47
|
+
width: 100%;
|
|
48
|
+
|
|
49
|
+
@include styles-tokens-infoBlock.composite-var(styles-tokens-infoBlock.$info-block, 'm', 'container');
|
|
50
|
+
|
|
51
|
+
.footer {
|
|
52
|
+
text-align: center;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.description,
|
|
56
|
+
.title {
|
|
57
|
+
text-align: center;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.contentLayout {
|
|
61
|
+
@include styles-tokens-infoBlock.composite-var(styles-tokens-infoBlock.$info-block, 'm', 'content-layout');
|
|
62
|
+
|
|
63
|
+
align-items: center;
|
|
64
|
+
|
|
65
|
+
width: 100%;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.textWrap {
|
|
69
|
+
@include styles-tokens-infoBlock.composite-var(styles-tokens-infoBlock.$info-block, 'm', 'text-wrap');
|
|
70
|
+
|
|
71
|
+
align-items: center;
|
|
72
|
+
|
|
73
|
+
width: 100%;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
|
|
4
|
+
import { extractSupportProps, WithSupportProps } from '@cloud-ru/uikit-product-utils';
|
|
5
|
+
|
|
6
|
+
import { ActionsProps, Headline, HeadlineProps, MobileActions } from '../../helperComponents';
|
|
7
|
+
import styles from './styles.module.scss';
|
|
8
|
+
|
|
9
|
+
export type MobilePageCatalogProps = WithSupportProps<
|
|
10
|
+
PropsWithChildren<
|
|
11
|
+
Pick<HeadlineProps, 'title'> & {
|
|
12
|
+
className?: string;
|
|
13
|
+
actions?: ActionsProps['items'];
|
|
14
|
+
maxVisibleActionsItems?: ActionsProps['maxVisibleItems'];
|
|
15
|
+
}
|
|
16
|
+
>
|
|
17
|
+
>;
|
|
18
|
+
|
|
19
|
+
export function MobilePageCatalog({
|
|
20
|
+
children,
|
|
21
|
+
title,
|
|
22
|
+
actions = [],
|
|
23
|
+
maxVisibleActionsItems,
|
|
24
|
+
className,
|
|
25
|
+
...rest
|
|
26
|
+
}: MobilePageCatalogProps) {
|
|
27
|
+
return (
|
|
28
|
+
<div className={cn(styles.catalog, className)} {...extractSupportProps(rest)}>
|
|
29
|
+
<Headline title={title} />
|
|
30
|
+
|
|
31
|
+
{actions.length > 0 && <MobileActions items={actions} maxVisibleItems={maxVisibleActionsItems} />}
|
|
32
|
+
|
|
33
|
+
<div className={styles.content}>{children}</div>
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MobilePageCatalog';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@use '@sbercloud/figma-tokens-cloud-platform/build/scss/styles-theme-variables';
|
|
2
|
+
|
|
3
|
+
.catalog {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: styles-theme-variables.$dimension-3m;
|
|
7
|
+
padding: styles-theme-variables.$dimension-3m;
|
|
8
|
+
margin: 0 auto;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
width: 100%;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.content {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
flex-grow: 1;
|
|
17
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
|
|
4
|
+
import { ChevronRightSVG, KebabSVG } from '@cloud-ru/uikit-product-icons';
|
|
5
|
+
import { MobileDropdown, MobileDroplist } from '@cloud-ru/uikit-product-mobile-dropdown';
|
|
6
|
+
import { MobileModalCustom } from '@cloud-ru/uikit-product-mobile-modal';
|
|
7
|
+
import { PageFormProps } from '@cloud-ru/uikit-product-page-layout';
|
|
8
|
+
import { ButtonFilled, ButtonFunction, ButtonOutline, ButtonSimple } from '@snack-uikit/button';
|
|
9
|
+
import { Typography } from '@snack-uikit/typography';
|
|
10
|
+
import { extractSupportProps, ValueOf } from '@snack-uikit/utils';
|
|
11
|
+
|
|
12
|
+
import { Headline } from '../../helperComponents';
|
|
13
|
+
import { useGetButtonLabel } from '../../helpers';
|
|
14
|
+
import { useButtonWithTooltip } from './hooks';
|
|
15
|
+
import styles from './styles.module.scss';
|
|
16
|
+
|
|
17
|
+
export const BUTTON_PRIMARY_VARIANT = {
|
|
18
|
+
Continue: 'continue',
|
|
19
|
+
Create: 'create',
|
|
20
|
+
Save: 'save',
|
|
21
|
+
Rent: 'rent',
|
|
22
|
+
Send: 'send',
|
|
23
|
+
} as const;
|
|
24
|
+
|
|
25
|
+
export const BUTTON_SECONDARY_VARIANT = {
|
|
26
|
+
Cancel: 'cancel',
|
|
27
|
+
Back: 'back',
|
|
28
|
+
} as const;
|
|
29
|
+
|
|
30
|
+
export type ButtonPrimaryVariant = ValueOf<typeof BUTTON_PRIMARY_VARIANT>;
|
|
31
|
+
export type ButtonSecondaryVariant = ValueOf<typeof BUTTON_SECONDARY_VARIANT>;
|
|
32
|
+
|
|
33
|
+
export type MobilePageFormProps = PageFormProps;
|
|
34
|
+
|
|
35
|
+
export function MobilePageForm({
|
|
36
|
+
children,
|
|
37
|
+
title,
|
|
38
|
+
subHeader,
|
|
39
|
+
className,
|
|
40
|
+
footer,
|
|
41
|
+
stepper,
|
|
42
|
+
priceSummary,
|
|
43
|
+
sideBlock,
|
|
44
|
+
...rest
|
|
45
|
+
}: PageFormProps) {
|
|
46
|
+
const PrimaryButton = useButtonWithTooltip({ Button: ButtonFilled, tooltip: footer?.buttonPrimary.tooltip });
|
|
47
|
+
const SecondaryButton = useButtonWithTooltip({ Button: ButtonOutline, tooltip: footer?.buttonSecondary?.tooltip });
|
|
48
|
+
const AdditionalButton = useButtonWithTooltip({ Button: ButtonSimple, tooltip: footer?.buttonAdditional?.tooltip });
|
|
49
|
+
|
|
50
|
+
const [openPriceSummary, setOpenPriceSummary] = useState<boolean>(false);
|
|
51
|
+
const [openMore, setOpenMore] = useState<boolean>(false);
|
|
52
|
+
const [openMoreContentIndex, setOpenMoreContentIndex] = useState<number | undefined>(undefined);
|
|
53
|
+
|
|
54
|
+
const getButtonLabel = useGetButtonLabel();
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<div className={cn(styles.container, className)} {...extractSupportProps(rest)}>
|
|
58
|
+
<Headline
|
|
59
|
+
title={title}
|
|
60
|
+
subHeader={subHeader}
|
|
61
|
+
moreActions={
|
|
62
|
+
sideBlock ? (
|
|
63
|
+
<MobileDroplist
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
size='l'
|
|
67
|
+
open={openMore}
|
|
68
|
+
onOpenChange={setOpenMore}
|
|
69
|
+
items={sideBlock.map(({ label }, idx) => ({
|
|
70
|
+
id: idx,
|
|
71
|
+
content: {
|
|
72
|
+
option: label,
|
|
73
|
+
},
|
|
74
|
+
onClick: () => {
|
|
75
|
+
(setOpenMoreContentIndex(idx), setOpenMore(false));
|
|
76
|
+
},
|
|
77
|
+
}))}
|
|
78
|
+
>
|
|
79
|
+
<ButtonFunction icon={<KebabSVG />} size='m' />
|
|
80
|
+
</MobileDroplist>
|
|
81
|
+
) : undefined
|
|
82
|
+
}
|
|
83
|
+
/>
|
|
84
|
+
|
|
85
|
+
{sideBlock && (
|
|
86
|
+
<MobileModalCustom open={openMoreContentIndex !== undefined} onClose={() => setOpenMoreContentIndex(undefined)}>
|
|
87
|
+
<MobileModalCustom.Body content={sideBlock?.[openMoreContentIndex ?? 0].content} />
|
|
88
|
+
</MobileModalCustom>
|
|
89
|
+
)}
|
|
90
|
+
|
|
91
|
+
{stepper && <div className={styles.stepper}>{stepper}</div>}
|
|
92
|
+
|
|
93
|
+
<div className={styles.body}>{children}</div>
|
|
94
|
+
|
|
95
|
+
{(priceSummary || footer) && (
|
|
96
|
+
<div className={styles.footer}>
|
|
97
|
+
{priceSummary && (
|
|
98
|
+
<div className={styles.priceSummary}>
|
|
99
|
+
<Typography.SansBodyM className={styles.priceSummaryText}>Оценка бюджета</Typography.SansBodyM>
|
|
100
|
+
|
|
101
|
+
<MobileDropdown
|
|
102
|
+
open={openPriceSummary}
|
|
103
|
+
onOpenChange={setOpenPriceSummary}
|
|
104
|
+
content={<div className={styles.modalContent}>{priceSummary.content}</div>}
|
|
105
|
+
>
|
|
106
|
+
<div className={styles.priceSummaryRight}>
|
|
107
|
+
<Typography.SansLabelL className={styles.priceSummaryTotal}>
|
|
108
|
+
{priceSummary.total}
|
|
109
|
+
</Typography.SansLabelL>
|
|
110
|
+
{priceSummary.content && <ButtonFunction size='m' icon={<ChevronRightSVG />} />}
|
|
111
|
+
</div>
|
|
112
|
+
</MobileDropdown>
|
|
113
|
+
</div>
|
|
114
|
+
)}
|
|
115
|
+
|
|
116
|
+
{footer && (
|
|
117
|
+
<div
|
|
118
|
+
className={styles.actions}
|
|
119
|
+
data-column={(footer.buttonAdditional && footer.buttonSecondary) || undefined}
|
|
120
|
+
>
|
|
121
|
+
{footer.buttonAdditional && <AdditionalButton {...footer.buttonAdditional} size='m' fullWidth />}
|
|
122
|
+
|
|
123
|
+
{footer.buttonSecondary && (
|
|
124
|
+
<SecondaryButton
|
|
125
|
+
{...footer.buttonSecondary}
|
|
126
|
+
size='m'
|
|
127
|
+
fullWidth
|
|
128
|
+
appearance='neutral'
|
|
129
|
+
label={
|
|
130
|
+
footer.buttonSecondary.variant === 'custom'
|
|
131
|
+
? footer.buttonSecondary.label
|
|
132
|
+
: getButtonLabel(footer.buttonSecondary.variant)
|
|
133
|
+
}
|
|
134
|
+
/>
|
|
135
|
+
)}
|
|
136
|
+
|
|
137
|
+
<PrimaryButton
|
|
138
|
+
{...footer.buttonPrimary}
|
|
139
|
+
size='m'
|
|
140
|
+
fullWidth
|
|
141
|
+
label={
|
|
142
|
+
footer.buttonPrimary.variant === 'custom'
|
|
143
|
+
? footer.buttonPrimary.label
|
|
144
|
+
: getButtonLabel(footer.buttonPrimary.variant)
|
|
145
|
+
}
|
|
146
|
+
/>
|
|
147
|
+
</div>
|
|
148
|
+
)}
|
|
149
|
+
</div>
|
|
150
|
+
)}
|
|
151
|
+
</div>
|
|
152
|
+
);
|
|
153
|
+
}
|