Skip to content

Commit 8ab13af

Browse files
authored
Merge pull request #800 from rvsia/addCarbonDualList
feat(carbon): add dual list component
2 parents 1f7220e + b402c0e commit 8ab13af

File tree

8 files changed

+1049
-36
lines changed

8 files changed

+1049
-36
lines changed

packages/carbon-component-mapper/demo/index.js

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,38 @@ class App extends React.Component {
4545
componentMapper={componentMapper}
4646
FormTemplate={(props) => <FormTemplate {...props} showFormControls={this.state.additionalOptions.showFormControls} />}
4747
onCancel={console.log}
48-
schema={this.state.schema}
48+
//schema={this.state.schema}
49+
schema={{
50+
fields: [
51+
{
52+
component: 'dual-list-select',
53+
name: 'dual-list',
54+
label: 'select animal',
55+
options: [
56+
{
57+
value: 'cats',
58+
label: 'cats'
59+
},
60+
{
61+
value: 'cats_1',
62+
label: 'cats_1'
63+
},
64+
{
65+
value: 'cats_2',
66+
label: 'cats_2'
67+
},
68+
{
69+
value: 'zebras',
70+
label: 'zebras'
71+
},
72+
{
73+
value: 'pigeons',
74+
label: 'pigeons'
75+
}
76+
]
77+
}
78+
]
79+
}}
4980
{...this.state.additionalOptions}
5081
/>
5182
</div>

packages/carbon-component-mapper/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"carbon-components": "^10.19.0",
4343
"carbon-components-react": "^7.19.0",
4444
"carbon-icons": "^7.0.7",
45+
"clsx": "^1.1.1",
4546
"css-loader": "^1.0.1",
4647
"enzyme": "^3.7.0",
4748
"enzyme-adapter-react-16": "^1.7.0",

packages/carbon-component-mapper/src/files/dual-list-select.d.ts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,68 @@ import { FormGroupProps } from "./form-group";
22
import { UseFieldApiComponentConfig, AnyObject } from "@data-driven-forms/react-form-renderer";
33
import { ReactNode } from "react";
44

5+
import {
6+
FormGroupProps as CarbonFormGroups,
7+
GridDefaultProps, RowDefaultProps,
8+
ColumnDefaultProps, ButtonProps,
9+
SearchProps, TooltipIconProps,
10+
StructuredListProps, StructuredListBodyProps,
11+
AllStructuredListRowProps,
12+
StructuredListCellProps
13+
} from 'carbon-components-react';
14+
515
export interface DualListSelectValue extends AnyObject {
616
value: any;
717
label: ReactNode;
18+
ListRowProps?: AllStructuredListRowProps;
19+
ListCellProps?: StructuredListCellProps;
20+
GridProps?: GridDefaultProps;
21+
RowProps?: RowDefaultProps;
22+
LabelProps?: ColumnDefaultProps;
23+
CheckmarkProps?: ColumnDefaultProps;
824
}
925

1026
interface InternalDualListSelectProps {
1127
options: DualListSelectValue[];
28+
noOptionsTitle?: ReactNode;
29+
noValueTitle?: ReactNode;
30+
leftTitle?: ReactNode;
31+
rightTitle?: ReactNode;
32+
LeftTitleElement?: string;
33+
RightTitleElement?: string;
34+
LeftTitleProps?: AnyObject;
35+
RightTitleProps?: AnyObject;
36+
moveLeftTitle?: ReactNode;
37+
moveRightTitle?: ReactNode;
38+
moveAllLeftTitle?: ReactNode;
39+
moveAllRightTitle?: ReactNode;
40+
label?: ReactNode;
41+
filterOptionsTitle?: string;
42+
filterValuesTitle?: string;
43+
sortOptionsTitle?: string;
44+
sortValuesTitle?: string;
45+
filterOptionsText?: ReactNode;
46+
filterValueText?: ReactNode;
47+
FormGroupProps?: CarbonFormGroups;
48+
GridProps?: GridDefaultProps;
49+
RowProps?: RowDefaultProps;
50+
OptionsColumnProps?: ColumnDefaultProps;
51+
ButtonColumnProps?: ColumnDefaultProps;
52+
ValuesColumnProps?: ColumnDefaultProps;
53+
AddButtonProps?: ButtonProps;
54+
AddAllButtonProps?: ButtonProps;
55+
RemoveButtonProps?: ButtonProps;
56+
RemoveAllButtonProps?: ButtonProps;
57+
LeftToolbarProps?: React.HTMLProps<HTMLDivElement>;
58+
RightToolbarProps?: React.HTMLProps<HTMLDivElement>;
59+
LeftSearchProps?: SearchProps;
60+
RightSearchProps?: SearchProps;
61+
LeftSortProps?: TooltipIconProps;
62+
RightSortProps?: TooltipIconProps;
63+
LeftListProps?: StructuredListProps;
64+
LeftBodyProps?: StructuredListBodyProps;
65+
RightListProps?: StructuredListProps;
66+
RightBodyProps?: StructuredListBodyProps
1267
}
1368

1469
export type DualListSelectProps = InternalDualListSelectProps & FormGroupProps & UseFieldApiComponentConfig;

0 commit comments

Comments
 (0)