Untitled
unknown
plain_text
a month ago
8.1 kB
4
Indexable
Never
im not able to enter the input values, check and update the code accordingly import React from 'react'; import { Password } from 'primereact/password'; import PrimeWrapper from '../primeWrapper/primewrapper'; import PropTypes from 'prop-types'; import classNames from 'classnames'; const PrimePassword = (props) => { return ( (props.showif !== undefined ? props.showif : true) && ( <span className="prime-input-text-wrapper"> <div> <label className={props.labelClassName}> {props.evalLangText(props)}</label> </div> <Password id={props.id} value={props.value || ''} onChange={props.onChange} onInput={props.onInput} className={props.className} inputClassName={props.inputClassName} style={props.style} inputStyle={props.inputStyle} placeholder={props.placeholder} disabled={props.disabled} autoFocus={props.autoFocus} autoComplete={props.autoComplete} maxLength={props.maxLength} keyfilter={props.keyfilter} invalid={props.invalid} feedback={props.feedback} promptLabel={props.promptLabel} panelClassName={props.panelClassName} panelStyle={props.panelStyle} weakLabel={props.weakLabel} mediumLabel={props.mediumLabel} strongLabel={props.strongLabel} mediumRegex={props.mediumRegex} strongRegex={props.strongRegex} toggleMask={props.toggleMask} icon={props.icon} tooltip={props.tooltip} tooltipOptions={props.tooltipOptions} panelStyle={props.panelStyle} panelClassName={props.panelClassName} header={props.header} footer={props.footer} showIcon={props.showIcon} hideIcon={props.hideIcon} meter={props.meter} meterLabel={props.meterLabel} tabIndex={props.tabIndex} required={props.required} ariaLabel={props.ariaLabel} ariaLabelledBy={props.ariaLabelledBy} onBlur={props.onBlur} onFocus={props.onFocus} onHide={props.onHide} onShow={props.onShow} {...props}> {props.children} </Password> </span> ) ); }; PrimePassword.propTypes = { /** Define a unique id for the component */ id: PropTypes.string, /** The value of component */ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), /** Event handler triggered when the user commits a change to the component's value. */ onChange: PropTypes.func, /** Callback to invoke while typing value on input */ onInput: PropTypes.func, /** List of CSS classnames to apply on wrapper element */ className: PropTypes.string, /** Style class of the input element. */ inputClassName: PropTypes.string, /** Inline styles applied to apply on wrapper element */ style: PropTypes.object, /** Inline style of the input element. */ inputStyle: PropTypes.object, /** Temporary text element that can be replaced with something else */ placeholder: PropTypes.string, /** Setting this attribute will disable the textbox */ disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), /** Sets autofocus property on textbox */ autoFocus: PropTypes.bool, /** Sets auto complete property on textbox */ autoComplete: PropTypes.string, /** Maximum number of characters allowed in the input field. */ maxLength: PropTypes.number, /** Format definition of the keys to block. */ keyfilter: PropTypes.any, /** Invalid state is displayed using the invalid prop to indicate a failed validation. */ invalid: PropTypes.string, /** Whether to display a strength indicator or not.. */ feedback: PropTypes.bool, /** Text for prompt when the field is empty. */ promptLabel: PropTypes.string, /** Label for a weak password. */ weakLabel: PropTypes.string, /** Label for a medium-strength password. */ mediumLabel: PropTypes.string, /** Label for a strong password. */ strongLabel: PropTypes.string, /**Regex for a medium-strength password. */ mediumRegex: PropTypes.string, /** Regex for a strong password. */ strongRegex: PropTypes.string, /** Whether to show an icon to toggle password . */ toggleMask: PropTypes.bool, /** Template of mask icon if "toggleMask" is enabled. */ icon: PropTypes.any, /** Content of the tooltip. */ tooltip: PropTypes.string, /** Configuration of the tooltip, refer to the tooltip documentation for more information. */ tooltipOptions: PropTypes.object, /** Inline style of the overlay panel element. */ panelClassName: PropTypes.string, /** Inline style of the overlay panel element. */ panelStyle: PropTypes.object, /** Template of panel content if "feedback" is enabled. */ content: PropTypes.func, /** Content to display at the top of the strength indicator panel. */ header: PropTypes.oneOfType([PropTypes.ReactNode, PropTypes.Function]), /** Content to display at the bottom of the strength indicator panel. */ footer: PropTypes.oneOfType([PropTypes.ReactNode, PropTypes.Function]), /** Displays an eye icon to show/hide password. */ showIcon: PropTypes.bool, /** Displays an eye icon to show/hide password. */ hideIcon: PropTypes.bool, /** Uses to pass attributes to the meter's DOM element. */ meter: PropTypes.bool, /** Uses to pass attributes to the label's DOM element. */ meterLabel: PropTypes.bool, /** Specifies the tab order of the input element when the user navigates using the keyboard. */ tabIndex: PropTypes.number, /** Determines if an input is required for Form validation */ required: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), //////////////////// TO-DO WITH REACT HOOK FORMS /** Attribute is used to define a string that labels the current element. Use it in cases where a text label is not visible on the screen. */ ariaLabel: PropTypes.string, /** Attribute establishes relationships between objects and their label(s), and its value should be one or more element IDs. */ ariaLabelledBy: PropTypes.string, /** Callback to invoke on input event of input field. */ onInput: PropTypes.func, /** Takes a user defined javascript function which executes on a 'blur' event .*/ onBlur: PropTypes.func, /** Event handler which is triggered when the input field gains focus. */ onFocus: PropTypes.func, /** Callback to invoke when overlay becomes hidden. */ onHide: PropTypes.func, /** Callback to invoke when overlay becomes visible. */ onShow: PropTypes.func, /** Determines if the component is hidden or shown */ showif: PropTypes.bool, /** Accepts a Content Manager key and assigns the value to the label of the input */ labelKey: PropTypes.string, /** List of CSS classnames to apply on label element */ labelClassName: PropTypes.string, }; PrimePassword.defaultProps = { value: '', feedback: true, autoComplete: 'off', promptLabel: 'Please enter a password', weakLabel: 'Weak', mediumLabel: 'Medium', strongLabel: 'Strong', mediumRegex: '^(((?=.*[a-z])(?=.*[A-Z]))|((?=.*[a-z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[0-9])))(?=.{6,}).', strongRegex: '^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.{8,})', }; export default PrimeWrapper(PrimePassword);
Leave a Comment