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

23 lines 1.08 kB
import { jsx as _jsx } from "react/jsx-runtime"; import React from 'react'; import { STYLES_NAME } from '../../constants/stylesName/stylesName'; import { useStylesV2 } from '../../hooks/useStyles/useStylesV2'; import { PillStandAlone } from './pillStandAlone'; import { getPillState } from './utils/state'; const PillComponent = ({ variant, size, ctv, selected = false, disabled = false, ...props }, ref) => { const variantStyles = useStylesV2({ styleName: STYLES_NAME.PILL_V2, variantName: variant, customTokens: ctv, isOptional: true, }); const state = getPillState({ selected, disabled }); // Size prop is optional, else select the first size from the variantStyles const styles = size ? variantStyles?.[size]?.[state] : variantStyles?.[Object.keys(variantStyles)[0]]?.[state]; return (_jsx(PillStandAlone, { ref: ref, disabled: disabled, selected: selected, styles: styles, ...props })); }; export const Pill = React.forwardRef(PillComponent); export { Pill as PillV2 }; //# sourceMappingURL=pill.js.map