@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,23 @@
|
|
|
1
|
+
import { ForwardRefExoticComponent } from 'react';
|
|
2
|
+
|
|
3
|
+
import { MobileTooltip, MobileTooltipProps } from '@cloud-ru/uikit-product-mobile-tooltip';
|
|
4
|
+
|
|
5
|
+
export function useButtonWithTooltip<T extends Record<string, unknown>>({
|
|
6
|
+
Button,
|
|
7
|
+
tooltip,
|
|
8
|
+
}: {
|
|
9
|
+
tooltip?: MobileTooltipProps;
|
|
10
|
+
Button: ForwardRefExoticComponent<T>;
|
|
11
|
+
}) {
|
|
12
|
+
if (tooltip) {
|
|
13
|
+
return function ButtonWithTooltip(props: T) {
|
|
14
|
+
return (
|
|
15
|
+
<MobileTooltip {...tooltip}>
|
|
16
|
+
<Button {...props} />
|
|
17
|
+
</MobileTooltip>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return Button;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MobilePageForm';
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
@use '@sbercloud/figma-tokens-cloud-platform/build/scss/styles-theme-variables';
|
|
2
|
+
|
|
3
|
+
$prefix-height: styles-theme-variables.simple-var(styles-theme-variables.$sans-headline-m-line-height);
|
|
4
|
+
|
|
5
|
+
.container {
|
|
6
|
+
background-color: styles-theme-variables.$sys-neutral-background1-level;
|
|
7
|
+
width: 100%;
|
|
8
|
+
min-height: 100%;
|
|
9
|
+
flex-grow: 1;
|
|
10
|
+
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
|
|
14
|
+
gap: styles-theme-variables.$dimension-2m;
|
|
15
|
+
padding: styles-theme-variables.$dimension-2m;
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
|
|
18
|
+
position: relative;
|
|
19
|
+
/* stylelint-disable-next-line declaration-property-value-allowed-list */
|
|
20
|
+
z-index: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.body {
|
|
24
|
+
@include styles-theme-variables.composite-var(styles-theme-variables.$sans-body-m);
|
|
25
|
+
color: styles-theme-variables.$sys-neutral-text-main;
|
|
26
|
+
background-color: styles-theme-variables.$sys-neutral-background1-level;
|
|
27
|
+
flex: 1;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.footer {
|
|
31
|
+
position: sticky;
|
|
32
|
+
bottom: 0;
|
|
33
|
+
/* stylelint-disable-next-line declaration-property-value-allowed-list */
|
|
34
|
+
z-index: 1;
|
|
35
|
+
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
gap: styles-theme-variables.$dimension-1m;
|
|
39
|
+
|
|
40
|
+
border-top: solid 1px styles-theme-variables.$sys-neutral-decor-default;
|
|
41
|
+
box-sizing: border-box;
|
|
42
|
+
background-color: styles-theme-variables.$sys-neutral-background1-level;
|
|
43
|
+
padding: styles-theme-variables.$dimension-1m styles-theme-variables.$dimension-2m styles-theme-variables.$dimension-2m;
|
|
44
|
+
margin: calc(0px - styles-theme-variables.$dimension-1m) calc(0px - styles-theme-variables.$dimension-2m) calc(0px - styles-theme-variables.$dimension-2m);
|
|
45
|
+
|
|
46
|
+
.actions {
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: row;
|
|
49
|
+
gap: styles-theme-variables.$dimension-1m;
|
|
50
|
+
|
|
51
|
+
&[data-column] {
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.mainActions {
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
margin-left: auto;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.priceSummary {
|
|
64
|
+
display: flex;
|
|
65
|
+
justify-content: space-between;
|
|
66
|
+
min-height: 40px;
|
|
67
|
+
align-items: center;
|
|
68
|
+
gap: 4px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.priceSummaryText {
|
|
72
|
+
color: styles-theme-variables.$sys-neutral-text-support;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.priceSummaryRight {
|
|
76
|
+
display: flex;
|
|
77
|
+
align-items: center;
|
|
78
|
+
cursor: pointer;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.stepper {
|
|
82
|
+
position: sticky;
|
|
83
|
+
top: 0;
|
|
84
|
+
|
|
85
|
+
/* stylelint-disable-next-line declaration-property-value-allowed-list */
|
|
86
|
+
z-index: 1;
|
|
87
|
+
|
|
88
|
+
background-color: styles-theme-variables.$sys-neutral-background1-level;
|
|
89
|
+
padding: 0 styles-theme-variables.$dimension-2m styles-theme-variables.$dimension-1m;
|
|
90
|
+
margin: 0 calc(0px - styles-theme-variables.$dimension-2m) calc(0px - styles-theme-variables.$dimension-1m);
|
|
91
|
+
|
|
92
|
+
border-bottom: solid 1px styles-theme-variables.$sys-neutral-decor-default;
|
|
93
|
+
box-sizing: border-box;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.modalContent {
|
|
97
|
+
padding: 0 styles-theme-variables.$dimension-2m;
|
|
98
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
|
|
4
|
+
import { extractSupportProps, WithSupportProps } from '@cloud-ru/uikit-product-utils';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
ActionsProps,
|
|
8
|
+
Headline,
|
|
9
|
+
HeadlineProps,
|
|
10
|
+
MobileActions,
|
|
11
|
+
SidebarSelect,
|
|
12
|
+
SidebarSelectProps,
|
|
13
|
+
} from '../../helperComponents';
|
|
14
|
+
import styles from './styles.module.scss';
|
|
15
|
+
|
|
16
|
+
export type MobilePageServicesProps = WithSupportProps<
|
|
17
|
+
PropsWithChildren<
|
|
18
|
+
Pick<HeadlineProps, 'title' | 'beforeHeadline' | 'subHeader' | 'afterHeadline'> & {
|
|
19
|
+
className?: string;
|
|
20
|
+
sidebar?: SidebarSelectProps;
|
|
21
|
+
actions?: ActionsProps['items'];
|
|
22
|
+
maxVisibleActionsItems?: ActionsProps['maxVisibleItems'];
|
|
23
|
+
}
|
|
24
|
+
>
|
|
25
|
+
>;
|
|
26
|
+
|
|
27
|
+
export function MobilePageServices({
|
|
28
|
+
children,
|
|
29
|
+
title,
|
|
30
|
+
actions = [],
|
|
31
|
+
className,
|
|
32
|
+
sidebar,
|
|
33
|
+
afterHeadline,
|
|
34
|
+
subHeader,
|
|
35
|
+
beforeHeadline,
|
|
36
|
+
maxVisibleActionsItems,
|
|
37
|
+
...rest
|
|
38
|
+
}: MobilePageServicesProps) {
|
|
39
|
+
return (
|
|
40
|
+
<div className={cn(styles.wrapper, className)} {...extractSupportProps(rest)}>
|
|
41
|
+
<Headline title={title} beforeHeadline={beforeHeadline} afterHeadline={afterHeadline} subHeader={subHeader} />
|
|
42
|
+
|
|
43
|
+
{sidebar && <SidebarSelect {...sidebar} />}
|
|
44
|
+
|
|
45
|
+
{actions.length > 0 && <MobileActions items={actions} maxVisibleItems={maxVisibleActionsItems} />}
|
|
46
|
+
|
|
47
|
+
<div className={styles.childWrapper}>{children}</div>
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MobilePageServices';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@use '@sbercloud/figma-tokens-cloud-platform/build/scss/styles-theme-variables';
|
|
2
|
+
|
|
3
|
+
.wrapper {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
width: 100%;
|
|
7
|
+
min-height: 100%;
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
padding: styles-theme-variables.$dimension-2m;
|
|
10
|
+
gap: styles-theme-variables.$dimension-2m;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.childWrapper {
|
|
14
|
+
flex-shrink: 1;
|
|
15
|
+
flex-grow: 1;
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
box-sizing: border-box;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.actions {
|
|
22
|
+
display: flex;
|
|
23
|
+
gap: 8px;
|
|
24
|
+
flex-shrink: 0;
|
|
25
|
+
width: 100%;
|
|
26
|
+
justify-content: stretch;
|
|
27
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import { AdaptiveTooltip } from '@cloud-ru/uikit-product-mobile-tooltip';
|
|
4
|
+
import { QuotaDropdown, QuotaDropdownProps } from '@cloud-ru/uikit-product-quota';
|
|
5
|
+
import { WithLayoutType } from '@cloud-ru/uikit-product-utils';
|
|
6
|
+
import {
|
|
7
|
+
ButtonFilled,
|
|
8
|
+
ButtonFilledProps,
|
|
9
|
+
ButtonFunction,
|
|
10
|
+
ButtonFunctionProps,
|
|
11
|
+
ButtonOutline,
|
|
12
|
+
ButtonOutlineProps,
|
|
13
|
+
ButtonSimple,
|
|
14
|
+
ButtonSimpleProps,
|
|
15
|
+
ButtonTonal,
|
|
16
|
+
ButtonTonalProps,
|
|
17
|
+
} from '@snack-uikit/button';
|
|
18
|
+
|
|
19
|
+
import { ButtonDropdown, ButtonDropdownProps } from '../ButtonDropdown';
|
|
20
|
+
import { ButtonDroplist, ButtonDroplistProps } from '../ButtonDroplist';
|
|
21
|
+
import { ButtonKebab, ButtonKebabProps } from '../ButtonKebab';
|
|
22
|
+
import { BUTTON_TYPE } from './constants';
|
|
23
|
+
import { Action } from './types';
|
|
24
|
+
|
|
25
|
+
export function ActionView({
|
|
26
|
+
variant,
|
|
27
|
+
tooltip,
|
|
28
|
+
hidden = false,
|
|
29
|
+
layoutType,
|
|
30
|
+
commonProps,
|
|
31
|
+
...buttonProps
|
|
32
|
+
}: WithLayoutType<Action & { commonProps: { className?: string; size?: 's' | 'm' | 'l'; fullWidth?: boolean } }>) {
|
|
33
|
+
if (hidden) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const addTooltip = (component: ReactNode) =>
|
|
38
|
+
tooltip ? (
|
|
39
|
+
<AdaptiveTooltip layoutType={layoutType} {...tooltip}>
|
|
40
|
+
{component}
|
|
41
|
+
</AdaptiveTooltip>
|
|
42
|
+
) : (
|
|
43
|
+
component
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
switch (variant) {
|
|
47
|
+
case BUTTON_TYPE.Filled:
|
|
48
|
+
return addTooltip(<ButtonFilled {...(buttonProps as ButtonFilledProps)} {...commonProps} />);
|
|
49
|
+
case BUTTON_TYPE.Outline:
|
|
50
|
+
return addTooltip(<ButtonOutline {...(buttonProps as ButtonOutlineProps)} {...commonProps} />);
|
|
51
|
+
case BUTTON_TYPE.Tonal:
|
|
52
|
+
return addTooltip(<ButtonTonal {...(buttonProps as ButtonTonalProps)} {...commonProps} />);
|
|
53
|
+
case BUTTON_TYPE.Function:
|
|
54
|
+
return addTooltip(<ButtonFunction {...(buttonProps as ButtonFunctionProps)} {...commonProps} />);
|
|
55
|
+
case BUTTON_TYPE.Simple:
|
|
56
|
+
return addTooltip(<ButtonSimple {...(buttonProps as ButtonSimpleProps)} {...commonProps} />);
|
|
57
|
+
case BUTTON_TYPE.Dropdown: {
|
|
58
|
+
const { button, dropdown } = buttonProps as ButtonDropdownProps;
|
|
59
|
+
|
|
60
|
+
return addTooltip(
|
|
61
|
+
<ButtonDropdown button={{ ...button, ...commonProps }} dropdown={dropdown} layoutType={layoutType} />,
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
case BUTTON_TYPE.Kebab: {
|
|
65
|
+
const { button, list } = buttonProps as ButtonKebabProps;
|
|
66
|
+
return addTooltip(<ButtonKebab button={{ ...button, ...commonProps }} list={list} layoutType={layoutType} />);
|
|
67
|
+
}
|
|
68
|
+
case BUTTON_TYPE.Droplist: {
|
|
69
|
+
const { button, list } = buttonProps as ButtonDroplistProps;
|
|
70
|
+
return addTooltip(<ButtonDroplist button={{ ...button, ...commonProps }} list={list} layoutType={layoutType} />);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
case BUTTON_TYPE.Quota: {
|
|
74
|
+
return addTooltip(
|
|
75
|
+
<QuotaDropdown {...(buttonProps as QuotaDropdownProps)} {...commonProps} layoutType={layoutType} />,
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
default:
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ActionView } from './ActionView';
|
|
2
|
+
import { hasVisibleActions } from './helpers';
|
|
3
|
+
import styles from './styles.module.scss';
|
|
4
|
+
import { ActionsProps } from './types';
|
|
5
|
+
|
|
6
|
+
export function DesktopActions({ items }: Pick<ActionsProps, 'items'>) {
|
|
7
|
+
if (!hasVisibleActions(items)) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<div className={styles.desktopActionsWrapper}>
|
|
13
|
+
{items.map((action, index) => (
|
|
14
|
+
<ActionView
|
|
15
|
+
{...action}
|
|
16
|
+
key={index}
|
|
17
|
+
layoutType='desktop'
|
|
18
|
+
commonProps={{
|
|
19
|
+
className: styles.button,
|
|
20
|
+
}}
|
|
21
|
+
/>
|
|
22
|
+
))}
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { Children, isValidElement, useRef, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { ChevronDownSVG, KebabSVG } from '@cloud-ru/uikit-product-icons';
|
|
4
|
+
import { useLocale } from '@cloud-ru/uikit-product-locale';
|
|
5
|
+
import { AdaptiveDropdown, MobileDroplist, MobileDroplistProps } from '@cloud-ru/uikit-product-mobile-dropdown';
|
|
6
|
+
import { MobileTooltip } from '@cloud-ru/uikit-product-mobile-tooltip';
|
|
7
|
+
import { checkExceeded, QuotaCardProps, QuotaDropdownContent } from '@cloud-ru/uikit-product-quota';
|
|
8
|
+
import { ButtonOutline } from '@snack-uikit/button';
|
|
9
|
+
import { Counter } from '@snack-uikit/counter';
|
|
10
|
+
import { useDynamicList } from '@snack-uikit/utils';
|
|
11
|
+
|
|
12
|
+
import { ActionView } from './ActionView';
|
|
13
|
+
import { BUTTON_TYPE } from './constants';
|
|
14
|
+
import { hasVisibleActions } from './helpers';
|
|
15
|
+
import styles from './styles.module.scss';
|
|
16
|
+
import { ActionsProps } from './types';
|
|
17
|
+
|
|
18
|
+
export function MobileActions({ items, maxVisibleItems }: ActionsProps) {
|
|
19
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
20
|
+
|
|
21
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
22
|
+
const { visibleItems, hiddenItems } = useDynamicList({ parentContainerRef: containerRef, items, maxVisibleItems });
|
|
23
|
+
|
|
24
|
+
const { t: tQuota } = useLocale('Quota');
|
|
25
|
+
|
|
26
|
+
if (!hasVisibleActions(items)) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const hiddenItemsWithKebab = hiddenItems.concat(visibleItems.filter(item => item.variant === 'kebab'));
|
|
31
|
+
const visibleItemsWithoutKebab = visibleItems.filter(item => item.variant !== 'kebab');
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<div className={styles.mobileActionsWrapper} ref={containerRef}>
|
|
35
|
+
{hiddenItemsWithKebab.length > 0 && (
|
|
36
|
+
<MobileDroplist
|
|
37
|
+
open={isOpen}
|
|
38
|
+
onOpenChange={setIsOpen}
|
|
39
|
+
items={hiddenItemsWithKebab.reduce(
|
|
40
|
+
(acc, action) => {
|
|
41
|
+
switch (action.variant) {
|
|
42
|
+
case BUTTON_TYPE.Tonal:
|
|
43
|
+
case BUTTON_TYPE.Simple:
|
|
44
|
+
case BUTTON_TYPE.Outline:
|
|
45
|
+
case BUTTON_TYPE.Function:
|
|
46
|
+
case BUTTON_TYPE.Filled: {
|
|
47
|
+
acc.push({
|
|
48
|
+
...action,
|
|
49
|
+
content: { option: action.label ?? '' },
|
|
50
|
+
onClick: event => {
|
|
51
|
+
setIsOpen(false);
|
|
52
|
+
action.onClick?.(event);
|
|
53
|
+
},
|
|
54
|
+
beforeContent: action?.icon,
|
|
55
|
+
itemWrapRender: action.tooltip
|
|
56
|
+
? item => (
|
|
57
|
+
<MobileTooltip tip={action.tooltip?.tip ?? ''} {...action.tooltip}>
|
|
58
|
+
{item}
|
|
59
|
+
</MobileTooltip>
|
|
60
|
+
)
|
|
61
|
+
: undefined,
|
|
62
|
+
});
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
case BUTTON_TYPE.Quota: {
|
|
66
|
+
const quotaExceededCount = Children.toArray(action.children).reduce<number>(
|
|
67
|
+
(count, child) =>
|
|
68
|
+
isValidElement<QuotaCardProps>(child) &&
|
|
69
|
+
!child?.props?.loading &&
|
|
70
|
+
!child?.props?.unlimited &&
|
|
71
|
+
checkExceeded((child?.props?.limit ?? 0) - (child?.props?.created ?? 0))
|
|
72
|
+
? count + 1
|
|
73
|
+
: count,
|
|
74
|
+
0,
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const isQuotaExceededCountVisible = !action.dataError && quotaExceededCount > 0;
|
|
78
|
+
|
|
79
|
+
acc.push({
|
|
80
|
+
...action,
|
|
81
|
+
type: 'group',
|
|
82
|
+
divider: acc.length > 0,
|
|
83
|
+
items: [
|
|
84
|
+
{
|
|
85
|
+
...action,
|
|
86
|
+
content: {
|
|
87
|
+
option: tQuota('quotas'),
|
|
88
|
+
},
|
|
89
|
+
afterContent: (
|
|
90
|
+
<>
|
|
91
|
+
{isQuotaExceededCountVisible && (
|
|
92
|
+
<Counter value={quotaExceededCount} appearance='red' size='m' />
|
|
93
|
+
)}
|
|
94
|
+
<ChevronDownSVG />
|
|
95
|
+
</>
|
|
96
|
+
),
|
|
97
|
+
|
|
98
|
+
itemWrapRender: item => {
|
|
99
|
+
const content = (
|
|
100
|
+
<AdaptiveDropdown content={<QuotaDropdownContent {...action} />} layoutType='mobile'>
|
|
101
|
+
{item}
|
|
102
|
+
</AdaptiveDropdown>
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
return action.tooltip ? (
|
|
106
|
+
<MobileTooltip {...action.tooltip}>{content}</MobileTooltip>
|
|
107
|
+
) : (
|
|
108
|
+
content
|
|
109
|
+
);
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
});
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
case BUTTON_TYPE.Droplist:
|
|
117
|
+
case BUTTON_TYPE.Kebab: {
|
|
118
|
+
const needDivider = Boolean(action.variant === 'droplist' && action?.button.label) || acc.length > 0;
|
|
119
|
+
|
|
120
|
+
acc.push({
|
|
121
|
+
...action,
|
|
122
|
+
type: 'group',
|
|
123
|
+
label: action.variant === 'droplist' ? action?.button.label : undefined,
|
|
124
|
+
divider: needDivider,
|
|
125
|
+
items: action.list.items.map(item => ({
|
|
126
|
+
...item,
|
|
127
|
+
onClick: event => {
|
|
128
|
+
setIsOpen(false);
|
|
129
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
130
|
+
// @ts-expect-error
|
|
131
|
+
item.onClick?.(event);
|
|
132
|
+
},
|
|
133
|
+
})),
|
|
134
|
+
});
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
case BUTTON_TYPE.Dropdown: {
|
|
138
|
+
acc.push({
|
|
139
|
+
...action,
|
|
140
|
+
type: 'group',
|
|
141
|
+
divider: acc.length > 0,
|
|
142
|
+
items: [
|
|
143
|
+
{
|
|
144
|
+
...action.button,
|
|
145
|
+
content: { option: action.button.label ?? '' },
|
|
146
|
+
onClick: event => {
|
|
147
|
+
action.button.onClick?.(event);
|
|
148
|
+
},
|
|
149
|
+
afterContent: <ChevronDownSVG />,
|
|
150
|
+
itemWrapRender: item => {
|
|
151
|
+
const content = (
|
|
152
|
+
<AdaptiveDropdown {...action.dropdown} layoutType='mobile'>
|
|
153
|
+
{item}
|
|
154
|
+
</AdaptiveDropdown>
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
return action.tooltip ? (
|
|
158
|
+
<MobileTooltip {...action.tooltip}>{content}</MobileTooltip>
|
|
159
|
+
) : (
|
|
160
|
+
content
|
|
161
|
+
);
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
});
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
default: {
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return acc;
|
|
174
|
+
},
|
|
175
|
+
[] as MobileDroplistProps['items'],
|
|
176
|
+
)}
|
|
177
|
+
>
|
|
178
|
+
<ButtonOutline appearance='neutral' icon={<KebabSVG />} size='m' />
|
|
179
|
+
</MobileDroplist>
|
|
180
|
+
)}
|
|
181
|
+
|
|
182
|
+
{visibleItemsWithoutKebab.map((action, index) => (
|
|
183
|
+
<ActionView
|
|
184
|
+
{...action}
|
|
185
|
+
key={index}
|
|
186
|
+
layoutType='mobile'
|
|
187
|
+
commonProps={{
|
|
188
|
+
className: styles.button,
|
|
189
|
+
size: 'm',
|
|
190
|
+
fullWidth: true,
|
|
191
|
+
}}
|
|
192
|
+
/>
|
|
193
|
+
))}
|
|
194
|
+
</div>
|
|
195
|
+
);
|
|
196
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
@use '@sbercloud/figma-tokens-cloud-platform/build/scss/styles-theme-variables';
|
|
2
|
+
|
|
3
|
+
.desktopActionsWrapper {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: row-reverse;
|
|
6
|
+
align-items: center;
|
|
7
|
+
flex-shrink: 0;
|
|
8
|
+
gap: styles-theme-variables.$dimension-1m;
|
|
9
|
+
height: 100%;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.mobileActionsWrapper {
|
|
13
|
+
display: flex;
|
|
14
|
+
gap: 8px;
|
|
15
|
+
flex-shrink: 0;
|
|
16
|
+
width: 100%;
|
|
17
|
+
justify-content: stretch;
|
|
18
|
+
overflow-y: auto;
|
|
19
|
+
flex-direction: row-reverse;
|
|
20
|
+
|
|
21
|
+
/* Hide scrollbar */
|
|
22
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
23
|
+
scrollbar-width: none; /* Firefox */
|
|
24
|
+
|
|
25
|
+
&::-webkit-scrollbar {
|
|
26
|
+
display: none; /* Chrome, Safari and Opera */
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.button {
|
|
31
|
+
white-space: nowrap;
|
|
32
|
+
|
|
33
|
+
&[data-full-width]:not([data-variant='icon-only']) {
|
|
34
|
+
flex-shrink: 0;
|
|
35
|
+
width: auto;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&[data-variant='icon-only'] {
|
|
39
|
+
flex-grow: 0;
|
|
40
|
+
flex-shrink: 0;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { TooltipProps } from '@cloud-ru/uikit-product-mobile-tooltip';
|
|
2
|
+
import { QuotaDropdownProps } from '@cloud-ru/uikit-product-quota';
|
|
3
|
+
import {
|
|
4
|
+
ButtonFilledProps,
|
|
5
|
+
ButtonFunctionProps,
|
|
6
|
+
ButtonOutlineProps,
|
|
7
|
+
ButtonSimpleProps,
|
|
8
|
+
ButtonTonalProps,
|
|
9
|
+
} from '@snack-uikit/button';
|
|
10
|
+
|
|
11
|
+
import { ButtonDropdownProps } from '../ButtonDropdown';
|
|
12
|
+
import { ButtonDroplistProps } from '../ButtonDroplist';
|
|
13
|
+
import { ButtonKebabProps } from '../ButtonKebab';
|
|
14
|
+
import { BUTTON_TYPE } from './constants';
|
|
15
|
+
|
|
16
|
+
type ButtonDropdownPropsWithoutLayout = Omit<ButtonDropdownProps, 'layoutType'>;
|
|
17
|
+
type ButtonKebabPropsWithoutLayout = Omit<ButtonKebabProps, 'layoutType'>;
|
|
18
|
+
type ButtonDroplistWithoutLayout = Omit<ButtonDroplistProps, 'layoutType'>;
|
|
19
|
+
type ButtonQuotaDropdownWithoutLayout = Omit<QuotaDropdownProps, 'layoutType'>;
|
|
20
|
+
|
|
21
|
+
export type Action = {
|
|
22
|
+
tooltip?: TooltipProps;
|
|
23
|
+
hidden?: boolean;
|
|
24
|
+
} & (
|
|
25
|
+
| ({ variant?: typeof BUTTON_TYPE.Filled } & ButtonFilledProps)
|
|
26
|
+
| ({ variant: typeof BUTTON_TYPE.Outline } & ButtonOutlineProps)
|
|
27
|
+
| ({ variant: typeof BUTTON_TYPE.Tonal } & ButtonTonalProps)
|
|
28
|
+
| ({ variant: typeof BUTTON_TYPE.Function } & ButtonFunctionProps)
|
|
29
|
+
| ({ variant: typeof BUTTON_TYPE.Simple } & ButtonSimpleProps)
|
|
30
|
+
| ({ variant: typeof BUTTON_TYPE.Dropdown } & ButtonDropdownPropsWithoutLayout)
|
|
31
|
+
| ({ variant: typeof BUTTON_TYPE.Kebab } & ButtonKebabPropsWithoutLayout)
|
|
32
|
+
| ({ variant: typeof BUTTON_TYPE.Droplist } & ButtonDroplistWithoutLayout)
|
|
33
|
+
| ({ variant: typeof BUTTON_TYPE.Quota } & ButtonQuotaDropdownWithoutLayout)
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
export type ActionsProps = {
|
|
37
|
+
items: Action[];
|
|
38
|
+
maxVisibleItems?: number;
|
|
39
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ChevronDownSVG, ChevronUpSVG } from '@cloud-ru/uikit-product-icons';
|
|
2
|
+
import { AdaptiveDropdown, AdaptiveDropdownProps } from '@cloud-ru/uikit-product-mobile-dropdown';
|
|
3
|
+
import { WithLayoutType } from '@cloud-ru/uikit-product-utils';
|
|
4
|
+
import { ButtonFunction, ButtonFunctionProps } from '@snack-uikit/button';
|
|
5
|
+
import { useValueControl } from '@snack-uikit/utils';
|
|
6
|
+
|
|
7
|
+
export type ButtonDropdownProps = WithLayoutType<{
|
|
8
|
+
button: Omit<ButtonFunctionProps, 'icon' | 'iconPosition' | 'appearance'>;
|
|
9
|
+
dropdown: Omit<AdaptiveDropdownProps, 'children' | 'layoutType' | 'placement'>;
|
|
10
|
+
}>;
|
|
11
|
+
|
|
12
|
+
export function ButtonDropdown({ layoutType, button, dropdown }: ButtonDropdownProps) {
|
|
13
|
+
const [open, onOpenChange] = useValueControl<boolean>({ onChange: dropdown.onOpenChange, value: dropdown.open });
|
|
14
|
+
|
|
15
|
+
const Icon = open ? ChevronUpSVG : ChevronDownSVG;
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<AdaptiveDropdown {...dropdown} open={open} onOpenChange={onOpenChange} layoutType={layoutType}>
|
|
19
|
+
<ButtonFunction {...button} icon={<Icon />} iconPosition='after' appearance='neutral' />
|
|
20
|
+
</AdaptiveDropdown>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ButtonDropdown';
|