-
Notifications
You must be signed in to change notification settings - Fork 37
/
ValueChip.js
46 lines (43 loc) · 1.22 KB
/
ValueChip.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import React from 'react';
import PropTypes from 'prop-types';
import IconButton from '../IconButton';
import css from './MultiSelect.css';
const ValueChip = ({
children,
disabled,
id,
getRemoveButtonProps,
controlLabelId,
descriptionId,
item,
index,
}) => (
<li key={id} className={css.valueChipRoot} id={`${id}_multiselect_selected`}>
<div className={css.valueChipGroup}>
<div className={css.valueChipValue} id={`${id}_multiselect_selected_label`}>
{children}
</div>
<IconButton
aria-labelledby={`${id}_multiselect_selected_label ${controlLabelId}`}
aria-describedby={descriptionId}
disabled={disabled}
icon="times"
size="small"
iconSize="small"
style={{ padding: 0 }} // set padding: 0 for odd spacing behavior in IE.
{...getRemoveButtonProps({ item, index })}
/>
</div>
</li>
);
ValueChip.propTypes = {
children: PropTypes.node,
controlLabelId: PropTypes.string,
descriptionId: PropTypes.string,
disabled: PropTypes.bool,
getRemoveButtonProps: PropTypes.func,
id: PropTypes.string,
index: PropTypes.number,
item: PropTypes.object
};
export default ValueChip;