@cloud-ru/ds-uikit-product-quota 1.0.0

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 (183) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +201 -0
  3. package/README.md +458 -0
  4. package/dist/cjs/components/QuotaWidget/QuotaIncreaseButton.d.ts +4 -0
  5. package/dist/cjs/components/QuotaWidget/QuotaIncreaseButton.js +15 -0
  6. package/dist/cjs/components/QuotaWidget/QuotaMobileHeader.d.ts +4 -0
  7. package/dist/cjs/components/QuotaWidget/QuotaMobileHeader.js +15 -0
  8. package/dist/cjs/components/QuotaWidget/QuotaWidget.d.ts +12 -0
  9. package/dist/cjs/components/QuotaWidget/QuotaWidget.js +44 -0
  10. package/dist/cjs/components/QuotaWidget/QuotaWidgetContent.d.ts +27 -0
  11. package/dist/cjs/components/QuotaWidget/QuotaWidgetContent.js +33 -0
  12. package/dist/cjs/components/QuotaWidget/components/ProjectHeader/ProjectHeader.d.ts +7 -0
  13. package/dist/cjs/components/QuotaWidget/components/ProjectHeader/ProjectHeader.js +19 -0
  14. package/dist/cjs/components/QuotaWidget/components/ProjectHeader/index.d.ts +1 -0
  15. package/dist/cjs/components/QuotaWidget/components/ProjectHeader/index.js +17 -0
  16. package/dist/cjs/components/QuotaWidget/components/ProjectHeader/styles.module.css +30 -0
  17. package/dist/cjs/components/QuotaWidget/index.d.ts +2 -0
  18. package/dist/cjs/components/QuotaWidget/index.js +18 -0
  19. package/dist/cjs/components/QuotaWidget/styles.module.css +49 -0
  20. package/dist/cjs/components/QuotaWidgetCard/QuotaWidgetCard.d.ts +13 -0
  21. package/dist/cjs/components/QuotaWidgetCard/QuotaWidgetCard.js +53 -0
  22. package/dist/cjs/components/QuotaWidgetCard/components/QuotaTooltip/QuotaTooltip.d.ts +6 -0
  23. package/dist/cjs/components/QuotaWidgetCard/components/QuotaTooltip/QuotaTooltip.js +23 -0
  24. package/dist/cjs/components/QuotaWidgetCard/components/QuotaTooltip/index.d.ts +1 -0
  25. package/dist/cjs/components/QuotaWidgetCard/components/QuotaTooltip/index.js +17 -0
  26. package/dist/cjs/components/QuotaWidgetCard/components/QuotaTooltip/styles.module.css +34 -0
  27. package/dist/cjs/components/QuotaWidgetCard/index.d.ts +1 -0
  28. package/dist/cjs/components/QuotaWidgetCard/index.js +17 -0
  29. package/dist/cjs/components/QuotaWidgetCard/styles.module.css +97 -0
  30. package/dist/cjs/components/QuotaWidgetMini/QuotaWidgetMini.d.ts +7 -0
  31. package/dist/cjs/components/QuotaWidgetMini/QuotaWidgetMini.js +27 -0
  32. package/dist/cjs/components/QuotaWidgetMini/index.d.ts +1 -0
  33. package/dist/cjs/components/QuotaWidgetMini/index.js +17 -0
  34. package/dist/cjs/components/QuotaWidgetMini/styles.module.css +15 -0
  35. package/dist/cjs/components/index.d.ts +3 -0
  36. package/dist/cjs/components/index.js +19 -0
  37. package/dist/cjs/constants.d.ts +17 -0
  38. package/dist/cjs/constants.js +20 -0
  39. package/dist/cjs/helperComponents/QuotaCardsGrid/QuotaCardsGrid.d.ts +6 -0
  40. package/dist/cjs/helperComponents/QuotaCardsGrid/QuotaCardsGrid.js +32 -0
  41. package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/Grid.d.ts +6 -0
  42. package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/Grid.js +30 -0
  43. package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/QuotaCardsSkeleton.d.ts +6 -0
  44. package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/QuotaCardsSkeleton.js +16 -0
  45. package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/index.d.ts +1 -0
  46. package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/index.js +17 -0
  47. package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/styles.module.css +10 -0
  48. package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/index.d.ts +1 -0
  49. package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/index.js +17 -0
  50. package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/styles.module.css +9 -0
  51. package/dist/cjs/helperComponents/QuotaCardsGrid/components/QuotaError/QuotaError.d.ts +5 -0
  52. package/dist/cjs/helperComponents/QuotaCardsGrid/components/QuotaError/QuotaError.js +12 -0
  53. package/dist/cjs/helperComponents/QuotaCardsGrid/components/QuotaError/index.d.ts +1 -0
  54. package/dist/cjs/helperComponents/QuotaCardsGrid/components/QuotaError/index.js +17 -0
  55. package/dist/cjs/helperComponents/QuotaCardsGrid/index.d.ts +1 -0
  56. package/dist/cjs/helperComponents/QuotaCardsGrid/index.js +17 -0
  57. package/dist/cjs/helperComponents/QuotaCardsGrid/styles.module.css +16 -0
  58. package/dist/cjs/index.d.ts +5 -0
  59. package/dist/cjs/index.js +21 -0
  60. package/dist/cjs/locale/index.d.ts +91 -0
  61. package/dist/cjs/locale/index.js +50 -0
  62. package/dist/cjs/package.json +3 -0
  63. package/dist/cjs/style.css +260 -0
  64. package/dist/cjs/types.d.ts +34 -0
  65. package/dist/cjs/types.js +2 -0
  66. package/dist/cjs/utils/checkIsExceeded.d.ts +2 -0
  67. package/dist/cjs/utils/checkIsExceeded.js +5 -0
  68. package/dist/cjs/utils/formatNumber.d.ts +1 -0
  69. package/dist/cjs/utils/formatNumber.js +6 -0
  70. package/dist/cjs/utils/getPercent.d.ts +2 -0
  71. package/dist/cjs/utils/getPercent.js +9 -0
  72. package/dist/cjs/utils/index.d.ts +3 -0
  73. package/dist/cjs/utils/index.js +19 -0
  74. package/dist/esm/components/QuotaWidget/QuotaIncreaseButton.d.ts +4 -0
  75. package/dist/esm/components/QuotaWidget/QuotaIncreaseButton.js +9 -0
  76. package/dist/esm/components/QuotaWidget/QuotaMobileHeader.d.ts +4 -0
  77. package/dist/esm/components/QuotaWidget/QuotaMobileHeader.js +9 -0
  78. package/dist/esm/components/QuotaWidget/QuotaWidget.d.ts +12 -0
  79. package/dist/esm/components/QuotaWidget/QuotaWidget.js +41 -0
  80. package/dist/esm/components/QuotaWidget/QuotaWidgetContent.d.ts +27 -0
  81. package/dist/esm/components/QuotaWidget/QuotaWidgetContent.js +27 -0
  82. package/dist/esm/components/QuotaWidget/components/ProjectHeader/ProjectHeader.d.ts +7 -0
  83. package/dist/esm/components/QuotaWidget/components/ProjectHeader/ProjectHeader.js +13 -0
  84. package/dist/esm/components/QuotaWidget/components/ProjectHeader/index.d.ts +1 -0
  85. package/dist/esm/components/QuotaWidget/components/ProjectHeader/index.js +1 -0
  86. package/dist/esm/components/QuotaWidget/components/ProjectHeader/styles.module.css +30 -0
  87. package/dist/esm/components/QuotaWidget/index.d.ts +2 -0
  88. package/dist/esm/components/QuotaWidget/index.js +2 -0
  89. package/dist/esm/components/QuotaWidget/styles.module.css +49 -0
  90. package/dist/esm/components/QuotaWidgetCard/QuotaWidgetCard.d.ts +13 -0
  91. package/dist/esm/components/QuotaWidgetCard/QuotaWidgetCard.js +47 -0
  92. package/dist/esm/components/QuotaWidgetCard/components/QuotaTooltip/QuotaTooltip.d.ts +6 -0
  93. package/dist/esm/components/QuotaWidgetCard/components/QuotaTooltip/QuotaTooltip.js +17 -0
  94. package/dist/esm/components/QuotaWidgetCard/components/QuotaTooltip/index.d.ts +1 -0
  95. package/dist/esm/components/QuotaWidgetCard/components/QuotaTooltip/index.js +1 -0
  96. package/dist/esm/components/QuotaWidgetCard/components/QuotaTooltip/styles.module.css +34 -0
  97. package/dist/esm/components/QuotaWidgetCard/index.d.ts +1 -0
  98. package/dist/esm/components/QuotaWidgetCard/index.js +1 -0
  99. package/dist/esm/components/QuotaWidgetCard/styles.module.css +97 -0
  100. package/dist/esm/components/QuotaWidgetMini/QuotaWidgetMini.d.ts +7 -0
  101. package/dist/esm/components/QuotaWidgetMini/QuotaWidgetMini.js +21 -0
  102. package/dist/esm/components/QuotaWidgetMini/index.d.ts +1 -0
  103. package/dist/esm/components/QuotaWidgetMini/index.js +1 -0
  104. package/dist/esm/components/QuotaWidgetMini/styles.module.css +15 -0
  105. package/dist/esm/components/index.d.ts +3 -0
  106. package/dist/esm/components/index.js +3 -0
  107. package/dist/esm/constants.d.ts +17 -0
  108. package/dist/esm/constants.js +17 -0
  109. package/dist/esm/helperComponents/QuotaCardsGrid/QuotaCardsGrid.d.ts +6 -0
  110. package/dist/esm/helperComponents/QuotaCardsGrid/QuotaCardsGrid.js +26 -0
  111. package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/Grid.d.ts +6 -0
  112. package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/Grid.js +24 -0
  113. package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/QuotaCardsSkeleton.d.ts +6 -0
  114. package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/QuotaCardsSkeleton.js +10 -0
  115. package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/index.d.ts +1 -0
  116. package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/index.js +1 -0
  117. package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/styles.module.css +10 -0
  118. package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/index.d.ts +1 -0
  119. package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/index.js +1 -0
  120. package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/styles.module.css +9 -0
  121. package/dist/esm/helperComponents/QuotaCardsGrid/components/QuotaError/QuotaError.d.ts +5 -0
  122. package/dist/esm/helperComponents/QuotaCardsGrid/components/QuotaError/QuotaError.js +9 -0
  123. package/dist/esm/helperComponents/QuotaCardsGrid/components/QuotaError/index.d.ts +1 -0
  124. package/dist/esm/helperComponents/QuotaCardsGrid/components/QuotaError/index.js +1 -0
  125. package/dist/esm/helperComponents/QuotaCardsGrid/index.d.ts +1 -0
  126. package/dist/esm/helperComponents/QuotaCardsGrid/index.js +1 -0
  127. package/dist/esm/helperComponents/QuotaCardsGrid/styles.module.css +16 -0
  128. package/dist/esm/index.d.ts +5 -0
  129. package/dist/esm/index.js +5 -0
  130. package/dist/esm/locale/index.d.ts +91 -0
  131. package/dist/esm/locale/index.js +47 -0
  132. package/dist/esm/style.css +260 -0
  133. package/dist/esm/types.d.ts +34 -0
  134. package/dist/esm/types.js +1 -0
  135. package/dist/esm/utils/checkIsExceeded.d.ts +2 -0
  136. package/dist/esm/utils/checkIsExceeded.js +1 -0
  137. package/dist/esm/utils/formatNumber.d.ts +1 -0
  138. package/dist/esm/utils/formatNumber.js +3 -0
  139. package/dist/esm/utils/getPercent.d.ts +2 -0
  140. package/dist/esm/utils/getPercent.js +6 -0
  141. package/dist/esm/utils/index.d.ts +3 -0
  142. package/dist/esm/utils/index.js +3 -0
  143. package/dist/tsconfig.cjs.tsbuildinfo +1 -0
  144. package/dist/tsconfig.esm.tsbuildinfo +1 -0
  145. package/package.json +63 -0
  146. package/src/components/QuotaWidget/QuotaIncreaseButton.tsx +21 -0
  147. package/src/components/QuotaWidget/QuotaMobileHeader.tsx +18 -0
  148. package/src/components/QuotaWidget/QuotaWidget.tsx +109 -0
  149. package/src/components/QuotaWidget/QuotaWidgetContent.tsx +91 -0
  150. package/src/components/QuotaWidget/components/ProjectHeader/ProjectHeader.tsx +59 -0
  151. package/src/components/QuotaWidget/components/ProjectHeader/index.ts +1 -0
  152. package/src/components/QuotaWidget/components/ProjectHeader/styles.module.scss +29 -0
  153. package/src/components/QuotaWidget/index.ts +2 -0
  154. package/src/components/QuotaWidget/styles.module.scss +52 -0
  155. package/src/components/QuotaWidgetCard/QuotaWidgetCard.tsx +127 -0
  156. package/src/components/QuotaWidgetCard/components/QuotaTooltip/QuotaTooltip.tsx +48 -0
  157. package/src/components/QuotaWidgetCard/components/QuotaTooltip/index.ts +1 -0
  158. package/src/components/QuotaWidgetCard/components/QuotaTooltip/styles.module.scss +30 -0
  159. package/src/components/QuotaWidgetCard/index.ts +1 -0
  160. package/src/components/QuotaWidgetCard/styles.module.scss +97 -0
  161. package/src/components/QuotaWidgetMini/QuotaWidgetMini.tsx +93 -0
  162. package/src/components/QuotaWidgetMini/index.ts +1 -0
  163. package/src/components/QuotaWidgetMini/styles.module.scss +18 -0
  164. package/src/components/index.ts +3 -0
  165. package/src/constants.ts +17 -0
  166. package/src/helperComponents/QuotaCardsGrid/QuotaCardsGrid.tsx +54 -0
  167. package/src/helperComponents/QuotaCardsGrid/components/Grid/Grid.tsx +47 -0
  168. package/src/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/QuotaCardsSkeleton.tsx +24 -0
  169. package/src/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/index.ts +1 -0
  170. package/src/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/styles.module.scss +15 -0
  171. package/src/helperComponents/QuotaCardsGrid/components/Grid/index.ts +1 -0
  172. package/src/helperComponents/QuotaCardsGrid/components/Grid/styles.module.scss +12 -0
  173. package/src/helperComponents/QuotaCardsGrid/components/QuotaError/QuotaError.tsx +31 -0
  174. package/src/helperComponents/QuotaCardsGrid/components/QuotaError/index.ts +1 -0
  175. package/src/helperComponents/QuotaCardsGrid/index.ts +1 -0
  176. package/src/helperComponents/QuotaCardsGrid/styles.module.scss +16 -0
  177. package/src/index.ts +5 -0
  178. package/src/locale/index.ts +51 -0
  179. package/src/types.ts +35 -0
  180. package/src/utils/checkIsExceeded.ts +3 -0
  181. package/src/utils/formatNumber.ts +3 -0
  182. package/src/utils/getPercent.ts +9 -0
  183. package/src/utils/index.ts +3 -0
