@astral/ui 1.31.0 → 1.32.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.
@@ -1,4 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
+ import { TooltipProps } from '../Tooltip';
2
3
  export declare type NestedAction<T> = {
3
4
  /**
4
5
  * Обработчик действия
@@ -65,5 +66,9 @@ export declare type ActionsCellProps<T> = {
65
66
  * Данные строки из DataGrid
66
67
  */
67
68
  row: T;
69
+ /**
70
+ * Позиция тултипа
71
+ */
72
+ tooltipPlacement?: TooltipProps['placement'];
68
73
  };
69
- export declare function ActionCell<T>({ actions: { main, secondary }, row, }: ActionsCellProps<T>): JSX.Element;
74
+ export declare function ActionCell<T>({ actions: { main, secondary }, row, tooltipPlacement, }: ActionsCellProps<T>): JSX.Element;
@@ -9,17 +9,17 @@ const IconDropdownButton_1 = require("../IconDropdownButton");
9
9
  const MenuItem_1 = require("../MenuItem");
10
10
  const Tooltip_1 = require("../Tooltip");
11
11
  const styles_1 = require("./styles");
12
- function ActionCell({ actions: { main = [], secondary = [] }, row, }) {
12
+ function ActionCell({ actions: { main = [], secondary = [] }, row, tooltipPlacement, }) {
13
13
  const handleActionClick = (onClick) => () => {
14
14
  onClick(row);
15
15
  };
16
16
  const renderMainAction = (0, react_1.useCallback)((action) => {
17
17
  if (action.nested) {
18
18
  const { name, actions, icon } = action;
19
- return ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, Object.assign({ title: name }, { children: (0, jsx_runtime_1.jsx)(IconDropdownButton_1.IconDropdownButton, Object.assign({ icon: icon, variant: "text" }, { children: actions.map(({ name: nestedActionName, onClick }) => ((0, jsx_runtime_1.jsx)(MenuItem_1.MenuItem, Object.assign({ onClick: handleActionClick(onClick) }, { children: nestedActionName }), nestedActionName))) })) }), name));
19
+ return ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, Object.assign({ title: name, placement: tooltipPlacement }, { children: (0, jsx_runtime_1.jsx)(IconDropdownButton_1.IconDropdownButton, Object.assign({ icon: icon, variant: "text" }, { children: actions.map(({ name: nestedActionName, onClick }) => ((0, jsx_runtime_1.jsx)(MenuItem_1.MenuItem, Object.assign({ onClick: handleActionClick(onClick) }, { children: nestedActionName }), nestedActionName))) })) }), name));
20
20
  }
21
21
  const { onClick, name, icon } = action;
22
- return ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, Object.assign({ title: name }, { children: (0, jsx_runtime_1.jsx)(IconButton_1.IconButton, Object.assign({ variant: "text", onClick: handleActionClick(onClick) }, { children: icon })) }), name));
22
+ return ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, Object.assign({ title: name, placement: tooltipPlacement }, { children: (0, jsx_runtime_1.jsx)(IconButton_1.IconButton, Object.assign({ variant: "text", onClick: handleActionClick(onClick) }, { children: icon })) }), name));
23
23
  }, [handleActionClick]);
24
24
  const renderSecondaryActions = (0, react_1.useMemo)(() => {
25
25
  if (!Boolean(secondary.length)) {
@@ -1,4 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
+ import { TooltipProps } from '../Tooltip';
2
3
  export declare type NestedAction<T> = {
3
4
  /**
4
5
  * Обработчик действия
@@ -65,5 +66,9 @@ export declare type ActionsCellProps<T> = {
65
66
  * Данные строки из DataGrid
66
67
  */
67
68
  row: T;
69
+ /**
70
+ * Позиция тултипа
71
+ */
72
+ tooltipPlacement?: TooltipProps['placement'];
68
73
  };
69
- export declare function ActionCell<T>({ actions: { main, secondary }, row, }: ActionsCellProps<T>): JSX.Element;
74
+ export declare function ActionCell<T>({ actions: { main, secondary }, row, tooltipPlacement, }: ActionsCellProps<T>): JSX.Element;
@@ -6,17 +6,17 @@ import { IconDropdownButton } from '../IconDropdownButton';
6
6
  import { MenuItem } from '../MenuItem';
7
7
  import { Tooltip } from '../Tooltip';
8
8
  import { ActionCellWrapper } from './styles';
9
- export function ActionCell({ actions: { main = [], secondary = [] }, row, }) {
9
+ export function ActionCell({ actions: { main = [], secondary = [] }, row, tooltipPlacement, }) {
10
10
  const handleActionClick = (onClick) => () => {
11
11
  onClick(row);
12
12
  };
13
13
  const renderMainAction = useCallback((action) => {
14
14
  if (action.nested) {
15
15
  const { name, actions, icon } = action;
16
- return (_jsx(Tooltip, Object.assign({ title: name }, { children: _jsx(IconDropdownButton, Object.assign({ icon: icon, variant: "text" }, { children: actions.map(({ name: nestedActionName, onClick }) => (_jsx(MenuItem, Object.assign({ onClick: handleActionClick(onClick) }, { children: nestedActionName }), nestedActionName))) })) }), name));
16
+ return (_jsx(Tooltip, Object.assign({ title: name, placement: tooltipPlacement }, { children: _jsx(IconDropdownButton, Object.assign({ icon: icon, variant: "text" }, { children: actions.map(({ name: nestedActionName, onClick }) => (_jsx(MenuItem, Object.assign({ onClick: handleActionClick(onClick) }, { children: nestedActionName }), nestedActionName))) })) }), name));
17
17
  }
18
18
  const { onClick, name, icon } = action;
19
- return (_jsx(Tooltip, Object.assign({ title: name }, { children: _jsx(IconButton, Object.assign({ variant: "text", onClick: handleActionClick(onClick) }, { children: icon })) }), name));
19
+ return (_jsx(Tooltip, Object.assign({ title: name, placement: tooltipPlacement }, { children: _jsx(IconButton, Object.assign({ variant: "text", onClick: handleActionClick(onClick) }, { children: icon })) }), name));
20
20
  }, [handleActionClick]);
21
21
  const renderSecondaryActions = useMemo(() => {
22
22
  if (!Boolean(secondary.length)) {
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "1.31.0",
3
+ "version": "1.32.0",
4
4
  "browser": "./esm/index.js",
5
5
  "main": "./index.js",
6
6
  "dependencies": {
7
- "@astral/icons": "^1.31.0",
7
+ "@astral/icons": "^1.32.0",
8
8
  "@emotion/cache": "11.7.1",
9
9
  "@emotion/react": "11.9.0",
10
10
  "@emotion/server": "11.4.0",