@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
package/dist/cjs/helperComponents/BulkActions/components/BulkActionsControls/BulkActionsControls.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BulkActionsControls = BulkActionsControls;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const button_1 = require("@cloud-ru/ds-button");
|
|
9
|
+
const system_1 = require("@cloud-ru/ds-icons/interface/system");
|
|
10
|
+
const list_1 = require("@cloud-ru/ds-list");
|
|
11
|
+
const tooltip_1 = require("@cloud-ru/ds-tooltip");
|
|
12
|
+
const utils_1 = require("@cloud-ru/ds-utils");
|
|
13
|
+
const react_1 = require("react");
|
|
14
|
+
const locale_1 = require("../../../../locale");
|
|
15
|
+
const testIds_1 = require("../../../../testIds");
|
|
16
|
+
const utils_2 = require("../../utils");
|
|
17
|
+
const BulkActionsCheckbox_1 = require("../BulkActionsCheckbox");
|
|
18
|
+
const SelectionLabel_1 = require("../SelectionLabel");
|
|
19
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
20
|
+
function BulkActionsControls({ actions, variant, checked, indeterminate, onCheck, showCheckbox = false, resizingContainerRef, selectedCount = 0, totalCount, hasSelection = false, }) {
|
|
21
|
+
const { t } = locale_1.toolbarLocale.useTranslations();
|
|
22
|
+
const [isMoreOpen, setIsMoreOpen] = (0, react_1.useState)(false);
|
|
23
|
+
const actionsAreaRef = (0, react_1.useRef)(null);
|
|
24
|
+
const triggerRef = (0, react_1.useRef)(null);
|
|
25
|
+
const isSheet = variant === 'sheet';
|
|
26
|
+
const { visibleItems, hiddenItems } = (0, utils_1.useDynamicList)({
|
|
27
|
+
items: actions,
|
|
28
|
+
resizingContainerRef: isSheet ? undefined : resizingContainerRef,
|
|
29
|
+
parentContainerRef: actionsAreaRef,
|
|
30
|
+
});
|
|
31
|
+
const droplistActions = isSheet ? actions : hiddenItems;
|
|
32
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.actionsArea, ref: actionsAreaRef, "data-variant": variant, "data-test-id": testIds_1.TEST_IDS.bulkActions, children: [showCheckbox && (0, jsx_runtime_1.jsx)(BulkActionsCheckbox_1.BulkActionsCheckbox, { checked: checked, indeterminate: indeterminate, onCheck: onCheck }), (0, jsx_runtime_1.jsx)("div", { className: isSheet ? styles_module_scss_1.default.sheetActions : styles_module_scss_1.default.bulkActions, children: visibleItems.map((action, visibleIndex) => {
|
|
33
|
+
const { label, icon: Icon, onClick, disabled, tooltip, 'data-test-id': testId } = action;
|
|
34
|
+
const actionIndex = (0, utils_2.getBulkActionIndex)(actions, action, visibleIndex);
|
|
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 })) }))] }));
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './BulkActionsControls';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./BulkActionsControls"), exports);
|
package/dist/cjs/helperComponents/BulkActions/components/BulkActionsControls/styles.module.css
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
.actionsArea{
|
|
2
|
+
display:flex;
|
|
3
|
+
flex:1 1 0;
|
|
4
|
+
gap:var(--sn-toolbar-anatomy-container-tool-bulkAction-gap, var(--sn-primitive-dimension-8, 8px));
|
|
5
|
+
align-items:center;
|
|
6
|
+
box-sizing:border-box;
|
|
7
|
+
width:100%;
|
|
8
|
+
min-width:0;
|
|
9
|
+
}
|
|
10
|
+
.actionsArea[data-variant=sheet]{
|
|
11
|
+
padding-left:var(--sn-toolbar-anatomy-container-tool-bulkAction-paddingLeft, var(--sn-primitive-dimension-4, 4px));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.bulkActions{
|
|
15
|
+
display:inline-flex;
|
|
16
|
+
flex-shrink:0;
|
|
17
|
+
gap:var(--sn-primitive-dimension-4, 4px);
|
|
18
|
+
align-items:center;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.moreActionButton{
|
|
22
|
+
flex-shrink:0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.action{
|
|
26
|
+
flex-shrink:0;
|
|
27
|
+
white-space:nowrap;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.sheetActions{
|
|
31
|
+
display:inline-flex;
|
|
32
|
+
flex-shrink:0;
|
|
33
|
+
gap:var(--sn-primitive-dimension-4, 4px);
|
|
34
|
+
align-items:center;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.triggerClassName{
|
|
38
|
+
display:inline-flex;
|
|
39
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BulkAction } from '../../types';
|
|
2
|
+
type MobileBulkActionsSheetProps = {
|
|
3
|
+
open: boolean;
|
|
4
|
+
actions: BulkAction[];
|
|
5
|
+
selectedCount: number;
|
|
6
|
+
totalCount?: number;
|
|
7
|
+
hasSelection: boolean;
|
|
8
|
+
checked?: boolean;
|
|
9
|
+
indeterminate?: boolean;
|
|
10
|
+
onCheck?(): void;
|
|
11
|
+
showBulkCheckbox?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare function MobileBulkActionsSheet({ open, actions, selectedCount, totalCount, hasSelection, checked, indeterminate, onCheck, showBulkCheckbox, }: MobileBulkActionsSheetProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MobileBulkActionsSheet = MobileBulkActionsSheet;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const bottom_sheet_1 = require("@cloud-ru/ds-bottom-sheet");
|
|
6
|
+
const portal_context_1 = require("@cloud-ru/ds-portal-context");
|
|
7
|
+
const theme_1 = require("@cloud-ru/ds-theme");
|
|
8
|
+
const utils_1 = require("@cloud-ru/ds-utils");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const locale_1 = require("../../../../locale");
|
|
11
|
+
const testIds_1 = require("../../../../testIds");
|
|
12
|
+
const BulkActionsControls_1 = require("../BulkActionsControls");
|
|
13
|
+
const SelectionLabel_1 = require("../SelectionLabel");
|
|
14
|
+
const CLOSE_STUB_CALLBACK = () => undefined;
|
|
15
|
+
function MobileBulkActionsSheet({ open, actions, selectedCount, totalCount, hasSelection, checked, indeterminate, onCheck, showBulkCheckbox, }) {
|
|
16
|
+
const { t } = locale_1.toolbarLocale.useTranslations();
|
|
17
|
+
const portalContext = (0, portal_context_1.usePortalContext)();
|
|
18
|
+
const [bottomSheetKey, setBottomSheetKey] = (0, react_1.useState)('notReady');
|
|
19
|
+
(0, utils_1.useLayoutEffect)(() => {
|
|
20
|
+
setBottomSheetKey('ready');
|
|
21
|
+
}, []);
|
|
22
|
+
// Фиксируем density, остальные оси (colorScheme/brand/…) наследуем из контекста темы.
|
|
23
|
+
const themeClassName = (0, theme_1.useThemeClassnames)({ density: 'comfort' });
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(bottom_sheet_1.BottomSheet, { className: themeClassName, container: portalContext.current ?? undefined, open: open, onClose: CLOSE_STUB_CALLBACK, title: t('multipleActions'),
|
|
25
|
+
// TODO: slotAfterTitle должен расширяться на всю ширину, а section-label уходить вправо
|
|
26
|
+
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, safeArea: false, withDividers: false, "data-test-id": testIds_1.TEST_IDS.mobileBulkActionsSheet }, bottomSheetKey));
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MobileBulkActionsSheet';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./MobileBulkActionsSheet"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type SelectionLabelProps = {
|
|
2
|
+
selectedCount: number;
|
|
3
|
+
totalCount?: number;
|
|
4
|
+
hasSelection: boolean;
|
|
5
|
+
className?: string;
|
|
6
|
+
placement?: 'inline' | 'headline';
|
|
7
|
+
};
|
|
8
|
+
export declare function SelectionLabel({ selectedCount, totalCount, hasSelection, className, placement, }: SelectionLabelProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SelectionLabel = SelectionLabel;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
9
|
+
const locale_1 = require("../../../../locale");
|
|
10
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
11
|
+
function SelectionLabel({ selectedCount, totalCount, hasSelection, className, placement = 'inline', }) {
|
|
12
|
+
const { t } = locale_1.toolbarLocale.useTranslations();
|
|
13
|
+
const valueLabel = hasSelection && totalCount != null
|
|
14
|
+
? t('selectedCountOf', { count: selectedCount, total: totalCount })
|
|
15
|
+
: t('selectedCount', { count: selectedCount });
|
|
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 })] }));
|
|
17
|
+
if (placement === 'headline') {
|
|
18
|
+
return (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.headlinePlacement, children: label });
|
|
19
|
+
}
|
|
20
|
+
return label;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SelectionLabel';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./SelectionLabel"), exports);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
.selectionLabel{
|
|
2
|
+
display:inline-flex;
|
|
3
|
+
flex-shrink:0;
|
|
4
|
+
gap:var(--sn-chip-anatomy-size-s-container-textWrapper-gap, var(--sn-density-spacing-control-wrapper-horizontal-s, var(--sn-primitive-dimension-8, 8px)));
|
|
5
|
+
align-items:center;
|
|
6
|
+
padding-inline:var(--sn-chip-anatomy-size-s-container-textWrapper-paddingHorizontal, var(--sn-density-spacing-control-wrapper-horizontal-s, var(--sn-primitive-dimension-8, 8px)));
|
|
7
|
+
white-space:nowrap;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.selectionLabelPrefix{
|
|
11
|
+
font-family:var(--sn-thin-label-m-fontFamily, var(--sn-brand-font-fontFamily-thin-label, var(--sn-primitive-fontFamily-brandA-sans, SB Sans Interface)));
|
|
12
|
+
font-weight:var(--sn-thin-label-m-fontWeight, var(--sn-theme-typography-fontWeight-thin-label-m, var(--sn-brand-font-fontWeight-light-thin-label-m, var(--sn-primitive-font-fontWeightValue-450, 450))));
|
|
13
|
+
line-height:var(--sn-thin-label-m-lineHeight, var(--sn-density-typography-roleLabel-lineHeightM, var(--sn-primitive-font-lineHeight-by16, 24px)));
|
|
14
|
+
font-size:var(--sn-thin-label-m-fontSize, var(--sn-density-typography-roleLabel-fontSizeM, var(--sn-primitive-font-fontSize-16, 16px)));
|
|
15
|
+
letter-spacing:var(--sn-thin-label-m-letterSpacing, var(--sn-primitive-font-letterSpacing-s, 0px));
|
|
16
|
+
paragraph-spacing:var(--sn-thin-label-m-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize12, 6px));
|
|
17
|
+
color:var(--sn-theme-color-available-version-textDisabled, var(--sn-brand-color-text-version-disabled, rgba(65, 66, 78, 0.3490196078)));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.selectionLabelValue{
|
|
21
|
+
font-family:var(--sn-regular-body-s-fontFamily, var(--sn-brand-font-fontFamily-regular-body, var(--sn-primitive-fontFamily-brandA-sans, SB Sans Interface)));
|
|
22
|
+
font-weight:var(--sn-regular-body-s-fontWeight, var(--sn-theme-typography-fontWeight-regular-body-s, var(--sn-brand-font-fontWeight-light-regular-body-s, var(--sn-primitive-font-fontWeightValue-400, 400))));
|
|
23
|
+
line-height:var(--sn-regular-body-s-lineHeight, var(--sn-density-typography-roleBody-lineHeightS, var(--sn-primitive-font-lineHeight-by14, 20px)));
|
|
24
|
+
font-size:var(--sn-regular-body-s-fontSize, var(--sn-density-typography-roleBody-fontSizeS, var(--sn-primitive-font-fontSize-14, 14px)));
|
|
25
|
+
letter-spacing:var(--sn-regular-body-s-letterSpacing, var(--sn-primitive-font-letterSpacing-m, 0.1px));
|
|
26
|
+
paragraph-spacing:var(--sn-regular-body-s-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize12, 6px));
|
|
27
|
+
color:var(--sn-theme-color-available-version-textTertiary, var(--sn-brand-color-text-version-tertiary, rgba(65, 66, 78, 0.5490196078)));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.selectionLabel:not([data-has-selection]) .selectionLabelValue{
|
|
31
|
+
color:var(--sn-theme-color-available-version-textDisabled, var(--sn-brand-color-text-version-disabled, rgba(65, 66, 78, 0.3490196078)));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.headlinePlacement{
|
|
35
|
+
display:flex;
|
|
36
|
+
flex:1 1 auto;
|
|
37
|
+
justify-content:flex-end;
|
|
38
|
+
width:100%;
|
|
39
|
+
min-width:0;
|
|
40
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./BulkActionsCheckbox"), exports);
|
|
18
|
+
__exportStar(require("./BulkActionsControls"), exports);
|
|
19
|
+
__exportStar(require("./MobileBulkActionsSheet"), exports);
|
|
20
|
+
__exportStar(require("./SelectionLabel"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./BulkActions"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
.bulkTool{
|
|
2
|
+
display:flex;
|
|
3
|
+
gap:var(--sn-toolbar-anatomy-container-tool-bulkAction-gap, var(--sn-primitive-dimension-8, 8px));
|
|
4
|
+
align-items:center;
|
|
5
|
+
box-sizing:border-box;
|
|
6
|
+
width:100%;
|
|
7
|
+
min-height:var(--sn-primitive-dimension-24, 24px);
|
|
8
|
+
padding-left:var(--sn-toolbar-anatomy-container-tool-bulkAction-paddingLeft, var(--sn-primitive-dimension-4, 4px));
|
|
9
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { TooltipProps } from '@cloud-ru/ds-tooltip';
|
|
2
|
+
import { WithSupportProps } from '@cloud-ru/ds-utils';
|
|
3
|
+
import { JSXElementConstructor, RefObject } from 'react';
|
|
4
|
+
export type BulkAction = WithSupportProps<{
|
|
5
|
+
label: string;
|
|
6
|
+
icon: JSXElementConstructor<{
|
|
7
|
+
className?: string;
|
|
8
|
+
}>;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
tooltip?: TooltipProps['tip'];
|
|
11
|
+
onClick?(): void;
|
|
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
|
+
export type BulkActionsComponentProps = BulkActionsProps & {
|
|
30
|
+
resizingContainerRef?: RefObject<HTMLDivElement>;
|
|
31
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { BulkAction } from './types';
|
|
3
|
+
export declare function getBulkActionKey(action: BulkAction, index: number): string;
|
|
4
|
+
export declare function getBulkActionIndex(actions: BulkAction[], action: BulkAction, fallbackIndex: number): number;
|
|
5
|
+
export declare function mapBulkActionToDroplistItem(action: BulkAction, index: number): {
|
|
6
|
+
id: string;
|
|
7
|
+
content: {
|
|
8
|
+
label: string;
|
|
9
|
+
};
|
|
10
|
+
beforeContent: import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
onClick: (() => void) | undefined;
|
|
12
|
+
disabled: boolean | undefined;
|
|
13
|
+
itemWrapRender: (item: ReactNode) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
'data-test-id': string | undefined;
|
|
15
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBulkActionKey = getBulkActionKey;
|
|
4
|
+
exports.getBulkActionIndex = getBulkActionIndex;
|
|
5
|
+
exports.mapBulkActionToDroplistItem = mapBulkActionToDroplistItem;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const tooltip_1 = require("@cloud-ru/ds-tooltip");
|
|
8
|
+
function getBulkActionKey(action, index) {
|
|
9
|
+
return action['data-test-id'] ?? `bulk-action__${index}`;
|
|
10
|
+
}
|
|
11
|
+
function getBulkActionIndex(actions, action, fallbackIndex) {
|
|
12
|
+
const index = actions.indexOf(action);
|
|
13
|
+
return index >= 0 ? index : fallbackIndex;
|
|
14
|
+
}
|
|
15
|
+
function mapBulkActionToDroplistItem(action, index) {
|
|
16
|
+
const { label, icon: Icon, onClick, disabled, tooltip, 'data-test-id': testId } = action;
|
|
17
|
+
return {
|
|
18
|
+
id: getBulkActionKey(action, index),
|
|
19
|
+
content: { label },
|
|
20
|
+
beforeContent: (0, jsx_runtime_1.jsx)(Icon, {}),
|
|
21
|
+
onClick,
|
|
22
|
+
disabled,
|
|
23
|
+
itemWrapRender: (item) => ((0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { tip: tooltip, open: tooltip ? undefined : false, placement: 'right', "data-test-id": `${testId}-tooltip`, children: item })),
|
|
24
|
+
'data-test-id': testId,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataView = DataView;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const segment_control_1 = require("@cloud-ru/ds-segment-control");
|
|
6
|
+
const constants_1 = require("./constants");
|
|
7
|
+
function DataView({ value, defaultValue = constants_1.DATA_VIEW_VALUE.List, onChange, items = constants_1.DEFAULT_ITEMS, }) {
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)(segment_control_1.SegmentControl, { outline: false, size: segment_control_1.SIZE.M, value: value, defaultValue: defaultValue, onChange: onChange, items: items }));
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type SegmentControlProps } from '@cloud-ru/ds-segment-control';
|
|
2
|
+
import { ValueOf } from '@cloud-ru/ds-utils';
|
|
3
|
+
export declare const DATA_VIEW_VALUE: {
|
|
4
|
+
readonly List: "list";
|
|
5
|
+
readonly Compact: "compact";
|
|
6
|
+
};
|
|
7
|
+
type DataViewValue = ValueOf<typeof DATA_VIEW_VALUE>;
|
|
8
|
+
export declare const DEFAULT_ITEMS: SegmentControlProps<DataViewValue>['items'];
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_ITEMS = exports.DATA_VIEW_VALUE = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const product_1 = require("@cloud-ru/ds-icons/interface/product");
|
|
6
|
+
exports.DATA_VIEW_VALUE = {
|
|
7
|
+
List: 'list',
|
|
8
|
+
Compact: 'compact',
|
|
9
|
+
};
|
|
10
|
+
exports.DEFAULT_ITEMS = [
|
|
11
|
+
{ value: exports.DATA_VIEW_VALUE.List, label: '', icon: (0, jsx_runtime_1.jsx)(product_1.ViewTableSVG, {}) },
|
|
12
|
+
{ value: exports.DATA_VIEW_VALUE.Compact, label: '', icon: (0, jsx_runtime_1.jsx)(product_1.ViewCardSVG, {}) },
|
|
13
|
+
];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./DataView"), exports);
|
|
18
|
+
__exportStar(require("./constants"), exports);
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type SegmentControlProps } from '@cloud-ru/ds-segment-control';
|
|
2
|
+
import { ValueOf, WithSupportProps } from '@cloud-ru/ds-utils';
|
|
3
|
+
import { DATA_VIEW_VALUE } from './constants';
|
|
4
|
+
export type DataViewValue = ValueOf<typeof DATA_VIEW_VALUE>;
|
|
5
|
+
type DataViewBaseProps = {
|
|
6
|
+
value?: DataViewValue;
|
|
7
|
+
defaultValue?: DataViewValue;
|
|
8
|
+
onChange?(value: DataViewValue): void;
|
|
9
|
+
items?: SegmentControlProps<DataViewValue>['items'];
|
|
10
|
+
};
|
|
11
|
+
export type DataViewProps = WithSupportProps<DataViewBaseProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { WithSupportProps } from '@cloud-ru/ds-utils';
|
|
2
|
+
type FilterButtonBaseProps = {
|
|
3
|
+
/** Открыта ли строка фильтров */
|
|
4
|
+
open: boolean;
|
|
5
|
+
/** Колбек смены состояния открытия строки фильтров */
|
|
6
|
+
onOpenChange(open: boolean): void;
|
|
7
|
+
/** Количество активных фильтров для отображения в counter */
|
|
8
|
+
numberOfFilters?: number;
|
|
9
|
+
};
|
|
10
|
+
export type FilterButtonProps = WithSupportProps<FilterButtonBaseProps>;
|
|
11
|
+
export declare function FilterButton({ open, onOpenChange, numberOfFilters }: FilterButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FilterButton = FilterButton;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const button_1 = require("@cloud-ru/ds-button");
|
|
9
|
+
const system_1 = require("@cloud-ru/ds-icons/interface/system");
|
|
10
|
+
const tooltip_1 = require("@cloud-ru/ds-tooltip");
|
|
11
|
+
const locale_1 = require("../../locale");
|
|
12
|
+
const testIds_1 = require("../../testIds");
|
|
13
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
14
|
+
function FilterButton({ open, onOpenChange, numberOfFilters }) {
|
|
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 }) }));
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FilterButton';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./FilterButton"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseItem } from '@cloud-ru/ds-list';
|
|
2
|
+
import { WithSupportProps } from '@cloud-ru/ds-utils';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
export type Action = {
|
|
5
|
+
tagLabel?: string;
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
'data-test-id'?: string;
|
|
8
|
+
} & Pick<BaseItem, 'content' | 'disabled' | 'onClick'>;
|
|
9
|
+
export type MoreActionsProps = WithSupportProps<{
|
|
10
|
+
/** Элементы выпадающего списка кнопки с действиями */
|
|
11
|
+
moreActions: Action[];
|
|
12
|
+
}>;
|
|
13
|
+
export declare function MoreActions({ moreActions, 'data-test-id': dataTestId, ...rest }: MoreActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MoreActions = MoreActions;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const button_1 = require("@cloud-ru/ds-button");
|
|
9
|
+
const system_1 = require("@cloud-ru/ds-icons/interface/system");
|
|
10
|
+
const list_1 = require("@cloud-ru/ds-list");
|
|
11
|
+
const tag_1 = require("@cloud-ru/ds-tag");
|
|
12
|
+
const utils_1 = require("@cloud-ru/ds-utils");
|
|
13
|
+
const react_1 = require("react");
|
|
14
|
+
const testIds_1 = require("../../testIds");
|
|
15
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
16
|
+
function MoreActions({ moreActions, 'data-test-id': dataTestId, ...rest }) {
|
|
17
|
+
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
18
|
+
const supportProps = (0, utils_1.extractSupportProps)(rest);
|
|
19
|
+
const triggerRef = (0, react_1.useRef)(null);
|
|
20
|
+
function mapMoreActionToDroplistItem(item) {
|
|
21
|
+
return {
|
|
22
|
+
onClick: (event) => {
|
|
23
|
+
item.onClick?.(event);
|
|
24
|
+
setIsOpen(false);
|
|
25
|
+
event.stopPropagation();
|
|
26
|
+
},
|
|
27
|
+
disabled: item.disabled,
|
|
28
|
+
content: item.content,
|
|
29
|
+
beforeContent: item.icon,
|
|
30
|
+
afterContent: item.tagLabel ? (0, jsx_runtime_1.jsx)(tag_1.Tag, { label: item.tagLabel }) : undefined,
|
|
31
|
+
'data-test-id': item['data-test-id'] ?? testIds_1.TEST_IDS.option,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)(list_1.Droplist, { triggerClassName: styles_module_scss_1.default.trigger, trigger: 'clickAndFocusVisible', open: isOpen, ...supportProps, "data-test-id": dataTestId ?? testIds_1.TEST_IDS.droplist, onOpenChange: setIsOpen, placement: 'bottom-end', scroll: true, size: 'm', items: moreActions.map(mapMoreActionToDroplistItem), triggerElemRef: triggerRef, children: ({ onKeyDown }) => ((0, jsx_runtime_1.jsx)(button_1.Button, { view: 'function', appearance: 'neutral', icon: (0, jsx_runtime_1.jsx)(system_1.KebabSVG, {}), size: 'm', "data-test-id": testIds_1.TEST_IDS.moreActionsButton, innerRef: triggerRef, onKeyDown: onKeyDown })) }));
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MoreActions';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./MoreActions"), exports);
|