@cloud-ru/ds-toolbar 2.1.11 → 2.1.12-preview-15dc0d59.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 (42) hide show
  1. package/README.md +4 -4
  2. package/dist/cjs/components/Toolbar/Toolbar.js +3 -3
  3. package/dist/cjs/components/Toolbar/styles.module.css +1 -0
  4. package/dist/cjs/components/Toolbar/{helpers.d.ts → utils/bulkActions.d.ts} +2 -2
  5. package/dist/cjs/helperComponents/BulkActions/components/BulkActionsControls/BulkActionsControls.js +1 -3
  6. package/dist/cjs/helperComponents/BulkActions/components/MobileBulkActionsSheet/MobileBulkActionsSheet.js +1 -3
  7. package/dist/cjs/helperComponents/BulkActions/components/SelectionLabel/SelectionLabel.js +1 -1
  8. package/dist/cjs/helperComponents/BulkActions/components/index.d.ts +1 -1
  9. package/dist/cjs/helperComponents/BulkActions/components/index.js +1 -1
  10. package/dist/cjs/helperComponents/BulkActions/styles.module.css +0 -1
  11. package/dist/cjs/helperComponents/FilterButton/FilterButton.js +1 -1
  12. package/dist/cjs/style.css +1 -1
  13. package/dist/cjs/testIds.d.ts +1 -1
  14. package/dist/cjs/testIds.js +1 -1
  15. package/dist/esm/components/Toolbar/Toolbar.js +1 -1
  16. package/dist/esm/components/Toolbar/styles.module.css +1 -0
  17. package/dist/esm/components/Toolbar/{helpers.d.ts → utils/bulkActions.d.ts} +2 -2
  18. package/dist/esm/helperComponents/BulkActions/components/BulkActionsControls/BulkActionsControls.js +1 -3
  19. package/dist/esm/helperComponents/BulkActions/components/MobileBulkActionsSheet/MobileBulkActionsSheet.js +1 -3
  20. package/dist/esm/helperComponents/BulkActions/components/SelectionLabel/SelectionLabel.js +1 -1
  21. package/dist/esm/helperComponents/BulkActions/components/index.d.ts +1 -1
  22. package/dist/esm/helperComponents/BulkActions/components/index.js +1 -1
  23. package/dist/esm/helperComponents/BulkActions/styles.module.css +0 -1
  24. package/dist/esm/helperComponents/FilterButton/FilterButton.js +1 -1
  25. package/dist/esm/style.css +1 -1
  26. package/dist/esm/testIds.d.ts +1 -1
  27. package/dist/esm/testIds.js +1 -1
  28. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  29. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  30. package/package.json +17 -17
  31. package/src/components/Toolbar/Toolbar.tsx +1 -1
  32. package/src/components/Toolbar/styles.module.scss +2 -0
  33. package/src/components/Toolbar/{helpers.ts → utils/bulkActions.ts} +1 -1
  34. package/src/helperComponents/BulkActions/components/BulkActionsControls/BulkActionsControls.tsx +1 -1
  35. package/src/helperComponents/BulkActions/components/MobileBulkActionsSheet/MobileBulkActionsSheet.tsx +0 -1
  36. package/src/helperComponents/BulkActions/components/SelectionLabel/SelectionLabel.tsx +1 -1
  37. package/src/helperComponents/BulkActions/components/index.ts +1 -1
  38. package/src/helperComponents/BulkActions/styles.module.scss +9 -2
  39. package/src/helperComponents/FilterButton/FilterButton.tsx +2 -2
  40. package/src/testIds.ts +1 -1
  41. /package/dist/cjs/components/Toolbar/{helpers.js → utils/bulkActions.js} +0 -0
  42. /package/dist/esm/components/Toolbar/{helpers.js → utils/bulkActions.js} +0 -0
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  `@cloud-ru/ds-toolbar` — Панель инструментов списков и таблиц — поиск, фильтры, массовые действия, меню «Ещё».
4
4
 
5
- `Toolbar` — композитная панель над таблицей или списком: поиск, обновление, фильтры, переключатель вида данных, массовые действия и overflow-меню «⋯». Панель адаптивна: на mobile меню «⋯» и bulk-действия переезжают в `BottomSheet`. Раскладку компонент берёт из `AdaptiveProvider` — отдельного пропа `layoutType` нет.
5
+ `Toolbar` — композитная панель над таблицей или списком: поиск, обновление, фильтры, переключатель вида данных, массовые действия и overflow-меню «⋯». Панель адаптивна: на mobile меню «⋯» и массовые действия открываются в `BottomSheet`. Раскладку компонент берёт из `AdaptiveProvider` — отдельного пропа `layoutType` нет.
6
6
 
7
7
  ## Когда использовать
8
8
 
