@cloud-ru/ds-uikit-product-quota 1.2.5-preview-360bd81e.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +2 -5
- package/dist/cjs/components/QuotaWidget/QuotaWidget.d.ts +1 -1
- package/dist/cjs/components/QuotaWidget/QuotaWidget.js +3 -3
- package/dist/cjs/components/QuotaWidget/QuotaWidgetContent.d.ts +1 -1
- package/dist/cjs/components/QuotaWidget/QuotaWidgetContent.js +3 -3
- package/dist/cjs/components/QuotaWidget/components/ProjectHeader/ProjectHeader.d.ts +2 -2
- package/dist/cjs/components/QuotaWidget/components/ProjectHeader/ProjectHeader.js +2 -2
- package/dist/cjs/components/QuotaWidgetMini/QuotaWidgetMini.d.ts +1 -1
- package/dist/cjs/components/QuotaWidgetMini/QuotaWidgetMini.js +2 -2
- package/dist/cjs/types.d.ts +0 -2
- package/dist/esm/components/QuotaWidget/QuotaWidget.d.ts +1 -1
- package/dist/esm/components/QuotaWidget/QuotaWidget.js +3 -3
- package/dist/esm/components/QuotaWidget/QuotaWidgetContent.d.ts +1 -1
- package/dist/esm/components/QuotaWidget/QuotaWidgetContent.js +3 -3
- package/dist/esm/components/QuotaWidget/components/ProjectHeader/ProjectHeader.d.ts +2 -2
- package/dist/esm/components/QuotaWidget/components/ProjectHeader/ProjectHeader.js +2 -2
- package/dist/esm/components/QuotaWidgetMini/QuotaWidgetMini.d.ts +1 -1
- package/dist/esm/components/QuotaWidgetMini/QuotaWidgetMini.js +2 -2
- package/dist/esm/types.d.ts +0 -2
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +18 -18
- package/src/components/QuotaWidget/QuotaWidget.tsx +1 -3
- package/src/components/QuotaWidget/QuotaWidgetContent.tsx +1 -3
- package/src/components/QuotaWidget/components/ProjectHeader/ProjectHeader.tsx +2 -3
- package/src/components/QuotaWidgetMini/QuotaWidgetMini.tsx +1 -2
- package/src/types.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 2.0.1 (2026-10-28)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @ds/uikit-product-quota
|
|
9
|
+
|
|
10
|
+
# 2.0.0 (2026-10-26)
|
|
11
|
+
|
|
12
|
+
### BREAKING CHANGES
|
|
13
|
+
|
|
14
|
+
- **LK-8763:** removed hideIncreaseQuotaButton prop ([cabbb61](https://github.com/cloud-ru-tech/snack-v2/commit/cabbb6148505166185db0c28447b231a0fa8e047))
|
|
15
|
+
|
|
6
16
|
## 1.2.4 (2026-10-21)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @ds/uikit-product-quota
|
package/README.md
CHANGED
|
@@ -57,7 +57,7 @@ import { QuotaWidget, QuotaWidgetMini, QuotaWidgetCard } from '@cloud-ru/ds-uiki
|
|
|
57
57
|
|
|
58
58
|
- `projectName` — название проекта.
|
|
59
59
|
- `quotasUrl` + `onQuotasUrlClick` — ссылка на страницу квот.
|
|
60
|
-
- `canEditQuota` + `onIncreaseQuotaClick` — кнопка «Увеличить
|
|
60
|
+
- `canEditQuota` + `onIncreaseQuotaClick` — кнопка «Увеличить квоты».
|
|
61
61
|
|
|
62
62
|
#### Список квот
|
|
63
63
|
|
|
@@ -174,7 +174,6 @@ export function QuotaWidgetError() {
|
|
|
174
174
|
| `data-test-id` | `string` | — | |
|
|
175
175
|
| `disableSorting` | `boolean` | — | Флаг отключения сортировки квот |
|
|
176
176
|
| `error` | `boolean` | — | Флаг ошибки при загрузке квот |
|
|
177
|
-
| `hideIncreaseQuotaButton` | `boolean` | — | Флаг скрытия кнопки увеличения квоты |
|
|
178
177
|
| `loading` | `boolean` | — | Флаг загрузки квот |
|
|
179
178
|
| `onIncreaseQuotaClick` | `(() => void)` | — | Колбек нажатия на кнопку увеличения квот |
|
|
180
179
|
| `onQuotasUrlClick` | `(() => void)` | — | Колбек клика по ссылке на страницу квот по проекту |
|
|
@@ -207,7 +206,6 @@ export function QuotaWidgetError() {
|
|
|
207
206
|
| `data-test-id` | `string` | — | |
|
|
208
207
|
| `disableSorting` | `boolean` | — | Флаг отключения сортировки квот |
|
|
209
208
|
| `error` | `boolean` | — | Флаг ошибки при загрузке квот |
|
|
210
|
-
| `hideIncreaseQuotaButton` | `boolean` | — | Флаг скрытия кнопки увеличения квоты |
|
|
211
209
|
| `hideMobileHeader` | `boolean` | `false` | Не рендерить мобильную шапку (её выносят в pinned-`title` контейнера, напр. BottomSheet). <br/> На desktop не влияет. |
|
|
212
210
|
| `hideMobileIncreaseButton` | `boolean` | `false` | Не рендерить мобильную кнопку расширения (её выносят в pinned-`footer` контейнера). <br/> На desktop не влияет. |
|
|
213
211
|
| `loading` | `boolean` | — | Флаг загрузки квот |
|
|
@@ -264,7 +262,7 @@ export function QuotaWidgetError() {
|
|
|
264
262
|
|
|
265
263
|
- Вертикальный список `QuotaWidgetCard`; исчерпанные квоты поднимаются в начало (`disableSorting` отключает).
|
|
266
264
|
- `loading` — skeleton-карточки; `error` — блок ошибки с кнопкой повтора (`onRefresh`).
|
|
267
|
-
- Кнопка «Увеличить квоты» (`canEditQuota`, `onIncreaseQuotaClick
|
|
265
|
+
- Кнопка «Увеличить квоты» (`canEditQuota`, `onIncreaseQuotaClick`).
|
|
268
266
|
|
|
269
267
|
### Примеры использования
|
|
270
268
|
|
|
@@ -315,7 +313,6 @@ export function QuotaWidgetMiniExpanded() {
|
|
|
315
313
|
| `defaultExpanded` | `boolean` | — | Флаг раскрытия аккордиона по умолчанию |
|
|
316
314
|
| `disableSorting` | `boolean` | — | Флаг отключения сортировки квот |
|
|
317
315
|
| `error` | `boolean` | — | Флаг ошибки при загрузке квот |
|
|
318
|
-
| `hideIncreaseQuotaButton` | `boolean` | — | Флаг скрытия кнопки увеличения квоты |
|
|
319
316
|
| `loading` | `boolean` | — | Флаг загрузки квот |
|
|
320
317
|
| `onIncreaseQuotaClick` | `(() => void)` | — | Колбек нажатия на кнопку увеличения квот |
|
|
321
318
|
| `onRefresh` | `() => void` | — | Колбек на обновление списка квот при ошибке |
|
|
@@ -9,4 +9,4 @@ export type QuotaWidgetProps = WithSupportProps<QuotaWidgetPropsBase & {
|
|
|
9
9
|
/** Свойства кнопки открытия виджета */
|
|
10
10
|
buttonProps?: Pick<ButtonProps, 'size' | 'className' | 'fullWidth' | 'label' | 'appearance' | 'disabled' | 'view'>;
|
|
11
11
|
}>;
|
|
12
|
-
export declare function QuotaWidget({ quotas, disableSorting, loading, skeletonRowCount, error, onRefresh, projectName, quotasUrl, canEditQuota,
|
|
12
|
+
export declare function QuotaWidget({ quotas, disableSorting, loading, skeletonRowCount, error, onRefresh, projectName, quotasUrl, canEditQuota, onIncreaseQuotaClick, onWidgetOpen, onQuotasUrlClick, buttonProps, ...props }: QuotaWidgetProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,7 +13,7 @@ const utils_1 = require("../../utils");
|
|
|
13
13
|
const QuotaIncreaseButton_1 = require("./QuotaIncreaseButton");
|
|
14
14
|
const QuotaMobileHeader_1 = require("./QuotaMobileHeader");
|
|
15
15
|
const QuotaWidgetContent_1 = require("./QuotaWidgetContent");
|
|
16
|
-
function QuotaWidget({ quotas, disableSorting, loading, skeletonRowCount, error, onRefresh, projectName, quotasUrl, canEditQuota,
|
|
16
|
+
function QuotaWidget({ quotas, disableSorting, loading, skeletonRowCount, error, onRefresh, projectName, quotasUrl, canEditQuota, onIncreaseQuotaClick, onWidgetOpen, onQuotasUrlClick, buttonProps, ...props }) {
|
|
17
17
|
const { t } = locale_1.quotaLocale.useTranslations();
|
|
18
18
|
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
19
19
|
const { layoutType } = (0, adaptive_1.useAdaptiveLayout)();
|
|
@@ -31,12 +31,12 @@ function QuotaWidget({ quotas, disableSorting, loading, skeletonRowCount, error,
|
|
|
31
31
|
const exhaustedCount = quotas.filter(utils_1.checkIsExceeded).length;
|
|
32
32
|
// На мобилке лист full-height: шапку и кнопку выносим в pinned-слоты BottomSheet
|
|
33
33
|
// (`title` сверху, `footer` снизу), а карточки скроллятся в теле листа — как в макете.
|
|
34
|
-
const showMobileIncreaseButton = isMobile && canEditQuota && !error
|
|
34
|
+
const showMobileIncreaseButton = isMobile && canEditQuota && !error;
|
|
35
35
|
return ((0, jsx_runtime_1.jsx)(dropdown_1.Dropdown, { ...props, placement: 'bottom-end',
|
|
36
36
|
// Desktop: отступы даёт `.content`; mobile: отступ тела даёт BottomSheet.
|
|
37
37
|
bodyPadding: isMobile,
|
|
38
38
|
// Mobile: лист на всю высоту экрана (safe-area даёт сам BottomSheet).
|
|
39
|
-
snapPoints: dropdown_1.SNAP_POINTS_PRESET.full, title: isMobile ? (0, jsx_runtime_1.jsx)(QuotaMobileHeader_1.QuotaMobileHeader, { projectName: projectName }) : undefined, footer: showMobileIncreaseButton ? (0, jsx_runtime_1.jsx)(QuotaIncreaseButton_1.QuotaIncreaseButton, { onClick: onIncreaseQuotaClick }) : undefined, open: isOpen, onOpenChange: handleOpenChange, content: (0, jsx_runtime_1.jsx)(QuotaWidgetContent_1.QuotaWidgetContent, { quotas: quotas, disableSorting: disableSorting, loading: loading, skeletonRowCount: skeletonRowCount, error: error, onRefresh: onRefresh, projectName: projectName, quotasUrl: quotasUrl, canEditQuota: canEditQuota,
|
|
39
|
+
snapPoints: dropdown_1.SNAP_POINTS_PRESET.full, title: isMobile ? (0, jsx_runtime_1.jsx)(QuotaMobileHeader_1.QuotaMobileHeader, { projectName: projectName }) : undefined, footer: showMobileIncreaseButton ? (0, jsx_runtime_1.jsx)(QuotaIncreaseButton_1.QuotaIncreaseButton, { onClick: onIncreaseQuotaClick }) : undefined, open: isOpen, onOpenChange: handleOpenChange, content: (0, jsx_runtime_1.jsx)(QuotaWidgetContent_1.QuotaWidgetContent, { quotas: quotas, disableSorting: disableSorting, loading: loading, skeletonRowCount: skeletonRowCount, error: error, onRefresh: onRefresh, projectName: projectName, quotasUrl: quotasUrl, canEditQuota: canEditQuota, onIncreaseQuotaClick: onIncreaseQuotaClick, onQuotasUrlClick: onQuotasUrlClick, hideMobileHeader: isMobile, hideMobileIncreaseButton: isMobile, "data-test-id": contentTestId }), children: (0, jsx_runtime_1.jsx)(button_1.Button
|
|
40
40
|
// На мобилке триггер бордюрный (`outline` — как в макете кнопки квот),
|
|
41
41
|
// на desktop — плоский `function`. Переопределяется через `buttonProps.view`.
|
|
42
42
|
, {
|
|
@@ -24,4 +24,4 @@ export type QuotaWidgetContentProps = WithSupportProps<QuotaWidgetPropsBase & {
|
|
|
24
24
|
* На full-height BottomSheet шапка/кнопка уезжают в pinned-слоты `title`/`footer` (см. `QuotaWidget`),
|
|
25
25
|
* а сюда остаются только карточки — тогда `hideMobileHeader`/`hideMobileIncreaseButton` = true.
|
|
26
26
|
*/
|
|
27
|
-
export declare function QuotaWidgetContent({ quotas, disableSorting, loading, skeletonRowCount, error, onRefresh, projectName, quotasUrl, canEditQuota,
|
|
27
|
+
export declare function QuotaWidgetContent({ quotas, disableSorting, loading, skeletonRowCount, error, onRefresh, projectName, quotasUrl, canEditQuota, onIncreaseQuotaClick, onQuotasUrlClick, hideMobileHeader, hideMobileIncreaseButton, ...props }: QuotaWidgetContentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -20,14 +20,14 @@ const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
|
20
20
|
* На full-height BottomSheet шапка/кнопка уезжают в pinned-слоты `title`/`footer` (см. `QuotaWidget`),
|
|
21
21
|
* а сюда остаются только карточки — тогда `hideMobileHeader`/`hideMobileIncreaseButton` = true.
|
|
22
22
|
*/
|
|
23
|
-
function QuotaWidgetContent({ quotas, disableSorting, loading, skeletonRowCount, error, onRefresh, projectName, quotasUrl, canEditQuota,
|
|
23
|
+
function QuotaWidgetContent({ quotas, disableSorting, loading, skeletonRowCount, error, onRefresh, projectName, quotasUrl, canEditQuota, onIncreaseQuotaClick, onQuotasUrlClick, hideMobileHeader = false, hideMobileIncreaseButton = false, ...props }) {
|
|
24
24
|
const { layoutType } = (0, adaptive_1.useAdaptiveLayout)();
|
|
25
25
|
const isMobile = (0, adaptive_1.isMobileLayout)(layoutType);
|
|
26
26
|
const contentTestId = props['data-test-id'] ?? constants_1.TEST_IDS.quotaWidget.content;
|
|
27
|
-
const showMobileIncreaseButton = isMobile && !hideMobileIncreaseButton && canEditQuota && !error
|
|
27
|
+
const showMobileIncreaseButton = isMobile && !hideMobileIncreaseButton && canEditQuota && !error;
|
|
28
28
|
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.content, "data-mobile": isMobile, "data-test-id": contentTestId, children: [isMobile ? (
|
|
29
29
|
// Мобильная шапка (макет): «Квоты» + имя проекта, без пиктограммы/ссылки/подзаголовка «Остаток…».
|
|
30
30
|
!hideMobileHeader && (0, jsx_runtime_1.jsx)(QuotaMobileHeader_1.QuotaMobileHeader, { projectName: projectName })) : (
|
|
31
31
|
// Desktop-popover: полная шапка проекта (с пиктограммой, ссылкой и кнопкой расширения).
|
|
32
|
-
(0, jsx_runtime_1.jsx)(ProjectHeader_1.ProjectHeader, { projectName: projectName, quotasUrl: quotasUrl, canEditQuota: canEditQuota, error: error, onIncreaseQuotaClick: onIncreaseQuotaClick,
|
|
32
|
+
(0, jsx_runtime_1.jsx)(ProjectHeader_1.ProjectHeader, { projectName: projectName, quotasUrl: quotasUrl, canEditQuota: canEditQuota, error: error, onIncreaseQuotaClick: onIncreaseQuotaClick, onQuotasUrlClick: onQuotasUrlClick })), (0, jsx_runtime_1.jsx)(QuotaCardsGrid_1.QuotaCardsGrid, { quotas: quotas, disableSorting: disableSorting, loading: loading, skeletonRowCount: skeletonRowCount, error: error, onRefresh: onRefresh }), showMobileIncreaseButton && (0, jsx_runtime_1.jsx)(QuotaIncreaseButton_1.QuotaIncreaseButton, { onClick: onIncreaseQuotaClick })] }));
|
|
33
33
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { QuotaWidgetPropsBase } from '../../../../types';
|
|
2
|
-
type ProjectHeaderProps = Pick<QuotaWidgetPropsBase, 'projectName' | 'canEditQuota' | 'error' | '
|
|
2
|
+
type ProjectHeaderProps = Pick<QuotaWidgetPropsBase, 'projectName' | 'canEditQuota' | 'error' | 'onIncreaseQuotaClick'> & {
|
|
3
3
|
quotasUrl: string;
|
|
4
4
|
onQuotasUrlClick?: () => void;
|
|
5
5
|
};
|
|
6
|
-
export declare function ProjectHeader({ projectName, quotasUrl, canEditQuota, error, onIncreaseQuotaClick,
|
|
6
|
+
export declare function ProjectHeader({ projectName, quotasUrl, canEditQuota, error, onIncreaseQuotaClick, onQuotasUrlClick, }: ProjectHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export {};
|
|
@@ -12,8 +12,8 @@ const constants_1 = require("../../../../constants");
|
|
|
12
12
|
const locale_1 = require("../../../../locale");
|
|
13
13
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
14
14
|
const RUSSIAN_CHARS_REGEXP = /[А-Яа-яЁё]/;
|
|
15
|
-
function ProjectHeader({ projectName, quotasUrl, canEditQuota, error, onIncreaseQuotaClick,
|
|
15
|
+
function ProjectHeader({ projectName, quotasUrl, canEditQuota, error, onIncreaseQuotaClick, onQuotasUrlClick, }) {
|
|
16
16
|
const { t } = locale_1.quotaLocale.useTranslations();
|
|
17
17
|
const widgetTitle = RUSSIAN_CHARS_REGEXP.test(projectName) ? 'widgetTitle.quotes' : 'widgetTitle.noQuotes';
|
|
18
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.header, "data-test-id": constants_1.TEST_IDS.quotaWidget.projectHeader, children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.projectWrapper, children: [(0, jsx_runtime_1.jsx)(uikit_product_title_clickable_1.TitleClickable, { className: styles_module_scss_1.default.titleLink, content: (0, jsx_runtime_1.jsx)(uikit_product_title_clickable_1.TitleClickable.SimpleTitle, { title: t(widgetTitle, { project: projectName }), icon: (0, jsx_runtime_1.jsx)(web_1.CloudFolderSVG, {}) }), href: quotasUrl, target: '_blank', onClick: onQuotasUrlClick }), (0, jsx_runtime_1.jsx)("p", { className: styles_module_scss_1.default.subtitle, children: t('widgetSubtitle') })] }), canEditQuota && !error &&
|
|
18
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.header, "data-test-id": constants_1.TEST_IDS.quotaWidget.projectHeader, children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.projectWrapper, children: [(0, jsx_runtime_1.jsx)(uikit_product_title_clickable_1.TitleClickable, { className: styles_module_scss_1.default.titleLink, content: (0, jsx_runtime_1.jsx)(uikit_product_title_clickable_1.TitleClickable.SimpleTitle, { title: t(widgetTitle, { project: projectName }), icon: (0, jsx_runtime_1.jsx)(web_1.CloudFolderSVG, {}) }), href: quotasUrl, target: '_blank', onClick: onQuotasUrlClick }), (0, jsx_runtime_1.jsx)("p", { className: styles_module_scss_1.default.subtitle, children: t('widgetSubtitle') })] }), canEditQuota && !error && ((0, jsx_runtime_1.jsx)(button_1.Button, { view: 'outline', appearance: 'neutral', label: t('increaseQuota'), size: 'm', onClick: onIncreaseQuotaClick }))] }));
|
|
19
19
|
}
|
|
@@ -4,4 +4,4 @@ export type QuotaWidgetMiniProps = WithSupportProps<QuotaWidgetPropsBase & {
|
|
|
4
4
|
/** Флаг раскрытия аккордиона по умолчанию */
|
|
5
5
|
defaultExpanded?: boolean;
|
|
6
6
|
}>;
|
|
7
|
-
export declare function QuotaWidgetMini({ quotas, disableSorting, loading, skeletonRowCount, error, onRefresh, projectName, canEditQuota, defaultExpanded,
|
|
7
|
+
export declare function QuotaWidgetMini({ quotas, disableSorting, loading, skeletonRowCount, error, onRefresh, projectName, canEditQuota, defaultExpanded, onIncreaseQuotaClick, onWidgetOpen, 'data-test-id': dataTestId, ...props }: QuotaWidgetMiniProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -15,7 +15,7 @@ const locale_1 = require("../../locale");
|
|
|
15
15
|
const utils_1 = require("../../utils");
|
|
16
16
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
17
17
|
const ACCORDION_ID = 'quotas-widget-accordion';
|
|
18
|
-
function QuotaWidgetMini({ quotas, disableSorting, loading, skeletonRowCount, error, onRefresh, projectName, canEditQuota, defaultExpanded,
|
|
18
|
+
function QuotaWidgetMini({ quotas, disableSorting, loading, skeletonRowCount, error, onRefresh, projectName, canEditQuota, defaultExpanded, onIncreaseQuotaClick, onWidgetOpen, 'data-test-id': dataTestId, ...props }) {
|
|
19
19
|
const { t } = locale_1.quotaLocale.useTranslations();
|
|
20
20
|
const exhaustedCount = quotas.filter(utils_1.checkIsExceeded).length;
|
|
21
21
|
const handleExpandedChange = (expanded) => {
|
|
@@ -23,5 +23,5 @@ function QuotaWidgetMini({ quotas, disableSorting, loading, skeletonRowCount, er
|
|
|
23
23
|
onWidgetOpen?.();
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
-
return ((0, jsx_runtime_1.jsx)("div", { "data-test-id": dataTestId ?? constants_1.TEST_IDS.quotaWidgetMini.root, children: (0, jsx_runtime_1.jsx)(accordion_1.Accordion, { ...props, expandedDefault: defaultExpanded ? ACCORDION_ID : undefined, onExpandedChange: handleExpandedChange, children: (0, jsx_runtime_1.jsx)(accordion_1.Accordion.CollapseBlockSecondary, { id: ACCORDION_ID, className: styles_module_scss_1.default.collapse, "data-test-id": constants_1.TEST_IDS.quotaWidgetMini.trigger, title: t('quotas'), afterTitle: !error && !loading && exhaustedCount > 0 ? ((0, jsx_runtime_1.jsx)(counter_1.Counter, { value: exhaustedCount, size: 'xs', appearance: 'red' })) : undefined, subTitle: (0, jsx_runtime_1.jsx)(truncate_string_1.TruncateString, { maxLines: 1, text: projectName }), children: (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.body, "data-test-id": constants_1.TEST_IDS.quotaWidgetMini.content, children: [(0, jsx_runtime_1.jsx)(QuotaCardsGrid_1.QuotaCardsGrid, { isAccordion: true, quotas: quotas, disableSorting: disableSorting, loading: loading, skeletonRowCount: skeletonRowCount, error: error, onRefresh: onRefresh }), !error && canEditQuota &&
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)("div", { "data-test-id": dataTestId ?? constants_1.TEST_IDS.quotaWidgetMini.root, children: (0, jsx_runtime_1.jsx)(accordion_1.Accordion, { ...props, expandedDefault: defaultExpanded ? ACCORDION_ID : undefined, onExpandedChange: handleExpandedChange, children: (0, jsx_runtime_1.jsx)(accordion_1.Accordion.CollapseBlockSecondary, { id: ACCORDION_ID, className: styles_module_scss_1.default.collapse, "data-test-id": constants_1.TEST_IDS.quotaWidgetMini.trigger, title: t('quotas'), afterTitle: !error && !loading && exhaustedCount > 0 ? ((0, jsx_runtime_1.jsx)(counter_1.Counter, { value: exhaustedCount, size: 'xs', appearance: 'red' })) : undefined, subTitle: (0, jsx_runtime_1.jsx)(truncate_string_1.TruncateString, { maxLines: 1, text: projectName }), children: (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.body, "data-test-id": constants_1.TEST_IDS.quotaWidgetMini.content, children: [(0, jsx_runtime_1.jsx)(QuotaCardsGrid_1.QuotaCardsGrid, { isAccordion: true, quotas: quotas, disableSorting: disableSorting, loading: loading, skeletonRowCount: skeletonRowCount, error: error, onRefresh: onRefresh }), !error && canEditQuota && ((0, jsx_runtime_1.jsx)(button_1.Button, { className: styles_module_scss_1.default.button, fullWidth: true, view: 'outline', appearance: 'neutral', label: t('increaseQuota'), size: 'm', onClick: onIncreaseQuotaClick }))] }) }) }) }));
|
|
27
27
|
}
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -34,8 +34,6 @@ export type QuotaWidgetPropsBase = {
|
|
|
34
34
|
projectName: string;
|
|
35
35
|
/** Флаг наличия прав на редактирование квот */
|
|
36
36
|
canEditQuota: boolean;
|
|
37
|
-
/** Флаг скрытия кнопки увеличения квоты */
|
|
38
|
-
hideIncreaseQuotaButton?: boolean;
|
|
39
37
|
/** Колбек нажатия на кнопку увеличения квот */
|
|
40
38
|
onIncreaseQuotaClick?: () => void;
|
|
41
39
|
/** Колбек открытия виджета квот */
|
|
@@ -9,4 +9,4 @@ export type QuotaWidgetProps = WithSupportProps<QuotaWidgetPropsBase & {
|
|
|
9
9
|
/** Свойства кнопки открытия виджета */
|
|
10
10
|
buttonProps?: Pick<ButtonProps, 'size' | 'className' | 'fullWidth' | 'label' | 'appearance' | 'disabled' | 'view'>;
|
|
11
11
|
}>;
|
|
12
|
-
export declare function QuotaWidget({ quotas, disableSorting, loading, skeletonRowCount, error, onRefresh, projectName, quotasUrl, canEditQuota,
|
|
12
|
+
export declare function QuotaWidget({ quotas, disableSorting, loading, skeletonRowCount, error, onRefresh, projectName, quotasUrl, canEditQuota, onIncreaseQuotaClick, onWidgetOpen, onQuotasUrlClick, buttonProps, ...props }: QuotaWidgetProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -10,7 +10,7 @@ import { checkIsExceeded } from '../../utils/index.js';
|
|
|
10
10
|
import { QuotaIncreaseButton } from './QuotaIncreaseButton.js';
|
|
11
11
|
import { QuotaMobileHeader } from './QuotaMobileHeader.js';
|
|
12
12
|
import { QuotaWidgetContent } from './QuotaWidgetContent.js';
|
|
13
|
-
export function QuotaWidget({ quotas, disableSorting, loading, skeletonRowCount, error, onRefresh, projectName, quotasUrl, canEditQuota,
|
|
13
|
+
export function QuotaWidget({ quotas, disableSorting, loading, skeletonRowCount, error, onRefresh, projectName, quotasUrl, canEditQuota, onIncreaseQuotaClick, onWidgetOpen, onQuotasUrlClick, buttonProps, ...props }) {
|
|
14
14
|
const { t } = quotaLocale.useTranslations();
|
|
15
15
|
const [isOpen, setIsOpen] = useState(false);
|
|
16
16
|
const { layoutType } = useAdaptiveLayout();
|
|
@@ -28,12 +28,12 @@ export function QuotaWidget({ quotas, disableSorting, loading, skeletonRowCount,
|
|
|
28
28
|
const exhaustedCount = quotas.filter(checkIsExceeded).length;
|
|
29
29
|
// На мобилке лист full-height: шапку и кнопку выносим в pinned-слоты BottomSheet
|
|
30
30
|
// (`title` сверху, `footer` снизу), а карточки скроллятся в теле листа — как в макете.
|
|
31
|
-
const showMobileIncreaseButton = isMobile && canEditQuota && !error
|
|
31
|
+
const showMobileIncreaseButton = isMobile && canEditQuota && !error;
|
|
32
32
|
return (_jsx(Dropdown, { ...props, placement: 'bottom-end',
|
|
33
33
|
// Desktop: отступы даёт `.content`; mobile: отступ тела даёт BottomSheet.
|
|
34
34
|
bodyPadding: isMobile,
|
|
35
35
|
// Mobile: лист на всю высоту экрана (safe-area даёт сам BottomSheet).
|
|
36
|
-
snapPoints: SNAP_POINTS_PRESET.full, title: isMobile ? _jsx(QuotaMobileHeader, { projectName: projectName }) : undefined, footer: showMobileIncreaseButton ? _jsx(QuotaIncreaseButton, { onClick: onIncreaseQuotaClick }) : undefined, open: isOpen, onOpenChange: handleOpenChange, content: _jsx(QuotaWidgetContent, { quotas: quotas, disableSorting: disableSorting, loading: loading, skeletonRowCount: skeletonRowCount, error: error, onRefresh: onRefresh, projectName: projectName, quotasUrl: quotasUrl, canEditQuota: canEditQuota,
|
|
36
|
+
snapPoints: SNAP_POINTS_PRESET.full, title: isMobile ? _jsx(QuotaMobileHeader, { projectName: projectName }) : undefined, footer: showMobileIncreaseButton ? _jsx(QuotaIncreaseButton, { onClick: onIncreaseQuotaClick }) : undefined, open: isOpen, onOpenChange: handleOpenChange, content: _jsx(QuotaWidgetContent, { quotas: quotas, disableSorting: disableSorting, loading: loading, skeletonRowCount: skeletonRowCount, error: error, onRefresh: onRefresh, projectName: projectName, quotasUrl: quotasUrl, canEditQuota: canEditQuota, onIncreaseQuotaClick: onIncreaseQuotaClick, onQuotasUrlClick: onQuotasUrlClick, hideMobileHeader: isMobile, hideMobileIncreaseButton: isMobile, "data-test-id": contentTestId }), children: _jsx(Button
|
|
37
37
|
// На мобилке триггер бордюрный (`outline` — как в макете кнопки квот),
|
|
38
38
|
// на desktop — плоский `function`. Переопределяется через `buttonProps.view`.
|
|
39
39
|
, {
|
|
@@ -24,4 +24,4 @@ export type QuotaWidgetContentProps = WithSupportProps<QuotaWidgetPropsBase & {
|
|
|
24
24
|
* На full-height BottomSheet шапка/кнопка уезжают в pinned-слоты `title`/`footer` (см. `QuotaWidget`),
|
|
25
25
|
* а сюда остаются только карточки — тогда `hideMobileHeader`/`hideMobileIncreaseButton` = true.
|
|
26
26
|
*/
|
|
27
|
-
export declare function QuotaWidgetContent({ quotas, disableSorting, loading, skeletonRowCount, error, onRefresh, projectName, quotasUrl, canEditQuota,
|
|
27
|
+
export declare function QuotaWidgetContent({ quotas, disableSorting, loading, skeletonRowCount, error, onRefresh, projectName, quotasUrl, canEditQuota, onIncreaseQuotaClick, onQuotasUrlClick, hideMobileHeader, hideMobileIncreaseButton, ...props }: QuotaWidgetContentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -14,14 +14,14 @@ import styles from './styles.module.css';
|
|
|
14
14
|
* На full-height BottomSheet шапка/кнопка уезжают в pinned-слоты `title`/`footer` (см. `QuotaWidget`),
|
|
15
15
|
* а сюда остаются только карточки — тогда `hideMobileHeader`/`hideMobileIncreaseButton` = true.
|
|
16
16
|
*/
|
|
17
|
-
export function QuotaWidgetContent({ quotas, disableSorting, loading, skeletonRowCount, error, onRefresh, projectName, quotasUrl, canEditQuota,
|
|
17
|
+
export function QuotaWidgetContent({ quotas, disableSorting, loading, skeletonRowCount, error, onRefresh, projectName, quotasUrl, canEditQuota, onIncreaseQuotaClick, onQuotasUrlClick, hideMobileHeader = false, hideMobileIncreaseButton = false, ...props }) {
|
|
18
18
|
const { layoutType } = useAdaptiveLayout();
|
|
19
19
|
const isMobile = isMobileLayout(layoutType);
|
|
20
20
|
const contentTestId = props['data-test-id'] ?? TEST_IDS.quotaWidget.content;
|
|
21
|
-
const showMobileIncreaseButton = isMobile && !hideMobileIncreaseButton && canEditQuota && !error
|
|
21
|
+
const showMobileIncreaseButton = isMobile && !hideMobileIncreaseButton && canEditQuota && !error;
|
|
22
22
|
return (_jsxs("div", { className: styles.content, "data-mobile": isMobile, "data-test-id": contentTestId, children: [isMobile ? (
|
|
23
23
|
// Мобильная шапка (макет): «Квоты» + имя проекта, без пиктограммы/ссылки/подзаголовка «Остаток…».
|
|
24
24
|
!hideMobileHeader && _jsx(QuotaMobileHeader, { projectName: projectName })) : (
|
|
25
25
|
// Desktop-popover: полная шапка проекта (с пиктограммой, ссылкой и кнопкой расширения).
|
|
26
|
-
_jsx(ProjectHeader, { projectName: projectName, quotasUrl: quotasUrl, canEditQuota: canEditQuota, error: error, onIncreaseQuotaClick: onIncreaseQuotaClick,
|
|
26
|
+
_jsx(ProjectHeader, { projectName: projectName, quotasUrl: quotasUrl, canEditQuota: canEditQuota, error: error, onIncreaseQuotaClick: onIncreaseQuotaClick, onQuotasUrlClick: onQuotasUrlClick })), _jsx(QuotaCardsGrid, { quotas: quotas, disableSorting: disableSorting, loading: loading, skeletonRowCount: skeletonRowCount, error: error, onRefresh: onRefresh }), showMobileIncreaseButton && _jsx(QuotaIncreaseButton, { onClick: onIncreaseQuotaClick })] }));
|
|
27
27
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { QuotaWidgetPropsBase } from '../../../../types.js';
|
|
2
|
-
type ProjectHeaderProps = Pick<QuotaWidgetPropsBase, 'projectName' | 'canEditQuota' | 'error' | '
|
|
2
|
+
type ProjectHeaderProps = Pick<QuotaWidgetPropsBase, 'projectName' | 'canEditQuota' | 'error' | 'onIncreaseQuotaClick'> & {
|
|
3
3
|
quotasUrl: string;
|
|
4
4
|
onQuotasUrlClick?: () => void;
|
|
5
5
|
};
|
|
6
|
-
export declare function ProjectHeader({ projectName, quotasUrl, canEditQuota, error, onIncreaseQuotaClick,
|
|
6
|
+
export declare function ProjectHeader({ projectName, quotasUrl, canEditQuota, error, onIncreaseQuotaClick, onQuotasUrlClick, }: ProjectHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export {};
|
|
@@ -6,8 +6,8 @@ import { TEST_IDS } from '../../../../constants.js';
|
|
|
6
6
|
import { quotaLocale } from '../../../../locale/index.js';
|
|
7
7
|
import styles from './styles.module.css';
|
|
8
8
|
const RUSSIAN_CHARS_REGEXP = /[А-Яа-яЁё]/;
|
|
9
|
-
export function ProjectHeader({ projectName, quotasUrl, canEditQuota, error, onIncreaseQuotaClick,
|
|
9
|
+
export function ProjectHeader({ projectName, quotasUrl, canEditQuota, error, onIncreaseQuotaClick, onQuotasUrlClick, }) {
|
|
10
10
|
const { t } = quotaLocale.useTranslations();
|
|
11
11
|
const widgetTitle = RUSSIAN_CHARS_REGEXP.test(projectName) ? 'widgetTitle.quotes' : 'widgetTitle.noQuotes';
|
|
12
|
-
return (_jsxs("div", { className: styles.header, "data-test-id": TEST_IDS.quotaWidget.projectHeader, children: [_jsxs("div", { className: styles.projectWrapper, children: [_jsx(TitleClickable, { className: styles.titleLink, content: _jsx(TitleClickable.SimpleTitle, { title: t(widgetTitle, { project: projectName }), icon: _jsx(CloudFolderSVG, {}) }), href: quotasUrl, target: '_blank', onClick: onQuotasUrlClick }), _jsx("p", { className: styles.subtitle, children: t('widgetSubtitle') })] }), canEditQuota && !error &&
|
|
12
|
+
return (_jsxs("div", { className: styles.header, "data-test-id": TEST_IDS.quotaWidget.projectHeader, children: [_jsxs("div", { className: styles.projectWrapper, children: [_jsx(TitleClickable, { className: styles.titleLink, content: _jsx(TitleClickable.SimpleTitle, { title: t(widgetTitle, { project: projectName }), icon: _jsx(CloudFolderSVG, {}) }), href: quotasUrl, target: '_blank', onClick: onQuotasUrlClick }), _jsx("p", { className: styles.subtitle, children: t('widgetSubtitle') })] }), canEditQuota && !error && (_jsx(Button, { view: 'outline', appearance: 'neutral', label: t('increaseQuota'), size: 'm', onClick: onIncreaseQuotaClick }))] }));
|
|
13
13
|
}
|
|
@@ -4,4 +4,4 @@ export type QuotaWidgetMiniProps = WithSupportProps<QuotaWidgetPropsBase & {
|
|
|
4
4
|
/** Флаг раскрытия аккордиона по умолчанию */
|
|
5
5
|
defaultExpanded?: boolean;
|
|
6
6
|
}>;
|
|
7
|
-
export declare function QuotaWidgetMini({ quotas, disableSorting, loading, skeletonRowCount, error, onRefresh, projectName, canEditQuota, defaultExpanded,
|
|
7
|
+
export declare function QuotaWidgetMini({ quotas, disableSorting, loading, skeletonRowCount, error, onRefresh, projectName, canEditQuota, defaultExpanded, onIncreaseQuotaClick, onWidgetOpen, 'data-test-id': dataTestId, ...props }: QuotaWidgetMiniProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -9,7 +9,7 @@ import { quotaLocale } from '../../locale/index.js';
|
|
|
9
9
|
import { checkIsExceeded } from '../../utils/index.js';
|
|
10
10
|
import styles from './styles.module.css';
|
|
11
11
|
const ACCORDION_ID = 'quotas-widget-accordion';
|
|
12
|
-
export function QuotaWidgetMini({ quotas, disableSorting, loading, skeletonRowCount, error, onRefresh, projectName, canEditQuota, defaultExpanded,
|
|
12
|
+
export function QuotaWidgetMini({ quotas, disableSorting, loading, skeletonRowCount, error, onRefresh, projectName, canEditQuota, defaultExpanded, onIncreaseQuotaClick, onWidgetOpen, 'data-test-id': dataTestId, ...props }) {
|
|
13
13
|
const { t } = quotaLocale.useTranslations();
|
|
14
14
|
const exhaustedCount = quotas.filter(checkIsExceeded).length;
|
|
15
15
|
const handleExpandedChange = (expanded) => {
|
|
@@ -17,5 +17,5 @@ export function QuotaWidgetMini({ quotas, disableSorting, loading, skeletonRowCo
|
|
|
17
17
|
onWidgetOpen?.();
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
return (_jsx("div", { "data-test-id": dataTestId ?? TEST_IDS.quotaWidgetMini.root, children: _jsx(Accordion, { ...props, expandedDefault: defaultExpanded ? ACCORDION_ID : undefined, onExpandedChange: handleExpandedChange, children: _jsx(Accordion.CollapseBlockSecondary, { id: ACCORDION_ID, className: styles.collapse, "data-test-id": TEST_IDS.quotaWidgetMini.trigger, title: t('quotas'), afterTitle: !error && !loading && exhaustedCount > 0 ? (_jsx(Counter, { value: exhaustedCount, size: 'xs', appearance: 'red' })) : undefined, subTitle: _jsx(TruncateString, { maxLines: 1, text: projectName }), children: _jsxs("div", { className: styles.body, "data-test-id": TEST_IDS.quotaWidgetMini.content, children: [_jsx(QuotaCardsGrid, { isAccordion: true, quotas: quotas, disableSorting: disableSorting, loading: loading, skeletonRowCount: skeletonRowCount, error: error, onRefresh: onRefresh }), !error && canEditQuota &&
|
|
20
|
+
return (_jsx("div", { "data-test-id": dataTestId ?? TEST_IDS.quotaWidgetMini.root, children: _jsx(Accordion, { ...props, expandedDefault: defaultExpanded ? ACCORDION_ID : undefined, onExpandedChange: handleExpandedChange, children: _jsx(Accordion.CollapseBlockSecondary, { id: ACCORDION_ID, className: styles.collapse, "data-test-id": TEST_IDS.quotaWidgetMini.trigger, title: t('quotas'), afterTitle: !error && !loading && exhaustedCount > 0 ? (_jsx(Counter, { value: exhaustedCount, size: 'xs', appearance: 'red' })) : undefined, subTitle: _jsx(TruncateString, { maxLines: 1, text: projectName }), children: _jsxs("div", { className: styles.body, "data-test-id": TEST_IDS.quotaWidgetMini.content, children: [_jsx(QuotaCardsGrid, { isAccordion: true, quotas: quotas, disableSorting: disableSorting, loading: loading, skeletonRowCount: skeletonRowCount, error: error, onRefresh: onRefresh }), !error && canEditQuota && (_jsx(Button, { className: styles.button, fullWidth: true, view: 'outline', appearance: 'neutral', label: t('increaseQuota'), size: 'm', onClick: onIncreaseQuotaClick }))] }) }) }) }));
|
|
21
21
|
}
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -34,8 +34,6 @@ export type QuotaWidgetPropsBase = {
|
|
|
34
34
|
projectName: string;
|
|
35
35
|
/** Флаг наличия прав на редактирование квот */
|
|
36
36
|
canEditQuota: boolean;
|
|
37
|
-
/** Флаг скрытия кнопки увеличения квоты */
|
|
38
|
-
hideIncreaseQuotaButton?: boolean;
|
|
39
37
|
/** Колбек нажатия на кнопку увеличения квот */
|
|
40
38
|
onIncreaseQuotaClick?: () => void;
|
|
41
39
|
/** Колбек открытия виджета квот */
|