@digital-ai/dot-components 1.3.0 → 1.3.1

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,7 +1,7 @@
1
1
  import { ChangeEvent } from 'react';
2
- import { DynamicFormConfig, DynamicFormControlProps, DynamicFormOutputData, DynamicFormState, DynamicFormStateData, HiddenControl } from './models';
3
- import { AutoCompleteValue } from '../auto-complete/AutoComplete';
4
- import { CheckboxProps } from '../checkbox/Checkbox';
2
+ import { DynamicFormConfig, DynamicFormControlProps, DynamicFormState, DynamicFormStateData } from '../models';
3
+ import { AutoCompleteValue } from '../../auto-complete/AutoComplete';
4
+ import { CheckboxProps } from '../../checkbox/Checkbox';
5
5
  declare type AutoCompleteChangeHandler = (controlName: string) => (e: ChangeEvent<HTMLInputElement>, value: AutoCompleteValue) => void;
6
6
  declare type ChangeHandler = (controlName: string) => (e: ChangeEvent<HTMLInputElement>) => void;
7
7
  declare type CheckboxGroupChangeHandler = (controlName: string) => (event: ChangeEvent<HTMLInputElement>, value: CheckboxProps[]) => void;
@@ -20,11 +20,7 @@ export interface UncontrolledInputArgs extends InputBaseArgs {
20
20
  formState?: DynamicFormState;
21
21
  handleClick?: () => void;
22
22
  }
23
- export declare const getControlValue: <T extends unknown>(controlName: string, data: DynamicFormStateData) => T;
24
- export declare const checkIfHiddenControl: (hidden: HiddenControl, formValues: DynamicFormOutputData) => boolean;
25
23
  export declare const getInitialFormState: (config: DynamicFormConfig, liveValidation: boolean) => DynamicFormState;
26
- export declare const getOutputFormData: (formState: DynamicFormState) => DynamicFormOutputData;
27
- export declare const getFormDataFromInitialValues: (config: DynamicFormConfig) => DynamicFormOutputData;
28
24
  export declare const buildInputTextControl: ({ controlName, controlProps, disabled, formData, handleChange, index, }: ControlledInputArgs) => JSX.Element;
29
25
  export declare const buildInputSelectControl: ({ controlName, controlProps, disabled, formData, handleChange, index, }: ControlledInputArgs) => JSX.Element;
30
26
  export declare const buildAutocompleteControl: ({ controlName, controlProps, disabled, formData, handleChange, index, }: ControlledInputArgs) => JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { DynamicFormConfig, DynamicFormOutputData, DynamicFormState, DynamicFormStateData, HiddenControl } from '../models';
2
+ export declare const getControlValue: <T extends unknown>(controlName: string, data: DynamicFormStateData) => T;
3
+ export declare const getOutputFormData: (formState: DynamicFormState) => DynamicFormOutputData;
4
+ export declare const checkIfHiddenControl: (hidden: HiddenControl, formValues: DynamicFormOutputData) => boolean;
5
+ export declare const getFormDataFromInitialValues: (config: DynamicFormConfig) => DynamicFormOutputData;
@@ -1,4 +1,4 @@
1
- import { DynamicFormConfig, DynamicFormOutputData, DynamicFormState, DynamicFormValidation, FieldValidation, ValidationField } from './models';
1
+ import { DynamicFormConfig, DynamicFormOutputData, DynamicFormState, DynamicFormValidation, FieldValidation, ValidationField } from '../models';
2
2
  export declare const checkIfValidationApplies: (validationField: ValidationField, formValues: DynamicFormOutputData) => boolean;
3
3
  export declare const checkIfEmptyValue: (value: unknown) => boolean;
4
4
  export declare const checkIfString: (value: unknown) => boolean;
@@ -1,2 +1,2 @@
1
1
  export declare const rootClassName = "dot-form";