@@ -256,7 +256,7 @@ export function WithDataView() {
256
256
  |------|------|---------|-------------|
257
257
  | `className` | `string \| undefined` | — | CSS-класс |
258
258
  | `defaultValue` | `Partial<TState> \| undefined` | — | Начальное состояние фильтров |
259
- | `filters` | `BaseChipProps` \| `ChipChoiceDateWithSeconds` \| `ChipChoiceRowFilter` \| `DropdownBridgeProps` \| `DroplistListProps` \| `DroplistMobileSlots` \| `EmptyState` \| `PublicListContextType` \| `ScrollProps` \| `SelectionMultipleState` \| `SelectionSingleState` \| `SelectionState` | — | Массив чипов |
259
+ | `filters` | `BaseChipProps` \| `ChipChoiceDateWithSeconds` \| `ChipChoiceRowFilter` \| `DropdownBridgeProps` \| `DroplistAdaptiveProps` \| `DroplistListProps` \| `DroplistMobileSlots` \| `EmptyState` \| `PublicListContextType` \| `ScrollProps` \| `SelectionMultipleState` \| `SelectionSingleState` \| `SelectionState` | — | Массив чипов |
260
260
  | `initialOpen` | `boolean \| undefined` | — | Начальное состояние filter-row (mobile) |
261
261
  | `onChange` | `((filters: TState) => void) \| undefined` | — | Колбек изменения состояния фильтров |
262
262
  | `onOpenChange` | `((isOpen: boolean) => void) \| undefined` | — | |
@@ -311,13 +311,13 @@ export function WithDataView() {
311
311
  `Toolbar` — адаптивный компонент: DOM остаётся единым, но при mobile-раскладке панель перестраивается. Раскладку он берёт из `AdaptiveProvider` (контекст `@cloud-ru/ds-adaptive`); публичный API единый для обеих платформ:
312
312
 
313
313
  - **desktop** (по умолчанию) — overflow «⋯» открывается в `Droplist`, bulk-действия идут строкой под чипами фильтров.
314
- - **mobile** — overflow «⋯» и bulk-действия переезжают в `BottomSheet` (панель снизу без backdrop при активном выборе). Кнопки слота `after` переносятся пунктами в меню «⋯»; элементы `pinnedAfter` остаются в строке панели (так `Table` держит отдельную кнопку сортировки).
314
+ - **mobile** — массовые действия автоматически открываются в `BottomSheet` при выборе строк. Кнопки слота `after` переносятся пунктами в меню «⋯»; элементы `pinnedAfter` остаются в строке панели (так `Table` держит отдельную кнопку сортировки).
315
315
 
316
316
  Верстайте под desktop и поставьте один `<AdaptiveProvider>` в корне приложения — mobile-перестроение включается автоматически (desktop-first). Пропа `layoutType` у компонента нет: источник раскладки — только контекст.
317
317
 
318
318
  ### Mobile layout
319
319
 
320
- Mobile-раскладка — включите чекбокс, чтобы открыть bulk-панель в BottomSheet внутри рамки
320
+ Mobile-раскладка — выберите строки и откройте дополнительные действия кнопкой «⋯»
321
321
 
322
322
  ```tsx
323
323
  import { AdaptiveProvider, LAYOUT_TYPE } from '@cloud-ru/ds-adaptive';
@@ -15,15 +15,15 @@ const react_1 = require("react");
15
15
  const helperComponents_1 = require("../../helperComponents");
16
16
  const locale_1 = require("../../locale");
17
17
  const testIds_1 = require("../../testIds");
18
- const helpers_1 = require("./helpers");
19
18
  const hooks_1 = require("./hooks");
20
19
  const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
21
20
  const buildMobileOverflowActions_1 = require("./utils/buildMobileOverflowActions");
21
+ const bulkActions_1 = require("./utils/bulkActions");
22
22
  function Toolbar({ className, after, pinnedAfter, dataView, outline = true, moreActions, onRefresh, search, filterRow: filterRowProps, persist, ...rest }) {
23
23
  const { layoutType } = (0, adaptive_1.useAdaptiveLayout)();
24
24
  const { t } = locale_1.toolbarLocale.useTranslations();
25
25
  const supportProps = (0, utils_1.extractSupportProps)(rest);
26
- const needsBulkActions = (0, helpers_1.isBulkActionsProps)(rest);
26
+ const needsBulkActions = (0, bulkActions_1.isBulkActionsProps)(rest);
27
27
  const isMobile = (0, adaptive_1.isMobileLayout)(layoutType);
28
28
  const containerWrapperRef = (0, react_1.useRef)(null);
29
29
  const { filterButton, filterRow } = (0, hooks_1.useFilters)({ filterRow: filterRowProps });
@@ -44,5 +44,5 @@ function Toolbar({ className, after, pinnedAfter, dataView, outline = true, more
44
44
  const showDataView = Boolean(dataView?.show);
45
45
  const hasRightSideElements = Boolean(showAfterSlot || showDataView || showMoreActionsMenu || filterRowProps);
46
46
  const showSeparatorAfterExtra = Boolean(showAfterSlot && (showDataView || filterButton || showMoreActionsMenu));
47
- return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.containerWrapper, ref: containerWrapperRef, ...supportProps, "data-test-id": supportProps['data-test-id'] ?? testIds_1.TEST_IDS.main, children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.container, className), "data-acrylic-appearance": 'neutral', "data-acrylic-level": '1Level', children: [(0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.acrylic, "aria-hidden": true }), outline && (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.border, "aria-hidden": true }), (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.content, children: [hasLeftSideElements && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.beforeSearch, children: (0, jsx_runtime_1.jsx)(button_1.Button, { view: 'function', appearance: 'neutral', icon: (0, jsx_runtime_1.jsx)(system_1.UpdateSVG, {}), size: 'm', className: styles_module_scss_1.default.updateButton, onClick: onRefresh, "data-test-id": testIds_1.TEST_IDS.refreshButton }) })), hasLeftSideElements && (0, jsx_runtime_1.jsx)(helperComponents_1.Separator, {}), (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.searchWrapper, children: search && (0, jsx_runtime_1.jsx)(helperComponents_1.Search, { ...search }) }), hasRightSideElements && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(helperComponents_1.Separator, {}), showAfterSlot && ((0, jsx_runtime_1.jsxs)("div", { "data-test-id": testIds_1.TEST_IDS.after, className: styles_module_scss_1.default.slot, children: [pinnedAfter, !isMobile && after] })), showSeparatorAfterExtra && (0, jsx_runtime_1.jsx)(helperComponents_1.Separator, {}), showDataView && dataView && ((0, jsx_runtime_1.jsx)("div", { "data-test-id": testIds_1.TEST_IDS.dataView, className: styles_module_scss_1.default.slot, children: (0, jsx_runtime_1.jsx)(helperComponents_1.DataView, { value: dataView.value, defaultValue: dataView.defaultValue, onChange: dataView.onChange, items: dataView.items }) })), filterButton && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.slot, children: (0, jsx_runtime_1.jsx)(helperComponents_1.FilterButton, { ...filterButton }) })), showMoreActionsMenu && effectiveMoreActions && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.slot, children: (0, jsx_runtime_1.jsx)(helperComponents_1.MoreActions, { moreActions: effectiveMoreActions }) }))] }))] })] }), filterRow && (0, jsx_runtime_1.jsx)(chips_1.ChipChoiceRow, { ...filterRow, size: 's', "data-test-id": testIds_1.TEST_IDS.filterRow }), needsBulkActions && ((0, jsx_runtime_1.jsx)(helperComponents_1.BulkActions, { ...(0, helpers_1.extractBulkActionsProps)(rest), resizingContainerRef: containerWrapperRef }))] }));
47
+ return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.containerWrapper, ref: containerWrapperRef, ...supportProps, "data-test-id": supportProps['data-test-id'] ?? testIds_1.TEST_IDS.main, children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.container, className), "data-acrylic-appearance": 'neutral', "data-acrylic-level": '1Level', children: [(0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.acrylic, "aria-hidden": true }), outline && (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.border, "aria-hidden": true }), (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.content, children: [hasLeftSideElements && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.beforeSearch, children: (0, jsx_runtime_1.jsx)(button_1.Button, { view: 'function', appearance: 'neutral', icon: (0, jsx_runtime_1.jsx)(system_1.UpdateSVG, {}), size: 'm', className: styles_module_scss_1.default.updateButton, onClick: onRefresh, "data-test-id": testIds_1.TEST_IDS.refreshButton }) })), hasLeftSideElements && (0, jsx_runtime_1.jsx)(helperComponents_1.Separator, {}), (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.searchWrapper, children: search && (0, jsx_runtime_1.jsx)(helperComponents_1.Search, { ...search }) }), hasRightSideElements && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(helperComponents_1.Separator, {}), showAfterSlot && ((0, jsx_runtime_1.jsxs)("div", { "data-test-id": testIds_1.TEST_IDS.after, className: styles_module_scss_1.default.slot, children: [pinnedAfter, !isMobile && after] })), showSeparatorAfterExtra && (0, jsx_runtime_1.jsx)(helperComponents_1.Separator, {}), showDataView && dataView && ((0, jsx_runtime_1.jsx)("div", { "data-test-id": testIds_1.TEST_IDS.dataView, className: styles_module_scss_1.default.slot, children: (0, jsx_runtime_1.jsx)(helperComponents_1.DataView, { value: dataView.value, defaultValue: dataView.defaultValue, onChange: dataView.onChange, items: dataView.items }) })), filterButton && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.slot, children: (0, jsx_runtime_1.jsx)(helperComponents_1.FilterButton, { ...filterButton }) })), showMoreActionsMenu && effectiveMoreActions && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.slot, children: (0, jsx_runtime_1.jsx)(helperComponents_1.MoreActions, { moreActions: effectiveMoreActions }) }))] }))] })] }), filterRow && (0, jsx_runtime_1.jsx)(chips_1.ChipChoiceRow, { ...filterRow, size: 's', "data-test-id": testIds_1.TEST_IDS.filterRow }), needsBulkActions && ((0, jsx_runtime_1.jsx)(helperComponents_1.BulkActions, { ...(0, bulkActions_1.extractBulkActionsProps)(rest), resizingContainerRef: containerWrapperRef }))] }));
48
48
  }
@@ -3,6 +3,7 @@
3
3
  display:flex;
4
4
  flex-direction:column;
5
5
  gap:var(--sn-toolbar-anatomy-container-gap, var(--sn-primitive-dimension-8, 8px));
6
+ box-sizing:border-box;
6
7
  width:100%;
7
8
  }
8
9
 
@@ -1,10 +1,10 @@
1
1
  import { FiltersState } from '@cloud-ru/ds-chips';
2
- import { ToolbarBulkActionProps, ToolbarProps } from './types';
2
+ import { ToolbarBulkActionProps, ToolbarProps } from '../types';
3
3
  export declare function extractBulkActionsProps({ onCheck, checked, indeterminate, bulkActions, selectedCount, totalCount, showBulkCheckbox, }: ToolbarBulkActionProps): {
4
4
  onCheck: (() => void) | undefined;
5
5
  checked: boolean | undefined;
6
6
  indeterminate: boolean | undefined;
7
- actions: import("..").BulkAction[];
7
+ actions: import("../..").BulkAction[];
8
8
  selectedCount: number | undefined;
9
9
  totalCount: number | undefined;
10
10
  showBulkCheckbox: boolean | undefined;
@@ -33,7 +33,5 @@ function BulkActionsControls({ actions, variant, checked, indeterminate, onCheck
33
33
  const { label, icon: Icon, onClick, disabled, tooltip, 'data-test-id': testId } = action;
34
34
  const actionIndex = (0, utils_2.getBulkActionIndex)(actions, action, visibleIndex);
35
35
  return ((0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { tip: tooltip, open: tooltip ? undefined : false, placement: 'top', "data-test-id": `${testId}-tooltip`, triggerClassName: styles_module_scss_1.default.triggerClassName, children: (0, jsx_runtime_1.jsx)(button_1.Button, { view: 'tonal', appearance: 'primary', className: styles_module_scss_1.default.action, "data-test-id": testId, iconPosition: 'before', icon: (0, jsx_runtime_1.jsx)(Icon, {}), label: label, size: 's', onClick: onClick, disabled: disabled }) }, (0, utils_2.getBulkActionKey)(action, actionIndex)));
36
- }) }), hiddenItems.length > 0 && ((0, jsx_runtime_1.jsx)(list_1.Droplist, { label: isSheet ? t('multipleActions') : undefined,
37
- // TODO: slotAfterTitle должен расширяться на всю ширину, а section-label уходить вправо
38
- slotAfterTitle: isSheet ? ((0, jsx_runtime_1.jsx)(SelectionLabel_1.SelectionLabel, { placement: 'headline', selectedCount: selectedCount, totalCount: totalCount, hasSelection: hasSelection })) : undefined, open: isMoreOpen, onOpenChange: setIsMoreOpen, trigger: 'clickAndFocusVisible', triggerElemRef: triggerRef, triggerClassName: styles_module_scss_1.default.triggerClassName, closeDroplistOnItemClick: true, placement: 'bottom-end', scroll: true, size: 's', items: droplistActions.map((action, index) => (0, utils_2.mapBulkActionToDroplistItem)(action, (0, utils_2.getBulkActionIndex)(actions, action, index))), children: ({ onKeyDown }) => ((0, jsx_runtime_1.jsx)(button_1.Button, { view: 'function', appearance: 'neutral', className: styles_module_scss_1.default.moreActionButton, size: 's', icon: (0, jsx_runtime_1.jsx)(system_1.KebabSVG, {}), "data-test-id": testIds_1.TEST_IDS.moreBulkActionsButton, innerRef: triggerRef, onKeyDown: onKeyDown })) }))] }));
36
+ }) }), hiddenItems.length > 0 && ((0, jsx_runtime_1.jsx)(list_1.Droplist, { label: isSheet ? t('multipleActions') : undefined, slotAfterTitle: isSheet ? ((0, jsx_runtime_1.jsx)(SelectionLabel_1.SelectionLabel, { placement: 'headline', selectedCount: selectedCount, totalCount: totalCount, hasSelection: hasSelection })) : undefined, open: isMoreOpen, onOpenChange: setIsMoreOpen, onBackButtonClick: isSheet ? () => setIsMoreOpen(false) : undefined, trigger: 'clickAndFocusVisible', triggerElemRef: triggerRef, triggerClassName: styles_module_scss_1.default.triggerClassName, closeDroplistOnItemClick: true, placement: 'bottom-end', scroll: true, size: 's', items: droplistActions.map((action, index) => (0, utils_2.mapBulkActionToDroplistItem)(action, (0, utils_2.getBulkActionIndex)(actions, action, index))), children: ({ onKeyDown }) => ((0, jsx_runtime_1.jsx)(button_1.Button, { view: 'function', appearance: 'neutral', className: styles_module_scss_1.default.moreActionButton, size: 's', icon: (0, jsx_runtime_1.jsx)(system_1.KebabSVG, {}), "data-test-id": testIds_1.TEST_IDS.moreBulkActionsButton, innerRef: triggerRef, onKeyDown: onKeyDown })) }))] }));
39
37
  }
@@ -19,7 +19,5 @@ function MobileBulkActionsSheet({ open, actions, selectedCount, totalCount, hasS
19
19
  setBottomSheetKey('ready');
20
20
  }, []);
21
21
  // Платформу webMobile фиксирует сам BottomSheet: свой набор sn-классов здесь не нужен.
22
- return ((0, jsx_runtime_1.jsx)(bottom_sheet_1.BottomSheet, { container: portalContext.current ?? undefined, open: open, onClose: CLOSE_STUB_CALLBACK, title: t('multipleActions'),
23
- // TODO: slotAfterTitle должен расширяться на всю ширину, а section-label уходить вправо
24
- slotAfterTitle: (0, jsx_runtime_1.jsx)(SelectionLabel_1.SelectionLabel, { placement: 'headline', selectedCount: selectedCount, totalCount: totalCount, hasSelection: hasSelection }), content: (0, jsx_runtime_1.jsx)(BulkActionsControls_1.BulkActionsControls, { variant: 'sheet', actions: actions, checked: checked, indeterminate: indeterminate, onCheck: onCheck, showCheckbox: showBulkCheckbox, selectedCount: selectedCount, totalCount: totalCount, hasSelection: hasSelection }), showBackdrop: false, swipeEnabled: false, lockScroll: false, closeOnPopstate: false, safeAreaTop: false, safeAreaBottom: false, withDividers: false, "data-test-id": testIds_1.TEST_IDS.mobileBulkActionsSheet }, bottomSheetKey));
22
+ return ((0, jsx_runtime_1.jsx)(bottom_sheet_1.BottomSheet, { container: portalContext.current ?? undefined, open: open, onClose: CLOSE_STUB_CALLBACK, title: t('multipleActions'), slotAfterTitle: (0, jsx_runtime_1.jsx)(SelectionLabel_1.SelectionLabel, { placement: 'headline', selectedCount: selectedCount, totalCount: totalCount, hasSelection: hasSelection }), content: (0, jsx_runtime_1.jsx)(BulkActionsControls_1.BulkActionsControls, { variant: 'sheet', actions: actions, checked: checked, indeterminate: indeterminate, onCheck: onCheck, showCheckbox: showBulkCheckbox, selectedCount: selectedCount, totalCount: totalCount, hasSelection: hasSelection }), showBackdrop: false, swipeEnabled: false, lockScroll: false, closeOnPopstate: false, safeAreaTop: false, safeAreaBottom: false, withDividers: false, "data-test-id": testIds_1.TEST_IDS.mobileBulkActionsSheet }, bottomSheetKey));
25
23
  }
@@ -10,7 +10,7 @@ const locale_1 = require("../../../../locale");
10
10
  const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
11
11
  function SelectionLabel({ selectedCount, totalCount, hasSelection, className, placement = 'inline', }) {
12
12
  const { t } = locale_1.toolbarLocale.useTranslations();
13
- const valueLabel = hasSelection && totalCount != null
13
+ const valueLabel = totalCount != null
14
14
  ? t('selectedCountOf', { count: selectedCount, total: totalCount })
15
15
  : t('selectedCount', { count: selectedCount });
16
16
  const label = ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.selectionLabel, className), "data-has-selection": hasSelection || undefined, children: [(0, jsx_runtime_1.jsx)("span", { className: styles_module_scss_1.default.selectionLabelPrefix, children: t('selectedPrefix') }), (0, jsx_runtime_1.jsx)("span", { className: styles_module_scss_1.default.selectionLabelValue, children: valueLabel })] }));
@@ -1,4 +1,4 @@
1
1
  export * from './BulkActionsCheckbox';
2
2
  export * from './BulkActionsControls';
3
- export * from './MobileBulkActionsSheet';
4
3
  export * from './SelectionLabel';
4
+ export * from './MobileBulkActionsSheet';
@@ -16,5 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./BulkActionsCheckbox"), exports);
18
18
  __exportStar(require("./BulkActionsControls"), exports);
19
- __exportStar(require("./MobileBulkActionsSheet"), exports);
20
19
  __exportStar(require("./SelectionLabel"), exports);
20
+ __exportStar(require("./MobileBulkActionsSheet"), exports);
@@ -5,7 +5,6 @@
5
5
  box-sizing:border-box;
6
6
  width:100%;
7
7
  min-height:var(--sn-toolbar-anatomy-container-tool-bulkTool-minHeight, var(--sn-density-size-xs, var(--sn-density-scale-100-xs, var(--sn-platform-comfort-scale-100-xs, var(--sn-primitive-dimension-24, 24px)))));
8
- padding-left:var(--sn-toolbar-anatomy-container-tool-bulkAction-paddingLeft, var(--sn-primitive-dimension-4, 4px));
9
8
  }
10
9
 
11
10
  .volumeWrapper{
@@ -13,5 +13,5 @@ const testIds_1 = require("../../testIds");
13
13
  const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
14
14
  function FilterButton({ open, onOpenChange, numberOfFilters }) {
15
15
  const { t } = locale_1.toolbarLocale.useTranslations();
16
- return ((0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { tip: open ? t('hideFilters') : t('showFilters'), triggerClassName: styles_module_scss_1.default.trigger, children: (0, jsx_runtime_1.jsx)(button_1.Button, { view: open ? 'tonal' : 'function', appearance: open ? 'primary' : 'neutral', size: 'm', icon: (0, jsx_runtime_1.jsx)(system_1.FilterSVG, {}), iconPosition: 'after', counter: numberOfFilters ? { value: numberOfFilters } : undefined, onClick: () => onOpenChange(!open), "aria-pressed": open, "data-test-id": testIds_1.TEST_IDS.filterButton, "data-filter-open": open || undefined }) }));
16
+ return ((0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { tip: open ? t('hideFilters') : t('showFilters'), triggerClassName: styles_module_scss_1.default.trigger, children: (0, jsx_runtime_1.jsx)(button_1.Button, { view: 'function', appearance: 'neutral', size: 'm', icon: (0, jsx_runtime_1.jsx)(system_1.FilterSVG, {}), iconPosition: 'after', counter: numberOfFilters ? { value: numberOfFilters } : undefined, onClick: () => onOpenChange(!open), "aria-pressed": open, "data-test-id": testIds_1.TEST_IDS.filterButton, "data-filter-open": open || undefined }) }));
17
17
  }
@@ -3,6 +3,7 @@
3
3
  display:flex;
4
4
  flex-direction:column;
5
5
  gap:var(--sn-toolbar-anatomy-container-gap, var(--sn-primitive-dimension-8, 8px));
6
+ box-sizing:border-box;
6
7
  width:100%;
7
8
  }
8
9
 
@@ -384,7 +385,6 @@
384
385
  box-sizing:border-box;
385
386
  width:100%;
386
387
  min-height:var(--sn-toolbar-anatomy-container-tool-bulkTool-minHeight, var(--sn-density-size-xs, var(--sn-density-scale-100-xs, var(--sn-platform-comfort-scale-100-xs, var(--sn-primitive-dimension-24, 24px)))));
387
- padding-left:var(--sn-toolbar-anatomy-container-tool-bulkAction-paddingLeft, var(--sn-primitive-dimension-4, 4px));
388
388
  }
389
389
 
390
390
  .volumeWrapper{
@@ -7,8 +7,8 @@ export declare const TEST_IDS: {
7
7
  readonly deactivateAction: "toolbar__deactivate-action";
8
8
  readonly disabledAction: "toolbar__disabled-action";
9
9
  readonly bulkTool: "toolbar__bulk-tool";
10
- readonly bulkActions: "toolbar__bulk-actions";
11
10
  readonly mobileBulkActionsSheet: "toolbar__mobile-bulk-actions-sheet";
11
+ readonly bulkActions: "toolbar__bulk-actions";
12
12
  readonly moreBulkActionsButton: "toolbar__more-bulk-actions-button";
13
13
  readonly refreshButton: "toolbar__refresh-button";
14
14
  readonly refreshOption: "toolbar__refresh-option";
@@ -10,8 +10,8 @@ exports.TEST_IDS = {
10
10
  deactivateAction: 'toolbar__deactivate-action',
11
11
  disabledAction: 'toolbar__disabled-action',
12
12
  bulkTool: 'toolbar__bulk-tool',
13
- bulkActions: 'toolbar__bulk-actions',
14
13
  mobileBulkActionsSheet: 'toolbar__mobile-bulk-actions-sheet',
14
+ bulkActions: 'toolbar__bulk-actions',
15
15
  moreBulkActionsButton: 'toolbar__more-bulk-actions-button',
16
16
  refreshButton: 'toolbar__refresh-button',
17
17
  refreshOption: 'toolbar__refresh-option',
@@ -9,10 +9,10 @@ import { useMemo, useRef } from 'react';
9
9
  import { BulkActions, DataView, FilterButton, MoreActions, Search, Separator } from '../../helperComponents/index.js';
10
10
  import { toolbarLocale } from '../../locale/index.js';
11
11
  import { TEST_IDS } from '../../testIds.js';
12
- import { extractBulkActionsProps, isBulkActionsProps } from './helpers.js';
13
12
  import { useFilters, usePersistState } from './hooks/index.js';
14
13
  import styles from './styles.module.css';
15
14
  import { buildMobileOverflowActions } from './utils/buildMobileOverflowActions.js';
15
+ import { extractBulkActionsProps, isBulkActionsProps } from './utils/bulkActions.js';
16
16
  export function Toolbar({ className, after, pinnedAfter, dataView, outline = true, moreActions, onRefresh, search, filterRow: filterRowProps, persist, ...rest }) {
17
17
  const { layoutType } = useAdaptiveLayout();
18
18
  const { t } = toolbarLocale.useTranslations();
@@ -3,6 +3,7 @@
3
3
  display:flex;
4
4
  flex-direction:column;
5
5
  gap:var(--sn-toolbar-anatomy-container-gap, var(--sn-primitive-dimension-8, 8px));
6
+ box-sizing:border-box;
6
7
  width:100%;
7
8
  }
8
9
 
@@ -1,10 +1,10 @@
1
1
  import { FiltersState } from '@cloud-ru/ds-chips';
2
- import { ToolbarBulkActionProps, ToolbarProps } from './types.js';
2
+ import { ToolbarBulkActionProps, ToolbarProps } from '../types.js';
3
3
  export declare function extractBulkActionsProps({ onCheck, checked, indeterminate, bulkActions, selectedCount, totalCount, showBulkCheckbox, }: ToolbarBulkActionProps): {
4
4
  onCheck: (() => void) | undefined;
5
5
  checked: boolean | undefined;
6
6
  indeterminate: boolean | undefined;
7
- actions: import("..").BulkAction[];
7
+ actions: import("../..").BulkAction[];
8
8
  selectedCount: number | undefined;
9
9
  totalCount: number | undefined;
10
10
  showBulkCheckbox: boolean | undefined;
@@ -27,7 +27,5 @@ export function BulkActionsControls({ actions, variant, checked, indeterminate,
27
27
  const { label, icon: Icon, onClick, disabled, tooltip, 'data-test-id': testId } = action;
28
28
  const actionIndex = getBulkActionIndex(actions, action, visibleIndex);
29
29
  return (_jsx(Tooltip, { tip: tooltip, open: tooltip ? undefined : false, placement: 'top', "data-test-id": `${testId}-tooltip`, triggerClassName: styles.triggerClassName, children: _jsx(Button, { view: 'tonal', appearance: 'primary', className: styles.action, "data-test-id": testId, iconPosition: 'before', icon: _jsx(Icon, {}), label: label, size: 's', onClick: onClick, disabled: disabled }) }, getBulkActionKey(action, actionIndex)));
30
- }) }), hiddenItems.length > 0 && (_jsx(Droplist, { label: isSheet ? t('multipleActions') : undefined,
31
- // TODO: slotAfterTitle должен расширяться на всю ширину, а section-label уходить вправо
32
- slotAfterTitle: isSheet ? (_jsx(SelectionLabel, { placement: 'headline', selectedCount: selectedCount, totalCount: totalCount, hasSelection: hasSelection })) : undefined, open: isMoreOpen, onOpenChange: setIsMoreOpen, trigger: 'clickAndFocusVisible', triggerElemRef: triggerRef, triggerClassName: styles.triggerClassName, closeDroplistOnItemClick: true, placement: 'bottom-end', scroll: true, size: 's', items: droplistActions.map((action, index) => mapBulkActionToDroplistItem(action, getBulkActionIndex(actions, action, index))), children: ({ onKeyDown }) => (_jsx(Button, { view: 'function', appearance: 'neutral', className: styles.moreActionButton, size: 's', icon: _jsx(KebabSVG, {}), "data-test-id": TEST_IDS.moreBulkActionsButton, innerRef: triggerRef, onKeyDown: onKeyDown })) }))] }));
30
+ }) }), hiddenItems.length > 0 && (_jsx(Droplist, { label: isSheet ? t('multipleActions') : undefined, slotAfterTitle: isSheet ? (_jsx(SelectionLabel, { placement: 'headline', selectedCount: selectedCount, totalCount: totalCount, hasSelection: hasSelection })) : undefined, open: isMoreOpen, onOpenChange: setIsMoreOpen, onBackButtonClick: isSheet ? () => setIsMoreOpen(false) : undefined, trigger: 'clickAndFocusVisible', triggerElemRef: triggerRef, triggerClassName: styles.triggerClassName, closeDroplistOnItemClick: true, placement: 'bottom-end', scroll: true, size: 's', items: droplistActions.map((action, index) => mapBulkActionToDroplistItem(action, getBulkActionIndex(actions, action, index))), children: ({ onKeyDown }) => (_jsx(Button, { view: 'function', appearance: 'neutral', className: styles.moreActionButton, size: 's', icon: _jsx(KebabSVG, {}), "data-test-id": TEST_IDS.moreBulkActionsButton, innerRef: triggerRef, onKeyDown: onKeyDown })) }))] }));
33
31
  }
@@ -16,7 +16,5 @@ export function MobileBulkActionsSheet({ open, actions, selectedCount, totalCoun
16
16
  setBottomSheetKey('ready');
17
17
  }, []);
18
18
  // Платформу webMobile фиксирует сам BottomSheet: свой набор sn-классов здесь не нужен.
19
- return (_jsx(BottomSheet, { container: portalContext.current ?? undefined, open: open, onClose: CLOSE_STUB_CALLBACK, title: t('multipleActions'),
20
- // TODO: slotAfterTitle должен расширяться на всю ширину, а section-label уходить вправо
21
- slotAfterTitle: _jsx(SelectionLabel, { placement: 'headline', selectedCount: selectedCount, totalCount: totalCount, hasSelection: hasSelection }), content: _jsx(BulkActionsControls, { variant: 'sheet', actions: actions, checked: checked, indeterminate: indeterminate, onCheck: onCheck, showCheckbox: showBulkCheckbox, selectedCount: selectedCount, totalCount: totalCount, hasSelection: hasSelection }), showBackdrop: false, swipeEnabled: false, lockScroll: false, closeOnPopstate: false, safeAreaTop: false, safeAreaBottom: false, withDividers: false, "data-test-id": TEST_IDS.mobileBulkActionsSheet }, bottomSheetKey));
19
+ return (_jsx(BottomSheet, { container: portalContext.current ?? undefined, open: open, onClose: CLOSE_STUB_CALLBACK, title: t('multipleActions'), slotAfterTitle: _jsx(SelectionLabel, { placement: 'headline', selectedCount: selectedCount, totalCount: totalCount, hasSelection: hasSelection }), content: _jsx(BulkActionsControls, { variant: 'sheet', actions: actions, checked: checked, indeterminate: indeterminate, onCheck: onCheck, showCheckbox: showBulkCheckbox, selectedCount: selectedCount, totalCount: totalCount, hasSelection: hasSelection }), showBackdrop: false, swipeEnabled: false, lockScroll: false, closeOnPopstate: false, safeAreaTop: false, safeAreaBottom: false, withDividers: false, "data-test-id": TEST_IDS.mobileBulkActionsSheet }, bottomSheetKey));
22
20
  }
@@ -4,7 +4,7 @@ import { toolbarLocale } from '../../../../locale/index.js';
4
4
  import styles from './styles.module.css';
5
5
  export function SelectionLabel({ selectedCount, totalCount, hasSelection, className, placement = 'inline', }) {
6
6
  const { t } = toolbarLocale.useTranslations();
7
- const valueLabel = hasSelection && totalCount != null
7
+ const valueLabel = totalCount != null
8
8
  ? t('selectedCountOf', { count: selectedCount, total: totalCount })
9
9
  : t('selectedCount', { count: selectedCount });
10
10
  const label = (_jsxs("div", { className: cn(styles.selectionLabel, className), "data-has-selection": hasSelection || undefined, children: [_jsx("span", { className: styles.selectionLabelPrefix, children: t('selectedPrefix') }), _jsx("span", { className: styles.selectionLabelValue, children: valueLabel })] }));
@@ -1,4 +1,4 @@
1
1
  export * from './BulkActionsCheckbox/index.js';
2
2
  export * from './BulkActionsControls/index.js';
3
- export * from './MobileBulkActionsSheet/index.js';
4
3
  export * from './SelectionLabel/index.js';
4
+ export * from './MobileBulkActionsSheet/index.js';
@@ -1,4 +1,4 @@
1
1
  export * from './BulkActionsCheckbox/index.js';
2
2
  export * from './BulkActionsControls/index.js';
3
- export * from './MobileBulkActionsSheet/index.js';
4
3
  export * from './SelectionLabel/index.js';
4
+ export * from './MobileBulkActionsSheet/index.js';
@@ -5,7 +5,6 @@
5
5
  box-sizing:border-box;
6
6
  width:100%;
7
7
  min-height:var(--sn-toolbar-anatomy-container-tool-bulkTool-minHeight, var(--sn-density-size-xs, var(--sn-density-scale-100-xs, var(--sn-platform-comfort-scale-100-xs, var(--sn-primitive-dimension-24, 24px)))));
8
- padding-left:var(--sn-toolbar-anatomy-container-tool-bulkAction-paddingLeft, var(--sn-primitive-dimension-4, 4px));
9
8
  }
10
9
 
11
10
  .volumeWrapper{
@@ -7,5 +7,5 @@ import { TEST_IDS } from '../../testIds.js';
7
7
  import styles from './styles.module.css';
8
8
  export function FilterButton({ open, onOpenChange, numberOfFilters }) {
9
9
  const { t } = toolbarLocale.useTranslations();
10
- return (_jsx(Tooltip, { tip: open ? t('hideFilters') : t('showFilters'), triggerClassName: styles.trigger, children: _jsx(Button, { view: open ? 'tonal' : 'function', appearance: open ? 'primary' : 'neutral', size: 'm', icon: _jsx(FilterSVG, {}), iconPosition: 'after', counter: numberOfFilters ? { value: numberOfFilters } : undefined, onClick: () => onOpenChange(!open), "aria-pressed": open, "data-test-id": TEST_IDS.filterButton, "data-filter-open": open || undefined }) }));
10
+ return (_jsx(Tooltip, { tip: open ? t('hideFilters') : t('showFilters'), triggerClassName: styles.trigger, children: _jsx(Button, { view: 'function', appearance: 'neutral', size: 'm', icon: _jsx(FilterSVG, {}), iconPosition: 'after', counter: numberOfFilters ? { value: numberOfFilters } : undefined, onClick: () => onOpenChange(!open), "aria-pressed": open, "data-test-id": TEST_IDS.filterButton, "data-filter-open": open || undefined }) }));
11
11
  }
@@ -3,6 +3,7 @@
3
3
  display:flex;
4
4
  flex-direction:column;
5
5
  gap:var(--sn-toolbar-anatomy-container-gap, var(--sn-primitive-dimension-8, 8px));
6
+ box-sizing:border-box;
6
7
  width:100%;
7
8
  }
8
9
 
@@ -384,7 +385,6 @@
384
385
  box-sizing:border-box;
385
386
  width:100%;
386
387
  min-height:var(--sn-toolbar-anatomy-container-tool-bulkTool-minHeight, var(--sn-density-size-xs, var(--sn-density-scale-100-xs, var(--sn-platform-comfort-scale-100-xs, var(--sn-primitive-dimension-24, 24px)))));
387
- padding-left:var(--sn-toolbar-anatomy-container-tool-bulkAction-paddingLeft, var(--sn-primitive-dimension-4, 4px));
388
388
  }
389
389
 
390
390
  .volumeWrapper{
@@ -7,8 +7,8 @@ export declare const TEST_IDS: {
7
7
  readonly deactivateAction: "toolbar__deactivate-action";
8
8
  readonly disabledAction: "toolbar__disabled-action";
9
9
  readonly bulkTool: "toolbar__bulk-tool";
10
- readonly bulkActions: "toolbar__bulk-actions";
11
10
  readonly mobileBulkActionsSheet: "toolbar__mobile-bulk-actions-sheet";
11
+ readonly bulkActions: "toolbar__bulk-actions";
12
12
  readonly moreBulkActionsButton: "toolbar__more-bulk-actions-button";
13
13
  readonly refreshButton: "toolbar__refresh-button";
14
14
  readonly refreshOption: "toolbar__refresh-option";
@@ -7,8 +7,8 @@ export const TEST_IDS = {
7
7
  deactivateAction: 'toolbar__deactivate-action',
8
8
  disabledAction: 'toolbar__disabled-action',
9
9
  bulkTool: 'toolbar__bulk-tool',
10
- bulkActions: 'toolbar__bulk-actions',
11
10
  mobileBulkActionsSheet: 'toolbar__mobile-bulk-actions-sheet',
11
+ bulkActions: 'toolbar__bulk-actions',
12
12
  moreBulkActionsButton: 'toolbar__more-bulk-actions-button',
13
13
  refreshButton: 'toolbar__refresh-button',
14
14
  refreshOption: 'toolbar__refresh-option',