@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.
- package/CHANGELOG.md +8 -0
- package/LICENSE +201 -0
- package/README.md +458 -0
- package/dist/cjs/components/QuotaWidget/QuotaIncreaseButton.d.ts +4 -0
- package/dist/cjs/components/QuotaWidget/QuotaIncreaseButton.js +15 -0
- package/dist/cjs/components/QuotaWidget/QuotaMobileHeader.d.ts +4 -0
- package/dist/cjs/components/QuotaWidget/QuotaMobileHeader.js +15 -0
- package/dist/cjs/components/QuotaWidget/QuotaWidget.d.ts +12 -0
- package/dist/cjs/components/QuotaWidget/QuotaWidget.js +44 -0
- package/dist/cjs/components/QuotaWidget/QuotaWidgetContent.d.ts +27 -0
- package/dist/cjs/components/QuotaWidget/QuotaWidgetContent.js +33 -0
- package/dist/cjs/components/QuotaWidget/components/ProjectHeader/ProjectHeader.d.ts +7 -0
- package/dist/cjs/components/QuotaWidget/components/ProjectHeader/ProjectHeader.js +19 -0
- package/dist/cjs/components/QuotaWidget/components/ProjectHeader/index.d.ts +1 -0
- package/dist/cjs/components/QuotaWidget/components/ProjectHeader/index.js +17 -0
- package/dist/cjs/components/QuotaWidget/components/ProjectHeader/styles.module.css +30 -0
- package/dist/cjs/components/QuotaWidget/index.d.ts +2 -0
- package/dist/cjs/components/QuotaWidget/index.js +18 -0
- package/dist/cjs/components/QuotaWidget/styles.module.css +49 -0
- package/dist/cjs/components/QuotaWidgetCard/QuotaWidgetCard.d.ts +13 -0
- package/dist/cjs/components/QuotaWidgetCard/QuotaWidgetCard.js +53 -0
- package/dist/cjs/components/QuotaWidgetCard/components/QuotaTooltip/QuotaTooltip.d.ts +6 -0
- package/dist/cjs/components/QuotaWidgetCard/components/QuotaTooltip/QuotaTooltip.js +23 -0
- package/dist/cjs/components/QuotaWidgetCard/components/QuotaTooltip/index.d.ts +1 -0
- package/dist/cjs/components/QuotaWidgetCard/components/QuotaTooltip/index.js +17 -0
- package/dist/cjs/components/QuotaWidgetCard/components/QuotaTooltip/styles.module.css +34 -0
- package/dist/cjs/components/QuotaWidgetCard/index.d.ts +1 -0
- package/dist/cjs/components/QuotaWidgetCard/index.js +17 -0
- package/dist/cjs/components/QuotaWidgetCard/styles.module.css +97 -0
- package/dist/cjs/components/QuotaWidgetMini/QuotaWidgetMini.d.ts +7 -0
- package/dist/cjs/components/QuotaWidgetMini/QuotaWidgetMini.js +27 -0
- package/dist/cjs/components/QuotaWidgetMini/index.d.ts +1 -0
- package/dist/cjs/components/QuotaWidgetMini/index.js +17 -0
- package/dist/cjs/components/QuotaWidgetMini/styles.module.css +15 -0
- package/dist/cjs/components/index.d.ts +3 -0
- package/dist/cjs/components/index.js +19 -0
- package/dist/cjs/constants.d.ts +17 -0
- package/dist/cjs/constants.js +20 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/QuotaCardsGrid.d.ts +6 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/QuotaCardsGrid.js +32 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/Grid.d.ts +6 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/Grid.js +30 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/QuotaCardsSkeleton.d.ts +6 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/QuotaCardsSkeleton.js +16 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/index.d.ts +1 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/index.js +17 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/styles.module.css +10 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/index.d.ts +1 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/index.js +17 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/styles.module.css +9 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/components/QuotaError/QuotaError.d.ts +5 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/components/QuotaError/QuotaError.js +12 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/components/QuotaError/index.d.ts +1 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/components/QuotaError/index.js +17 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/index.d.ts +1 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/index.js +17 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/styles.module.css +16 -0
- package/dist/cjs/index.d.ts +5 -0
- package/dist/cjs/index.js +21 -0
- package/dist/cjs/locale/index.d.ts +91 -0
- package/dist/cjs/locale/index.js +50 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/style.css +260 -0
- package/dist/cjs/types.d.ts +34 -0
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/utils/checkIsExceeded.d.ts +2 -0
- package/dist/cjs/utils/checkIsExceeded.js +5 -0
- package/dist/cjs/utils/formatNumber.d.ts +1 -0
- package/dist/cjs/utils/formatNumber.js +6 -0
- package/dist/cjs/utils/getPercent.d.ts +2 -0
- package/dist/cjs/utils/getPercent.js +9 -0
- package/dist/cjs/utils/index.d.ts +3 -0
- package/dist/cjs/utils/index.js +19 -0
- package/dist/esm/components/QuotaWidget/QuotaIncreaseButton.d.ts +4 -0
- package/dist/esm/components/QuotaWidget/QuotaIncreaseButton.js +9 -0
- package/dist/esm/components/QuotaWidget/QuotaMobileHeader.d.ts +4 -0
- package/dist/esm/components/QuotaWidget/QuotaMobileHeader.js +9 -0
- package/dist/esm/components/QuotaWidget/QuotaWidget.d.ts +12 -0
- package/dist/esm/components/QuotaWidget/QuotaWidget.js +41 -0
- package/dist/esm/components/QuotaWidget/QuotaWidgetContent.d.ts +27 -0
- package/dist/esm/components/QuotaWidget/QuotaWidgetContent.js +27 -0
- package/dist/esm/components/QuotaWidget/components/ProjectHeader/ProjectHeader.d.ts +7 -0
- package/dist/esm/components/QuotaWidget/components/ProjectHeader/ProjectHeader.js +13 -0
- package/dist/esm/components/QuotaWidget/components/ProjectHeader/index.d.ts +1 -0
- package/dist/esm/components/QuotaWidget/components/ProjectHeader/index.js +1 -0
- package/dist/esm/components/QuotaWidget/components/ProjectHeader/styles.module.css +30 -0
- package/dist/esm/components/QuotaWidget/index.d.ts +2 -0
- package/dist/esm/components/QuotaWidget/index.js +2 -0
- package/dist/esm/components/QuotaWidget/styles.module.css +49 -0
- package/dist/esm/components/QuotaWidgetCard/QuotaWidgetCard.d.ts +13 -0
- package/dist/esm/components/QuotaWidgetCard/QuotaWidgetCard.js +47 -0
- package/dist/esm/components/QuotaWidgetCard/components/QuotaTooltip/QuotaTooltip.d.ts +6 -0
- package/dist/esm/components/QuotaWidgetCard/components/QuotaTooltip/QuotaTooltip.js +17 -0
- package/dist/esm/components/QuotaWidgetCard/components/QuotaTooltip/index.d.ts +1 -0
- package/dist/esm/components/QuotaWidgetCard/components/QuotaTooltip/index.js +1 -0
- package/dist/esm/components/QuotaWidgetCard/components/QuotaTooltip/styles.module.css +34 -0
- package/dist/esm/components/QuotaWidgetCard/index.d.ts +1 -0
- package/dist/esm/components/QuotaWidgetCard/index.js +1 -0
- package/dist/esm/components/QuotaWidgetCard/styles.module.css +97 -0
- package/dist/esm/components/QuotaWidgetMini/QuotaWidgetMini.d.ts +7 -0
- package/dist/esm/components/QuotaWidgetMini/QuotaWidgetMini.js +21 -0
- package/dist/esm/components/QuotaWidgetMini/index.d.ts +1 -0
- package/dist/esm/components/QuotaWidgetMini/index.js +1 -0
- package/dist/esm/components/QuotaWidgetMini/styles.module.css +15 -0
- package/dist/esm/components/index.d.ts +3 -0
- package/dist/esm/components/index.js +3 -0
- package/dist/esm/constants.d.ts +17 -0
- package/dist/esm/constants.js +17 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/QuotaCardsGrid.d.ts +6 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/QuotaCardsGrid.js +26 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/Grid.d.ts +6 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/Grid.js +24 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/QuotaCardsSkeleton.d.ts +6 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/QuotaCardsSkeleton.js +10 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/index.d.ts +1 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/index.js +1 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/styles.module.css +10 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/index.d.ts +1 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/index.js +1 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/styles.module.css +9 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/components/QuotaError/QuotaError.d.ts +5 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/components/QuotaError/QuotaError.js +9 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/components/QuotaError/index.d.ts +1 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/components/QuotaError/index.js +1 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/index.d.ts +1 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/index.js +1 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/styles.module.css +16 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/locale/index.d.ts +91 -0
- package/dist/esm/locale/index.js +47 -0
- package/dist/esm/style.css +260 -0
- package/dist/esm/types.d.ts +34 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/utils/checkIsExceeded.d.ts +2 -0
- package/dist/esm/utils/checkIsExceeded.js +1 -0
- package/dist/esm/utils/formatNumber.d.ts +1 -0
- package/dist/esm/utils/formatNumber.js +3 -0
- package/dist/esm/utils/getPercent.d.ts +2 -0
- package/dist/esm/utils/getPercent.js +6 -0
- package/dist/esm/utils/index.d.ts +3 -0
- package/dist/esm/utils/index.js +3 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/package.json +63 -0
- package/src/components/QuotaWidget/QuotaIncreaseButton.tsx +21 -0
- package/src/components/QuotaWidget/QuotaMobileHeader.tsx +18 -0
- package/src/components/QuotaWidget/QuotaWidget.tsx +109 -0
- package/src/components/QuotaWidget/QuotaWidgetContent.tsx +91 -0
- package/src/components/QuotaWidget/components/ProjectHeader/ProjectHeader.tsx +59 -0
- package/src/components/QuotaWidget/components/ProjectHeader/index.ts +1 -0
- package/src/components/QuotaWidget/components/ProjectHeader/styles.module.scss +29 -0
- package/src/components/QuotaWidget/index.ts +2 -0
- package/src/components/QuotaWidget/styles.module.scss +52 -0
- package/src/components/QuotaWidgetCard/QuotaWidgetCard.tsx +127 -0
- package/src/components/QuotaWidgetCard/components/QuotaTooltip/QuotaTooltip.tsx +48 -0
- package/src/components/QuotaWidgetCard/components/QuotaTooltip/index.ts +1 -0
- package/src/components/QuotaWidgetCard/components/QuotaTooltip/styles.module.scss +30 -0
- package/src/components/QuotaWidgetCard/index.ts +1 -0
- package/src/components/QuotaWidgetCard/styles.module.scss +97 -0
- package/src/components/QuotaWidgetMini/QuotaWidgetMini.tsx +93 -0
- package/src/components/QuotaWidgetMini/index.ts +1 -0
- package/src/components/QuotaWidgetMini/styles.module.scss +18 -0
- package/src/components/index.ts +3 -0
- package/src/constants.ts +17 -0
- package/src/helperComponents/QuotaCardsGrid/QuotaCardsGrid.tsx +54 -0
- package/src/helperComponents/QuotaCardsGrid/components/Grid/Grid.tsx +47 -0
- package/src/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/QuotaCardsSkeleton.tsx +24 -0
- package/src/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/index.ts +1 -0
- package/src/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/styles.module.scss +15 -0
- package/src/helperComponents/QuotaCardsGrid/components/Grid/index.ts +1 -0
- package/src/helperComponents/QuotaCardsGrid/components/Grid/styles.module.scss +12 -0
- package/src/helperComponents/QuotaCardsGrid/components/QuotaError/QuotaError.tsx +31 -0
- package/src/helperComponents/QuotaCardsGrid/components/QuotaError/index.ts +1 -0
- package/src/helperComponents/QuotaCardsGrid/index.ts +1 -0
- package/src/helperComponents/QuotaCardsGrid/styles.module.scss +16 -0
- package/src/index.ts +5 -0
- package/src/locale/index.ts +51 -0
- package/src/types.ts +35 -0
- package/src/utils/checkIsExceeded.ts +3 -0
- package/src/utils/formatNumber.ts +3 -0
- package/src/utils/getPercent.ts +9 -0
- 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,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,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,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;
|