@cloud-ru/ds-toolbar 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/LICENSE +201 -0
- package/README.md +301 -0
- package/dist/cjs/components/Toolbar/Toolbar.d.ts +3 -0
- package/dist/cjs/components/Toolbar/Toolbar.js +51 -0
- package/dist/cjs/components/Toolbar/helpers.d.ts +12 -0
- package/dist/cjs/components/Toolbar/helpers.js +27 -0
- package/dist/cjs/components/Toolbar/hooks/index.d.ts +2 -0
- package/dist/cjs/components/Toolbar/hooks/index.js +18 -0
- package/dist/cjs/components/Toolbar/hooks/useFilters.d.ts +12 -0
- package/dist/cjs/components/Toolbar/hooks/useFilters.js +55 -0
- package/dist/cjs/components/Toolbar/hooks/usePersistState/index.d.ts +1 -0
- package/dist/cjs/components/Toolbar/hooks/usePersistState/index.js +17 -0
- package/dist/cjs/components/Toolbar/hooks/usePersistState/usePersistState.d.ts +9 -0
- package/dist/cjs/components/Toolbar/hooks/usePersistState/usePersistState.js +72 -0
- package/dist/cjs/components/Toolbar/hooks/usePersistState/utils/index.d.ts +3 -0
- package/dist/cjs/components/Toolbar/hooks/usePersistState/utils/index.js +19 -0
- package/dist/cjs/components/Toolbar/hooks/usePersistState/utils/isDateString.d.ts +9 -0
- package/dist/cjs/components/Toolbar/hooks/usePersistState/utils/isDateString.js +45 -0
- package/dist/cjs/components/Toolbar/hooks/usePersistState/utils/parser.d.ts +4 -0
- package/dist/cjs/components/Toolbar/hooks/usePersistState/utils/parser.js +46 -0
- package/dist/cjs/components/Toolbar/hooks/usePersistState/utils/serializer.d.ts +11 -0
- package/dist/cjs/components/Toolbar/hooks/usePersistState/utils/serializer.js +41 -0
- package/dist/cjs/components/Toolbar/index.d.ts +3 -0
- package/dist/cjs/components/Toolbar/index.js +19 -0
- package/dist/cjs/components/Toolbar/styles.module.css +297 -0
- package/dist/cjs/components/Toolbar/types.d.ts +80 -0
- package/dist/cjs/components/Toolbar/types.js +2 -0
- package/dist/cjs/components/Toolbar/typesUtils.d.ts +12 -0
- package/dist/cjs/components/Toolbar/typesUtils.js +2 -0
- package/dist/cjs/components/Toolbar/utils/buildMobileOverflowActions.d.ts +10 -0
- package/dist/cjs/components/Toolbar/utils/buildMobileOverflowActions.js +84 -0
- package/dist/cjs/components/Toolbar/utils/toolbarAfterOverflow.d.ts +2 -0
- package/dist/cjs/components/Toolbar/utils/toolbarAfterOverflow.js +5 -0
- package/dist/cjs/components/index.d.ts +4 -0
- package/dist/cjs/components/index.js +23 -0
- package/dist/cjs/helperComponents/BulkActions/BulkActions.d.ts +2 -0
- package/dist/cjs/helperComponents/BulkActions/BulkActions.js +20 -0
- package/dist/cjs/helperComponents/BulkActions/components/BulkActionsCheckbox/BulkActionsCheckbox.d.ts +8 -0
- package/dist/cjs/helperComponents/BulkActions/components/BulkActionsCheckbox/BulkActionsCheckbox.js +20 -0
- package/dist/cjs/helperComponents/BulkActions/components/BulkActionsCheckbox/index.d.ts +1 -0
- package/dist/cjs/helperComponents/BulkActions/components/BulkActionsCheckbox/index.js +17 -0
- package/dist/cjs/helperComponents/BulkActions/components/BulkActionsCheckbox/styles.module.css +3 -0
- package/dist/cjs/helperComponents/BulkActions/components/BulkActionsControls/BulkActionsControls.d.ts +17 -0
- package/dist/cjs/helperComponents/BulkActions/components/BulkActionsControls/BulkActionsControls.js +39 -0
- package/dist/cjs/helperComponents/BulkActions/components/BulkActionsControls/index.d.ts +1 -0
- package/dist/cjs/helperComponents/BulkActions/components/BulkActionsControls/index.js +17 -0
- package/dist/cjs/helperComponents/BulkActions/components/BulkActionsControls/styles.module.css +39 -0
- package/dist/cjs/helperComponents/BulkActions/components/MobileBulkActionsSheet/MobileBulkActionsSheet.d.ts +14 -0
- package/dist/cjs/helperComponents/BulkActions/components/MobileBulkActionsSheet/MobileBulkActionsSheet.js +27 -0
- package/dist/cjs/helperComponents/BulkActions/components/MobileBulkActionsSheet/index.d.ts +1 -0
- package/dist/cjs/helperComponents/BulkActions/components/MobileBulkActionsSheet/index.js +17 -0
- package/dist/cjs/helperComponents/BulkActions/components/SelectionLabel/SelectionLabel.d.ts +9 -0
- package/dist/cjs/helperComponents/BulkActions/components/SelectionLabel/SelectionLabel.js +21 -0
- package/dist/cjs/helperComponents/BulkActions/components/SelectionLabel/index.d.ts +1 -0
- package/dist/cjs/helperComponents/BulkActions/components/SelectionLabel/index.js +17 -0
- package/dist/cjs/helperComponents/BulkActions/components/SelectionLabel/styles.module.css +40 -0
- package/dist/cjs/helperComponents/BulkActions/components/index.d.ts +4 -0
- package/dist/cjs/helperComponents/BulkActions/components/index.js +20 -0
- package/dist/cjs/helperComponents/BulkActions/index.d.ts +2 -0
- package/dist/cjs/helperComponents/BulkActions/index.js +18 -0
- package/dist/cjs/helperComponents/BulkActions/styles.module.css +9 -0
- package/dist/cjs/helperComponents/BulkActions/types.d.ts +31 -0
- package/dist/cjs/helperComponents/BulkActions/types.js +2 -0
- package/dist/cjs/helperComponents/BulkActions/utils.d.ts +15 -0
- package/dist/cjs/helperComponents/BulkActions/utils.js +26 -0
- package/dist/cjs/helperComponents/DataView/DataView.d.ts +2 -0
- package/dist/cjs/helperComponents/DataView/DataView.js +9 -0
- package/dist/cjs/helperComponents/DataView/constants.d.ts +9 -0
- package/dist/cjs/helperComponents/DataView/constants.js +13 -0
- package/dist/cjs/helperComponents/DataView/index.d.ts +3 -0
- package/dist/cjs/helperComponents/DataView/index.js +19 -0
- package/dist/cjs/helperComponents/DataView/types.d.ts +12 -0
- package/dist/cjs/helperComponents/DataView/types.js +2 -0
- package/dist/cjs/helperComponents/FilterButton/FilterButton.d.ts +12 -0
- package/dist/cjs/helperComponents/FilterButton/FilterButton.js +17 -0
- package/dist/cjs/helperComponents/FilterButton/index.d.ts +1 -0
- package/dist/cjs/helperComponents/FilterButton/index.js +17 -0
- package/dist/cjs/helperComponents/FilterButton/styles.module.css +5 -0
- package/dist/cjs/helperComponents/MoreActions/MoreActions.d.ts +13 -0
- package/dist/cjs/helperComponents/MoreActions/MoreActions.js +35 -0
- package/dist/cjs/helperComponents/MoreActions/index.d.ts +1 -0
- package/dist/cjs/helperComponents/MoreActions/index.js +17 -0
- package/dist/cjs/helperComponents/MoreActions/styles.module.css +5 -0
- package/dist/cjs/helperComponents/Search/ToolbarSearch.d.ts +9 -0
- package/dist/cjs/helperComponents/Search/ToolbarSearch.js +19 -0
- package/dist/cjs/helperComponents/Search/index.d.ts +1 -0
- package/dist/cjs/helperComponents/Search/index.js +17 -0
- package/dist/cjs/helperComponents/Search/styles.module.css +25 -0
- package/dist/cjs/helperComponents/Separator/Separator.d.ts +1 -0
- package/dist/cjs/helperComponents/Separator/Separator.js +11 -0
- package/dist/cjs/helperComponents/Separator/index.d.ts +1 -0
- package/dist/cjs/helperComponents/Separator/index.js +17 -0
- package/dist/cjs/helperComponents/Separator/styles.module.css +14 -0
- package/dist/cjs/helperComponents/index.d.ts +6 -0
- package/dist/cjs/helperComponents/index.js +22 -0
- package/dist/cjs/index.d.ts +5 -0
- package/dist/cjs/index.js +24 -0
- package/dist/cjs/locale/index.d.ts +55 -0
- package/dist/cjs/locale/index.js +32 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/style.css +437 -0
- package/dist/cjs/testIds.d.ts +24 -0
- package/dist/cjs/testIds.js +27 -0
- package/dist/esm/components/Toolbar/Toolbar.d.ts +3 -0
- package/dist/esm/components/Toolbar/Toolbar.js +45 -0
- package/dist/esm/components/Toolbar/helpers.d.ts +12 -0
- package/dist/esm/components/Toolbar/helpers.js +23 -0
- package/dist/esm/components/Toolbar/hooks/index.d.ts +2 -0
- package/dist/esm/components/Toolbar/hooks/index.js +2 -0
- package/dist/esm/components/Toolbar/hooks/useFilters.d.ts +12 -0
- package/dist/esm/components/Toolbar/hooks/useFilters.js +49 -0
- package/dist/esm/components/Toolbar/hooks/usePersistState/index.d.ts +1 -0
- package/dist/esm/components/Toolbar/hooks/usePersistState/index.js +1 -0
- package/dist/esm/components/Toolbar/hooks/usePersistState/usePersistState.d.ts +9 -0
- package/dist/esm/components/Toolbar/hooks/usePersistState/usePersistState.js +69 -0
- package/dist/esm/components/Toolbar/hooks/usePersistState/utils/index.d.ts +3 -0
- package/dist/esm/components/Toolbar/hooks/usePersistState/utils/index.js +3 -0
- package/dist/esm/components/Toolbar/hooks/usePersistState/utils/isDateString.d.ts +9 -0
- package/dist/esm/components/Toolbar/hooks/usePersistState/utils/isDateString.js +42 -0
- package/dist/esm/components/Toolbar/hooks/usePersistState/utils/parser.d.ts +4 -0
- package/dist/esm/components/Toolbar/hooks/usePersistState/utils/parser.js +42 -0
- package/dist/esm/components/Toolbar/hooks/usePersistState/utils/serializer.d.ts +11 -0
- package/dist/esm/components/Toolbar/hooks/usePersistState/utils/serializer.js +37 -0
- package/dist/esm/components/Toolbar/index.d.ts +3 -0
- package/dist/esm/components/Toolbar/index.js +3 -0
- package/dist/esm/components/Toolbar/styles.module.css +297 -0
- package/dist/esm/components/Toolbar/types.d.ts +80 -0
- package/dist/esm/components/Toolbar/types.js +1 -0
- package/dist/esm/components/Toolbar/typesUtils.d.ts +12 -0
- package/dist/esm/components/Toolbar/typesUtils.js +1 -0
- package/dist/esm/components/Toolbar/utils/buildMobileOverflowActions.d.ts +10 -0
- package/dist/esm/components/Toolbar/utils/buildMobileOverflowActions.js +81 -0
- package/dist/esm/components/Toolbar/utils/toolbarAfterOverflow.d.ts +2 -0
- package/dist/esm/components/Toolbar/utils/toolbarAfterOverflow.js +2 -0
- package/dist/esm/components/index.d.ts +4 -0
- package/dist/esm/components/index.js +3 -0
- package/dist/esm/helperComponents/BulkActions/BulkActions.d.ts +2 -0
- package/dist/esm/helperComponents/BulkActions/BulkActions.js +14 -0
- package/dist/esm/helperComponents/BulkActions/components/BulkActionsCheckbox/BulkActionsCheckbox.d.ts +8 -0
- package/dist/esm/helperComponents/BulkActions/components/BulkActionsCheckbox/BulkActionsCheckbox.js +14 -0
- package/dist/esm/helperComponents/BulkActions/components/BulkActionsCheckbox/index.d.ts +1 -0
- package/dist/esm/helperComponents/BulkActions/components/BulkActionsCheckbox/index.js +1 -0
- package/dist/esm/helperComponents/BulkActions/components/BulkActionsCheckbox/styles.module.css +3 -0
- package/dist/esm/helperComponents/BulkActions/components/BulkActionsControls/BulkActionsControls.d.ts +17 -0
- package/dist/esm/helperComponents/BulkActions/components/BulkActionsControls/BulkActionsControls.js +33 -0
- package/dist/esm/helperComponents/BulkActions/components/BulkActionsControls/index.d.ts +1 -0
- package/dist/esm/helperComponents/BulkActions/components/BulkActionsControls/index.js +1 -0
- package/dist/esm/helperComponents/BulkActions/components/BulkActionsControls/styles.module.css +39 -0
- package/dist/esm/helperComponents/BulkActions/components/MobileBulkActionsSheet/MobileBulkActionsSheet.d.ts +14 -0
- package/dist/esm/helperComponents/BulkActions/components/MobileBulkActionsSheet/MobileBulkActionsSheet.js +24 -0
- package/dist/esm/helperComponents/BulkActions/components/MobileBulkActionsSheet/index.d.ts +1 -0
- package/dist/esm/helperComponents/BulkActions/components/MobileBulkActionsSheet/index.js +1 -0
- package/dist/esm/helperComponents/BulkActions/components/SelectionLabel/SelectionLabel.d.ts +9 -0
- package/dist/esm/helperComponents/BulkActions/components/SelectionLabel/SelectionLabel.js +15 -0
- package/dist/esm/helperComponents/BulkActions/components/SelectionLabel/index.d.ts +1 -0
- package/dist/esm/helperComponents/BulkActions/components/SelectionLabel/index.js +1 -0
- package/dist/esm/helperComponents/BulkActions/components/SelectionLabel/styles.module.css +40 -0
- package/dist/esm/helperComponents/BulkActions/components/index.d.ts +4 -0
- package/dist/esm/helperComponents/BulkActions/components/index.js +4 -0
- package/dist/esm/helperComponents/BulkActions/index.d.ts +2 -0
- package/dist/esm/helperComponents/BulkActions/index.js +2 -0
- package/dist/esm/helperComponents/BulkActions/styles.module.css +9 -0
- package/dist/esm/helperComponents/BulkActions/types.d.ts +31 -0
- package/dist/esm/helperComponents/BulkActions/types.js +1 -0
- package/dist/esm/helperComponents/BulkActions/utils.d.ts +15 -0
- package/dist/esm/helperComponents/BulkActions/utils.js +21 -0
- package/dist/esm/helperComponents/DataView/DataView.d.ts +2 -0
- package/dist/esm/helperComponents/DataView/DataView.js +6 -0
- package/dist/esm/helperComponents/DataView/constants.d.ts +9 -0
- package/dist/esm/helperComponents/DataView/constants.js +10 -0
- package/dist/esm/helperComponents/DataView/index.d.ts +3 -0
- package/dist/esm/helperComponents/DataView/index.js +3 -0
- package/dist/esm/helperComponents/DataView/types.d.ts +12 -0
- package/dist/esm/helperComponents/DataView/types.js +1 -0
- package/dist/esm/helperComponents/FilterButton/FilterButton.d.ts +12 -0
- package/dist/esm/helperComponents/FilterButton/FilterButton.js +11 -0
- package/dist/esm/helperComponents/FilterButton/index.d.ts +1 -0
- package/dist/esm/helperComponents/FilterButton/index.js +1 -0
- package/dist/esm/helperComponents/FilterButton/styles.module.css +5 -0
- package/dist/esm/helperComponents/MoreActions/MoreActions.d.ts +13 -0
- package/dist/esm/helperComponents/MoreActions/MoreActions.js +29 -0
- package/dist/esm/helperComponents/MoreActions/index.d.ts +1 -0
- package/dist/esm/helperComponents/MoreActions/index.js +1 -0
- package/dist/esm/helperComponents/MoreActions/styles.module.css +5 -0
- package/dist/esm/helperComponents/Search/ToolbarSearch.d.ts +9 -0
- package/dist/esm/helperComponents/Search/ToolbarSearch.js +13 -0
- package/dist/esm/helperComponents/Search/index.d.ts +1 -0
- package/dist/esm/helperComponents/Search/index.js +1 -0
- package/dist/esm/helperComponents/Search/styles.module.css +25 -0
- package/dist/esm/helperComponents/Separator/Separator.d.ts +1 -0
- package/dist/esm/helperComponents/Separator/Separator.js +5 -0
- package/dist/esm/helperComponents/Separator/index.d.ts +1 -0
- package/dist/esm/helperComponents/Separator/index.js +1 -0
- package/dist/esm/helperComponents/Separator/styles.module.css +14 -0
- package/dist/esm/helperComponents/index.d.ts +6 -0
- package/dist/esm/helperComponents/index.js +6 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/locale/index.d.ts +55 -0
- package/dist/esm/locale/index.js +29 -0
- package/dist/esm/style.css +437 -0
- package/dist/esm/testIds.d.ts +24 -0
- package/dist/esm/testIds.js +24 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/package.json +65 -0
- package/src/components/Toolbar/Toolbar.tsx +145 -0
- package/src/components/Toolbar/helpers.ts +39 -0
- package/src/components/Toolbar/hooks/index.ts +2 -0
- package/src/components/Toolbar/hooks/useFilters.ts +87 -0
- package/src/components/Toolbar/hooks/usePersistState/index.ts +1 -0
- package/src/components/Toolbar/hooks/usePersistState/usePersistState.ts +107 -0
- package/src/components/Toolbar/hooks/usePersistState/utils/index.ts +3 -0
- package/src/components/Toolbar/hooks/usePersistState/utils/isDateString.ts +49 -0
- package/src/components/Toolbar/hooks/usePersistState/utils/parser.ts +62 -0
- package/src/components/Toolbar/hooks/usePersistState/utils/serializer.ts +51 -0
- package/src/components/Toolbar/index.ts +3 -0
- package/src/components/Toolbar/styles.module.scss +116 -0
- package/src/components/Toolbar/types.ts +99 -0
- package/src/components/Toolbar/typesUtils.ts +17 -0
- package/src/components/Toolbar/utils/buildMobileOverflowActions.tsx +142 -0
- package/src/components/Toolbar/utils/toolbarAfterOverflow.ts +2 -0
- package/src/components/index.ts +4 -0
- package/src/helperComponents/BulkActions/BulkActions.tsx +54 -0
- package/src/helperComponents/BulkActions/components/BulkActionsCheckbox/BulkActionsCheckbox.tsx +35 -0
- package/src/helperComponents/BulkActions/components/BulkActionsCheckbox/index.ts +1 -0
- package/src/helperComponents/BulkActions/components/BulkActionsCheckbox/styles.module.scss +3 -0
- package/src/helperComponents/BulkActions/components/BulkActionsControls/BulkActionsControls.tsx +135 -0
- package/src/helperComponents/BulkActions/components/BulkActionsControls/index.ts +1 -0
- package/src/helperComponents/BulkActions/components/BulkActionsControls/styles.module.scss +49 -0
- package/src/helperComponents/BulkActions/components/MobileBulkActionsSheet/MobileBulkActionsSheet.tsx +88 -0
- package/src/helperComponents/BulkActions/components/MobileBulkActionsSheet/index.ts +1 -0
- package/src/helperComponents/BulkActions/components/SelectionLabel/SelectionLabel.tsx +40 -0
- package/src/helperComponents/BulkActions/components/SelectionLabel/index.ts +1 -0
- package/src/helperComponents/BulkActions/components/SelectionLabel/styles.module.scss +38 -0
- package/src/helperComponents/BulkActions/components/index.ts +4 -0
- package/src/helperComponents/BulkActions/index.ts +2 -0
- package/src/helperComponents/BulkActions/styles.module.scss +13 -0
- package/src/helperComponents/BulkActions/types.ts +32 -0
- package/src/helperComponents/BulkActions/utils.tsx +32 -0
- package/src/helperComponents/DataView/DataView.tsx +22 -0
- package/src/helperComponents/DataView/constants.tsx +15 -0
- package/src/helperComponents/DataView/index.ts +3 -0
- package/src/helperComponents/DataView/types.ts +15 -0
- package/src/helperComponents/FilterButton/FilterButton.tsx +40 -0
- package/src/helperComponents/FilterButton/index.ts +1 -0
- package/src/helperComponents/FilterButton/styles.module.scss +5 -0
- package/src/helperComponents/MoreActions/MoreActions.tsx +69 -0
- package/src/helperComponents/MoreActions/index.ts +1 -0
- package/src/helperComponents/MoreActions/styles.module.scss +5 -0
- package/src/helperComponents/Search/ToolbarSearch.tsx +48 -0
- package/src/helperComponents/Search/index.ts +1 -0
- package/src/helperComponents/Search/styles.module.scss +35 -0
- package/src/helperComponents/Separator/Separator.tsx +9 -0
- package/src/helperComponents/Separator/index.ts +1 -0
- package/src/helperComponents/Separator/styles.module.scss +18 -0
- package/src/helperComponents/index.ts +6 -0
- package/src/index.ts +5 -0
- package/src/locale/index.ts +33 -0
- package/src/testIds.ts +24 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { BottomSheet } from '@cloud-ru/ds-bottom-sheet';
|
|
2
|
+
import { usePortalContext } from '@cloud-ru/ds-portal-context';
|
|
3
|
+
import { useThemeClassnames } from '@cloud-ru/ds-theme';
|
|
4
|
+
import { useLayoutEffect } from '@cloud-ru/ds-utils';
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { toolbarLocale } from '../../../../locale';
|
|
8
|
+
import { TEST_IDS } from '../../../../testIds';
|
|
9
|
+
import { BulkAction } from '../../types';
|
|
10
|
+
import { BulkActionsControls } from '../BulkActionsControls';
|
|
11
|
+
import { SelectionLabel } from '../SelectionLabel';
|
|
12
|
+
|
|
13
|
+
type MobileBulkActionsSheetProps = {
|
|
14
|
+
open: boolean;
|
|
15
|
+
actions: BulkAction[];
|
|
16
|
+
selectedCount: number;
|
|
17
|
+
totalCount?: number;
|
|
18
|
+
hasSelection: boolean;
|
|
19
|
+
checked?: boolean;
|
|
20
|
+
indeterminate?: boolean;
|
|
21
|
+
onCheck?(): void;
|
|
22
|
+
showBulkCheckbox?: boolean;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const CLOSE_STUB_CALLBACK = () => undefined;
|
|
26
|
+
|
|
27
|
+
export function MobileBulkActionsSheet({
|
|
28
|
+
open,
|
|
29
|
+
actions,
|
|
30
|
+
selectedCount,
|
|
31
|
+
totalCount,
|
|
32
|
+
hasSelection,
|
|
33
|
+
checked,
|
|
34
|
+
indeterminate,
|
|
35
|
+
onCheck,
|
|
36
|
+
showBulkCheckbox,
|
|
37
|
+
}: MobileBulkActionsSheetProps) {
|
|
38
|
+
const { t } = toolbarLocale.useTranslations();
|
|
39
|
+
const portalContext = usePortalContext();
|
|
40
|
+
const [bottomSheetKey, setBottomSheetKey] = useState('notReady');
|
|
41
|
+
|
|
42
|
+
useLayoutEffect(() => {
|
|
43
|
+
setBottomSheetKey('ready');
|
|
44
|
+
}, []);
|
|
45
|
+
|
|
46
|
+
// Фиксируем density, остальные оси (colorScheme/brand/…) наследуем из контекста темы.
|
|
47
|
+
const themeClassName = useThemeClassnames({ density: 'comfort' });
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<BottomSheet
|
|
51
|
+
className={themeClassName}
|
|
52
|
+
key={bottomSheetKey}
|
|
53
|
+
container={portalContext.current ?? undefined}
|
|
54
|
+
open={open}
|
|
55
|
+
onClose={CLOSE_STUB_CALLBACK}
|
|
56
|
+
title={t('multipleActions')}
|
|
57
|
+
// TODO: slotAfterTitle должен расширяться на всю ширину, а section-label уходить вправо
|
|
58
|
+
slotAfterTitle={
|
|
59
|
+
<SelectionLabel
|
|
60
|
+
placement='headline'
|
|
61
|
+
selectedCount={selectedCount}
|
|
62
|
+
totalCount={totalCount}
|
|
63
|
+
hasSelection={hasSelection}
|
|
64
|
+
/>
|
|
65
|
+
}
|
|
66
|
+
content={
|
|
67
|
+
<BulkActionsControls
|
|
68
|
+
variant='sheet'
|
|
69
|
+
actions={actions}
|
|
70
|
+
checked={checked}
|
|
71
|
+
indeterminate={indeterminate}
|
|
72
|
+
onCheck={onCheck}
|
|
73
|
+
showCheckbox={showBulkCheckbox}
|
|
74
|
+
selectedCount={selectedCount}
|
|
75
|
+
totalCount={totalCount}
|
|
76
|
+
hasSelection={hasSelection}
|
|
77
|
+
/>
|
|
78
|
+
}
|
|
79
|
+
showBackdrop={false}
|
|
80
|
+
swipeEnabled={false}
|
|
81
|
+
lockScroll={false}
|
|
82
|
+
closeOnPopstate={false}
|
|
83
|
+
safeArea={false}
|
|
84
|
+
withDividers={false}
|
|
85
|
+
data-test-id={TEST_IDS.mobileBulkActionsSheet}
|
|
86
|
+
/>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MobileBulkActionsSheet';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
|
|
3
|
+
import { toolbarLocale } from '../../../../locale';
|
|
4
|
+
import styles from './styles.module.scss';
|
|
5
|
+
|
|
6
|
+
type SelectionLabelProps = {
|
|
7
|
+
selectedCount: number;
|
|
8
|
+
totalCount?: number;
|
|
9
|
+
hasSelection: boolean;
|
|
10
|
+
className?: string;
|
|
11
|
+
placement?: 'inline' | 'headline';
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export function SelectionLabel({
|
|
15
|
+
selectedCount,
|
|
16
|
+
totalCount,
|
|
17
|
+
hasSelection,
|
|
18
|
+
className,
|
|
19
|
+
placement = 'inline',
|
|
20
|
+
}: SelectionLabelProps) {
|
|
21
|
+
const { t } = toolbarLocale.useTranslations();
|
|
22
|
+
|
|
23
|
+
const valueLabel =
|
|
24
|
+
hasSelection && totalCount != null
|
|
25
|
+
? t('selectedCountOf', { count: selectedCount, total: totalCount })
|
|
26
|
+
: t('selectedCount', { count: selectedCount });
|
|
27
|
+
|
|
28
|
+
const label = (
|
|
29
|
+
<div className={cn(styles.selectionLabel, className)} data-has-selection={hasSelection || undefined}>
|
|
30
|
+
<span className={styles.selectionLabelPrefix}>{t('selectedPrefix')}</span>
|
|
31
|
+
<span className={styles.selectionLabelValue}>{valueLabel}</span>
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
if (placement === 'headline') {
|
|
36
|
+
return <div className={styles.headlinePlacement}>{label}</div>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return label;
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SelectionLabel';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
@use '@cloud-ru/ds-figma-variables/build/scss/styles/styles.module' as base;
|
|
2
|
+
@use '@cloud-ru/ds-figma-variables/build/scss/components/chip.module' as chip;
|
|
3
|
+
|
|
4
|
+
.selectionLabel {
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
flex-shrink: 0;
|
|
7
|
+
gap: chip.$sn-chip-anatomy-size-s-container-textWrapper-gap;
|
|
8
|
+
align-items: center;
|
|
9
|
+
|
|
10
|
+
padding-inline: chip.$sn-chip-anatomy-size-s-container-textWrapper-paddingHorizontal;
|
|
11
|
+
|
|
12
|
+
white-space: nowrap;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.selectionLabelPrefix {
|
|
16
|
+
@include base.composite-var(base.$sn-thin-label-m);
|
|
17
|
+
|
|
18
|
+
color: base.$sn-theme-color-available-version-textDisabled;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.selectionLabelValue {
|
|
22
|
+
@include base.composite-var(base.$sn-regular-body-s);
|
|
23
|
+
|
|
24
|
+
color: base.$sn-theme-color-available-version-textTertiary;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.selectionLabel:not([data-has-selection]) .selectionLabelValue {
|
|
28
|
+
color: base.$sn-theme-color-available-version-textDisabled;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.headlinePlacement {
|
|
32
|
+
display: flex;
|
|
33
|
+
flex: 1 1 auto;
|
|
34
|
+
justify-content: flex-end;
|
|
35
|
+
|
|
36
|
+
width: 100%;
|
|
37
|
+
min-width: 0;
|
|
38
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@use '@cloud-ru/ds-figma-variables/build/scss/styles/styles.module' as base;
|
|
2
|
+
@use '@cloud-ru/ds-figma-variables/build/scss/components/toolbar.module' as toolbar;
|
|
3
|
+
|
|
4
|
+
.bulkTool {
|
|
5
|
+
display: flex;
|
|
6
|
+
gap: toolbar.$sn-toolbar-anatomy-container-tool-bulkAction-gap;
|
|
7
|
+
align-items: center;
|
|
8
|
+
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
width: 100%;
|
|
11
|
+
min-height: base.$sn-primitive-dimension-24;
|
|
12
|
+
padding-left: toolbar.$sn-toolbar-anatomy-container-tool-bulkAction-paddingLeft;
|
|
13
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { TooltipProps } from '@cloud-ru/ds-tooltip';
|
|
2
|
+
import { WithSupportProps } from '@cloud-ru/ds-utils';
|
|
3
|
+
import { JSXElementConstructor, RefObject } from 'react';
|
|
4
|
+
|
|
5
|
+
export type BulkAction = WithSupportProps<{
|
|
6
|
+
label: string;
|
|
7
|
+
icon: JSXElementConstructor<{ className?: string }>;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
tooltip?: TooltipProps['tip'];
|
|
10
|
+
onClick?(): void;
|
|
11
|
+
}>;
|
|
12
|
+
|
|
13
|
+
export type BulkActionsProps = WithSupportProps<{
|
|
14
|
+
/** Список массовых действий */
|
|
15
|
+
actions?: BulkAction[];
|
|
16
|
+
/** Колбек смены значения чекбокса */
|
|
17
|
+
onCheck?(): void;
|
|
18
|
+
/** Значение чекбокса */
|
|
19
|
+
checked?: boolean;
|
|
20
|
+
/** Состояние частичного выбора */
|
|
21
|
+
indeterminate?: boolean;
|
|
22
|
+
/** Показывать чекбокс слева (Figma: showBulkCheckbox) @default true */
|
|
23
|
+
showBulkCheckbox?: boolean;
|
|
24
|
+
/** Количество выбранных элементов (для подписи Selected: N) */
|
|
25
|
+
selectedCount?: number;
|
|
26
|
+
/** Общее количество элементов (для подписи Selected: N of M) */
|
|
27
|
+
totalCount?: number;
|
|
28
|
+
}>;
|
|
29
|
+
|
|
30
|
+
export type BulkActionsComponentProps = BulkActionsProps & {
|
|
31
|
+
resizingContainerRef?: RefObject<HTMLDivElement>;
|
|
32
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Tooltip } from '@cloud-ru/ds-tooltip';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
import { BulkAction } from './types';
|
|
5
|
+
|
|
6
|
+
export function getBulkActionKey(action: BulkAction, index: number): string {
|
|
7
|
+
return action['data-test-id'] ?? `bulk-action__${index}`;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function getBulkActionIndex(actions: BulkAction[], action: BulkAction, fallbackIndex: number): number {
|
|
11
|
+
const index = actions.indexOf(action);
|
|
12
|
+
|
|
13
|
+
return index >= 0 ? index : fallbackIndex;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function mapBulkActionToDroplistItem(action: BulkAction, index: number) {
|
|
17
|
+
const { label, icon: Icon, onClick, disabled, tooltip, 'data-test-id': testId } = action;
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
id: getBulkActionKey(action, index),
|
|
21
|
+
content: { label },
|
|
22
|
+
beforeContent: <Icon />,
|
|
23
|
+
onClick,
|
|
24
|
+
disabled,
|
|
25
|
+
itemWrapRender: (item: ReactNode) => (
|
|
26
|
+
<Tooltip tip={tooltip} open={tooltip ? undefined : false} placement='right' data-test-id={`${testId}-tooltip`}>
|
|
27
|
+
{item}
|
|
28
|
+
</Tooltip>
|
|
29
|
+
),
|
|
30
|
+
'data-test-id': testId,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SegmentControl, SIZE } from '@cloud-ru/ds-segment-control';
|
|
2
|
+
|
|
3
|
+
import { DATA_VIEW_VALUE, DEFAULT_ITEMS } from './constants';
|
|
4
|
+
import { DataViewProps } from './types';
|
|
5
|
+
|
|
6
|
+
export function DataView({
|
|
7
|
+
value,
|
|
8
|
+
defaultValue = DATA_VIEW_VALUE.List,
|
|
9
|
+
onChange,
|
|
10
|
+
items = DEFAULT_ITEMS,
|
|
11
|
+
}: DataViewProps) {
|
|
12
|
+
return (
|
|
13
|
+
<SegmentControl
|
|
14
|
+
outline={false}
|
|
15
|
+
size={SIZE.M}
|
|
16
|
+
value={value}
|
|
17
|
+
defaultValue={defaultValue}
|
|
18
|
+
onChange={onChange}
|
|
19
|
+
items={items}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ViewCardSVG, ViewTableSVG } from '@cloud-ru/ds-icons/interface/product';
|
|
2
|
+
import { type SegmentControlProps } from '@cloud-ru/ds-segment-control';
|
|
3
|
+
import { ValueOf } from '@cloud-ru/ds-utils';
|
|
4
|
+
|
|
5
|
+
export const DATA_VIEW_VALUE = {
|
|
6
|
+
List: 'list',
|
|
7
|
+
Compact: 'compact',
|
|
8
|
+
} as const;
|
|
9
|
+
|
|
10
|
+
type DataViewValue = ValueOf<typeof DATA_VIEW_VALUE>;
|
|
11
|
+
|
|
12
|
+
export const DEFAULT_ITEMS: SegmentControlProps<DataViewValue>['items'] = [
|
|
13
|
+
{ value: DATA_VIEW_VALUE.List, label: '', icon: <ViewTableSVG /> },
|
|
14
|
+
{ value: DATA_VIEW_VALUE.Compact, label: '', icon: <ViewCardSVG /> },
|
|
15
|
+
];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type SegmentControlProps } from '@cloud-ru/ds-segment-control';
|
|
2
|
+
import { ValueOf, WithSupportProps } from '@cloud-ru/ds-utils';
|
|
3
|
+
|
|
4
|
+
import { DATA_VIEW_VALUE } from './constants';
|
|
5
|
+
|
|
6
|
+
export type DataViewValue = ValueOf<typeof DATA_VIEW_VALUE>;
|
|
7
|
+
|
|
8
|
+
type DataViewBaseProps = {
|
|
9
|
+
value?: DataViewValue;
|
|
10
|
+
defaultValue?: DataViewValue;
|
|
11
|
+
onChange?(value: DataViewValue): void;
|
|
12
|
+
items?: SegmentControlProps<DataViewValue>['items'];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type DataViewProps = WithSupportProps<DataViewBaseProps>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Button } from '@cloud-ru/ds-button';
|
|
2
|
+
import { FilterSVG } from '@cloud-ru/ds-icons/interface/system';
|
|
3
|
+
import { Tooltip } from '@cloud-ru/ds-tooltip';
|
|
4
|
+
import { WithSupportProps } from '@cloud-ru/ds-utils';
|
|
5
|
+
|
|
6
|
+
import { toolbarLocale } from '../../locale';
|
|
7
|
+
import { TEST_IDS } from '../../testIds';
|
|
8
|
+
import styles from './styles.module.scss';
|
|
9
|
+
|
|
10
|
+
type FilterButtonBaseProps = {
|
|
11
|
+
/** Открыта ли строка фильтров */
|
|
12
|
+
open: boolean;
|
|
13
|
+
/** Колбек смены состояния открытия строки фильтров */
|
|
14
|
+
onOpenChange(open: boolean): void;
|
|
15
|
+
/** Количество активных фильтров для отображения в counter */
|
|
16
|
+
numberOfFilters?: number;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type FilterButtonProps = WithSupportProps<FilterButtonBaseProps>;
|
|
20
|
+
|
|
21
|
+
export function FilterButton({ open, onOpenChange, numberOfFilters }: FilterButtonProps) {
|
|
22
|
+
const { t } = toolbarLocale.useTranslations();
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Tooltip tip={open ? t('hideFilters') : t('showFilters')} triggerClassName={styles.trigger}>
|
|
26
|
+
<Button
|
|
27
|
+
view={open ? 'tonal' : 'function'}
|
|
28
|
+
appearance={open ? 'primary' : 'neutral'}
|
|
29
|
+
size='m'
|
|
30
|
+
icon={<FilterSVG />}
|
|
31
|
+
iconPosition='after'
|
|
32
|
+
counter={numberOfFilters ? { value: numberOfFilters } : undefined}
|
|
33
|
+
onClick={() => onOpenChange(!open)}
|
|
34
|
+
aria-pressed={open}
|
|
35
|
+
data-test-id={TEST_IDS.filterButton}
|
|
36
|
+
data-filter-open={open || undefined}
|
|
37
|
+
/>
|
|
38
|
+
</Tooltip>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FilterButton';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Button } from '@cloud-ru/ds-button';
|
|
2
|
+
import { KebabSVG } from '@cloud-ru/ds-icons/interface/system';
|
|
3
|
+
import { BaseItem, Droplist } from '@cloud-ru/ds-list';
|
|
4
|
+
import { Tag } from '@cloud-ru/ds-tag';
|
|
5
|
+
import { extractSupportProps, WithSupportProps } from '@cloud-ru/ds-utils';
|
|
6
|
+
import { MouseEvent, ReactNode, useRef, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { TEST_IDS } from '../../testIds';
|
|
9
|
+
import styles from './styles.module.scss';
|
|
10
|
+
|
|
11
|
+
export type Action = {
|
|
12
|
+
tagLabel?: string;
|
|
13
|
+
icon?: ReactNode;
|
|
14
|
+
'data-test-id'?: string;
|
|
15
|
+
} & Pick<BaseItem, 'content' | 'disabled' | 'onClick'>;
|
|
16
|
+
|
|
17
|
+
export type MoreActionsProps = WithSupportProps<{
|
|
18
|
+
/** Элементы выпадающего списка кнопки с действиями */
|
|
19
|
+
moreActions: Action[];
|
|
20
|
+
}>;
|
|
21
|
+
|
|
22
|
+
export function MoreActions({ moreActions, 'data-test-id': dataTestId, ...rest }: MoreActionsProps) {
|
|
23
|
+
const [isOpen, setIsOpen] = useState<boolean>(false);
|
|
24
|
+
const supportProps = extractSupportProps(rest);
|
|
25
|
+
const triggerRef = useRef<HTMLButtonElement>(null);
|
|
26
|
+
|
|
27
|
+
function mapMoreActionToDroplistItem(item: Action) {
|
|
28
|
+
return {
|
|
29
|
+
onClick: (event: MouseEvent<HTMLElement>) => {
|
|
30
|
+
item.onClick?.(event);
|
|
31
|
+
setIsOpen(false);
|
|
32
|
+
event.stopPropagation();
|
|
33
|
+
},
|
|
34
|
+
disabled: item.disabled,
|
|
35
|
+
content: item.content,
|
|
36
|
+
beforeContent: item.icon,
|
|
37
|
+
afterContent: item.tagLabel ? <Tag label={item.tagLabel} /> : undefined,
|
|
38
|
+
'data-test-id': item['data-test-id'] ?? TEST_IDS.option,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<Droplist
|
|
44
|
+
triggerClassName={styles.trigger}
|
|
45
|
+
trigger='clickAndFocusVisible'
|
|
46
|
+
open={isOpen}
|
|
47
|
+
{...supportProps}
|
|
48
|
+
data-test-id={dataTestId ?? TEST_IDS.droplist}
|
|
49
|
+
onOpenChange={setIsOpen}
|
|
50
|
+
placement='bottom-end'
|
|
51
|
+
scroll
|
|
52
|
+
size='m'
|
|
53
|
+
items={moreActions.map(mapMoreActionToDroplistItem)}
|
|
54
|
+
triggerElemRef={triggerRef}
|
|
55
|
+
>
|
|
56
|
+
{({ onKeyDown }) => (
|
|
57
|
+
<Button
|
|
58
|
+
view='function'
|
|
59
|
+
appearance='neutral'
|
|
60
|
+
icon={<KebabSVG />}
|
|
61
|
+
size='m'
|
|
62
|
+
data-test-id={TEST_IDS.moreActionsButton}
|
|
63
|
+
innerRef={triggerRef}
|
|
64
|
+
onKeyDown={onKeyDown}
|
|
65
|
+
/>
|
|
66
|
+
)}
|
|
67
|
+
</Droplist>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MoreActions';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Search as SearchComponent } from '@cloud-ru/ds-search';
|
|
2
|
+
import { WithSupportProps } from '@cloud-ru/ds-utils';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
|
|
5
|
+
import { TEST_IDS } from '../../testIds';
|
|
6
|
+
import styles from './styles.module.scss';
|
|
7
|
+
|
|
8
|
+
export type SearchProps = {
|
|
9
|
+
value: string;
|
|
10
|
+
onChange(value: string): void;
|
|
11
|
+
onSubmit?(value: string): void;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function Search({
|
|
17
|
+
value,
|
|
18
|
+
onChange,
|
|
19
|
+
onSubmit,
|
|
20
|
+
placeholder,
|
|
21
|
+
loading,
|
|
22
|
+
'data-test-id': dataTestId,
|
|
23
|
+
}: WithSupportProps<SearchProps>) {
|
|
24
|
+
const [focusVisible, setFocusVisible] = useState(false);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div className={styles.root} data-focusvisible={focusVisible || undefined} data-loading={loading || undefined}>
|
|
28
|
+
<span className={styles.focusFrame} aria-hidden />
|
|
29
|
+
<SearchComponent
|
|
30
|
+
value={value}
|
|
31
|
+
onChange={onChange}
|
|
32
|
+
onSubmit={onSubmit}
|
|
33
|
+
placeholder={placeholder}
|
|
34
|
+
loading={loading}
|
|
35
|
+
background={false}
|
|
36
|
+
size='m'
|
|
37
|
+
className={styles.search}
|
|
38
|
+
data-test-id={dataTestId ?? TEST_IDS.search}
|
|
39
|
+
onFocus={event => {
|
|
40
|
+
setFocusVisible(event.target.matches(':focus-visible'));
|
|
41
|
+
}}
|
|
42
|
+
onBlur={() => {
|
|
43
|
+
setFocusVisible(false);
|
|
44
|
+
}}
|
|
45
|
+
/>
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ToolbarSearch';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@use '@cloud-ru/ds-figma-variables/build/scss/styles/styles.module' as base;
|
|
2
|
+
@use '@cloud-ru/ds-figma-variables/build/scss/components/toolbar.module' as toolbar;
|
|
3
|
+
|
|
4
|
+
.root {
|
|
5
|
+
position: relative;
|
|
6
|
+
width: 100%;
|
|
7
|
+
min-width: base.$sn-primitive-dimension-96;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.focusFrame {
|
|
11
|
+
pointer-events: none;
|
|
12
|
+
|
|
13
|
+
position: absolute;
|
|
14
|
+
z-index: 0;
|
|
15
|
+
// В макете рамка рисуется внутрь поля (`focusedFrame/regular/inside`, stroke INSIDE),
|
|
16
|
+
// поэтому нулевой inset, а не отрицательный.
|
|
17
|
+
inset: 0;
|
|
18
|
+
|
|
19
|
+
display: none;
|
|
20
|
+
|
|
21
|
+
border: base.$sn-brand-anatomy-focusLine-control-strokeWeight solid base.$sn-theme-color-available-complementary;
|
|
22
|
+
border-radius: toolbar.$sn-toolbar-anatomy-container-tool-search-borderRadius;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.search {
|
|
26
|
+
position: relative;
|
|
27
|
+
z-index: 1;
|
|
28
|
+
width: 100%;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.root:not([data-loading='true'])[data-focusvisible='true'] {
|
|
32
|
+
.focusFrame {
|
|
33
|
+
display: block;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Separator';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
@use '@cloud-ru/ds-figma-variables/build/scss/styles/styles.module' as base;
|
|
2
|
+
|
|
3
|
+
.separatorWrapper {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-shrink: 0;
|
|
6
|
+
align-items: stretch;
|
|
7
|
+
align-self: stretch;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.separator {
|
|
11
|
+
flex: 1 1 auto;
|
|
12
|
+
align-self: stretch;
|
|
13
|
+
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
width: base.$sn-primitive-strokeWeight-strokeRegular;
|
|
16
|
+
|
|
17
|
+
background-color: base.$sn-theme-color-available-borderColor;
|
|
18
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { defineLocale, defineMessages } from '@cloud-ru/ds-locale';
|
|
2
|
+
|
|
3
|
+
const TOOLBAR_MESSAGES = defineMessages({
|
|
4
|
+
'en-GB': {
|
|
5
|
+
showFilters: 'Show filters',
|
|
6
|
+
hideFilters: 'Hide filters',
|
|
7
|
+
selected: 'Selected: {{count}}',
|
|
8
|
+
selectedOf: 'Selected: {{count}} of {{total}}',
|
|
9
|
+
selectedPrefix: 'Selected:',
|
|
10
|
+
selectedCount: '{{count}}',
|
|
11
|
+
selectedCountOf: '{{count}} of {{total}}',
|
|
12
|
+
multipleActions: 'Multiple actions',
|
|
13
|
+
refresh: 'Refresh',
|
|
14
|
+
more: 'More',
|
|
15
|
+
},
|
|
16
|
+
'ru-RU': {
|
|
17
|
+
showFilters: 'Показать фильтры',
|
|
18
|
+
hideFilters: 'Скрыть фильтры',
|
|
19
|
+
selected: 'Выбрано: {{count}}',
|
|
20
|
+
selectedOf: 'Выбрано: {{count}} из {{total}}',
|
|
21
|
+
selectedPrefix: 'Выбрано:',
|
|
22
|
+
selectedCount: '{{count}}',
|
|
23
|
+
selectedCountOf: '{{count}} из {{total}}',
|
|
24
|
+
multipleActions: 'Массовые действия',
|
|
25
|
+
refresh: 'Обновить',
|
|
26
|
+
more: 'Ещё',
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export type ToolbarMessages = (typeof TOOLBAR_MESSAGES)['en-GB'];
|
|
31
|
+
|
|
32
|
+
/** locale компонента Toolbar: `toolbarLocale.useTranslations()` в коде, `toolbarLocale.extend(...)` в сервисе. */
|
|
33
|
+
export const toolbarLocale = defineLocale('@cloud-ru/ds-toolbar', TOOLBAR_MESSAGES);
|
package/src/testIds.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const TEST_IDS = {
|
|
2
|
+
main: 'toolbar',
|
|
3
|
+
checkbox: 'toolbar__checkbox',
|
|
4
|
+
confirmAction: 'toolbar__confirm-action',
|
|
5
|
+
rejectAction: 'toolbar__reject-action',
|
|
6
|
+
deleteAction: 'toolbar__delete-action',
|
|
7
|
+
deactivateAction: 'toolbar__deactivate-action',
|
|
8
|
+
disabledAction: 'toolbar__disabled-action',
|
|
9
|
+
bulkTool: 'toolbar__bulk-tool',
|
|
10
|
+
bulkActions: 'toolbar__bulk-actions',
|
|
11
|
+
mobileBulkActionsSheet: 'toolbar__mobile-bulk-actions-sheet',
|
|
12
|
+
moreBulkActionsButton: 'toolbar__more-bulk-actions-button',
|
|
13
|
+
refreshButton: 'toolbar__refresh-button',
|
|
14
|
+
refreshOption: 'toolbar__refresh-option',
|
|
15
|
+
afterOption: 'toolbar__after-option',
|
|
16
|
+
search: 'toolbar__search',
|
|
17
|
+
filterButton: 'toolbar__filter-button',
|
|
18
|
+
filterRow: 'toolbar__filter-row',
|
|
19
|
+
moreActionsButton: 'toolbar__more-actions-button',
|
|
20
|
+
droplist: 'toolbar__droplist',
|
|
21
|
+
option: 'toolbar__droplist-option',
|
|
22
|
+
after: 'toolbar__after',
|
|
23
|
+
dataView: 'toolbar__data-view',
|
|
24
|
+
} as const;
|