@adam-milo/ui 1.0.61 → 1.0.62
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.
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +3 -3
- package/dist/index92.cjs +1 -1
- package/dist/index92.js +1 -1
- package/package.json +1 -1
package/dist/index58.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),r=require("./index67.cjs"),s=require("./index51.cjs"),l=require("./index92.cjs"),a=require("./index60.cjs"),o=require("./index69.cjs"),i=t.forwardRef(({type:i="text",label:n,tooltip:c,error:d,helperText:u,fullWidth:h=!1,showPasswordToggle:p=!0,showLastChar:x=!0,lastCharDelay:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),r=require("./index67.cjs"),s=require("./index51.cjs"),l=require("./index92.cjs"),a=require("./index60.cjs"),o=require("./index69.cjs"),i=t.forwardRef(({type:i="text",label:n,tooltip:c,error:d,helperText:u,fullWidth:h=!1,showPasswordToggle:p=!0,showLastChar:x=!0,lastCharDelay:g=500,validate:f,onValidationChange:j,className:y,id:v,onChange:m,onBlur:w,required:k,value:C,"data-cy":S,"data-testid":b,...N},$)=>{const[T,q]=t.useState(!1),[M,R]=t.useState(),[W,L]=t.useState(!1),[E,B]=t.useState(!1),P=t.useRef(!1),[D,F]=t.useState(""),I=t.useRef(""),O=t.useRef(null),V=t.useRef(null),z=a.useMergedRef($,V),A=t.useId(),H=v||A,_=`${H}-error`,G=`${H}-helper`,J=S||"input",K=b||"input",Q="password"===i,U=Q&&p,X=Q&&x&&!T&&void 0===C,Y=Q&&(T||X&&I.current.length>0)?"text":i,Z=n&&k&&!n.includes("*")?`${n} *`:n,ee=t.useMemo(()=>o.debounce(e=>{if(f&&P.current){const t=f(e);R(t),j?.(!t)}},300),[f,j]),te=t.useRef(ee);t.useEffect(()=>{te.current=ee},[ee]),t.useEffect(()=>{process.env.NODE_ENV},[Q,x,C]),t.useEffect(()=>()=>{O.current&&clearTimeout(O.current),te.current.cancel()},[]);const re=X&&void 0===C?D:T&&Q&&void 0===C?I.current||"":C,se=d||M,le=N.disabled?"disabled":se?"error":W?"focus":E?"hover":"idle";return e.jsxs("div",{className:l.wrapperStyles,"data-cy":`${J}-wrapper`,"data-testid":`${K}-wrapper`,children:[(n||c)&&e.jsxs("div",{className:l.labelRowStyles,children:[n&&e.jsx("label",{htmlFor:H,className:l.labelStyles,"data-cy":`${J}-label`,"data-testid":`${K}-label`,children:Z}),c&&e.jsx(r.Provider,{delayDuration:200,children:e.jsxs(r.Root,{children:[e.jsx(r.Trigger,{asChild:!0,children:e.jsx("button",{type:"button",className:l.tooltipTriggerStyles,"aria-label":"More information","data-cy":`${J}-tooltip-trigger`,"data-testid":`${K}-tooltip-trigger`,children:e.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[e.jsx("circle",{cx:"6",cy:"6",r:"5.5",stroke:"currentColor",strokeWidth:"1",fill:"none"}),e.jsx("path",{d:"M6 5.5V8.5",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"}),e.jsx("circle",{cx:"6",cy:"4",r:"0.5",fill:"currentColor"})]})})}),e.jsx(r.Portal,{children:e.jsxs(r.Content,{className:l.tooltipContentStyles,side:"top",sideOffset:4,"data-cy":`${J}-tooltip-content`,"data-testid":`${K}-tooltip-content`,children:[c,e.jsx(r.Arrow,{className:"fill-text"})]})})]})})]}),e.jsxs("div",{className:l.fieldContainerStyles,children:[e.jsx("input",{ref:z,id:H,type:Y,value:re,className:s.cn(l.inputBaseStyles,se&&l.inputErrorStyles,U&&l.inputWithToggleStyles,y),"aria-invalid":se?"true":"false","aria-required":k?"true":void 0,"aria-describedby":se?_:u?G:void 0,"data-cy":J,"data-testid":K,"data-state":le,onChange:e=>{let t=e.target.value;if(X){const r=e.target.value,s=I.current,l=D.length;let a;if(0===r.length)a="";else if(r.length>l){const e=r.slice(l);a=s+e}else if(r.length<l)a=s.slice(0,r.length);else{const e=r.slice(-1);a=s.slice(0,-1)+e}I.current=a;const o=a?"•".repeat(a.length-1)+a.slice(-1):"";if(F(o),t=a,m){const t={...e,target:{...e.target,value:a},currentTarget:{...e.currentTarget,value:a}};m(t)}O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{F("•".repeat(a.length))},g)}else m?.(e);P.current&&ee(t)},onFocus:e=>{L(!0),N.onFocus?.(e)},onBlur:e=>{if(L(!1),P.current=!0,f){const t=X?I.current:e.target.value,r=f(t);R(r),j?.(!r)}w?.(e)},onMouseEnter:()=>B(!0),onMouseLeave:()=>B(!1),required:k,...N}),U&&e.jsx("button",{type:"button",className:l.toggleStyles,onClick:()=>{q(e=>!e),setTimeout(()=>V.current?.focus(),0)},"aria-label":T?"Hide password":"Show password","data-cy":`${J}-toggle`,"data-testid":`${K}-toggle`,children:T?e.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[e.jsx("path",{d:"M10 4C5.5 4 2 10 2 10s3.5 6 8 6 8-6 8-6-3.5-6-8-6z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),e.jsx("circle",{cx:"10",cy:"10",r:"2.5",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})]}):e.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[e.jsx("path",{d:"M10 4C5.5 4 2 10 2 10s3.5 6 8 6 8-6 8-6-3.5-6-8-6z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),e.jsx("circle",{cx:"10",cy:"10",r:"2.5",stroke:"currentColor",strokeWidth:"1.5",fill:"none"}),e.jsx("path",{d:"M3 3l14 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})]}),se&&e.jsx("span",{id:_,className:l.errorStyles,role:"alert","data-cy":`${J}-error`,"data-testid":`${K}-error`,children:se}),u&&!se&&e.jsx("span",{id:G,className:l.helperStyles,"data-cy":`${J}-helper`,"data-testid":`${K}-helper`,children:u})]})});i.displayName="Input",exports.Input=i;
|
package/dist/index58.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{forwardRef as r,useState as a,useRef as
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{forwardRef as r,useState as a,useRef as o,useId as l,useMemo as i,useEffect as n}from"react";import{Provider as s,Root as c,Trigger as d,Portal as u,Content as h,Arrow as p}from"./index67.js";import{cn as m}from"./index51.js";import{wrapperStyles as f,labelRowStyles as g,labelStyles as v,tooltipTriggerStyles as k,tooltipContentStyles as y,fieldContainerStyles as w,inputWithToggleStyles as x,inputErrorStyles as C,inputBaseStyles as N,toggleStyles as $,errorStyles as b,helperStyles as j}from"./index92.js";import{useMergedRef as L}from"./index60.js";import{debounce as T}from"./index69.js";const W=r(({type:r="text",label:W,tooltip:M,error:B,helperText:q,fullWidth:D=!1,showPasswordToggle:E=!0,showLastChar:F=!0,lastCharDelay:V=500,validate:z,onValidationChange:O,className:A,id:H,onChange:I,onBlur:P,required:R,value:S,"data-cy":_,"data-testid":G,...J},K)=>{const[Q,U]=a(!1),[X,Y]=a(),[Z,ee]=a(!1),[te,re]=a(!1),ae=o(!1),[oe,le]=a(""),ie=o(""),ne=o(null),se=o(null),ce=L(K,se),de=l(),ue=H||de,he=`${ue}-error`,pe=`${ue}-helper`,me=_||"input",fe=G||"input",ge="password"===r,ve=ge&&E,ke=ge&&F&&!Q&&void 0===S,ye=ge&&(Q||ke&&ie.current.length>0)?"text":r,we=W&&R&&!W.includes("*")?`${W} *`:W,xe=i(()=>T(e=>{if(z&&ae.current){const t=z(e);Y(t),O?.(!t)}},300),[z,O]),Ce=o(xe);n(()=>{Ce.current=xe},[xe]),n(()=>{process.env.NODE_ENV},[ge,F,S]),n(()=>()=>{ne.current&&clearTimeout(ne.current),Ce.current.cancel()},[]);const Ne=ke&&void 0===S?oe:Q&&ge&&void 0===S?ie.current||"":S,$e=B||X,be=J.disabled?"disabled":$e?"error":Z?"focus":te?"hover":"idle";/* @__PURE__ */
|
|
2
2
|
return e("div",{className:f,"data-cy":`${me}-wrapper`,"data-testid":`${fe}-wrapper`,children:[(W||M)&&/* @__PURE__ */e("div",{className:g,children:[W&&/* @__PURE__ */t("label",{htmlFor:ue,className:v,"data-cy":`${me}-label`,"data-testid":`${fe}-label`,children:we}),M&&/* @__PURE__ */t(s,{delayDuration:200,children:/* @__PURE__ */e(c,{children:[
|
|
3
3
|
/* @__PURE__ */t(d,{asChild:!0,children:/* @__PURE__ */t("button",{type:"button",className:k,"aria-label":"More information","data-cy":`${me}-tooltip-trigger`,"data-testid":`${fe}-tooltip-trigger`,children:/* @__PURE__ */e("svg",{className:"w-3 h-3",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[
|
|
4
4
|
/* @__PURE__ */t("circle",{cx:"6",cy:"6",r:"5.5",stroke:"currentColor",strokeWidth:"1",fill:"none"}),
|
|
@@ -7,9 +7,9 @@ return e("div",{className:f,"data-cy":`${me}-wrapper`,"data-testid":`${fe}-wrapp
|
|
|
7
7
|
/* @__PURE__ */t(u,{children:/* @__PURE__ */e(h,{className:y,side:"top",sideOffset:4,"data-cy":`${me}-tooltip-content`,"data-testid":`${fe}-tooltip-content`,children:[M,
|
|
8
8
|
/* @__PURE__ */t(p,{className:"fill-text"})]})})]})})]}),
|
|
9
9
|
/* @__PURE__ */e("div",{className:w,children:[
|
|
10
|
-
/* @__PURE__ */t("input",{ref:ce,id:ue,type:ye,value:Ne,className:m(N,$e&&C,ve&&x,A),"aria-invalid":$e?"true":"false","aria-required":R?"true":void 0,"aria-describedby":$e?he:q?pe:void 0,"data-cy":me,"data-testid":fe,"data-state":be,onChange:e=>{let t=e.target.value;if(ke){const r=e.target.value,a=ie.current,
|
|
10
|
+
/* @__PURE__ */t("input",{ref:ce,id:ue,type:ye,value:Ne,className:m(N,$e&&C,ve&&x,A),"aria-invalid":$e?"true":"false","aria-required":R?"true":void 0,"aria-describedby":$e?he:q?pe:void 0,"data-cy":me,"data-testid":fe,"data-state":be,onChange:e=>{let t=e.target.value;if(ke){const r=e.target.value,a=ie.current,o=oe.length;let l;if(0===r.length)l="";else if(r.length>o){const e=r.slice(o);l=a+e}else if(r.length<o)l=a.slice(0,r.length);else{const e=r.slice(-1);l=a.slice(0,-1)+e}ie.current=l;const i=l?"•".repeat(l.length-1)+l.slice(-1):"";if(le(i),t=l,I){const t={...e,target:{...e.target,value:l},currentTarget:{...e.currentTarget,value:l}};I(t)}ne.current&&clearTimeout(ne.current),ne.current=setTimeout(()=>{le("•".repeat(l.length))},V)}else I?.(e);ae.current&&xe(t)},onFocus:e=>{ee(!0),J.onFocus?.(e)},onBlur:e=>{if(ee(!1),ae.current=!0,z){const t=ke?ie.current:e.target.value,r=z(t);Y(r),O?.(!r)}P?.(e)},onMouseEnter:()=>re(!0),onMouseLeave:()=>re(!1),required:R,...J}),ve&&/* @__PURE__ */t("button",{type:"button",className:$,onClick:()=>{U(e=>!e),setTimeout(()=>se.current?.focus(),0)},"aria-label":Q?"Hide password":"Show password","data-cy":`${me}-toggle`,"data-testid":`${fe}-toggle`,children:/* @__PURE__ */e("svg",Q?{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[
|
|
11
11
|
/* @__PURE__ */t("path",{d:"M10 4C5.5 4 2 10 2 10s3.5 6 8 6 8-6 8-6-3.5-6-8-6z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),
|
|
12
|
-
/* @__PURE__ */t("circle",{cx:"10",cy:"10",r:"2.5",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})]}:{className:"w-
|
|
12
|
+
/* @__PURE__ */t("circle",{cx:"10",cy:"10",r:"2.5",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})]}:{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[
|
|
13
13
|
/* @__PURE__ */t("path",{d:"M10 4C5.5 4 2 10 2 10s3.5 6 8 6 8-6 8-6-3.5-6-8-6z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),
|
|
14
14
|
/* @__PURE__ */t("circle",{cx:"10",cy:"10",r:"2.5",stroke:"currentColor",strokeWidth:"1.5",fill:"none"}),
|
|
15
15
|
/* @__PURE__ */t("path",{d:"M3 3l14 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})]}),$e&&/* @__PURE__ */t("span",{id:he,className:b,role:"alert","data-cy":`${me}-error`,"data-testid":`${fe}-error`,children:$e}),q&&!$e&&/* @__PURE__ */t("span",{id:pe,className:j,"data-cy":`${me}-helper`,"data-testid":`${fe}-helper`,children:q})]})});W.displayName="Input";export{W as Input};
|
package/dist/index92.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=["p-0.5 m-0 border-none bg-transparent","flex items-center justify-center flex-shrink-0","text-[var(--color-icon-secondary)] cursor-pointer rounded","transition-colors duration-150","hover:text-[var(--color-system-text)]","focus:outline-2 focus:outline-[var(--color-clickable)] focus:outline-offset-1","focus:not(:focus-visible):outline-none"].join(" "),o=["z-[100] max-w-[var(--max-width-xs)] px-3 py-2","bg-[var(--color-text)] rounded-md shadow-[0_0.25rem_0.75rem_var(--shadow-color-lg)]","text-xs font-normal leading-relaxed text-[var(--color-card)]","animate-in fade-in-0 zoom-in-95"].join(" "),r=["flex items-center self-stretch w-full","h-[var(--input-height)] p-[0.875rem]","text-base leading-none text-[var(--color-text)]","bg-[var(--color-card)] border border-[var(--color-border)] rounded-[var(--radius-md)]","transition-[border-color,box-shadow] duration-200","cursor-text","placeholder:text-[var(--color-icon-secondary)]","focus:outline-none focus:border-[var(--color-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=["p-0.5 m-0 border-none bg-transparent","flex items-center justify-center flex-shrink-0","text-[var(--color-icon-secondary)] cursor-pointer rounded","transition-colors duration-150","hover:text-[var(--color-system-text)]","focus:outline-2 focus:outline-[var(--color-clickable)] focus:outline-offset-1","focus:not(:focus-visible):outline-none"].join(" "),o=["z-[100] max-w-[var(--max-width-xs)] px-3 py-2","bg-[var(--color-text)] rounded-md shadow-[0_0.25rem_0.75rem_var(--shadow-color-lg)]","text-xs font-normal leading-relaxed text-[var(--color-card)]","animate-in fade-in-0 zoom-in-95"].join(" "),r=["flex items-center self-stretch w-full","h-[var(--input-height)] p-[0.875rem]","text-base leading-none text-[var(--color-text)]","bg-[var(--color-card)] border border-[var(--color-border)] rounded-[var(--radius-md)]","transition-[border-color,box-shadow] duration-200 ease-in-out","cursor-text","placeholder:text-[var(--color-icon-secondary)]","focus:outline-none focus:border-[var(--color-button-blue)]","hover:border-[var(--color-button-blue)]","disabled:cursor-not-allowed disabled:opacity-50 disabled:pointer-events-none"].join(" "),t=["absolute top-1/2 end-3.5 -translate-y-1/2","flex items-center justify-center w-8 h-8 p-0","bg-transparent border-none text-[var(--color-icon-secondary)] cursor-pointer","transition-colors duration-200","hover:text-[var(--color-system-text)]","focus:outline-2 focus:outline-[var(--color-clickable)] focus:outline-offset-2 focus:rounded-sm","focus:not(:focus-visible):outline-none","active:-translate-y-1/2 active:scale-95"].join(" ");exports.errorStyles="text-[0.75rem] font-normal leading-none text-[var(--Error-Red,var(--color-error))]",exports.fieldContainerStyles="relative flex items-center w-full",exports.helperStyles="text-xs leading-none text-[var(--color-grey-07)]",exports.inputBaseStyles=r,exports.inputErrorStyles="border-[var(--color-error)] focus:border-[var(--color-error)] hover:enabled:border-[var(--color-error)]",exports.inputWithToggleStyles="pe-12",exports.labelRowStyles="flex items-center justify-between h-4 w-full",exports.labelStyles="text-sm font-normal text-[var(--color-grey-07)] leading-none",exports.toggleStyles=t,exports.tooltipContentStyles=o,exports.tooltipTriggerStyles=e,exports.wrapperStyles="flex flex-col justify-center items-start gap-2 w-full";
|
package/dist/index92.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="flex flex-col justify-center items-start gap-2 w-full",o="flex items-center justify-between h-4 w-full",r="text-sm font-normal text-[var(--color-grey-07)] leading-none",t=["p-0.5 m-0 border-none bg-transparent","flex items-center justify-center flex-shrink-0","text-[var(--color-icon-secondary)] cursor-pointer rounded","transition-colors duration-150","hover:text-[var(--color-system-text)]","focus:outline-2 focus:outline-[var(--color-clickable)] focus:outline-offset-1","focus:not(:focus-visible):outline-none"].join(" "),n=["z-[100] max-w-[var(--max-width-xs)] px-3 py-2","bg-[var(--color-text)] rounded-md shadow-[0_0.25rem_0.75rem_var(--shadow-color-lg)]","text-xs font-normal leading-relaxed text-[var(--color-card)]","animate-in fade-in-0 zoom-in-95"].join(" "),l="relative flex items-center w-full",a=["flex items-center self-stretch w-full","h-[var(--input-height)] p-[0.875rem]","text-base leading-none text-[var(--color-text)]","bg-[var(--color-card)] border border-[var(--color-border)] rounded-[var(--radius-md)]","transition-[border-color,box-shadow] duration-200","cursor-text","placeholder:text-[var(--color-icon-secondary)]","focus:outline-none focus:border-[var(--color-
|
|
1
|
+
const e="flex flex-col justify-center items-start gap-2 w-full",o="flex items-center justify-between h-4 w-full",r="text-sm font-normal text-[var(--color-grey-07)] leading-none",t=["p-0.5 m-0 border-none bg-transparent","flex items-center justify-center flex-shrink-0","text-[var(--color-icon-secondary)] cursor-pointer rounded","transition-colors duration-150","hover:text-[var(--color-system-text)]","focus:outline-2 focus:outline-[var(--color-clickable)] focus:outline-offset-1","focus:not(:focus-visible):outline-none"].join(" "),n=["z-[100] max-w-[var(--max-width-xs)] px-3 py-2","bg-[var(--color-text)] rounded-md shadow-[0_0.25rem_0.75rem_var(--shadow-color-lg)]","text-xs font-normal leading-relaxed text-[var(--color-card)]","animate-in fade-in-0 zoom-in-95"].join(" "),l="relative flex items-center w-full",a=["flex items-center self-stretch w-full","h-[var(--input-height)] p-[0.875rem]","text-base leading-none text-[var(--color-text)]","bg-[var(--color-card)] border border-[var(--color-border)] rounded-[var(--radius-md)]","transition-[border-color,box-shadow] duration-200 ease-in-out","cursor-text","placeholder:text-[var(--color-icon-secondary)]","focus:outline-none focus:border-[var(--color-button-blue)]","hover:border-[var(--color-button-blue)]","disabled:cursor-not-allowed disabled:opacity-50 disabled:pointer-events-none"].join(" "),c="border-[var(--color-error)] focus:border-[var(--color-error)] hover:enabled:border-[var(--color-error)]",s="pe-12",i=["absolute top-1/2 end-3.5 -translate-y-1/2","flex items-center justify-center w-8 h-8 p-0","bg-transparent border-none text-[var(--color-icon-secondary)] cursor-pointer","transition-colors duration-200","hover:text-[var(--color-system-text)]","focus:outline-2 focus:outline-[var(--color-clickable)] focus:outline-offset-2 focus:rounded-sm","focus:not(:focus-visible):outline-none","active:-translate-y-1/2 active:scale-95"].join(" "),d="text-xs leading-none text-[var(--color-grey-07)]",u="text-[0.75rem] font-normal leading-none text-[var(--Error-Red,var(--color-error))]";export{u as errorStyles,l as fieldContainerStyles,d as helperStyles,a as inputBaseStyles,c as inputErrorStyles,s as inputWithToggleStyles,o as labelRowStyles,r as labelStyles,i as toggleStyles,n as tooltipContentStyles,t as tooltipTriggerStyles,e as wrapperStyles};
|