Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const { getOptionProps, getDisabledOptionProps } = data
const {
id,
isDisabled,
isHighlighted,
isSelected,
renderBeforeLabel,
renderAfterLabel,
children
} = option.props
let optionProps = {
// passthrough props
...omitProps(option.props, {
...Option.propTypes,
...Options.Item.propTypes
}),
// props from selectable
...getOptionProps({ id }),
// Options.Item props
renderBeforeLabel,
renderAfterLabel
}
// should option be treated as highlighted or selected
if (isSelected) {
optionProps.variant = 'selected'
} else if (isHighlighted) {
optionProps.variant = 'highlighted'
}
// should option be treated as disabled
if (isDisabled) {
optionProps.variant = 'disabled'