@kwantis-id3/frontend-library 1.0.0-rc.4 → 1.0.0-rc.6
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/changelog.md +32 -0
- package/dist/esm/index.js +173 -81
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/Accordion/Accordion.d.ts +2 -36
- package/dist/esm/types/components/Accordion/AccordionInterfaces.d.ts +21 -0
- package/dist/esm/types/components/Accordion/AccordionStyled.d.ts +19 -10
- package/dist/esm/types/components/Accordion/index.d.ts +2 -1
- package/dist/esm/types/components/Button/Button.d.ts +2 -0
- package/dist/esm/types/components/InputField/InputField.d.ts +0 -2
- package/dist/esm/types/components/TreeView/ControlledTreeView.d.ts +4 -0
- package/dist/esm/types/components/TreeView/TreeUtils.d.ts +3 -0
- package/dist/esm/types/components/TreeView/TreeViewInterfaces.d.ts +78 -0
- package/dist/esm/types/components/TreeView/TreeViewSyled.d.ts +24 -0
- package/dist/esm/types/components/TreeView/UncontrolledTreeView.d.ts +3 -0
- package/dist/esm/types/components/TreeView/index.d.ts +3 -0
- package/dist/esm/types/components/index.d.ts +2 -1
- package/dist/esm/types/utils/colors.d.ts +12 -2
- package/dist/esm/types/utils/index.d.ts +1 -3
- package/dist/index.d.ts +113 -32
- package/package.json +1 -1
- package/README.md +0 -333
- /package/dist/esm/types/components/InputField/{StyledInputField.d.ts → InputFieldStyled.d.ts} +0 -0
|
@@ -1,37 +1,3 @@
|
|
|
1
|
-
/** @jsxImportSource @emotion/react */
|
|
2
|
-
import { Interpolation } from "@emotion/styled";
|
|
3
1
|
import React from "react";
|
|
4
|
-
import {
|
|
5
|
-
export
|
|
6
|
-
/** Text of the accordion trigger */
|
|
7
|
-
title: string;
|
|
8
|
-
/** Content of the accordion */
|
|
9
|
-
children: React.ReactNode;
|
|
10
|
-
/** Custom trigger component */
|
|
11
|
-
customTrigger?: React.ReactNode;
|
|
12
|
-
/** Works only if uncontrolled (isOpen props is not present) */
|
|
13
|
-
defaultOpen?: boolean;
|
|
14
|
-
/** Color of the accordion */
|
|
15
|
-
color?: string;
|
|
16
|
-
/** Color of the icon */
|
|
17
|
-
iconColor?: string;
|
|
18
|
-
/** Color of the divider */
|
|
19
|
-
dividerColor?: string;
|
|
20
|
-
/** Hide the icon */
|
|
21
|
-
hideIcon?: boolean;
|
|
22
|
-
/** Hide the divider */
|
|
23
|
-
hideDivider?: boolean;
|
|
24
|
-
/** Pass your state value here if the Accordion needs to be Controlled */
|
|
25
|
-
isOpen?: boolean;
|
|
26
|
-
/** Lazy render the content of the accordion */
|
|
27
|
-
isLazy?: boolean;
|
|
28
|
-
/** onClick handler */
|
|
29
|
-
onClick?: () => void;
|
|
30
|
-
/** onOpen handler */
|
|
31
|
-
onOpen?: () => void;
|
|
32
|
-
/** onClose handler */
|
|
33
|
-
onClose?: () => void;
|
|
34
|
-
/** Custom styles */
|
|
35
|
-
sx?: Interpolation<Theme>;
|
|
36
|
-
};
|
|
37
|
-
export declare const Accordion: (props: AccordionProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
2
|
+
import { TAccordionProps } from "./AccordionInterfaces";
|
|
3
|
+
export declare const Accordion: React.FC<TAccordionProps>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from "react";
|
|
2
|
+
export type TAccordionProps = PropsWithChildren & {
|
|
3
|
+
/** Title to be used if no custom trigger is passed */
|
|
4
|
+
title: string;
|
|
5
|
+
/** Pass your state value here if the Accordion needs to be Controlled */
|
|
6
|
+
isOpen?: boolean;
|
|
7
|
+
/** Default open state if the accordion is Uncontrolled */
|
|
8
|
+
defaultOpen?: boolean;
|
|
9
|
+
/** Callback function to be called when the Accordion is clicked */
|
|
10
|
+
onClick?: () => void;
|
|
11
|
+
/** Callback function to be called when the Accordion opens */
|
|
12
|
+
onOpen?: () => void;
|
|
13
|
+
/** Callback function to be called when the Accordion closes */
|
|
14
|
+
onClose?: () => void;
|
|
15
|
+
/** Custom trigger element */
|
|
16
|
+
trigger?: (isOpen: boolean) => React.ReactNode;
|
|
17
|
+
/** Variant of the Accordion. Default has everything wrapped in borders, while light just renders the content and the title without setting colors
|
|
18
|
+
* @default "default"
|
|
19
|
+
*/
|
|
20
|
+
variant?: "default" | "light";
|
|
21
|
+
};
|
|
@@ -1,23 +1,32 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const AccordionGroup: import("@emotion/styled").StyledComponent<{
|
|
2
2
|
theme?: import("@emotion/react").Theme;
|
|
3
3
|
as?: React.ElementType;
|
|
4
|
-
} & {
|
|
5
|
-
$color: string;
|
|
6
4
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
7
|
-
export declare const
|
|
5
|
+
export declare const StyledAccordion: import("@emotion/styled").StyledComponent<{
|
|
8
6
|
theme?: import("@emotion/react").Theme;
|
|
9
7
|
as?: React.ElementType;
|
|
10
8
|
} & {
|
|
11
|
-
$
|
|
12
|
-
$
|
|
9
|
+
$variant: "default" | "light";
|
|
10
|
+
$isOpen: boolean;
|
|
13
11
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
14
|
-
export declare const
|
|
12
|
+
export declare const StyledAccordionHeader: import("@emotion/styled").StyledComponent<{
|
|
15
13
|
theme?: import("@emotion/react").Theme;
|
|
16
14
|
as?: React.ElementType;
|
|
17
15
|
} & {
|
|
18
|
-
$
|
|
16
|
+
$variant: "default" | "light";
|
|
17
|
+
$isOpen: boolean;
|
|
18
|
+
}, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
|
|
19
|
+
export declare const StyledAccordionContent: import("@emotion/styled").StyledComponent<{
|
|
20
|
+
theme?: import("@emotion/react").Theme;
|
|
21
|
+
as?: React.ElementType;
|
|
22
|
+
} & {
|
|
23
|
+
$isOpen: boolean;
|
|
24
|
+
$variant: "default" | "light";
|
|
25
|
+
$defaultHeight: string;
|
|
19
26
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
20
|
-
export declare const
|
|
27
|
+
export declare const Icon: import("@emotion/styled").StyledComponent<{
|
|
21
28
|
theme?: import("@emotion/react").Theme;
|
|
22
29
|
as?: React.ElementType;
|
|
23
|
-
}
|
|
30
|
+
} & {
|
|
31
|
+
$isOpen: boolean;
|
|
32
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { Accordion
|
|
1
|
+
export { Accordion } from "./Accordion";
|
|
2
|
+
export * from "./AccordionInterfaces";
|
|
@@ -12,6 +12,8 @@ export type ButtonProps = {
|
|
|
12
12
|
sx?: Interpolation<Theme>;
|
|
13
13
|
/** Variant of the button, either `contained`, `outlined` or `text` */
|
|
14
14
|
variant?: ButtonVariants;
|
|
15
|
+
/** The button size; either "large" or "small" */
|
|
16
|
+
size?: "small" | "large";
|
|
15
17
|
/** onClick handler */
|
|
16
18
|
onClick?: () => void;
|
|
17
19
|
className?: string;
|
|
@@ -2,8 +2,6 @@ import React from "react";
|
|
|
2
2
|
interface TextFieldProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
3
3
|
/** Classname given to the container div */
|
|
4
4
|
containerClassName?: string;
|
|
5
|
-
/** Disables the input */
|
|
6
|
-
isDisabled?: boolean;
|
|
7
5
|
/** The color of the input */
|
|
8
6
|
color?: string;
|
|
9
7
|
/** Change the styles of the input field */
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Interpolation, Theme } from "@emotion/react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* A callback to customize how items are rendered
|
|
5
|
+
* @property isOpen: A boolean indicating if the item is expanded
|
|
6
|
+
* @property hasChildren: A boolean indicating if the item has children
|
|
7
|
+
* @property item: the entire item object
|
|
8
|
+
*/
|
|
9
|
+
export type TCustomRenderProps = {
|
|
10
|
+
isOpen: boolean;
|
|
11
|
+
item: TTreeViewItem;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A callback to customize how the content of the items is rendered
|
|
15
|
+
* @extends TCustomRenderProps
|
|
16
|
+
* @property icon: The icon of the item. If the renderIcon callback is provided, this will be the result of that callback
|
|
17
|
+
* @property title: The title of the item. If the renderTitle callback is provided, this will be the result of that callback
|
|
18
|
+
*/
|
|
19
|
+
export type TRenderTriggerProps = TCustomRenderProps & {
|
|
20
|
+
icon: React.ReactNode;
|
|
21
|
+
title: React.ReactNode;
|
|
22
|
+
};
|
|
23
|
+
type TTreeItemFunctions = {
|
|
24
|
+
/** A callback to customize how the titles are rendered */
|
|
25
|
+
renderTitle?: (props: TCustomRenderProps) => React.ReactNode;
|
|
26
|
+
/** A callback to customize how the icons are rendered */
|
|
27
|
+
renderIcon?: (props: TCustomRenderProps) => React.ReactNode;
|
|
28
|
+
/** A callback to customize how the content of the items is rendered */
|
|
29
|
+
renderTrigger?: (props: TRenderTriggerProps) => React.ReactNode;
|
|
30
|
+
/** A callback executed when an item is focused. An item gets focused when you click on it. Focusing and item will also select it. */
|
|
31
|
+
onFocusItem?: (item: TTreeViewItem) => void;
|
|
32
|
+
/** A callback executed when an item is selected. To select an item, ctrl+click on it. */
|
|
33
|
+
onSelectItems?: (item: string[]) => void;
|
|
34
|
+
/** A callback executed when an item is expanded */
|
|
35
|
+
onExpandItem?: (item: TTreeViewItem) => void;
|
|
36
|
+
/** A callback executed when an item is collapsed */
|
|
37
|
+
onCollapseItem?: (item: TTreeViewItem) => void;
|
|
38
|
+
/** A callback to handle the expansion of items without children */
|
|
39
|
+
onMissingChildren?: (item: TTreeViewItem) => void;
|
|
40
|
+
};
|
|
41
|
+
type TTreeViewProps = TTreeItemFunctions & {
|
|
42
|
+
/** An array representing the items that the tree needs to render */
|
|
43
|
+
items: TTreeViewItem[];
|
|
44
|
+
/** Disable multi-selection possibility */
|
|
45
|
+
isMultiSelectionDisabled?: boolean;
|
|
46
|
+
/** Custom styles */
|
|
47
|
+
sx?: Interpolation<Theme>;
|
|
48
|
+
};
|
|
49
|
+
export type TUncontrolledTreeViewProps = TTreeViewProps & {
|
|
50
|
+
items: TTreeViewItem[];
|
|
51
|
+
};
|
|
52
|
+
export type TControlledTreeViewProps = TTreeViewProps & {
|
|
53
|
+
/** The current state of the Tree View. */
|
|
54
|
+
viewState: TViewState;
|
|
55
|
+
};
|
|
56
|
+
export type TViewState = {
|
|
57
|
+
/** The list of ids of items that are selected */
|
|
58
|
+
selectedItems?: string[];
|
|
59
|
+
/** The list of ids of items that are expanded */
|
|
60
|
+
expandedItems?: string[];
|
|
61
|
+
/** The focused item */
|
|
62
|
+
focusedItem?: string;
|
|
63
|
+
};
|
|
64
|
+
export type TTreeViewItem = TTreeItemFunctions & {
|
|
65
|
+
/** Item identifier */
|
|
66
|
+
id: string;
|
|
67
|
+
/** Item name */
|
|
68
|
+
name: string;
|
|
69
|
+
/** The possible children of this item */
|
|
70
|
+
children?: string[];
|
|
71
|
+
/** If the item should be rendered as a folder even with no children */
|
|
72
|
+
isFolder?: boolean;
|
|
73
|
+
/** A callback to fetch children asynchronously */
|
|
74
|
+
childrenAsync?: () => Promise<TTreeViewItem[]>;
|
|
75
|
+
/** Custom styles */
|
|
76
|
+
sx?: Interpolation<Theme>;
|
|
77
|
+
};
|
|
78
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const TreeView: import("@emotion/styled").StyledComponent<{
|
|
2
|
+
theme?: import("@emotion/react").Theme;
|
|
3
|
+
as?: React.ElementType;
|
|
4
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
5
|
+
export declare const TreeItemsWrapper: import("@emotion/styled").StyledComponent<{
|
|
6
|
+
theme?: import("@emotion/react").Theme;
|
|
7
|
+
as?: React.ElementType;
|
|
8
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, {}>;
|
|
9
|
+
export declare const TreeItemTrigger: import("@emotion/styled").StyledComponent<{
|
|
10
|
+
theme?: import("@emotion/react").Theme;
|
|
11
|
+
as?: React.ElementType;
|
|
12
|
+
} & {
|
|
13
|
+
$isFocused: boolean;
|
|
14
|
+
$isExpanded: boolean;
|
|
15
|
+
$isSelected: boolean;
|
|
16
|
+
}, import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, {}>;
|
|
17
|
+
export declare const TreeItemChildren: import("@emotion/styled").StyledComponent<{
|
|
18
|
+
theme?: import("@emotion/react").Theme;
|
|
19
|
+
as?: React.ElementType;
|
|
20
|
+
} & import("react").ClassAttributes<HTMLUListElement> & import("react").HTMLAttributes<HTMLUListElement> & {
|
|
21
|
+
theme?: import("@emotion/react").Theme;
|
|
22
|
+
} & {
|
|
23
|
+
$isExpanded: boolean;
|
|
24
|
+
}, {}, {}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Button, ButtonProps } from "./Button";
|
|
2
2
|
export * from "./ThemeContext";
|
|
3
|
-
export { Accordion,
|
|
3
|
+
export { Accordion, TAccordionProps } from "./Accordion";
|
|
4
4
|
export { InputField } from "./InputField";
|
|
5
5
|
export { SingleSelect, SingleSelectProps, MultiSelect, MultiSelectProps, } from "./SelectFilter";
|
|
6
6
|
export { Slider, SliderProps } from "./Slider";
|
|
@@ -11,3 +11,4 @@ export { Tag, TTagProps } from "./Tag";
|
|
|
11
11
|
export { Card, CardHeader, CardContent, CardFooter, CardIndicators, CardMediaSection, TCardSectionProps, } from "./Card";
|
|
12
12
|
export { Table, renderCell, TTableProps, TTableCell, TCellValues, TTableRow, } from "./Table";
|
|
13
13
|
export { MultiViewList, TMultiViewListProps } from "./MultiViewList";
|
|
14
|
+
export { ControlledTreeView, UncontrolledTreeView, TControlledTreeViewProps, TUncontrolledTreeViewProps, TViewState, TTreeViewItem, TCustomRenderProps, } from "./TreeView";
|
|
@@ -6,15 +6,25 @@
|
|
|
6
6
|
export declare const getContrastColor: (color: string) => string;
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
9
|
-
* @param color
|
|
9
|
+
* @param color a color
|
|
10
10
|
* @param strength the strength (0-100) to darken the color
|
|
11
11
|
* @returns the color darkened by the strength
|
|
12
12
|
*/
|
|
13
13
|
export declare const darkenColor: (color: string, strength?: number) => string;
|
|
14
14
|
/**
|
|
15
15
|
*
|
|
16
|
-
* @param color
|
|
16
|
+
* @param color a color
|
|
17
17
|
* @param strength the strength (0-100) to lighten the color
|
|
18
18
|
* @returns the color lightened by the strength
|
|
19
19
|
*/
|
|
20
20
|
export declare const lightenColor: (color: string, strength?: number) => string;
|
|
21
|
+
/**
|
|
22
|
+
* @param color a color
|
|
23
|
+
* @returns the hover color, based on if the color is dark or light
|
|
24
|
+
*/
|
|
25
|
+
export declare const getHoverColor: (color: string) => string;
|
|
26
|
+
/**
|
|
27
|
+
* @param color a color
|
|
28
|
+
* @returns the active color, based on if the color is dark or light
|
|
29
|
+
*/
|
|
30
|
+
export declare const getActiveColor: (color: string) => string;
|
|
@@ -2,6 +2,4 @@ import useIsMobile from "./isMobile";
|
|
|
2
2
|
export { transientOptions } from "./transientOptions";
|
|
3
3
|
export { styled } from "./styled";
|
|
4
4
|
export { useIsMobile };
|
|
5
|
-
export { getContrastColor } from "./colors";
|
|
6
|
-
export { darkenColor } from "./colors";
|
|
7
|
-
export { lightenColor } from "./colors";
|
|
5
|
+
export { getContrastColor, darkenColor, lightenColor, getHoverColor, getActiveColor } from "./colors";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
|
|
2
2
|
import * as React$1 from 'react';
|
|
3
|
-
import React__default, {
|
|
3
|
+
import React__default, { PropsWithChildren, FC } from 'react';
|
|
4
4
|
import { Interpolation, CreateStyled } from '@emotion/styled';
|
|
5
5
|
import { Theme, Interpolation as Interpolation$1 } from '@emotion/react';
|
|
6
6
|
import { ColumnDef } from '@tanstack/react-table';
|
|
@@ -15,6 +15,8 @@ type ButtonProps = {
|
|
|
15
15
|
sx?: Interpolation<Theme>;
|
|
16
16
|
/** Variant of the button, either `contained`, `outlined` or `text` */
|
|
17
17
|
variant?: ButtonVariants;
|
|
18
|
+
/** The button size; either "large" or "small" */
|
|
19
|
+
size?: "small" | "large";
|
|
18
20
|
/** onClick handler */
|
|
19
21
|
onClick?: () => void;
|
|
20
22
|
className?: string;
|
|
@@ -141,45 +143,32 @@ declare const defaultDarkPalette: IPalette;
|
|
|
141
143
|
declare const ThemeContextProvider: ({ palettes, defaultMode, children, }: React__default.PropsWithChildren<IThemeContextProps>) => JSX.Element;
|
|
142
144
|
declare const useThemeContext: () => IThemeContextValue;
|
|
143
145
|
|
|
144
|
-
type
|
|
145
|
-
/**
|
|
146
|
+
type TAccordionProps = PropsWithChildren & {
|
|
147
|
+
/** Title to be used if no custom trigger is passed */
|
|
146
148
|
title: string;
|
|
147
|
-
/** Content of the accordion */
|
|
148
|
-
children: React__default.ReactNode;
|
|
149
|
-
/** Custom trigger component */
|
|
150
|
-
customTrigger?: React__default.ReactNode;
|
|
151
|
-
/** Works only if uncontrolled (isOpen props is not present) */
|
|
152
|
-
defaultOpen?: boolean;
|
|
153
|
-
/** Color of the accordion */
|
|
154
|
-
color?: string;
|
|
155
|
-
/** Color of the icon */
|
|
156
|
-
iconColor?: string;
|
|
157
|
-
/** Color of the divider */
|
|
158
|
-
dividerColor?: string;
|
|
159
|
-
/** Hide the icon */
|
|
160
|
-
hideIcon?: boolean;
|
|
161
|
-
/** Hide the divider */
|
|
162
|
-
hideDivider?: boolean;
|
|
163
149
|
/** Pass your state value here if the Accordion needs to be Controlled */
|
|
164
150
|
isOpen?: boolean;
|
|
165
|
-
/**
|
|
166
|
-
|
|
167
|
-
/**
|
|
151
|
+
/** Default open state if the accordion is Uncontrolled */
|
|
152
|
+
defaultOpen?: boolean;
|
|
153
|
+
/** Callback function to be called when the Accordion is clicked */
|
|
168
154
|
onClick?: () => void;
|
|
169
|
-
/**
|
|
155
|
+
/** Callback function to be called when the Accordion opens */
|
|
170
156
|
onOpen?: () => void;
|
|
171
|
-
/**
|
|
157
|
+
/** Callback function to be called when the Accordion closes */
|
|
172
158
|
onClose?: () => void;
|
|
173
|
-
/** Custom
|
|
174
|
-
|
|
159
|
+
/** Custom trigger element */
|
|
160
|
+
trigger?: (isOpen: boolean) => React__default.ReactNode;
|
|
161
|
+
/** Variant of the Accordion. Default has everything wrapped in borders, while light just renders the content and the title without setting colors
|
|
162
|
+
* @default "default"
|
|
163
|
+
*/
|
|
164
|
+
variant?: "default" | "light";
|
|
175
165
|
};
|
|
176
|
-
|
|
166
|
+
|
|
167
|
+
declare const Accordion: React__default.FC<TAccordionProps>;
|
|
177
168
|
|
|
178
169
|
interface TextFieldProps extends React__default.InputHTMLAttributes<HTMLInputElement> {
|
|
179
170
|
/** Classname given to the container div */
|
|
180
171
|
containerClassName?: string;
|
|
181
|
-
/** Disables the input */
|
|
182
|
-
isDisabled?: boolean;
|
|
183
172
|
/** The color of the input */
|
|
184
173
|
color?: string;
|
|
185
174
|
/** Change the styles of the input field */
|
|
@@ -456,6 +445,88 @@ type TMultiViewListProps<Cell extends TCellValues, Row extends TTableRow<Cell>>
|
|
|
456
445
|
|
|
457
446
|
declare const MultiViewList: <Cell extends TCellValues, Row extends TTableRow<Cell>>(props: TMultiViewListProps<Cell, Row>) => _emotion_react_jsx_runtime.JSX.Element;
|
|
458
447
|
|
|
448
|
+
/**
|
|
449
|
+
* A callback to customize how items are rendered
|
|
450
|
+
* @property isOpen: A boolean indicating if the item is expanded
|
|
451
|
+
* @property hasChildren: A boolean indicating if the item has children
|
|
452
|
+
* @property item: the entire item object
|
|
453
|
+
*/
|
|
454
|
+
type TCustomRenderProps = {
|
|
455
|
+
isOpen: boolean;
|
|
456
|
+
item: TTreeViewItem;
|
|
457
|
+
};
|
|
458
|
+
/**
|
|
459
|
+
* A callback to customize how the content of the items is rendered
|
|
460
|
+
* @extends TCustomRenderProps
|
|
461
|
+
* @property icon: The icon of the item. If the renderIcon callback is provided, this will be the result of that callback
|
|
462
|
+
* @property title: The title of the item. If the renderTitle callback is provided, this will be the result of that callback
|
|
463
|
+
*/
|
|
464
|
+
type TRenderTriggerProps = TCustomRenderProps & {
|
|
465
|
+
icon: React__default.ReactNode;
|
|
466
|
+
title: React__default.ReactNode;
|
|
467
|
+
};
|
|
468
|
+
type TTreeItemFunctions = {
|
|
469
|
+
/** A callback to customize how the titles are rendered */
|
|
470
|
+
renderTitle?: (props: TCustomRenderProps) => React__default.ReactNode;
|
|
471
|
+
/** A callback to customize how the icons are rendered */
|
|
472
|
+
renderIcon?: (props: TCustomRenderProps) => React__default.ReactNode;
|
|
473
|
+
/** A callback to customize how the content of the items is rendered */
|
|
474
|
+
renderTrigger?: (props: TRenderTriggerProps) => React__default.ReactNode;
|
|
475
|
+
/** A callback executed when an item is focused. An item gets focused when you click on it. Focusing and item will also select it. */
|
|
476
|
+
onFocusItem?: (item: TTreeViewItem) => void;
|
|
477
|
+
/** A callback executed when an item is selected. To select an item, ctrl+click on it. */
|
|
478
|
+
onSelectItems?: (item: string[]) => void;
|
|
479
|
+
/** A callback executed when an item is expanded */
|
|
480
|
+
onExpandItem?: (item: TTreeViewItem) => void;
|
|
481
|
+
/** A callback executed when an item is collapsed */
|
|
482
|
+
onCollapseItem?: (item: TTreeViewItem) => void;
|
|
483
|
+
/** A callback to handle the expansion of items without children */
|
|
484
|
+
onMissingChildren?: (item: TTreeViewItem) => void;
|
|
485
|
+
};
|
|
486
|
+
type TTreeViewProps = TTreeItemFunctions & {
|
|
487
|
+
/** An array representing the items that the tree needs to render */
|
|
488
|
+
items: TTreeViewItem[];
|
|
489
|
+
/** Disable multi-selection possibility */
|
|
490
|
+
isMultiSelectionDisabled?: boolean;
|
|
491
|
+
/** Custom styles */
|
|
492
|
+
sx?: Interpolation$1<Theme>;
|
|
493
|
+
};
|
|
494
|
+
type TUncontrolledTreeViewProps = TTreeViewProps & {
|
|
495
|
+
items: TTreeViewItem[];
|
|
496
|
+
};
|
|
497
|
+
type TControlledTreeViewProps = TTreeViewProps & {
|
|
498
|
+
/** The current state of the Tree View. */
|
|
499
|
+
viewState: TViewState;
|
|
500
|
+
};
|
|
501
|
+
type TViewState = {
|
|
502
|
+
/** The list of ids of items that are selected */
|
|
503
|
+
selectedItems?: string[];
|
|
504
|
+
/** The list of ids of items that are expanded */
|
|
505
|
+
expandedItems?: string[];
|
|
506
|
+
/** The focused item */
|
|
507
|
+
focusedItem?: string;
|
|
508
|
+
};
|
|
509
|
+
type TTreeViewItem = TTreeItemFunctions & {
|
|
510
|
+
/** Item identifier */
|
|
511
|
+
id: string;
|
|
512
|
+
/** Item name */
|
|
513
|
+
name: string;
|
|
514
|
+
/** The possible children of this item */
|
|
515
|
+
children?: string[];
|
|
516
|
+
/** If the item should be rendered as a folder even with no children */
|
|
517
|
+
isFolder?: boolean;
|
|
518
|
+
/** A callback to fetch children asynchronously */
|
|
519
|
+
childrenAsync?: () => Promise<TTreeViewItem[]>;
|
|
520
|
+
/** Custom styles */
|
|
521
|
+
sx?: Interpolation$1<Theme>;
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
/** @jsxImportSource @emotion/react */
|
|
525
|
+
|
|
526
|
+
declare const ControlledTreeView: FC<TControlledTreeViewProps>;
|
|
527
|
+
|
|
528
|
+
declare const UncontrolledTreeView: FC<TUncontrolledTreeViewProps>;
|
|
529
|
+
|
|
459
530
|
/**
|
|
460
531
|
* Hook to check if the screen is mobile. The default breakpoint is 768px.
|
|
461
532
|
* @param {number=} mobileBreakpoint breakpoint width to check against
|
|
@@ -482,17 +553,27 @@ declare const styled: CreateStyled;
|
|
|
482
553
|
declare const getContrastColor: (color: string) => string;
|
|
483
554
|
/**
|
|
484
555
|
*
|
|
485
|
-
* @param color
|
|
556
|
+
* @param color a color
|
|
486
557
|
* @param strength the strength (0-100) to darken the color
|
|
487
558
|
* @returns the color darkened by the strength
|
|
488
559
|
*/
|
|
489
560
|
declare const darkenColor: (color: string, strength?: number) => string;
|
|
490
561
|
/**
|
|
491
562
|
*
|
|
492
|
-
* @param color
|
|
563
|
+
* @param color a color
|
|
493
564
|
* @param strength the strength (0-100) to lighten the color
|
|
494
565
|
* @returns the color lightened by the strength
|
|
495
566
|
*/
|
|
496
567
|
declare const lightenColor: (color: string, strength?: number) => string;
|
|
568
|
+
/**
|
|
569
|
+
* @param color a color
|
|
570
|
+
* @returns the hover color, based on if the color is dark or light
|
|
571
|
+
*/
|
|
572
|
+
declare const getHoverColor: (color: string) => string;
|
|
573
|
+
/**
|
|
574
|
+
* @param color a color
|
|
575
|
+
* @returns the active color, based on if the color is dark or light
|
|
576
|
+
*/
|
|
577
|
+
declare const getActiveColor: (color: string) => string;
|
|
497
578
|
|
|
498
|
-
export { Accordion,
|
|
579
|
+
export { Accordion, Button, ButtonProps, Card, CardContent, CardFooter, CardHeader, CardIndicators, CardMediaSection, ControlledTreeView, Dropdown, DropdownItem, DropdownProps, IBackgroundColors, ICommonColors, IIndicatorColors, IPalette, IStandardPaletteColor, ITagColors, IThemeContextProps, IThemeContextValue, Indicator, InputField, Modal, MultiSelect, MultiSelectProps, MultiViewList, SingleSelect, SingleSelectProps, Slider, SliderProps, TAccordionProps, TCardSectionProps, TCellValues, TColorScale, TControlledTreeViewProps, TCustomRenderProps, TIndicatorProps, TIndicatorVariants, TMultiViewListProps, TTableCell, TTableProps, TTableRow, TTagProps, TThemeMode, TTreeViewItem, TUncontrolledTreeViewProps, TViewState, Table, Tag, ThemeContextProvider, UncontrolledTreeView, darkenColor, defaultDarkPalette, defaultLightPalette, getActiveColor, getContrastColor, getHoverColor, lightenColor, renderCell, styled, transientOptions, useIsMobile, useThemeContext };
|