@@ -0,0 +1,15 @@
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.QuotaIncreaseButton = QuotaIncreaseButton;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const button_1 = require("@cloud-ru/ds-button");
9
+ const locale_1 = require("../../locale");
10
+ const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
11
+ /** Кнопка «Увеличить квоту» (outline, на всю ширину) — низ мобильного листа / footer-слот BottomSheet. */
12
+ function QuotaIncreaseButton({ onClick }) {
13
+ const { t } = locale_1.quotaLocale.useTranslations();
14
+ return ((0, jsx_runtime_1.jsx)(button_1.Button, { className: styles_module_scss_1.default.increaseButton, view: 'outline', appearance: 'neutral', label: t('increaseQuota'), size: 'm', fullWidth: true, onClick: onClick }));
15
+ }
@@ -0,0 +1,4 @@
1
+ /** Мобильная шапка квота-виджета (макет): заголовок «Квоты» + имя проекта, слева, без пиктограмм. */
2
+ export declare function QuotaMobileHeader({ projectName }: {
3
+ projectName: string;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
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.QuotaMobileHeader = QuotaMobileHeader;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const truncate_string_1 = require("@cloud-ru/ds-truncate-string");
9
+ const locale_1 = require("../../locale");
10
+ const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
11
+ /** Мобильная шапка квота-виджета (макет): заголовок «Квоты» + имя проекта, слева, без пиктограмм. */
12
+ function QuotaMobileHeader({ projectName }) {
13
+ const { t } = locale_1.quotaLocale.useTranslations();
14
+ return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.mobileHeader, children: [(0, jsx_runtime_1.jsx)("h2", { className: styles_module_scss_1.default.mobileTitle, children: t('quotas') }), (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.mobileSubtitle, children: (0, jsx_runtime_1.jsx)(truncate_string_1.TruncateString, { maxLines: 1, text: projectName }) })] }));
15
+ }
@@ -0,0 +1,12 @@
1
+ import { ButtonProps } from '@cloud-ru/ds-button';
2
+ import { WithSupportProps } from '@cloud-ru/ds-utils';
3
+ import { QuotaWidgetPropsBase } from '../../types';
4
+ export type QuotaWidgetProps = WithSupportProps<QuotaWidgetPropsBase & {
5
+ /** Ссылка на страницу квот по проекту */
6
+ quotasUrl: string;
7
+ /** Колбек клика по ссылке на страницу квот по проекту */
8
+ onQuotasUrlClick?: () => void;
9
+ /** Свойства кнопки открытия виджета */
10
+ buttonProps?: Pick<ButtonProps, 'size' | 'className' | 'fullWidth' | 'label' | 'appearance' | 'disabled' | 'view'>;
11
+ }>;
12
+ export declare function QuotaWidget({ quotas, disableSorting, loading, error, onRefresh, projectName, quotasUrl, canEditQuota, hideIncreaseQuotaButton, onIncreaseQuotaClick, onWidgetOpen, onQuotasUrlClick, buttonProps, ...props }: QuotaWidgetProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QuotaWidget = QuotaWidget;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const adaptive_1 = require("@cloud-ru/ds-adaptive");
6
+ const button_1 = require("@cloud-ru/ds-button");
7
+ const dropdown_1 = require("@cloud-ru/ds-dropdown");
8
+ const system_1 = require("@cloud-ru/ds-icons/interface/system");
9
+ const react_1 = require("react");
10
+ const constants_1 = require("../../constants");
11
+ const locale_1 = require("../../locale");
12
+ const utils_1 = require("../../utils");
13
+ const QuotaIncreaseButton_1 = require("./QuotaIncreaseButton");
14
+ const QuotaMobileHeader_1 = require("./QuotaMobileHeader");
15
+ const QuotaWidgetContent_1 = require("./QuotaWidgetContent");
16
+ function QuotaWidget({ quotas, disableSorting, loading, error, onRefresh, projectName, quotasUrl, canEditQuota, hideIncreaseQuotaButton, onIncreaseQuotaClick, onWidgetOpen, onQuotasUrlClick, buttonProps, ...props }) {
17
+ const { t } = locale_1.quotaLocale.useTranslations();
18
+ const [isOpen, setIsOpen] = (0, react_1.useState)(false);
19
+ const { layoutType } = (0, adaptive_1.useAdaptiveLayout)();
20
+ const isMobile = (0, adaptive_1.isMobileLayout)(layoutType);
21
+ const rootTestId = props['data-test-id'];
22
+ const useMatrixTestIds = Boolean(rootTestId && rootTestId !== constants_1.TEST_IDS.quotaWidget.root);
23
+ const contentTestId = useMatrixTestIds && rootTestId ? `content-${rootTestId}` : constants_1.TEST_IDS.quotaWidget.content;
24
+ const triggerTestId = useMatrixTestIds && rootTestId ? `trigger-${rootTestId}` : constants_1.TEST_IDS.quotaWidget.trigger;
25
+ const handleOpenChange = (open) => {
26
+ setIsOpen(open);
27
+ if (open) {
28
+ onWidgetOpen?.();
29
+ }
30
+ };
31
+ const exhaustedCount = quotas.filter(utils_1.checkIsExceeded).length;
32
+ // На мобилке лист full-height (snap `1`): шапку и кнопку выносим в pinned-слоты BottomSheet
33
+ // (`title` сверху, `footer` снизу), а карточки скроллятся в теле листа — как в макете.
34
+ const showMobileIncreaseButton = isMobile && canEditQuota && !error && !hideIncreaseQuotaButton;
35
+ return ((0, jsx_runtime_1.jsx)(dropdown_1.Dropdown, { ...props, placement: 'bottom-end',
36
+ // Mobile: лист на всю высоту экрана (число `1` = full-height snap; safe-area даёт сам BottomSheet).
37
+ snapPoints: [1], title: isMobile ? (0, jsx_runtime_1.jsx)(QuotaMobileHeader_1.QuotaMobileHeader, { projectName: projectName }) : undefined, footer: showMobileIncreaseButton ? (0, jsx_runtime_1.jsx)(QuotaIncreaseButton_1.QuotaIncreaseButton, { onClick: onIncreaseQuotaClick }) : undefined, open: isOpen, onOpenChange: handleOpenChange, content: (0, jsx_runtime_1.jsx)(QuotaWidgetContent_1.QuotaWidgetContent, { quotas: quotas, disableSorting: disableSorting, loading: loading, error: error, onRefresh: onRefresh, projectName: projectName, quotasUrl: quotasUrl, canEditQuota: canEditQuota, hideIncreaseQuotaButton: hideIncreaseQuotaButton, onIncreaseQuotaClick: onIncreaseQuotaClick, onQuotasUrlClick: onQuotasUrlClick, hideMobileHeader: isMobile, hideMobileIncreaseButton: isMobile, "data-test-id": contentTestId }), children: (0, jsx_runtime_1.jsx)(button_1.Button
38
+ // На мобилке триггер бордюрный (`outline` — как в макете кнопки квот),
39
+ // на desktop — плоский `function`. Переопределяется через `buttonProps.view`.
40
+ , {
41
+ // На мобилке триггер бордюрный (`outline` — как в макете кнопки квот),
42
+ // на desktop — плоский `function`. Переопределяется через `buttonProps.view`.
43
+ view: isMobile ? 'outline' : 'function', label: t('quotas'), appearance: 'neutral', iconPosition: 'after', icon: isOpen ? (0, jsx_runtime_1.jsx)(system_1.ChevronUpSVG, {}) : (0, jsx_runtime_1.jsx)(system_1.ChevronDownSVG, {}), counter: exhaustedCount > 0 ? { value: exhaustedCount, appearance: 'red' } : undefined, size: 'm', "data-test-id": triggerTestId, ...buttonProps }) }));
44
+ }
@@ -0,0 +1,27 @@
1
+ import { WithSupportProps } from '@cloud-ru/ds-utils';
2
+ import { QuotaWidgetPropsBase } from '../../types';
3
+ export type QuotaWidgetContentProps = WithSupportProps<QuotaWidgetPropsBase & {
4
+ /** Ссылка на страницу квот по проекту */
5
+ quotasUrl: string;
6
+ /** Колбек клика по ссылке на страницу квот по проекту */
7
+ onQuotasUrlClick?: () => void;
8
+ /**
9
+ * Не рендерить мобильную шапку (её выносят в pinned-`title` контейнера, напр. BottomSheet).
10
+ * На desktop не влияет.
11
+ */
12
+ hideMobileHeader?: boolean;
13
+ /**
14
+ * Не рендерить мобильную кнопку расширения (её выносят в pinned-`footer` контейнера).
15
+ * На desktop не влияет.
16
+ */
17
+ hideMobileIncreaseButton?: boolean;
18
+ }>;
19
+ /**
20
+ * Голый контент квота-виджета: шапка проекта + карточки + кнопка расширения — без триггера,
21
+ * дропдауна и аккордеона. Используется внутри `QuotaWidget` (в дропдауне/BottomSheet) и напрямую,
22
+ * когда контейнер-раскрытие даёт кто-то снаружи (напр. `sideBlock` формы уже открывает BottomSheet).
23
+ *
24
+ * На full-height BottomSheet шапка/кнопка уезжают в pinned-слоты `title`/`footer` (см. `QuotaWidget`),
25
+ * а сюда остаются только карточки — тогда `hideMobileHeader`/`hideMobileIncreaseButton` = true.
26
+ */
27
+ export declare function QuotaWidgetContent({ quotas, disableSorting, loading, error, onRefresh, projectName, quotasUrl, canEditQuota, hideIncreaseQuotaButton, onIncreaseQuotaClick, onQuotasUrlClick, hideMobileHeader, hideMobileIncreaseButton, ...props }: QuotaWidgetContentProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,33 @@
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.QuotaWidgetContent = QuotaWidgetContent;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const adaptive_1 = require("@cloud-ru/ds-adaptive");
9
+ const constants_1 = require("../../constants");
10
+ const QuotaCardsGrid_1 = require("../../helperComponents/QuotaCardsGrid");
11
+ const ProjectHeader_1 = require("./components/ProjectHeader");
12
+ const QuotaIncreaseButton_1 = require("./QuotaIncreaseButton");
13
+ const QuotaMobileHeader_1 = require("./QuotaMobileHeader");
14
+ const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
15
+ /**
16
+ * Голый контент квота-виджета: шапка проекта + карточки + кнопка расширения — без триггера,
17
+ * дропдауна и аккордеона. Используется внутри `QuotaWidget` (в дропдауне/BottomSheet) и напрямую,
18
+ * когда контейнер-раскрытие даёт кто-то снаружи (напр. `sideBlock` формы уже открывает BottomSheet).
19
+ *
20
+ * На full-height BottomSheet шапка/кнопка уезжают в pinned-слоты `title`/`footer` (см. `QuotaWidget`),
21
+ * а сюда остаются только карточки — тогда `hideMobileHeader`/`hideMobileIncreaseButton` = true.
22
+ */
23
+ function QuotaWidgetContent({ quotas, disableSorting, loading, error, onRefresh, projectName, quotasUrl, canEditQuota, hideIncreaseQuotaButton, onIncreaseQuotaClick, onQuotasUrlClick, hideMobileHeader = false, hideMobileIncreaseButton = false, ...props }) {
24
+ const { layoutType } = (0, adaptive_1.useAdaptiveLayout)();
25
+ const isMobile = (0, adaptive_1.isMobileLayout)(layoutType);
26
+ const contentTestId = props['data-test-id'] ?? constants_1.TEST_IDS.quotaWidget.content;
27
+ const showMobileIncreaseButton = isMobile && !hideMobileIncreaseButton && canEditQuota && !error && !hideIncreaseQuotaButton;
28
+ return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.content, "data-mobile": isMobile, "data-test-id": contentTestId, children: [isMobile ? (
29
+ // Мобильная шапка (макет): «Квоты» + имя проекта, без пиктограммы/ссылки/подзаголовка «Остаток…».
30
+ !hideMobileHeader && (0, jsx_runtime_1.jsx)(QuotaMobileHeader_1.QuotaMobileHeader, { projectName: projectName })) : (
31
+ // Desktop-popover: полная шапка проекта (с пиктограммой, ссылкой и кнопкой расширения).
32
+ (0, jsx_runtime_1.jsx)(ProjectHeader_1.ProjectHeader, { projectName: projectName, quotasUrl: quotasUrl, canEditQuota: canEditQuota, error: error, onIncreaseQuotaClick: onIncreaseQuotaClick, hideIncreaseQuotaButton: hideIncreaseQuotaButton, onQuotasUrlClick: onQuotasUrlClick })), (0, jsx_runtime_1.jsx)(QuotaCardsGrid_1.QuotaCardsGrid, { quotas: quotas, disableSorting: disableSorting, loading: loading, error: error, onRefresh: onRefresh }), showMobileIncreaseButton && (0, jsx_runtime_1.jsx)(QuotaIncreaseButton_1.QuotaIncreaseButton, { onClick: onIncreaseQuotaClick })] }));
33
+ }
@@ -0,0 +1,7 @@
1
+ import { QuotaWidgetPropsBase } from '../../../../types';
2
+ type ProjectHeaderProps = Pick<QuotaWidgetPropsBase, 'projectName' | 'canEditQuota' | 'error' | 'hideIncreaseQuotaButton' | 'onIncreaseQuotaClick'> & {
3
+ quotasUrl: string;
4
+ onQuotasUrlClick?: () => void;
5
+ };
6
+ export declare function ProjectHeader({ projectName, quotasUrl, canEditQuota, error, onIncreaseQuotaClick, hideIncreaseQuotaButton, onQuotasUrlClick, }: ProjectHeaderProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,19 @@
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.ProjectHeader = ProjectHeader;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const button_1 = require("@cloud-ru/ds-button");
9
+ const product_1 = require("@cloud-ru/ds-icons/interface/product");
10
+ const uikit_product_title_clickable_1 = require("@cloud-ru/ds-uikit-product-title-clickable");
11
+ const constants_1 = require("../../../../constants");
12
+ const locale_1 = require("../../../../locale");
13
+ const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
14
+ const RUSSIAN_CHARS_REGEXP = /[А-Яа-яЁё]/;
15
+ function ProjectHeader({ projectName, quotasUrl, canEditQuota, error, onIncreaseQuotaClick, hideIncreaseQuotaButton, onQuotasUrlClick, }) {
16
+ const { t } = locale_1.quotaLocale.useTranslations();
17
+ const widgetTitle = RUSSIAN_CHARS_REGEXP.test(projectName) ? 'widgetTitle.quotes' : 'widgetTitle.noQuotes';
18
+ return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.header, "data-test-id": constants_1.TEST_IDS.quotaWidget.projectHeader, children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.projectWrapper, children: [(0, jsx_runtime_1.jsx)(uikit_product_title_clickable_1.TitleClickable, { className: styles_module_scss_1.default.titleLink, title: t(widgetTitle, { project: projectName }), href: quotasUrl, target: '_blank', icon: (0, jsx_runtime_1.jsx)(product_1.QuotaSVG, {}), onClick: onQuotasUrlClick }), (0, jsx_runtime_1.jsx)("p", { className: styles_module_scss_1.default.subtitle, children: t('widgetSubtitle') })] }), canEditQuota && !error && !hideIncreaseQuotaButton && ((0, jsx_runtime_1.jsx)(button_1.Button, { view: 'outline', appearance: 'neutral', label: t('increaseQuota'), size: 'm', onClick: onIncreaseQuotaClick }))] }));
19
+ }
@@ -0,0 +1 @@
1
+ export * from './ProjectHeader';
@@ -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("./ProjectHeader"), exports);
@@ -0,0 +1,30 @@
1
+ .header{
2
+ display:flex;
3
+ gap:var(--sn-primitive-dimension-8, 8px);
4
+ align-items:center;
5
+ width:100%;
6
+ }
7
+
8
+ .projectWrapper{
9
+ display:flex;
10
+ flex:1 0 0;
11
+ flex-direction:column;
12
+ align-items:flex-start;
13
+ min-width:0;
14
+ }
15
+
16
+ .titleLink{
17
+ gap:var(--sn-primitive-dimension-8, 8px);
18
+ }
19
+
20
+ .subtitle{
21
+ font-family:var(--sn-regular-body-s-fontFamily, var(--sn-brand-font-fontFamily-regular-body, var(--sn-primitive-fontFamily-brandA-sans, SB Sans Interface)));
22
+ font-weight:var(--sn-regular-body-s-fontWeight, var(--sn-theme-typography-fontWeight-regular-body-s, var(--sn-brand-font-fontWeight-light-regular-body-s, var(--sn-primitive-font-fontWeightValue-400, 400))));
23
+ line-height:var(--sn-regular-body-s-lineHeight, var(--sn-density-typography-roleBody-lineHeightS, var(--sn-primitive-font-lineHeight-by14, 20px)));
24
+ font-size:var(--sn-regular-body-s-fontSize, var(--sn-density-typography-roleBody-fontSizeS, var(--sn-primitive-font-fontSize-14, 14px)));
25
+ letter-spacing:var(--sn-regular-body-s-letterSpacing, var(--sn-primitive-font-letterSpacing-m, 0.1px));
26
+ paragraph-spacing:var(--sn-regular-body-s-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize12, 6px));
27
+ width:100%;
28
+ margin:0;
29
+ color:var(--sn-theme-color-available-version-textTertiary, var(--sn-brand-color-text-version-tertiary, rgba(65, 66, 78, 0.5490196078)));
30
+ }
@@ -0,0 +1,2 @@
1
+ export * from './QuotaWidget';
2
+ export * from './QuotaWidgetContent';
@@ -0,0 +1,18 @@
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("./QuotaWidget"), exports);
18
+ __exportStar(require("./QuotaWidgetContent"), exports);
@@ -0,0 +1,49 @@
1
+ @charset "UTF-8";
2
+ .content{
3
+ display:flex;
4
+ flex-direction:column;
5
+ gap:var(--sn-primitive-dimension-16, 16px);
6
+ align-items:flex-start;
7
+ width:620px;
8
+ min-width:620px;
9
+ padding:var(--sn-primitive-dimension-12, 12px) var(--sn-primitive-dimension-16, 16px);
10
+ }
11
+ .content[data-mobile=true]{
12
+ width:100%;
13
+ min-width:0;
14
+ height:100%;
15
+ padding:0;
16
+ }
17
+ .increaseButton{
18
+ width:100%;
19
+ }
20
+ .mobileHeader{
21
+ display:flex;
22
+ flex-direction:column;
23
+ gap:var(--sn-primitive-dimension-2, 2px);
24
+ align-items:flex-start;
25
+ width:100%;
26
+ }
27
+
28
+ .mobileTitle{
29
+ font-family:var(--sn-regular-title-l-fontFamily, var(--sn-brand-font-fontFamily-regular-title, var(--sn-primitive-fontFamily-brandA-sans, SB Sans Interface)));
30
+ font-weight:var(--sn-regular-title-l-fontWeight, var(--sn-theme-typography-fontWeight-regular-title-l, var(--sn-brand-font-fontWeight-light-regular-title-l, var(--sn-primitive-font-fontWeightValue-600, 600))));
31
+ line-height:var(--sn-regular-title-l-lineHeight, var(--sn-density-typography-roleTitle-lineHeightL, var(--sn-primitive-font-lineHeight-by20, 28px)));
32
+ font-size:var(--sn-regular-title-l-fontSize, var(--sn-density-typography-roleTitle-fontSizeL, var(--sn-primitive-font-fontSize-20, 20px)));
33
+ letter-spacing:var(--sn-regular-title-l-letterSpacing, var(--sn-primitive-font-letterSpacing-l, 0.15px));
34
+ paragraph-spacing:var(--sn-regular-title-l-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize20, 10px));
35
+ margin:0;
36
+ color:var(--sn-theme-color-available-version-textMain, var(--sn-brand-color-text-version-main, #41424e));
37
+ }
38
+
39
+ .mobileSubtitle{
40
+ font-family:var(--sn-regular-body-m-fontFamily, var(--sn-brand-font-fontFamily-regular-body, var(--sn-primitive-fontFamily-brandA-sans, SB Sans Interface)));
41
+ font-weight:var(--sn-regular-body-m-fontWeight, var(--sn-theme-typography-fontWeight-regular-body-m, var(--sn-brand-font-fontWeight-light-regular-body-m, var(--sn-primitive-font-fontWeightValue-400, 400))));
42
+ line-height:var(--sn-regular-body-m-lineHeight, var(--sn-density-typography-roleBody-lineHeightM, var(--sn-primitive-font-lineHeight-by16, 24px)));
43
+ font-size:var(--sn-regular-body-m-fontSize, var(--sn-density-typography-roleBody-fontSizeM, var(--sn-primitive-font-fontSize-16, 16px)));
44
+ letter-spacing:var(--sn-regular-body-m-letterSpacing, var(--sn-primitive-font-letterSpacing-m, 0.1px));
45
+ paragraph-spacing:var(--sn-regular-body-m-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize14, 7px));
46
+ width:100%;
47
+ margin:0;
48
+ color:var(--sn-theme-color-available-version-textSecondary, var(--sn-brand-color-text-version-secondary, rgba(65, 66, 78, 0.8)));
49
+ }
@@ -0,0 +1,13 @@
1
+ import { WithSupportProps } from '@cloud-ru/ds-utils';
2
+ import { QuotaItem } from '../../types';
3
+ export type QuotaWidgetCardProps = WithSupportProps<{
4
+ /** Отображаемая квота */
5
+ quota: QuotaItem;
6
+ /** Состояние «не удалось загрузить данные» (Figma: noData=true) */
7
+ noData?: boolean;
8
+ /** Состояние загрузки (Figma: loading=true) */
9
+ loading?: boolean;
10
+ /** Колбек кнопки «Обновить» в состоянии noData */
11
+ onRefresh?: () => void;
12
+ }>;
13
+ export declare function QuotaWidgetCard({ quota, noData, loading, onRefresh, ...props }: QuotaWidgetCardProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,53 @@
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.QuotaWidgetCard = QuotaWidgetCard;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const button_1 = require("@cloud-ru/ds-button");
9
+ const system_1 = require("@cloud-ru/ds-icons/interface/system");
10
+ const info_block_1 = require("@cloud-ru/ds-info-block");
11
+ const progress_bar_1 = require("@cloud-ru/ds-progress-bar");
12
+ const skeleton_1 = require("@cloud-ru/ds-skeleton");
13
+ const tooltip_1 = require("@cloud-ru/ds-tooltip");
14
+ const truncate_string_1 = require("@cloud-ru/ds-truncate-string");
15
+ const typography_1 = require("@cloud-ru/ds-typography");
16
+ const locale_1 = require("../../locale");
17
+ const utils_1 = require("../../utils");
18
+ const QuotaTooltip_1 = require("./components/QuotaTooltip");
19
+ const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
20
+ const QUOTA_USAGE_PROGRESS = {
21
+ HIGH: 90,
22
+ MEDIUM: 70,
23
+ };
24
+ function getProgressAppearance(percent) {
25
+ if (percent >= QUOTA_USAGE_PROGRESS.HIGH) {
26
+ return 'red';
27
+ }
28
+ if (percent >= QUOTA_USAGE_PROGRESS.MEDIUM) {
29
+ return 'yellow';
30
+ }
31
+ return 'green';
32
+ }
33
+ function QuotaWidgetCard({ quota, noData = false, loading = false, onRefresh, ...props }) {
34
+ const { t } = locale_1.quotaLocale.useTranslations();
35
+ if (noData) {
36
+ return ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.card, "data-no-data": true, ...props, children: (0, jsx_runtime_1.jsx)(info_block_1.InfoBlock, { size: 's', align: 'vertical', title: quota.name, content: t('errorText'), footer: onRefresh ? ((0, jsx_runtime_1.jsx)(button_1.Button, { view: 'simple', appearance: 'neutral', size: 's', label: t('errorButton'), icon: (0, jsx_runtime_1.jsx)(system_1.UpdateSVG, { size: 16 }), iconPosition: 'after', onClick: onRefresh })) : undefined }) }));
37
+ }
38
+ if (loading) {
39
+ return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.card, "data-loading": true, ...props, children: [(0, jsx_runtime_1.jsx)(skeleton_1.SkeletonText, { loading: true, lines: 1, variant: 'body', size: 'm' }), (0, jsx_runtime_1.jsx)(skeleton_1.SkeletonText, { loading: true, lines: 1, variant: 'body', size: 'm' }), (0, jsx_runtime_1.jsx)(skeleton_1.SkeletonText, { loading: true, lines: 1, variant: 'body', size: 'l' })] }));
40
+ }
41
+ const percent = (0, utils_1.getPercent)(quota);
42
+ const rows = [
43
+ {
44
+ label: t('cardAvailable'),
45
+ value: quota.limit,
46
+ },
47
+ {
48
+ label: t('cardRemaining'),
49
+ value: quota.remains,
50
+ },
51
+ ];
52
+ return ((0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { triggerClassName: styles_module_scss_1.default.tooltip, hoverDelayOpen: 500, tip: (0, jsx_runtime_1.jsx)(QuotaTooltip_1.QuotaTooltip, { quota: quota }), children: (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.card, "data-exhausted": (0, utils_1.checkIsExceeded)(quota), ...props, children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.header, children: [(0, jsx_runtime_1.jsx)(typography_1.Typography, { variant: 'body', size: 'm', className: styles_module_scss_1.default.title, children: (0, jsx_runtime_1.jsx)(truncate_string_1.TruncateString, { maxLines: 2, text: quota.name }) }), (0, jsx_runtime_1.jsxs)("span", { className: styles_module_scss_1.default.percent, children: [Math.round(percent), "%"] })] }), (0, jsx_runtime_1.jsx)(progress_bar_1.ProgressBar, { className: styles_module_scss_1.default.progressBar, progress: percent, size: 'xs', appearance: getProgressAppearance(percent) }), (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.info, children: rows.map(row => ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.row, children: [(0, jsx_runtime_1.jsx)("span", { className: styles_module_scss_1.default.label, children: row.label }), (0, jsx_runtime_1.jsxs)("span", { className: styles_module_scss_1.default.value, children: [(0, utils_1.formatNumber)(row.value), " ", (0, jsx_runtime_1.jsx)("span", { className: styles_module_scss_1.default.unit, children: quota.unitDisplayName })] })] }, row.label))) })] }) }));
53
+ }
@@ -0,0 +1,6 @@
1
+ import { QuotaItem } from '../../../../types';
2
+ type QuotaTooltipProps = {
3
+ quota: QuotaItem;
4
+ };
5
+ export declare function QuotaTooltip({ quota }: QuotaTooltipProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,23 @@
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.QuotaTooltip = QuotaTooltip;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const divider_1 = require("@cloud-ru/ds-divider");
9
+ const typography_1 = require("@cloud-ru/ds-typography");
10
+ const constants_1 = require("../../../../constants");
11
+ const locale_1 = require("../../../../locale");
12
+ const utils_1 = require("../../../../utils");
13
+ const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
14
+ function QuotaTooltip({ quota }) {
15
+ const { t } = locale_1.quotaLocale.useTranslations();
16
+ const rows = [
17
+ { label: t('tooltipAvailable'), value: quota.limit },
18
+ { label: t('tooltipUsed'), value: quota.usage },
19
+ { label: t('tooltipRemaining'), value: quota.remains },
20
+ ];
21
+ const exhaustedHint = `${t('tooltipExhaustedHint.first')} ${t('tooltipExhaustedHint.second')}`;
22
+ return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.content, "data-test-id": constants_1.TEST_IDS.quotaWidgetCard.tooltip, children: [(0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.lists, children: rows.map(row => ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.row, children: [(0, jsx_runtime_1.jsx)("span", { className: styles_module_scss_1.default.rowLabel, children: row.label }), (0, jsx_runtime_1.jsxs)("span", { className: styles_module_scss_1.default.rowValue, children: [(0, utils_1.formatNumber)(row.value), " ", quota.unitDisplayName] })] }, row.label))) }), (0, utils_1.checkIsExceeded)(quota) && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(divider_1.Divider, { appearance: divider_1.APPEARANCE.InvertNeutral }), (0, jsx_runtime_1.jsx)(typography_1.Typography, { variant: 'body', size: 'm', children: exhaustedHint })] }))] }));
23
+ }
@@ -0,0 +1 @@
1
+ export * from './QuotaTooltip';
@@ -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("./QuotaTooltip"), exports);
@@ -0,0 +1,34 @@
1
+ .content{
2
+ display:flex;
3
+ flex-direction:column;
4
+ row-gap:var(--sn-primitive-dimension-4, 4px);
5
+ align-items:stretch;
6
+ }
7
+
8
+ .lists{
9
+ display:flex;
10
+ flex-direction:column;
11
+ row-gap:var(--sn-primitive-dimension-4, 4px);
12
+ }
13
+
14
+ .row{
15
+ display:flex;
16
+ -moz-column-gap:var(--sn-primitive-dimension-8, 8px);
17
+ column-gap:var(--sn-primitive-dimension-8, 8px);
18
+ align-items:center;
19
+ justify-content:space-between;
20
+ }
21
+
22
+ .rowLabel,
23
+ .rowValue{
24
+ font-family:var(--sn-regular-body-m-fontFamily, var(--sn-brand-font-fontFamily-regular-body, var(--sn-primitive-fontFamily-brandA-sans, SB Sans Interface)));
25
+ font-weight:var(--sn-regular-body-m-fontWeight, var(--sn-theme-typography-fontWeight-regular-body-m, var(--sn-brand-font-fontWeight-light-regular-body-m, var(--sn-primitive-font-fontWeightValue-400, 400))));
26
+ line-height:var(--sn-regular-body-m-lineHeight, var(--sn-density-typography-roleBody-lineHeightM, var(--sn-primitive-font-lineHeight-by16, 24px)));
27
+ font-size:var(--sn-regular-body-m-fontSize, var(--sn-density-typography-roleBody-fontSizeM, var(--sn-primitive-font-fontSize-16, 16px)));
28
+ letter-spacing:var(--sn-regular-body-m-letterSpacing, var(--sn-primitive-font-letterSpacing-m, 0.1px));
29
+ paragraph-spacing:var(--sn-regular-body-m-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize14, 7px));
30
+ }
31
+
32
+ .rowValue{
33
+ text-align:right;
34
+ }
@@ -0,0 +1 @@
1
+ export * from './QuotaWidgetCard';
@@ -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("./QuotaWidgetCard"), exports);
@@ -0,0 +1,97 @@
1
+ @charset "UTF-8";
2
+ .tooltip{
3
+ display:flex;
4
+ width:100%;
5
+ max-width:100%;
6
+ }
7
+ .card{
8
+ display:flex;
9
+ flex:1 1 auto;
10
+ flex-direction:column;
11
+ row-gap:var(--sn-primitive-dimension-4, 4px);
12
+ box-sizing:border-box;
13
+ min-width:min(256px, 100%);
14
+ max-width:100%;
15
+ padding:var(--sn-primitive-dimension-8, 8px);
16
+ border-radius:var(--sn-card-anatomy-radius-s-container-borderRadius, var(--sn-brand-anatomy-radius-card-s, var(--sn-primitive-dimension-2, 2px)));
17
+ background-color:var(--sn-theme-color-neutral-decorTransparent, var(--sn-brand-color-neutral-transparent-forLightMode, rgba(124, 131, 182, 0.0784313725)));
18
+ backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground1Level, 0) / 2));
19
+ }
20
+ .card[data-exhausted=true]{
21
+ background-color:var(--sn-theme-color-red-background, var(--sn-primitive-color-red-90, #fee8e5));
22
+ }
23
+ .header{
24
+ display:flex;
25
+ gap:var(--sn-primitive-dimension-8, 8px);
26
+ align-items:flex-end;
27
+ justify-content:space-between;
28
+ width:100%;
29
+ }
30
+
31
+ .title{
32
+ flex:1 1 0;
33
+ min-width:0;
34
+ color:var(--sn-theme-color-available-version-textMain, var(--sn-brand-color-text-version-main, #41424e));
35
+ }
36
+
37
+ .percent{
38
+ font-family:var(--sn-thin-label-m-fontFamily, var(--sn-brand-font-fontFamily-thin-label, var(--sn-primitive-fontFamily-brandA-sans, SB Sans Interface)));
39
+ font-weight:var(--sn-thin-label-m-fontWeight, var(--sn-theme-typography-fontWeight-thin-label-m, var(--sn-brand-font-fontWeight-light-thin-label-m, var(--sn-primitive-font-fontWeightValue-450, 450))));
40
+ line-height:var(--sn-thin-label-m-lineHeight, var(--sn-density-typography-roleLabel-lineHeightM, var(--sn-primitive-font-lineHeight-by16, 24px)));
41
+ font-size:var(--sn-thin-label-m-fontSize, var(--sn-density-typography-roleLabel-fontSizeM, var(--sn-primitive-font-fontSize-16, 16px)));
42
+ letter-spacing:var(--sn-thin-label-m-letterSpacing, var(--sn-primitive-font-letterSpacing-s, 0px));
43
+ paragraph-spacing:var(--sn-thin-label-m-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize12, 6px));
44
+ flex-shrink:0;
45
+ color:var(--sn-theme-color-available-version-textTertiary, var(--sn-brand-color-text-version-tertiary, rgba(65, 66, 78, 0.5490196078)));
46
+ }
47
+
48
+ .progressBar{
49
+ width:100%;
50
+ }
51
+
52
+ .info{
53
+ display:flex;
54
+ flex-direction:column;
55
+ row-gap:var(--sn-primitive-dimension-2, 2px);
56
+ width:100%;
57
+ }
58
+
59
+ .row{
60
+ display:flex;
61
+ -moz-column-gap:var(--sn-primitive-dimension-8, 8px);
62
+ column-gap:var(--sn-primitive-dimension-8, 8px);
63
+ align-items:center;
64
+ justify-content:space-between;
65
+ width:100%;
66
+ }
67
+
68
+ .label{
69
+ font-family:var(--sn-thin-label-s-fontFamily, var(--sn-brand-font-fontFamily-thin-label, var(--sn-primitive-fontFamily-brandA-sans, SB Sans Interface)));
70
+ font-weight:var(--sn-thin-label-s-fontWeight, var(--sn-theme-typography-fontWeight-thin-label-s, var(--sn-brand-font-fontWeight-light-thin-label-s, var(--sn-primitive-font-fontWeightValue-450, 450))));
71
+ line-height:var(--sn-thin-label-s-lineHeight, var(--sn-density-typography-roleLabel-lineHeightS, var(--sn-primitive-font-lineHeight-by14, 20px)));
72
+ font-size:var(--sn-thin-label-s-fontSize, var(--sn-density-typography-roleLabel-fontSizeS, var(--sn-primitive-font-fontSize-14, 14px)));
73
+ letter-spacing:var(--sn-thin-label-s-letterSpacing, var(--sn-primitive-font-letterSpacing-s, 0px));
74
+ paragraph-spacing:var(--sn-thin-label-s-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize11, 5px));
75
+ color:var(--sn-theme-color-available-version-textTertiary, var(--sn-brand-color-text-version-tertiary, rgba(65, 66, 78, 0.5490196078)));
76
+ }
77
+
78
+ .value{
79
+ font-family:var(--sn-thin-label-l-fontFamily, var(--sn-brand-font-fontFamily-thin-label, var(--sn-primitive-fontFamily-brandA-sans, SB Sans Interface)));
80
+ font-weight:var(--sn-thin-label-l-fontWeight, var(--sn-theme-typography-fontWeight-thin-label-l, var(--sn-brand-font-fontWeight-light-thin-label-l, var(--sn-primitive-font-fontWeightValue-450, 450))));
81
+ line-height:var(--sn-thin-label-l-lineHeight, var(--sn-density-typography-roleLabel-lineHeightL, var(--sn-primitive-font-lineHeight-by20, 28px)));
82
+ font-size:var(--sn-thin-label-l-fontSize, var(--sn-density-typography-roleLabel-fontSizeL, var(--sn-primitive-font-fontSize-20, 20px)));
83
+ letter-spacing:var(--sn-thin-label-l-letterSpacing, var(--sn-primitive-font-letterSpacing-s, 0px));
84
+ paragraph-spacing:var(--sn-thin-label-l-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize14, 7px));
85
+ color:var(--sn-theme-color-available-version-textMain, var(--sn-brand-color-text-version-main, #41424e));
86
+ white-space:nowrap;
87
+ }
88
+
89
+ .unit{
90
+ font-family:var(--sn-thin-label-l-fontFamily, var(--sn-brand-font-fontFamily-thin-label, var(--sn-primitive-fontFamily-brandA-sans, SB Sans Interface)));
91
+ font-weight:var(--sn-thin-label-l-fontWeight, var(--sn-theme-typography-fontWeight-thin-label-l, var(--sn-brand-font-fontWeight-light-thin-label-l, var(--sn-primitive-font-fontWeightValue-450, 450))));
92
+ line-height:var(--sn-thin-label-l-lineHeight, var(--sn-density-typography-roleLabel-lineHeightL, var(--sn-primitive-font-lineHeight-by20, 28px)));
93
+ font-size:var(--sn-thin-label-l-fontSize, var(--sn-density-typography-roleLabel-fontSizeL, var(--sn-primitive-font-fontSize-20, 20px)));
94
+ letter-spacing:var(--sn-thin-label-l-letterSpacing, var(--sn-primitive-font-letterSpacing-s, 0px));
95
+ paragraph-spacing:var(--sn-thin-label-l-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize14, 7px));
96
+ color:var(--sn-theme-color-available-version-textTertiary, var(--sn-brand-color-text-version-tertiary, rgba(65, 66, 78, 0.5490196078)));
97
+ }
@@ -0,0 +1,7 @@
1
+ import { WithSupportProps } from '@cloud-ru/ds-utils';
2
+ import { QuotaWidgetPropsBase } from '../../types';
3
+ export type QuotaWidgetMiniProps = WithSupportProps<QuotaWidgetPropsBase & {
4
+ /** Флаг раскрытия аккордиона по умолчанию */
5
+ defaultExpanded?: boolean;
6
+ }>;
7
+ export declare function QuotaWidgetMini({ quotas, disableSorting, loading, error, onRefresh, projectName, canEditQuota, defaultExpanded, hideIncreaseQuotaButton, onIncreaseQuotaClick, onWidgetOpen, 'data-test-id': dataTestId, ...props }: QuotaWidgetMiniProps): import("react/jsx-runtime").JSX.Element;