@astral/ui 0.33.0 → 0.34.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/ActionCell/ActionCell.d.ts +69 -0
- package/ActionCell/ActionCell.js +51 -0
- package/ActionCell/index.d.ts +1 -0
- package/ActionCell/index.js +13 -0
- package/ActionCell/styles.d.ts +5 -0
- package/ActionCell/styles.js +10 -0
- package/Badge/styled.d.ts +3 -21
- package/DataGrid/DataGridHead/DataGridHead.js +1 -1
- package/DatePicker/DatePickerHeader/styled.js +1 -1
- package/IconDropdownButton/IconDropdownButton.js +2 -2
- package/Tooltip/Tooltip.d.ts +1 -1
- package/esm/ActionCell/ActionCell.d.ts +69 -0
- package/esm/ActionCell/ActionCell.js +47 -0
- package/esm/ActionCell/index.d.ts +1 -0
- package/esm/ActionCell/index.js +1 -0
- package/esm/ActionCell/styles.d.ts +5 -0
- package/esm/ActionCell/styles.js +7 -0
- package/esm/Badge/styled.d.ts +3 -21
- package/esm/DataGrid/DataGridHead/DataGridHead.js +1 -1
- package/esm/DatePicker/DatePickerHeader/styled.js +1 -1
- package/esm/IconDropdownButton/IconDropdownButton.js +2 -2
- package/esm/Tooltip/Tooltip.d.ts +1 -1
- package/esm/hooks/useMenu.d.ts +2 -2
- package/esm/hooks/useMenu.js +13 -2
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/hooks/useMenu.d.ts +2 -2
- package/hooks/useMenu.js +12 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export declare type NestedAction<T> = {
|
|
3
|
+
/**
|
|
4
|
+
* Обработчик действия
|
|
5
|
+
*/
|
|
6
|
+
onClick: (row: T) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Название действия
|
|
9
|
+
*/
|
|
10
|
+
name: string;
|
|
11
|
+
};
|
|
12
|
+
export declare type SingleAction<T> = {
|
|
13
|
+
/**
|
|
14
|
+
* Иконка действия
|
|
15
|
+
*/
|
|
16
|
+
icon?: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Обработчик действия
|
|
19
|
+
*/
|
|
20
|
+
onClick: (row: T) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Название действия
|
|
23
|
+
*/
|
|
24
|
+
name: string;
|
|
25
|
+
/**
|
|
26
|
+
* Флаг показа выпадающего списка при клике
|
|
27
|
+
*/
|
|
28
|
+
nested?: false;
|
|
29
|
+
};
|
|
30
|
+
export declare type MultipleAction<T> = {
|
|
31
|
+
/**
|
|
32
|
+
* Иконка действия
|
|
33
|
+
*/
|
|
34
|
+
icon: ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* Список действий для выпадающего списка
|
|
37
|
+
*/
|
|
38
|
+
actions: Array<NestedAction<T>>;
|
|
39
|
+
/**
|
|
40
|
+
* Флаг показа выпадающего списка при клике
|
|
41
|
+
*/
|
|
42
|
+
nested: true;
|
|
43
|
+
/**
|
|
44
|
+
* Название действия
|
|
45
|
+
*/
|
|
46
|
+
name: string;
|
|
47
|
+
};
|
|
48
|
+
export declare type MainAction<T> = SingleAction<T> | MultipleAction<T>;
|
|
49
|
+
export declare type Actions<T> = {
|
|
50
|
+
/**
|
|
51
|
+
* Основные действия
|
|
52
|
+
*/
|
|
53
|
+
main: MainAction<T>[];
|
|
54
|
+
/**
|
|
55
|
+
* Второстепенные действия
|
|
56
|
+
*/
|
|
57
|
+
secondary?: SingleAction<T>[];
|
|
58
|
+
};
|
|
59
|
+
export declare type ActionsCellProps<T> = {
|
|
60
|
+
/**
|
|
61
|
+
* Действия
|
|
62
|
+
*/
|
|
63
|
+
actions: Actions<T>;
|
|
64
|
+
/**
|
|
65
|
+
* Данные строки из DataGrid
|
|
66
|
+
*/
|
|
67
|
+
row: T;
|
|
68
|
+
};
|
|
69
|
+
export declare function ActionCell<T>({ actions: { main, secondary }, row, }: ActionsCellProps<T>): JSX.Element;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.ActionCell = void 0;
|
|
15
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
var icons_1 = require("@astral/icons");
|
|
17
|
+
var react_1 = require("react");
|
|
18
|
+
var IconButton_1 = require("../IconButton");
|
|
19
|
+
var IconDropdownButton_1 = require("../IconDropdownButton");
|
|
20
|
+
var MenuItem_1 = require("../MenuItem");
|
|
21
|
+
var Tooltip_1 = require("../Tooltip");
|
|
22
|
+
var styles_1 = require("./styles");
|
|
23
|
+
function ActionCell(_a) {
|
|
24
|
+
var _b = _a.actions, _c = _b.main, main = _c === void 0 ? [] : _c, _d = _b.secondary, secondary = _d === void 0 ? [] : _d, row = _a.row;
|
|
25
|
+
var handleActionClick = function (onClick) {
|
|
26
|
+
return function () {
|
|
27
|
+
onClick(row);
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
var renderMainAction = (0, react_1.useCallback)(function (action) {
|
|
31
|
+
if (action.nested) {
|
|
32
|
+
var name_1 = action.name, actions = action.actions, icon_1 = action.icon;
|
|
33
|
+
return ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, __assign({ title: name_1 }, { children: (0, jsx_runtime_1.jsx)(IconDropdownButton_1.IconDropdownButton, __assign({ icon: icon_1, variant: "text" }, { children: actions.map(function (_a) {
|
|
34
|
+
var nestedActionName = _a.name, onClick = _a.onClick;
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)(MenuItem_1.MenuItem, __assign({ onClick: handleActionClick(onClick) }, { children: nestedActionName }), nestedActionName));
|
|
36
|
+
}) }), void 0) }), name_1));
|
|
37
|
+
}
|
|
38
|
+
var onClick = action.onClick, name = action.name, icon = action.icon;
|
|
39
|
+
return ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, __assign({ title: name }, { children: (0, jsx_runtime_1.jsx)(IconButton_1.IconButton, __assign({ variant: "text", onClick: handleActionClick(onClick) }, { children: icon }), void 0) }), name));
|
|
40
|
+
}, [handleActionClick]);
|
|
41
|
+
var renderSecondaryActions = (0, react_1.useMemo)(function () {
|
|
42
|
+
if (!Boolean(secondary.length))
|
|
43
|
+
return null;
|
|
44
|
+
return ((0, jsx_runtime_1.jsx)(IconDropdownButton_1.IconDropdownButton, __assign({ icon: (0, jsx_runtime_1.jsx)(icons_1.DotsVOutlineMd, {}, void 0), variant: "text" }, { children: secondary.map(function (_a) {
|
|
45
|
+
var name = _a.name, onClick = _a.onClick;
|
|
46
|
+
return ((0, jsx_runtime_1.jsx)(MenuItem_1.MenuItem, __assign({ onClick: handleActionClick(onClick) }, { children: name }), name));
|
|
47
|
+
}) }), void 0));
|
|
48
|
+
}, [secondary, handleActionClick]);
|
|
49
|
+
return ((0, jsx_runtime_1.jsxs)(styles_1.ActionCellWrapper, { children: [main.map(function (action) { return renderMainAction(action); }), renderSecondaryActions] }, void 0));
|
|
50
|
+
}
|
|
51
|
+
exports.ActionCell = ActionCell;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ActionCell';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./ActionCell"), exports);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const ActionCellWrapper: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any> | undefined;
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ActionCellWrapper = void 0;
|
|
8
|
+
var styles_1 = require("../styles");
|
|
9
|
+
exports.ActionCellWrapper = styles_1.styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n"], ["\n display: flex;\n align-items: center;\n"])));
|
|
10
|
+
var templateObject_1;
|
package/Badge/styled.d.ts
CHANGED
|
@@ -1,30 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BadgeColor, BadgeProps } from './types';
|
|
3
3
|
export declare const StyledBadge: import("@emotion/styled").StyledComponent<{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
colorError?: string | undefined;
|
|
8
|
-
colorInfo?: string | undefined;
|
|
9
|
-
colorSuccess?: string | undefined;
|
|
10
|
-
colorWarning?: string | undefined;
|
|
11
|
-
anchorOriginTopRightRectangular?: string | undefined;
|
|
12
|
-
anchorOriginBottomRightRectangular?: string | undefined;
|
|
13
|
-
anchorOriginTopLeftRectangular?: string | undefined;
|
|
14
|
-
anchorOriginBottomLeftRectangular?: string | undefined;
|
|
15
|
-
anchorOriginTopRightCircular?: string | undefined;
|
|
16
|
-
anchorOriginBottomRightCircular?: string | undefined;
|
|
17
|
-
anchorOriginTopLeftCircular?: string | undefined;
|
|
18
|
-
anchorOriginBottomLeftCircular?: string | undefined;
|
|
19
|
-
overlapRectangular?: string | undefined;
|
|
20
|
-
overlapCircular?: string | undefined;
|
|
21
|
-
}) | undefined;
|
|
4
|
+
anchorOrigin?: import("@mui/material").BadgeOrigin | undefined;
|
|
5
|
+
classes?: Partial<import("@mui/material").BadgeClasses> | undefined;
|
|
6
|
+
className?: string | undefined;
|
|
22
7
|
color?: "primary" | "secondary" | "default" | "error" | "success" | "warning" | "info" | undefined;
|
|
23
8
|
overlap?: "circular" | "rectangular" | undefined;
|
|
24
9
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
25
10
|
variant?: "dot" | "standard" | undefined;
|
|
26
11
|
} & {
|
|
27
|
-
anchorOrigin?: import("@mui/base").BadgeOrigin | undefined;
|
|
28
12
|
components?: {
|
|
29
13
|
Root?: import("react").ElementType<any> | undefined;
|
|
30
14
|
Badge?: import("react").ElementType<any> | undefined;
|
|
@@ -35,11 +19,9 @@ export declare const StyledBadge: import("@emotion/styled").StyledComponent<{
|
|
|
35
19
|
} | undefined;
|
|
36
20
|
badgeContent?: import("react").ReactNode;
|
|
37
21
|
children?: import("react").ReactNode;
|
|
38
|
-
classes?: Partial<import("@mui/base").BadgeUnstyledClasses> | undefined;
|
|
39
22
|
invisible?: boolean | undefined;
|
|
40
23
|
max?: number | undefined;
|
|
41
24
|
showZero?: boolean | undefined;
|
|
42
|
-
variant?: string | undefined;
|
|
43
25
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "tabIndex" | "children" | "className" | "slot" | "style" | "title" | "key" | "css" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & {
|
|
44
26
|
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
45
27
|
}, "components" | "children" | "componentsProps" | "color" | "variant" | keyof import("@mui/material/OverridableComponent").CommonProps | "sx" | "invisible" | "anchorOrigin" | "overlap" | "badgeContent" | "max" | "showZero"> & {
|
|
@@ -63,7 +63,7 @@ function DataGridHead(_a) {
|
|
|
63
63
|
var renderColumns = (0, react_1.useMemo)(function () {
|
|
64
64
|
return columns.map(function (_a) {
|
|
65
65
|
var field = _a.field, label = _a.label, sortable = _a.sortable, align = _a.align, renderCell = _a.renderCell;
|
|
66
|
-
return ((0, jsx_runtime_1.jsx)(DataGridHeadColumn_1.DataGridHeadColumn, { sorting: sorting, renderCell: renderCell, field: field, onSort: handleSort, label: label, sortable: sortable, align: align },
|
|
66
|
+
return ((0, jsx_runtime_1.jsx)(DataGridHeadColumn_1.DataGridHeadColumn, { sorting: sorting, renderCell: renderCell, field: field, onSort: handleSort, label: label, sortable: sortable, align: align }, field));
|
|
67
67
|
});
|
|
68
68
|
}, [columns, handleSort, sorting]);
|
|
69
69
|
return ((0, jsx_runtime_1.jsx)(TableHead_1.TableHead, { children: (0, jsx_runtime_1.jsxs)(Table_1.TableRow, { children: [selectable && ((0, jsx_runtime_1.jsx)(Table_1.TableCell, __assign({ padding: "checkbox" }, { children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: checked, indeterminate: indeterminate, onChange: onSelectAllRows }, void 0) }), void 0)), renderColumns] }, void 0) }, void 0));
|
|
@@ -7,6 +7,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.DatePickerHeaderTitle = exports.DatePickerHeaderWrapper = void 0;
|
|
8
8
|
var styles_1 = require("../../styles");
|
|
9
9
|
var Typography_1 = require("../../Typography");
|
|
10
|
-
exports.DatePickerHeaderWrapper = styles_1.styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n
|
|
10
|
+
exports.DatePickerHeaderWrapper = styles_1.styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n"], ["\n display: flex;\n align-items: center;\n justify-content: space-between;\n"])));
|
|
11
11
|
exports.DatePickerHeaderTitle = (0, styles_1.styled)(Typography_1.Typography)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n text-transform: capitalize;\n"], ["\n text-transform: capitalize;\n"])));
|
|
12
12
|
var templateObject_1, templateObject_2;
|
|
@@ -31,6 +31,6 @@ var Menu_1 = require("../Menu");
|
|
|
31
31
|
var styles_1 = require("./styles");
|
|
32
32
|
exports.IconDropdownButton = (0, react_1.forwardRef)(function (_a, ref) {
|
|
33
33
|
var children = _a.children, icon = _a.icon, props = __rest(_a, ["children", "icon"]);
|
|
34
|
-
var _b = (0, hooks_1.useMenu)(), open = _b.open, anchorRef = _b.anchorRef, handleOpenMenu = _b.handleOpenMenu, handleCloseMenu = _b.handleCloseMenu;
|
|
35
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.ClickAwayListener, __assign({
|
|
34
|
+
var _b = (0, hooks_1.useMenu)(ref), open = _b.open, anchorRef = _b.anchorRef, handleOpenMenu = _b.handleOpenMenu, handleCloseMenu = _b.handleCloseMenu;
|
|
35
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.ClickAwayListener, __assign({ onClickAway: handleCloseMenu }, { children: (0, jsx_runtime_1.jsx)(styles_1.IconDropdownButtonWrapper, __assign({}, props, { ref: anchorRef, onClick: handleOpenMenu, selected: open }, { children: icon }), void 0) }), void 0), (0, jsx_runtime_1.jsx)(Menu_1.Menu, __assign({ open: open, anchorEl: anchorRef.current }, { children: children }), void 0)] }, void 0));
|
|
36
36
|
});
|
package/Tooltip/Tooltip.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TooltipProps } from './types';
|
|
3
|
-
export declare const Tooltip: import("react").ForwardRefExoticComponent<Pick<TooltipProps, "components" | "tabIndex" | "children" | "className" | "componentsProps" | "slot" | "style" | "title" | "css" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "size" | "open" | "classes" | "sx" | "onClose" | "TransitionComponent" | "TransitionProps" | "arrow" | "describeChild" | "disableFocusListener" | "disableHoverListener" | "disableInteractive" | "disableTouchListener" | "enterDelay" | "enterNextDelay" | "enterTouchDelay" | "followCursor" | "leaveDelay" | "leaveTouchDelay" | "onOpen" | "
|
|
3
|
+
export declare const Tooltip: import("react").ForwardRefExoticComponent<Pick<TooltipProps, "components" | "tabIndex" | "children" | "className" | "componentsProps" | "slot" | "style" | "title" | "css" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "size" | "open" | "classes" | "sx" | "onClose" | "TransitionComponent" | "TransitionProps" | "placement" | "arrow" | "describeChild" | "disableFocusListener" | "disableHoverListener" | "disableInteractive" | "disableTouchListener" | "enterDelay" | "enterNextDelay" | "enterTouchDelay" | "followCursor" | "leaveDelay" | "leaveTouchDelay" | "onOpen" | "PopperComponent" | "PopperProps"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export declare type NestedAction<T> = {
|
|
3
|
+
/**
|
|
4
|
+
* Обработчик действия
|
|
5
|
+
*/
|
|
6
|
+
onClick: (row: T) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Название действия
|
|
9
|
+
*/
|
|
10
|
+
name: string;
|
|
11
|
+
};
|
|
12
|
+
export declare type SingleAction<T> = {
|
|
13
|
+
/**
|
|
14
|
+
* Иконка действия
|
|
15
|
+
*/
|
|
16
|
+
icon?: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Обработчик действия
|
|
19
|
+
*/
|
|
20
|
+
onClick: (row: T) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Название действия
|
|
23
|
+
*/
|
|
24
|
+
name: string;
|
|
25
|
+
/**
|
|
26
|
+
* Флаг показа выпадающего списка при клике
|
|
27
|
+
*/
|
|
28
|
+
nested?: false;
|
|
29
|
+
};
|
|
30
|
+
export declare type MultipleAction<T> = {
|
|
31
|
+
/**
|
|
32
|
+
* Иконка действия
|
|
33
|
+
*/
|
|
34
|
+
icon: ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* Список действий для выпадающего списка
|
|
37
|
+
*/
|
|
38
|
+
actions: Array<NestedAction<T>>;
|
|
39
|
+
/**
|
|
40
|
+
* Флаг показа выпадающего списка при клике
|
|
41
|
+
*/
|
|
42
|
+
nested: true;
|
|
43
|
+
/**
|
|
44
|
+
* Название действия
|
|
45
|
+
*/
|
|
46
|
+
name: string;
|
|
47
|
+
};
|
|
48
|
+
export declare type MainAction<T> = SingleAction<T> | MultipleAction<T>;
|
|
49
|
+
export declare type Actions<T> = {
|
|
50
|
+
/**
|
|
51
|
+
* Основные действия
|
|
52
|
+
*/
|
|
53
|
+
main: MainAction<T>[];
|
|
54
|
+
/**
|
|
55
|
+
* Второстепенные действия
|
|
56
|
+
*/
|
|
57
|
+
secondary?: SingleAction<T>[];
|
|
58
|
+
};
|
|
59
|
+
export declare type ActionsCellProps<T> = {
|
|
60
|
+
/**
|
|
61
|
+
* Действия
|
|
62
|
+
*/
|
|
63
|
+
actions: Actions<T>;
|
|
64
|
+
/**
|
|
65
|
+
* Данные строки из DataGrid
|
|
66
|
+
*/
|
|
67
|
+
row: T;
|
|
68
|
+
};
|
|
69
|
+
export declare function ActionCell<T>({ actions: { main, secondary }, row, }: ActionsCellProps<T>): JSX.Element;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { DotsVOutlineMd } from '@astral/icons';
|
|
14
|
+
import { useCallback, useMemo } from 'react';
|
|
15
|
+
import { IconButton } from '../IconButton';
|
|
16
|
+
import { IconDropdownButton } from '../IconDropdownButton';
|
|
17
|
+
import { MenuItem } from '../MenuItem';
|
|
18
|
+
import { Tooltip } from '../Tooltip';
|
|
19
|
+
import { ActionCellWrapper } from './styles';
|
|
20
|
+
export function ActionCell(_a) {
|
|
21
|
+
var _b = _a.actions, _c = _b.main, main = _c === void 0 ? [] : _c, _d = _b.secondary, secondary = _d === void 0 ? [] : _d, row = _a.row;
|
|
22
|
+
var handleActionClick = function (onClick) {
|
|
23
|
+
return function () {
|
|
24
|
+
onClick(row);
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
var renderMainAction = useCallback(function (action) {
|
|
28
|
+
if (action.nested) {
|
|
29
|
+
var name_1 = action.name, actions = action.actions, icon_1 = action.icon;
|
|
30
|
+
return (_jsx(Tooltip, __assign({ title: name_1 }, { children: _jsx(IconDropdownButton, __assign({ icon: icon_1, variant: "text" }, { children: actions.map(function (_a) {
|
|
31
|
+
var nestedActionName = _a.name, onClick = _a.onClick;
|
|
32
|
+
return (_jsx(MenuItem, __assign({ onClick: handleActionClick(onClick) }, { children: nestedActionName }), nestedActionName));
|
|
33
|
+
}) }), void 0) }), name_1));
|
|
34
|
+
}
|
|
35
|
+
var onClick = action.onClick, name = action.name, icon = action.icon;
|
|
36
|
+
return (_jsx(Tooltip, __assign({ title: name }, { children: _jsx(IconButton, __assign({ variant: "text", onClick: handleActionClick(onClick) }, { children: icon }), void 0) }), name));
|
|
37
|
+
}, [handleActionClick]);
|
|
38
|
+
var renderSecondaryActions = useMemo(function () {
|
|
39
|
+
if (!Boolean(secondary.length))
|
|
40
|
+
return null;
|
|
41
|
+
return (_jsx(IconDropdownButton, __assign({ icon: _jsx(DotsVOutlineMd, {}, void 0), variant: "text" }, { children: secondary.map(function (_a) {
|
|
42
|
+
var name = _a.name, onClick = _a.onClick;
|
|
43
|
+
return (_jsx(MenuItem, __assign({ onClick: handleActionClick(onClick) }, { children: name }), name));
|
|
44
|
+
}) }), void 0));
|
|
45
|
+
}, [secondary, handleActionClick]);
|
|
46
|
+
return (_jsxs(ActionCellWrapper, { children: [main.map(function (action) { return renderMainAction(action); }), renderSecondaryActions] }, void 0));
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ActionCell';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ActionCell';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const ActionCellWrapper: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any> | undefined;
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
import { styled } from '../styles';
|
|
6
|
+
export var ActionCellWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n"], ["\n display: flex;\n align-items: center;\n"])));
|
|
7
|
+
var templateObject_1;
|
package/esm/Badge/styled.d.ts
CHANGED
|
@@ -1,30 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BadgeColor, BadgeProps } from './types';
|
|
3
3
|
export declare const StyledBadge: import("@emotion/styled").StyledComponent<{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
colorError?: string | undefined;
|
|
8
|
-
colorInfo?: string | undefined;
|
|
9
|
-
colorSuccess?: string | undefined;
|
|
10
|
-
colorWarning?: string | undefined;
|
|
11
|
-
anchorOriginTopRightRectangular?: string | undefined;
|
|
12
|
-
anchorOriginBottomRightRectangular?: string | undefined;
|
|
13
|
-
anchorOriginTopLeftRectangular?: string | undefined;
|
|
14
|
-
anchorOriginBottomLeftRectangular?: string | undefined;
|
|
15
|
-
anchorOriginTopRightCircular?: string | undefined;
|
|
16
|
-
anchorOriginBottomRightCircular?: string | undefined;
|
|
17
|
-
anchorOriginTopLeftCircular?: string | undefined;
|
|
18
|
-
anchorOriginBottomLeftCircular?: string | undefined;
|
|
19
|
-
overlapRectangular?: string | undefined;
|
|
20
|
-
overlapCircular?: string | undefined;
|
|
21
|
-
}) | undefined;
|
|
4
|
+
anchorOrigin?: import("@mui/material").BadgeOrigin | undefined;
|
|
5
|
+
classes?: Partial<import("@mui/material").BadgeClasses> | undefined;
|
|
6
|
+
className?: string | undefined;
|
|
22
7
|
color?: "primary" | "secondary" | "default" | "error" | "success" | "warning" | "info" | undefined;
|
|
23
8
|
overlap?: "circular" | "rectangular" | undefined;
|
|
24
9
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
25
10
|
variant?: "dot" | "standard" | undefined;
|
|
26
11
|
} & {
|
|
27
|
-
anchorOrigin?: import("@mui/base").BadgeOrigin | undefined;
|
|
28
12
|
components?: {
|
|
29
13
|
Root?: import("react").ElementType<any> | undefined;
|
|
30
14
|
Badge?: import("react").ElementType<any> | undefined;
|
|
@@ -35,11 +19,9 @@ export declare const StyledBadge: import("@emotion/styled").StyledComponent<{
|
|
|
35
19
|
} | undefined;
|
|
36
20
|
badgeContent?: import("react").ReactNode;
|
|
37
21
|
children?: import("react").ReactNode;
|
|
38
|
-
classes?: Partial<import("@mui/base").BadgeUnstyledClasses> | undefined;
|
|
39
22
|
invisible?: boolean | undefined;
|
|
40
23
|
max?: number | undefined;
|
|
41
24
|
showZero?: boolean | undefined;
|
|
42
|
-
variant?: string | undefined;
|
|
43
25
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "tabIndex" | "children" | "className" | "slot" | "style" | "title" | "key" | "css" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & {
|
|
44
26
|
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
45
27
|
}, "components" | "children" | "componentsProps" | "color" | "variant" | keyof import("@mui/material/OverridableComponent").CommonProps | "sx" | "invisible" | "anchorOrigin" | "overlap" | "badgeContent" | "max" | "showZero"> & {
|
|
@@ -60,7 +60,7 @@ export function DataGridHead(_a) {
|
|
|
60
60
|
var renderColumns = useMemo(function () {
|
|
61
61
|
return columns.map(function (_a) {
|
|
62
62
|
var field = _a.field, label = _a.label, sortable = _a.sortable, align = _a.align, renderCell = _a.renderCell;
|
|
63
|
-
return (_jsx(DataGridHeadColumn, { sorting: sorting, renderCell: renderCell, field: field, onSort: handleSort, label: label, sortable: sortable, align: align },
|
|
63
|
+
return (_jsx(DataGridHeadColumn, { sorting: sorting, renderCell: renderCell, field: field, onSort: handleSort, label: label, sortable: sortable, align: align }, field));
|
|
64
64
|
});
|
|
65
65
|
}, [columns, handleSort, sorting]);
|
|
66
66
|
return (_jsx(TableHead, { children: _jsxs(TableRow, { children: [selectable && (_jsx(TableCell, __assign({ padding: "checkbox" }, { children: _jsx(Checkbox, { checked: checked, indeterminate: indeterminate, onChange: onSelectAllRows }, void 0) }), void 0)), renderColumns] }, void 0) }, void 0));
|
|
@@ -4,6 +4,6 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
4
4
|
};
|
|
5
5
|
import { styled } from '../../styles';
|
|
6
6
|
import { Typography } from '../../Typography';
|
|
7
|
-
export var DatePickerHeaderWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n
|
|
7
|
+
export var DatePickerHeaderWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n"], ["\n display: flex;\n align-items: center;\n justify-content: space-between;\n"])));
|
|
8
8
|
export var DatePickerHeaderTitle = styled(Typography)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n text-transform: capitalize;\n"], ["\n text-transform: capitalize;\n"])));
|
|
9
9
|
var templateObject_1, templateObject_2;
|
|
@@ -28,6 +28,6 @@ import { Menu } from '../Menu';
|
|
|
28
28
|
import { IconDropdownButtonWrapper } from './styles';
|
|
29
29
|
export var IconDropdownButton = forwardRef(function (_a, ref) {
|
|
30
30
|
var children = _a.children, icon = _a.icon, props = __rest(_a, ["children", "icon"]);
|
|
31
|
-
var _b = useMenu(), open = _b.open, anchorRef = _b.anchorRef, handleOpenMenu = _b.handleOpenMenu, handleCloseMenu = _b.handleCloseMenu;
|
|
32
|
-
return (_jsxs(_Fragment, { children: [_jsx(ClickAwayListener, __assign({
|
|
31
|
+
var _b = useMenu(ref), open = _b.open, anchorRef = _b.anchorRef, handleOpenMenu = _b.handleOpenMenu, handleCloseMenu = _b.handleCloseMenu;
|
|
32
|
+
return (_jsxs(_Fragment, { children: [_jsx(ClickAwayListener, __assign({ onClickAway: handleCloseMenu }, { children: _jsx(IconDropdownButtonWrapper, __assign({}, props, { ref: anchorRef, onClick: handleOpenMenu, selected: open }, { children: icon }), void 0) }), void 0), _jsx(Menu, __assign({ open: open, anchorEl: anchorRef.current }, { children: children }), void 0)] }, void 0));
|
|
33
33
|
});
|
package/esm/Tooltip/Tooltip.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TooltipProps } from './types';
|
|
3
|
-
export declare const Tooltip: import("react").ForwardRefExoticComponent<Pick<TooltipProps, "components" | "tabIndex" | "children" | "className" | "componentsProps" | "slot" | "style" | "title" | "css" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "size" | "open" | "classes" | "sx" | "onClose" | "TransitionComponent" | "TransitionProps" | "arrow" | "describeChild" | "disableFocusListener" | "disableHoverListener" | "disableInteractive" | "disableTouchListener" | "enterDelay" | "enterNextDelay" | "enterTouchDelay" | "followCursor" | "leaveDelay" | "leaveTouchDelay" | "onOpen" | "
|
|
3
|
+
export declare const Tooltip: import("react").ForwardRefExoticComponent<Pick<TooltipProps, "components" | "tabIndex" | "children" | "className" | "componentsProps" | "slot" | "style" | "title" | "css" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "size" | "open" | "classes" | "sx" | "onClose" | "TransitionComponent" | "TransitionProps" | "placement" | "arrow" | "describeChild" | "disableFocusListener" | "disableHoverListener" | "disableInteractive" | "disableTouchListener" | "enterDelay" | "enterNextDelay" | "enterTouchDelay" | "followCursor" | "leaveDelay" | "leaveTouchDelay" | "onOpen" | "PopperComponent" | "PopperProps"> & import("react").RefAttributes<HTMLDivElement>>;
|
package/esm/hooks/useMenu.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MutableRefObject } from 'react';
|
|
1
|
+
import { ForwardedRef, MutableRefObject } from 'react';
|
|
2
2
|
declare type UseMenuResult = {
|
|
3
3
|
/**
|
|
4
4
|
* Флаг состояния меню (открыто-закрыто)
|
|
@@ -17,5 +17,5 @@ declare type UseMenuResult = {
|
|
|
17
17
|
*/
|
|
18
18
|
handleOpenMenu: () => void;
|
|
19
19
|
};
|
|
20
|
-
export declare function useMenu(): UseMenuResult;
|
|
20
|
+
export declare function useMenu(ref?: ForwardedRef<HTMLButtonElement> | null): UseMenuResult;
|
|
21
21
|
export {};
|
package/esm/hooks/useMenu.js
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
|
-
import { useRef, useState } from 'react';
|
|
2
|
-
export function useMenu() {
|
|
1
|
+
import { useEffect, useRef, useState, } from 'react';
|
|
2
|
+
export function useMenu(ref) {
|
|
3
|
+
if (ref === void 0) { ref = null; }
|
|
3
4
|
var _a = useState(false), open = _a[0], setOpen = _a[1];
|
|
4
5
|
var anchorRef = useRef(null);
|
|
6
|
+
useEffect(function () {
|
|
7
|
+
if (!ref)
|
|
8
|
+
return;
|
|
9
|
+
if (typeof ref === 'function') {
|
|
10
|
+
ref(anchorRef.current);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
ref.current = anchorRef.current;
|
|
14
|
+
}
|
|
15
|
+
}, [ref]);
|
|
5
16
|
var handleCloseMenu = function () { return setOpen(false); };
|
|
6
17
|
var handleOpenMenu = function () { return setOpen(true); };
|
|
7
18
|
return { open: open, anchorRef: anchorRef, handleCloseMenu: handleCloseMenu, handleOpenMenu: handleOpenMenu };
|
package/esm/index.d.ts
CHANGED
package/esm/index.js
CHANGED
package/hooks/useMenu.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MutableRefObject } from 'react';
|
|
1
|
+
import { ForwardedRef, MutableRefObject } from 'react';
|
|
2
2
|
declare type UseMenuResult = {
|
|
3
3
|
/**
|
|
4
4
|
* Флаг состояния меню (открыто-закрыто)
|
|
@@ -17,5 +17,5 @@ declare type UseMenuResult = {
|
|
|
17
17
|
*/
|
|
18
18
|
handleOpenMenu: () => void;
|
|
19
19
|
};
|
|
20
|
-
export declare function useMenu(): UseMenuResult;
|
|
20
|
+
export declare function useMenu(ref?: ForwardedRef<HTMLButtonElement> | null): UseMenuResult;
|
|
21
21
|
export {};
|
package/hooks/useMenu.js
CHANGED
|
@@ -2,9 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useMenu = void 0;
|
|
4
4
|
var react_1 = require("react");
|
|
5
|
-
function useMenu() {
|
|
5
|
+
function useMenu(ref) {
|
|
6
|
+
if (ref === void 0) { ref = null; }
|
|
6
7
|
var _a = (0, react_1.useState)(false), open = _a[0], setOpen = _a[1];
|
|
7
8
|
var anchorRef = (0, react_1.useRef)(null);
|
|
9
|
+
(0, react_1.useEffect)(function () {
|
|
10
|
+
if (!ref)
|
|
11
|
+
return;
|
|
12
|
+
if (typeof ref === 'function') {
|
|
13
|
+
ref(anchorRef.current);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
ref.current = anchorRef.current;
|
|
17
|
+
}
|
|
18
|
+
}, [ref]);
|
|
8
19
|
var handleCloseMenu = function () { return setOpen(false); };
|
|
9
20
|
var handleOpenMenu = function () { return setOpen(true); };
|
|
10
21
|
return { open: open, anchorRef: anchorRef, handleCloseMenu: handleCloseMenu, handleOpenMenu: handleOpenMenu };
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -10,6 +10,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./ActionCell"), exports);
|
|
13
14
|
__exportStar(require("./Autocomplete"), exports);
|
|
14
15
|
__exportStar(require("./Badge"), exports);
|
|
15
16
|
__exportStar(require("./Button"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astral/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"browser": "./src/index.ts",
|
|
5
5
|
"jest": {
|
|
6
6
|
"moduleNameMapper": {
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
}
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@astral/icons": "^0.
|
|
11
|
+
"@astral/icons": "^0.34.0",
|
|
12
12
|
"@emotion/cache": "11.7.1",
|
|
13
|
-
"@emotion/react": "11.
|
|
13
|
+
"@emotion/react": "11.9.0",
|
|
14
14
|
"@emotion/server": "11.4.0",
|
|
15
15
|
"@emotion/styled": "11.8.1",
|
|
16
16
|
"@mui/base": "5.0.0-alpha.69",
|
|
17
17
|
"@mui/lab": "5.0.0-alpha.70",
|
|
18
|
-
"@mui/material": "5.
|
|
18
|
+
"@mui/material": "5.8.2",
|
|
19
19
|
"date-fns": "^2.28.0",
|
|
20
20
|
"lodash-es": "4.17.21",
|
|
21
21
|
"react-datepicker": "4.7.0",
|