@cloud-ru/uikit-product-site-selector-platform-drop-list 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/LICENSE +201 -0
  3. package/README.md +24 -0
  4. package/dist/cjs/components/SelectorPlatformDropList/SelectorPlatformDropList.d.ts +19 -0
  5. package/dist/cjs/components/SelectorPlatformDropList/SelectorPlatformDropList.js +23 -0
  6. package/dist/cjs/components/SelectorPlatformDropList/index.d.ts +2 -0
  7. package/dist/cjs/components/SelectorPlatformDropList/index.js +5 -0
  8. package/dist/cjs/components/SelectorPlatformDropList/platforms.d.ts +5 -0
  9. package/dist/cjs/components/SelectorPlatformDropList/platforms.js +30 -0
  10. package/dist/cjs/components/index.d.ts +1 -0
  11. package/dist/cjs/components/index.js +17 -0
  12. package/dist/cjs/helperComponents/BaseIcon/BaseIcon.d.ts +8 -0
  13. package/dist/cjs/helperComponents/BaseIcon/BaseIcon.js +14 -0
  14. package/dist/cjs/helperComponents/BaseIcon/index.d.ts +1 -0
  15. package/dist/cjs/helperComponents/BaseIcon/index.js +5 -0
  16. package/dist/cjs/helperComponents/ContentItemList/ContentItemList.d.ts +5 -0
  17. package/dist/cjs/helperComponents/ContentItemList/ContentItemList.js +12 -0
  18. package/dist/cjs/helperComponents/ContentItemList/index.d.ts +1 -0
  19. package/dist/cjs/helperComponents/ContentItemList/index.js +5 -0
  20. package/dist/cjs/helperComponents/ContentItemList/styles.module.css +5 -0
  21. package/dist/cjs/helperComponents/IconItemList/IconItemList.d.ts +6 -0
  22. package/dist/cjs/helperComponents/IconItemList/IconItemList.js +11 -0
  23. package/dist/cjs/helperComponents/IconItemList/index.d.ts +1 -0
  24. package/dist/cjs/helperComponents/IconItemList/index.js +5 -0
  25. package/dist/cjs/helperComponents/IconItemList/styles.module.css +12 -0
  26. package/dist/cjs/helperComponents/SelectedItemList/SelectedItemList.d.ts +8 -0
  27. package/dist/cjs/helperComponents/SelectedItemList/SelectedItemList.js +19 -0
  28. package/dist/cjs/helperComponents/SelectedItemList/index.d.ts +1 -0
  29. package/dist/cjs/helperComponents/SelectedItemList/index.js +5 -0
  30. package/dist/cjs/helperComponents/SelectedItemList/styles.module.css +32 -0
  31. package/dist/cjs/helperComponents/SelectorPlatformDropListPrivate/SelectorPlatformDropListPrivate.d.ts +18 -0
  32. package/dist/cjs/helperComponents/SelectorPlatformDropListPrivate/SelectorPlatformDropListPrivate.js +44 -0
  33. package/dist/cjs/helperComponents/SelectorPlatformDropListPrivate/index.d.ts +2 -0
  34. package/dist/cjs/helperComponents/SelectorPlatformDropListPrivate/index.js +5 -0
  35. package/dist/cjs/helperComponents/SelectorPlatformDropListPrivate/styles.module.css +54 -0
  36. package/dist/cjs/helperComponents/SelectorPlatformDropListPrivate/utils.d.ts +2 -0
  37. package/dist/cjs/helperComponents/SelectorPlatformDropListPrivate/utils.js +15 -0
  38. package/dist/cjs/helperComponents/TitleWithGoBack/TitleWithGoBack.d.ts +7 -0
  39. package/dist/cjs/helperComponents/TitleWithGoBack/TitleWithGoBack.js +13 -0
  40. package/dist/cjs/helperComponents/TitleWithGoBack/index.d.ts +1 -0
  41. package/dist/cjs/helperComponents/TitleWithGoBack/index.js +5 -0
  42. package/dist/cjs/helperComponents/TitleWithGoBack/styles.module.css +17 -0
  43. package/dist/cjs/helperComponents/Tooltip/Tooltip.d.ts +9 -0
  44. package/dist/cjs/helperComponents/Tooltip/Tooltip.js +26 -0
  45. package/dist/cjs/helperComponents/Tooltip/index.d.ts +1 -0
  46. package/dist/cjs/helperComponents/Tooltip/index.js +5 -0
  47. package/dist/cjs/helperComponents/Tooltip/styles.module.css +8 -0
  48. package/dist/cjs/helperComponents/index.d.ts +7 -0
  49. package/dist/cjs/helperComponents/index.js +17 -0
  50. package/dist/cjs/index.d.ts +1 -0
  51. package/dist/cjs/index.js +17 -0
  52. package/dist/cjs/types.d.ts +32 -0
  53. package/dist/cjs/types.js +2 -0
  54. package/dist/esm/components/SelectorPlatformDropList/SelectorPlatformDropList.d.ts +19 -0
  55. package/dist/esm/components/SelectorPlatformDropList/SelectorPlatformDropList.js +20 -0
  56. package/dist/esm/components/SelectorPlatformDropList/index.d.ts +2 -0
  57. package/dist/esm/components/SelectorPlatformDropList/index.js +1 -0
  58. package/dist/esm/components/SelectorPlatformDropList/platforms.d.ts +5 -0
  59. package/dist/esm/components/SelectorPlatformDropList/platforms.js +27 -0
  60. package/dist/esm/components/index.d.ts +1 -0
  61. package/dist/esm/components/index.js +1 -0
  62. package/dist/esm/helperComponents/BaseIcon/BaseIcon.d.ts +8 -0
  63. package/dist/esm/helperComponents/BaseIcon/BaseIcon.js +11 -0
  64. package/dist/esm/helperComponents/BaseIcon/index.d.ts +1 -0
  65. package/dist/esm/helperComponents/BaseIcon/index.js +1 -0
  66. package/dist/esm/helperComponents/ContentItemList/ContentItemList.d.ts +5 -0
  67. package/dist/esm/helperComponents/ContentItemList/ContentItemList.js +6 -0
  68. package/dist/esm/helperComponents/ContentItemList/index.d.ts +1 -0
  69. package/dist/esm/helperComponents/ContentItemList/index.js +1 -0
  70. package/dist/esm/helperComponents/ContentItemList/styles.module.css +5 -0
  71. package/dist/esm/helperComponents/IconItemList/IconItemList.d.ts +6 -0
  72. package/dist/esm/helperComponents/IconItemList/IconItemList.js +5 -0
  73. package/dist/esm/helperComponents/IconItemList/index.d.ts +1 -0
  74. package/dist/esm/helperComponents/IconItemList/index.js +1 -0
  75. package/dist/esm/helperComponents/IconItemList/styles.module.css +12 -0
  76. package/dist/esm/helperComponents/SelectedItemList/SelectedItemList.d.ts +8 -0
  77. package/dist/esm/helperComponents/SelectedItemList/SelectedItemList.js +13 -0
  78. package/dist/esm/helperComponents/SelectedItemList/index.d.ts +1 -0
  79. package/dist/esm/helperComponents/SelectedItemList/index.js +1 -0
  80. package/dist/esm/helperComponents/SelectedItemList/styles.module.css +32 -0
  81. package/dist/esm/helperComponents/SelectorPlatformDropListPrivate/SelectorPlatformDropListPrivate.d.ts +18 -0
  82. package/dist/esm/helperComponents/SelectorPlatformDropListPrivate/SelectorPlatformDropListPrivate.js +38 -0
  83. package/dist/esm/helperComponents/SelectorPlatformDropListPrivate/index.d.ts +2 -0
  84. package/dist/esm/helperComponents/SelectorPlatformDropListPrivate/index.js +1 -0
  85. package/dist/esm/helperComponents/SelectorPlatformDropListPrivate/styles.module.css +54 -0
  86. package/dist/esm/helperComponents/SelectorPlatformDropListPrivate/utils.d.ts +2 -0
  87. package/dist/esm/helperComponents/SelectorPlatformDropListPrivate/utils.js +12 -0
  88. package/dist/esm/helperComponents/TitleWithGoBack/TitleWithGoBack.d.ts +7 -0
  89. package/dist/esm/helperComponents/TitleWithGoBack/TitleWithGoBack.js +7 -0
  90. package/dist/esm/helperComponents/TitleWithGoBack/index.d.ts +1 -0
  91. package/dist/esm/helperComponents/TitleWithGoBack/index.js +1 -0
  92. package/dist/esm/helperComponents/TitleWithGoBack/styles.module.css +17 -0
  93. package/dist/esm/helperComponents/Tooltip/Tooltip.d.ts +9 -0
  94. package/dist/esm/helperComponents/Tooltip/Tooltip.js +20 -0
  95. package/dist/esm/helperComponents/Tooltip/index.d.ts +1 -0
  96. package/dist/esm/helperComponents/Tooltip/index.js +1 -0
  97. package/dist/esm/helperComponents/Tooltip/styles.module.css +8 -0
  98. package/dist/esm/helperComponents/index.d.ts +7 -0
  99. package/dist/esm/helperComponents/index.js +7 -0
  100. package/dist/esm/index.d.ts +1 -0
  101. package/dist/esm/index.js +1 -0
  102. package/dist/esm/types.d.ts +32 -0
  103. package/dist/esm/types.js +1 -0
  104. package/package.json +48 -0
  105. package/src/components/SelectorPlatformDropList/SelectorPlatformDropList.tsx +69 -0
  106. package/src/components/SelectorPlatformDropList/index.ts +2 -0
  107. package/src/components/SelectorPlatformDropList/platforms.ts +35 -0
  108. package/src/components/index.ts +1 -0
  109. package/src/helperComponents/BaseIcon/BaseIcon.tsx +20 -0
  110. package/src/helperComponents/BaseIcon/index.ts +1 -0
  111. package/src/helperComponents/ContentItemList/ContentItemList.tsx +15 -0
  112. package/src/helperComponents/ContentItemList/index.ts +1 -0
  113. package/src/helperComponents/ContentItemList/styles.module.scss +5 -0
  114. package/src/helperComponents/IconItemList/IconItemList.tsx +14 -0
  115. package/src/helperComponents/IconItemList/index.ts +1 -0
  116. package/src/helperComponents/IconItemList/styles.module.scss +14 -0
  117. package/src/helperComponents/SelectedItemList/SelectedItemList.tsx +33 -0
  118. package/src/helperComponents/SelectedItemList/index.ts +1 -0
  119. package/src/helperComponents/SelectedItemList/styles.module.scss +35 -0
  120. package/src/helperComponents/SelectorPlatformDropListPrivate/SelectorPlatformDropListPrivate.tsx +132 -0
  121. package/src/helperComponents/SelectorPlatformDropListPrivate/index.ts +2 -0
  122. package/src/helperComponents/SelectorPlatformDropListPrivate/styles.module.scss +59 -0
  123. package/src/helperComponents/SelectorPlatformDropListPrivate/utils.ts +15 -0
  124. package/src/helperComponents/TitleWithGoBack/TitleWithGoBack.tsx +21 -0
  125. package/src/helperComponents/TitleWithGoBack/index.ts +1 -0
  126. package/src/helperComponents/TitleWithGoBack/styles.module.scss +21 -0
  127. package/src/helperComponents/Tooltip/Tooltip.tsx +33 -0
  128. package/src/helperComponents/Tooltip/index.ts +1 -0
  129. package/src/helperComponents/Tooltip/styles.module.scss +10 -0
  130. package/src/helperComponents/index.ts +7 -0
  131. package/src/index.ts +1 -0
  132. package/src/types.ts +37 -0
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SelectorPlatformDropListPrivate = SelectorPlatformDropListPrivate;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_1 = require("react");
9
+ const uikit_product_icons_1 = require("@cloud-ru/uikit-product-icons");
10
+ const uikit_product_mobile_dropdown_1 = require("@cloud-ru/uikit-product-mobile-dropdown");
11
+ const uikit_product_mobile_modal_1 = require("@cloud-ru/uikit-product-mobile-modal");
12
+ const typography_1 = require("@snack-uikit/typography");
13
+ const helperComponents_1 = require("../../helperComponents");
14
+ const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
15
+ const utils_1 = require("./utils");
16
+ function SelectorPlatformDropListPrivate({ items, value, onChange, footer, title, baseTitle, baseIcon, layoutType, mode, }) {
17
+ const [isOpen, setIsOpen] = (0, react_1.useState)(false);
18
+ const [tooltipMobile, setTooltipMobile] = (0, react_1.useState)({
19
+ open: false,
20
+ });
21
+ const handleCloseTooltipMobile = () => {
22
+ setTooltipMobile({
23
+ open: false,
24
+ });
25
+ };
26
+ const itemsView = (0, react_1.useMemo)(() => items.map(item => ({
27
+ id: item.id,
28
+ content: (0, jsx_runtime_1.jsx)(helperComponents_1.ContentItemList, { title: item.title }),
29
+ beforeContent: (0, jsx_runtime_1.jsx)(helperComponents_1.IconItemList, { icon: item.icon }),
30
+ afterContent: ((0, jsx_runtime_1.jsx)(helperComponents_1.Tooltip, { setTooltipMobile: setTooltipMobile, tooltipText: item.tooltipText, layoutType: layoutType })),
31
+ className: styles_module_scss_1.default.rowItem,
32
+ onClick: item.onClick,
33
+ })), [items, layoutType]);
34
+ const itemsWithDivider = (0, react_1.useMemo)(() => [...itemsView, { type: 'group', divider: true, items: [] }], [itemsView]);
35
+ const selection = (0, react_1.useMemo)(() => mode === 'multiple'
36
+ ? { value, onChange, mode: 'multiple' }
37
+ : { value, onChange, mode: 'single' }, [mode, onChange, value]);
38
+ const foundItems = (0, react_1.useMemo)(() => (0, utils_1.findItems)(items, value), [items, value]);
39
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(uikit_product_mobile_dropdown_1.AdaptiveDroplist
40
+ // @ts-expect-error label существует только у MobileDroplist, отсутствует у Droplist
41
+ , {
42
+ // @ts-expect-error label существует только у MobileDroplist, отсутствует у Droplist
43
+ label: (0, jsx_runtime_1.jsx)(helperComponents_1.TitleWithGoBack, { title: '\u041E\u0431\u043B\u0430\u0447\u043D\u0430\u044F \u043F\u043B\u0430\u0442\u0444\u043E\u0440\u043C\u0430' }), layoutType: layoutType, trigger: 'click', open: isOpen, items: footer ? itemsWithDivider : itemsView, onOpenChange: setIsOpen, selection: selection, footer: footer, closeDroplistOnItemClick: true, size: 'm', children: (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.root, "data-focus": isOpen, role: 'button', children: [(0, jsx_runtime_1.jsx)(helperComponents_1.BaseIcon, { baseIcon: baseIcon, value: foundItems, lengthDroplist: items.length }), (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.titleContainer, children: [(0, jsx_runtime_1.jsx)(typography_1.Typography, { className: styles_module_scss_1.default.valueLabel, family: 'sans', purpose: 'body', size: 's', children: title }), (0, jsx_runtime_1.jsx)(helperComponents_1.SelectedItemList, { lengthDroplist: items.length, baseTitle: baseTitle, value: foundItems })] }), (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.iconContainer, children: isOpen ? (0, jsx_runtime_1.jsx)(uikit_product_icons_1.ChevronUpSVG, { className: styles_module_scss_1.default.icon }) : (0, jsx_runtime_1.jsx)(uikit_product_icons_1.ChevronDownSVG, { className: styles_module_scss_1.default.icon }) })] }) }), (0, jsx_runtime_1.jsxs)(uikit_product_mobile_modal_1.MobileModalCustom, { open: tooltipMobile.open, onClose: handleCloseTooltipMobile, children: [(0, jsx_runtime_1.jsx)(uikit_product_mobile_modal_1.MobileModalCustom.Header, { title: (0, jsx_runtime_1.jsx)(helperComponents_1.TitleWithGoBack, { onGoBack: handleCloseTooltipMobile, title: '\u041E\u0431\u043B\u0430\u0447\u043D\u0430\u044F \u043F\u043B\u0430\u0442\u0444\u043E\u0440\u043C\u0430' }) }), (0, jsx_runtime_1.jsx)(uikit_product_mobile_modal_1.MobileModalCustom.Body, { content: (0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyL, { children: tooltipMobile.text }) })] })] }));
44
+ }
@@ -0,0 +1,2 @@
1
+ export { SelectorPlatformDropListPrivate } from './SelectorPlatformDropListPrivate';
2
+ export type { SelectorPlatformDropListPrivateProps } from './SelectorPlatformDropListPrivate';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SelectorPlatformDropListPrivate = void 0;
4
+ var SelectorPlatformDropListPrivate_1 = require("./SelectorPlatformDropListPrivate");
5
+ Object.defineProperty(exports, "SelectorPlatformDropListPrivate", { enumerable: true, get: function () { return SelectorPlatformDropListPrivate_1.SelectorPlatformDropListPrivate; } });
@@ -0,0 +1,54 @@
1
+ .root{
2
+ cursor:pointer;
3
+ display:flex;
4
+ align-items:center;
5
+ gap:8px;
6
+ height:48px;
7
+ padding:4px 12px 4px 8px;
8
+ background-color:var(--sys-neutral-background1-level, #fdfdfd);
9
+ border:1px solid var(--sys-neutral-decor-default, #dde0ea);
10
+ box-sizing:border-box;
11
+ }
12
+ .root:hover{
13
+ border-color:var(--sys-neutral-decor-hovered, #cfd2dc);
14
+ }
15
+ .root[data-focus=true]{
16
+ outline-width:var(--border-state-focus-m-border-width, 3px);
17
+ outline-style:var(--border-state-focus-m-border-style, solid);
18
+ outline-color:var(--border-state-focus-m-border-color, );
19
+ background-color:var(--sys-neutral-background2-level, #ffffff);
20
+ border-color:var(--sys-primary-accent-default, #26d07c);
21
+ outline-color:var(--sys-primary-decor-activated, #8ee7bb);
22
+ }
23
+
24
+ .titleContainer{
25
+ display:flex;
26
+ flex-direction:column;
27
+ justify-content:space-between;
28
+ height:36px;
29
+ width:100%;
30
+ flex:1 1 auto;
31
+ min-width:0;
32
+ }
33
+
34
+ .iconContainer{
35
+ width:24px;
36
+ height:24px;
37
+ }
38
+
39
+ .valueLabel{
40
+ cursor:pointer;
41
+ color:var(--sys-neutral-text-light, #8b8e9b);
42
+ }
43
+
44
+ .valueTitle{
45
+ color:var(--sys-neutral-text-main, #41424e);
46
+ }
47
+
48
+ .icon{
49
+ color:var(--sys-graphite-text-main, #222222);
50
+ }
51
+
52
+ .rowItem{
53
+ box-sizing:border-box;
54
+ }
@@ -0,0 +1,2 @@
1
+ import { Item } from '../../types';
2
+ export declare function findItems(items: Array<Item>, value: Array<string> | string | undefined): Item[];
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findItems = findItems;
4
+ function findItems(items, value) {
5
+ if (!value)
6
+ return [];
7
+ if (typeof value === 'string') {
8
+ const foundItem = items.find(item => item.id === value);
9
+ if (!foundItem) {
10
+ return [];
11
+ }
12
+ return [foundItem];
13
+ }
14
+ return items.filter(item => value.find(val => val === item.id));
15
+ }
@@ -0,0 +1,7 @@
1
+ import { MouseEventHandler, ReactNode } from 'react';
2
+ type TitleWithGoBackProps = {
3
+ title: ReactNode;
4
+ onGoBack?: MouseEventHandler<SVGElement>;
5
+ };
6
+ export declare function TitleWithGoBack({ onGoBack, title }: TitleWithGoBackProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.TitleWithGoBack = TitleWithGoBack;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const uikit_product_icons_1 = require("@cloud-ru/uikit-product-icons");
9
+ const typography_1 = require("@snack-uikit/typography");
10
+ const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
11
+ function TitleWithGoBack({ onGoBack, title }) {
12
+ return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.wrapper, "data-icon-back": Boolean(onGoBack), children: [onGoBack && (0, jsx_runtime_1.jsx)(uikit_product_icons_1.ArrowLeftSVG, { size: 24, className: styles_module_scss_1.default.arrow, onClick: onGoBack }), (0, jsx_runtime_1.jsx)(typography_1.Typography.SansTitleL, { children: title }), onGoBack && (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.buttonStub })] }));
13
+ }
@@ -0,0 +1 @@
1
+ export { TitleWithGoBack } from './TitleWithGoBack';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TitleWithGoBack = void 0;
4
+ var TitleWithGoBack_1 = require("./TitleWithGoBack");
5
+ Object.defineProperty(exports, "TitleWithGoBack", { enumerable: true, get: function () { return TitleWithGoBack_1.TitleWithGoBack; } });
@@ -0,0 +1,17 @@
1
+ .wrapper{
2
+ display:flex;
3
+ align-items:center;
4
+ justify-content:space-between;
5
+ width:calc(100vw - 32px);
6
+ }
7
+ .wrapper[data-icon-back=false]{
8
+ justify-content:center;
9
+ }
10
+
11
+ .arrow{
12
+ color:var(--sys-neutral-text-light, #8b8e9b);
13
+ }
14
+
15
+ .buttonStub{
16
+ width:24px;
17
+ }
@@ -0,0 +1,9 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ import { WithLayoutType } from '@cloud-ru/uikit-product-utils';
3
+ import { TooltipMobile } from '../../types';
4
+ type TooltipProps = WithLayoutType<{
5
+ tooltipText?: string;
6
+ setTooltipMobile: Dispatch<SetStateAction<TooltipMobile>>;
7
+ }>;
8
+ export declare function Tooltip({ layoutType, tooltipText, setTooltipMobile }: TooltipProps): import("react/jsx-runtime").JSX.Element | null;
9
+ export {};
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Tooltip = Tooltip;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const uikit_product_icons_1 = require("@cloud-ru/uikit-product-icons");
9
+ const tooltip_1 = require("@snack-uikit/tooltip");
10
+ const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
11
+ function Tooltip({ layoutType, tooltipText, setTooltipMobile }) {
12
+ if (!tooltipText) {
13
+ return null;
14
+ }
15
+ if (layoutType !== 'mobile') {
16
+ return (0, jsx_runtime_1.jsx)(tooltip_1.QuestionTooltip, { className: styles_module_scss_1.default.questionTooltip, tip: tooltipText });
17
+ }
18
+ const handleOpen = (event) => {
19
+ event.stopPropagation();
20
+ setTooltipMobile({
21
+ open: true,
22
+ text: tooltipText,
23
+ });
24
+ };
25
+ return (0, jsx_runtime_1.jsx)(uikit_product_icons_1.QuestionSVG, { className: styles_module_scss_1.default.icon, onClick: handleOpen, size: 16 });
26
+ }
@@ -0,0 +1 @@
1
+ export { Tooltip } from './Tooltip';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Tooltip = void 0;
4
+ var Tooltip_1 = require("./Tooltip");
5
+ Object.defineProperty(exports, "Tooltip", { enumerable: true, get: function () { return Tooltip_1.Tooltip; } });
@@ -0,0 +1,8 @@
1
+ .questionTooltip{
2
+ margin:auto 0;
3
+ }
4
+
5
+ .icon{
6
+ color:var(--sys-neutral-text-light, #8b8e9b);
7
+ margin:auto 0;
8
+ }
@@ -0,0 +1,7 @@
1
+ export { SelectedItemList } from './SelectedItemList';
2
+ export { ContentItemList } from './ContentItemList';
3
+ export { IconItemList } from './IconItemList';
4
+ export { BaseIcon } from './BaseIcon';
5
+ export { TitleWithGoBack } from './TitleWithGoBack';
6
+ export { Tooltip } from './Tooltip';
7
+ export { SelectorPlatformDropListPrivate } from './SelectorPlatformDropListPrivate';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SelectorPlatformDropListPrivate = exports.Tooltip = exports.TitleWithGoBack = exports.BaseIcon = exports.IconItemList = exports.ContentItemList = exports.SelectedItemList = void 0;
4
+ var SelectedItemList_1 = require("./SelectedItemList");
5
+ Object.defineProperty(exports, "SelectedItemList", { enumerable: true, get: function () { return SelectedItemList_1.SelectedItemList; } });
6
+ var ContentItemList_1 = require("./ContentItemList");
7
+ Object.defineProperty(exports, "ContentItemList", { enumerable: true, get: function () { return ContentItemList_1.ContentItemList; } });
8
+ var IconItemList_1 = require("./IconItemList");
9
+ Object.defineProperty(exports, "IconItemList", { enumerable: true, get: function () { return IconItemList_1.IconItemList; } });
10
+ var BaseIcon_1 = require("./BaseIcon");
11
+ Object.defineProperty(exports, "BaseIcon", { enumerable: true, get: function () { return BaseIcon_1.BaseIcon; } });
12
+ var TitleWithGoBack_1 = require("./TitleWithGoBack");
13
+ Object.defineProperty(exports, "TitleWithGoBack", { enumerable: true, get: function () { return TitleWithGoBack_1.TitleWithGoBack; } });
14
+ var Tooltip_1 = require("./Tooltip");
15
+ Object.defineProperty(exports, "Tooltip", { enumerable: true, get: function () { return Tooltip_1.Tooltip; } });
16
+ var SelectorPlatformDropListPrivate_1 = require("./SelectorPlatformDropListPrivate");
17
+ Object.defineProperty(exports, "SelectorPlatformDropListPrivate", { enumerable: true, get: function () { return SelectorPlatformDropListPrivate_1.SelectorPlatformDropListPrivate; } });
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./components"), exports);
@@ -0,0 +1,32 @@
1
+ import { JSXElementConstructor } from 'react';
2
+ export type IconSelector = JSXElementConstructor<{
3
+ size?: number;
4
+ className?: string;
5
+ }>;
6
+ export type Item = {
7
+ id: string;
8
+ title: string;
9
+ icon: IconSelector;
10
+ onClick?: () => void;
11
+ tooltipText?: string;
12
+ };
13
+ export type TooltipMobile = {
14
+ open: boolean;
15
+ text?: string;
16
+ };
17
+ export type MultipleSelectorPlatformDropListProps = {
18
+ /** Режим выбора */
19
+ mode: 'multiple';
20
+ /** Controlled состояние */
21
+ value: Array<string>;
22
+ /** Controlled обработчик изменения состояния */
23
+ onChange(value: Array<string>): void;
24
+ };
25
+ export type SingleSelectorPlatformDropListProps = {
26
+ /** Режим выбора */
27
+ mode: 'single';
28
+ /** Controlled состояние */
29
+ value: string | undefined;
30
+ /** Controlled обработчик изменения состояния */
31
+ onChange(value: string | undefined): void;
32
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,19 @@
1
+ import { ReactNode } from 'react';
2
+ import { WithLayoutType } from '@cloud-ru/uikit-product-utils';
3
+ import { MultipleSelectorPlatformDropListProps, SingleSelectorPlatformDropListProps } from '../../types';
4
+ export type PlatformType = 'advanced' | 'evolution' | 'vmware' | 'all';
5
+ export type Platform = {
6
+ /** Тип элемента */
7
+ type: PlatformType;
8
+ /** Колбек клика на элемент */
9
+ onClick?: () => void;
10
+ };
11
+ type BaseSelectorPlatformDropListProps = WithLayoutType<{
12
+ /** Список элементов droplist */
13
+ items: Array<Platform>;
14
+ /** Нижняя часть под списком droplist */
15
+ footer?: ReactNode;
16
+ }>;
17
+ export type SelectorPlatformDropListProps = BaseSelectorPlatformDropListProps & (MultipleSelectorPlatformDropListProps | SingleSelectorPlatformDropListProps);
18
+ export declare function SelectorPlatformDropList({ items, value, footer, onChange, layoutType, mode, }: SelectorPlatformDropListProps): import("react/jsx-runtime").JSX.Element;
19
+ export {};
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useMemo } from 'react';
3
+ import { CloudSVG } from '@cloud-ru/uikit-product-icons';
4
+ import { SelectorPlatformDropListPrivate } from '../../helperComponents';
5
+ import { PLATFORMS } from './platforms';
6
+ export function SelectorPlatformDropList({ items, value, footer, onChange, layoutType, mode, }) {
7
+ const selection = useMemo(() => mode === 'multiple'
8
+ ? {
9
+ value,
10
+ onChange,
11
+ mode: 'multiple',
12
+ }
13
+ : {
14
+ value,
15
+ onChange,
16
+ mode: 'single',
17
+ }, [mode, value, onChange]);
18
+ const itemsView = useMemo(() => items.map(({ type, onClick }) => (Object.assign(Object.assign({}, PLATFORMS[type]), { onClick }))), [items]);
19
+ return (_jsx(SelectorPlatformDropListPrivate, Object.assign({ layoutType: layoutType === 'tablet' ? 'mobile' : layoutType, items: itemsView, title: 'Облачная платформа', baseTitle: 'Все платформы', baseIcon: CloudSVG, footer: footer }, selection)));
20
+ }
@@ -0,0 +1,2 @@
1
+ export { SelectorPlatformDropList } from './SelectorPlatformDropList';
2
+ export type { SelectorPlatformDropListProps, PlatformType, Platform } from './SelectorPlatformDropList';
@@ -0,0 +1 @@
1
+ export { SelectorPlatformDropList } from './SelectorPlatformDropList';
@@ -0,0 +1,5 @@
1
+ import { Item } from '../../types';
2
+ import { PlatformType } from './SelectorPlatformDropList';
3
+ export declare const PLATFORMS: {
4
+ [key in PlatformType]: Item;
5
+ };
@@ -0,0 +1,27 @@
1
+ import { AdvancedSVG, CloudSVG, EvolutionSVG, VMwareBackupServerSVG } from '@cloud-ru/uikit-product-icons';
2
+ export const PLATFORMS = {
3
+ evolution: {
4
+ id: 'evolution',
5
+ title: 'Evolution',
6
+ icon: EvolutionSVG,
7
+ tooltipText: 'Платформа собственной разработки с доступом к IaaS- и PaaS-сервисам, вычислительным мощностям с GPU, аренде выделенных физических серверов и AI-инструментам.',
8
+ },
9
+ advanced: {
10
+ id: 'advanced',
11
+ title: 'Advanced',
12
+ icon: AdvancedSVG,
13
+ tooltipText: 'Вендорская платформа с широким набором IaaS- и PaaS-сервисов от одного из лидеров мирового рынка облачных услуг.',
14
+ },
15
+ vmware: {
16
+ id: 'vmware',
17
+ title: 'Облако VMware',
18
+ icon: VMwareBackupServerSVG,
19
+ tooltipText: 'Вендорская платформа, предоставляющая инфраструктуру как услугу, основанную на технологиях VMware — ведущего поставщика решений IaaS.',
20
+ },
21
+ all: {
22
+ id: 'all',
23
+ title: 'Все платформы',
24
+ icon: CloudSVG,
25
+ tooltipText: 'Совокупность сервисов, программных и/или аппаратных средств, решающих определенную задачу или группу задач.',
26
+ },
27
+ };
@@ -0,0 +1 @@
1
+ export * from './SelectorPlatformDropList';
@@ -0,0 +1 @@
1
+ export * from './SelectorPlatformDropList';
@@ -0,0 +1,8 @@
1
+ import { IconSelector, Item } from '../../types';
2
+ type BaseIconProps = {
3
+ baseIcon?: IconSelector;
4
+ value: Array<Item>;
5
+ lengthDroplist: number;
6
+ };
7
+ export declare function BaseIcon({ baseIcon, value, lengthDroplist }: BaseIconProps): import("react/jsx-runtime").JSX.Element | null;
8
+ export {};
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { IconItemList } from '../IconItemList';
3
+ export function BaseIcon({ baseIcon, value, lengthDroplist }) {
4
+ if (value.length === 1) {
5
+ return _jsx(IconItemList, { icon: value[0].icon });
6
+ }
7
+ if (!baseIcon || (value.length > 1 && lengthDroplist !== value.length)) {
8
+ return null;
9
+ }
10
+ return _jsx(IconItemList, { icon: baseIcon });
11
+ }
@@ -0,0 +1 @@
1
+ export { BaseIcon } from './BaseIcon';
@@ -0,0 +1 @@
1
+ export { BaseIcon } from './BaseIcon';
@@ -0,0 +1,5 @@
1
+ type ContentItemListProps = {
2
+ title: string;
3
+ };
4
+ export declare function ContentItemList({ title }: ContentItemListProps): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Typography } from '@snack-uikit/typography';
3
+ import styles from './styles.module.css';
4
+ export function ContentItemList({ title }) {
5
+ return (_jsx("div", { className: styles.container, children: _jsx(Typography.SansTitleS, { children: title }) }));
6
+ }
@@ -0,0 +1 @@
1
+ export { ContentItemList } from './ContentItemList';
@@ -0,0 +1 @@
1
+ export { ContentItemList } from './ContentItemList';
@@ -0,0 +1,5 @@
1
+ .container{
2
+ display:flex;
3
+ align-items:center;
4
+ min-height:24px;
5
+ }
@@ -0,0 +1,6 @@
1
+ import { IconSelector } from '../../types';
2
+ type IconItemListProps = {
3
+ icon: IconSelector;
4
+ };
5
+ export declare function IconItemList({ icon: IconComponent }: IconItemListProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import styles from './styles.module.css';
3
+ export function IconItemList({ icon: IconComponent }) {
4
+ return (_jsx("div", { className: styles.container, children: _jsx(IconComponent, { size: 24, className: styles.icon }) }));
5
+ }
@@ -0,0 +1 @@
1
+ export { IconItemList } from './IconItemList';
@@ -0,0 +1 @@
1
+ export { IconItemList } from './IconItemList';
@@ -0,0 +1,12 @@
1
+ .container{
2
+ display:flex;
3
+ align-items:center;
4
+ justify-content:center;
5
+ min-width:32px;
6
+ min-height:32px;
7
+ background:var(--sys-graphite-background, #f4f4f4);
8
+ }
9
+
10
+ .icon{
11
+ color:var(--sys-neutral-text-main, #41424e);
12
+ }
@@ -0,0 +1,8 @@
1
+ import { Item } from '../../types';
2
+ type SelectedItemListProps = {
3
+ baseTitle: string;
4
+ value: Array<Item>;
5
+ lengthDroplist: number;
6
+ };
7
+ export declare function SelectedItemList({ baseTitle, value, lengthDroplist }: SelectedItemListProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Typography } from '@snack-uikit/typography';
3
+ import styles from './styles.module.css';
4
+ export function SelectedItemList({ baseTitle, value, lengthDroplist }) {
5
+ var _a;
6
+ if (value.length === 0 || value.length === lengthDroplist) {
7
+ return _jsx(Typography.SansTitleS, { className: styles.text, children: baseTitle });
8
+ }
9
+ if (value.length === 1) {
10
+ return _jsx(Typography.SansTitleS, { className: styles.text, children: (_a = value[0]) === null || _a === void 0 ? void 0 : _a.title });
11
+ }
12
+ return (_jsx("div", { className: styles.container, children: value.map(({ title, icon: IconComponent }, index) => (_jsxs("div", { className: styles.item, children: [IconComponent && _jsx(IconComponent, { size: 12, className: styles.icon }), _jsx(Typography.SansLabelM, { className: styles.text, children: `${title}${index !== value.length - 1 ? ',' : ''}` })] }, title))) }));
13
+ }
@@ -0,0 +1 @@
1
+ export { SelectedItemList } from './SelectedItemList';
@@ -0,0 +1 @@
1
+ export { SelectedItemList } from './SelectedItemList';
@@ -0,0 +1,32 @@
1
+ .iconPlatform{
2
+ color:var(--sys-primary-text-light, #6aaf90);
3
+ }
4
+
5
+ .text{
6
+ color:var(--sys-neutral-text-main, #41424e);
7
+ }
8
+
9
+ .container{
10
+ display:flex;
11
+ gap:8px;
12
+ flex-wrap:nowrap;
13
+ align-items:center;
14
+ margin-bottom:2px;
15
+ width:100%;
16
+ flex:1 1 auto;
17
+ min-width:0;
18
+ white-space:nowrap;
19
+ overflow:hidden;
20
+ text-overflow:ellipsis;
21
+ }
22
+
23
+ .item{
24
+ display:flex;
25
+ gap:4px;
26
+ flex-wrap:nowrap;
27
+ align-items:center;
28
+ }
29
+
30
+ .icon{
31
+ color:var(--sys-primary-text-light, #6aaf90);
32
+ }
@@ -0,0 +1,18 @@
1
+ import { ReactNode } from 'react';
2
+ import { WithLayoutType } from '@cloud-ru/uikit-product-utils';
3
+ import { IconSelector, Item, MultipleSelectorPlatformDropListProps, SingleSelectorPlatformDropListProps } from '../../types';
4
+ type BaseSelectorPlatformDropListPrivateProps = WithLayoutType<{
5
+ /** Заголовок верхней части блока выбора */
6
+ title: string;
7
+ /** Базовый заголовок нижней части блока выбора, отображается когда ничего не выбрано */
8
+ baseTitle: string;
9
+ /** Базовая иконка блока выбора слева, отображается когда ничего не выбрано */
10
+ baseIcon?: IconSelector;
11
+ /** Список элементов droplist */
12
+ items: Array<Item>;
13
+ /** Нижняя часть под списком droplist */
14
+ footer?: ReactNode;
15
+ }>;
16
+ export type SelectorPlatformDropListPrivateProps = BaseSelectorPlatformDropListPrivateProps & (MultipleSelectorPlatformDropListProps | SingleSelectorPlatformDropListProps);
17
+ export declare function SelectorPlatformDropListPrivate({ items, value, onChange, footer, title, baseTitle, baseIcon, layoutType, mode, }: SelectorPlatformDropListPrivateProps): import("react/jsx-runtime").JSX.Element;
18
+ export {};