1 | import React from 'react';
|
2 | import MultiselectTag from './MultiselectTag';
|
3 |
|
4 | function MultiselectTagList({
|
5 | id,
|
6 | value,
|
7 | textAccessor,
|
8 | label,
|
9 | disabled,
|
10 | readOnly,
|
11 | onDelete,
|
12 | children,
|
13 | clearTagIcon,
|
14 | renderTagValue,
|
15 | tagOptionComponent: TagOption = MultiselectTag
|
16 | }) {
|
17 | return React.createElement("div", {
|
18 | id: id,
|
19 | role: "listbox",
|
20 | "aria-label": label,
|
21 | "aria-multiselectable": "true",
|
22 | "aria-orientation": "horizontal",
|
23 | className: "rw-multiselect-taglist"
|
24 | }, value.map((item, i) => {
|
25 | const itemDisabled = Array.isArray(disabled) ? disabled.includes(item) : !!disabled;
|
26 | return React.createElement(TagOption, {
|
27 | key: i,
|
28 | dataItem: item,
|
29 | onRemove: onDelete,
|
30 | clearTagIcon: clearTagIcon,
|
31 | disabled: itemDisabled,
|
32 | readOnly: readOnly
|
33 | }, renderTagValue ? renderTagValue({
|
34 | item
|
35 | }) : textAccessor(item));
|
36 | }), children);
|
37 | }
|
38 |
|
39 | export default MultiselectTagList; |
\ | No newline at end of file |