Skip to content

Commit 226060c

Browse files
committed
feat(CC-batch-4): updated dual list
1 parent ceb380e commit 226060c

6 files changed

Lines changed: 119 additions & 72 deletions

File tree

packages/code-connect/components/DualListSelector/DualListHeader.figma.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,18 @@ figma.connect(
1212
itemInformation: figma.string('Item information'),
1313

1414
// boolean
15-
isSearchable: figma.boolean('Has search bar'),
15+
isSearchable: figma.boolean('Has search bar', {
16+
true: `buildSearchInput(true)`,
17+
false: undefined
18+
}),
1619
onSearch: figma.boolean('Has search bar', {
1720
true: () => {},
1821
false: undefined
1922
}),
2023

21-
hasSort: figma.boolean('Has search bar', {
24+
// TODO: FIGMA: Add sort button
25+
26+
actions: figma.boolean('Has search bar', {
2227
true: [
2328
<Button
2429
variant={ButtonVariant.plain}
@@ -44,11 +49,14 @@ figma.connect(
4449
example: (props) => (
4550
// Documentation for DualListHeader can be found at https://www.patternfly.org/components/dual-list-selector
4651
<DualListSelectorPane
47-
searchInput={props.isSearchable}
52+
actions={props.actions}
53+
listMinHeight="300px"
4854
onSearch={props.onSearch}
49-
actions={props.hasSort}
55+
searchInput={props.isSearchable}
5056
title={props.title}
51-
></DualListSelectorPane>
57+
>
58+
{props.children}
59+
</DualListSelectorPane>
5260
)
5361
}
5462
);

packages/code-connect/components/DualListSelector/DualListItemBaseComponent.figma.tsx

Lines changed: 0 additions & 30 deletions
This file was deleted.

packages/code-connect/components/DualListSelector/DualListItemTree.figma.tsx

Lines changed: 0 additions & 17 deletions
This file was deleted.

packages/code-connect/components/DualListSelector/DualListItemTypes.figma.tsx

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,80 @@
1-
import { DualListSelector } from '@patternfly/react-core';
1+
import {
2+
DualListSelector,
3+
DualListSelectorList,
4+
DualListSelectorPane,
5+
DualListSelectorControl,
6+
DualListSelectorControlsWrapper
7+
} from '@patternfly/react-core';
28
import figma from '@figma/code-connect';
9+
import AngleRightIcon from '@patternfly/react-icons/icons/angle-right-icon/dist/esm/icons/angle-right-icon';
10+
import AngleDoubleRightIcon from '@patternfly/react-icons/icons/angle-double-right-icon/dist/esm/icons/angle-double-right-icon';
11+
import AngleDoubleLeftIcon from '@patternfly/react-icons/icons/angle-double-left-icon/dist/esm/icons/angle-double-left-icon';
12+
import AngleLeftIcon from '@patternfly/react-icons/icons/angle-left-icon/dist/esm/icons/angle-left-icon';
313

414
figma.connect(
515
DualListSelector,
616
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6--Components-Test?node-id=29667-231683',
717
{
818
props: {
9-
children: figma.children('*')
19+
children: figma.children('Dual list item*')
1020
},
1121
example: (props) => (
1222
// Documentation for DualListSelector can be found at https://www.patternfly.org/components/dual-list-selector
13-
<DualListSelector>{props.children}</DualListSelector>
23+
// TODO: FIGMA: isTree: figma.boolean('Expandable'),
24+
// properties are static now, but will be dynamic once pane is introduced
25+
<DualListSelector>
26+
{/*
27+
TODO: FIGMA: Configure Dual list selector pane
28+
> properties are static now, but will be dynamic once pane is introduced
29+
*/}
30+
<DualListSelectorPane
31+
title="Available options"
32+
searchInput={buildSearchInput(false)}
33+
actions={[buildSort(false)]}
34+
listMinHeight="300px"
35+
isChosen
36+
status={() => {}}
37+
>
38+
<DualListSelectorList>{props.children}</DualListSelectorList>
39+
</DualListSelectorPane>
40+
{/*
41+
TODO: FIGMA: Configure Dual list selector controls
42+
properties are static now, but will be dynamic once controls are introduced
43+
*/}
44+
<DualListSelectorControlsWrapper>
45+
<DualListSelectorControl
46+
isDisabled={false}
47+
onClick={() => {}}
48+
aria-label="Add selected"
49+
icon={<AngleRightIcon />}
50+
/>
51+
<DualListSelectorControl
52+
isDisabled={false}
53+
onClick={() => {}}
54+
aria-label="Add all"
55+
icon={<AngleDoubleRightIcon />}
56+
/>
57+
<DualListSelectorControl
58+
isDisabled={false}
59+
onClick={() => {}}
60+
aria-label="Remove all"
61+
icon={<AngleDoubleLeftIcon />}
62+
/>
63+
<DualListSelectorControl
64+
isDisabled={false}
65+
onClick={() => {}}
66+
aria-label="Remove selected"
67+
icon={<AngleLeftIcon />}
68+
/>
69+
</DualListSelectorControlsWrapper>
70+
{/*
71+
TODO: FIGMA: Configure Dual list selector pane
72+
> properties are static now, but will be dynamic once pane is introduced
73+
*/}
74+
<DualListSelectorPane title="Choose options" status={() => {}}>
75+
<DualListSelectorList>{props.children}</DualListSelectorList>
76+
</DualListSelectorPane>
77+
</DualListSelector>
1478
)
1579
}
1680
);
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { DualListSelectorListItem } from '@patternfly/react-core';
2+
import figma from '@figma/code-connect';
3+
4+
figma.connect(
5+
DualListSelectorListItem,
6+
'https://www.figma.com/design/aEBBvq0J3EPXxHvv6WgDx9/PatternFly-6--Components-Test?node-id=29667-231683',
7+
{
8+
props: {
9+
// string
10+
itemText: figma.string('Item text'),
11+
12+
// boolean
13+
isDraggable: figma.boolean('Is Draggable'),
14+
draggableButtonAriaLabel: figma.boolean('Is Draggable', {
15+
true: 'Draggable list item',
16+
false: undefined
17+
}),
18+
19+
// enum
20+
isSelected: figma.enum('State', { Selected: true }),
21+
children: figma.children('*')
22+
},
23+
example: (props) => (
24+
// TODO: FIGMA: Dual list item types and tree setting should come from this component
25+
// Documentation for DualListSelector can be found at https://www.patternfly.org/components/dual-list-selector
26+
<DualListSelectorListItem
27+
id="dual-list-selector-list-item-id"
28+
isSelected={props.isSelected}
29+
isDraggable={props.isDraggable}
30+
key="dual-list-selector-list-item-key"
31+
draggableButtonAriaLabel={props.draggableButtonAriaLabel}
32+
onOptionSelect={() => {}}
33+
>
34+
{props.itemText}
35+
{props.children}
36+
</DualListSelectorListItem>
37+
)
38+
}
39+
);

0 commit comments

Comments
 (0)