@snack-uikit/toolbar 0.11.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/cjs/components/Toolbar/helpers.js +1 -1
- package/dist/cjs/helperComponents/BulkActions/BulkActions.js +2 -2
- package/dist/cjs/helperComponents/BulkActions/types.d.ts +1 -1
- package/dist/esm/components/Toolbar/helpers.js +1 -5
- package/dist/esm/helperComponents/BulkActions/BulkActions.js +2 -2
- package/dist/esm/helperComponents/BulkActions/types.d.ts +1 -1
- package/package.json +2 -2
- package/src/components/Toolbar/helpers.ts +1 -7
- package/src/helperComponents/BulkActions/BulkActions.tsx +2 -2
- package/src/helperComponents/BulkActions/types.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 0.11.1 (2025-02-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **PDS-1081:** allow to show checkbox without bulk actions ([db193d9](https://github.com/cloud-ru-tech/snack-uikit/commit/db193d9fa9f8d679c1855db0f0d975d9f5704551))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# 0.11.0 (2025-02-05)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -22,5 +22,5 @@ function extractBulkActionsProps(_ref) {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
function isBulkActionsProps(props) {
|
|
25
|
-
return '
|
|
25
|
+
return 'selectionMode' in props && props.selectionMode === 'multiple';
|
|
26
26
|
}
|
|
@@ -22,7 +22,7 @@ const constants_2 = require("./constants");
|
|
|
22
22
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
23
23
|
function BulkActions(_ref) {
|
|
24
24
|
let {
|
|
25
|
-
actions,
|
|
25
|
+
actions = [],
|
|
26
26
|
checked,
|
|
27
27
|
onCheck,
|
|
28
28
|
indeterminate,
|
|
@@ -59,7 +59,7 @@ function BulkActions(_ref) {
|
|
|
59
59
|
indeterminate: indeterminate,
|
|
60
60
|
tabIndex: -1
|
|
61
61
|
})
|
|
62
|
-
}), (checked || indeterminate) && (0, jsx_runtime_1.jsxs)("div", {
|
|
62
|
+
}), (checked || indeterminate) && actions.length > 0 && (0, jsx_runtime_1.jsxs)("div", {
|
|
63
63
|
className: styles_module_scss_1.default.bulkActionsWrapper,
|
|
64
64
|
"data-test-id": constants_1.TEST_IDS.bulkActions,
|
|
65
65
|
ref: parentContainerRef,
|
|
@@ -14,7 +14,7 @@ export type BulkAction = WithSupportProps<{
|
|
|
14
14
|
}>;
|
|
15
15
|
export type BulkActionsProps = {
|
|
16
16
|
/** Список массовых действий */
|
|
17
|
-
actions
|
|
17
|
+
actions?: BulkAction[];
|
|
18
18
|
/** Колбек смены значения чекбокса */
|
|
19
19
|
onCheck?(): void;
|
|
20
20
|
/** Значение чекбокса */
|
|
@@ -2,9 +2,5 @@ export function extractBulkActionsProps({ onCheck, checked, indeterminate, bulkA
|
|
|
2
2
|
return { onCheck, checked, indeterminate, actions: bulkActions, selectionMode };
|
|
3
3
|
}
|
|
4
4
|
export function isBulkActionsProps(props) {
|
|
5
|
-
return
|
|
6
|
-
Array.isArray(props.bulkActions) &&
|
|
7
|
-
props.bulkActions.length > 0 &&
|
|
8
|
-
'selectionMode' in props &&
|
|
9
|
-
props.selectionMode === 'multiple');
|
|
5
|
+
return 'selectionMode' in props && props.selectionMode === 'multiple';
|
|
10
6
|
}
|
|
@@ -9,7 +9,7 @@ import { useDynamicList } from '@snack-uikit/utils';
|
|
|
9
9
|
import { TEST_IDS } from '../../constants';
|
|
10
10
|
import { SELECTION_MODE } from './constants';
|
|
11
11
|
import styles from './styles.module.css';
|
|
12
|
-
export function BulkActions({ actions, checked, onCheck, indeterminate, selectionMode = SELECTION_MODE.Multiple, resizingContainerRef, }) {
|
|
12
|
+
export function BulkActions({ actions = [], checked, onCheck, indeterminate, selectionMode = SELECTION_MODE.Multiple, resizingContainerRef, }) {
|
|
13
13
|
const handleKeyDown = useCallback((e) => {
|
|
14
14
|
if (e.key === ' ' || e.key === 'Enter') {
|
|
15
15
|
onCheck === null || onCheck === void 0 ? void 0 : onCheck();
|
|
@@ -22,7 +22,7 @@ export function BulkActions({ actions, checked, onCheck, indeterminate, selectio
|
|
|
22
22
|
parentContainerRef,
|
|
23
23
|
maxVisibleItems: 3,
|
|
24
24
|
});
|
|
25
|
-
return (_jsxs(_Fragment, { children: [selectionMode === SELECTION_MODE.Multiple && (_jsx("div", { className: styles.checkboxWrapper, onClick: onCheck, tabIndex: 0, role: 'checkbox', "aria-checked": checked, onKeyDown: handleKeyDown, "data-test-id": TEST_IDS.checkbox, children: _jsx(Checkbox, { size: 's', checked: checked, indeterminate: indeterminate, tabIndex: -1 }) })), (checked || indeterminate) && (_jsxs("div", { className: styles.bulkActionsWrapper, "data-test-id": TEST_IDS.bulkActions, ref: parentContainerRef, children: [_jsx("div", { className: styles.bulkActions, children: visibleItems.map(({ label, icon: Icon, onClick, disabled, tooltip, 'data-test-id': testId }) => (_jsx(Tooltip, { tip: tooltip, open: tooltip ? undefined : false, placement: 'top', "data-test-id": `${testId}-tooltip`, children: _jsx(ButtonFunction, { className: styles.action, fullWidth: true, "data-test-id": testId, iconPosition: 'before', icon: _jsx(Icon, {}), label: label, size: 'm', onClick: onClick, disabled: disabled }) }, label))) }), hiddenItems.length > 0 && (_jsx(Droplist, { trigger: 'clickAndFocusVisible', closeDroplistOnItemClick: true, items: hiddenItems.map(({ label, icon: Icon, onClick, disabled, tooltip, 'data-test-id': testId }) => ({
|
|
25
|
+
return (_jsxs(_Fragment, { children: [selectionMode === SELECTION_MODE.Multiple && (_jsx("div", { className: styles.checkboxWrapper, onClick: onCheck, tabIndex: 0, role: 'checkbox', "aria-checked": checked, onKeyDown: handleKeyDown, "data-test-id": TEST_IDS.checkbox, children: _jsx(Checkbox, { size: 's', checked: checked, indeterminate: indeterminate, tabIndex: -1 }) })), (checked || indeterminate) && actions.length > 0 && (_jsxs("div", { className: styles.bulkActionsWrapper, "data-test-id": TEST_IDS.bulkActions, ref: parentContainerRef, children: [_jsx("div", { className: styles.bulkActions, children: visibleItems.map(({ label, icon: Icon, onClick, disabled, tooltip, 'data-test-id': testId }) => (_jsx(Tooltip, { tip: tooltip, open: tooltip ? undefined : false, placement: 'top', "data-test-id": `${testId}-tooltip`, children: _jsx(ButtonFunction, { className: styles.action, fullWidth: true, "data-test-id": testId, iconPosition: 'before', icon: _jsx(Icon, {}), label: label, size: 'm', onClick: onClick, disabled: disabled }) }, label))) }), hiddenItems.length > 0 && (_jsx(Droplist, { trigger: 'clickAndFocusVisible', closeDroplistOnItemClick: true, items: hiddenItems.map(({ label, icon: Icon, onClick, disabled, tooltip, 'data-test-id': testId }) => ({
|
|
26
26
|
id: label,
|
|
27
27
|
content: { option: label },
|
|
28
28
|
beforeContent: _jsx(Icon, {}),
|
|
@@ -14,7 +14,7 @@ export type BulkAction = WithSupportProps<{
|
|
|
14
14
|
}>;
|
|
15
15
|
export type BulkActionsProps = {
|
|
16
16
|
/** Список массовых действий */
|
|
17
|
-
actions
|
|
17
|
+
actions?: BulkAction[];
|
|
18
18
|
/** Колбек смены значения чекбокса */
|
|
19
19
|
onCheck?(): void;
|
|
20
20
|
/** Значение чекбокса */
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Toolbar",
|
|
7
|
-
"version": "0.11.
|
|
7
|
+
"version": "0.11.1",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@snack-uikit/locale": "*"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "0afa3cfced84e6a6f01575f0d21e03912ce9043c"
|
|
55
55
|
}
|
|
@@ -16,11 +16,5 @@ export function extractBulkActionsProps({
|
|
|
16
16
|
export function isBulkActionsProps<TState extends FiltersState>(
|
|
17
17
|
props: Partial<ToolbarProps<TState>>,
|
|
18
18
|
): props is ToolbarBulkActionProps {
|
|
19
|
-
return
|
|
20
|
-
'bulkActions' in props &&
|
|
21
|
-
Array.isArray(props.bulkActions) &&
|
|
22
|
-
props.bulkActions.length > 0 &&
|
|
23
|
-
'selectionMode' in props &&
|
|
24
|
-
props.selectionMode === 'multiple'
|
|
25
|
-
);
|
|
19
|
+
return 'selectionMode' in props && props.selectionMode === 'multiple';
|
|
26
20
|
}
|
|
@@ -13,7 +13,7 @@ import styles from './styles.module.scss';
|
|
|
13
13
|
import { BulkActionsProps } from './types';
|
|
14
14
|
|
|
15
15
|
export function BulkActions({
|
|
16
|
-
actions,
|
|
16
|
+
actions = [],
|
|
17
17
|
checked,
|
|
18
18
|
onCheck,
|
|
19
19
|
indeterminate,
|
|
@@ -56,7 +56,7 @@ export function BulkActions({
|
|
|
56
56
|
</div>
|
|
57
57
|
)}
|
|
58
58
|
|
|
59
|
-
{(checked || indeterminate) && (
|
|
59
|
+
{(checked || indeterminate) && actions.length > 0 && (
|
|
60
60
|
<div className={styles.bulkActionsWrapper} data-test-id={TEST_IDS.bulkActions} ref={parentContainerRef}>
|
|
61
61
|
<div className={styles.bulkActions}>
|
|
62
62
|
{visibleItems.map(({ label, icon: Icon, onClick, disabled, tooltip, 'data-test-id': testId }) => (
|
|
@@ -17,7 +17,7 @@ export type BulkAction = WithSupportProps<{
|
|
|
17
17
|
|
|
18
18
|
export type BulkActionsProps = {
|
|
19
19
|
/** Список массовых действий */
|
|
20
|
-
actions
|
|
20
|
+
actions?: BulkAction[];
|
|
21
21
|
/** Колбек смены значения чекбокса */
|
|
22
22
|
onCheck?(): void;
|
|
23
23
|
/** Значение чекбокса */
|