@digital-ai/dot-components 1.3.4 → 1.3.5

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,6 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { CommonProps } from '../CommonProps';
3
- export declare type BadgeOverlap = 'circle' | 'rectangle' | 'circular' | 'rectangular';
3
+ export declare type BadgeOverlap = 'circular' | 'rectangular';
4
4
  export interface BadgeProps extends CommonProps {
5
5
  /** custom color code for the badge */
6
6
  badgeColor?: string;
@@ -1,3 +1,6 @@
1
- import { BadgeProps } from './Badge';
2
1
  export declare const rootClassName = "dot-badge";
3
- export declare const StyledBadge: import("styled-components").StyledComponent<import("@material-ui/core/OverridableComponent").OverridableComponent<import("@material-ui/core").BadgeTypeMap<{}, "div">>, any, BadgeProps, never>;
2
+ interface StyledBadgeProps {
3
+ $badgeColor?: string;
4
+ }
5
+ export declare const StyledBadge: import("styled-components").StyledComponent<import("@material-ui/core/OverridableComponent").OverridableComponent<import("@material-ui/core").BadgeTypeMap<{}, "div">>, any, StyledBadgeProps, never>;
6
+ export {};
@@ -8,4 +8,4 @@ export interface DynamicFormProps extends CommonProps {
8
8
  onChange?: (formData: DynamicFormState) => void;
9
9
  onSubmit?: (formData: DynamicFormOutputData) => void;
10
10
  }
11
- export declare const DotDynamicForm: ({ ariaLabel, className, "data-testid": dataTestId, config, disabled, liveValidation, onChange, onSubmit, }: DynamicFormProps) => JSX.Element;
11
+ export declare const DotDynamicForm: ({ ariaLabel, className, "data-testid": dataTestId, config, disabled: isFormDisabled, liveValidation, onChange, onSubmit, }: DynamicFormProps) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { ControlClickHandler, DynamicFormConfig } from './models';
2
+ export declare const getDynamicFormConfig: (handleProgressControlClick?: ControlClickHandler) => DynamicFormConfig;
@@ -0,0 +1 @@
1
+ export declare const StyledDynamicFormStory: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  export declare const rootClassName = "dot-dynamic-form";
2
- export declare const StyledDynamicForm: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export declare const StyledDynamicForm: import("styled-components").StyledComponent<({ ariaLabel, children, className, "data-testid": dataTestId, onSubmit, }: import("../form/Form").FormProps) => JSX.Element, any, {}, never>;
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { ComponentType, ReactNode } from 'react';
2
2
  import { AutoCompleteProps } from '../auto-complete/AutoComplete';
3
3
  import { ButtonProps } from '../button/Button';
4
4
  import { CheckboxProps } from '../checkbox/Checkbox';
@@ -7,21 +7,35 @@ import { InputSelectProps } from '../input-form-fields/InputSelect';
7
7
  import { CheckboxGroupProps } from '../checkbox/CheckboxGroup';
8
8
  import { RadioGroupProps } from '../radio/RadioGroup';
9
9
  import { SwitchProps } from '../switch/Switch';
10
- export declare type DynamicFormControlType = 'dot-input-text' | 'dot-input-select' | 'dot-checkbox' | 'dot-checkbox-group' | 'dot-autocomplete' | 'dot-button' | 'dot-radio-group' | 'dot-reset' | 'dot-submit' | 'dot-switch' | 'custom-element';
11
- export declare type DynamicFormControlProps = AutoCompleteProps | InputTextProps | InputSelectProps | CheckboxProps | CheckboxGroupProps | ButtonProps | RadioGroupProps | SwitchProps;
10
+ import { ProgressButtonProps } from '../progress-button/ProgressButton';
11
+ export declare type DynamicFormControlType = 'dot-input-text' | 'dot-input-select' | 'dot-checkbox' | 'dot-checkbox-group' | 'dot-autocomplete' | 'dot-button' | 'dot-progress-button' | 'dot-radio-group' | 'dot-reset' | 'dot-submit' | 'dot-progress-submit' | 'dot-switch' | 'dot-form-section' | 'custom-element';
12
+ export declare type DynamicFormControlProps = AutoCompleteProps | InputTextProps | InputSelectProps | CheckboxProps | CheckboxGroupProps | ButtonProps | ProgressButtonProps | RadioGroupProps | SwitchProps;
12
13
  export interface DynamicFormOutputData {
13
14
  [key: string]: unknown;
14
15
  }
15
16
  export declare type ConditionFunction = (formValues: DynamicFormOutputData) => boolean;
16
- export declare type HiddenControl = boolean | ConditionFunction;
17
+ export declare type DisabledConditionFunction = (formValues: DynamicFormOutputData, isFormValid: boolean) => boolean;
18
+ export declare type ControlCondition = boolean | ConditionFunction;
19
+ export declare type DisabledControlCondition = boolean | DisabledConditionFunction;
20
+ export declare type ControlClickHandler = (formValues: DynamicFormOutputData) => void;
21
+ export interface DynamicFormSectionProps {
22
+ sectionControls: ReactNode[];
23
+ }
24
+ export interface DynamicFormSection {
25
+ FormSectionComponent: ComponentType<DynamicFormSectionProps>;
26
+ sectionControls: DynamicFormControl[];
27
+ }
17
28
  export interface DynamicFormControl {
18
29
  controlName?: string;
19
- controlType: DynamicFormControlType;
20
30
  controlProps?: DynamicFormControlProps;
31
+ controlType: DynamicFormControlType;
32
+ formSection?: DynamicFormSection;
33
+ customElement?: ReactNode;
34
+ disabled?: DisabledControlCondition;
35
+ hidden?: ControlCondition;
21
36
  initialValue?: unknown;
37
+ onControlClick?: ControlClickHandler;
22
38
  validation?: DynamicFormValidation;
23
- customElement?: ReactNode;
24
- hidden?: HiddenControl;
25
39
  }
26
40
  export interface FieldValidation {
27
41
  isValid: boolean;
@@ -51,7 +65,7 @@ export interface DynamicFormStateItem {
51
65
  isValid: boolean;
52
66
  isTouched: boolean;
53
67
  errorMessage: string;
54
- hidden?: HiddenControl;
68
+ hidden?: ControlCondition;
55
69
  }
56
70
  export interface DynamicFormState {
57
71
  data: DynamicFormStateData;
@@ -1,4 +1,2 @@
1
- import { DynamicFormConfig, DynamicFormOutputData, DynamicFormState } from './models';
2
- export declare const sampleMiddleNameHiddenFn: (formValues: DynamicFormOutputData) => boolean;
3
- export declare const getSampleConfig: () => DynamicFormConfig;
1
+ import { DynamicFormState } from './models';
4
2
  export declare const getSampleFormState: () => DynamicFormState;
@@ -1,5 +1,5 @@
1
1
  import { ChangeEvent } from 'react';
2
- import { DynamicFormConfig, DynamicFormControlProps, DynamicFormState, DynamicFormStateData } from '../models';
2
+ import { ControlClickHandler, DynamicFormConfig, DynamicFormControl, DynamicFormControlProps, DynamicFormOutputData, DynamicFormState, DynamicFormStateData, DynamicFormStateItem } from '../models';
3
3
  import { AutoCompleteValue } from '../../auto-complete/AutoComplete';
4
4
  import { CheckboxProps } from '../../checkbox/Checkbox';
5
5
  declare type AutoCompleteChangeHandler = (controlName: string) => (e: ChangeEvent<HTMLInputElement>, value: AutoCompleteValue) => void;
@@ -18,9 +18,11 @@ export interface ControlledInputArgs extends InputBaseArgs {
18
18
  }
19
19
  export interface UncontrolledInputArgs extends InputBaseArgs {
20
20
  formState?: DynamicFormState;
21
- handleClick?: () => void;
21
+ handleClick?: (formValues?: DynamicFormOutputData) => void;
22
22
  }
23
+ export declare const getInitialStateFromControl: ({ hidden, initialValue, controlType, validation, formSection, }: DynamicFormControl, liveValidation: boolean, formValues: DynamicFormOutputData) => DynamicFormStateItem;
23
24
  export declare const getInitialFormState: (config: DynamicFormConfig, liveValidation: boolean) => DynamicFormState;
25
+ export declare const getControlClickHandler: (formValues: DynamicFormOutputData, onControlClick?: ControlClickHandler) => () => void;
24
26
  export declare const buildInputTextControl: ({ controlName, controlProps, disabled, formData, handleChange, index, }: ControlledInputArgs) => JSX.Element;
25
27
  export declare const buildInputSelectControl: ({ controlName, controlProps, disabled, formData, handleChange, index, }: ControlledInputArgs) => JSX.Element;
26
28
  export declare const buildAutocompleteControl: ({ controlName, controlProps, disabled, formData, handleChange, index, }: ControlledInputArgs) => JSX.Element;
@@ -28,7 +30,9 @@ export declare const buildRadioGroupControl: ({ controlName, controlProps, disab
28
30
  export declare const buildCheckboxControl: ({ controlName, controlProps, disabled, formData, handleChange, index, }: ControlledInputArgs) => JSX.Element;
29
31
  export declare const buildCheckboxGroupControl: ({ controlName, controlProps, disabled, formData, handleChange, index, }: ControlledInputArgs) => JSX.Element;
30
32
  export declare const buildSwitchControl: ({ controlName, controlProps, disabled, formData, handleChange, index, }: ControlledInputArgs) => JSX.Element;
31
- export declare const buildButtonControl: ({ controlProps, disabled, index, }: UncontrolledInputArgs) => JSX.Element;
33
+ export declare const buildButtonControl: ({ controlProps, disabled, index, handleClick, }: UncontrolledInputArgs) => JSX.Element;
34
+ export declare const buildProgressButtonControl: ({ controlProps, disabled, index, handleClick, }: UncontrolledInputArgs) => JSX.Element;
32
35
  export declare const buildResetControl: ({ controlProps, disabled, handleClick, index, }: UncontrolledInputArgs) => JSX.Element;
33
36
  export declare const buildSubmitControl: ({ controlProps, disabled, formState, index, liveValidation, }: UncontrolledInputArgs) => JSX.Element;
37
+ export declare const buildProgressSubmitControl: ({ controlProps, disabled, formState, index, liveValidation, }: UncontrolledInputArgs) => JSX.Element;
34
38
  export {};
@@ -1,5 +1,6 @@
1
- import { DynamicFormConfig, DynamicFormOutputData, DynamicFormState, DynamicFormStateData, HiddenControl } from '../models';
1
+ import { ControlCondition, DisabledControlCondition, DynamicFormConfig, DynamicFormOutputData, DynamicFormState, DynamicFormStateData } from '../models';
2
2
  export declare const getControlValue: <T extends unknown>(controlName: string, data: DynamicFormStateData) => T;
3
3
  export declare const getOutputFormData: (formState: DynamicFormState) => DynamicFormOutputData;
4
- export declare const checkIfHiddenControl: (hidden: HiddenControl, formValues: DynamicFormOutputData) => boolean;
4
+ export declare const checkIfHiddenControl: (hidden: ControlCondition, formValues: DynamicFormOutputData) => boolean;
5
+ export declare const checkIfDisabledControl: (disabled: DisabledControlCondition, formValues: DynamicFormOutputData, isFormValid: boolean) => boolean;
5
6
  export declare const getFormDataFromInitialValues: (config: DynamicFormConfig) => DynamicFormOutputData;
@@ -7,7 +7,7 @@ export type { CheckboxProps } from './checkbox/Checkbox';
7
7
  export type { CheckboxGroupProps } from './checkbox/CheckboxGroup';
8
8
  export type { SubmitButtonProps } from './dialog/Dialog';
9
9
  export type { DynamicFormProps } from './dynamic-form/DynamicForm';
10
- export type { DynamicFormConfig, DynamicFormOutputData, DynamicFormState, FieldValidation, } from './dynamic-form/models';
10
+ export type { ControlClickHandler, DynamicFormConfig, DynamicFormControl, DynamicFormOutputData, DynamicFormState, FieldValidation, DynamicFormSectionProps, } from './dynamic-form/models';
11
11
  export type { IconButtonProps } from './button/IconButton';
12
12
  export type { InputTextProps } from './input-form-fields/InputText';
13
13
  export type { InputSelectProps } from './input-form-fields/InputSelect';
@@ -73,6 +73,7 @@ export { DotSkeleton } from './skeleton/Skeleton';
73
73
  export { DotSnackbar } from './snackbar/Snackbar';
74
74
  export { DotSnackbarContainer, DotSnackbarProvider, useDotSnackbarContext, } from './snackbar/SnackbarProvider';
75
75
  export { DotSplitButton } from './split-button/SplitButton';
76
+ export { DotProgressButton } from './progress-button/ProgressButton';
76
77
  export { DotSwitch } from './switch/Switch';
77
78
  export { DotTable } from './table/Table';
78
79
  export { DotTooltip } from './tooltip/Tooltip';
@@ -80,4 +81,3 @@ export { DotHeaderRow } from './table/TableHeader';
80
81
  export { DotTablePagination } from './table/TablePagination';
81
82
  export { DotTabs } from './tabs/Tabs';
82
83
  export { DotTypography } from './typography/Typography';
83
- export { DotProgressButton } from './progress-button/ProgressButton';
@@ -27,8 +27,12 @@ export interface InputProps extends CommonProps {
27
27
  label?: string;
28
28
  /** The name of input element */
29
29
  name: string;
30
+ /** A function that should be executed when the input loses focus */
31
+ onBlur?: (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
30
32
  /** A function that should be executed when the value of the input changes */
31
33
  onChange?: (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
34
+ /** A function that should be executed when the input gains focus */
35
+ onFocus?: (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
32
36
  /** If true, the label is displayed as required and the input element` will be required. */
33
37
  required?: boolean;
34
38
  /** Size of the input */
@@ -8,4 +8,4 @@ export interface InputSelectProps extends InputProps {
8
8
  /** value of input field */
9
9
  value?: string;
10
10
  }
11
- export declare const DotInputSelect: ({ ariaLabel, autoFocus, className, "data-testid": dataTestId, defaultValue, disabled, endIcon, error, fullWidth, helperText, id, inputRef, label, name, onChange, options, required, size, startIcon, value, warning, }: InputSelectProps) => JSX.Element;
11
+ export declare const DotInputSelect: ({ ariaLabel, autoFocus, className, "data-testid": dataTestId, defaultValue, disabled, endIcon, error, fullWidth, helperText, id, inputRef, label, name, onBlur, onChange, onFocus, options, required, size, startIcon, value, warning, }: InputSelectProps) => JSX.Element;
@@ -17,4 +17,4 @@ export interface InputTextProps extends InputProps {
17
17
  /** value of the InputText */
18
18
  value?: string;
19
19
  }
20
- export declare const DotInputText: ({ autoFocus, className, defaultValue, "data-testid": dataTestId, disabled, error, fullWidth, hasDebounce, helperText, endIcon, id, inputRef, label, multiline, name, onChange, placeholder, readOnly, required, rows, rowsMax, startIcon, size, type, value, warning, }: InputTextProps) => JSX.Element;
20
+ export declare const DotInputText: ({ autoFocus, className, defaultValue, "data-testid": dataTestId, disabled, error, fullWidth, hasDebounce, helperText, endIcon, id, inputRef, label, multiline, name, onBlur, onChange, onFocus, placeholder, readOnly, required, rows, rowsMax, startIcon, size, type, value, warning, }: InputTextProps) => JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digital-ai/dot-components",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN <LICENSE.md>",
6
6
  "contributors": [