@internxt/ui 0.0.25
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 +69 -0
- package/dist/components/avatar/Avatar.d.ts +29 -0
- package/dist/components/avatar/components/DefaultAvatar.d.ts +5 -0
- package/dist/components/avatar/components/PictureAvatar.d.ts +6 -0
- package/dist/components/avatar/index.d.ts +1 -0
- package/dist/components/baseDialog/BaseDialog.d.ts +62 -0
- package/dist/components/baseDialog/index.d.ts +2 -0
- package/dist/components/breadcrumbs/Breadcrumbs.d.ts +68 -0
- package/dist/components/breadcrumbs/BreadcrumbsItem.d.ts +91 -0
- package/dist/components/breadcrumbs/index.d.ts +3 -0
- package/dist/components/button/Button.d.ts +75 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/buttonCircle/CircleButton.d.ts +19 -0
- package/dist/components/buttonCircle/index.d.ts +2 -0
- package/dist/components/card/Card.d.ts +17 -0
- package/dist/components/card/index.d.ts +1 -0
- package/dist/components/checkbox/Checkbox.d.ts +46 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/contextMenu/ContextMenu.d.ts +56 -0
- package/dist/components/contextMenu/index.d.ts +2 -0
- package/dist/components/copyable/Copyable.d.ts +27 -0
- package/dist/components/copyable/index.d.ts +2 -0
- package/dist/components/dialog/Dialog.d.ts +50 -0
- package/dist/components/dialog/index.d.ts +2 -0
- package/dist/components/dropdown/Dropdown.d.ts +20 -0
- package/dist/components/dropdown/index.d.ts +2 -0
- package/dist/components/empty/Empty.d.ts +40 -0
- package/dist/components/empty/index.d.ts +2 -0
- package/dist/components/header/Header.d.ts +24 -0
- package/dist/components/header/index.d.ts +2 -0
- package/dist/components/index.d.ts +28 -0
- package/dist/components/infiniteScroll/InfiniteScroll.d.ts +45 -0
- package/dist/components/infiniteScroll/index.d.ts +2 -0
- package/dist/components/input/Input.d.ts +115 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/list/List.d.ts +135 -0
- package/dist/components/list/ListHeader.d.ts +33 -0
- package/dist/components/list/ListItem.d.ts +25 -0
- package/dist/components/list/index.d.ts +2 -0
- package/dist/components/loader/Loader.d.ts +40 -0
- package/dist/components/loader/index.d.ts +2 -0
- package/dist/components/menu/Menu.d.ts +72 -0
- package/dist/components/menu/index.d.ts +2 -0
- package/dist/components/modal/Modal.d.ts +53 -0
- package/dist/components/modal/index.d.ts +2 -0
- package/dist/components/modalTransparent/TransparentModal.d.ts +11 -0
- package/dist/components/modalTransparent/index.d.ts +2 -0
- package/dist/components/popover/Popover.d.ts +30 -0
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/radioButton/RadioButton.d.ts +26 -0
- package/dist/components/radioButton/index.d.ts +2 -0
- package/dist/components/skeletonLoader/SkeletonLoader.d.ts +19 -0
- package/dist/components/skeletonLoader/index.d.ts +2 -0
- package/dist/components/slider/RangeSlider.d.ts +56 -0
- package/dist/components/slider/index.d.ts +2 -0
- package/dist/components/switch/Switch.d.ts +33 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/table/Table.d.ts +59 -0
- package/dist/components/table/index.d.ts +6 -0
- package/dist/components/textArea/TextArea.d.ts +36 -0
- package/dist/components/textArea/index.d.ts +2 -0
- package/dist/components/tooltip/Tooltip.d.ts +46 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/hooks/useHotKeys.d.ts +5 -0
- package/dist/index.cjs.js +198 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +6052 -0
- package/dist/index.es.js.map +1 -0
- package/dist/stories/components/avatar/Avatar.stories.d.ts +18 -0
- package/dist/stories/components/baseDialog/BaseDialog.stories.d.ts +9 -0
- package/dist/stories/components/breadcrumbs/breadcrumbs.stories.d.ts +10 -0
- package/dist/stories/components/button/Button.stories.d.ts +12 -0
- package/dist/stories/components/buttonCircle/ButtonCircle.stories.d.ts +25 -0
- package/dist/stories/components/card/Card.stories.d.ts +8 -0
- package/dist/stories/components/checkbox/Checkbox.stories.d.ts +12 -0
- package/dist/stories/components/contextMenu/ContextMenu.stories.d.ts +7 -0
- package/dist/stories/components/copyable/Copyable.stories.d.ts +8 -0
- package/dist/stories/components/dialog/Dialog.stories.d.ts +7 -0
- package/dist/stories/components/dropdown/Dropdown.stories.d.ts +8 -0
- package/dist/stories/components/empty/Empty.stories.d.ts +8 -0
- package/dist/stories/components/header/Header.stories.d.ts +8 -0
- package/dist/stories/components/infiniteScroll/InfiniteScroll.stories.d.ts +8 -0
- package/dist/stories/components/input/Input.stories.d.ts +12 -0
- package/dist/stories/components/list/List.stories.d.ts +13 -0
- package/dist/stories/components/loader/Loader.stories.d.ts +11 -0
- package/dist/stories/components/menu/Menu.stories.d.ts +8 -0
- package/dist/stories/components/modal/Modal.stories.d.ts +7 -0
- package/dist/stories/components/modalTransparent/TransparentModal.stories.d.ts +9 -0
- package/dist/stories/components/popover/Popover.stories.d.ts +7 -0
- package/dist/stories/components/radioButton/RadioButton.stories.d.ts +7 -0
- package/dist/stories/components/skeletonLoader/SkeletonLoader.stories.d.ts +7 -0
- package/dist/stories/components/slider/RangeSlider.stories.d.ts +7 -0
- package/dist/stories/components/switch/Switch.stories.d.ts +9 -0
- package/dist/stories/components/table/Table.stories.d.ts +6 -0
- package/dist/stories/components/textArea/TextArea.stories.d.ts +8 -0
- package/dist/stories/components/tooltip/Tooltip.stories.d.ts +11 -0
- package/package.json +106 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { MenuItemType } from '../';
|
|
3
|
+
|
|
4
|
+
export type DropdownProps<T> = {
|
|
5
|
+
children: ReactNode | ((obj: {
|
|
6
|
+
open: boolean;
|
|
7
|
+
}) => JSX.Element);
|
|
8
|
+
options?: {
|
|
9
|
+
text: string;
|
|
10
|
+
onClick: () => void;
|
|
11
|
+
}[];
|
|
12
|
+
classButton?: string;
|
|
13
|
+
menuItems?: ReactNode[];
|
|
14
|
+
classMenuItems: string;
|
|
15
|
+
openDirection: 'left' | 'right';
|
|
16
|
+
dropdownActionsContext?: Array<MenuItemType<T>>;
|
|
17
|
+
item?: T;
|
|
18
|
+
};
|
|
19
|
+
declare const Dropdown: <T>({ children, options, classButton, menuItems, classMenuItems, openDirection, dropdownActionsContext, item, }: DropdownProps<T>) => JSX.Element;
|
|
20
|
+
export default Dropdown;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Upload } from '@phosphor-icons/react';
|
|
2
|
+
|
|
3
|
+
export interface EmptyProps {
|
|
4
|
+
icon: JSX.Element;
|
|
5
|
+
title: string;
|
|
6
|
+
subtitle: string;
|
|
7
|
+
action?: {
|
|
8
|
+
text: string;
|
|
9
|
+
icon: typeof Upload;
|
|
10
|
+
style: 'plain' | 'elevated';
|
|
11
|
+
onClick: () => void;
|
|
12
|
+
};
|
|
13
|
+
contextMenuClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Empty component
|
|
17
|
+
*
|
|
18
|
+
* This component is used to display a message or placeholder content when there is no data or items available.
|
|
19
|
+
* It allows for a customizable icon, title, subtitle, and an optional action button.
|
|
20
|
+
*
|
|
21
|
+
* @property {JSX.Element} icon
|
|
22
|
+
* - The icon to be displayed at the top of the component. This can be any valid React element.
|
|
23
|
+
*
|
|
24
|
+
* @property {string} title
|
|
25
|
+
* - The main title or heading to be displayed in the component.
|
|
26
|
+
*
|
|
27
|
+
* @property {string} subtitle
|
|
28
|
+
* - A secondary subtitle or description.
|
|
29
|
+
*
|
|
30
|
+
* @property {object} [action]
|
|
31
|
+
* - An optional object containing details for an action button that can be displayed.
|
|
32
|
+
*
|
|
33
|
+
* @property {string} action.text
|
|
34
|
+
* - The text to display on the action button.
|
|
35
|
+
*
|
|
36
|
+
* @property {Function} [contextMenuClick]
|
|
37
|
+
* - An optional function to handle right-click (context menu) interactions on the component.
|
|
38
|
+
*/
|
|
39
|
+
declare const Empty: ({ icon, title, subtitle, action, contextMenuClick }: EmptyProps) => JSX.Element;
|
|
40
|
+
export default Empty;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface HeaderProps {
|
|
2
|
+
/**
|
|
3
|
+
* Elements to be rendered on the left side of the header
|
|
4
|
+
*/
|
|
5
|
+
leftContent?: JSX.Element;
|
|
6
|
+
/**
|
|
7
|
+
* Elements to be rendered on the right side of the header
|
|
8
|
+
*/
|
|
9
|
+
rightContent?: JSX.Element;
|
|
10
|
+
/**
|
|
11
|
+
* Optional class name for additional styling
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Header component
|
|
17
|
+
*
|
|
18
|
+
* A flexible header component that can contain any content on its left and right sides.
|
|
19
|
+
*
|
|
20
|
+
* @param {HeaderProps} props - The properties for the Header component
|
|
21
|
+
* @returns {JSX.Element} The rendered Header component
|
|
22
|
+
*/
|
|
23
|
+
declare const Header: ({ leftContent, rightContent, className }: HeaderProps) => JSX.Element;
|
|
24
|
+
export default Header;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export * from './avatar';
|
|
2
|
+
export * from './baseDialog';
|
|
3
|
+
export * from './breadcrumbs';
|
|
4
|
+
export * from './button';
|
|
5
|
+
export * from './buttonCircle';
|
|
6
|
+
export * from './card';
|
|
7
|
+
export * from './checkbox';
|
|
8
|
+
export * from './contextMenu';
|
|
9
|
+
export * from './copyable';
|
|
10
|
+
export * from './dialog';
|
|
11
|
+
export * from './dropdown';
|
|
12
|
+
export * from './empty';
|
|
13
|
+
export * from './header';
|
|
14
|
+
export * from './infiniteScroll';
|
|
15
|
+
export * from './input';
|
|
16
|
+
export * from './list';
|
|
17
|
+
export * from './loader';
|
|
18
|
+
export * from './menu';
|
|
19
|
+
export * from './modal';
|
|
20
|
+
export * from './modalTransparent';
|
|
21
|
+
export * from './popover';
|
|
22
|
+
export * from './radioButton';
|
|
23
|
+
export * from './skeletonLoader';
|
|
24
|
+
export * from './slider';
|
|
25
|
+
export * from './switch';
|
|
26
|
+
export * from './table/Table';
|
|
27
|
+
export * from './textArea';
|
|
28
|
+
export * from './tooltip';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface InfiniteScrollProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
handleNextPage: () => void;
|
|
6
|
+
hasMoreItems: boolean | undefined;
|
|
7
|
+
loader: React.ReactNode;
|
|
8
|
+
scrollableTarget?: string;
|
|
9
|
+
classNameLoader?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* InfiniteScroll component
|
|
13
|
+
*
|
|
14
|
+
* @param {InfiniteScrollProps} props - The properties of the component.
|
|
15
|
+
*
|
|
16
|
+
* @property {ReactNode} children
|
|
17
|
+
* - The child components or elements to be rendered inside the scrollable container.
|
|
18
|
+
*
|
|
19
|
+
* @property {() => void} handleNextPage
|
|
20
|
+
* - A callback function that is triggered when the user reaches the bottom of the container
|
|
21
|
+
* and more items need to be loaded.
|
|
22
|
+
*
|
|
23
|
+
* @property {boolean | undefined} hasMoreItems
|
|
24
|
+
* - A flag indicating whether there are more items to load. If `false`, the loader will not be shown,
|
|
25
|
+
* and no more items will be fetched.
|
|
26
|
+
*
|
|
27
|
+
* @property {React.ReactNode} loader
|
|
28
|
+
* - The content to be shown as a loader while waiting for more items to load.
|
|
29
|
+
*
|
|
30
|
+
* @property {string} [scrollableTarget]
|
|
31
|
+
* - An optional ID of the scrollable container that will be observed for scroll events.
|
|
32
|
+
* If not provided, the default behavior is to observe the entire window.
|
|
33
|
+
*
|
|
34
|
+
* @property {string} [classNameLoader]
|
|
35
|
+
* - An optional custom class name for the loader element, used to style the loader component.
|
|
36
|
+
*
|
|
37
|
+
* @returns {JSX.Element}
|
|
38
|
+
* - A JSX element containing the children with the loader attached to the last item, if there are more items to load.
|
|
39
|
+
*
|
|
40
|
+
* The component uses the `IntersectionObserver` API to detect when the loader element (at the bottom of the list)
|
|
41
|
+
* comes into view. When this happens, it triggers the `handleNextPage` callback to load the next set of items.
|
|
42
|
+
* It also shows the loader element only when there are more items to load (`hasMoreItems` is `true`).
|
|
43
|
+
*/
|
|
44
|
+
declare const InfiniteScroll: ({ children, handleNextPage, hasMoreItems, loader, scrollableTarget, classNameLoader, }: InfiniteScrollProps) => import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
export default InfiniteScroll;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { KeyboardEvent } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface InputProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
variant?: 'default' | 'search' | 'password' | 'email';
|
|
7
|
+
accent?: 'error' | 'warning' | 'success';
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
value?: string;
|
|
11
|
+
maxLength?: number;
|
|
12
|
+
onChange?: (v: string) => void;
|
|
13
|
+
onClear?: () => void;
|
|
14
|
+
onFocus?: () => void;
|
|
15
|
+
onBlur?: () => void;
|
|
16
|
+
message?: string;
|
|
17
|
+
autofocus?: boolean;
|
|
18
|
+
autoComplete?: 'on' | 'off';
|
|
19
|
+
dataTest?: string;
|
|
20
|
+
name?: string;
|
|
21
|
+
required?: boolean;
|
|
22
|
+
labelDataCy?: string;
|
|
23
|
+
inputDataCy?: string;
|
|
24
|
+
onKeyDown?: (e: KeyboardEvent<HTMLInputElement>) => void;
|
|
25
|
+
inputClassName?: string;
|
|
26
|
+
borderRadius?: string;
|
|
27
|
+
fontClasses?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Input component
|
|
31
|
+
*
|
|
32
|
+
* @property {string} [className]
|
|
33
|
+
* - Optional custom class name to be applied to the outermost container of the input.
|
|
34
|
+
*
|
|
35
|
+
* @property {string} [label]
|
|
36
|
+
* - The label for the input field.
|
|
37
|
+
*
|
|
38
|
+
* @property {'default' | 'search' | 'password' | 'email'} [variant]
|
|
39
|
+
* - The variant of the input field. Determines the input type and visual style.
|
|
40
|
+
* - 'default': Regular input field.
|
|
41
|
+
* - 'search': Search field with a magnifying glass icon.
|
|
42
|
+
* - 'password': Password input with an option to toggle visibility.
|
|
43
|
+
* - 'email': Email input with specific email validation.
|
|
44
|
+
*
|
|
45
|
+
* @property {'error' | 'warning' | 'success'} [accent]
|
|
46
|
+
* - Optional accent color for the input border and message.
|
|
47
|
+
* - 'error': Red border and error message.
|
|
48
|
+
* - 'warning': Orange border and warning message.
|
|
49
|
+
* - 'success': Green border and success message.
|
|
50
|
+
*
|
|
51
|
+
* @property {boolean} [disabled]
|
|
52
|
+
* - If true, disables the input field, preventing user interaction.
|
|
53
|
+
*
|
|
54
|
+
* @property {string} [placeholder]
|
|
55
|
+
* - The placeholder text displayed inside the input when it is empty.
|
|
56
|
+
*
|
|
57
|
+
* @property {string} [value]
|
|
58
|
+
* - The current value of the input field.
|
|
59
|
+
*
|
|
60
|
+
* @property {number} [maxLength]
|
|
61
|
+
* - Maximum number of characters allowed in the input field.
|
|
62
|
+
*
|
|
63
|
+
* @property {(v: string) => void} [onChange]
|
|
64
|
+
* - Callback function that is called whenever the input value changes.
|
|
65
|
+
*
|
|
66
|
+
* @property {() => void} [onClear]
|
|
67
|
+
* - Callback function that is called when the clear button is clicked in the search variant.
|
|
68
|
+
*
|
|
69
|
+
* @property {() => void} [onFocus]
|
|
70
|
+
* - Callback function that is called when the input gains focus.
|
|
71
|
+
*
|
|
72
|
+
* @property {() => void} [onBlur]
|
|
73
|
+
* - Callback function that is called when the input loses focus.
|
|
74
|
+
*
|
|
75
|
+
* @property {string} [message]
|
|
76
|
+
* - Optional message displayed below the input. Used for feedback like error or success.
|
|
77
|
+
*
|
|
78
|
+
* @property {boolean} [autofocus]
|
|
79
|
+
* - If true, the input will automatically gain focus when the component is rendered.
|
|
80
|
+
*
|
|
81
|
+
* @property {'on' | 'off'} [autoComplete]
|
|
82
|
+
* - Controls the auto-completion behavior of the input. Defaults to 'on'.
|
|
83
|
+
*
|
|
84
|
+
* @property {string} [dataTest]
|
|
85
|
+
* - Optional data attribute for testing purposes, used for targeting the input element in tests.
|
|
86
|
+
*
|
|
87
|
+
* @property {string} [name]
|
|
88
|
+
* - The name attribute of the input field, used in form submissions.
|
|
89
|
+
*
|
|
90
|
+
* @property {boolean} [required]
|
|
91
|
+
* - If true, the input is marked as required for form validation.
|
|
92
|
+
*
|
|
93
|
+
* @property {string} [labelDataCy]
|
|
94
|
+
* - Optional data attribute for targeting the label element in tests.
|
|
95
|
+
*
|
|
96
|
+
* @property {string} [inputDataCy]
|
|
97
|
+
* - Optional data attribute for targeting the input element itself in tests.
|
|
98
|
+
*
|
|
99
|
+
* @property {string} [inputClassName]
|
|
100
|
+
* - Optional custom class name to be applied directly to the input element.
|
|
101
|
+
* - These classes will be added after the default classes and can override them.
|
|
102
|
+
*
|
|
103
|
+
* @property {string} [borderRadius='rounded-md']
|
|
104
|
+
* - Optional Tailwind class to control the border radius of the input.
|
|
105
|
+
* - Defaults to 'rounded-md' if not specified.
|
|
106
|
+
*
|
|
107
|
+
* @property {string} [fontClasses='text-lg font-normal']
|
|
108
|
+
* - Optional Tailwind class to control the font size and font weight of the input.
|
|
109
|
+
* - Defaults to 'text-lg font-normal' if not specified.
|
|
110
|
+
*
|
|
111
|
+
* @property {(e: KeyboardEvent<HTMLInputElement>) => void} [onKeyDown]
|
|
112
|
+
* - Callback function for handling keydown events in the input field.
|
|
113
|
+
*/
|
|
114
|
+
declare const Input: ({ className, label, variant, accent, disabled, placeholder, value, maxLength, onChange, onClear, message, onFocus, onBlur, autofocus, autoComplete, dataTest, name, required, labelDataCy, inputDataCy, onKeyDown, inputClassName, borderRadius, fontClasses, }: InputProps) => JSX.Element;
|
|
115
|
+
export default Input;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { HeaderProps } from './ListHeader';
|
|
3
|
+
import { MenuItemsType } from '../menu/Menu';
|
|
4
|
+
|
|
5
|
+
export interface ListProps<T, F> {
|
|
6
|
+
header: HeaderProps<T, F>[];
|
|
7
|
+
checkboxDataCy?: string;
|
|
8
|
+
items: T[];
|
|
9
|
+
itemComposition: Array<(props: T) => JSX.Element>;
|
|
10
|
+
selectedItems: T[];
|
|
11
|
+
onClick?: (props: T) => void;
|
|
12
|
+
onDoubleClick?: (props: T) => void;
|
|
13
|
+
onEnterPressed?: (props: T) => void;
|
|
14
|
+
onSelectedItemsChanged: (changes: {
|
|
15
|
+
props: T;
|
|
16
|
+
value: boolean;
|
|
17
|
+
}[]) => void;
|
|
18
|
+
isLoading?: boolean;
|
|
19
|
+
forceLoading?: boolean;
|
|
20
|
+
skinSkeleton?: Array<JSX.Element>;
|
|
21
|
+
emptyState?: ReactNode;
|
|
22
|
+
onNextPage?: () => void;
|
|
23
|
+
onOrderByChanged?: (value: {
|
|
24
|
+
field: F;
|
|
25
|
+
direction: 'ASC' | 'DESC';
|
|
26
|
+
}) => void;
|
|
27
|
+
orderBy?: {
|
|
28
|
+
field: F;
|
|
29
|
+
direction: 'ASC' | 'DESC';
|
|
30
|
+
};
|
|
31
|
+
hasMoreItems?: boolean;
|
|
32
|
+
menu?: MenuItemsType<T>;
|
|
33
|
+
displayMenuDiv?: boolean;
|
|
34
|
+
className?: string;
|
|
35
|
+
keyboardShortcuts?: Array<'selectAll' | 'unselectAll' | 'multiselect' | Array<'delete' & (() => void)>>;
|
|
36
|
+
disableKeyboardShortcuts?: boolean;
|
|
37
|
+
disableItemCompositionStyles?: boolean;
|
|
38
|
+
onMouseEnter?: () => void;
|
|
39
|
+
onMouseLeave?: () => void;
|
|
40
|
+
keyBoardShortcutActions?: {
|
|
41
|
+
onShiftFKeysPressed?: () => void;
|
|
42
|
+
onRKeyPressed?: () => void;
|
|
43
|
+
onBackspaceKeyPressed?: () => void;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* List component
|
|
48
|
+
*
|
|
49
|
+
* @property {HeaderProps<T, F>[]} header
|
|
50
|
+
* - Array of headers for the list. Each header defines the properties of the columns displayed.
|
|
51
|
+
*
|
|
52
|
+
* @property {string} [checkboxDataCy]
|
|
53
|
+
* - Optional `data-cy` attribute used for testing checkboxes in the list.
|
|
54
|
+
*
|
|
55
|
+
* @property {T[]} items
|
|
56
|
+
* - Array of items to be displayed in the list. Each item corresponds to the data for each row.
|
|
57
|
+
*
|
|
58
|
+
* @property {(props: T) => JSX.Element}[] itemComposition
|
|
59
|
+
* - Array of functions that return JSX elements for rendering each item in the list.
|
|
60
|
+
*
|
|
61
|
+
* @property {T[]} selectedItems
|
|
62
|
+
* - Array of selected items.
|
|
63
|
+
*
|
|
64
|
+
* @property {(props: T) => void} [onClick]
|
|
65
|
+
* - Optional callback triggered when an item is clicked.
|
|
66
|
+
*
|
|
67
|
+
* @property {(props: T) => void} [onDoubleClick]
|
|
68
|
+
* - Optional callback triggered when an item is double-clicked.
|
|
69
|
+
*
|
|
70
|
+
* @property {(props: T) => void} [onEnterPressed]
|
|
71
|
+
* - Optional callback triggered when the Enter key is pressed on an item.
|
|
72
|
+
*
|
|
73
|
+
* @property {(changes: { props: T; value: boolean }[]) => void} onSelectedItemsChanged
|
|
74
|
+
* - Callback triggered when the selection state of the items changes.
|
|
75
|
+
*
|
|
76
|
+
* @property {boolean} [isLoading]
|
|
77
|
+
* - Optional flag indicating if the list is loading. If true, a loading state will be shown.
|
|
78
|
+
*
|
|
79
|
+
* @property {boolean} [forceLoading]
|
|
80
|
+
* - Optional flag to force the loading state, even if no items are loading.
|
|
81
|
+
*
|
|
82
|
+
* @property {JSX.Element[]} [skinSkeleton]
|
|
83
|
+
* - Optional array of skeleton elements to be displayed while the list is loading.
|
|
84
|
+
*
|
|
85
|
+
* @property {ReactNode} [emptyState]
|
|
86
|
+
* - Optional content to display when there are no items in the list and no loading state.
|
|
87
|
+
*
|
|
88
|
+
* @property {() => void} [onNextPage]
|
|
89
|
+
* - Optional callback triggered when the user scrolls to load the next page of items.
|
|
90
|
+
*
|
|
91
|
+
* @property {({ field: F; direction: 'ASC' | 'DESC' }) => void} [onOrderByChanged]
|
|
92
|
+
* - Optional callback triggered when the user changes the sorting order of the list.
|
|
93
|
+
*
|
|
94
|
+
* @property {{ field: F; direction: 'ASC' | 'DESC' }} [orderBy]
|
|
95
|
+
* - Optional object specifying the current sorting state of the list.
|
|
96
|
+
*
|
|
97
|
+
* @property {boolean} [hasMoreItems]
|
|
98
|
+
* - Optional flag indicating if there are more items to load.
|
|
99
|
+
*
|
|
100
|
+
* @property {MenuItemsType<T>} [menu]
|
|
101
|
+
* - Optional menu items to be displayed for each item in the list.
|
|
102
|
+
*
|
|
103
|
+
* @property {boolean} [displayMenuDiv]
|
|
104
|
+
* - Optional flag to control whether the menu is displayed as a separate div.
|
|
105
|
+
*
|
|
106
|
+
* @property {string} [className]
|
|
107
|
+
* - Optional CSS class name to apply additional styles to the list container.
|
|
108
|
+
*
|
|
109
|
+
* @property {Array<'selectAll' | 'unselectAll' | 'multiselect' | Array<'delete' & (() => void)>>} [keyboardShortcuts]
|
|
110
|
+
* - Optional array of keyboard shortcut actions to be handled.
|
|
111
|
+
*
|
|
112
|
+
* @property {boolean} [disableKeyboardShortcuts]
|
|
113
|
+
* - Optional flag to disable keyboard shortcuts for the list.
|
|
114
|
+
*
|
|
115
|
+
* @property {boolean} [disableItemCompositionStyles]
|
|
116
|
+
* - Optional flag to disable custom styles for item composition.
|
|
117
|
+
*
|
|
118
|
+
* @property {() => void} [onMouseEnter]
|
|
119
|
+
* - Optional callback triggered when the mouse enters the list.
|
|
120
|
+
*
|
|
121
|
+
* @property {() => void} [onMouseLeave]
|
|
122
|
+
* - Optional callback triggered when the mouse leaves the list.
|
|
123
|
+
*
|
|
124
|
+
* @property {
|
|
125
|
+
* { onShiftFKeysPressed?: () => void; onRKeyPressed?: () => void; onBackspaceKeyPressed?: () => void }
|
|
126
|
+
* } [keyBoardShortcutActions]
|
|
127
|
+
* - Optional object with custom actions for specific keyboard shortcuts like Shift+F, R, and Backspace.
|
|
128
|
+
*
|
|
129
|
+
* @returns {JSX.Element}
|
|
130
|
+
* - The rendered list component.
|
|
131
|
+
*/
|
|
132
|
+
declare const List: <T extends {
|
|
133
|
+
id: number;
|
|
134
|
+
}, F extends keyof T>({ header, checkboxDataCy, items, itemComposition, selectedItems, onClick, onDoubleClick, onEnterPressed, onSelectedItemsChanged, isLoading, forceLoading, skinSkeleton, emptyState, orderBy, onOrderByChanged, onNextPage, hasMoreItems, menu, displayMenuDiv, className, disableItemCompositionStyles, onMouseEnter, onMouseLeave, keyBoardShortcutActions, disableKeyboardShortcuts, }: ListProps<T, F>) => JSX.Element;
|
|
135
|
+
export default List;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { MenuItemsType } from '../menu/Menu';
|
|
2
|
+
|
|
3
|
+
export type HeaderProps<T, F> = {
|
|
4
|
+
label: string;
|
|
5
|
+
width: string;
|
|
6
|
+
} & ({
|
|
7
|
+
name: F;
|
|
8
|
+
orderable: true;
|
|
9
|
+
defaultDirection: 'ASC' | 'DESC';
|
|
10
|
+
buttonDataCy?: string;
|
|
11
|
+
textDataCy?: string;
|
|
12
|
+
} | {
|
|
13
|
+
name: keyof T;
|
|
14
|
+
orderable: false;
|
|
15
|
+
});
|
|
16
|
+
interface ListHeaderProps<T, F> {
|
|
17
|
+
selectedItems: T[];
|
|
18
|
+
items: T[];
|
|
19
|
+
header: HeaderProps<T, F>[];
|
|
20
|
+
isVerticalScrollbarVisible: boolean | null;
|
|
21
|
+
orderBy?: {
|
|
22
|
+
field: F;
|
|
23
|
+
direction: 'ASC' | 'DESC';
|
|
24
|
+
};
|
|
25
|
+
menu?: MenuItemsType<T>;
|
|
26
|
+
displayMenuDiv?: boolean;
|
|
27
|
+
checkboxDataCy?: string;
|
|
28
|
+
onTopSelectionCheckboxClick: () => void;
|
|
29
|
+
onOrderableColumnClicked: (column: HeaderProps<T, F>) => void;
|
|
30
|
+
onClose?: () => void;
|
|
31
|
+
}
|
|
32
|
+
declare const ListHeader: <T, F extends keyof T>({ selectedItems, onTopSelectionCheckboxClick, items, header, orderBy, onOrderableColumnClicked, menu, displayMenuDiv, isVerticalScrollbarVisible, checkboxDataCy, onClose, }: ListHeaderProps<T, F>) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export default ListHeader;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { MenuItemsType } from '../menu/Menu';
|
|
2
|
+
|
|
3
|
+
interface ListItemProps<T> {
|
|
4
|
+
item: T;
|
|
5
|
+
listIndex: number;
|
|
6
|
+
itemComposition: Array<(props: T) => JSX.Element>;
|
|
7
|
+
selected: boolean;
|
|
8
|
+
isOpen: boolean;
|
|
9
|
+
columnsWidth: Array<string>;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
onSelectedChanged: (value: boolean) => void;
|
|
12
|
+
onDoubleClick?: () => void;
|
|
13
|
+
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
14
|
+
onClickContextMenu?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
15
|
+
onThreeDotsButtonPressed?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
16
|
+
menu?: MenuItemsType<T>;
|
|
17
|
+
disableItemCompositionStyles?: boolean;
|
|
18
|
+
onMouseEnter?: () => void;
|
|
19
|
+
onMouseLeave?: () => void;
|
|
20
|
+
genericEnterKey: () => void;
|
|
21
|
+
}
|
|
22
|
+
declare const ListItem: <T extends {
|
|
23
|
+
id: number;
|
|
24
|
+
}>({ item, listIndex, itemComposition, selected, isOpen, columnsWidth, onClose, onSelectedChanged, onDoubleClick, onClick, onClickContextMenu, onThreeDotsButtonPressed, disableItemCompositionStyles, menu, onMouseEnter, onMouseLeave, genericEnterKey, }: ListItemProps<T>) => JSX.Element;
|
|
25
|
+
export default ListItem;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface LoaderProps {
|
|
4
|
+
classNameContainer?: string;
|
|
5
|
+
classNameLoader?: string;
|
|
6
|
+
classNameText?: string;
|
|
7
|
+
type?: 'spinner' | 'pulse';
|
|
8
|
+
text?: string;
|
|
9
|
+
size?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Loader component.
|
|
13
|
+
*
|
|
14
|
+
* @property {string} [classNameContainer]
|
|
15
|
+
* - Optional class name for the container wrapping the loader.
|
|
16
|
+
* Useful for applying custom styles to the outermost container.
|
|
17
|
+
*
|
|
18
|
+
* @property {string} [classNameLoader]
|
|
19
|
+
* - Optional class name for the loader element itself (spinner or pulse).
|
|
20
|
+
* Allows custom styling of the loading animation.
|
|
21
|
+
*
|
|
22
|
+
* @property {string} [classNameText]
|
|
23
|
+
* - Optional class name for the text displayed below the loader.
|
|
24
|
+
* Allows style or adjust the appearance of the text.
|
|
25
|
+
*
|
|
26
|
+
* @property {'spinner' | 'pulse'} [type='spinner']
|
|
27
|
+
* - Determines the type of loader to render.
|
|
28
|
+
* Can be `'spinner'` for a rotating animation or `'pulse'` for a pulsing effect.
|
|
29
|
+
* Defaults to `'spinner'`.
|
|
30
|
+
*
|
|
31
|
+
* @property {string} [text]
|
|
32
|
+
* - Optional text to display below the loader.
|
|
33
|
+
*
|
|
34
|
+
* @property {number} [size=32]
|
|
35
|
+
* - Size of the spinner loader in pixels.
|
|
36
|
+
* Applies to the width and height of the SVG element for the `'spinner'` type.
|
|
37
|
+
* Defaults to `32`.
|
|
38
|
+
*/
|
|
39
|
+
declare const Loader: React.FC<LoaderProps>;
|
|
40
|
+
export default Loader;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export type MenuItemType<T> = {
|
|
4
|
+
separator: true;
|
|
5
|
+
} | {
|
|
6
|
+
name?: string;
|
|
7
|
+
separator?: false;
|
|
8
|
+
disabled?: (target: T) => boolean;
|
|
9
|
+
isTitle?: (target: T) => boolean;
|
|
10
|
+
icon?: React.ForwardRefExoticComponent<{
|
|
11
|
+
size?: number | string;
|
|
12
|
+
}>;
|
|
13
|
+
keyboardShortcutOptions?: {
|
|
14
|
+
keyboardShortcutIcon?: React.ForwardRefExoticComponent<{
|
|
15
|
+
size?: number | string;
|
|
16
|
+
}>;
|
|
17
|
+
keyboardShortcutText?: string;
|
|
18
|
+
};
|
|
19
|
+
action?: (target: T) => void | Promise<void>;
|
|
20
|
+
onClick?: () => void;
|
|
21
|
+
node?: ReactNode;
|
|
22
|
+
};
|
|
23
|
+
export type MenuItemsType<T> = Array<MenuItemType<T>>;
|
|
24
|
+
export interface MenuProps<T> {
|
|
25
|
+
item?: T;
|
|
26
|
+
isOpen: boolean;
|
|
27
|
+
menu?: MenuItemsType<T>;
|
|
28
|
+
handleMenuClose: () => void;
|
|
29
|
+
genericEnterKey?: () => void;
|
|
30
|
+
paddingX?: string;
|
|
31
|
+
paddingY?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Menu component
|
|
35
|
+
*
|
|
36
|
+
* @template T
|
|
37
|
+
* @param {MenuProps<T>} props - Properties of the Menu component.
|
|
38
|
+
*
|
|
39
|
+
* @property {T} [item]
|
|
40
|
+
* - Optional item that may be used in menu actions (e.g., data passed for actions).
|
|
41
|
+
*
|
|
42
|
+
* @property {boolean} [isOpen]
|
|
43
|
+
* - To know is Menu is visible.
|
|
44
|
+
*
|
|
45
|
+
* @property {MenuItemsType<T>} [menu]
|
|
46
|
+
* - Optional array of menu items. Each item can define a separator, title, icon, action, etc.
|
|
47
|
+
*
|
|
48
|
+
* @property {() => void} handleMenuClose
|
|
49
|
+
* - Function to close the menu.
|
|
50
|
+
*
|
|
51
|
+
* @property {() => void} [genericEnterKey]
|
|
52
|
+
* - Optional callback for when the Enter key is pressed without selecting a menu item.
|
|
53
|
+
*
|
|
54
|
+
* @property {string} [paddingX='px-4']
|
|
55
|
+
* - Optional padding for the X axis (horizontal) of each menu item. Defaults to `px-4`.
|
|
56
|
+
*
|
|
57
|
+
* @property {string} [paddingY='py-1.5']
|
|
58
|
+
* - Optional padding for the Y axis (vertical) of each menu item. Defaults to `py-1.5`.
|
|
59
|
+
*
|
|
60
|
+
* @returns {JSX.Element}
|
|
61
|
+
* - The rendered Menu component.
|
|
62
|
+
*
|
|
63
|
+
* The component handles key events such as Arrow Down, Arrow Up, and Enter for navigation and action execution.
|
|
64
|
+
* It also supports mouse interactions for hovering and selecting menu items.
|
|
65
|
+
*
|
|
66
|
+
* Each menu item can have an action, an optional keyboard shortcut, and an icon.
|
|
67
|
+
* If the item is disabled or marked as a title, it won't be clickable.
|
|
68
|
+
*
|
|
69
|
+
* It features a dynamic index for item selection, with keyboard and mouse-based navigation.
|
|
70
|
+
*/
|
|
71
|
+
declare const Menu: <T>({ item, menu, isOpen, genericEnterKey, handleMenuClose, paddingX, paddingY, }: MenuProps<T>) => JSX.Element;
|
|
72
|
+
export default Menu;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface ModalProps {
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
maxWidth?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
width?: string;
|
|
10
|
+
preventClosing?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Modal component
|
|
14
|
+
*
|
|
15
|
+
* @param {ModalProps} props - Properties of the Modal component.
|
|
16
|
+
*
|
|
17
|
+
* @property {boolean} isOpen
|
|
18
|
+
* - Controls the visibility of the modal. If `true`, the modal is shown; if `false`, the modal is hidden.
|
|
19
|
+
*
|
|
20
|
+
* @property {() => void} onClose
|
|
21
|
+
* - Callback function that is called when the modal is closed.
|
|
22
|
+
* This function is triggered by clicking outside the modal or
|
|
23
|
+
* pressing the 'Escape' key (unless `preventClosing` is `true`).
|
|
24
|
+
*
|
|
25
|
+
* @property {ReactNode} children
|
|
26
|
+
* - The content to be displayed inside the modal.
|
|
27
|
+
*
|
|
28
|
+
* @property {string} [maxWidth]
|
|
29
|
+
* - Optional maximum width for the modal. Defaults to `'max-w-lg'` if not specified.
|
|
30
|
+
*
|
|
31
|
+
* @property {string} [className]
|
|
32
|
+
* - Optional custom class names to apply to the modal content wrapper.
|
|
33
|
+
*
|
|
34
|
+
* @property {string} [width]
|
|
35
|
+
* - Optional width for the modal. Defaults to `'w-full'` if not specified.
|
|
36
|
+
*
|
|
37
|
+
* @property {boolean} [preventClosing=false]
|
|
38
|
+
* - Optional flag to prevent the modal from closing when clicking outside or pressing the 'Escape' key.
|
|
39
|
+
*
|
|
40
|
+
* @returns {JSX.Element | null}
|
|
41
|
+
* - The rendered Modal component, or `null` if `isOpen` is `false`.
|
|
42
|
+
*
|
|
43
|
+
* The component uses a series of hooks and effects to manage modal transitions and handle click and key press events.
|
|
44
|
+
* It supports smooth opacity and scale transitions during opening and closing,
|
|
45
|
+
* and prevents interaction with the modal's background during the transitions.
|
|
46
|
+
*
|
|
47
|
+
* The `preventClosing` prop ensures the modal stays open when interacting outside of the modal or pressing 'Escape'.
|
|
48
|
+
*
|
|
49
|
+
* The modal is displayed with a fixed position in the center of the screen, with a backdrop overlay.
|
|
50
|
+
* The content of the modal is rendered inside a flex container with transition effects to animate its appearance.
|
|
51
|
+
*/
|
|
52
|
+
declare const Modal: ({ isOpen, onClose, children, maxWidth, className, width, preventClosing, }: ModalProps) => JSX.Element | null;
|
|
53
|
+
export default Modal;
|