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.97 kB
import { jsx as _jsx } from "react/jsx-runtime"; // vendors import React from 'react'; import { STYLES_NAME } from '../../constants/stylesName/stylesName'; import { useId } from '../../hooks/useId/useId'; import { useStyles } from '../../hooks/useStyles/useStyles'; import { ErrorBoundary } from '../../provider/errorBoundary/errorBoundary'; import { FallbackComponent } from '../../provider/errorBoundary/fallbackComponent'; import { AriaLiveOptionType } from '../../types/ariaLiveOption/ariaLiveOption'; import { mergeObjects } from '../../utils/mergeObjects/mergeObjects'; import { InputStandAlone } from './inputStandAlone'; import { AUTOCOMPLETE_TYPE, } from './types/input'; import { InputIconPosition } from './types/inputTheme'; const InputControlledComponent = React.forwardRef(({ iconPosition = InputIconPosition.RIGHT, errorAriaLiveType = AriaLiveOptionType.POLITE, extraAriaLabelledBy = '', autocomplete = AUTOCOMPLETE_TYPE.ON, disabledCopyAndPaste = false, ctv, ...props }, ref) => { let styles = useStyles(STYLES_NAME.INPUT, props.variant, ctv); // TODO improvement this merge object in THEME styles = mergeObjects({ ...styles }, props.overrideStyles ?? {}); const uniqueId = useId('input'); const inputId = props.id ?? uniqueId; return (_jsx(InputStandAlone, { ...props, ref: ref, autocomplete: autocomplete, disabledCopyAndPaste: disabledCopyAndPaste, errorAriaLiveType: errorAriaLiveType, extraAriaLabelledBy: extraAriaLabelledBy, iconPosition: iconPosition, inputId: inputId, styles: styles })); }); InputControlledComponent.displayName = 'InputControlledComponent'; const InputBoundary = (props, ref) => (_jsx(ErrorBoundary, { fallBackComponent: _jsx(FallbackComponent, { children: _jsx(InputStandAlone, { ...props, ref: ref }) }), children: _jsx(InputControlledComponent, { ...props, ref: ref }) })); const InputControlled = React.forwardRef(InputBoundary); export { InputControlled }; //# sourceMappingURL=inputControlled.js.map