@cloud-ru/uikit-product-quota 2.0.13 → 2.0.14-preview-ff13f470.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/dist/cjs/components/QuotaButtonDropdown/QuotaDropdown.d.ts +3 -0
  2. package/dist/cjs/components/QuotaButtonDropdown/QuotaDropdown.js +3 -0
  3. package/dist/cjs/components/QuotaCard/QuotaCard.d.ts +3 -0
  4. package/dist/cjs/components/QuotaCard/QuotaCard.js +3 -0
  5. package/dist/cjs/components/QuotaWidgetCard/QuotaWidgetCard.d.ts +8 -0
  6. package/dist/cjs/components/QuotaWidgetCard/QuotaWidgetCard.js +51 -0
  7. package/dist/cjs/components/QuotaWidgetCard/components/QuotaTooltip/QuotaTooltip.d.ts +6 -0
  8. package/dist/cjs/components/QuotaWidgetCard/components/QuotaTooltip/QuotaTooltip.js +19 -0
  9. package/dist/cjs/components/QuotaWidgetCard/components/QuotaTooltip/index.d.ts +1 -0
  10. package/dist/cjs/components/QuotaWidgetCard/components/QuotaTooltip/index.js +17 -0
  11. package/dist/cjs/components/QuotaWidgetCard/components/QuotaTooltip/styles.module.css +19 -0
  12. package/dist/cjs/components/QuotaWidgetCard/index.d.ts +1 -0
  13. package/dist/cjs/components/QuotaWidgetCard/index.js +17 -0
  14. package/dist/cjs/components/QuotaWidgetCard/styles.module.css +60 -0
  15. package/dist/cjs/components/QuotasWidget/QuotasWidget.d.ts +9 -0
  16. package/dist/cjs/components/QuotasWidget/QuotasWidget.js +44 -0
  17. package/dist/cjs/components/QuotasWidget/components/ProjectHeader/ProjectHeader.d.ts +11 -0
  18. package/dist/cjs/components/QuotasWidget/components/ProjectHeader/ProjectHeader.js +17 -0
  19. package/dist/cjs/components/QuotasWidget/components/ProjectHeader/index.d.ts +1 -0
  20. package/dist/cjs/components/QuotasWidget/components/ProjectHeader/index.js +17 -0
  21. package/dist/cjs/components/QuotasWidget/components/ProjectHeader/styles.module.css +17 -0
  22. package/dist/cjs/components/QuotasWidget/index.d.ts +1 -0
  23. package/dist/cjs/components/QuotasWidget/index.js +17 -0
  24. package/dist/cjs/components/QuotasWidget/styles.module.css +9 -0
  25. package/dist/cjs/components/QuotasWidgetMini/QuotasWidgetMini.d.ts +7 -0
  26. package/dist/cjs/components/QuotasWidgetMini/QuotasWidgetMini.js +38 -0
  27. package/dist/cjs/components/QuotasWidgetMini/index.d.ts +1 -0
  28. package/dist/cjs/components/QuotasWidgetMini/index.js +17 -0
  29. package/dist/cjs/components/QuotasWidgetMini/styles.module.css +19 -0
  30. package/dist/cjs/components/QuotasWidgetMobile/QuotasWidgetMobile.d.ts +9 -0
  31. package/dist/cjs/components/QuotasWidgetMobile/QuotasWidgetMobile.js +31 -0
  32. package/dist/cjs/components/QuotasWidgetMobile/index.d.ts +1 -0
  33. package/dist/cjs/components/QuotasWidgetMobile/index.js +17 -0
  34. package/dist/cjs/components/index.d.ts +3 -0
  35. package/dist/cjs/components/index.js +3 -0
  36. package/dist/cjs/helperComponents/QuotaCardsGrid/QuotaCardsGrid.d.ts +11 -0
  37. package/dist/cjs/helperComponents/QuotaCardsGrid/QuotaCardsGrid.js +21 -0
  38. package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/Grid.d.ts +9 -0
  39. package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/Grid.js +25 -0
  40. package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/QuotaCardsSkeleton.d.ts +6 -0
  41. package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/QuotaCardsSkeleton.js +16 -0
  42. package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/index.d.ts +1 -0
  43. package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/index.js +17 -0
  44. package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/styles.module.css +8 -0
  45. package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/index.d.ts +1 -0
  46. package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/index.js +17 -0
  47. package/dist/cjs/helperComponents/QuotaCardsGrid/components/Grid/styles.module.css +8 -0
  48. package/dist/cjs/helperComponents/QuotaCardsGrid/components/QuotaError/QuotaError.d.ts +5 -0
  49. package/dist/cjs/helperComponents/QuotaCardsGrid/components/QuotaError/QuotaError.js +17 -0
  50. package/dist/cjs/helperComponents/QuotaCardsGrid/components/QuotaError/index.d.ts +1 -0
  51. package/dist/cjs/helperComponents/QuotaCardsGrid/components/QuotaError/index.js +17 -0
  52. package/dist/cjs/helperComponents/QuotaCardsGrid/index.d.ts +1 -0
  53. package/dist/cjs/helperComponents/QuotaCardsGrid/index.js +17 -0
  54. package/dist/cjs/helperComponents/QuotaCardsGrid/styles.module.css +10 -0
  55. package/dist/cjs/index.d.ts +1 -0
  56. package/dist/cjs/index.js +1 -0
  57. package/dist/cjs/types.d.ts +32 -0
  58. package/dist/cjs/utils/getPercent.d.ts +2 -0
  59. package/dist/cjs/utils/getPercent.js +9 -0
  60. package/dist/cjs/utils/index.d.ts +2 -0
  61. package/dist/cjs/utils/index.js +18 -0
  62. package/dist/esm/components/QuotaButtonDropdown/QuotaDropdown.d.ts +3 -0
  63. package/dist/esm/components/QuotaButtonDropdown/QuotaDropdown.js +3 -0
  64. package/dist/esm/components/QuotaCard/QuotaCard.d.ts +3 -0
  65. package/dist/esm/components/QuotaCard/QuotaCard.js +3 -0
  66. package/dist/esm/components/QuotaWidgetCard/QuotaWidgetCard.d.ts +8 -0
  67. package/dist/esm/components/QuotaWidgetCard/QuotaWidgetCard.js +45 -0
  68. package/dist/esm/components/QuotaWidgetCard/components/QuotaTooltip/QuotaTooltip.d.ts +6 -0
  69. package/dist/esm/components/QuotaWidgetCard/components/QuotaTooltip/QuotaTooltip.js +13 -0
  70. package/dist/esm/components/QuotaWidgetCard/components/QuotaTooltip/index.d.ts +1 -0
  71. package/dist/esm/components/QuotaWidgetCard/components/QuotaTooltip/index.js +1 -0
  72. package/dist/esm/components/QuotaWidgetCard/components/QuotaTooltip/styles.module.css +19 -0
  73. package/dist/esm/components/QuotaWidgetCard/index.d.ts +1 -0
  74. package/dist/esm/components/QuotaWidgetCard/index.js +1 -0
  75. package/dist/esm/components/QuotaWidgetCard/styles.module.css +60 -0
  76. package/dist/esm/components/QuotasWidget/QuotasWidget.d.ts +9 -0
  77. package/dist/esm/components/QuotasWidget/QuotasWidget.js +38 -0
  78. package/dist/esm/components/QuotasWidget/components/ProjectHeader/ProjectHeader.d.ts +11 -0
  79. package/dist/esm/components/QuotasWidget/components/ProjectHeader/ProjectHeader.js +11 -0
  80. package/dist/esm/components/QuotasWidget/components/ProjectHeader/index.d.ts +1 -0
  81. package/dist/esm/components/QuotasWidget/components/ProjectHeader/index.js +1 -0
  82. package/dist/esm/components/QuotasWidget/components/ProjectHeader/styles.module.css +17 -0
  83. package/dist/esm/components/QuotasWidget/index.d.ts +1 -0
  84. package/dist/esm/components/QuotasWidget/index.js +1 -0
  85. package/dist/esm/components/QuotasWidget/styles.module.css +9 -0
  86. package/dist/esm/components/QuotasWidgetMini/QuotasWidgetMini.d.ts +7 -0
  87. package/dist/esm/components/QuotasWidgetMini/QuotasWidgetMini.js +32 -0
  88. package/dist/esm/components/QuotasWidgetMini/index.d.ts +1 -0
  89. package/dist/esm/components/QuotasWidgetMini/index.js +1 -0
  90. package/dist/esm/components/QuotasWidgetMini/styles.module.css +19 -0
  91. package/dist/esm/components/QuotasWidgetMobile/QuotasWidgetMobile.d.ts +9 -0
  92. package/dist/esm/components/QuotasWidgetMobile/QuotasWidgetMobile.js +28 -0
  93. package/dist/esm/components/QuotasWidgetMobile/index.d.ts +1 -0
  94. package/dist/esm/components/QuotasWidgetMobile/index.js +1 -0
  95. package/dist/esm/components/index.d.ts +3 -0
  96. package/dist/esm/components/index.js +3 -0
  97. package/dist/esm/helperComponents/QuotaCardsGrid/QuotaCardsGrid.d.ts +11 -0
  98. package/dist/esm/helperComponents/QuotaCardsGrid/QuotaCardsGrid.js +15 -0
  99. package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/Grid.d.ts +9 -0
  100. package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/Grid.js +19 -0
  101. package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/QuotaCardsSkeleton.d.ts +6 -0
  102. package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/QuotaCardsSkeleton.js +10 -0
  103. package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/index.d.ts +1 -0
  104. package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/index.js +1 -0
  105. package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/styles.module.css +8 -0
  106. package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/index.d.ts +1 -0
  107. package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/index.js +1 -0
  108. package/dist/esm/helperComponents/QuotaCardsGrid/components/Grid/styles.module.css +8 -0
  109. package/dist/esm/helperComponents/QuotaCardsGrid/components/QuotaError/QuotaError.d.ts +5 -0
  110. package/dist/esm/helperComponents/QuotaCardsGrid/components/QuotaError/QuotaError.js +14 -0
  111. package/dist/esm/helperComponents/QuotaCardsGrid/components/QuotaError/index.d.ts +1 -0
  112. package/dist/esm/helperComponents/QuotaCardsGrid/components/QuotaError/index.js +1 -0
  113. package/dist/esm/helperComponents/QuotaCardsGrid/index.d.ts +1 -0
  114. package/dist/esm/helperComponents/QuotaCardsGrid/index.js +1 -0
  115. package/dist/esm/helperComponents/QuotaCardsGrid/styles.module.css +10 -0
  116. package/dist/esm/index.d.ts +1 -0
  117. package/dist/esm/index.js +1 -0
  118. package/dist/esm/types.d.ts +32 -0
  119. package/dist/esm/utils/getPercent.d.ts +2 -0
  120. package/dist/esm/utils/getPercent.js +6 -0
  121. package/dist/esm/utils/index.d.ts +2 -0
  122. package/dist/esm/utils/index.js +2 -0
  123. package/package.json +13 -3
  124. package/src/components/QuotaButtonDropdown/QuotaDropdown.tsx +3 -0
  125. package/src/components/QuotaCard/QuotaCard.tsx +3 -0
  126. package/src/components/QuotaWidgetCard/QuotaWidgetCard.tsx +70 -0
  127. package/src/components/QuotaWidgetCard/components/QuotaTooltip/QuotaTooltip.tsx +40 -0
  128. package/src/components/QuotaWidgetCard/components/QuotaTooltip/index.ts +1 -0
  129. package/src/components/QuotaWidgetCard/components/QuotaTooltip/styles.module.scss +20 -0
  130. package/src/components/QuotaWidgetCard/index.ts +1 -0
  131. package/src/components/QuotaWidgetCard/styles.module.scss +61 -0
  132. package/src/components/QuotasWidget/QuotasWidget.tsx +86 -0
  133. package/src/components/QuotasWidget/components/ProjectHeader/ProjectHeader.tsx +49 -0
  134. package/src/components/QuotasWidget/components/ProjectHeader/index.ts +1 -0
  135. package/src/components/QuotasWidget/components/ProjectHeader/styles.module.scss +18 -0
  136. package/src/components/QuotasWidget/index.ts +1 -0
  137. package/src/components/QuotasWidget/styles.module.scss +11 -0
  138. package/src/components/QuotasWidgetMini/QuotasWidgetMini.tsx +92 -0
  139. package/src/components/QuotasWidgetMini/index.ts +1 -0
  140. package/src/components/QuotasWidgetMini/styles.module.scss +20 -0
  141. package/src/components/QuotasWidgetMobile/QuotasWidgetMobile.tsx +55 -0
  142. package/src/components/QuotasWidgetMobile/index.ts +1 -0
  143. package/src/components/index.ts +3 -0
  144. package/src/helperComponents/QuotaCardsGrid/QuotaCardsGrid.tsx +47 -0
  145. package/src/helperComponents/QuotaCardsGrid/components/Grid/Grid.tsx +39 -0
  146. package/src/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/QuotaCardsSkeleton.tsx +25 -0
  147. package/src/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/index.ts +1 -0
  148. package/src/helperComponents/QuotaCardsGrid/components/Grid/components/QuotaWidgetCardsSkeleton/styles.module.scss +10 -0
  149. package/src/helperComponents/QuotaCardsGrid/components/Grid/index.ts +1 -0
  150. package/src/helperComponents/QuotaCardsGrid/components/Grid/styles.module.scss +11 -0
  151. package/src/helperComponents/QuotaCardsGrid/components/QuotaError/QuotaError.tsx +31 -0
  152. package/src/helperComponents/QuotaCardsGrid/components/QuotaError/index.ts +1 -0
  153. package/src/helperComponents/QuotaCardsGrid/index.ts +1 -0
  154. package/src/helperComponents/QuotaCardsGrid/styles.module.scss +12 -0
  155. package/src/index.ts +1 -0
  156. package/src/types.ts +34 -0
  157. package/src/utils/getPercent.ts +9 -0
  158. package/src/utils/index.ts +2 -0
  159. /package/dist/cjs/{utils.d.ts → utils/checkExceeded.d.ts} +0 -0
  160. /package/dist/cjs/{utils.js → utils/checkExceeded.js} +0 -0
  161. /package/dist/esm/{utils.d.ts → utils/checkExceeded.d.ts} +0 -0
  162. /package/dist/esm/{utils.js → utils/checkExceeded.js} +0 -0
  163. /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,8 @@
