UNPKG

@kubit-ui-web/react-components

Version:

Kubit React Components is a customizable, accessible library of React web components, designed to enhance your application's user experience

20 lines 1.52 kB
import { jsx as _jsx } from "react/jsx-runtime"; import React from 'react'; import { Pill as PillV2 } from '../pillV2/pill'; import { PillType } from '../pillV2/types/pillType'; import { RootContainerStyled } from './pillSelector.styled'; import { PillSelectorType } from './types/pillSelectorType'; const PillSelectorStandAloneComponent = ({ dataTestId = 'pill-selector', ...props }, ref) => { return (_jsx(RootContainerStyled, { ref: ref, "data-testid": dataTestId, styles: props.styles, children: props.pills?.map((pill, index) => { const selected = props.type === PillSelectorType.SELECTOR_MULTIPLE ? pill.value !== undefined && Array.isArray(props.value) && props.value.includes(pill.value) : pill.value === props.value; return (_jsx(PillV2, { dataTestId: pill.dataTestId, disabled: pill.disabled ?? props.disabled, label: pill.label, leftIcon: pill.icon, name: props.name, rightIcon: selected ? props.selectedIcon : undefined, selected: selected, size: pill.size ?? props.styles?.pill?.size, type: props.type === PillSelectorType.SELECTOR_MULTIPLE ? PillType.SELECTOR_MULTIPLE : PillType.SELECTOR_SIMPLE, value: pill.value, variant: pill.variant ?? props.styles?.pill?.variant, onChange: props.onPillChange }, index)); }) })); }; export const PillSelectorStandAlone = React.forwardRef(PillSelectorStandAloneComponent); //# sourceMappingURL=pillSelectorStandAlone.js.map