@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
package/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# InternxtUI
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This repository contains the library of Internxt components, named `@internxt/internxtui`. It offers a collection of reusable UI components for use within Internxt projects.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
To install the library, use yarn:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
yarn add @internxt/internxtui
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage/Examples
|
|
16
|
+
|
|
17
|
+
You can import the components from @internxt/internxtui in your React application as follows:
|
|
18
|
+
|
|
19
|
+
```javascript
|
|
20
|
+
import { Button } from '@internxt/internxtui';
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Replace `Button` with the specific component you want to use.
|
|
24
|
+
|
|
25
|
+
## Scripts
|
|
26
|
+
|
|
27
|
+
### `yarn sb`
|
|
28
|
+
|
|
29
|
+
Starts Storybook server.
|
|
30
|
+
|
|
31
|
+
### `yarn build-storybook`
|
|
32
|
+
|
|
33
|
+
Builds Storybook for production.
|
|
34
|
+
|
|
35
|
+
### `yarn build`
|
|
36
|
+
|
|
37
|
+
Builds the library using TypeScript and Vite.
|
|
38
|
+
|
|
39
|
+
### `yarn format`
|
|
40
|
+
|
|
41
|
+
Formats TypeScript files using Prettier.
|
|
42
|
+
|
|
43
|
+
### `yarn lint`
|
|
44
|
+
|
|
45
|
+
Lints the project using ESLint.
|
|
46
|
+
|
|
47
|
+
### `yarn test`
|
|
48
|
+
|
|
49
|
+
Runs tests using Vitest.
|
|
50
|
+
|
|
51
|
+
### `yarn test-update`
|
|
52
|
+
|
|
53
|
+
Runs tests and updates snapshots.
|
|
54
|
+
|
|
55
|
+
### `yarn test-watch`
|
|
56
|
+
|
|
57
|
+
Runs tests in watch mode.
|
|
58
|
+
|
|
59
|
+
### `yarn test:ui`
|
|
60
|
+
|
|
61
|
+
Runs UI tests.
|
|
62
|
+
|
|
63
|
+
### `yarn coverage`
|
|
64
|
+
|
|
65
|
+
Generates test coverage reports.
|
|
66
|
+
|
|
67
|
+
### `yarn deploy`
|
|
68
|
+
|
|
69
|
+
Deploy Storybook to GitHub Pages. This is the url: https://internxt.github.io/ui
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
type SIZE_KEYS = 'xxs' | 'xs' | 'sm' | 'base' | 'lg' | 'xl';
|
|
2
|
+
/**
|
|
3
|
+
* Renders an avatar component which can be either a picture or a default avatar with initials.
|
|
4
|
+
*
|
|
5
|
+
* @param {Object} props - The properties for the Avatar component.
|
|
6
|
+
* @param {string} props.fullName - The full name of the user, used to generate initials if no image is provided.
|
|
7
|
+
* @param {number} [props.diameter=80] - The diameter of the avatar in pixels. Ignored if `size` is provided.
|
|
8
|
+
* @param {SIZE_KEYS} [props.size] - Predefined size for the avatar. If provided, overrides the `diameter`.
|
|
9
|
+
* The associated value in `SIZES` will be used as the diameter. Possible values are:
|
|
10
|
+
* - `'xxs'`: 28px
|
|
11
|
+
* - `'xs'`: 36px
|
|
12
|
+
* - `'sm'`: 40px
|
|
13
|
+
* - `'base'`: 48px
|
|
14
|
+
* - `'lg'`: 80px
|
|
15
|
+
* - `'xl'`: 128px
|
|
16
|
+
* @param {string|null} [props.src] - The URL of the image to display as the avatar. If not provided, initials are shown
|
|
17
|
+
* @param {string} [props.className=''] - Additional CSS classes to apply to the avatar component.
|
|
18
|
+
* @param {Object} [props.style={}] - Additional inline styles to apply to the avatar component.
|
|
19
|
+
* @returns {JSX.Element} The rendered avatar component.
|
|
20
|
+
*/
|
|
21
|
+
declare const Avatar: ({ src, diameter, size, className, fullName, style, }: {
|
|
22
|
+
fullName: string;
|
|
23
|
+
diameter?: number;
|
|
24
|
+
size?: SIZE_KEYS;
|
|
25
|
+
src?: string | null;
|
|
26
|
+
className?: string;
|
|
27
|
+
style?: Record<string, string | number>;
|
|
28
|
+
}) => JSX.Element;
|
|
29
|
+
export default Avatar;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Avatar } from './Avatar';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { IconWeight } from '@phosphor-icons/react';
|
|
2
|
+
|
|
3
|
+
export interface BaseDialogProps {
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
title?: string;
|
|
6
|
+
hideCloseButton?: boolean;
|
|
7
|
+
subTitle?: string;
|
|
8
|
+
dialogRounded?: boolean;
|
|
9
|
+
children: JSX.Element | JSX.Element[];
|
|
10
|
+
classes?: string;
|
|
11
|
+
titleClasses?: string;
|
|
12
|
+
panelClasses?: string;
|
|
13
|
+
closeClass?: string;
|
|
14
|
+
weightIcon?: IconWeight;
|
|
15
|
+
bgColor?: string;
|
|
16
|
+
onClose: () => void;
|
|
17
|
+
dataTest?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* BaseDialog component
|
|
21
|
+
*
|
|
22
|
+
* @property {boolean} isOpen
|
|
23
|
+
* - Controls whether the dialog is open or closed. If true, the dialog is visible.
|
|
24
|
+
*
|
|
25
|
+
* @property {string} [title]
|
|
26
|
+
* - The title of the dialog, displayed at the top of the dialog box.
|
|
27
|
+
*
|
|
28
|
+
* @property {boolean} [hideCloseButton]
|
|
29
|
+
* - If true, hides the close button (X icon) in the top right corner of the dialog.
|
|
30
|
+
*
|
|
31
|
+
* @property {string} [subTitle]
|
|
32
|
+
* - A subtitle for the dialog, displayed below the title.
|
|
33
|
+
*
|
|
34
|
+
* @property {boolean} [dialogRounded]
|
|
35
|
+
* - If true, applies a more rounded corner style to the dialog.
|
|
36
|
+
*
|
|
37
|
+
* @property {JSX.Element | JSX.Element[]} children
|
|
38
|
+
* - The content to be displayed inside the dialog. Can be a single JSX element or an array of elements.
|
|
39
|
+
*
|
|
40
|
+
* @property {string} [classes]
|
|
41
|
+
* - Custom classes for the outermost container of the dialog. Allows additional styling like margins or padding.
|
|
42
|
+
*
|
|
43
|
+
* @property {string} [titleClasses]
|
|
44
|
+
* - Custom classes for styling the title element. Can modify font size, weight, etc.
|
|
45
|
+
*
|
|
46
|
+
* @property {string} [panelClasses]
|
|
47
|
+
* - Custom classes for the main dialog panel, where the content is displayed.
|
|
48
|
+
*
|
|
49
|
+
* @property {string} [closeClass]
|
|
50
|
+
* - Custom classes for the close button, allowing for customization of the button's appearance.
|
|
51
|
+
*
|
|
52
|
+
* @property {IconWeight} [weightIcon]
|
|
53
|
+
* - Controls the thickness of the close button icon (X). Options range from "thin" to "bold".
|
|
54
|
+
*
|
|
55
|
+
* @property {string} [bgColor]
|
|
56
|
+
* - Custom background color for the dialog. Defaults to a light surface color if not provided.
|
|
57
|
+
*
|
|
58
|
+
* @property {() => void} onClose
|
|
59
|
+
* - Callback function triggered when the close button or overlay is clicked, used to close the dialog.
|
|
60
|
+
*/
|
|
61
|
+
declare const BaseDialog: ({ isOpen, title, subTitle, dialogRounded, children, onClose, classes, panelClasses, titleClasses, closeClass, weightIcon, bgColor, dataTest, hideCloseButton, }: BaseDialogProps) => JSX.Element;
|
|
62
|
+
export default BaseDialog;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { FunctionComponent, SVGProps } from 'react';
|
|
2
|
+
import { Dispatch } from 'redux';
|
|
3
|
+
import { BreadcrumbItemData, BreadcrumbsMenuProps } from './BreadcrumbsItem';
|
|
4
|
+
import { DropTargetMonitor, useDrop } from 'react-dnd';
|
|
5
|
+
|
|
6
|
+
export interface BreadcrumbsProps<T extends Dispatch, U> {
|
|
7
|
+
items: BreadcrumbItemData[];
|
|
8
|
+
rootBreadcrumbItemDataCy?: string;
|
|
9
|
+
menu?: (props: BreadcrumbsMenuProps) => JSX.Element;
|
|
10
|
+
namePath: {
|
|
11
|
+
name: string;
|
|
12
|
+
uuid: string;
|
|
13
|
+
}[];
|
|
14
|
+
isSomeItemSelected: boolean;
|
|
15
|
+
selectedItems: U[];
|
|
16
|
+
onItemDropped: (item: BreadcrumbItemData, namePath: {
|
|
17
|
+
name: string;
|
|
18
|
+
uuid: string;
|
|
19
|
+
}[], isSomeItemSelected: boolean, selectedItems: U[], dispatch: T) => (draggedItem: U, monitor: DropTargetMonitor) => Promise<void>;
|
|
20
|
+
canItemDrop: (item: BreadcrumbItemData) => (draggedItem: U, monitor: DropTargetMonitor) => boolean;
|
|
21
|
+
itemComponent?: FunctionComponent<SVGProps<SVGSVGElement>>;
|
|
22
|
+
acceptedTypes: string[];
|
|
23
|
+
dispatch: T;
|
|
24
|
+
useDrop: typeof useDrop;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Breadcrumbs component
|
|
28
|
+
*
|
|
29
|
+
* @property {BreadcrumbItemData[]} items
|
|
30
|
+
* - Array of breadcrumb items to be displayed, each containing a label, icon, and other related properties.
|
|
31
|
+
*
|
|
32
|
+
* @property {string} [rootBreadcrumbItemDataCy]
|
|
33
|
+
* - Custom `data-cy` attribute applied to the root breadcrumb item.
|
|
34
|
+
*
|
|
35
|
+
* @property {Function} [menu]
|
|
36
|
+
* - Optional custom menu component for rendering a dropdown menu for breadcrumb items that need additional actions
|
|
37
|
+
* or options.
|
|
38
|
+
*
|
|
39
|
+
* @property {Object[]} namePath
|
|
40
|
+
* - Array of objects representing the path and UUID of the breadcrumb item, used for handling navigation or selection.
|
|
41
|
+
*
|
|
42
|
+
* @property {boolean} isSomeItemSelected
|
|
43
|
+
* - If true, indicates that some breadcrumb items are selected, affecting the display and behavior of the breadcrumbs.
|
|
44
|
+
*
|
|
45
|
+
* @property {any[]} selectedItems
|
|
46
|
+
* - Array of selected breadcrumb items, used to manage the selection state and related actions.
|
|
47
|
+
*
|
|
48
|
+
* @property {Function} onItemDropped
|
|
49
|
+
* - Callback function that is triggered when a breadcrumb item is dropped, used for handling drag-and-drop operations.
|
|
50
|
+
*
|
|
51
|
+
* @property {Function} canItemDrop
|
|
52
|
+
* - Determines if a breadcrumb item can be dropped. Used for validating drop actions in the drag-and-drop interaction.
|
|
53
|
+
*
|
|
54
|
+
* @property {FunctionComponent<SVGProps<SVGSVGElement>>} [itemComponent]
|
|
55
|
+
* - Optional custom component for rendering icons or other visual elements inside each breadcrumb item.
|
|
56
|
+
*
|
|
57
|
+
* @property {string[]} acceptedTypes
|
|
58
|
+
* - Array of accepted drag-and-drop types for breadcrumb items,
|
|
59
|
+
* specifying what types of items can be dragged and dropped.
|
|
60
|
+
*
|
|
61
|
+
* @property {Dispatch} dispatch
|
|
62
|
+
* - The Redux dispatch function for dispatching actions related to the breadcrumb items.
|
|
63
|
+
*
|
|
64
|
+
* @property {Functiodn} useDrop
|
|
65
|
+
* - Hook for dnd.
|
|
66
|
+
*/
|
|
67
|
+
declare const Breadcrumbs: <T extends Dispatch, U>(props: Readonly<BreadcrumbsProps<T, U>>) => JSX.Element;
|
|
68
|
+
export default Breadcrumbs;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { DropTargetMonitor, useDrop } from 'react-dnd';
|
|
2
|
+
import { Dispatch } from 'redux';
|
|
3
|
+
import { FunctionComponent, SVGProps } from 'react';
|
|
4
|
+
|
|
5
|
+
export interface BreadcrumbItemData {
|
|
6
|
+
uuid: string;
|
|
7
|
+
label: string;
|
|
8
|
+
icon: JSX.Element | null;
|
|
9
|
+
active: boolean;
|
|
10
|
+
isFirstPath?: boolean;
|
|
11
|
+
dialog?: boolean;
|
|
12
|
+
isBackup?: boolean;
|
|
13
|
+
onClick?: () => void;
|
|
14
|
+
}
|
|
15
|
+
export interface BreadcrumbsMenuProps {
|
|
16
|
+
item: BreadcrumbItemData;
|
|
17
|
+
items: BreadcrumbItemData[];
|
|
18
|
+
onItemClicked: (item: BreadcrumbItemData) => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* BreadcrumbsItem component
|
|
22
|
+
*
|
|
23
|
+
* @property {BreadcrumbItemData} item
|
|
24
|
+
* - Data representing a single breadcrumb item, including label, icon, and other properties.
|
|
25
|
+
*
|
|
26
|
+
* @property {number} totalBreadcrumbsLength
|
|
27
|
+
* - The total number of breadcrumb items, used for styling the first item and determining when to apply certain styles.
|
|
28
|
+
*
|
|
29
|
+
* @property {boolean} [isHiddenInList]
|
|
30
|
+
* - If true, the breadcrumb is hidden in the list and only shown in a dropdown menu.
|
|
31
|
+
*
|
|
32
|
+
* @property {BreadcrumbItemData[]} items
|
|
33
|
+
* - Array of all breadcrumb items, used for rendering all the breadcrumbs and their separators.
|
|
34
|
+
*
|
|
35
|
+
* @property {string} [breadcrumbButtonDataCy]
|
|
36
|
+
* - Custom `data-cy` attribute applied to the breadcrumb button element.
|
|
37
|
+
*
|
|
38
|
+
* @property {FunctionComponent<BreadcrumbsMenuProps>} [menu]
|
|
39
|
+
* - A custom menu component that can be shown for the breadcrumb item when it's not active or dialog-based.
|
|
40
|
+
*
|
|
41
|
+
* @property {Object[]} namePath
|
|
42
|
+
* - Array of objects representing the path and UUID of the breadcrumb item.
|
|
43
|
+
*
|
|
44
|
+
* @property {boolean} isSomeItemSelected
|
|
45
|
+
* - If true, indicates that at least one breadcrumb item is selected, affecting styling or behavior.
|
|
46
|
+
*
|
|
47
|
+
* @property {any[]} selectedItems
|
|
48
|
+
* - Array of selected breadcrumb items, used to manage selected states and actions.
|
|
49
|
+
*
|
|
50
|
+
* @property {Function} onItemDropped
|
|
51
|
+
* - Callback function that is triggered when a breadcrumb item is dropped.
|
|
52
|
+
*
|
|
53
|
+
* @property {Function} canItemDrop
|
|
54
|
+
* - Determines if a breadcrumb item can be dropped. Used for validation during drag-and-drop operations.
|
|
55
|
+
*
|
|
56
|
+
* @property {FunctionComponent<SVGProps<SVGSVGElement>>} [itemComponent]
|
|
57
|
+
* - Optional custom component for rendering an icon or other visual elements within the breadcrumb item.
|
|
58
|
+
*
|
|
59
|
+
* @property {string[]} acceptedTypes
|
|
60
|
+
* - List of accepted drag-and-drop types for the breadcrumb item.
|
|
61
|
+
*
|
|
62
|
+
* @property {Dispatch} dispatch
|
|
63
|
+
* - The Redux dispatch function for dispatching actions related to the breadcrumb item.
|
|
64
|
+
* @property {Functiodn} useDrop
|
|
65
|
+
* - Hook for dnd.
|
|
66
|
+
*/
|
|
67
|
+
export interface BreadcrumbsItemProps<T extends Dispatch, U> {
|
|
68
|
+
item: BreadcrumbItemData;
|
|
69
|
+
totalBreadcrumbsLength: number;
|
|
70
|
+
isHiddenInList?: boolean;
|
|
71
|
+
items: BreadcrumbItemData[];
|
|
72
|
+
breadcrumbButtonDataCy?: string;
|
|
73
|
+
menu?: (props: BreadcrumbsMenuProps) => JSX.Element;
|
|
74
|
+
namePath: {
|
|
75
|
+
name: string;
|
|
76
|
+
uuid: string;
|
|
77
|
+
}[];
|
|
78
|
+
isSomeItemSelected: boolean;
|
|
79
|
+
selectedItems: U[];
|
|
80
|
+
onItemDropped: (item: BreadcrumbItemData, namePath: {
|
|
81
|
+
name: string;
|
|
82
|
+
uuid: string;
|
|
83
|
+
}[], isSomeItemSelected: boolean, selectedItems: U[], dispatch: T) => (draggedItem: U, monitor: DropTargetMonitor) => Promise<void>;
|
|
84
|
+
canItemDrop: (item: BreadcrumbItemData) => (draggedItem: U, monitor: DropTargetMonitor<unknown, unknown>) => boolean;
|
|
85
|
+
itemComponent?: FunctionComponent<SVGProps<SVGSVGElement>>;
|
|
86
|
+
acceptedTypes: string[];
|
|
87
|
+
dispatch: T;
|
|
88
|
+
useDrop: typeof useDrop;
|
|
89
|
+
}
|
|
90
|
+
declare const BreadcrumbsItem: <T extends Dispatch, U>(props: BreadcrumbsItemProps<T, U>) => JSX.Element;
|
|
91
|
+
export default BreadcrumbsItem;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface ButtonProps {
|
|
4
|
+
id?: string;
|
|
5
|
+
variant?: 'primary' | 'secondary' | 'ghost' | 'destructive' | 'tertiary';
|
|
6
|
+
type?: 'button' | 'submit';
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
onClick?: (e?: unknown) => void;
|
|
11
|
+
onKeyDown?: (e?: unknown) => void;
|
|
12
|
+
size?: 'medium' | 'default';
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
dataTest?: string;
|
|
15
|
+
autofocus?: boolean;
|
|
16
|
+
buttonDataCy?: string;
|
|
17
|
+
buttonChildrenDataCy?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Button component
|
|
21
|
+
*
|
|
22
|
+
* @property {string} [id]
|
|
23
|
+
* - Optional ID for the button element, useful for accessibility and styling.
|
|
24
|
+
*
|
|
25
|
+
* @property {'primary' | 'secondary' | 'ghost' | 'destructive'} [variant]
|
|
26
|
+
* - Defines the button's style variant. Options are:
|
|
27
|
+
* - 'primary': Standard button style with primary color.
|
|
28
|
+
* - 'secondary': Button with border and subtle background color.
|
|
29
|
+
* - 'ghost': Button with transparent background, suitable for icons or light use.
|
|
30
|
+
* - 'destructive': Button for destructive actions.
|
|
31
|
+
*
|
|
32
|
+
* @property {'button' | 'submit'} [type]
|
|
33
|
+
* - Specifies the type of the button. Defaults to 'button'.
|
|
34
|
+
* - 'button': Standard button behavior.
|
|
35
|
+
* - 'submit': Button submits a form when used inside a form element.
|
|
36
|
+
*
|
|
37
|
+
* @property {ReactNode} [children]
|
|
38
|
+
* - The content inside the button, such as text or icons.
|
|
39
|
+
* - Can be a single element or an array of elements.
|
|
40
|
+
*
|
|
41
|
+
* @property {string} [className]
|
|
42
|
+
* - Custom CSS classes for additional styling of the button.
|
|
43
|
+
*
|
|
44
|
+
* @property {boolean} [disabled]
|
|
45
|
+
* - Disables the button, preventing user interaction and applying a disabled style.
|
|
46
|
+
* - Defaults to false.
|
|
47
|
+
*
|
|
48
|
+
* @property {(e?: unknown) => void} [onClick]
|
|
49
|
+
* - Function called when the button is clicked. Accepts an optional event object.
|
|
50
|
+
*
|
|
51
|
+
* @property {(e?: unknown) => void} [onKeyDown]
|
|
52
|
+
* - Function called when a key is pressed while the button is focused. Accepts an optional event object.
|
|
53
|
+
*
|
|
54
|
+
* @property {'medium' | 'default'} [size]
|
|
55
|
+
* - Specifies the button size. Options are:
|
|
56
|
+
* - 'default': Standard size.
|
|
57
|
+
* - 'medium': Slightly smaller size for compact use.
|
|
58
|
+
*
|
|
59
|
+
* @property {boolean} [loading]
|
|
60
|
+
* - If true, shows a loading spinner inside the button.
|
|
61
|
+
*
|
|
62
|
+
* @property {string} [dataTest]
|
|
63
|
+
* - Custom data attribute used for test automation or tracking purposes.
|
|
64
|
+
*
|
|
65
|
+
* @property {boolean} [autofocus]
|
|
66
|
+
* - If true, the button will be focused automatically when the page loads.
|
|
67
|
+
*
|
|
68
|
+
* @property {string} [buttonDataCy]
|
|
69
|
+
* - Custom data attribute for the button element.
|
|
70
|
+
*
|
|
71
|
+
* @property {string} [buttonChildrenDataCy]
|
|
72
|
+
* - Custom data attribute for the children of the button.
|
|
73
|
+
*/
|
|
74
|
+
declare const Button: ({ variant, type, id, children, className, disabled, onClick, onKeyDown, size, loading, dataTest, autofocus, buttonDataCy, buttonChildrenDataCy, }: Readonly<ButtonProps>) => JSX.Element;
|
|
75
|
+
export default Button;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type ButtonVariant = 'default' | 'warning' | 'cancel';
|
|
2
|
+
export interface CircleButtonProps {
|
|
3
|
+
children?: JSX.Element | JSX.Element[];
|
|
4
|
+
variant?: ButtonVariant;
|
|
5
|
+
active?: boolean;
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
onClickToggleButton?: () => void;
|
|
8
|
+
className?: string;
|
|
9
|
+
dropdown?: React.ReactNode;
|
|
10
|
+
indicator?: {
|
|
11
|
+
icon?: JSX.Element;
|
|
12
|
+
className?: string;
|
|
13
|
+
};
|
|
14
|
+
isOpen?: boolean;
|
|
15
|
+
handleOpen?: () => void;
|
|
16
|
+
handleClose?: () => void;
|
|
17
|
+
}
|
|
18
|
+
declare const CircleButton: ({ children, variant, active, onClick, onClickToggleButton, className, dropdown, indicator, isOpen, handleOpen, handleClose, }: CircleButtonProps) => JSX.Element;
|
|
19
|
+
export default CircleButton;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Card component
|
|
5
|
+
*
|
|
6
|
+
* @property {string} [className]
|
|
7
|
+
* - Optional additional CSS classes to customize the appearance of the card.
|
|
8
|
+
* By default, the card has rounded corners, border, padding, and shadow.
|
|
9
|
+
*
|
|
10
|
+
* @property {ReactNode} children
|
|
11
|
+
* - The content to be rendered inside the card. This can be any valid React node.
|
|
12
|
+
*/
|
|
13
|
+
declare const Card: ({ className, children }: {
|
|
14
|
+
className?: string;
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
}) => JSX.Element;
|
|
17
|
+
export default Card;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Card } from './Card';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export interface CheckboxProps {
|
|
2
|
+
id?: string;
|
|
3
|
+
checked?: boolean;
|
|
4
|
+
indeterminate?: boolean;
|
|
5
|
+
onClick?: React.DOMAttributes<HTMLLabelElement>['onClick'];
|
|
6
|
+
required?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
checkboxDataCy?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Checkbox component
|
|
13
|
+
*
|
|
14
|
+
* @property {string} [id]
|
|
15
|
+
* - Optional ID for the checkbox input element, useful for accessibility and styling.
|
|
16
|
+
*
|
|
17
|
+
* @property {boolean} [checked]
|
|
18
|
+
* - Controls whether the checkbox is checked. Defaults to true.
|
|
19
|
+
* - If true, the checkbox appears checked.
|
|
20
|
+
* - If false, the checkbox appears unchecked.
|
|
21
|
+
*
|
|
22
|
+
* @property {boolean} [indeterminate]
|
|
23
|
+
* - If true, the checkbox appears in an indeterminate state (a visual state between checked and unchecked).
|
|
24
|
+
* - This state is typically used for a parent checkbox representing a partial selection of child checkboxes.
|
|
25
|
+
*
|
|
26
|
+
* @property {React.DOMAttributes<HTMLLabelElement>['onClick']} [onClick]
|
|
27
|
+
* - Function called when the checkbox label is clicked. It is triggered only if the checkbox is not disabled.
|
|
28
|
+
* - Accepts an event object from the click event.
|
|
29
|
+
*
|
|
30
|
+
* @property {boolean} [required]
|
|
31
|
+
* - If true, marks the checkbox as required in form validation.
|
|
32
|
+
* - Defaults to false.
|
|
33
|
+
*
|
|
34
|
+
* @property {string} [className]
|
|
35
|
+
* - Custom CSS classes for additional styling of the checkbox container element.
|
|
36
|
+
*
|
|
37
|
+
* @property {string} [checkboxDataCy]
|
|
38
|
+
* - Custom data attribute for the checkbox element.
|
|
39
|
+
*
|
|
40
|
+
* @property {boolean} [disabled]
|
|
41
|
+
* - Disables the checkbox, preventing user interaction and applying a disabled style.
|
|
42
|
+
* - If true, the checkbox cannot be checked or unchecked.
|
|
43
|
+
* - Defaults to false.
|
|
44
|
+
*/
|
|
45
|
+
declare const Checkbox: ({ id, checked, indeterminate, onClick, required, className, checkboxDataCy, disabled, }: CheckboxProps) => JSX.Element;
|
|
46
|
+
export default Checkbox;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { MenuItemsType } from '../menu/Menu';
|
|
2
|
+
|
|
3
|
+
export interface ContextMenuProps<T> {
|
|
4
|
+
item: T;
|
|
5
|
+
menuItemsRef: React.MutableRefObject<HTMLDivElement | null>;
|
|
6
|
+
menu?: MenuItemsType<T>;
|
|
7
|
+
openedFromRightClick: boolean;
|
|
8
|
+
isOpen: boolean;
|
|
9
|
+
posX: number;
|
|
10
|
+
posY: number;
|
|
11
|
+
isContextMenuCutOff: boolean;
|
|
12
|
+
genericEnterKey: () => void;
|
|
13
|
+
handleMenuClose: () => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Properties for `ContextMenuProps<T>`
|
|
17
|
+
*
|
|
18
|
+
* @template T - Generic type representing the item to which the context menu applies.
|
|
19
|
+
*
|
|
20
|
+
* @property {T} item
|
|
21
|
+
* - The current item associated with the context menu.
|
|
22
|
+
* This object is passed to each menu option's `action` and `disabled` functions.
|
|
23
|
+
*
|
|
24
|
+
* @property {React.MutableRefObject<HTMLDivElement | null>} menuItemsRef
|
|
25
|
+
* - A mutable ref to the `div` containing the context menu. Used for handling the menu's positioning and visibility.
|
|
26
|
+
*
|
|
27
|
+
* @property {MenuType<T>} [menu]
|
|
28
|
+
* - An array of menu options, where each option includes properties like `name`, `icon`, `action`, etc.
|
|
29
|
+
* The `MenuType<T>` type allows some options to be separators (`separator: boolean`).
|
|
30
|
+
*
|
|
31
|
+
* @property {boolean} openedFromRightClick
|
|
32
|
+
* - Indicates whether the context menu was opened via a right-click (`true`).
|
|
33
|
+
* Determines whether the menu's position is set based on the click location or a predefined position.
|
|
34
|
+
*
|
|
35
|
+
* @property {boolean} [isOpen]
|
|
36
|
+
* - To know is Menu is visible.
|
|
37
|
+
*
|
|
38
|
+
* @property {number} posX
|
|
39
|
+
* - X-coordinate for the menu's position, used if `openedFromRightClick` is `true`.
|
|
40
|
+
*
|
|
41
|
+
* @property {number} posY
|
|
42
|
+
* - Y-coordinate for the menu's position, used if `openedFromRightClick` is `true`.
|
|
43
|
+
*
|
|
44
|
+
* @property {boolean} isContextMenuCutOff
|
|
45
|
+
* - Specifies whether the menu should align to the bottom of the screen to prevent it
|
|
46
|
+
* from being cut off on smaller screens. Switches menu positioning between top or bottom.
|
|
47
|
+
*
|
|
48
|
+
* @property {() => void} genericEnterKey
|
|
49
|
+
* - A callback that executes if the Enter key is pressed without a selected menu option.
|
|
50
|
+
* Can be used to define a default action.
|
|
51
|
+
*
|
|
52
|
+
* @property {() => void} handleMenuClose
|
|
53
|
+
* - Function to close the context menu. Called after an action is executed or when pressing Enter in the menu.
|
|
54
|
+
*/
|
|
55
|
+
declare const ContextMenu: <T>({ item, menuItemsRef, menu, openedFromRightClick, posX, posY, isContextMenuCutOff, isOpen, genericEnterKey, handleMenuClose, }: ContextMenuProps<T>) => JSX.Element;
|
|
56
|
+
export default ContextMenu;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface CopyableProps {
|
|
2
|
+
className?: string;
|
|
3
|
+
classText?: string;
|
|
4
|
+
text: string;
|
|
5
|
+
copiedText?: string;
|
|
6
|
+
copyToClipboardText?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Copyable component
|
|
10
|
+
*
|
|
11
|
+
* @property {string} [className]
|
|
12
|
+
* - Custom classes for the outer container.
|
|
13
|
+
*
|
|
14
|
+
* @property {string} [classText]
|
|
15
|
+
* - Custom classes for the selected text.
|
|
16
|
+
*
|
|
17
|
+
* @property {string} text
|
|
18
|
+
* - The text content to be displayed and copied to the clipboard.
|
|
19
|
+
*
|
|
20
|
+
* @property {string} copiedText
|
|
21
|
+
* - The text to display in the tooltip when the content has been copied.
|
|
22
|
+
*
|
|
23
|
+
* @property {string} copyToClipboardText
|
|
24
|
+
* - The text to display in the tooltip when the content can be copied to the clipboard.
|
|
25
|
+
*/
|
|
26
|
+
declare const Copyable: ({ className, classText, text, copiedText, copyToClipboardText, }: CopyableProps) => JSX.Element;
|
|
27
|
+
export default Copyable;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export interface DialogProps {
|
|
2
|
+
isOpen: boolean;
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
onPrimaryAction: () => void;
|
|
5
|
+
onSecondaryAction: () => void;
|
|
6
|
+
title: string;
|
|
7
|
+
subtitle: string;
|
|
8
|
+
primaryAction: string;
|
|
9
|
+
secondaryAction: string;
|
|
10
|
+
primaryActionColor: 'primary' | 'danger';
|
|
11
|
+
isLoading?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Dialog component
|
|
15
|
+
*
|
|
16
|
+
* @property {boolean} isOpen
|
|
17
|
+
* - Controls whether the dialog is open or closed. If true, the dialog becomes visible.
|
|
18
|
+
*
|
|
19
|
+
* @property {() => void} onClose
|
|
20
|
+
* - Callback function triggered when the overlay or the close button is clicked. Used to close the dialog.
|
|
21
|
+
*
|
|
22
|
+
* @property {() => void} onPrimaryAction
|
|
23
|
+
* - Callback function triggered when the primary action button is clicked.
|
|
24
|
+
*
|
|
25
|
+
* @property {() => void} onSecondaryAction
|
|
26
|
+
* - Callback function triggered when the secondary action button is clicked.
|
|
27
|
+
*
|
|
28
|
+
* @property {string} title
|
|
29
|
+
* - The title of the dialog, displayed at the top of the dialog box.
|
|
30
|
+
*
|
|
31
|
+
* @property {string} subtitle
|
|
32
|
+
* - A subtitle for the dialog, displayed below the title.
|
|
33
|
+
*
|
|
34
|
+
* @property {string} primaryAction
|
|
35
|
+
* - The label for the primary action button.
|
|
36
|
+
*
|
|
37
|
+
* @property {string} secondaryAction
|
|
38
|
+
* - The label for the secondary action button.
|
|
39
|
+
*
|
|
40
|
+
* @property {('primary' | 'danger')} primaryActionColor
|
|
41
|
+
* - Defines the color of the primary action button. Can either be 'primary' or 'danger'.
|
|
42
|
+
*
|
|
43
|
+
* @property {boolean} [isLoading]
|
|
44
|
+
* - Optional flag to indicate if the buttons should show a loading state. Defaults to false.
|
|
45
|
+
*
|
|
46
|
+
* @returns {JSX.Element}
|
|
47
|
+
* - The rendered dialog component.
|
|
48
|
+
*/
|
|
49
|
+
declare const Dialog: ({ isOpen, onClose, onPrimaryAction, onSecondaryAction, title, subtitle, primaryAction, secondaryAction, primaryActionColor, isLoading, }: DialogProps) => JSX.Element;
|
|
50
|
+
export default Dialog;
|