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

22 lines 1.34 kB
import { jsx as _jsx } from "react/jsx-runtime"; import React from 'react'; import { STYLES_NAME } from '../../constants/stylesName/stylesName'; import { useStyles } from '../../hooks/useStyles/useStyles'; import { ErrorBoundary } from '../../provider/errorBoundary/errorBoundary'; import { FallbackComponent } from '../../provider/errorBoundary/fallbackComponent'; import { PillStandAlone } from './pillStandAlone'; const PillControlledComponent = React.forwardRef((props, ref) => { const sizeStyles = useStyles(STYLES_NAME.PILL, props.size, props.ctv); const variantStyles = sizeStyles ? sizeStyles[props.variant] : {}; const handleOnChange = event => { props.onPillChange?.(event.target.checked, props.value || ''); }; return (_jsx(PillStandAlone, { ...props, ref: ref, styles: variantStyles, onPillChange: handleOnChange, children: props.children })); }); PillControlledComponent.displayName = 'PillControlledComponent'; const PillBoundary = (props, ref) => (_jsx(ErrorBoundary, { fallBackComponent: _jsx(FallbackComponent, { children: _jsx(PillStandAlone, { ...props, ref: ref }) }), children: _jsx(PillControlledComponent, { ...props, ref: ref }) })); /** * @deprecated Try the new PillV2 component */ export const PillControlled = React.forwardRef(PillBoundary); //# sourceMappingURL=pillControlled.js.map