@cloud-ru/uikit-product-quota 2.0.14 → 2.0.15-preview-e657b6a5.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/dist/cjs/components/QuotaWidget/QuotaWidget.d.ts +12 -0
- package/dist/cjs/components/QuotaWidget/QuotaWidget.js +44 -0
- package/dist/cjs/components/QuotaWidget/components/ProjectHeader/ProjectHeader.d.ts +7 -0
- package/dist/cjs/components/QuotaWidget/components/ProjectHeader/ProjectHeader.js +17 -0
- package/dist/cjs/components/QuotaWidget/components/ProjectHeader/index.d.ts +1 -0
- package/dist/cjs/components/{QuotaButtonDropdown/components → QuotaWidget/components/ProjectHeader}/index.js +1 -1
- package/dist/cjs/components/QuotaWidget/components/ProjectHeader/styles.module.css +17 -0
- package/dist/cjs/components/QuotaWidget/index.d.ts +1 -0
- package/dist/cjs/components/{QuotaButtonDropdown → QuotaWidget}/index.js +1 -2
- package/dist/cjs/components/QuotaWidget/styles.module.css +9 -0
- package/dist/cjs/components/QuotaWidgetCard/QuotaWidgetCard.d.ts +7 -0
- package/dist/cjs/components/QuotaWidgetCard/QuotaWidgetCard.js +56 -0
- package/dist/cjs/components/QuotaWidgetCard/components/QuotaTooltip/QuotaTooltip.d.ts +6 -0
- package/dist/cjs/components/QuotaWidgetCard/components/QuotaTooltip/QuotaTooltip.js +20 -0
- package/dist/cjs/components/QuotaWidgetCard/components/QuotaTooltip/index.d.ts +1 -0
- package/dist/cjs/components/{QuotaCard/components → QuotaWidgetCard/components/QuotaTooltip}/index.js +1 -3
- package/dist/cjs/components/QuotaWidgetCard/components/QuotaTooltip/styles.module.css +19 -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 +66 -0
- package/dist/cjs/components/QuotaWidgetMini/QuotaWidgetMini.d.ts +7 -0
- package/dist/cjs/components/QuotaWidgetMini/QuotaWidgetMini.js +38 -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 +19 -0
- package/dist/cjs/components/QuotaWidgetMobile/QuotaWidgetMobile.d.ts +9 -0
- package/dist/cjs/components/QuotaWidgetMobile/QuotaWidgetMobile.js +31 -0
- package/dist/cjs/components/QuotaWidgetMobile/index.d.ts +1 -0
- package/dist/cjs/components/QuotaWidgetMobile/index.js +17 -0
- package/dist/cjs/components/index.d.ts +4 -2
- package/dist/cjs/components/index.js +4 -2
- package/dist/cjs/helperComponents/QuotaCardsGrid/QuotaCardsGrid.d.ts +7 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/QuotaCardsGrid.js +28 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/Grid.d.ts +7 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/Grid.js +25 -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 +8 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/index.d.ts +1 -0
- package/dist/cjs/{components/QuotaCard → helperComponents/QuotaCardsGrid/components/Grid}/index.js +1 -1
- package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/styles.module.css +8 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/components/QuotaError/QuotaError.d.ts +5 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/components/QuotaError/QuotaError.js +17 -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 +10 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/types.d.ts +34 -1
- 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 +2 -0
- package/dist/cjs/utils/index.js +18 -0
- package/dist/esm/components/QuotaWidget/QuotaWidget.d.ts +12 -0
- package/dist/esm/components/QuotaWidget/QuotaWidget.js +38 -0
- package/dist/esm/components/QuotaWidget/components/ProjectHeader/ProjectHeader.d.ts +7 -0
- package/dist/esm/components/QuotaWidget/components/ProjectHeader/ProjectHeader.js +11 -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 +17 -0
- package/dist/esm/components/QuotaWidget/index.d.ts +1 -0
- package/dist/esm/components/QuotaWidget/index.js +1 -0
- package/dist/esm/components/QuotaWidget/styles.module.css +9 -0
- package/dist/esm/components/QuotaWidgetCard/QuotaWidgetCard.d.ts +7 -0
- package/dist/esm/components/QuotaWidgetCard/QuotaWidgetCard.js +50 -0
- package/dist/esm/components/QuotaWidgetCard/components/QuotaTooltip/QuotaTooltip.d.ts +6 -0
- package/dist/esm/components/QuotaWidgetCard/components/QuotaTooltip/QuotaTooltip.js +14 -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 +19 -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 +66 -0
- package/dist/esm/components/QuotaWidgetMini/QuotaWidgetMini.d.ts +7 -0
- package/dist/esm/components/QuotaWidgetMini/QuotaWidgetMini.js +32 -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 +19 -0
- package/dist/esm/components/QuotaWidgetMobile/QuotaWidgetMobile.d.ts +9 -0
- package/dist/esm/components/QuotaWidgetMobile/QuotaWidgetMobile.js +28 -0
- package/dist/esm/components/QuotaWidgetMobile/index.d.ts +1 -0
- package/dist/esm/components/QuotaWidgetMobile/index.js +1 -0
- package/dist/esm/components/index.d.ts +4 -2
- package/dist/esm/components/index.js +4 -2
- package/dist/esm/helperComponents/QuotaCardsGrid/QuotaCardsGrid.d.ts +7 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/QuotaCardsGrid.js +22 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/Grid.d.ts +7 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/Grid.js +19 -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 +8 -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 +8 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/components/QuotaError/QuotaError.d.ts +5 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/components/QuotaError/QuotaError.js +14 -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 +10 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/types.d.ts +34 -1
- 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 +2 -0
- package/dist/esm/utils/index.js +2 -0
- package/package.json +12 -4
- package/src/components/QuotaWidget/QuotaWidget.tsx +97 -0
- package/src/components/QuotaWidget/components/ProjectHeader/ProjectHeader.tsx +48 -0
- package/src/components/QuotaWidget/components/ProjectHeader/index.ts +1 -0
- package/src/components/QuotaWidget/components/ProjectHeader/styles.module.scss +18 -0
- package/src/components/QuotaWidget/index.ts +1 -0
- package/src/components/QuotaWidget/styles.module.scss +11 -0
- package/src/components/QuotaWidgetCard/QuotaWidgetCard.tsx +76 -0
- package/src/components/QuotaWidgetCard/components/QuotaTooltip/QuotaTooltip.tsx +41 -0
- package/src/components/QuotaWidgetCard/components/QuotaTooltip/index.ts +1 -0
- package/src/components/QuotaWidgetCard/components/QuotaTooltip/styles.module.scss +20 -0
- package/src/components/QuotaWidgetCard/index.ts +1 -0
- package/src/components/QuotaWidgetCard/styles.module.scss +65 -0
- package/src/components/QuotaWidgetMini/QuotaWidgetMini.tsx +94 -0
- package/src/components/QuotaWidgetMini/index.ts +1 -0
- package/src/components/QuotaWidgetMini/styles.module.scss +20 -0
- package/src/components/QuotaWidgetMobile/QuotaWidgetMobile.tsx +63 -0
- package/src/components/QuotaWidgetMobile/index.ts +1 -0
- package/src/components/index.ts +4 -2
- package/src/helperComponents/QuotaCardsGrid/QuotaCardsGrid.tsx +55 -0
- package/src/helperComponents/QuotaCardsGrid/components/Grid/Grid.tsx +37 -0
- package/src/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/QuotaCardsSkeleton.tsx +25 -0
- package/src/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/index.ts +1 -0
- package/src/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/styles.module.scss +10 -0
- package/src/helperComponents/QuotaCardsGrid/components/Grid/index.ts +1 -0
- package/src/helperComponents/QuotaCardsGrid/components/Grid/styles.module.scss +11 -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 +12 -0
- package/src/index.ts +1 -0
- package/src/types.ts +35 -1
- 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 +2 -0
- package/dist/cjs/components/QuotaButtonDropdown/QuotaDropdown.d.ts +0 -24
- package/dist/cjs/components/QuotaButtonDropdown/QuotaDropdown.js +0 -36
- package/dist/cjs/components/QuotaButtonDropdown/components/NoData.d.ts +0 -5
- package/dist/cjs/components/QuotaButtonDropdown/components/NoData.js +0 -15
- package/dist/cjs/components/QuotaButtonDropdown/components/QuotaDropdownContent.d.ts +0 -2
- package/dist/cjs/components/QuotaButtonDropdown/components/QuotaDropdownContent.js +0 -24
- package/dist/cjs/components/QuotaButtonDropdown/components/QuotaDropdownLayout.d.ts +0 -2
- package/dist/cjs/components/QuotaButtonDropdown/components/QuotaDropdownLayout.js +0 -13
- package/dist/cjs/components/QuotaButtonDropdown/components/index.d.ts +0 -1
- package/dist/cjs/components/QuotaButtonDropdown/index.d.ts +0 -2
- package/dist/cjs/components/QuotaButtonDropdown/styles.module.css +0 -106
- package/dist/cjs/components/QuotaCard/QuotaCard.d.ts +0 -22
- package/dist/cjs/components/QuotaCard/QuotaCard.js +0 -48
- package/dist/cjs/components/QuotaCard/components/DataRow.d.ts +0 -9
- package/dist/cjs/components/QuotaCard/components/DataRow.js +0 -13
- package/dist/cjs/components/QuotaCard/components/DataSkeleton.d.ts +0 -1
- package/dist/cjs/components/QuotaCard/components/DataSkeleton.js +0 -12
- package/dist/cjs/components/QuotaCard/components/NoData.d.ts +0 -5
- package/dist/cjs/components/QuotaCard/components/NoData.js +0 -15
- package/dist/cjs/components/QuotaCard/components/QuotaCardLayout.d.ts +0 -10
- package/dist/cjs/components/QuotaCard/components/QuotaCardLayout.js +0 -27
- package/dist/cjs/components/QuotaCard/components/index.d.ts +0 -3
- package/dist/cjs/components/QuotaCard/index.d.ts +0 -1
- package/dist/cjs/components/QuotaCard/styles.module.css +0 -106
- package/dist/cjs/utils.d.ts +0 -1
- package/dist/cjs/utils.js +0 -5
- package/dist/esm/components/QuotaButtonDropdown/QuotaDropdown.d.ts +0 -24
- package/dist/esm/components/QuotaButtonDropdown/QuotaDropdown.js +0 -33
- package/dist/esm/components/QuotaButtonDropdown/components/NoData.d.ts +0 -5
- package/dist/esm/components/QuotaButtonDropdown/components/NoData.js +0 -9
- package/dist/esm/components/QuotaButtonDropdown/components/QuotaDropdownContent.d.ts +0 -2
- package/dist/esm/components/QuotaButtonDropdown/components/QuotaDropdownContent.js +0 -21
- package/dist/esm/components/QuotaButtonDropdown/components/QuotaDropdownLayout.d.ts +0 -2
- package/dist/esm/components/QuotaButtonDropdown/components/QuotaDropdownLayout.js +0 -7
- package/dist/esm/components/QuotaButtonDropdown/components/index.d.ts +0 -1
- package/dist/esm/components/QuotaButtonDropdown/components/index.js +0 -1
- package/dist/esm/components/QuotaButtonDropdown/index.d.ts +0 -2
- package/dist/esm/components/QuotaButtonDropdown/index.js +0 -2
- package/dist/esm/components/QuotaButtonDropdown/styles.module.css +0 -106
- package/dist/esm/components/QuotaCard/QuotaCard.d.ts +0 -22
- package/dist/esm/components/QuotaCard/QuotaCard.js +0 -42
- package/dist/esm/components/QuotaCard/components/DataRow.d.ts +0 -9
- package/dist/esm/components/QuotaCard/components/DataRow.js +0 -7
- package/dist/esm/components/QuotaCard/components/DataSkeleton.d.ts +0 -1
- package/dist/esm/components/QuotaCard/components/DataSkeleton.js +0 -6
- package/dist/esm/components/QuotaCard/components/NoData.d.ts +0 -5
- package/dist/esm/components/QuotaCard/components/NoData.js +0 -9
- package/dist/esm/components/QuotaCard/components/QuotaCardLayout.d.ts +0 -10
- package/dist/esm/components/QuotaCard/components/QuotaCardLayout.js +0 -21
- package/dist/esm/components/QuotaCard/components/index.d.ts +0 -3
- package/dist/esm/components/QuotaCard/components/index.js +0 -3
- package/dist/esm/components/QuotaCard/index.d.ts +0 -1
- package/dist/esm/components/QuotaCard/index.js +0 -1
- package/dist/esm/components/QuotaCard/styles.module.css +0 -106
- package/dist/esm/utils.d.ts +0 -1
- package/dist/esm/utils.js +0 -1
- package/src/components/QuotaButtonDropdown/QuotaDropdown.tsx +0 -72
- package/src/components/QuotaButtonDropdown/components/NoData.tsx +0 -20
- package/src/components/QuotaButtonDropdown/components/QuotaDropdownContent.tsx +0 -16
- package/src/components/QuotaButtonDropdown/components/QuotaDropdownLayout.tsx +0 -28
- package/src/components/QuotaButtonDropdown/components/index.ts +0 -1
- package/src/components/QuotaButtonDropdown/index.ts +0 -2
- package/src/components/QuotaButtonDropdown/styles.module.scss +0 -106
- package/src/components/QuotaCard/QuotaCard.tsx +0 -102
- package/src/components/QuotaCard/components/DataRow.tsx +0 -31
- package/src/components/QuotaCard/components/DataSkeleton.tsx +0 -12
- package/src/components/QuotaCard/components/NoData.tsx +0 -20
- package/src/components/QuotaCard/components/QuotaCardLayout.tsx +0 -29
- package/src/components/QuotaCard/components/index.ts +0 -3
- package/src/components/QuotaCard/index.ts +0 -1
- package/src/components/QuotaCard/styles.module.scss +0 -109
- package/src/utils.ts +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { WithSupportProps } from '@cloud-ru/uikit-product-utils';
|
|
2
|
+
import { ButtonFunctionProps } from '@snack-uikit/button';
|
|
3
|
+
import { QuotaWidgetPropsBase } from '../../types';
|
|
4
|
+
export type QuotaWidgetProps = WithSupportProps<QuotaWidgetPropsBase & {
|
|
5
|
+
/** Ссылка на страницу квот по проекту */
|
|
6
|
+
quotasUrl: string;
|
|
7
|
+
/** Колбек клика по ссылке на страницу квот по проекту */
|
|
8
|
+
onQuotasUrlClick?: () => void;
|
|
9
|
+
/** Свойства кнопки открытия виджета */
|
|
10
|
+
buttonProps?: Pick<ButtonFunctionProps, 'size' | 'className' | 'fullWidth' | 'label' | 'appearance' | 'disabled'>;
|
|
11
|
+
}>;
|
|
12
|
+
export declare function QuotaWidget({ quotas, disableSorting, isLoading, isError, 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
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.QuotaWidget = QuotaWidget;
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const react_1 = require("react");
|
|
20
|
+
const uikit_product_locale_1 = require("@cloud-ru/uikit-product-locale");
|
|
21
|
+
const button_1 = require("@snack-uikit/button");
|
|
22
|
+
const dropdown_1 = require("@snack-uikit/dropdown");
|
|
23
|
+
const icons_1 = require("@snack-uikit/icons");
|
|
24
|
+
const QuotaCardsGrid_1 = require("../../helperComponents/QuotaCardsGrid");
|
|
25
|
+
const ProjectHeader_1 = require("./components/ProjectHeader");
|
|
26
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
27
|
+
function QuotaWidget(_a) {
|
|
28
|
+
var { quotas, disableSorting, isLoading, isError, onRefresh, projectName, quotasUrl, canEditQuota, hideIncreaseQuotaButton, onIncreaseQuotaClick, onWidgetOpen, onQuotasUrlClick, buttonProps } = _a, props = __rest(_a, ["quotas", "disableSorting", "isLoading", "isError", "onRefresh", "projectName", "quotasUrl", "canEditQuota", "hideIncreaseQuotaButton", "onIncreaseQuotaClick", "onWidgetOpen", "onQuotasUrlClick", "buttonProps"]);
|
|
29
|
+
const { t } = (0, uikit_product_locale_1.useLocale)('Quota');
|
|
30
|
+
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
31
|
+
const handleOpenChange = (open) => {
|
|
32
|
+
setIsOpen(open);
|
|
33
|
+
if (open) {
|
|
34
|
+
onWidgetOpen === null || onWidgetOpen === void 0 ? void 0 : onWidgetOpen();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const exhaustedCount = quotas.filter(item => item.remains === 0).length;
|
|
38
|
+
return ((0, jsx_runtime_1.jsx)(dropdown_1.Dropdown, Object.assign({}, props, { placement: 'bottom-end', open: isOpen, onOpenChange: handleOpenChange, content: (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.content, children: [(0, jsx_runtime_1.jsx)(ProjectHeader_1.ProjectHeader, { projectName: projectName, quotasUrl: quotasUrl, canEditQuota: canEditQuota, isError: isError, onIncreaseQuotaClick: onIncreaseQuotaClick, hideIncreaseQuotaButton: hideIncreaseQuotaButton, onQuotasUrlClick: onQuotasUrlClick }), (0, jsx_runtime_1.jsx)(QuotaCardsGrid_1.QuotaCardsGrid, { quotas: quotas, disableSorting: disableSorting, isLoading: isLoading, isError: isError, onRefresh: onRefresh })] }), children: (0, jsx_runtime_1.jsx)(button_1.ButtonFunction, Object.assign({ label: t('quotas'), icon: isOpen ? (0, jsx_runtime_1.jsx)(icons_1.ChevronUpSVG, {}) : (0, jsx_runtime_1.jsx)(icons_1.ChevronDownSVG, {}), counter: exhaustedCount > 0
|
|
39
|
+
? {
|
|
40
|
+
value: exhaustedCount,
|
|
41
|
+
appearance: 'red',
|
|
42
|
+
}
|
|
43
|
+
: undefined, size: 's' }, buttonProps)) })));
|
|
44
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { QuotaWidgetPropsBase } from '../../../../types';
|
|
2
|
+
type ProjectHeaderProps = Pick<QuotaWidgetPropsBase, 'projectName' | 'canEditQuota' | 'isError' | 'hideIncreaseQuotaButton' | 'onIncreaseQuotaClick'> & {
|
|
3
|
+
quotasUrl: string;
|
|
4
|
+
onQuotasUrlClick?: () => void;
|
|
5
|
+
};
|
|
6
|
+
export declare function ProjectHeader({ projectName, quotasUrl, canEditQuota, isError, onIncreaseQuotaClick, hideIncreaseQuotaButton, onQuotasUrlClick, }: ProjectHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
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 uikit_product_icons_1 = require("@cloud-ru/uikit-product-icons");
|
|
9
|
+
const uikit_product_locale_1 = require("@cloud-ru/uikit-product-locale");
|
|
10
|
+
const uikit_product_title_clickable_1 = require("@cloud-ru/uikit-product-title-clickable");
|
|
11
|
+
const button_1 = require("@snack-uikit/button");
|
|
12
|
+
const typography_1 = require("@snack-uikit/typography");
|
|
13
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
14
|
+
function ProjectHeader({ projectName, quotasUrl, canEditQuota, isError, onIncreaseQuotaClick, hideIncreaseQuotaButton, onQuotasUrlClick, }) {
|
|
15
|
+
const { t } = (0, uikit_product_locale_1.useLocale)('Quota');
|
|
16
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.header, 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, { title: projectName, href: quotasUrl, target: '_blank', icon: uikit_product_icons_1.CloudFolderSVG, onClick: onQuotasUrlClick }), (0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyS, { className: styles_module_scss_1.default.subtitle, children: t('widgetSubtitle') })] }), canEditQuota && !isError && !hideIncreaseQuotaButton && ((0, jsx_runtime_1.jsx)(button_1.ButtonOutline, { appearance: 'neutral', label: t('increaseQuota'), size: 's', onClick: onIncreaseQuotaClick }))] }));
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ProjectHeader';
|
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./ProjectHeader"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
.header{
|
|
2
|
+
display:grid;
|
|
3
|
+
grid-template-columns:minmax(0, 1fr) 128px;
|
|
4
|
+
align-items:center;
|
|
5
|
+
justify-content:space-between;
|
|
6
|
+
-moz-column-gap:12px;
|
|
7
|
+
column-gap:12px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.projectWrapper{
|
|
11
|
+
min-width:0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.subtitle{
|
|
15
|
+
display:block;
|
|
16
|
+
color:var(--sys-neutral-text-light, #8b8e9b);
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './QuotaWidget';
|
|
@@ -14,5 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./components/QuotaDropdownContent"), exports);
|
|
17
|
+
__exportStar(require("./QuotaWidget"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { WithSupportProps } from '@cloud-ru/uikit-product-utils';
|
|
2
|
+
import { QuotaItem } from '../../types';
|
|
3
|
+
export type QuotaWidgetCardProps = WithSupportProps<{
|
|
4
|
+
/** Отображаемая квота */
|
|
5
|
+
quota: QuotaItem;
|
|
6
|
+
}>;
|
|
7
|
+
export declare function QuotaWidgetCard({ quota, ...props }: QuotaWidgetCardProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.QuotaWidgetCard = QuotaWidgetCard;
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const uikit_product_locale_1 = require("@cloud-ru/uikit-product-locale");
|
|
20
|
+
const progress_bar_1 = require("@snack-uikit/progress-bar");
|
|
21
|
+
const tooltip_1 = require("@snack-uikit/tooltip");
|
|
22
|
+
const truncate_string_1 = require("@snack-uikit/truncate-string");
|
|
23
|
+
const typography_1 = require("@snack-uikit/typography");
|
|
24
|
+
const formatNumber_1 = require("../../utils/formatNumber");
|
|
25
|
+
const getPercent_1 = require("../../utils/getPercent");
|
|
26
|
+
const QuotaTooltip_1 = require("./components/QuotaTooltip");
|
|
27
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
28
|
+
const QUOTA_USAGE_PROGRESS = {
|
|
29
|
+
HIGH: 90,
|
|
30
|
+
MEDIUM: 70,
|
|
31
|
+
};
|
|
32
|
+
function getProgressAppearance(percent) {
|
|
33
|
+
if (percent >= QUOTA_USAGE_PROGRESS.HIGH) {
|
|
34
|
+
return 'red';
|
|
35
|
+
}
|
|
36
|
+
else if (percent >= QUOTA_USAGE_PROGRESS.MEDIUM) {
|
|
37
|
+
return 'orange';
|
|
38
|
+
}
|
|
39
|
+
return 'green';
|
|
40
|
+
}
|
|
41
|
+
function QuotaWidgetCard(_a) {
|
|
42
|
+
var { quota } = _a, props = __rest(_a, ["quota"]);
|
|
43
|
+
const { t } = (0, uikit_product_locale_1.useLocale)('Quota');
|
|
44
|
+
const percent = (0, getPercent_1.getPercent)(quota);
|
|
45
|
+
const rows = [
|
|
46
|
+
{
|
|
47
|
+
label: t('cardAvailable'),
|
|
48
|
+
value: quota.limit,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: t('cardRemaining'),
|
|
52
|
+
value: quota.remains,
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
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", Object.assign({ className: styles_module_scss_1.default.card, "data-exhausted": quota.remains === 0 }, props, { children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.header, children: [(0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyM, { 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)(typography_1.Typography.SansLabelM, { className: styles_module_scss_1.default.percent, children: [(0, formatNumber_1.formatNumber)(percent), "%"] })] }), (0, jsx_runtime_1.jsx)(progress_bar_1.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)(typography_1.Typography.SansLabelM, { className: styles_module_scss_1.default.label, children: row.label }), (0, jsx_runtime_1.jsxs)(typography_1.Typography.SansLabelL, { className: styles_module_scss_1.default.value, children: [(0, formatNumber_1.formatNumber)(row.value), " ", (0, jsx_runtime_1.jsx)("span", { className: styles_module_scss_1.default.unit, children: quota.unitDisplayName })] })] }, row.label))) })] })) }));
|
|
56
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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 uikit_product_locale_1 = require("@cloud-ru/uikit-product-locale");
|
|
9
|
+
const typography_1 = require("@snack-uikit/typography");
|
|
10
|
+
const formatNumber_1 = require("../../../../utils/formatNumber");
|
|
11
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
12
|
+
function QuotaTooltip({ quota }) {
|
|
13
|
+
const { t } = (0, uikit_product_locale_1.useLocale)('Quota');
|
|
14
|
+
const rows = [
|
|
15
|
+
{ label: t('tooltipAvailable'), value: quota.limit },
|
|
16
|
+
{ label: t('tooltipUsed'), value: quota.usage },
|
|
17
|
+
{ label: t('tooltipRemaining'), value: quota.remains },
|
|
18
|
+
];
|
|
19
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.content, children: [rows.map(row => ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.row, children: [(0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyS, { children: row.label }), (0, jsx_runtime_1.jsxs)(typography_1.Typography.SansBodyS, { children: [(0, formatNumber_1.formatNumber)(row.value), " ", quota.unitDisplayName] })] }, row.label))), quota.remains === 0 && ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.exhausted, children: [(0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyS, { tag: 'div', children: t('tooltipExhaustedHint.first') }), (0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyS, { tag: 'div', children: t('tooltipExhaustedHint.second') })] }))] }));
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './QuotaTooltip';
|
|
@@ -14,6 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./NoData"), exports);
|
|
19
|
-
__exportStar(require("./DataRow"), exports);
|
|
17
|
+
__exportStar(require("./QuotaTooltip"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.content{
|
|
2
|
+
display:flex;
|
|
3
|
+
flex-direction:column;
|
|
4
|
+
gap:4px;
|
|
5
|
+
width:216px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.row{
|
|
9
|
+
display:flex;
|
|
10
|
+
justify-content:space-between;
|
|
11
|
+
-moz-column-gap:8px;
|
|
12
|
+
column-gap:8px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.exhausted{
|
|
16
|
+
margin-top:8px;
|
|
17
|
+
padding-top:8px;
|
|
18
|
+
border-top:1px solid var(--sys-neutral-decor-default, #dde0ea);
|
|
19
|
+
}
|
|
@@ -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,66 @@
|
|
|
1
|
+
.tooltip{
|
|
2
|
+
display:block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.card{
|
|
6
|
+
display:flex;
|
|
7
|
+
flex-direction:column;
|
|
8
|
+
row-gap:4px;
|
|
9
|
+
padding:8px;
|
|
10
|
+
background-color:var(--sys-neutral-background-opacity, rgba(238, 239, 243, 0.5019607843));
|
|
11
|
+
border-radius:4px;
|
|
12
|
+
height:-webkit-fill-available;
|
|
13
|
+
height:-moz-available;
|
|
14
|
+
height:stretch;
|
|
15
|
+
}
|
|
16
|
+
.card[data-exhausted=true]{
|
|
17
|
+
background-color:var(--sys-red-background, #fdf1ef);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.header{
|
|
21
|
+
display:flex;
|
|
22
|
+
align-items:flex-end;
|
|
23
|
+
justify-content:space-between;
|
|
24
|
+
-moz-column-gap:4px;
|
|
25
|
+
column-gap:4px;
|
|
26
|
+
flex:1;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.title{
|
|
30
|
+
color:var(--sys-neutral-text-main, #41424e);
|
|
31
|
+
align-self:flex-start;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.percent[data-family=sans][data-purpose=label][data-size=m]{
|
|
35
|
+
font-weight:400;
|
|
36
|
+
color:var(--sys-neutral-text-light, #8b8e9b);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.info{
|
|
40
|
+
display:flex;
|
|
41
|
+
flex-direction:column;
|
|
42
|
+
row-gap:2px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.row{
|
|
46
|
+
display:flex;
|
|
47
|
+
align-items:center;
|
|
48
|
+
justify-content:space-between;
|
|
49
|
+
-moz-column-gap:8px;
|
|
50
|
+
column-gap:8px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.label[data-family=sans][data-purpose=label][data-size=m]{
|
|
54
|
+
color:var(--sys-neutral-text-light, #8b8e9b);
|
|
55
|
+
font-weight:400;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.value[data-family=sans][data-purpose=label][data-size=l]{
|
|
59
|
+
color:var(--sys-neutral-text-main, #41424e);
|
|
60
|
+
white-space:nowrap;
|
|
61
|
+
font-weight:400;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.unit{
|
|
65
|
+
color:var(--sys-neutral-text-light, #8b8e9b);
|
|
66
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { WithSupportProps } from '@cloud-ru/uikit-product-utils';
|
|
2
|
+
import { QuotaWidgetPropsBase } from '../../types';
|
|
3
|
+
export type QuotaWidgetMiniProps = WithSupportProps<QuotaWidgetPropsBase & {
|
|
4
|
+
/** Флаг раскрытия аккордиона по умолчанию */
|
|
5
|
+
isExpandedDefault?: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
export declare function QuotaWidgetMini({ quotas, disableSorting, isLoading, isError, onRefresh, projectName, canEditQuota, isExpandedDefault, hideIncreaseQuotaButton, onIncreaseQuotaClick, onWidgetOpen, ...props }: QuotaWidgetMiniProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.QuotaWidgetMini = QuotaWidgetMini;
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const uikit_product_locale_1 = require("@cloud-ru/uikit-product-locale");
|
|
20
|
+
const accordion_1 = require("@snack-uikit/accordion");
|
|
21
|
+
const button_1 = require("@snack-uikit/button");
|
|
22
|
+
const counter_1 = require("@snack-uikit/counter");
|
|
23
|
+
const truncate_string_1 = require("@snack-uikit/truncate-string");
|
|
24
|
+
const typography_1 = require("@snack-uikit/typography");
|
|
25
|
+
const QuotaCardsGrid_1 = require("../../helperComponents/QuotaCardsGrid");
|
|
26
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
27
|
+
const ACCORDION_ID = 'quotas-widget-accordion';
|
|
28
|
+
function QuotaWidgetMini(_a) {
|
|
29
|
+
var { quotas, disableSorting, isLoading, isError, onRefresh, projectName, canEditQuota, isExpandedDefault, hideIncreaseQuotaButton, onIncreaseQuotaClick, onWidgetOpen } = _a, props = __rest(_a, ["quotas", "disableSorting", "isLoading", "isError", "onRefresh", "projectName", "canEditQuota", "isExpandedDefault", "hideIncreaseQuotaButton", "onIncreaseQuotaClick", "onWidgetOpen"]);
|
|
30
|
+
const { t } = (0, uikit_product_locale_1.useLocale)('Quota');
|
|
31
|
+
const exhaustedCount = quotas.filter(item => item.remains === 0).length;
|
|
32
|
+
const handleExpandedChange = (expanded) => {
|
|
33
|
+
if (expanded) {
|
|
34
|
+
onWidgetOpen === null || onWidgetOpen === void 0 ? void 0 : onWidgetOpen();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)(accordion_1.AccordionPrimary, Object.assign({}, props, { expandedDefault: isExpandedDefault ? ACCORDION_ID : undefined, onExpandedChange: handleExpandedChange, children: (0, jsx_runtime_1.jsxs)(accordion_1.AccordionPrimary.CollapseBlock, { id: ACCORDION_ID, className: styles_module_scss_1.default.collapse, header: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.title, children: [(0, jsx_runtime_1.jsx)(typography_1.Typography.SansTitleM, { children: (0, jsx_runtime_1.jsx)(truncate_string_1.TruncateString, { maxLines: 1, text: t('quotas') }) }), exhaustedCount > 0 && (0, jsx_runtime_1.jsx)(counter_1.Counter, { value: exhaustedCount, size: 's', appearance: 'red' })] }), (0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyM, { className: styles_module_scss_1.default.subtitle, children: (0, jsx_runtime_1.jsx)(truncate_string_1.TruncateString, { maxLines: 1, text: projectName }) })] }), children: [(0, jsx_runtime_1.jsx)(QuotaCardsGrid_1.QuotaCardsGrid, { isAccordion: true, quotas: quotas, disableSorting: disableSorting, isLoading: isLoading, isError: isError, onRefresh: onRefresh, isMobile: true }), !isError && canEditQuota && !hideIncreaseQuotaButton && ((0, jsx_runtime_1.jsx)(button_1.ButtonOutline, { className: styles_module_scss_1.default.button, fullWidth: true, appearance: 'neutral', label: t('increaseQuota'), size: 's', onClick: onIncreaseQuotaClick }))] }) })));
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './QuotaWidgetMini';
|
|
@@ -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("./QuotaWidgetMini"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.collapse{
|
|
2
|
+
padding:16px 24px;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.title{
|
|
6
|
+
display:flex;
|
|
7
|
+
align-items:center;
|
|
8
|
+
-moz-column-gap:4px;
|
|
9
|
+
column-gap:4px;
|
|
10
|
+
color:var(--sys-neutral-text-main, #41424e);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.subtitle{
|
|
14
|
+
color:var(--sys-neutral-text-support, #6d707f);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.button{
|
|
18
|
+
margin-top:12px;
|
|
19
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { WithSupportProps } from '@cloud-ru/uikit-product-utils';
|
|
2
|
+
import { QuotaWidgetPropsBase } from '../../types';
|
|
3
|
+
export type QuotaWidgetMobileProps = WithSupportProps<QuotaWidgetPropsBase & {
|
|
4
|
+
/** Флаг открытия модального окна */
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
/** Колбек на закрытие модального окна */
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
}>;
|
|
9
|
+
export declare function QuotaWidgetMobile({ quotas, disableSorting, isLoading, isError, onRefresh, projectName, canEditQuota, isOpen, onClose, onIncreaseQuotaClick, hideIncreaseQuotaButton, ...props }: QuotaWidgetMobileProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.QuotaWidgetMobile = QuotaWidgetMobile;
|
|
15
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
const uikit_product_locale_1 = require("@cloud-ru/uikit-product-locale");
|
|
17
|
+
const uikit_product_mobile_modal_1 = require("@cloud-ru/uikit-product-mobile-modal");
|
|
18
|
+
const QuotaCardsGrid_1 = require("../../helperComponents/QuotaCardsGrid");
|
|
19
|
+
function QuotaWidgetMobile(_a) {
|
|
20
|
+
var { quotas, disableSorting, isLoading, isError, onRefresh, projectName, canEditQuota, isOpen, onClose, onIncreaseQuotaClick, hideIncreaseQuotaButton } = _a, props = __rest(_a, ["quotas", "disableSorting", "isLoading", "isError", "onRefresh", "projectName", "canEditQuota", "isOpen", "onClose", "onIncreaseQuotaClick", "hideIncreaseQuotaButton"]);
|
|
21
|
+
const { t } = (0, uikit_product_locale_1.useLocale)('Quota');
|
|
22
|
+
return (
|
|
23
|
+
// @ts-expect-error no approve button needed
|
|
24
|
+
(0, jsx_runtime_1.jsx)(uikit_product_mobile_modal_1.MobileModal, Object.assign({}, props, { closeButtonEnabled: true, open: isOpen, onClose: onClose, title: t('quotas'), subtitle: projectName, cancelButton: isError || !canEditQuota || hideIncreaseQuotaButton
|
|
25
|
+
? undefined
|
|
26
|
+
: {
|
|
27
|
+
appearance: 'neutral',
|
|
28
|
+
label: t('increaseQuota'),
|
|
29
|
+
onClick: onIncreaseQuotaClick,
|
|
30
|
+
}, content: (0, jsx_runtime_1.jsx)(QuotaCardsGrid_1.QuotaCardsGrid, { quotas: quotas, disableSorting: disableSorting, isLoading: isLoading, isError: isError, onRefresh: onRefresh, isMobile: true }) })));
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './QuotaWidgetMobile';
|
|
@@ -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("./QuotaWidgetMobile"), exports);
|
|
@@ -14,5 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./QuotaWidget"), exports);
|
|
18
|
+
__exportStar(require("./QuotaWidgetMini"), exports);
|
|
19
|
+
__exportStar(require("./QuotaWidgetMobile"), exports);
|
|
20
|
+
__exportStar(require("./QuotaWidgetCard"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { QuotaWidgetPropsBase } from '../../types';
|
|
2
|
+
type QuotaCardsGridProps = Pick<QuotaWidgetPropsBase, 'quotas' | 'disableSorting' | 'isLoading' | 'isError' | 'onRefresh'> & {
|
|
3
|
+
isAccordion?: boolean;
|
|
4
|
+
isMobile?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare function QuotaCardsGrid({ quotas, isLoading, isError, onRefresh, disableSorting, isAccordion, isMobile, }: QuotaCardsGridProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
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.QuotaCardsGrid = QuotaCardsGrid;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const scroll_1 = require("@snack-uikit/scroll");
|
|
9
|
+
const Grid_1 = require("./components/Grid");
|
|
10
|
+
const QuotaError_1 = require("./components/QuotaError");
|
|
11
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
12
|
+
function QuotaCardsGrid({ quotas, isLoading, isError, onRefresh, disableSorting = false, isAccordion = false, isMobile = false, }) {
|
|
13
|
+
const wrapperAttributes = {
|
|
14
|
+
className: styles_module_scss_1.default.wrapper,
|
|
15
|
+
'data-accordion': isAccordion,
|
|
16
|
+
};
|
|
17
|
+
const gridProps = {
|
|
18
|
+
quotas,
|
|
19
|
+
isLoading,
|
|
20
|
+
disableSorting,
|
|
21
|
+
isAccordion,
|
|
22
|
+
isMobile,
|
|
23
|
+
};
|
|
24
|
+
if (isError) {
|
|
25
|
+
return isMobile ? ((0, jsx_runtime_1.jsx)(QuotaError_1.QuotaError, { onRefresh: onRefresh })) : ((0, jsx_runtime_1.jsx)("div", Object.assign({}, wrapperAttributes, { children: (0, jsx_runtime_1.jsx)(QuotaError_1.QuotaError, { onRefresh: onRefresh }) })));
|
|
26
|
+
}
|
|
27
|
+
return isMobile ? ((0, jsx_runtime_1.jsx)(Grid_1.Grid, Object.assign({}, gridProps))) : ((0, jsx_runtime_1.jsx)(scroll_1.Scroll, Object.assign({}, wrapperAttributes, { size: 's', children: (0, jsx_runtime_1.jsx)(Grid_1.Grid, Object.assign({}, gridProps)) })));
|
|
28
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { QuotaWidgetPropsBase } from '../../../../types';
|
|
2
|
+
type GridProps = Pick<QuotaWidgetPropsBase, 'quotas' | 'isLoading' | 'disableSorting'> & {
|
|
3
|
+
isAccordion?: boolean;
|
|
4
|
+
isMobile?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare function Grid({ quotas, isLoading, disableSorting, isAccordion, isMobile }: GridProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
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.Grid = Grid;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const QuotaWidgetCard_1 = require("../../../../components/QuotaWidgetCard");
|
|
9
|
+
const getPercent_1 = require("../../../../utils/getPercent");
|
|
10
|
+
const QuotaWidgetCardsSkeleton_1 = require("./components/QuotaWidgetCardsSkeleton");
|
|
11
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
12
|
+
function sortQuotas(quotas) {
|
|
13
|
+
return [...quotas].sort((first, second) => {
|
|
14
|
+
const percentFirst = (0, getPercent_1.getPercent)(first);
|
|
15
|
+
const percentSecond = (0, getPercent_1.getPercent)(second);
|
|
16
|
+
if (percentSecond !== percentFirst) {
|
|
17
|
+
return percentSecond - percentFirst;
|
|
18
|
+
}
|
|
19
|
+
return first.name.localeCompare(second.name);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function Grid({ quotas, isLoading, disableSorting = false, isAccordion = false, isMobile = false }) {
|
|
23
|
+
const sortedQuotas = disableSorting ? quotas : sortQuotas(quotas);
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.grid, "data-single": (quotas.length <= 1 && !isLoading) || isMobile || isAccordion, children: (0, jsx_runtime_1.jsx)(QuotaWidgetCardsSkeleton_1.QuotaWidgetCardsSkeleton, { isLoading: isLoading, children: sortedQuotas.map((quota, index) => ((0, jsx_runtime_1.jsx)(QuotaWidgetCard_1.QuotaWidgetCard, { quota: quota }, index))) }) }));
|
|
25
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
type QuotaWidgetCardsSkeletonProps = PropsWithChildren<{
|
|
3
|
+
isLoading: boolean;
|
|
4
|
+
}>;
|
|
5
|
+
export declare function QuotaWidgetCardsSkeleton({ isLoading, children }: QuotaWidgetCardsSkeletonProps): string | number | boolean | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element[] | null | undefined;
|
|
6
|
+
export {};
|