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

26 lines 1.94 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.PillSelectorStandAlone = void 0; const jsx_runtime_1 = require("react/jsx-runtime"); const react_1 = __importDefault(require("react")); const pill_1 = require("../pillV2/pill"); const pillType_1 = require("../pillV2/types/pillType"); const pillSelector_styled_1 = require("./pillSelector.styled"); const pillSelectorType_1 = require("./types/pillSelectorType"); const PillSelectorStandAloneComponent = ({ dataTestId = 'pill-selector', ...props }, ref) => { return ((0, jsx_runtime_1.jsx)(pillSelector_styled_1.RootContainerStyled, { ref: ref, "data-testid": dataTestId, styles: props.styles, children: props.pills?.map((pill, index) => { const selected = props.type === pillSelectorType_1.PillSelectorType.SELECTOR_MULTIPLE ? pill.value !== undefined && Array.isArray(props.value) && props.value.includes(pill.value) : pill.value === props.value; return ((0, jsx_runtime_1.jsx)(pill_1.Pill, { 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_1.PillSelectorType.SELECTOR_MULTIPLE ? pillType_1.PillType.SELECTOR_MULTIPLE : pillType_1.PillType.SELECTOR_SIMPLE, value: pill.value, variant: pill.variant ?? props.styles?.pill?.variant, onChange: props.onPillChange }, index)); }) })); }; exports.PillSelectorStandAlone = react_1.default.forwardRef(PillSelectorStandAloneComponent); //# sourceMappingURL=pillSelectorStandAlone.js.map