@snack-uikit/toolbar 0.9.18 → 0.10.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 +11 -0
- package/README.md +2 -3
- package/dist/cjs/components/Toolbar/Toolbar.d.ts +1 -1
- package/dist/cjs/components/Toolbar/Toolbar.js +10 -10
- package/dist/cjs/components/Toolbar/helpers.d.ts +4 -4
- package/dist/cjs/components/Toolbar/helpers.js +7 -7
- package/dist/cjs/components/Toolbar/styles.module.css +11 -0
- package/dist/cjs/components/Toolbar/types.d.ts +7 -5
- package/dist/cjs/constants.d.ts +7 -2
- package/dist/cjs/constants.js +7 -2
- package/dist/cjs/helperComponents/BulkActions/BulkActions.d.ts +5 -0
- package/dist/cjs/helperComponents/BulkActions/BulkActions.js +131 -0
- package/dist/cjs/helperComponents/{DeleteAction → BulkActions}/index.d.ts +1 -1
- package/dist/cjs/helperComponents/{DeleteAction → BulkActions}/index.js +1 -1
- package/dist/{esm/helperComponents/DeleteAction → cjs/helperComponents/BulkActions}/styles.module.css +26 -0
- package/dist/cjs/helperComponents/BulkActions/types.d.ts +26 -0
- package/dist/cjs/helperComponents/Separator/Separator.js +5 -2
- package/dist/cjs/helperComponents/Separator/styles.module.css +7 -2
- package/dist/cjs/helperComponents/index.d.ts +1 -1
- package/dist/cjs/helperComponents/index.js +1 -1
- package/dist/esm/components/Toolbar/Toolbar.d.ts +1 -1
- package/dist/esm/components/Toolbar/Toolbar.js +8 -6
- package/dist/esm/components/Toolbar/helpers.d.ts +4 -4
- package/dist/esm/components/Toolbar/helpers.js +8 -10
- package/dist/esm/components/Toolbar/styles.module.css +11 -0
- package/dist/esm/components/Toolbar/types.d.ts +7 -5
- package/dist/esm/constants.d.ts +7 -2
- package/dist/esm/constants.js +7 -2
- package/dist/esm/helperComponents/BulkActions/BulkActions.d.ts +5 -0
- package/dist/esm/helperComponents/BulkActions/BulkActions.js +34 -0
- package/dist/esm/helperComponents/{DeleteAction → BulkActions}/index.d.ts +1 -1
- package/dist/esm/helperComponents/{DeleteAction → BulkActions}/index.js +1 -1
- package/dist/{cjs/helperComponents/DeleteAction → esm/helperComponents/BulkActions}/styles.module.css +26 -0
- package/dist/esm/helperComponents/BulkActions/types.d.ts +26 -0
- package/dist/esm/helperComponents/Separator/Separator.js +1 -1
- package/dist/esm/helperComponents/Separator/styles.module.css +7 -2
- package/dist/esm/helperComponents/index.d.ts +1 -1
- package/dist/esm/helperComponents/index.js +1 -1
- package/package.json +10 -9
- package/src/components/Toolbar/Toolbar.tsx +17 -14
- package/src/components/Toolbar/helpers.ts +11 -13
- package/src/components/Toolbar/styles.module.scss +18 -9
- package/src/components/Toolbar/types.ts +8 -5
- package/src/constants.ts +7 -2
- package/src/helperComponents/BulkActions/BulkActions.tsx +118 -0
- package/src/helperComponents/{DeleteAction → BulkActions}/index.ts +1 -1
- package/src/helperComponents/BulkActions/styles.module.scss +55 -0
- package/src/helperComponents/BulkActions/types.ts +29 -0
- package/src/helperComponents/Separator/Separator.tsx +5 -1
- package/src/helperComponents/Separator/styles.module.scss +10 -6
- package/src/helperComponents/index.ts +1 -1
- package/dist/cjs/helperComponents/DeleteAction/DeleteAction.d.ts +0 -14
- package/dist/cjs/helperComponents/DeleteAction/DeleteAction.js +0 -56
- package/dist/cjs/helperComponents/DeleteAction/types.d.ts +0 -3
- package/dist/esm/helperComponents/DeleteAction/DeleteAction.d.ts +0 -14
- package/dist/esm/helperComponents/DeleteAction/DeleteAction.js +0 -16
- package/dist/esm/helperComponents/DeleteAction/types.d.ts +0 -3
- package/src/helperComponents/DeleteAction/DeleteAction.tsx +0 -68
- package/src/helperComponents/DeleteAction/styles.module.scss +0 -24
- package/src/helperComponents/DeleteAction/types.ts +0 -5
- /package/dist/cjs/helperComponents/{DeleteAction → BulkActions}/constants.d.ts +0 -0
- /package/dist/cjs/helperComponents/{DeleteAction → BulkActions}/constants.js +0 -0
- /package/dist/cjs/helperComponents/{DeleteAction → BulkActions}/types.js +0 -0
- /package/dist/esm/helperComponents/{DeleteAction → BulkActions}/constants.d.ts +0 -0
- /package/dist/esm/helperComponents/{DeleteAction → BulkActions}/constants.js +0 -0
- /package/dist/esm/helperComponents/{DeleteAction → BulkActions}/types.js +0 -0
- /package/src/helperComponents/{DeleteAction → BulkActions}/constants.ts +0 -0
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
@use '@snack-uikit/figma-tokens/build/scss/styles-
|
|
1
|
+
@use '@snack-uikit/figma-tokens/build/scss/components/styles-tokens-toolbar' as toolbar;
|
|
2
|
+
|
|
3
|
+
.separatorWrapper {
|
|
4
|
+
@include toolbar.composite-var(toolbar.$toolbar-separator-wrap);
|
|
2
5
|
|
|
3
|
-
.separator {
|
|
4
6
|
flex-shrink: 0;
|
|
7
|
+
}
|
|
5
8
|
|
|
6
|
-
box-sizing: border-box;
|
|
7
|
-
width: styles-theme-variables.$border-width-toolbar-separator;
|
|
8
|
-
margin: styles-theme-variables.$space-toolbar-separator-padding 0;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
.separator {
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
width: toolbar.$border-width-toolbar-separator;
|
|
13
|
+
height: 100%;
|
|
14
|
+
background-color: toolbar.$sys-neutral-decor-default;
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { SelectionMode } from './types';
|
|
2
|
-
export type DeleteActionProps = {
|
|
3
|
-
/** Колбек смены значения чекбокса*/
|
|
4
|
-
onCheck?(): void;
|
|
5
|
-
/** Колбек удаления */
|
|
6
|
-
onDelete?(): void;
|
|
7
|
-
/** Значения чекбокса*/
|
|
8
|
-
checked?: boolean;
|
|
9
|
-
/** Состояние частичного выбора */
|
|
10
|
-
indeterminate?: boolean;
|
|
11
|
-
/** Режим выбора @default 'multiple'*/
|
|
12
|
-
selectionMode?: SelectionMode;
|
|
13
|
-
};
|
|
14
|
-
export declare function DeleteAction({ checked, onCheck, onDelete, indeterminate, selectionMode, }: DeleteActionProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
4
|
-
return mod && mod.__esModule ? mod : {
|
|
5
|
-
"default": mod
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", {
|
|
9
|
-
value: true
|
|
10
|
-
});
|
|
11
|
-
exports.DeleteAction = DeleteAction;
|
|
12
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
13
|
-
const react_1 = require("react");
|
|
14
|
-
const button_1 = require("@snack-uikit/button");
|
|
15
|
-
const icons_1 = require("@snack-uikit/icons");
|
|
16
|
-
const toggles_1 = require("@snack-uikit/toggles");
|
|
17
|
-
const constants_1 = require("../../constants");
|
|
18
|
-
const constants_2 = require("./constants");
|
|
19
|
-
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
20
|
-
function DeleteAction(_ref) {
|
|
21
|
-
let {
|
|
22
|
-
checked,
|
|
23
|
-
onCheck,
|
|
24
|
-
onDelete,
|
|
25
|
-
indeterminate,
|
|
26
|
-
selectionMode = constants_2.SELECTION_MODE.Multiple
|
|
27
|
-
} = _ref;
|
|
28
|
-
const handleKeyDown = (0, react_1.useCallback)(e => {
|
|
29
|
-
if (e.key === ' ') {
|
|
30
|
-
onCheck === null || onCheck === void 0 ? void 0 : onCheck();
|
|
31
|
-
}
|
|
32
|
-
}, [onCheck]);
|
|
33
|
-
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, {
|
|
34
|
-
children: [selectionMode === constants_2.SELECTION_MODE.Multiple && (0, jsx_runtime_1.jsx)("div", {
|
|
35
|
-
className: styles_module_scss_1.default.checkboxWrapper,
|
|
36
|
-
onClick: onCheck,
|
|
37
|
-
tabIndex: 0,
|
|
38
|
-
role: 'checkbox',
|
|
39
|
-
"aria-checked": checked,
|
|
40
|
-
onKeyDown: handleKeyDown,
|
|
41
|
-
"data-test-id": constants_1.TEST_IDS.checkbox,
|
|
42
|
-
children: (0, jsx_runtime_1.jsx)(toggles_1.Checkbox, {
|
|
43
|
-
size: 's',
|
|
44
|
-
checked: checked,
|
|
45
|
-
indeterminate: indeterminate,
|
|
46
|
-
tabIndex: -1
|
|
47
|
-
})
|
|
48
|
-
}), onDelete && (0, jsx_runtime_1.jsx)(button_1.ButtonFunction, {
|
|
49
|
-
"data-test-id": constants_1.TEST_IDS.deleteButton,
|
|
50
|
-
icon: (0, jsx_runtime_1.jsx)(icons_1.TrashSVG, {}),
|
|
51
|
-
size: 'm',
|
|
52
|
-
onClick: onDelete,
|
|
53
|
-
disabled: !checked && !indeterminate
|
|
54
|
-
})]
|
|
55
|
-
});
|
|
56
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { SelectionMode } from './types';
|
|
2
|
-
export type DeleteActionProps = {
|
|
3
|
-
/** Колбек смены значения чекбокса*/
|
|
4
|
-
onCheck?(): void;
|
|
5
|
-
/** Колбек удаления */
|
|
6
|
-
onDelete?(): void;
|
|
7
|
-
/** Значения чекбокса*/
|
|
8
|
-
checked?: boolean;
|
|
9
|
-
/** Состояние частичного выбора */
|
|
10
|
-
indeterminate?: boolean;
|
|
11
|
-
/** Режим выбора @default 'multiple'*/
|
|
12
|
-
selectionMode?: SelectionMode;
|
|
13
|
-
};
|
|
14
|
-
export declare function DeleteAction({ checked, onCheck, onDelete, indeterminate, selectionMode, }: DeleteActionProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback } from 'react';
|
|
3
|
-
import { ButtonFunction } from '@snack-uikit/button';
|
|
4
|
-
import { TrashSVG } from '@snack-uikit/icons';
|
|
5
|
-
import { Checkbox } from '@snack-uikit/toggles';
|
|
6
|
-
import { TEST_IDS } from '../../constants';
|
|
7
|
-
import { SELECTION_MODE } from './constants';
|
|
8
|
-
import styles from './styles.module.css';
|
|
9
|
-
export function DeleteAction({ checked, onCheck, onDelete, indeterminate, selectionMode = SELECTION_MODE.Multiple, }) {
|
|
10
|
-
const handleKeyDown = useCallback((e) => {
|
|
11
|
-
if (e.key === ' ') {
|
|
12
|
-
onCheck === null || onCheck === void 0 ? void 0 : onCheck();
|
|
13
|
-
}
|
|
14
|
-
}, [onCheck]);
|
|
15
|
-
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 }) })), onDelete && (_jsx(ButtonFunction, { "data-test-id": TEST_IDS.deleteButton, icon: _jsx(TrashSVG, {}), size: 'm', onClick: onDelete, disabled: !checked && !indeterminate }))] }));
|
|
16
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { KeyboardEvent, useCallback } from 'react';
|
|
2
|
-
|
|
3
|
-
import { ButtonFunction } from '@snack-uikit/button';
|
|
4
|
-
import { TrashSVG } from '@snack-uikit/icons';
|
|
5
|
-
import { Checkbox } from '@snack-uikit/toggles';
|
|
6
|
-
|
|
7
|
-
import { TEST_IDS } from '../../constants';
|
|
8
|
-
import { SELECTION_MODE } from './constants';
|
|
9
|
-
import styles from './styles.module.scss';
|
|
10
|
-
import { SelectionMode } from './types';
|
|
11
|
-
|
|
12
|
-
export type DeleteActionProps = {
|
|
13
|
-
/** Колбек смены значения чекбокса*/
|
|
14
|
-
onCheck?(): void;
|
|
15
|
-
/** Колбек удаления */
|
|
16
|
-
onDelete?(): void;
|
|
17
|
-
/** Значения чекбокса*/
|
|
18
|
-
checked?: boolean;
|
|
19
|
-
/** Состояние частичного выбора */
|
|
20
|
-
indeterminate?: boolean;
|
|
21
|
-
/** Режим выбора @default 'multiple'*/
|
|
22
|
-
selectionMode?: SelectionMode;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export function DeleteAction({
|
|
26
|
-
checked,
|
|
27
|
-
onCheck,
|
|
28
|
-
onDelete,
|
|
29
|
-
indeterminate,
|
|
30
|
-
selectionMode = SELECTION_MODE.Multiple,
|
|
31
|
-
}: DeleteActionProps) {
|
|
32
|
-
const handleKeyDown = useCallback(
|
|
33
|
-
(e: KeyboardEvent<HTMLDivElement>) => {
|
|
34
|
-
if (e.key === ' ') {
|
|
35
|
-
onCheck?.();
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
[onCheck],
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<>
|
|
43
|
-
{selectionMode === SELECTION_MODE.Multiple && (
|
|
44
|
-
<div
|
|
45
|
-
className={styles.checkboxWrapper}
|
|
46
|
-
onClick={onCheck}
|
|
47
|
-
tabIndex={0}
|
|
48
|
-
role='checkbox'
|
|
49
|
-
aria-checked={checked}
|
|
50
|
-
onKeyDown={handleKeyDown}
|
|
51
|
-
data-test-id={TEST_IDS.checkbox}
|
|
52
|
-
>
|
|
53
|
-
<Checkbox size='s' checked={checked} indeterminate={indeterminate} tabIndex={-1} />
|
|
54
|
-
</div>
|
|
55
|
-
)}
|
|
56
|
-
|
|
57
|
-
{onDelete && (
|
|
58
|
-
<ButtonFunction
|
|
59
|
-
data-test-id={TEST_IDS.deleteButton}
|
|
60
|
-
icon={<TrashSVG />}
|
|
61
|
-
size='m'
|
|
62
|
-
onClick={onDelete}
|
|
63
|
-
disabled={!checked && !indeterminate}
|
|
64
|
-
/>
|
|
65
|
-
)}
|
|
66
|
-
</>
|
|
67
|
-
);
|
|
68
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
@use '@snack-uikit/figma-tokens/build/scss/components/styles-tokens-toolbar';
|
|
2
|
-
@use '@snack-uikit/figma-tokens/build/scss/components/styles-tokens-element';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
.checkboxWrapper {
|
|
6
|
-
@include styles-tokens-toolbar.composite-var(styles-tokens-toolbar.$toolbar-checkbox);
|
|
7
|
-
|
|
8
|
-
cursor: pointer;
|
|
9
|
-
|
|
10
|
-
position: relative;
|
|
11
|
-
|
|
12
|
-
display: flex;
|
|
13
|
-
flex-shrink: 0;
|
|
14
|
-
align-items: center;
|
|
15
|
-
justify-content: center;
|
|
16
|
-
|
|
17
|
-
box-sizing: border-box;
|
|
18
|
-
|
|
19
|
-
&:focus-visible {
|
|
20
|
-
@include styles-tokens-toolbar.outline-var(styles-tokens-element.$container-focused-s);
|
|
21
|
-
|
|
22
|
-
outline-color: styles-tokens-toolbar.$sys-available-complementary;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|