@ws-ui/shared 0.0.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/README.md +27 -0
- package/dist/assets/4DIcons.d.ts +1572 -0
- package/dist/assets/index.d.ts +3 -0
- package/dist/components/Dialog.d.ts +21 -0
- package/dist/components/Portal.d.ts +2 -0
- package/dist/components/Toast.d.ts +14 -0
- package/dist/components/Tree/components/IndentLines.d.ts +8 -0
- package/dist/components/Tree/components/Switcher.d.ts +8 -0
- package/dist/components/Tree/components/Tree.d.ts +4 -0
- package/dist/components/Tree/components/TreeNode.d.ts +4 -0
- package/dist/components/Tree/index.d.ts +7 -0
- package/dist/components/Tree/interfaces.d.ts +87 -0
- package/dist/components/Tree/styled.d.ts +3 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/use-didmounteffect.d.ts +2 -0
- package/dist/hooks/use-hotkeys.d.ts +14 -0
- package/dist/hooks/use-outside-click.d.ts +2 -0
- package/dist/hooks/use-previous.d.ts +1 -0
- package/dist/hooks/use-state-ref.d.ts +2 -0
- package/dist/index.cjs.js +36 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.es.js +6350 -0
- package/dist/index.es.js.map +1 -0
- package/dist/providers/PathProvider.d.ts +7 -0
- package/dist/providers/index.d.ts +1 -0
- package/dist/style.css +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/subjects.d.ts +36 -0
- package/dist/utils/validation.d.ts +2 -0
- package/dist/utils/validation.test.d.ts +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +51 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Placement, VirtualElement } from '@popperjs/core';
|
|
2
|
+
import React, { CSSProperties, FC } from 'react';
|
|
3
|
+
interface IOverlayProps {
|
|
4
|
+
onClick: (ev: React.MouseEvent) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const Overlay: FC<IOverlayProps>;
|
|
7
|
+
interface IDialogBodyProps {
|
|
8
|
+
style?: CSSProperties;
|
|
9
|
+
attributes?: {
|
|
10
|
+
[key: string]: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export declare const DialogBody: React.ForwardRefExoticComponent<Omit<React.HTMLProps<HTMLDivElement> & IDialogBodyProps, "ref"> & React.RefAttributes<any>>;
|
|
14
|
+
interface IDialogProps {
|
|
15
|
+
isOpen: boolean;
|
|
16
|
+
onClose?: () => void;
|
|
17
|
+
referenceElement: Element | VirtualElement | null | undefined;
|
|
18
|
+
placement?: Placement;
|
|
19
|
+
}
|
|
20
|
+
export declare const Dialog: FC<IDialogProps>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type ToastKind = 'warning' | 'info' | 'danger' | 'message' | 'error' | 'multi';
|
|
3
|
+
interface IToastProps {
|
|
4
|
+
kind: ToastKind;
|
|
5
|
+
message: string | IMultilineMessage[];
|
|
6
|
+
id?: number | string;
|
|
7
|
+
onClose(): void;
|
|
8
|
+
}
|
|
9
|
+
export interface IMultilineMessage {
|
|
10
|
+
title: string;
|
|
11
|
+
messages: string[];
|
|
12
|
+
}
|
|
13
|
+
export declare const Toast: React.FC<IToastProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import Tree from './components/Tree';
|
|
2
|
+
import TreeNode from './components/TreeNode';
|
|
3
|
+
import IndentLines from './components/IndentLines';
|
|
4
|
+
import Switcher from './components/Switcher';
|
|
5
|
+
export { TreeNode, Tree, IndentLines, Switcher };
|
|
6
|
+
export * from './interfaces';
|
|
7
|
+
export * from './styled';
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { MouseEvent, ReactElement } from 'react';
|
|
2
|
+
export type RenderNodeHandler<T = any> = (node: ITreeNodeData<T>, depth: number, state: NodeState, actions: TreeActions, searchQuery: string) => JSX.Element;
|
|
3
|
+
export type NodeHandler = (node?: ITreeNodeData) => void;
|
|
4
|
+
export type NodeState = {
|
|
5
|
+
expanded: boolean;
|
|
6
|
+
selected: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type TreeActions = {
|
|
9
|
+
expand: NodeHandler;
|
|
10
|
+
select: NodeHandler;
|
|
11
|
+
selectSingle: NodeHandler;
|
|
12
|
+
deselect: NodeHandler;
|
|
13
|
+
};
|
|
14
|
+
export type TreeState = {
|
|
15
|
+
expandedKeys: string[];
|
|
16
|
+
selectedKeys: string[];
|
|
17
|
+
};
|
|
18
|
+
export interface ITreeProps {
|
|
19
|
+
/**
|
|
20
|
+
* Nested Tree Data.
|
|
21
|
+
*/
|
|
22
|
+
treeData: ITreeNodeData[];
|
|
23
|
+
/**
|
|
24
|
+
* A function to customize the structure of the node.
|
|
25
|
+
*/
|
|
26
|
+
renderNode?: RenderNodeHandler;
|
|
27
|
+
/**
|
|
28
|
+
* an event listener when a node is expanded inside the tree
|
|
29
|
+
*/
|
|
30
|
+
onExpandNode?: (expandedKeys: string[]) => void;
|
|
31
|
+
/**
|
|
32
|
+
* expanded keys of the tree.
|
|
33
|
+
*/
|
|
34
|
+
expandedKeys?: string[];
|
|
35
|
+
/**
|
|
36
|
+
* node search query
|
|
37
|
+
*/
|
|
38
|
+
searchQuery?: string;
|
|
39
|
+
/**
|
|
40
|
+
* expand condition
|
|
41
|
+
*/
|
|
42
|
+
expandCondition?: 'always' | 'when-collapsed';
|
|
43
|
+
/**
|
|
44
|
+
* Hanlder for node click event.
|
|
45
|
+
*/
|
|
46
|
+
onNodeClick?: NodeHandler;
|
|
47
|
+
/**
|
|
48
|
+
* Renders the encapsolated view
|
|
49
|
+
*/
|
|
50
|
+
encapsulated?: boolean;
|
|
51
|
+
}
|
|
52
|
+
export interface ITreeNodeData<T = any> {
|
|
53
|
+
key: string;
|
|
54
|
+
title: string;
|
|
55
|
+
index?: number;
|
|
56
|
+
subtitle?: string;
|
|
57
|
+
options?: {
|
|
58
|
+
selectable?: boolean;
|
|
59
|
+
draggable?: boolean;
|
|
60
|
+
focusable?: boolean;
|
|
61
|
+
deletable?: boolean;
|
|
62
|
+
filterable?: boolean;
|
|
63
|
+
};
|
|
64
|
+
icon?: ReactElement | JSX.Element | string;
|
|
65
|
+
children?: ITreeNodeData[];
|
|
66
|
+
invalid?: boolean;
|
|
67
|
+
data?: T;
|
|
68
|
+
}
|
|
69
|
+
export interface TreeNodeProps {
|
|
70
|
+
node: ITreeNodeData;
|
|
71
|
+
expandedKeys: string[];
|
|
72
|
+
selectedKeys: string[];
|
|
73
|
+
actions: TreeActions;
|
|
74
|
+
depth: number;
|
|
75
|
+
searchQuery: string;
|
|
76
|
+
renderNode?: RenderNodeHandler;
|
|
77
|
+
onNodeClick?: NodeHandler;
|
|
78
|
+
}
|
|
79
|
+
export interface ITreeAction {
|
|
80
|
+
name: string;
|
|
81
|
+
icon: ReactElement;
|
|
82
|
+
}
|
|
83
|
+
export interface ITreeIcon {
|
|
84
|
+
size?: number;
|
|
85
|
+
className?: string;
|
|
86
|
+
onClick?: (ev: MouseEvent) => void;
|
|
87
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DependencyList } from 'react';
|
|
2
|
+
import { KeyHandler } from 'hotkeys-js';
|
|
3
|
+
type Options = {
|
|
4
|
+
scope?: string;
|
|
5
|
+
element?: HTMLElement | null;
|
|
6
|
+
keyup?: boolean | null;
|
|
7
|
+
keydown?: boolean | null;
|
|
8
|
+
splitKey?: string;
|
|
9
|
+
preventDefault?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare function useHotkeys(keys: string, callback: KeyHandler, options?: Options): void;
|
|
12
|
+
export declare function useHotkeys(keys: string, callback: KeyHandler, deps?: DependencyList): void;
|
|
13
|
+
export declare function useHotkeys(keys: string, callback: KeyHandler, options?: Options, deps?: DependencyList): void;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function usePrevious<T = any>(value: T): T | undefined;
|