2
- export declare const StyledForm: import("styled-components").StyledComponent<"form", any, {}, never>;
2
+ export declare const StyledFormContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,21 +1,47 @@
1
+ export type { AppToolbarProps } from './app-toolbar/AppToolbar';
2
+ export type { AutoCompleteOption, AutoCompleteProps, AutoCompleteValue, } from './auto-complete/AutoComplete';
3
+ export type { AvatarProps } from './avatar/Avatar';
4
+ export type { BreadcrumbItem } from './breadcrumbs/Breadcrumbs';
5
+ export type { ButtonProps } from './button/Button';
6
+ export type { CheckboxProps } from './checkbox/Checkbox';
7
+ export type { CheckboxGroupProps } from './checkbox/CheckboxGroup';
8
+ export type { DynamicFormProps } from './dynamic-form/DynamicForm';
9
+ export type { DynamicFormConfig, DynamicFormOutputData, DynamicFormState, FieldValidation, } from './dynamic-form/models';
10
+ export type { IconButtonProps } from './button/IconButton';
11
+ export type { InputTextProps } from './input-form-fields/InputText';
12
+ export type { InputSelectProps } from './input-form-fields/InputSelect';
13
+ export type { ListItemProps } from './list/List';
14
+ export type { MenuItemProps } from './menu/Menu';
15
+ export type { RailItem } from './navigation-rail/NavigationRail';
16
+ export type { RadioButtonProps } from './radio/RadioButton';
17
+ export type { RadioGroupProps } from './radio/RadioGroup';
18
+ export type { BackItemProps, SidebarProps } from './sidebar/Sidebar';
19
+ export type { SwitchProps } from './switch/Switch';
20
+ export type { TableRowProps } from './table/Table';
21
+ export type { DotColumnHeader } from './table/TableHeader';
22
+ export type { Order } from './table/TableBody';
23
+ export type { TableDataWithPagination } from './table/TableDataWithPagination';
24
+ export type { RowsPerPageOption } from './table/TablePagination';
25
+ export type { TabProps } from './tabs/Tabs';
26
+ export type { TypographyVariant } from './typography/Typography';
1
27
  export { DotAccordion } from './accordion/Accordion';
2
28
  export { DotActionToolbar } from './action-toolbar/ActionToolbar';
3
29
  export { DotAlertBanner } from './alert-banner/AlertBanner';
4
30
  export { DotAppLogo } from './app-logo/AppLogo';
5
- export { DotAppToolbar, AppToolbarProps } from './app-toolbar/AppToolbar';
6
- export { AutoCompleteOption, AutoCompleteProps, DotAutoComplete, AutoCompleteValue, parseAutoCompleteValue, } from './auto-complete/AutoComplete';
7
- export { AvatarProps, DotAvatar } from './avatar/Avatar';
31
+ export { DotAppToolbar } from './app-toolbar/AppToolbar';
32
+ export { DotAutoComplete, parseAutoCompleteValue, } from './auto-complete/AutoComplete';
33
+ export { DotAvatar } from './avatar/Avatar';
8
34
  export { DotAvatarGroup } from './avatar-group/AvatarGroup';
9
35
  export { DotBadge } from './badge/Badge';
10
- export { BreadcrumbItem, DotBreadcrumbs } from './breadcrumbs/Breadcrumbs';
11
- export { DotButton, ButtonProps } from './button/Button';
36
+ export { DotBreadcrumbs } from './breadcrumbs/Breadcrumbs';
37
+ export { DotButton } from './button/Button';
12
38
  export { DotButtonToggle } from './button-toggle/ButtonToggle';
13
39
  export { DotCard } from './card/Card';
14
40
  export { DotCardContent } from './card/CardContent';
15
41
  export { DotCardFooter } from './card/CardFooter';
16
42
  export { DotCardHeader } from './card/CardHeader';
17
- export { CheckboxProps, DotCheckbox } from './checkbox/Checkbox';
18
- export { DotCheckboxGroup, CheckboxGroupProps } from './checkbox/CheckboxGroup';
43
+ export { DotCheckbox } from './checkbox/Checkbox';
44
+ export { DotCheckboxGroup } from './checkbox/CheckboxGroup';
19
45
  export { DotChip } from './chip/Chip';
20
46
  export { DotConfirmationDialog } from './confirmation-dialog/ConfirmationDialog';
21
47
  export { Cell, CssCell } from './css-grid/CssCell';
@@ -23,35 +49,33 @@ export { CssGrid } from './css-grid/CssGrid';
23
49
  export { CssGridDebug } from './css-grid/CssGridDebug';
24
50
  export { DotDialog } from './dialog/Dialog';
25
51
  export { DotDrawer } from './drawer/Drawer';
52
+ export { DotJsonSchemaForm } from './json-schema-form/JsonSchemaForm';
26
53
  export { DotEmptyState } from './empty-state/EmptyState';
27
54
  export { DotForm } from './form/Form';