1
+ import { WithSupportProps } from '@cloud-ru/uikit-product-utils';
2
+ import { QuotaItem } from '../../types';
3
+ type QuotaWidgetCardProps = WithSupportProps<{
4
+ /** Отображаемая квота */
5
+ quota: QuotaItem;
6
+ }>;
7
+ export declare function QuotaWidgetCard({ quota, ...props }: QuotaWidgetCardProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,51 @@
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 getPercent_1 = require("../../utils/getPercent");
25
+ const QuotaTooltip_1 = require("./components/QuotaTooltip");
26
+ const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
27
+ function getProgressAppearance(percent) {
28
+ if (percent >= 90) {
29
+ return 'red';
30
+ }
31
+ else if (percent >= 70) {
32
+ return 'orange';
33
+ }
34
+ return 'green';
35
+ }
36
+ function QuotaWidgetCard(_a) {
37
+ var { quota } = _a, props = __rest(_a, ["quota"]);
38
+ const { t } = (0, uikit_product_locale_1.useLocale)('Quota');
39
+ const percent = (0, getPercent_1.getPercent)(quota);
40
+ const rows = [
41
+ {
42
+ label: t('cardAvailable'),
43
+ value: quota.limit,
44
+ },
45
+ {
46
+ label: t('cardRemaining'),
47
+ value: quota.remains,
48
+ },
49
+ ];
50
+ return ((0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, Object.assign({}, props, { 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))) })] }) })));
51
+ }
@@ -0,0 +1,6 @@
1
+ import { QuotaItem } from '../../../../types';
2
+ type QuotaTooltipProps = {
3
+ quota: QuotaItem;
4
+ };
5
+ export declare function QuotaTooltip({ quota }: QuotaTooltipProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,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,9 @@
1
+ import { WithSupportProps } from '@cloud-ru/uikit-product-utils';
2
+ import { QuotasWidgetPropsBase } from '../../types';
3
+ export type QuotasWidgetProps = WithSupportProps<QuotasWidgetPropsBase & {
4
+ /** Ссылка на страницу квот по проекту */
5
+ quotasUrl: string;
6
+ /** Колбек клика по ссылке на страницу квот по проекту */
7
+ onQuotasUrlClick?: () => void;
8
+ }>;
9
+ export declare function QuotasWidget({ quotas, isLoading, isError, onRefresh, projectName, quotasUrl, canEditQuota, hideIncreaseQuotaButton, onIncreaseQuotaClick, onWidgetOpen, onQuotasUrlClick, ...props }: QuotasWidgetProps): 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.QuotasWidget = QuotasWidget;
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 QuotasWidget(_a) {
28
+ var { quotas, isLoading, isError, onRefresh, projectName, quotasUrl, canEditQuota, hideIncreaseQuotaButton, onIncreaseQuotaClick, onWidgetOpen, onQuotasUrlClick } = _a, props = __rest(_a, ["quotas", "isLoading", "isError", "onRefresh", "projectName", "quotasUrl", "canEditQuota", "hideIncreaseQuotaButton", "onIncreaseQuotaClick", "onWidgetOpen", "onQuotasUrlClick"]);
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, 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
39
+ ? {
40
+ value: exhaustedCount,
41
+ appearance: 'red',
42
+ }
43
+ : undefined, size: 's' }) })));
44
+ }
@@ -0,0 +1,11 @@
1
+ type ProjectHeaderProps = {
2
+ projectName: string;
3
+ quotasUrl: string;
4
+ canEditQuota: boolean;
5
+ isError: boolean;
6
+ hideIncreaseQuotaButton?: boolean;
7
+ onIncreaseQuotaClick?: () => void;
8
+ onQuotasUrlClick?: () => void;
9
+ };
10
+ export declare function ProjectHeader({ projectName, quotasUrl, canEditQuota, isError, onIncreaseQuotaClick, hideIncreaseQuotaButton, onQuotasUrlClick, }: ProjectHeaderProps): import("react/jsx-runtime").JSX.Element;
11
+ 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';
@@ -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,9 @@
1
+ .content{
2
+ width:620px;
3
+ display:flex;
4
+ flex-direction:column;
5
+ gap:16px;
6
+ padding:12px 16px 0;
7
+ background-color:var(--sys-neutral-background1-level, #fdfdfd);
8
+ border-radius:12px;
9
+ }
@@ -0,0 +1,7 @@
1
+ import { WithSupportProps } from '@cloud-ru/uikit-product-utils';
2
+ import { QuotasWidgetPropsBase } from '../../types';
3
+ export type QuotasWidgetMiniProps = WithSupportProps<QuotasWidgetPropsBase & {
4
+ /** Флаг раскрытия аккордиона по умолчанию */
5
+ isExpandedDefault?: boolean;
6
+ }>;
7
+ export declare function QuotasWidgetMini({ quotas, isLoading, isError, onRefresh, projectName, canEditQuota, isExpandedDefault, hideIncreaseQuotaButton, onIncreaseQuotaClick, onWidgetOpen, ...props }: QuotasWidgetMiniProps): 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.QuotasWidgetMini = QuotasWidgetMini;
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 QuotasWidgetMini(_a) {
29
+ var { quotas, isLoading, isError, onRefresh, projectName, canEditQuota, isExpandedDefault, hideIncreaseQuotaButton, onIncreaseQuotaClick, onWidgetOpen } = _a, props = __rest(_a, ["quotas", "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, 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 './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,9 @@
1
+ import { WithSupportProps } from '@cloud-ru/uikit-product-utils';
2
+ import { QuotasWidgetPropsBase } from '../../types';
3
+ export type QuotasWidgetMobileProps = WithSupportProps<QuotasWidgetPropsBase & {
4
+ /** Флаг открытия модального окна */
5
+ isOpen: boolean;
6
+ /** Колбек на закрытие модального окна */
7
+ onClose: () => void;
8
+ }>;
9
+ export declare function QuotasWidgetMobile({ quotas, isLoading, isError, onRefresh, projectName, canEditQuota, isOpen, onClose, onIncreaseQuotaClick, hideIncreaseQuotaButton, ...props }: QuotasWidgetMobileProps): 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.QuotasWidgetMobile = QuotasWidgetMobile;
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 QuotasWidgetMobile(_a) {
20
+ var { quotas, isLoading, isError, onRefresh, projectName, canEditQuota, isOpen, onClose, onIncreaseQuotaClick, hideIncreaseQuotaButton } = _a, props = __rest(_a, ["quotas", "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, isLoading: isLoading, isError: isError, onRefresh: onRefresh, isMobile: true }) })));
31
+ }
@@ -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);
@@ -1,2 +1,5 @@
1
1
  export * from './QuotaCard';
2
2
  export * from './QuotaButtonDropdown';
3
+ export * from './QuotasWidget';
4
+ export * from './QuotasWidgetMini';
5
+ export * from './QuotasWidgetMobile';
@@ -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
+ }