@digital-ai/dot-components 1.20.0 → 1.21.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.
@@ -1,4 +1,4 @@
1
- import { ChangeEvent, ReactNode, Ref } from 'react';
1
+ import { ChangeEvent, FocusEvent, ReactNode, Ref } from 'react';
2
2
  import { AutocompleteCloseReason, AutocompleteGetTagProps, AutocompleteRenderOptionState } from '@material-ui/lab';
3
3
  import { CommonProps } from '../CommonProps';
4
4
  export declare const DEFAULT_ACTION_ITEM_TEXT = "Add new item";
@@ -36,6 +36,7 @@ export interface AutoCompleteProps<T extends AutoCompleteOption = AutoCompleteOp
36
36
  disablePortal?: boolean;
37
37
  /** If true, the input will be disabled. */
38
38
  disabled?: boolean;
39
+ endAdornmentTooltip?: string;
39
40
  /** If true, the input will be displayed in an error state. */
40
41
  error?: boolean;
41
42
  /** If `true`, hide the selected options from the list box. */
@@ -58,6 +59,8 @@ export interface AutoCompleteProps<T extends AutoCompleteOption = AutoCompleteOp
58
59
  maxHeight?: number | string;
59
60
  /** If true, will allow the user to select multiple options */
60
61
  multiple?: boolean;
62
+ /** Callback function which will be executed upon blur event */
63
+ onBlur?: (event: FocusEvent<HTMLElement>) => void;
61
64
  /** A function that should be executed when the autocomplete value changes */
62
65
  onChange?: (event: ChangeEvent<unknown>, value: AutoCompleteValue, reason: string) => void;
63
66
  /** Callback fired when the popup requests to be closed. Use in controlled mode. */
@@ -72,6 +75,8 @@ export interface AutoCompleteProps<T extends AutoCompleteOption = AutoCompleteOp
72
75
  options?: Array<T>;
73
76
  /** Placeholder text always displayed inside the input field */
74
77
  placeholder?: string;
78
+ /** If true: popper cannot be opened, TextField is in read only mode, change is not allowed */
79
+ readOnly?: boolean;
75
80
  /** Render the option, use `getOptionLabel` by default. */
76
81
  renderOption?: (option: T, state: AutocompleteRenderOptionState) => ReactNode;
77
82
  /** Render the selected value. */
@@ -82,5 +87,7 @@ export interface AutoCompleteProps<T extends AutoCompleteOption = AutoCompleteOp
82
87
  size?: autoCompleteSize;
83
88
  /** value if this is a controlled component */
84
89
  value?: AutoCompleteValue;
90
+ /** If true, the label will be displayed in a warning state. */
91
+ warning?: boolean;
85
92
  }
86
- export declare const DotAutoComplete: <T extends AutoCompleteOption>({ actionItem, ariaLabel, autoFocus, className, "data-testid": dataTestId, defaultValue, dense, disabled, disablePortal, error, filterSelectedOptions, freesolo, group, helperText, inputId, inputRef, label, loading, maxHeight, multiple, onChange, onClose, onInputChange, onOpen, open, options, placeholder, renderOption, renderTags, required, size, value, }: AutoCompleteProps<T>) => JSX.Element;
93
+ export declare const DotAutoComplete: <T extends AutoCompleteOption>({ actionItem, ariaLabel, autoFocus, className, "data-testid": dataTestId, defaultValue, dense, disabled, disablePortal, endAdornmentTooltip, error, filterSelectedOptions, freesolo, group, helperText, inputId, inputRef, label, loading, maxHeight, multiple, onBlur, onChange, onClose, onInputChange, onOpen, open, options, placeholder, readOnly, renderOption, renderTags, required, size, value, warning, }: AutoCompleteProps<T>) => JSX.Element;
@@ -3,5 +3,11 @@ import { AutocompleteGetTagProps } from '@material-ui/lab';
3
3
  import { ChipSize } from '../../chip/Chip';
4
4
  import { AutoCompleteOption, AutoCompleteValue } from '../AutoComplete';
