@clicoh/orion-library 1.0.18 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/Input/Input.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/Input/Input.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAMf,KAAK,UAAU,GAAG;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE;QACL,IAAI,EAAE,IAAI,CACR,iBAAiB,CACf,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,gBAAgB,CACjB,CAAC,MAAM,CAAC,EACT,QAAQ,GAAG,UAAU,GAAG,OAAO,CAChC,CAAC;KACH,GAAG,IAAI,CACN,iBAAiB,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,EAC1E,aAAa,CACd,CAAC;IACF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,KAAK,EACL,UAAU,EACV,KAAK,EACL,KAAK,EACL,KAAK,GACN,EAAE,UAAU,GAAG,SAAS,CAqFxB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { useEffect, useState, } from 'react';
|
|
4
|
+
import { FiEye, FiEyeOff } from 'react-icons/fi';
|
|
4
5
|
import { generateUniqueId } from '../../../utils';
|
|
5
6
|
import { generateBorder } from './utils/border';
|
|
6
7
|
import { RenderErrorOrHelperText } from './utils/RenderErrorOrHelperText';
|
|
@@ -31,6 +32,9 @@ import { RenderErrorOrHelperText } from './utils/RenderErrorOrHelperText';
|
|
|
31
32
|
*/
|
|
32
33
|
export function Input({ label, input, helperText, error, iconL, iconR, }) {
|
|
33
34
|
const [id, setId] = useState('');
|
|
35
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
36
|
+
const isPassword = input.type === 'password';
|
|
37
|
+
const effectiveType = isPassword && showPassword ? 'text' : input.type;
|
|
34
38
|
const inputClasses = clsx('peer disabled:text-gray-3 h-full w-full rounded-full bg-transparent px-5 text-sm font-normal text-black outline-0 transition-all focus:text-black', input.className);
|
|
35
39
|
const { labelProps, legendClasses, fieldsetClasses } = generateBorder(error);
|
|
36
40
|
if (id) {
|
|
@@ -40,9 +44,12 @@ export function Input({ label, input, helperText, error, iconL, iconR, }) {
|
|
|
40
44
|
useEffect(() => {
|
|
41
45
|
setId(generateUniqueId());
|
|
42
46
|
}, []);
|
|
47
|
+
const rightSlot = isPassword ? (<button type="button" onClick={() => setShowPassword((prev) => !prev)} aria-pressed={showPassword} aria-label={showPassword ? 'Ocultar contraseña' : 'Mostrar contraseña'} disabled={input.disabled} className={clsx('peer-disabled:text-gray-3 flex cursor-pointer items-center justify-center rounded-full p-1 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-black/20 disabled:cursor-not-allowed', error ? 'text-error' : 'text-black')}>
|
|
48
|
+
{showPassword ? <FiEyeOff size={18}/> : <FiEye size={18}/>}
|
|
49
|
+
</button>) : (iconR);
|
|
43
50
|
return (<div className="w-full max-w-full">
|
|
44
51
|
<div className="relative h-9">
|
|
45
|
-
<input {...input} className={inputClasses} placeholder=" "/>
|
|
52
|
+
<input {...input} type={effectiveType} className={inputClasses} placeholder=" "/>
|
|
46
53
|
<label {...labelProps}>{label}</label>
|
|
47
54
|
<fieldset className={fieldsetClasses}>
|
|
48
55
|
<legend className={legendClasses}>{label}</legend>
|
|
@@ -50,8 +57,8 @@ export function Input({ label, input, helperText, error, iconL, iconR, }) {
|
|
|
50
57
|
{!!iconL && (<span className={clsx('peer-disabled:text-gray-3 absolute top-3 left-1', error ? 'text-error' : 'text-black')}>
|
|
51
58
|
{iconL}
|
|
52
59
|
</span>)}
|
|
53
|
-
{!!
|
|
54
|
-
{
|
|
60
|
+
{!!rightSlot && (<span className={clsx('peer-disabled:text-gray-3 absolute top-2 right-2', error ? 'text-error' : 'text-black')}>
|
|
61
|
+
{rightSlot}
|
|
55
62
|
</span>)}
|
|
56
63
|
</div>
|
|
57
64
|
<RenderErrorOrHelperText disabled={input.disabled} helperText={helperText} error={error} className="pl-6"/>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.jsx","sourceRoot":"","sources":["../../../../src/components/01-atoms/Input/Input.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAIL,SAAS,EACT,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAsB1E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,KAAK,CAAC,EACpB,KAAK,EACL,KAAK,EACL,UAAU,EACV,KAAK,EACL,KAAK,EACL,KAAK,GACM;IACX,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"Input.jsx","sourceRoot":"","sources":["../../../../src/components/01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