@mdtl/uikit 0.0.29 → 0.0.31

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.
@@ -0,0 +1,7 @@
1
+ import { FC } from 'react';
2
+ import { MenuMutualProps } from './interfaces';
3
+ interface IHierarchicalArrowProps extends MenuMutualProps {
4
+ isHierarchical: boolean;
5
+ }
6
+ export declare const HierarchicalArrow: FC<IHierarchicalArrowProps>;
7
+ export {};
@@ -0,0 +1,20 @@
1
+ import { FC } from 'react';
2
+ import { MenuMutualProps, TMenuAnchorElement, TItemActionNestedSelectionElement, NodeWithOptionalPayload } from './interfaces';
3
+ interface IHierarchicalMenuProps extends MenuMutualProps {
4
+ anchorEl: TMenuAnchorElement;
5
+ setAnchorEl: (anchorEl: TMenuAnchorElement) => void;
6
+ open: boolean;
7
+ onHover: () => void;
8
+ onCancelHover: () => void;
9
+ setAnchorElRootMenu: (value: HTMLElement) => void;
10
+ setOpenRootMenu: (value: boolean) => void;
11
+ list: TItemActionNestedSelectionElement[];
12
+ /**
13
+ * рекурсивно прокидывается внутрь MenuItemComponent как часть itemAction
14
+ * @param value
15
+ * @returns
16
+ */
17
+ clickCallback: (value: NodeWithOptionalPayload) => void;
18
+ }
19
+ export declare const HierarchicalMenu: FC<IHierarchicalMenuProps>;
20
+ export {};
@@ -0,0 +1,12 @@
1
+ import { FC, JSX } from 'react';
2
+ import { IToolbarAction } from '../Toolbar/interfaces';
3
+ import { IToolbarProps } from '../Toolbar/Toolbar';
4
+ import { MenuMutualProps } from './interfaces';
5
+ export interface IMenuComponentProps extends MenuMutualProps {
6
+ menuItems: IToolbarAction[];
7
+ menuBtnOptions?: IToolbarProps['menuBtnOptions'];
8
+ color?: IToolbarProps['color'];
9
+ setCurrentItemInfo?: (value: JSX.Element | null) => void;
10
+ setOpenInfo?: (value: boolean) => void;
11
+ }
12
+ export declare const Menu: FC<IMenuComponentProps>;
@@ -0,0 +1,29 @@
1
+ import { FC } from 'react';
2
+ import { IToolbarAction, TAnchorItemEl } from '../Toolbar/interfaces';
3
+ import { TItemActionNestedSelectionElement, MenuMutualProps } from './interfaces';
4
+ import { IMenuComponentProps } from './Menu';
5
+ interface IMenuItemComponentProps extends MenuMutualProps {
6
+ /**
7
+ * указывает, что пункт является корневым и может открывать иерархическое меню
8
+ */
9
+ isRootNode: boolean;
10
+ itemAction: IToolbarAction;
11
+ setAnchorItemEl: (value: TAnchorItemEl) => void;
12
+ setMenuOpen: (value: boolean) => void;
13
+ setCurrentItemInfo?: IMenuComponentProps['setCurrentItemInfo'];
14
+ setOpenInfo?: IMenuComponentProps['setOpenInfo'];
15
+ /**
16
+ * используется для расчета необходимости рендерить info
17
+ */
18
+ hasInfoOnCurrentLevel?: boolean;
19
+ /**
20
+ * используется для расчета необходимости рендерить Box для стрелок иерархического меню
21
+ */
22
+ hasHierarchicalOnCurrentLevel?: boolean;
23
+ /**
24
+ * используется как payload для clickCallback, если MenuItemComponent лежит внутри HierarchicalMenu
25
+ */
26
+ nestedSelectionElement?: TItemActionNestedSelectionElement;
27
+ }
28
+ export declare const MenuItemComponent: FC<IMenuItemComponentProps>;
29
+ export {};
@@ -0,0 +1,19 @@
1
+ export interface Node {
2
+ id: string;
3
+ parentId?: string | null;
4
+ level: number;
5
+ name: string;
6
+ description: string;
7
+ }
8
+ export interface NodeWithOptionalPayload extends Node {
9
+ payload?: unknown;
10
+ }
11
+ export type TItemActionNestedSelectionElement = {
12
+ data: NodeWithOptionalPayload;
13
+ children?: TItemActionNestedSelectionElement[] | null;
14
+ };
15
+ export type TMenuAnchorElement = HTMLLIElement | null;
16
+ export interface MenuMutualProps {
17
+ /** true: иерархическое меню будет строиться направо */
18
+ hierarchicalMenuLTR?: boolean;
19
+ }
@@ -0,0 +1,15 @@
1
+ import { FC } from 'react';
2
+ import { SvgIconPropsColorOverrides } from '@mui/material/SvgIcon';
3
+ import { ButtonProps } from '@mui/material/Button';
4
+ import { OverridableStringUnion } from '@mui/types';
5
+ import { IToolbarAction } from './interfaces';
6
+ export interface IToolbarProps {
7
+ itemActions: IToolbarAction[];
8
+ color?: OverridableStringUnion<'inherit' | 'action' | 'disabled' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning', SvgIconPropsColorOverrides>;
9
+ menuBtnOptions?: {
10
+ size?: ButtonProps['size'];
11
+ color?: ButtonProps['color'];
12
+ variant?: ButtonProps['variant'];
13
+ };
14
+ }
15
+ export declare const Toolbar: FC<IToolbarProps>;
@@ -0,0 +1,21 @@
1
+ import { NodeWithOptionalPayload, TItemActionNestedSelectionElement } from '../Menu/interfaces';
2
+ import { ButtonPropsColorOverrides, ButtonPropsSizeOverrides, SvgIconPropsColorOverrides } from '@mui/material';
3
+ import { default as SvgIcon } from '@mui/material/SvgIcon';
4
+ import { OverridableStringUnion } from '@mui/types';
5
+ import { JSX, MemoExoticComponent } from 'react';
6
+ export type TAnchorItemEl = null | HTMLElement;
7
+ export interface IToolbarAction {
8
+ tooltip: string;
9
+ id: string;
10
+ clickCallback: (data?: NodeWithOptionalPayload) => void | Promise<void>;
11
+ visible?: 'menu' | 'button' | 'none' | 'icon';
12
+ children?: IToolbarAction[];
13
+ color?: OverridableStringUnion<'inherit' | 'primary' | 'secondary' | 'success' | 'error' | 'info' | 'warning', ButtonPropsColorOverrides | SvgIconPropsColorOverrides>;
14
+ size?: OverridableStringUnion<'small' | 'medium' | 'large', ButtonPropsSizeOverrides>;
15
+ icon?: MemoExoticComponent<(props: any) => JSX.Element> | typeof SvgIcon;
16
+ startIcon?: MemoExoticComponent<(props: any) => JSX.Element> | typeof SvgIcon;
17
+ endIcon?: MemoExoticComponent<(props: any) => JSX.Element> | typeof SvgIcon;
18
+ info?: JSX.Element;
19
+ nestedSelection?: TItemActionNestedSelectionElement[];
20
+ disabled?: boolean;
21
+ }
package/dist/index.d.ts CHANGED
@@ -9,4 +9,8 @@ export { StackPanel } from './components/StackPanel/StackPanel';
9
9
  export { DefaultHeaderTemplate } from './components/StackPanel/DefaultHeaderTemplate';
10
10
  export { Sections } from './components/StackPanel/Sections';
11
11
  export * from './components/StackPanel/interfaces';
12
+ export { Toolbar } from './components/Toolbar/Toolbar';
13
+ export * from './components/Toolbar/interfaces';
14
+ export { Menu } from './components/Menu/Menu';
15
+ export * from './components/Menu/interfaces';
12
16
  export { generateGuid } from './utils/generateGuid';