@cloud-ru/uikit-product-quota 2.0.13 → 2.0.14-preview-9cd6156d.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/QuotaButtonDropdown/QuotaDropdown.d.ts +3 -0
- package/dist/cjs/components/QuotaButtonDropdown/QuotaDropdown.js +3 -0
- package/dist/cjs/components/QuotaCard/QuotaCard.d.ts +3 -0
- package/dist/cjs/components/QuotaCard/QuotaCard.js +3 -0
- package/dist/cjs/components/QuotaWidgetCard/QuotaWidgetCard.d.ts +6 -0
- package/dist/cjs/components/QuotaWidgetCard/QuotaWidgetCard.js +39 -0
- package/dist/cjs/components/QuotaWidgetCard/components/QuotaTooltip/QuotaTooltip.d.ts +6 -0
- package/dist/cjs/components/QuotaWidgetCard/components/QuotaTooltip/QuotaTooltip.js +19 -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 +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 +60 -0
- package/dist/cjs/components/QuotasWidget/QuotasWidget.d.ts +12 -0
- package/dist/cjs/components/QuotasWidget/QuotasWidget.js +26 -0
- package/dist/cjs/components/QuotasWidget/components/ProjectHeader/ProjectHeader.d.ts +9 -0
- package/dist/cjs/components/QuotasWidget/components/ProjectHeader/ProjectHeader.js +17 -0
- package/dist/cjs/components/QuotasWidget/components/ProjectHeader/index.d.ts +1 -0
- package/dist/cjs/components/QuotasWidget/components/ProjectHeader/index.js +17 -0
- package/dist/cjs/components/QuotasWidget/components/ProjectHeader/styles.module.css +17 -0
- package/dist/cjs/components/QuotasWidget/index.d.ts +1 -0
- package/dist/cjs/components/QuotasWidget/index.js +17 -0
- package/dist/cjs/components/QuotasWidget/styles.module.css +9 -0
- package/dist/cjs/components/QuotasWidgetMini/QuotasWidgetMini.d.ts +12 -0
- package/dist/cjs/components/QuotasWidgetMini/QuotasWidgetMini.js +21 -0
- package/dist/cjs/components/QuotasWidgetMini/index.d.ts +1 -0
- package/dist/cjs/components/QuotasWidgetMini/index.js +17 -0
- package/dist/cjs/components/QuotasWidgetMini/styles.module.css +19 -0
- package/dist/cjs/components/QuotasWidgetMobile/QuotasWidgetMobile.d.ts +13 -0
- package/dist/cjs/components/QuotasWidgetMobile/QuotasWidgetMobile.js +19 -0
- package/dist/cjs/components/QuotasWidgetMobile/index.d.ts +1 -0
- package/dist/cjs/components/QuotasWidgetMobile/index.js +17 -0
- package/dist/cjs/components/index.d.ts +3 -0
- package/dist/cjs/components/index.js +3 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/QuotaCardsGrid.d.ts +11 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/QuotaCardsGrid.js +21 -0
- package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/Grid.d.ts +9 -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/helperComponents/QuotaCardsGrid/components/Grid/index.js +17 -0
- 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 +7 -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/QuotaButtonDropdown/QuotaDropdown.d.ts +3 -0
- package/dist/esm/components/QuotaButtonDropdown/QuotaDropdown.js +3 -0
- package/dist/esm/components/QuotaCard/QuotaCard.d.ts +3 -0
- package/dist/esm/components/QuotaCard/QuotaCard.js +3 -0
- package/dist/esm/components/QuotaWidgetCard/QuotaWidgetCard.d.ts +6 -0
- package/dist/esm/components/QuotaWidgetCard/QuotaWidgetCard.js +33 -0
- package/dist/esm/components/QuotaWidgetCard/components/QuotaTooltip/QuotaTooltip.d.ts +6 -0
- package/dist/esm/components/QuotaWidgetCard/components/QuotaTooltip/QuotaTooltip.js +13 -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 +60 -0
- package/dist/esm/components/QuotasWidget/QuotasWidget.d.ts +12 -0
- package/dist/esm/components/QuotasWidget/QuotasWidget.js +20 -0
- package/dist/esm/components/QuotasWidget/components/ProjectHeader/ProjectHeader.d.ts +9 -0
- package/dist/esm/components/QuotasWidget/components/ProjectHeader/ProjectHeader.js +11 -0
- package/dist/esm/components/QuotasWidget/components/ProjectHeader/index.d.ts +1 -0
- package/dist/esm/components/QuotasWidget/components/ProjectHeader/index.js +1 -0
- package/dist/esm/components/QuotasWidget/components/ProjectHeader/styles.module.css +17 -0
- package/dist/esm/components/QuotasWidget/index.d.ts +1 -0
- package/dist/esm/components/QuotasWidget/index.js +1 -0
- package/dist/esm/components/QuotasWidget/styles.module.css +9 -0
- package/dist/esm/components/QuotasWidgetMini/QuotasWidgetMini.d.ts +12 -0
- package/dist/esm/components/QuotasWidgetMini/QuotasWidgetMini.js +15 -0
- package/dist/esm/components/QuotasWidgetMini/index.d.ts +1 -0
- package/dist/esm/components/QuotasWidgetMini/index.js +1 -0
- package/dist/esm/components/QuotasWidgetMini/styles.module.css +19 -0
- package/dist/esm/components/QuotasWidgetMobile/QuotasWidgetMobile.d.ts +13 -0
- package/dist/esm/components/QuotasWidgetMobile/QuotasWidgetMobile.js +16 -0
- package/dist/esm/components/QuotasWidgetMobile/index.d.ts +1 -0
- package/dist/esm/components/QuotasWidgetMobile/index.js +1 -0
- package/dist/esm/components/index.d.ts +3 -0
- package/dist/esm/components/index.js +3 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/QuotaCardsGrid.d.ts +11 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/QuotaCardsGrid.js +15 -0
- package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/Grid.d.ts +9 -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 +7 -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 +13 -3
- package/src/components/QuotaButtonDropdown/QuotaDropdown.tsx +3 -0
- package/src/components/QuotaCard/QuotaCard.tsx +3 -0
- package/src/components/QuotaWidgetCard/QuotaWidgetCard.tsx +68 -0
- package/src/components/QuotaWidgetCard/components/QuotaTooltip/QuotaTooltip.tsx +40 -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 +61 -0
- package/src/components/QuotasWidget/QuotasWidget.tsx +73 -0
- package/src/components/QuotasWidget/components/ProjectHeader/ProjectHeader.tsx +39 -0
- package/src/components/QuotasWidget/components/ProjectHeader/index.ts +1 -0
- package/src/components/QuotasWidget/components/ProjectHeader/styles.module.scss +18 -0
- package/src/components/QuotasWidget/index.ts +1 -0
- package/src/components/QuotasWidget/styles.module.scss +11 -0
- package/src/components/QuotasWidgetMini/QuotasWidgetMini.tsx +82 -0
- package/src/components/QuotasWidgetMini/index.ts +1 -0
- package/src/components/QuotasWidgetMini/styles.module.scss +20 -0
- package/src/components/QuotasWidgetMobile/QuotasWidgetMobile.tsx +54 -0
- package/src/components/QuotasWidgetMobile/index.ts +1 -0
- package/src/components/index.ts +3 -0
- package/src/helperComponents/QuotaCardsGrid/QuotaCardsGrid.tsx +47 -0
- package/src/helperComponents/QuotaCardsGrid/components/Grid/Grid.tsx +39 -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 +8 -0
- package/src/utils/getPercent.ts +9 -0
- package/src/utils/index.ts +2 -0
- /package/dist/cjs/{utils.d.ts → utils/checkExceeded.d.ts} +0 -0
- /package/dist/cjs/{utils.js → utils/checkExceeded.js} +0 -0
- /package/dist/esm/{utils.d.ts → utils/checkExceeded.d.ts} +0 -0
- /package/dist/esm/{utils.js → utils/checkExceeded.js} +0 -0
- /package/src/{utils.ts → utils/checkExceeded.ts} +0 -0
|
@@ -21,4 +21,7 @@ export type QuotaDropdownProps = WithSupportProps<{
|
|
|
21
21
|
/** CSS класс */
|
|
22
22
|
className?: string;
|
|
23
23
|
}>;
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated use QuotaWidget instead
|
|
26
|
+
*/
|
|
24
27
|
export declare function QuotaDropdown({ placement, layoutType, className, size, ...props }: QuotaDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -18,6 +18,9 @@ const uikit_product_button_predefined_1 = require("@cloud-ru/uikit-product-butto
|
|
|
18
18
|
const uikit_product_locale_1 = require("@cloud-ru/uikit-product-locale");
|
|
19
19
|
const utils_1 = require("../../utils");
|
|
20
20
|
const components_1 = require("./components");
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated use QuotaWidget instead
|
|
23
|
+
*/
|
|
21
24
|
function QuotaDropdown(_a) {
|
|
22
25
|
var { placement = 'bottom-end', layoutType = 'desktop', className, size } = _a, props = __rest(_a, ["placement", "layoutType", "className", "size"]);
|
|
23
26
|
const [open, setOpen] = (0, react_1.useState)(false);
|
|
@@ -18,5 +18,8 @@ export type QuotaCardProps = QuotaCardCommonProps & ({
|
|
|
18
18
|
customUnit: string;
|
|
19
19
|
customLabel: string;
|
|
20
20
|
});
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated use QuotaWidgetCard instead
|
|
23
|
+
*/
|
|
21
24
|
export declare function QuotaCard({ loading, title, limit, created, increaseLink, onRetry, unlimited, type, customUnit, customLabel, ...rest }: QuotaCardProps): import("react/jsx-runtime").JSX.Element;
|
|
22
25
|
export {};
|
|
@@ -25,6 +25,9 @@ const truncate_string_1 = require("@snack-uikit/truncate-string");
|
|
|
25
25
|
const utils_1 = require("../../utils");
|
|
26
26
|
const components_1 = require("./components");
|
|
27
27
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated use QuotaWidgetCard instead
|
|
30
|
+
*/
|
|
28
31
|
function QuotaCard(_a) {
|
|
29
32
|
var { loading, title, limit, created, increaseLink, onRetry, unlimited = false, type = 'instances', customUnit, customLabel } = _a, rest = __rest(_a, ["loading", "title", "limit", "created", "increaseLink", "onRetry", "unlimited", "type", "customUnit", "customLabel"]);
|
|
30
33
|
const available = (limit !== null && limit !== void 0 ? limit : 0) - (created !== null && created !== void 0 ? created : 0);
|
|
@@ -0,0 +1,39 @@
|
|
|
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 uikit_product_locale_1 = require("@cloud-ru/uikit-product-locale");
|
|
9
|
+
const progress_bar_1 = require("@snack-uikit/progress-bar");
|
|
10
|
+
const tooltip_1 = require("@snack-uikit/tooltip");
|
|
11
|
+
const truncate_string_1 = require("@snack-uikit/truncate-string");
|
|
12
|
+
const typography_1 = require("@snack-uikit/typography");
|
|
13
|
+
const getPercent_1 = require("../../utils/getPercent");
|
|
14
|
+
const QuotaTooltip_1 = require("./components/QuotaTooltip");
|
|
15
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
16
|
+
function getProgressAppearance(percent) {
|
|
17
|
+
if (percent >= 90) {
|
|
18
|
+
return 'red';
|
|
19
|
+
}
|
|
20
|
+
else if (percent >= 70) {
|
|
21
|
+
return 'orange';
|
|
22
|
+
}
|
|
23
|
+
return 'green';
|
|
24
|
+
}
|
|
25
|
+
function QuotaWidgetCard({ quota }) {
|
|
26
|
+
const { t } = (0, uikit_product_locale_1.useLocale)('Quota');
|
|
27
|
+
const percent = (0, getPercent_1.getPercent)(quota);
|
|
28
|
+
const rows = [
|
|
29
|
+
{
|
|
30
|
+
label: t('cardAvailable'),
|
|
31
|
+
value: quota.limit,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
label: t('cardRemaining'),
|
|
35
|
+
value: quota.remains,
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
return ((0, jsx_runtime_1.jsx)(tooltip_1.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": quota.remains === 0, 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: [Math.floor(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: [row.value, " ", (0, jsx_runtime_1.jsx)("span", { className: styles_module_scss_1.default.unit, children: quota.unitDisplayName })] })] }, row.label))) })] }) }));
|
|
39
|
+
}
|
|
@@ -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.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 styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
11
|
+
function QuotaTooltip({ quota }) {
|
|
12
|
+
const { t } = (0, uikit_product_locale_1.useLocale)('Quota');
|
|
13
|
+
const rows = [
|
|
14
|
+
{ label: t('tooltipAvailable'), value: quota.limit },
|
|
15
|
+
{ label: t('tooltipUsed'), value: quota.usage },
|
|
16
|
+
{ label: t('tooltipRemaining'), value: quota.remains },
|
|
17
|
+
];
|
|
18
|
+
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: [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') })] }))] }));
|
|
19
|
+
}
|
|
@@ -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,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,60 @@
|
|
|
1
|
+
.card{
|
|
2
|
+
display:flex;
|
|
3
|
+
flex-direction:column;
|
|
4
|
+
row-gap:4px;
|
|
5
|
+
padding:8px;
|
|
6
|
+
background-color:var(--sys-neutral-background-opacity, rgba(238, 239, 243, 0.5019607843));
|
|
7
|
+
border-radius:4px;
|
|
8
|
+
height:100%;
|
|
9
|
+
}
|
|
10
|
+
.card[data-exhausted=true]{
|
|
11
|
+
background-color:var(--sys-red-background, #fdf1ef);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.header{
|
|
15
|
+
display:flex;
|
|
16
|
+
align-items:flex-end;
|
|
17
|
+
justify-content:space-between;
|
|
18
|
+
-moz-column-gap:4px;
|
|
19
|
+
column-gap:4px;
|
|
20
|
+
flex:1;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.title{
|
|
24
|
+
color:var(--sys-neutral-text-main, #41424e);
|
|
25
|
+
align-self:flex-start;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.percent[data-family=sans][data-purpose=label][data-size=m]{
|
|
29
|
+
font-weight:400;
|
|
30
|
+
color:var(--sys-neutral-text-light, #8b8e9b);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.info{
|
|
34
|
+
display:flex;
|
|
35
|
+
flex-direction:column;
|
|
36
|
+
row-gap:2px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.row{
|
|
40
|
+
display:flex;
|
|
41
|
+
align-items:center;
|
|
42
|
+
justify-content:space-between;
|
|
43
|
+
-moz-column-gap:8px;
|
|
44
|
+
column-gap:8px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.label[data-family=sans][data-purpose=label][data-size=m]{
|
|
48
|
+
color:var(--sys-neutral-text-light, #8b8e9b);
|
|
49
|
+
font-weight:400;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.value[data-family=sans][data-purpose=label][data-size=l]{
|
|
53
|
+
color:var(--sys-neutral-text-main, #41424e);
|
|
54
|
+
white-space:nowrap;
|
|
55
|
+
font-weight:400;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.unit{
|
|
59
|
+
color:var(--sys-neutral-text-light, #8b8e9b);
|
|
60
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { QuotaItem } from '../../types';
|
|
2
|
+
export type QuotasWidgetProps = {
|
|
3
|
+
quotas: QuotaItem[];
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
isError: boolean;
|
|
6
|
+
onRefresh: () => void;
|
|
7
|
+
projectName: string;
|
|
8
|
+
quotasUrl: string;
|
|
9
|
+
canEditQuota: boolean;
|
|
10
|
+
onIncreaseQuotaClick?: () => void;
|
|
11
|
+
};
|
|
12
|
+
export declare function QuotasWidget({ quotas, isLoading, isError, onRefresh, projectName, quotasUrl, canEditQuota, onIncreaseQuotaClick, }: QuotasWidgetProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.QuotasWidget = QuotasWidget;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const uikit_product_locale_1 = require("@cloud-ru/uikit-product-locale");
|
|
10
|
+
const button_1 = require("@snack-uikit/button");
|
|
11
|
+
const dropdown_1 = require("@snack-uikit/dropdown");
|
|
12
|
+
const icons_1 = require("@snack-uikit/icons");
|
|
13
|
+
const QuotaCardsGrid_1 = require("../../helperComponents/QuotaCardsGrid");
|
|
14
|
+
const ProjectHeader_1 = require("./components/ProjectHeader");
|
|
15
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
16
|
+
function QuotasWidget({ quotas, isLoading, isError, onRefresh, projectName, quotasUrl, canEditQuota, onIncreaseQuotaClick, }) {
|
|
17
|
+
const { t } = (0, uikit_product_locale_1.useLocale)('Quota');
|
|
18
|
+
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
19
|
+
const exhaustedCount = quotas.filter(item => item.remains === 0).length;
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(dropdown_1.Dropdown, { placement: 'bottom-end', open: isOpen, onOpenChange: setIsOpen, 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 }), (0, jsx_runtime_1.jsx)(QuotaCardsGrid_1.QuotaCardsGrid, { quotas: quotas, isLoading: isLoading, isError: isError, onRefresh: onRefresh })] }), children: (0, jsx_runtime_1.jsx)(button_1.ButtonFunction, { label: t('quotas'), icon: isOpen ? (0, jsx_runtime_1.jsx)(icons_1.ChevronUpSVG, {}) : (0, jsx_runtime_1.jsx)(icons_1.ChevronDownSVG, {}), counter: exhaustedCount > 0
|
|
21
|
+
? {
|
|
22
|
+
value: exhaustedCount,
|
|
23
|
+
appearance: 'red',
|
|
24
|
+
}
|
|
25
|
+
: undefined, size: 's' }) }));
|
|
26
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type ProjectHeaderProps = {
|
|
2
|
+
projectName: string;
|
|
3
|
+
quotasUrl: string;
|
|
4
|
+
canEditQuota: boolean;
|
|
5
|
+
isError: boolean;
|
|
6
|
+
onIncreaseQuotaClick?: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare function ProjectHeader({ projectName, quotasUrl, canEditQuota, isError, onIncreaseQuotaClick, }: ProjectHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
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, }) {
|
|
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 }), (0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyS, { className: styles_module_scss_1.default.subtitle, children: t('widgetSubtitle') })] }), canEditQuota && !isError && ((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';
|
|
@@ -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,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 './QuotasWidget';
|
|
@@ -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("./QuotasWidget"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { QuotaItem } from '../../types';
|
|
2
|
+
export type QuotasWidgetMiniProps = {
|
|
3
|
+
quotas: QuotaItem[];
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
isError: boolean;
|
|
6
|
+
onRefresh: () => void;
|
|
7
|
+
projectName: string;
|
|
8
|
+
canEditQuota: boolean;
|
|
9
|
+
isExpandedDefault?: boolean;
|
|
10
|
+
onIncreaseQuotaClick?: () => void;
|
|
11
|
+
};
|
|
12
|
+
export declare function QuotasWidgetMini({ quotas, isLoading, isError, onRefresh, projectName, canEditQuota, isExpandedDefault, onIncreaseQuotaClick, }: QuotasWidgetMiniProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
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.QuotasWidgetMini = QuotasWidgetMini;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const uikit_product_locale_1 = require("@cloud-ru/uikit-product-locale");
|
|
9
|
+
const accordion_1 = require("@snack-uikit/accordion");
|
|
10
|
+
const button_1 = require("@snack-uikit/button");
|
|
11
|
+
const counter_1 = require("@snack-uikit/counter");
|
|
12
|
+
const truncate_string_1 = require("@snack-uikit/truncate-string");
|
|
13
|
+
const typography_1 = require("@snack-uikit/typography");
|
|
14
|
+
const QuotaCardsGrid_1 = require("../../helperComponents/QuotaCardsGrid");
|
|
15
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
16
|
+
const ACCORDION_ID = 'quotas-widget-accordion';
|
|
17
|
+
function QuotasWidgetMini({ quotas, isLoading, isError, onRefresh, projectName, canEditQuota, isExpandedDefault, onIncreaseQuotaClick, }) {
|
|
18
|
+
const { t } = (0, uikit_product_locale_1.useLocale)('Quota');
|
|
19
|
+
const exhaustedCount = quotas.filter(item => item.remains === 0).length;
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(accordion_1.AccordionPrimary, { expandedDefault: isExpandedDefault ? ACCORDION_ID : undefined, 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, isLoading: isLoading, isError: isError, onRefresh: onRefresh, isMobile: true }), !isError && canEditQuota && ((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 }))] }) }));
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './QuotasWidgetMini';
|
|
@@ -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("./QuotasWidgetMini"), 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,13 @@
|
|
|
1
|
+
import { QuotaItem } from '../../types';
|
|
2
|
+
export type QuotasWidgetMobileProps = {
|
|
3
|
+
quotas: QuotaItem[];
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
isError: boolean;
|
|
6
|
+
onRefresh: () => void;
|
|
7
|
+
projectName: string;
|
|
8
|
+
canEditQuota: boolean;
|
|
9
|
+
isOpen: boolean;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
onIncreaseQuotaClick?: () => void;
|
|
12
|
+
};
|
|
13
|
+
export declare function QuotasWidgetMobile({ quotas, isLoading, isError, onRefresh, projectName, canEditQuota, isOpen, onClose, onIncreaseQuotaClick, }: QuotasWidgetMobileProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QuotasWidgetMobile = QuotasWidgetMobile;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const uikit_product_locale_1 = require("@cloud-ru/uikit-product-locale");
|
|
6
|
+
const uikit_product_mobile_modal_1 = require("@cloud-ru/uikit-product-mobile-modal");
|
|
7
|
+
const QuotaCardsGrid_1 = require("../../helperComponents/QuotaCardsGrid");
|
|
8
|
+
function QuotasWidgetMobile({ quotas, isLoading, isError, onRefresh, projectName, canEditQuota, isOpen, onClose, onIncreaseQuotaClick, }) {
|
|
9
|
+
const { t } = (0, uikit_product_locale_1.useLocale)('Quota');
|
|
10
|
+
return (
|
|
11
|
+
// @ts-expect-error no approve button needed
|
|
12
|
+
(0, jsx_runtime_1.jsx)(uikit_product_mobile_modal_1.MobileModal, { closeButtonEnabled: true, open: isOpen, onClose: onClose, title: t('quotas'), subtitle: projectName, cancelButton: isError || !canEditQuota
|
|
13
|
+
? undefined
|
|
14
|
+
: {
|
|
15
|
+
appearance: 'neutral',
|
|
16
|
+
label: t('increaseQuota'),
|
|
17
|
+
onClick: onIncreaseQuotaClick,
|
|
18
|
+
}, content: (0, jsx_runtime_1.jsx)(QuotaCardsGrid_1.QuotaCardsGrid, { quotas: quotas, isLoading: isLoading, isError: isError, onRefresh: onRefresh, isMobile: true }) }));
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './QuotasWidgetMobile';
|
|
@@ -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("./QuotasWidgetMobile"), exports);
|
|
@@ -16,3 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./QuotaCard"), exports);
|
|
18
18
|
__exportStar(require("./QuotaButtonDropdown"), exports);
|
|
19
|
+
__exportStar(require("./QuotasWidget"), exports);
|
|
20
|
+
__exportStar(require("./QuotasWidgetMini"), exports);
|
|
21
|
+
__exportStar(require("./QuotasWidgetMobile"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { QuotaItem } from '../../types';
|
|
2
|
+
type QuotaCardsGridProps = {
|
|
3
|
+
quotas: QuotaItem[];
|
|
4
|
+
isAccordion?: boolean;
|
|
5
|
+
isLoading: boolean;
|
|
6
|
+
isError: boolean;
|
|
7
|
+
onRefresh: () => void;
|
|
8
|
+
isMobile?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare function QuotaCardsGrid({ quotas, isAccordion, isLoading, isError, onRefresh, isMobile, }: QuotaCardsGridProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
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, isAccordion = false, isLoading, isError, onRefresh, isMobile = false, }) {
|
|
13
|
+
const wrapperAttributes = {
|
|
14
|
+
className: styles_module_scss_1.default.wrapper,
|
|
15
|
+
'data-accordion': isAccordion,
|
|
16
|
+
};
|
|
17
|
+
if (isError) {
|
|
18
|
+
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 }) })));
|
|
19
|
+
}
|
|
20
|
+
return isMobile ? ((0, jsx_runtime_1.jsx)(Grid_1.Grid, { quotas: quotas, isLoading: isLoading, isAccordion: isAccordion, isMobile: isMobile })) : ((0, jsx_runtime_1.jsx)(scroll_1.Scroll, Object.assign({}, wrapperAttributes, { size: 's', children: (0, jsx_runtime_1.jsx)(Grid_1.Grid, { quotas: quotas, isLoading: isLoading, isAccordion: isAccordion, isMobile: isMobile }) })));
|
|
21
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { QuotaItem } from '../../../../types';
|
|
2
|
+
type GridProps = {
|
|
3
|
+
quotas: QuotaItem[];
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
isAccordion: boolean;
|
|
6
|
+
isMobile: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function Grid({ quotas, isLoading, isAccordion, isMobile }: GridProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
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, isAccordion, isMobile }) {
|
|
23
|
+
const sortedQuotas = 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 {};
|