28
55
  export { DotFormGroup } from './form-group/FormGroup';
29
- export { DotDynamicForm, DynamicFormProps } from './dynamic-form/DynamicForm';
30
- export { DynamicFormConfig, DynamicFormOutputData, DynamicFormState, FieldValidation, } from './dynamic-form/models';
56
+ export { DotDynamicForm } from './dynamic-form/DynamicForm';
31
57
  export { DotIcon } from './icon/Icon';
32
- export { DotIconButton, IconButtonProps } from './button/IconButton';
58
+ export { DotIconButton } from './button/IconButton';
33
59
  export { DotInlineEdit } from './inline-edit/InlineEdit';
34
- export { DotInputText, InputTextProps } from './input-form-fields/InputText';
35
- export { DotInputSelect, InputSelectProps, } from './input-form-fields/InputSelect';
60
+ export { DotInputText } from './input-form-fields/InputText';
61
+ export { DotInputSelect } from './input-form-fields/InputSelect';
36
62
  export { DotLink } from './link/Link';
37
- export { DotList, ListItemProps } from './list/List';
38
- export { DotMenu, MenuItemProps } from './menu/Menu';
39
- export { DotNavigationRail, RailItem } from './navigation-rail/NavigationRail';
63
+ export { DotList } from './list/List';
64
+ export { DotMenu } from './menu/Menu';
65
+ export { DotNavigationRail } from './navigation-rail/NavigationRail';
40
66
  export { DotPill } from './pill/Pill';
41
67
  export { DotProgress } from './progress/Progress';
42
- export { DotRadioButton, RadioButtonProps } from './radio/RadioButton';
43
- export { DotRadioGroup, RadioGroupProps } from './radio/RadioGroup';
44
- export { BackItemProps, DotSidebar, SidebarProps } from './sidebar/Sidebar';
68
+ export { DotRadioButton } from './radio/RadioButton';
69
+ export { DotRadioGroup } from './radio/RadioGroup';
70
+ export { DotSidebar } from './sidebar/Sidebar';
45
71
  export { DotSkeleton } from './skeleton/Skeleton';
46
72
  export { DotSnackbar } from './snackbar/Snackbar';
47
73
  export { DotSnackbarContainer, DotSnackbarProvider, useDotSnackbarContext, } from './snackbar/SnackbarProvider';
48
74
  export { DotSplitButton } from './split-button/SplitButton';
49
- export { DotSwitch, SwitchProps } from './switch/Switch';
50
- export { DotTable, TableRowProps } from './table/Table';
75
+ export { DotSwitch } from './switch/Switch';
76
+ export { DotTable } from './table/Table';
51
77
  export { DotTooltip } from './tooltip/Tooltip';
