@edvisor/product-language 0.4.2 → 0.5.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.
@@ -3,6 +3,7 @@ import { FC } from '@helpers';
3
3
  export interface ICheckboxProps {
4
4
  disabled?: boolean;
5
5
  checked?: boolean;
6
+ indeterminate?: boolean;
6
7
  error?: boolean;
7
8
  className?: string;
8
9
  }
@@ -1,12 +1,12 @@
1
- export declare const getHoverStyles: () => import("styled-components").FlattenInterpolation<import("styled-components").ThemedStyledProps<{
1
+ export declare const getHoverStyles: (indeterminate: boolean) => import("styled-components").FlattenInterpolation<import("styled-components").ThemedStyledProps<{
2
2
  checked?: boolean | undefined;
3
3
  }, any>>;
4
- export declare const getDisabledStyles: () => import("styled-components").FlattenInterpolation<import("styled-components").ThemedStyledProps<{
4
+ export declare const getDisabledStyles: (indeterminate: boolean) => import("styled-components").FlattenInterpolation<import("styled-components").ThemedStyledProps<{
5
5
  checked?: boolean | undefined;
6
6
  }, any>>;
7
- export declare const getDefaultStyles: () => import("styled-components").FlattenInterpolation<import("styled-components").ThemedStyledProps<{
7
+ export declare const getDefaultStyles: (indeterminate: boolean) => import("styled-components").FlattenInterpolation<import("styled-components").ThemedStyledProps<{
8
8
  checked?: boolean | undefined;
9
9
  }, any>>;
10
- export declare const getInvalidStyles: () => import("styled-components").FlattenInterpolation<import("styled-components").ThemedStyledProps<{
10
+ export declare const getInvalidStyles: (indeterminate: boolean) => import("styled-components").FlattenInterpolation<import("styled-components").ThemedStyledProps<{
11
11
  checked?: boolean | undefined;
12
12
  }, any>>;
@@ -14,5 +14,6 @@ export * from './icon';
14
14
  export * from './flag';
15
15
  export * from './spinner';
16
16
  export * from './select';
17
+ export * from './tree-view';
17
18
  export * from './molecules';
18
19
  export * from './organisms';
@@ -3,6 +3,5 @@ import { FC } from '@helpers';
3
3
  export declare type IInputCheckboxProps = InputHTMLAttributes<HTMLInputElement> & {
4
4
  label: string;
5
5
  error?: boolean;
6
- onChange?: (change: boolean) => void;
7
6
  };
8
7
  export declare const InputCheckbox: FC<IInputCheckboxProps>;
@@ -0,0 +1,3 @@
1
+ import { FC } from '@helpers';
2
+ import { IMenuComponentProps } from '../types';
3
+ export declare const MenuList: FC<IMenuComponentProps>;
@@ -5,6 +5,9 @@ interface IOptionItemProps {
5
5
  selected?: IOptionComponentProps['selected'];
6
6
  height?: IOptionComponentProps['height'];
7
7
  }
8
- export declare const OptionItem: import("styled-components").StyledComponent<"div", any, IOptionItemProps, never>;
8
+ export declare const OptionItem: import("styled-components").StyledComponent<"div", any, {
9
+ column?: boolean | undefined;
10
+ center?: boolean | undefined;
11
+ } & IOptionItemProps, never>;
9
12
  export declare const OptionComponent: import("react").MemoExoticComponent<(props: IOptionComponentProps) => JSX.Element>;
10
13
  export {};
@@ -1 +1,3 @@
1
1
  export * from './select';
2
+ export * from './components/menu-list';
3
+ export { IOption } from './types';
@@ -1,9 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import { PropsWithChildren } from '@helpers';
3
3
  import { ISelectProps } from './types';
4
- export declare const SelectImpl: <T>(props: ISelectProps<T>, ref: React.ForwardedRef<HTMLDivElement>) => JSX.Element;
4
+ declare const SelectImpl: <T>(props: ISelectProps<T>, selectRef: React.ForwardedRef<HTMLDivElement>) => JSX.Element;
5
5
  export declare const Select: <T>(props: ISelectProps<T> & {
6
6
  children?: import("react").ReactNode;
7
7
  } & {
8
8
  ref?: import("react").ForwardedRef<HTMLDivElement> | undefined;
9
9
  }) => ReturnType<typeof SelectImpl>;
10
+ export {};
@@ -17,6 +17,7 @@ export interface ISelectProps<T = any> {
17
17
  rowHeight?: number;
18
18
  menuHeight?: number;
19
19
  menuPosition?: 'top' | 'bottom';
20
+ menuTitle?: string;
20
21
  label?: string;
21
22
  labelPosition?: 'top' | 'side';
22
23
  labelComponent?: FC<LabelComponentProps<T>>;
@@ -62,12 +63,6 @@ export interface IMenuContainerProps {
62
63
  onClick?(el: React.MouseEvent<HTMLDivElement>): void;
63
64
  }
64
65
  declare type RectSize = number | 'auto';
65
- export interface IRect {
66
- left: number;
67
- top: number;
68
- width: RectSize;
69
- height: RectSize;
70
- }
71
66
  export interface IValueComponentMultiProps<T = any> extends IValueComponentSingleProps<T> {
72
67
  options: IOption<T>[];
73
68
  onRemove(value: T): void;
@@ -113,6 +108,7 @@ export interface IMenuComponentProps<T = any> {
113
108
  search?: string;
114
109
  labelPosition?: string;
115
110
  label?: string;
111
+ menuTitle?: string;
116
112
  onSelect(value: T extends any[] ? T[] : T, option?: T): void;
117
113
  }
118
114
  export interface IPosition {
@@ -121,4 +117,16 @@ export interface IPosition {
121
117
  label?: string;
122
118
  labelPosition?: string;
123
119
  }
120
+ export declare const DEFAULT_ROW_HEIGHT = 44;
121
+ export declare const DEFAULT_MENU_HEIGHT = 190;
122
+ export declare const DEFAULT_EMPTY_TEXT = "No results found";
123
+ export declare const DEFAULT_PLACEHOLDER = "Select Something";
124
+ export declare const enum menuPositionType {
125
+ TOP = "top",
126
+ BOTTOM = "bottom"
127
+ }
128
+ export declare const enum labelPositionType {
129
+ TOP = "top",
130
+ SIDE = "side"
131
+ }
124
132
  export {};
@@ -0,0 +1,3 @@
1
+ import { FC, PropsWithChildren } from '@helpers';
2
+ import { ITreeNode } from '../types';
3
+ export declare const TreeNode: FC<PropsWithChildren<ITreeNode>>;
@@ -0,0 +1,12 @@
1
+ import { INode, IFlattenNode, CheckboxState } from './types';
2
+ export declare const flattenNodes: (flattenList: IFlattenNode[], nodes: INode[], parent?: INode, depth?: number) => void;
3
+ export declare const getNode: (nodes: IFlattenNode[], value: string) => IFlattenNode | undefined;
4
+ export declare const deserializeList: (flatNodes: IFlattenNode[], lists: {
5
+ checked: string[];
6
+ expanded: string[];
7
+ }) => void;
8
+ export declare const serializeList: (flatNodes: IFlattenNode[], key: string) => string[];
9
+ export declare const expandAllNodes: (flatNodes: IFlattenNode[], expand: boolean) => void;
10
+ export declare const toggleChecked: (flatNodes: IFlattenNode[], node: INode, isChecked: boolean) => void;
11
+ export declare const toggleNode: (flatNodes: IFlattenNode[], nodeValue: string, key: string, toggleValue: boolean) => void;
12
+ export declare const getNodeCheckState: (flattenNodeList: IFlattenNode[], node: INode) => CheckboxState;
@@ -0,0 +1,2 @@
1
+ export * from './tree-view';
2
+ export { INode, ICheckNode, IExpandNode } from './types';
@@ -0,0 +1,3 @@
1
+ import { FC, PropsWithChildren } from '@helpers';
2
+ import { ITreeViewProps } from './types';
3
+ export declare const TreeView: FC<PropsWithChildren<ITreeViewProps>>;
@@ -0,0 +1,62 @@
1
+ import { ReactNode } from 'react';
2
+ export interface INode {
3
+ label: string;
4
+ value: string;
5
+ helpfulMessage?: string;
6
+ disabled?: boolean;
7
+ invalid?: boolean;
8
+ children?: INode[];
9
+ }
10
+ export interface IFlattenNode extends INode {
11
+ parent?: INode;
12
+ isChild: boolean;
13
+ isParent: boolean;
14
+ isLeaf: boolean;
15
+ treeDepth: number;
16
+ index: number;
17
+ checked: boolean;
18
+ checkState: number;
19
+ expanded: boolean;
20
+ }
21
+ export interface ITreeViewProps {
22
+ checkedList: string[];
23
+ nodes: INode[];
24
+ expanded?: string[];
25
+ className?: string;
26
+ title?: string;
27
+ showChildCount?: boolean;
28
+ expandDisabled?: boolean;
29
+ onCheck: (checked: string[], node?: ICheckNode) => void;
30
+ onClick?: (node: ICheckNode) => void;
31
+ onExpand?: (expanded: string[], node?: IExpandNode) => void;
32
+ }
33
+ export interface ITreeNode {
34
+ checkState: number;
35
+ disabled: boolean;
36
+ expanded: boolean;
37
+ isParent: boolean;
38
+ isLeaf: boolean;
39
+ expandDisabled: boolean;
40
+ label: string;
41
+ value: string;
42
+ children: ReactNode;
43
+ treeId: string;
44
+ invalid: boolean;
45
+ childCount: number;
46
+ showChildCount: boolean;
47
+ helpfulMessage?: string;
48
+ onCheck: (node: ICheckNode) => void;
49
+ onClick: (node: ICheckNode) => void;
50
+ onExpand: (node: IExpandNode) => void;
51
+ }
52
+ export interface ICheckNode extends INode {
53
+ checked: boolean;
54
+ }
55
+ export interface IExpandNode extends INode {
56
+ expanded: boolean;
57
+ }
58
+ export declare enum CheckboxState {
59
+ UNCHECKED = 0,
60
+ CHECKED = 1,
61
+ INDETERMINATE = 2
62
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edvisor/product-language",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "license": "MIT",
5
5
  "description": "Edvisor.io product-language components",
6
6
  "repository": "https://github.com/edvisor-io/front-end/",