@datacrest/dcuikit 1.0.0 → 1.0.2
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/build/components/Atom/TextArea/TextArea.d.ts +4 -0
- package/build/components/Atom/TextArea/TextArea.stories.d.ts +5 -0
- package/build/components/Atom/TextArea/TextArea.test.d.ts +1 -0
- package/build/components/Atom/TextArea/index.d.ts +2 -0
- package/build/components/Atom/TextArea/types.d.ts +25 -0
- package/build/components/Atom/TextArea/utils.d.ts +26 -0
- package/build/components/Molecule/AlertDialog/AlertDialog.d.ts +1 -1
- package/build/components/Molecule/AlertDialog/AlertDialog.stories.d.ts +1 -1
- package/build/components/Molecule/AlertDialog/index.d.ts +3 -2
- package/build/components/Molecule/AlertDialog/types.d.ts +5 -2
- package/build/components/Molecule/Dropdown/index.d.ts +1 -0
- package/build/components/Molecule/FileUploader/FileUploader.d.ts +4 -0
- package/build/components/Molecule/FileUploader/FileUploader.stories.d.ts +5 -0
- package/build/components/Molecule/FileUploader/FileUploader.test.d.ts +1 -0
- package/build/components/Molecule/FileUploader/const.d.ts +19 -0
- package/build/components/Molecule/FileUploader/index.d.ts +3 -0
- package/build/components/Molecule/FileUploader/types.d.ts +32 -0
- package/build/components/Molecule/FileUploader/utils.d.ts +4 -0
- package/build/components/Molecule/Message/Message.d.ts +1 -1
- package/build/components/Molecule/Message/Message.stories.d.ts +1 -1
- package/build/components/Molecule/Message/index.d.ts +4 -2
- package/build/components/Molecule/Table/Table.d.ts +1 -1
- package/build/components/Molecule/Table/Table.stories.d.ts +3 -0
- package/build/components/Molecule/Table/Table.types.d.ts +7 -0
- package/build/components/Molecule/Table/TableCell.d.ts +1 -1
- package/build/components/Molecule/Table/TableColumn.d.ts +5 -3
- package/build/components/Molecule/Table/const.d.ts +2 -0
- package/build/components/Molecule/Table/index.d.ts +3 -2
- package/build/components/Molecule/Table/utils.d.ts +1 -0
- package/build/index.css +2 -2
- package/build/index.d.ts +2 -0
- package/build/index.esm.css +2 -2
- package/build/index.esm.js +6 -6
- package/build/index.esm.js.map +1 -1
- package/build/index.js +7 -7
- package/build/index.js.map +1 -1
- package/build/tsconfig.prod.tsbuildinfo +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { TextAreaProps } from './types';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const TextArea: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, TextAreaProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { TextareaHTMLAttributes, ChangeEvent, FocusEvent } from 'react';
|
|
2
|
+
export type TextAreaResize = boolean;
|
|
3
|
+
export interface TextAreaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'size' | 'onChange' | 'onFocus' | 'onBlur'> {
|
|
4
|
+
error?: boolean;
|
|
5
|
+
resize?: TextAreaResize;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
value?: string;
|
|
8
|
+
defaultValue?: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
helperText?: string;
|
|
11
|
+
showCharCount?: boolean;
|
|
12
|
+
floatingLabel?: boolean;
|
|
13
|
+
onChange?: (event: ChangeEvent<HTMLTextAreaElement>) => void;
|
|
14
|
+
onFocus?: (event: FocusEvent<HTMLTextAreaElement>) => void;
|
|
15
|
+
onBlur?: (event: FocusEvent<HTMLTextAreaElement>) => void;
|
|
16
|
+
rows?: number;
|
|
17
|
+
maxLength?: number;
|
|
18
|
+
required?: boolean;
|
|
19
|
+
readOnly?: boolean;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
autoFocus?: boolean;
|
|
22
|
+
fluid?: boolean;
|
|
23
|
+
width?: string;
|
|
24
|
+
className?: string;
|
|
25
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface Prop {
|
|
3
|
+
resize: boolean;
|
|
4
|
+
disabled: boolean;
|
|
5
|
+
floatingLabel: boolean;
|
|
6
|
+
isLabelFloated: boolean;
|
|
7
|
+
focused: boolean;
|
|
8
|
+
error: boolean;
|
|
9
|
+
fluid: boolean;
|
|
10
|
+
width?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
value?: string;
|
|
13
|
+
currentValue: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const generateBaseClasses: (resize: boolean) => string;
|
|
16
|
+
export declare const generateContainerClasses: ({ disabled, floatingLabel, isLabelFloated, focused, error, }: Pick<Prop, "disabled" | "floatingLabel" | "isLabelFloated" | "focused" | "error">) => string;
|
|
17
|
+
export declare const generateWrapperClasses: ({ fluid, width, className, }: Pick<Prop, "fluid" | "width" | "className">) => string;
|
|
18
|
+
export declare const generateWrapperStyle: (width?: string) => React.CSSProperties;
|
|
19
|
+
export declare const getCurrentLength: (value?: string, currentValue?: string) => number;
|
|
20
|
+
export declare const generateFloatingLabelClasses: ({ isLabelFloated, focused, error, }: {
|
|
21
|
+
isLabelFloated: boolean;
|
|
22
|
+
focused: boolean;
|
|
23
|
+
error: boolean;
|
|
24
|
+
}) => string;
|
|
25
|
+
export declare const generateBorderClasses: (focused: boolean, error: boolean) => string;
|
|
26
|
+
export declare const generateNotchWidth: (label?: string, required?: boolean) => number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { AlertDialogProps } from './types';
|
|
3
|
-
declare const AlertDialogComponent: ({ title, description, trigger, action, cancel, onAction, onCancel, variant, disabled, }: AlertDialogProps) => React.JSX.Element;
|
|
3
|
+
declare const AlertDialogComponent: ({ title, description, trigger, action, cancel, onAction, onCancel, variant, disabled, open, onOpenChange, }: AlertDialogProps) => React.JSX.Element;
|
|
4
4
|
export default AlertDialogComponent;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import type { AlertDialogProps } from './types';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
title: string;
|
|
5
|
-
component: ({ title, description, trigger, action, cancel, onAction, onCancel, variant, disabled, }: AlertDialogProps) => React.JSX.Element;
|
|
5
|
+
component: ({ title, description, trigger, action, cancel, onAction, onCancel, variant, disabled, open, onOpenChange, }: AlertDialogProps) => React.JSX.Element;
|
|
6
6
|
argTypes: {
|
|
7
7
|
title: {
|
|
8
8
|
control: "text";
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
export * from './AlertDialog';
|
|
2
|
+
export * from './const';
|
|
3
|
+
export * from './types';
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
export interface AlertDialogProps {
|
|
2
3
|
title: string;
|
|
3
4
|
description: string;
|
|
4
|
-
trigger: string;
|
|
5
|
-
action: string;
|
|
5
|
+
trigger: string | ReactNode;
|
|
6
|
+
action: string | ReactNode;
|
|
6
7
|
cancel?: string;
|
|
7
8
|
onAction?: () => void;
|
|
8
9
|
onCancel?: () => void;
|
|
9
10
|
variant?: 'default' | 'destructive';
|
|
10
11
|
disabled?: boolean;
|
|
12
|
+
open?: boolean;
|
|
13
|
+
onOpenChange?: (open: boolean) => void;
|
|
11
14
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import type { FileUploaderProps } from './types';
|
|
3
|
+
declare const _default: Meta<FileUploaderProps>;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const FileUploader: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, FileUploaderProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const DEFAULT_MAX_SIZE: number;
|
|
2
|
+
export declare const DEFAULT_MAX_FILES = 5;
|
|
3
|
+
export declare const ACCEPTED_FILE_TYPES: {
|
|
4
|
+
IMAGE: string;
|
|
5
|
+
PDF: string;
|
|
6
|
+
DOCUMENT: string;
|
|
7
|
+
ALL: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const FILE_UPLOAD_ERRORS: {
|
|
10
|
+
FILE_TOO_LARGE: string;
|
|
11
|
+
TOO_MANY_FILES: string;
|
|
12
|
+
INVALID_FILE_TYPE: string;
|
|
13
|
+
UPLOAD_FAILED: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const UPLOAD_STATUS: {
|
|
16
|
+
readonly UPLOADING: "uploading";
|
|
17
|
+
readonly SUCCESS: "success";
|
|
18
|
+
readonly ERROR: "error";
|
|
19
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface FileAction {
|
|
2
|
+
label: string;
|
|
3
|
+
onClick: (file: UploadedFile) => void;
|
|
4
|
+
variant?: 'primary' | 'secondary' | 'tertiary' | 'danger' | 'warning' | 'harford' | 'link';
|
|
5
|
+
icon?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export interface FileUploaderProps {
|
|
8
|
+
onFilesChange: (files: File[]) => void;
|
|
9
|
+
accept: string;
|
|
10
|
+
multiple?: boolean;
|
|
11
|
+
maxSize?: number;
|
|
12
|
+
maxFiles?: number;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
className?: string;
|
|
15
|
+
width?: string;
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
fileActions?: FileAction[];
|
|
18
|
+
showRemoveButton?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface FileWithPreview extends File {
|
|
21
|
+
preview?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface UploadedFile {
|
|
24
|
+
id: string;
|
|
25
|
+
file: File;
|
|
26
|
+
name: string;
|
|
27
|
+
size: number;
|
|
28
|
+
type: string;
|
|
29
|
+
preview?: string;
|
|
30
|
+
status: 'uploading' | 'success' | 'error';
|
|
31
|
+
progress?: number;
|
|
32
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { MessageProps } from './Message.types';
|
|
3
|
-
declare const MessageComponent: ({ id, destroy, title, description, variant, duration, animationDuration, icon, dataTestId, }: MessageProps) => React.JSX.Element;
|
|
3
|
+
declare const MessageComponent: ({ id, destroy, title, description, variant, position, duration, animationDuration, icon, dataTestId, }: MessageProps) => React.JSX.Element;
|
|
4
4
|
export default MessageComponent;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { MessageProps, MessageVariants, MessagePosition } from './Message.types';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
title: string;
|
|
5
|
-
component: ({ id, destroy, title, description, variant, duration, animationDuration, icon, dataTestId, }: MessageProps) => React.JSX.Element;
|
|
5
|
+
component: ({ id, destroy, title, description, variant, position, duration, animationDuration, icon, dataTestId, }: MessageProps) => React.JSX.Element;
|
|
6
6
|
argTypes: {
|
|
7
7
|
variant: {
|
|
8
8
|
control: "select";
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import MessageComponent from './Message';
|
|
2
|
+
import { MessageProps } from './Message.types';
|
|
2
3
|
import { message, MessageOptions } from './MessageManager';
|
|
3
|
-
export
|
|
4
|
+
export * from './Message.types';
|
|
4
5
|
export type { MessageProps, MessageOptions };
|
|
6
|
+
export { MessageComponent, message };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { JSX } from 'react';
|
|
2
2
|
import { TableProps } from './Table.types';
|
|
3
|
-
declare const Table: <T extends Record<string, unknown>>({ columns, data, sortable, pagination, searchable, currentPage, pageSize, onSort, onPageChange, actions, showCustomCells, useBuiltInStatus, swapPaginationLayout, }: TableProps<T>) => JSX.Element;
|
|
3
|
+
declare const Table: <T extends Record<string, unknown>>({ columns, data, sortable, pagination, searchable, currentPage, pageSize, onSort, onPageChange, actions, showCustomCells, useBuiltInStatus, swapPaginationLayout, selectable, onSelectionChange, }: TableProps<T>) => JSX.Element;
|
|
4
4
|
export default Table;
|
|
@@ -12,5 +12,8 @@ interface TableStoryProps {
|
|
|
12
12
|
showActions: boolean;
|
|
13
13
|
useBuiltInStatus: boolean;
|
|
14
14
|
swapPaginationLayout: boolean;
|
|
15
|
+
selectable: boolean;
|
|
16
|
+
enableTextTruncation: boolean;
|
|
17
|
+
maxWords: number;
|
|
15
18
|
}
|
|
16
19
|
export declare const Table: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, TableStoryProps>;
|
|
@@ -21,6 +21,10 @@ export interface DateFormat {
|
|
|
21
21
|
input?: string;
|
|
22
22
|
output: string;
|
|
23
23
|
}
|
|
24
|
+
export interface TruncationOptions {
|
|
25
|
+
enableTruncation?: boolean;
|
|
26
|
+
maxWords?: number;
|
|
27
|
+
}
|
|
24
28
|
export interface TableColumn<T extends Record<string, unknown>> {
|
|
25
29
|
key: string;
|
|
26
30
|
title: string;
|
|
@@ -32,6 +36,7 @@ export interface TableColumn<T extends Record<string, unknown>> {
|
|
|
32
36
|
filterFn?: FilterFn<T>;
|
|
33
37
|
customCell?: (value: unknown, row: T) => ReactNode;
|
|
34
38
|
customHeader?: (column: ColumnInfo<T>) => ReactNode;
|
|
39
|
+
maxWords?: number;
|
|
35
40
|
}
|
|
36
41
|
export interface ColumnInfo<T> {
|
|
37
42
|
toggleSorting: (desc?: boolean) => void;
|
|
@@ -53,4 +58,6 @@ export interface TableProps<T extends Record<string, unknown>> {
|
|
|
53
58
|
showCustomCells?: boolean;
|
|
54
59
|
useBuiltInStatus?: boolean;
|
|
55
60
|
swapPaginationLayout?: boolean;
|
|
61
|
+
selectable?: boolean;
|
|
62
|
+
onSelectionChange?: (selectedRows: T[]) => void;
|
|
56
63
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TableColumn } from './Table.types';
|
|
3
|
-
declare const TableCell: <T extends Record<string, unknown>>(column: TableColumn<T>, row: T, showCustomCells: boolean, useBuiltInStatus: boolean) => React.JSX.Element
|
|
3
|
+
declare const TableCell: <T extends Record<string, unknown>>(column: TableColumn<T>, row: T, showCustomCells: boolean, useBuiltInStatus: boolean) => React.JSX.Element;
|
|
4
4
|
export default TableCell;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TableColumn as TableColumnType, TableColumnAlign } from './Table.types';
|
|
2
|
+
import { TableColumn as TableColumnType, TableColumnAlign, TruncationOptions } from './Table.types';
|
|
3
3
|
import { PersonData } from './const';
|
|
4
4
|
export declare const createTextColumn: <T extends Record<string, unknown>>(key: string, title: string, options?: {
|
|
5
5
|
width?: string;
|
|
6
6
|
sortable?: boolean;
|
|
7
7
|
align?: TableColumnAlign;
|
|
8
8
|
customCell?: (value: unknown, row: T) => React.ReactNode;
|
|
9
|
+
maxWords?: number;
|
|
9
10
|
}) => TableColumnType<T>;
|
|
10
11
|
export declare const createDateColumn: <T extends Record<string, unknown>>(key: string, title: string, options?: {
|
|
11
12
|
width?: string;
|
|
@@ -21,13 +22,14 @@ export declare const createStatusColumn: <T extends Record<string, unknown>>(key
|
|
|
21
22
|
align?: TableColumnAlign;
|
|
22
23
|
customCell?: (value: unknown, row: T) => React.ReactNode;
|
|
23
24
|
}) => TableColumnType<T>;
|
|
24
|
-
export declare const createPersonDataColumns: (showCustomCells: boolean) => TableColumnType<PersonData>[];
|
|
25
|
+
export declare const createPersonDataColumns: (showCustomCells: boolean, truncationOptions?: TruncationOptions) => TableColumnType<PersonData>[];
|
|
25
26
|
declare const TableColumn: {
|
|
26
27
|
createTextColumn: <T extends Record<string, unknown>>(key: string, title: string, options?: {
|
|
27
28
|
width?: string;
|
|
28
29
|
sortable?: boolean;
|
|
29
30
|
align?: TableColumnAlign;
|
|
30
31
|
customCell?: (value: unknown, row: T) => React.ReactNode;
|
|
32
|
+
maxWords?: number;
|
|
31
33
|
}) => TableColumnType<T>;
|
|
32
34
|
createDateColumn: <T extends Record<string, unknown>>(key: string, title: string, options?: {
|
|
33
35
|
width?: string;
|
|
@@ -43,6 +45,6 @@ declare const TableColumn: {
|
|
|
43
45
|
align?: TableColumnAlign;
|
|
44
46
|
customCell?: (value: unknown, row: T) => React.ReactNode;
|
|
45
47
|
}) => TableColumnType<T>;
|
|
46
|
-
createPersonDataColumns: (showCustomCells: boolean) => TableColumnType<PersonData>[];
|
|
48
|
+
createPersonDataColumns: (showCustomCells: boolean, truncationOptions?: TruncationOptions) => TableColumnType<PersonData>[];
|
|
47
49
|
};
|
|
48
50
|
export default TableColumn;
|
|
@@ -3,6 +3,7 @@ export interface PersonData extends Record<string, unknown> {
|
|
|
3
3
|
email?: string;
|
|
4
4
|
joinDate?: string;
|
|
5
5
|
status?: string;
|
|
6
|
+
description?: string;
|
|
6
7
|
}
|
|
7
8
|
export declare const SAMPLE_DATA: PersonData[];
|
|
8
9
|
export declare const PAGE_SIZES: readonly [5, 10, 20, 50];
|
|
@@ -13,4 +14,5 @@ export declare const DEFAULT_COLUMN_CONFIG: {
|
|
|
13
14
|
EMAIL_KEY: string;
|
|
14
15
|
JOIN_DATE_KEY: string;
|
|
15
16
|
STATUS_KEY: string;
|
|
17
|
+
DESCRIPTION_KEY: string;
|
|
16
18
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Table from './Table';
|
|
2
2
|
import TableCell from './TableCell';
|
|
3
|
-
import TableColumn, { createTextColumn, createDateColumn, createStatusColumn } from './TableColumn';
|
|
4
3
|
import TableHeader, { renderSortIcon, renderHeader, renderTableHeader } from './TableHeader';
|
|
5
|
-
export { Table, TableCell,
|
|
4
|
+
export { Table, TableCell, TableHeader, renderSortIcon, renderHeader, renderTableHeader, };
|
|
6
5
|
export * from './Table.types';
|
|
6
|
+
export * from './TableColumn';
|
|
7
|
+
export * from './utils';
|