@cloud-ru/uikit-product-quota 2.1.2 → 2.1.3-preview-6e29b8db.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.
@@ -13,5 +13,6 @@ const typography_1 = require("@snack-uikit/typography");
13
13
  const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
14
14
  function ProjectHeader({ projectName, quotasUrl, canEditQuota, isError, onIncreaseQuotaClick, hideIncreaseQuotaButton, onQuotasUrlClick, }) {
15
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 }))] }));
16
+ const widgetTitle = /[А-Яа-яЁё]/.test(projectName) ? 'widgetTitle.quotes' : 'widgetTitle.noQuotes';
17
+ 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: t(widgetTitle, { project: projectName }), href: quotasUrl, target: '_blank', icon: uikit_product_icons_1.QuotaSVG, 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
18
  }
@@ -34,5 +34,5 @@ function QuotaWidgetMini(_a) {
34
34
  onWidgetOpen === null || onWidgetOpen === void 0 ? void 0 : onWidgetOpen();
35
35
  }
36
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 }), !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 }))] }) })));
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('projectQuotas') }) }), 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 }), !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
38
  }
@@ -21,7 +21,7 @@ function QuotaWidgetMobile(_a) {
21
21
  const { t } = (0, uikit_product_locale_1.useLocale)('Quota');
22
22
  return (
23
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
24
+ (0, jsx_runtime_1.jsx)(uikit_product_mobile_modal_1.MobileModal, Object.assign({}, props, { closeButtonEnabled: true, open: isOpen, onClose: onClose, title: t('projectQuotas'), subtitle: projectName, cancelButton: isError || !canEditQuota || hideIncreaseQuotaButton
25
25
  ? undefined
26
26
  : {
27
27
  appearance: 'neutral',
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { CloudFolderSVG } from '@cloud-ru/uikit-product-icons';
2
+ import { QuotaSVG } from '@cloud-ru/uikit-product-icons';
3
3
  import { useLocale } from '@cloud-ru/uikit-product-locale';
4
4
  import { TitleClickable } from '@cloud-ru/uikit-product-title-clickable';
5
5
  import { ButtonOutline } from '@snack-uikit/button';
@@ -7,5 +7,6 @@ import { Typography } from '@snack-uikit/typography';
7
7
  import styles from './styles.module.css';
8
8
  export function ProjectHeader({ projectName, quotasUrl, canEditQuota, isError, onIncreaseQuotaClick, hideIncreaseQuotaButton, onQuotasUrlClick, }) {
9
9
  const { t } = useLocale('Quota');
10
- return (_jsxs("div", { className: styles.header, children: [_jsxs("div", { className: styles.projectWrapper, children: [_jsx(TitleClickable, { title: projectName, href: quotasUrl, target: '_blank', icon: CloudFolderSVG, onClick: onQuotasUrlClick }), _jsx(Typography.SansBodyS, { className: styles.subtitle, children: t('widgetSubtitle') })] }), canEditQuota && !isError && !hideIncreaseQuotaButton && (_jsx(ButtonOutline, { appearance: 'neutral', label: t('increaseQuota'), size: 's', onClick: onIncreaseQuotaClick }))] }));
10
+ const widgetTitle = /[А-Яа-яЁё]/.test(projectName) ? 'widgetTitle.quotes' : 'widgetTitle.noQuotes';
11
+ return (_jsxs("div", { className: styles.header, children: [_jsxs("div", { className: styles.projectWrapper, children: [_jsx(TitleClickable, { title: t(widgetTitle, { project: projectName }), href: quotasUrl, target: '_blank', icon: QuotaSVG, onClick: onQuotasUrlClick }), _jsx(Typography.SansBodyS, { className: styles.subtitle, children: t('widgetSubtitle') })] }), canEditQuota && !isError && !hideIncreaseQuotaButton && (_jsx(ButtonOutline, { appearance: 'neutral', label: t('increaseQuota'), size: 's', onClick: onIncreaseQuotaClick }))] }));
11
12
  }
@@ -28,5 +28,5 @@ export function QuotaWidgetMini(_a) {
28
28
  onWidgetOpen === null || onWidgetOpen === void 0 ? void 0 : onWidgetOpen();
29
29
  }
30
30
  };
31
- return (_jsx(AccordionPrimary, Object.assign({}, props, { expandedDefault: isExpandedDefault ? ACCORDION_ID : undefined, onExpandedChange: handleExpandedChange, children: _jsxs(AccordionPrimary.CollapseBlock, { id: ACCORDION_ID, className: styles.collapse, header: _jsxs(_Fragment, { children: [_jsxs("div", { className: styles.title, children: [_jsx(Typography.SansTitleM, { children: _jsx(TruncateString, { maxLines: 1, text: t('quotas') }) }), exhaustedCount > 0 && _jsx(Counter, { value: exhaustedCount, size: 's', appearance: 'red' })] }), _jsx(Typography.SansBodyM, { className: styles.subtitle, children: _jsx(TruncateString, { maxLines: 1, text: projectName }) })] }), children: [_jsx(QuotaCardsGrid, { isAccordion: true, quotas: quotas, disableSorting: disableSorting, isLoading: isLoading, isError: isError, onRefresh: onRefresh }), !isError && canEditQuota && !hideIncreaseQuotaButton && (_jsx(ButtonOutline, { className: styles.button, fullWidth: true, appearance: 'neutral', label: t('increaseQuota'), size: 's', onClick: onIncreaseQuotaClick }))] }) })));
31
+ return (_jsx(AccordionPrimary, Object.assign({}, props, { expandedDefault: isExpandedDefault ? ACCORDION_ID : undefined, onExpandedChange: handleExpandedChange, children: _jsxs(AccordionPrimary.CollapseBlock, { id: ACCORDION_ID, className: styles.collapse, header: _jsxs(_Fragment, { children: [_jsxs("div", { className: styles.title, children: [_jsx(Typography.SansTitleM, { children: _jsx(TruncateString, { maxLines: 1, text: t('projectQuotas') }) }), exhaustedCount > 0 && _jsx(Counter, { value: exhaustedCount, size: 's', appearance: 'red' })] }), _jsx(Typography.SansBodyM, { className: styles.subtitle, children: _jsx(TruncateString, { maxLines: 1, text: projectName }) })] }), children: [_jsx(QuotaCardsGrid, { isAccordion: true, quotas: quotas, disableSorting: disableSorting, isLoading: isLoading, isError: isError, onRefresh: onRefresh }), !isError && canEditQuota && !hideIncreaseQuotaButton && (_jsx(ButtonOutline, { className: styles.button, fullWidth: true, appearance: 'neutral', label: t('increaseQuota'), size: 's', onClick: onIncreaseQuotaClick }))] }) })));
32
32
  }
@@ -18,7 +18,7 @@ export function QuotaWidgetMobile(_a) {
18
18
  const { t } = useLocale('Quota');
19
19
  return (
20
20
  // @ts-expect-error no approve button needed
21
- _jsx(MobileModal, Object.assign({}, props, { closeButtonEnabled: true, open: isOpen, onClose: onClose, title: t('quotas'), subtitle: projectName, cancelButton: isError || !canEditQuota || hideIncreaseQuotaButton
21
+ _jsx(MobileModal, Object.assign({}, props, { closeButtonEnabled: true, open: isOpen, onClose: onClose, title: t('projectQuotas'), subtitle: projectName, cancelButton: isError || !canEditQuota || hideIncreaseQuotaButton
22
22
  ? undefined
23
23
  : {
24
24
  appearance: 'neutral',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloud-ru/uikit-product-quota",
3
3
  "title": "Quota",
4
- "version": "2.1.2",
4
+ "version": "2.1.3-preview-6e29b8db.0",
5
5
  "sideEffects": [
6
6
  "*.css",
7
7
  "*.woff",
@@ -56,5 +56,5 @@
56
56
  "peerDependencies": {
57
57
  "@cloud-ru/uikit-product-locale": "*"
58
58
  },
59
- "gitHead": "a77b7c53fc319e66a50756e3c6c7950dee6cc187"
59
+ "gitHead": "30cbc7b37fe3a2e1c47814a0a3d6904f91b53e84"
60
60
  }
@@ -1,4 +1,4 @@
1
- import { CloudFolderSVG } from '@cloud-ru/uikit-product-icons';
1
+ import { QuotaSVG } from '@cloud-ru/uikit-product-icons';
2
2
  import { useLocale } from '@cloud-ru/uikit-product-locale';
3
3
  import { TitleClickable } from '@cloud-ru/uikit-product-title-clickable';
4
4
  import { ButtonOutline } from '@snack-uikit/button';
@@ -26,14 +26,16 @@ export function ProjectHeader({
26
26
  }: ProjectHeaderProps) {
27
27
  const { t } = useLocale('Quota');
28
28
 
29
+ const widgetTitle = /[А-Яа-яЁё]/.test(projectName) ? 'widgetTitle.quotes' : 'widgetTitle.noQuotes';
30
+
29
31
  return (
30
32
  <div className={styles.header}>
31
33
  <div className={styles.projectWrapper}>
32
34
  <TitleClickable
33
- title={projectName}
35
+ title={t(widgetTitle, { project: projectName })}
34
36
  href={quotasUrl}
35
37
  target='_blank'
36
- icon={CloudFolderSVG}
38
+ icon={QuotaSVG}
37
39
  onClick={onQuotasUrlClick}
38
40
  />
39
41
 
@@ -56,7 +56,7 @@ export function QuotaWidgetMini({
56
56
  <>
57
57
  <div className={styles.title}>
58
58
  <Typography.SansTitleM>
59
- <TruncateString maxLines={1} text={t('quotas')} />
59
+ <TruncateString maxLines={1} text={t('projectQuotas')} />
60
60
  </Typography.SansTitleM>
61
61
 
62
62
  {exhaustedCount > 0 && <Counter value={exhaustedCount} size='s' appearance='red' />}
@@ -37,7 +37,7 @@ export function QuotaWidgetMobile({
37
37
  closeButtonEnabled
38
38
  open={isOpen}
39
39
  onClose={onClose}
40
- title={t('quotas')}
40
+ title={t('projectQuotas')}
41
41
  subtitle={projectName}
42
42
  cancelButton={
43
43
  isError || !canEditQuota || hideIncreaseQuotaButton