5
5
  export declare const parseAutoCompleteValue: (value: AutoCompleteValue) => string;
6
- export declare const getChipsFromAutocomplete: (values: Array<AutoCompleteOption | string>, getTagProps: AutocompleteGetTagProps, chipSize?: ChipSize) => JSX.Element[];
6
+ export interface GetChipsFromAutocompleteProps {
7
+ chipSize?: ChipSize;
8
+ getTagProps: AutocompleteGetTagProps;
9
+ isReadOnly?: boolean;
10
+ values: Array<AutoCompleteOption | string>;
11
+ }
12
+ export declare const getChipsFromAutocomplete: ({ chipSize, getTagProps, isReadOnly, values, }: GetChipsFromAutocompleteProps) => JSX.Element[];
7
13
  export declare const checkIfDuplicateItem: (itemText: string, autocompleteOptions: AutoCompleteOption[]) => boolean;
@@ -21,6 +21,8 @@ export interface AvatarProps extends CommonProps {
21
21
  size?: AvatarSize;
22
22
  /** To be used to override styles inline */
23
23
  style?: CSSProperties;
24
+ /** tab order for the avatar */
25
+ tabIndex?: number;
24
26
  /** The text to be displayed. Only the first 2 letters will be displayed. */
25
27
  text?: string;
26
28
  /** Tooltip for avatar */
@@ -30,4 +32,4 @@ export interface AvatarProps extends CommonProps {
30
32
  /** The shape of the avatar */
31
33
  variant?: AvatarVariant;
32
34
  }
33
- export declare const DotAvatar: ({ alt, ariaLabel, className, component, color, "data-testid": dataTestId, iconId, imageSrc, onClick, size, text, type, tooltip, variant, style, }: AvatarProps) => JSX.Element;
35
+ export declare const DotAvatar: ({ alt, ariaLabel, className, component, color, "data-testid": dataTestId, iconId, imageSrc, onClick, size, tabIndex, text, type, tooltip, variant, style, }: AvatarProps) => JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import { ChangeEvent } from 'react';
2
2
  import { RadioGroupBaseProps } from '../radio/RadioGroup';
3
- import { CheckboxProps } from '../checkbox/Checkbox';
3
+ import { CheckboxProps } from './Checkbox';
4
4
  export interface CheckboxGroupProps extends RadioGroupBaseProps {
5
5
  /** Array of CheckboxProps to set by default */
6
6
  defaultValues?: CheckboxProps[];
@@ -20,7 +20,7 @@ export interface UncontrolledInputArgs extends InputBaseArgs {
20
20
  formState?: DynamicFormState;
21
21
  handleClick?: (formValues?: DynamicFormOutputData) => void;
22
22
  }
23
- export declare const getInitialStateFromControl: ({ hidden, initialValue, controlType, validation, formSection, }: DynamicFormControl, liveValidation: boolean, formValues: DynamicFormOutputData) => DynamicFormStateItem;
23
+ export declare const getInitialStateFromControl: ({ hidden, initialValue, controlType, validation }: DynamicFormControl, liveValidation: boolean, formValues: DynamicFormOutputData) => DynamicFormStateItem;
24
24
  export declare const getInitialFormState: (config: DynamicFormConfig, liveValidation: boolean) => DynamicFormState;
25
25
  export declare const getControlClickHandler: (formValues: DynamicFormOutputData, onControlClick?: ControlClickHandler) => () => void;
26
26
  export declare const buildInputTextControl: ({ controlName, controlProps, disabled, formData, handleChange, index, }: ControlledInputArgs) => JSX.Element;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import { KeyboardEvent } from 'react';
2
2
  import { CommonProps } from '../CommonProps';
3
3
  export interface ListItemFile {
4
4
  id: string | number;
@@ -11,5 +11,7 @@ export interface FileItemProps extends CommonProps {
11
11
  errorText?: string;
12
12
  file: ListItemFile;
13
13
  onClick?: (file: ListItemFile) => void;
14
+ onKeyPress?: (event: KeyboardEvent<Element>) => void;
15
+ tabIndex?: number;
14
16
  }
15
- export declare const DotFileListItem: ({ ariaLabel, className, "data-testid": dataTestId, deleteFile, disableDelete, error, errorText, file, onClick, }: FileItemProps) => JSX.Element;
17
+ export declare const DotFileListItem: ({ ariaLabel, className, "data-testid": dataTestId, deleteFile, disableDelete, error, errorText, file, onClick, onKeyPress, tabIndex, }: FileItemProps) => JSX.Element;
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
- import { FileUploadProps } from './';
2
+ import { FileUploadProps, MappedListItemFile } from './';
3
3
  export interface CustomFileUploadArgs {
4
+ alreadyUploadedFiles?: MappedListItemFile[];
4
5
  args: FileUploadProps;
5
6
  }
6
- export declare const CustomFileUpload: ({ args }: CustomFileUploadArgs) => JSX.Element;
7
+ export declare const CustomFileUpload: ({ args, alreadyUploadedFiles, }: CustomFileUploadArgs) => JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  import { FileRejection } from 'react-dropzone';
3
- import { DropzoneContentArgs, ParseListItemArgs, UploadedFilesListArgs } from './models';
3
+ import { DropzoneContentArgs, FileUploadError, ParseListItemArgs, UploadedFilesListArgs } from './models';
4
4
  export declare const renderMaxSizeMessage: (maxSizeMB: number) => ReactNode;
5
5
  export declare const renderMaxFilesMessage: (maxFiles: number, maxFilesClasses: string) => ReactNode;
6
6
  export declare const renderSelectFilesButton: (isUploadDisabled: boolean, onButtonClick: () => void) => ReactNode;
@@ -21,3 +21,4 @@ export declare const joinAcceptedAndRejectedFiles: (filesAccepted: File[], files
21
21
  file: File;
22
22
  errors: any[];
23
23
  }[];
24
+ export declare const getErrorMessagesForDisplay: (errors: FileUploadError[]) => string;
@@ -19,6 +19,10 @@ export interface InlineEditProps extends CommonProps {
19
19
  onEditStateChange?: (editing: boolean) => void;
20
20
  /** If true, component will behave like a regular text (editing functionality will be disabled). */
21
21
  readOnly?: boolean;
22
+ /** If true, when starting edit it will select all text in the input */
23
+ selectTextOnEdit?: boolean;
24
+ /** tab order for the inline edit */
25
+ tabIndex?: number;
22
26
  /** Tooltip text displayed on hover */
23
27
  tooltip?: string;
24
28
  /** Typography variant to be used */
@@ -29,4 +33,4 @@ export interface InlineEditProps extends CommonProps {
29
33
  /**
30
34
  * @experimental This component is still in development
31
35
  */
32
- export declare const DotInlineEdit: ({ ariaLabel, bindings, charactersLimit, className, "data-testid": dataTestId, fullWidth, hideActionButtons, name, onChange, onEditStateChange, readOnly, tooltip, typography, value, }: InlineEditProps) => JSX.Element;
36
+ export declare const DotInlineEdit: ({ ariaLabel, bindings, charactersLimit, className, "data-testid": dataTestId, fullWidth, hideActionButtons, name, onChange, onEditStateChange, readOnly, selectTextOnEdit, tabIndex, tooltip, typography, value, }: InlineEditProps) => JSX.Element;
@@ -39,6 +39,8 @@ export interface InputProps extends CommonProps {
39
39
  onMouseUp?: (event: MouseEvent) => void;
40
40
  /** If true, the label will be persistently displayed outside of the field */
41
41
  persistentLabel?: boolean;
42
+ /** If true, the input will be read-only. */
43
+ readOnly?: boolean;
42
44
  /** If true, the label is displayed as required and the input element` will be required. */
43
45
  required?: boolean;
44
46
  /** If specified, the label being shrunk/unshrunk must be controlled by the consumer */
@@ -2,7 +2,7 @@
2
2
  import { InputProps } from './InputFormFields.propTypes';
3
3
  export declare type OptionType = string | InputSelectOption;
4
4
  export interface InputSelectOption {
5
- /** options that appears in dropdown */
5
+ /** options that appear in dropdown */
6
6
  option: string;
7
7
  /** value of input field when option is selected */
8
8
  value?: string;
@@ -13,4 +13,4 @@ export interface InputSelectProps extends InputProps {
13
13
  /** options of select dropdown */
14
14
  options: Array<OptionType>;
15
15
  }
16
- export declare const DotInputSelect: ({ ariaLabel, autoFocus, className, "data-testid": dataTestId, defaultValue, disabled, endIcon, error, fullWidth, helperText, id, inputRef, label, name, onBlur, onChange, onFocus, onKeyDown, options, persistentLabel, required, shrink, size, startIcon, success, value, warning, }: InputSelectProps) => JSX.Element;
16
+ export declare const DotInputSelect: ({ ariaLabel, autoFocus, className, "data-testid": dataTestId, defaultValue, disabled, endIcon, error, fullWidth, helperText, id, inputRef, label, name, onBlur, onChange, onFocus, onKeyDown, options, persistentLabel, readOnly, required, shrink, size, startIcon, success, value, warning, }: InputSelectProps) => JSX.Element;
@@ -15,8 +15,6 @@ export interface InputTextProps extends InputProps {
15
15
  multiline?: boolean;
16
16
  /** Placeholder text always displayed inside the input field */
17
17
  placeholder?: string;
18
- /** If true, the input will be read-only. */
19
- readOnly?: boolean;
20
18
  /** number of rows for multiline line */
21
19
  rows?: number;
22
20
  /** max of rows for multiline line */
@@ -1,10 +1,15 @@
1
- /// <reference types="react" />
1
+ import { ReactElement } from 'react';
2
2
  import { CommonProps } from '../CommonProps';
3
3
  export declare type PillSize = 'small' | 'medium';
4
4
  export declare type PillStatus = 'success' | 'error' | 'warning' | 'in-progress' | 'default';
5
+ export declare type PillVariant = 'default' | 'outlined';
5
6
  export interface PillProps extends CommonProps {
6
7
  /** Background color for the pill, ignored if 'status' is not 'default' */
7
8
  backgroundcolor?: string;
9
+ /** Border color for the pill, ignored if 'status' is not 'default' */
10
+ bordercolor?: string;
11
+ /** The icon for the pill */
12
+ icon?: ReactElement;
8
13
  /** The text for the pill. */
9
14
  label: string;
10
15
  /** Label color for the pill, ignored if 'status' is not 'default' */
@@ -13,5 +18,7 @@ export interface PillProps extends CommonProps {
13
18
  size?: PillSize;
14
19
  /** Determines the status of the pill component */
15
20
  status?: PillStatus;
21
+ /** Determines the variant of the pill 'default' or 'outlined' */
22
+ variant?: PillVariant;
16
23
  }
17
- export declare const DotPill: ({ ariaLabel, backgroundcolor, className, "data-testid": dataTestId, label, labelcolor, size, status, }: PillProps) => JSX.Element;
24
+ export declare const DotPill: ({ ariaLabel, backgroundcolor, bordercolor, className, "data-testid": dataTestId, icon, label, labelcolor, size, status, variant, }: PillProps) => JSX.Element;
@@ -2,9 +2,5 @@ import { RadioGroup } from '@material-ui/core';
2
2
  export declare const wrapperClassName = "dot-radio-group-wrapper";
3
3
  export declare const groupClassName = "dot-radio-group";
4
4
  export declare const rootClassName = "dot-radio-control";
5
- export declare const groupLabelClassName = "dot-radio-group-label";
6
- export declare const startAdornmentClassName = "dot-start-adornment";
7
- export declare const endAdornmentClassName = "dot-end-adornment";
8
- export declare const placementClassName = "dot-";
9
5
  export declare const StyledRadioGroupWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
10
6
  export declare const StyledRadioGroup: import("styled-components").StyledComponent<typeof RadioGroup, any, {}, never>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digital-ai/dot-components",
3
- "version": "1.20.0",
3
+ "version": "1.21.2",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN <LICENSE.md>",
6
6
  "contributors": [