52
- export { Order } from './table/TableBody';
53
- export { DotHeaderRow, DotColumnHeader } from './table/TableHeader';
54
- export { TableDataWithPagination } from './table/TableDataWithPagination';
55
- export { DotTablePagination, RowsPerPageOption } from './table/TablePagination';
56
- export { DotTabs, TabProps } from './tabs/Tabs';
57
- export { DotTypography, TypographyVariant } from './typography/Typography';
78
+ export { DotHeaderRow } from './table/TableHeader';
79
+ export { DotTablePagination } from './table/TablePagination';
80
+ export { DotTabs } from './tabs/Tabs';
81
+ export { DotTypography } from './typography/Typography';
@@ -0,0 +1,21 @@
1
+ import { MouseEvent, KeyboardEvent } from 'react';
2
+ import { ErrorSchema, FormValidation, IChangeEvent, ISubmitEvent, UiSchema } from 'react-jsonschema-form';
3
+ import { JSONSchema6 } from 'json-schema';
4
+ declare type BoolNumStr = boolean | number | string;
5
+ interface JsonSchemaFormProps<T> {
6
+ disabled?: boolean;
7
+ formData?: T;
8
+ liveValidate?: boolean;
9
+ onBlur?: (id: string, value: BoolNumStr) => void;
10
+ onCancel?: (event: MouseEvent<Element> | KeyboardEvent<Element>) => void;
11
+ onChange?: (event: IChangeEvent<T>, errorSchema?: ErrorSchema) => unknown;
12
+ onError?: (event: unknown) => unknown;
13
+ onFocus?: (id: string, value: BoolNumStr) => void;
14
+ onSubmit?: (event: ISubmitEvent<T>) => void;
15
+ schema: JSONSchema6;
16
+ submitButtonText?: string;
17
+ uiSchema?: UiSchema;
18
+ validate?: (formData: T, errors: FormValidation) => FormValidation;
19
+ }
20
+ declare function DotJsonSchemaForm<T>({ disabled, formData, liveValidate, onBlur, onCancel, onChange, onError, onFocus, onSubmit, schema, submitButtonText, uiSchema, validate, }: JsonSchemaFormProps<T>): JSX.Element;
21
+ export { DotJsonSchemaForm, JsonSchemaFormProps };
@@ -0,0 +1,2 @@
1
+ export declare const rootClassName = "dot-json-schema-form";
2
+ export declare const StyledActionButtonsRow: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { WidgetProps } from 'react-jsonschema-form';
3
+ export declare const CustomCheckboxWidget: ({ id, label, value, disabled, onChange, }: WidgetProps) => JSX.Element;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { WidgetProps } from 'react-jsonschema-form';
3
+ export declare const CustomCheckboxesWidget: ({ id, value, onChange, required, rawErrors, schema, disabled, options: optionsObj, }: WidgetProps) => JSX.Element;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { WidgetProps } from 'react-jsonschema-form';
3
+ export declare const CustomRadioWidget: ({ id, label, value, disabled, onChange, required, rawErrors, schema, }: WidgetProps) => JSX.Element;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { WidgetProps } from 'react-jsonschema-form';
3
+ export declare const CustomSelectWidget: ({ autofocus, disabled, id, label, onChange, rawErrors, required, schema, value, }: WidgetProps) => JSX.Element;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { WidgetProps } from 'react-jsonschema-form';
3
+ export declare const CustomTextWidget: ({ autofocus, id, label, value, disabled, onChange, required, rawErrors, schema, }: WidgetProps) => JSX.Element;
@@ -0,0 +1,10 @@
1
+ export declare const getOptionsFromSchema: (optionsObj: {
2
+ [key: string]: string | number | boolean | object;
3
+ }) => {
4
+ label: string;
5
+ value: string;
6
+ }[];
7
+ export declare const useProcessRawErrors: (rawErrors: Array<string>) => {
8
+ error: boolean;
9
+ errorHelperText: string;
10
+ };
@@ -0,0 +1,5 @@
1
+ export { CustomCheckboxWidget } from './CustomCheckboxWidget';
2
+ export { CustomTextWidget } from './CustomTextWidget';
3
+ export { CustomCheckboxesWidget } from './CustomCheckboxesWidget';
4
+ export { CustomSelectWidget } from './CustomSelectWidget';
5
+ export { CustomRadioWidget } from './CustomRadioWidget';
@@ -38,7 +38,7 @@ export interface ListProps extends CommonProps {
38
38
  /** If 'menu' the nested list will be displayed as a flyout nav, else it will be an expand/collapse toggle list */
39
39
  nestedListType?: NestedListType;
40
40
  /** Width of list, defaults to 240px */
41
- width?: number;
41
+ width?: number | string;
42
42
  }
43
43
  export interface ListItemProps extends CommonProps {
44
44
  /** string or JSX element that is displayed inside the list */
@@ -37,8 +37,12 @@ export declare const defaultData: ({
37
37
  fans: number;
38
38
  delete: {
39
39
  children: JSX.Element;
40
+ dataTestId: string;
41
+ disabled: boolean;
42
+ iconId: string;
40
43
  key: string;
41
44
  onclick: () => void;
45
+ tooltip: string;
42
46
  }[];
43
47
  };
44
48
  } | {
@@ -49,8 +53,12 @@ export declare const defaultData: ({
49
53
  fans: number;
50
54
  delete: {
51
55
  children: JSX.Element;
56
+ dataTestId: string;
57
+ disabled: boolean;
58
+ iconId: string;
52
59
  key: string;
53
60
  onclick: () => void;
61
+ tooltip: string;
54
62
  }[];
55
63
  };
56
64
  selected?: undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digital-ai/dot-components",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN <LICENSE.md>",
6
6
  "contributors": [
@@ -31,6 +31,7 @@
31
31
  "styled-components": "^5.2.1"
32
32
  },
33
33
  "peerDependencies": {
34
- "react": "^16.8.0 || ^17.0.0"
34
+ "react": "^16.8.0 || ^17.0.0",
35
+ "react-jsonschema-form": "^1.8.1"
35
36
  }
36
37
  }