@tribepad/themis 1.5.1 → 1.5.2
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/CHANGELOG.md +8 -0
- package/dist/elements/PasswordField/index.js +1 -1
- package/dist/elements/PasswordField/index.js.map +1 -1
- package/dist/elements/PasswordField/index.mjs +1 -1
- package/dist/elements/PasswordField/index.mjs.map +1 -1
- package/dist/elements/SearchField/index.js +1 -1
- package/dist/elements/SearchField/index.js.map +1 -1
- package/dist/elements/SearchField/index.mjs +1 -1
- package/dist/elements/SearchField/index.mjs.map +1 -1
- package/dist/elements/Select/Select.d.ts.map +1 -1
- package/dist/elements/Select/index.js +1 -1
- package/dist/elements/Select/index.js.map +1 -1
- package/dist/elements/Select/index.mjs +1 -1
- package/dist/elements/Select/index.mjs.map +1 -1
- package/dist/elements/TextField/index.js +1 -1
- package/dist/elements/TextField/index.js.map +1 -1
- package/dist/elements/TextField/index.mjs +1 -1
- package/dist/elements/TextField/index.mjs.map +1 -1
- package/dist/elements/index.js +1 -1
- package/dist/elements/index.js.map +1 -1
- package/dist/elements/index.mjs +1 -1
- package/dist/elements/index.mjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.5.2] - 2026-05-11
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **TextField** — error-state label and error message now render in `--destructive-background` (the destructive red itself) instead of `--destructive-foreground` (the contrast colour for text *on* a destructive background, typically white). In any theme where the destructive-foreground is white, the label and error message were invisible against the page background. Brings `TextField` in line with `Select` and the design-system intent for inline error text.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
- **Select** — the inline error message no longer renders a leading `AlertCircle` icon. The destructive border on the trigger and the red message text already convey the error state, and the icon was the only field type doing this — `NumberField`, `TextField`'s error text, and `RichTextEditor` errors are text-only. Tightens visual consistency across error surfaces.
|
|
15
|
+
|
|
8
16
|
## [1.5.1] - 2026-05-08
|
|
9
17
|
|
|
10
18
|
### Added
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
'use strict';var react=require('react'),reactAriaComponents=require('react-aria-components'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),lucideReact=require('lucide-react'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime'),zod=require('zod');function c(...t){return tailwindMerge.twMerge(clsx.clsx(t))}var se="data-[pressed]:scale-[0.97]";var ie="data-[hovered]:shadow-md";var Y="hc:data-[hovered]:outline hc:data-[hovered]:outline-2 hc:data-[hovered]:outline-foreground",q="hc:data-[pressed]:outline hc:data-[pressed]:outline-2 hc:data-[pressed]:outline-offset-1 hc:data-[pressed]:outline-foreground",de="disabled:pointer-events-none disabled:opacity-50";var Z={sm:"h-9",default:"h-10",lg:"h-11"},D={sm:`${Z.sm} px-2 text-xs`,default:`${Z.default} px-3 text-sm`,lg:`${Z.lg} px-4 text-base`},ce="min-h-[44px] flex items-center";var ue=classVarianceAuthority.cva("inline-flex justify-center min-h-[44px] min-w-[44px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50",{variants:{fullWidth:{true:"w-full",false:""},inVerticalGroup:{true:"items-stretch",false:"items-center"}},defaultVariants:{fullWidth:false,inVerticalGroup:false}}),pe=classVarianceAuthority.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background motion-safe:transition-transform motion-safe:duration-200 motion-safe:[transition-timing-function:cubic-bezier(0.34,1.56,0.64,1)] motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 relative cursor-pointer",{variants:{variant:{default:"bg-[var(--primary-action)] text-[var(--primary-action-foreground)] shadow-md hover:bg-[var(--primary-action-hover)] hover:-translate-y-1",destructive:"bg-[var(--destructive-background)] text-[var(--destructive-foreground)] shadow-md hover:bg-[var(--destructive-background-hover,var(--destructive-background))] motion-safe:hover:btn-warn-shake",outline:"border border-[var(--input-border)] bg-[var(--page-background)] hover:bg-[var(--input-border)]",secondary:"bg-[var(--secondary)] text-[var(--secondary-foreground)] shadow-md hover:bg-[var(--secondary-hover,var(--secondary))]",ghost:"hover:bg-[var(--accent)] hover:text-[var(--accent-foreground)]",link:"text-[var(--text-link)] underline underline-offset-4 hover:bg-[var(--accent)] hover:text-[var(--text-link-hover)]"},fullWidth:{true:"w-full",false:""},visualSize:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3 text-xs",lg:"h-11 rounded-md px-8",icon:"h-10 w-10",dot:"h-5 w-5 rounded-full p-0 min-h-0 min-w-0"},paywall:{true:"!bg-[var(--paywall)] !text-[var(--paywall-foreground)] !shadow-md hover:!bg-[var(--paywall)]/90 !cursor-not-allowed !border-transparent",false:""}},defaultVariants:{variant:"default",visualSize:"default",paywall:false}});var Le=react.createContext(null);Le.displayName="ButtonGroupContext";function Ve(){return react.useContext(Le)}var De=react.createContext(null);De.displayName="ButtonGroupItemContext";function Be(){return react.useContext(De)}classVarianceAuthority.cva("inline-flex items-center gap-0",{variants:{orientation:{horizontal:"flex-row",vertical:"flex-col w-full"}},defaultVariants:{orientation:"horizontal"}});var Me=classVarianceAuthority.cva("",{variants:{orientation:{horizontal:"min-w-[44px]",vertical:"flex min-h-[44px]"},position:{first:"",middle:"",last:"",only:""}},compoundVariants:[{orientation:"horizontal",position:"first",className:"rounded-r-none border-r-0"},{orientation:"horizontal",position:"middle",className:"rounded-none border-r-0"},{orientation:"horizontal",position:"last",className:"rounded-l-none"},{orientation:"vertical",position:"first",className:"rounded-b-none border-b-0"},{orientation:"vertical",position:"middle",className:"rounded-none border-b-0"},{orientation:"vertical",position:"last",className:"rounded-t-none"}],defaultVariants:{orientation:"horizontal",position:"only"}});classVarianceAuthority.cva("bg-[var(--border)]",{variants:{orientation:{horizontal:"w-px h-6 mx-1",vertical:"h-px w-full my-1"}},defaultVariants:{orientation:"horizontal"}});var M=react.memo(react.forwardRef(({className:t,buttonVisualClassName:o,variant:n,size:a,visualSize:i,fullWidth:p,loading:d=false,loadingText:u="Loading...",shortcut:b,children:x,isDisabled:f,paywall:s=false,paywallRedirect:I,paywallDescription:ee,onPress:te,...G},oe)=>{let y=react.useId(),N=Ve(),z=Be(),A=n??N?.variant??"default",S=a??N?.size,U=f??N?.isDisabled??false,C=N?.orientation==="vertical",h=p||C,$=z?Me({orientation:N?.orientation??"horizontal",position:z.position}):"",_=i??S??"default";return process.env.NODE_ENV!=="production"&&(_==="dot"||_==="icon")&&!G["aria-label"]&&!x&&console.warn('[Button] visualSize="dot" or "icon" requires aria-label when no visible text is provided (WCAG 1.1.1)'),jsxRuntime.jsx(reactAriaComponents.Button,{ref:oe,isDisabled:U||d||void 0,"aria-disabled":s?true:void 0,"aria-describedby":s?y:void 0,onPress:E=>{if(s){I&&window.open(I,"_blank","noopener,noreferrer");return}te?.(E);},className:c(ue({fullWidth:h,inVerticalGroup:C}),t),...G,children:E=>jsxRuntime.jsxs("span",{className:c(pe({variant:A,visualSize:_,paywall:s,fullWidth:h}),$,o,se,ie,Y,q),"data-pressed":E.isPressed||void 0,children:[d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Loader2,{className:"motion-safe:animate-spin","aria-hidden":"true"}),jsxRuntime.jsx("span",{className:"sr-only","aria-live":"polite",children:u})]}),!d&&x,s&&jsxRuntime.jsx(lucideReact.Zap,{"data-testid":"zap-icon","aria-hidden":"true",className:"ml-1"}),s&&jsxRuntime.jsxs("span",{id:y,className:"sr-only",children:["Premium feature: ",ee||"Upgrade required to access this feature"]}),E.isFocusVisible&&b&&jsxRuntime.jsx("kbd",{className:"ml-auto hidden text-xs opacity-60 lg:inline",children:b})]})})}));M.displayName="Button";var He=()=>jsxRuntime.jsxs("svg",{"data-testid":"password-toggle-icon-show",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M1 8s3-5 7-5 7 5 7 5-3 5-7 5-7-5-7-5z"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"2"})]}),ke=()=>jsxRuntime.jsxs("svg",{"data-testid":"password-toggle-icon-hide",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M10.5 5.5l-5 5"}),jsxRuntime.jsx("path",{d:"M1 8s3-5 7-5c1.5 0 2.8.6 4 1.5M15 8s-1.5 2.5-4 4"}),jsxRuntime.jsx("path",{d:"M3 13l2-2m7-7l2-2"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"2"})]});var xe=classVarianceAuthority.cva("flex w-full rounded-md border bg-[var(--content-background)] shadow-xs px-3 py-2 text-sm ring-offset-[var(--content-background)] file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-[var(--content-foreground)] placeholder:text-[var(--menu-muted)] transition-all duration-200",{variants:{size:{sm:`${D.sm} py-1`,default:`${D.default} py-2`,lg:`${D.lg} py-3`},state:{default:"border-[var(--input-border)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2",error:"border-[var(--destructive-background)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--destructive-background)] focus-visible:ring-offset-2",success:"border-[var(--success-background)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--success-ring)] focus-visible:ring-offset-2",disabled:"cursor-not-allowed opacity-50",readonly:"cursor-default bg-[var(--content-background)] opacity-70"}},defaultVariants:{size:"default",state:"default"}}),ge=classVarianceAuthority.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",{variants:{state:{default:"text-[var(--content-foreground)]",error:"text-[var(--destructive-foreground)]",disabled:"opacity-50 cursor-not-allowed"}},defaultVariants:{state:"default"}}),be=classVarianceAuthority.cva("text-sm text-[var(--content-foreground)]"),ze=classVarianceAuthority.cva("text-sm text-[var(--destructive-foreground)] font-medium"),ve=classVarianceAuthority.cva("text-sm text-[var(--success-foreground)] font-medium");function $e({expandOnFocus:t,collapsedWidth:o,value:n,defaultValue:a,userOnFocus:i,userOnBlur:p}){let[d,u]=react.useState(false),b=react.useCallback(s=>{t&&u(true),i?.(s);},[t,i]),x=react.useCallback(s=>{t&&s.target.value===""&&u(false),p?.(s);},[t,p]),f=react.useMemo(()=>t?d||(n!==void 0?n!=="":a!==void 0&&a!=="")?"100%":o:void 0,[t,d,n,a,o]);return {handleFocus:b,handleBlur:x,inputWidth:f}}function We({disableCopyPaste:t}){let[o,n]=react.useState(false),[a,i]=react.useState("");react.useEffect(()=>{t&&typeof process<"u"&&process.env.NODE_ENV==="development"&&console.warn("[TextField] Copy/paste prevention should only be used for security-critical fields like password confirmation. This feature can break assistive technology workflows and password managers.");},[t]);let p=react.useCallback(d=>{t&&(d.preventDefault(),n(true),i("Pasting is not allowed in this field. Please type your entry."),setTimeout(()=>{n(false),i("");},250));},[t]);return {isShaking:o,screenReaderMessage:a,handlePaste:p}}function Ye({type:t,showPasswordToggle:o}){let[n,a]=react.useState(false),i=react.useCallback(()=>{a(d=>!d);},[]),p=react.useMemo(()=>t==="password"&&o&&n?"text":t,[t,o,n]);return {showPassword:n,actualType:p,handlePasswordToggle:i}}var Ot=react.forwardRef(({className:t,state:o="default",children:n,...a},i)=>jsxRuntime.jsx(reactAriaComponents.Label,{ref:i,className:c(ge({state:o}),t),...a,children:n}));Ot.displayName="TextFieldLabel";var Ct=react.forwardRef(({className:t,size:o="default",state:n="default",...a},i)=>jsxRuntime.jsx(reactAriaComponents.Input,{ref:i,className:c(xe({size:o,state:n}),de,t),...a}));Ct.displayName="TextFieldInput";var Rt=react.forwardRef(({className:t,children:o,...n},a)=>jsxRuntime.jsx(reactAriaComponents.Text,{ref:a,slot:"description",className:c(be(),t),...n,children:o}));Rt.displayName="TextFieldDescription";var Xe=react.forwardRef(({className:t,children:o,...n},a)=>jsxRuntime.jsx(reactAriaComponents.FieldError,{ref:a,...n,className:c(ze(),t),children:jsxRuntime.jsxs("span",{className:"flex items-center gap-2",role:"alert",children:[jsxRuntime.jsx(lucideReact.CircleAlert,{className:"h-4 w-4"}),o]})}));Xe.displayName="TextFieldError";var Lt=react.forwardRef(({className:t,children:o,...n},a)=>jsxRuntime.jsx(reactAriaComponents.Text,{ref:a,slot:"description",className:c(ve(),t),...n,children:o}));Lt.displayName="TextFieldSuccess";var Te=react.forwardRef(({className:t,size:o="default",label:n,labelHint:a,description:i,errorMessage:p,successMessage:d,type:u="text",isRequired:b=false,isReadOnly:x=false,isDisabled:f=false,isInvalid:s=false,isValid:I=false,id:ee,autoComplete:te,disableCopyPaste:G=false,pattern:oe,patternDescription:y,expandOnFocus:N=false,collapsedWidth:z="200px",prefix:A,suffix:S,prefixSize:U=16,suffixSize:C=16,showPasswordToggle:h,isIconHidden:$=false,onSubmit:_,onClear:ne,value:R,defaultValue:E,onFocus:Qe,onBlur:Je,...L},et)=>{let Ee=react.useId(),tt=react.useId(),ot=ee||tt,{handleFocus:nt,handleBlur:at,inputWidth:rt}=$e({expandOnFocus:N,collapsedWidth:z,value:R,defaultValue:E,userOnFocus:Qe,userOnBlur:Je}),{isShaking:st,screenReaderMessage:Ie,handlePaste:it}=We({disableCopyPaste:G}),{showPassword:ae,actualType:lt,handlePasswordToggle:ye}=Ye({type:u,showPasswordToggle:h}),g=u==="search",[dt,Ne]=react.useState(E??""),V=R!==void 0,T=V?R:dt,ct=react.useCallback(l=>{V||Ne(l),L.onChange?.(l);},[V,L]),W=react.useCallback(()=>{V||Ne(""),L.onChange?.(""),ne?.();},[V,L,ne]),ut=react.useCallback(l=>{l.key==="Enter"&&_&&_(T),l.key==="Escape"&&T&&(l.preventDefault(),W());},[T,_,W]),pt=react.useMemo(()=>f?"disabled":x?"readonly":s?"error":I?"success":"default",[f,x,s,I]),ft=react.useMemo(()=>f?"disabled":s?"error":"default",[f,s]),_e=react.useMemo(()=>i&&y?`${i} ${y}`:i||y,[i,y]),P=react.useMemo(()=>g&&!$&&!A?jsxRuntime.jsx(lucideReact.Search,{className:o==="sm"?"h-3.5 w-3.5":o==="lg"?"h-5 w-5":"h-4 w-4"}):A,[g,$,A,o]),Ae=react.useMemo(()=>{let l={left:12,right:12};if(P){let re=typeof P=="string"?P.length*8+16:U+16;l.left=re;}if(u==="password"&&h)l.right=32;else if(g&&T)l.right=44;else if(S){let re=typeof S=="string"?S.length*8+16:C+16;l.right=re;}return l},[P,A,S,U,C,u,h,g,T]),Pe=react.useMemo(()=>u==="password"&&h?jsxRuntime.jsx(M,{variant:"ghost",visualSize:"icon",onPress:ye,"aria-label":ae?"Hide password":"Show password",className:"!min-h-0 !min-w-0 h-8 w-8",children:ae?jsxRuntime.jsx(ke,{}):jsxRuntime.jsx(He,{})}):g&&T?jsxRuntime.jsx(M,{variant:"ghost",visualSize:"icon",onPress:W,"aria-label":"Clear search",className:"!min-h-0 !min-w-0 h-8 w-8",children:jsxRuntime.jsx(lucideReact.X,{className:o==="sm"?"h-3 w-3":o==="lg"?"h-5 w-5":"h-4 w-4"})}):S,[u,h,ae,S,ye,g,T,o,W]),we=u==="password"&&h||g&&!!T;return jsxRuntime.jsxs(reactAriaComponents.TextField,{ref:et,className:c("flex flex-col gap-1.5",t),isRequired:b,isReadOnly:x,isDisabled:f,isInvalid:s,value:g?T:R,defaultValue:g?void 0:E,onChange:g?ct:void 0,...L,children:[n&&jsxRuntime.jsxs(reactAriaComponents.Label,{className:c(ge({state:ft}),a&&"flex items-baseline justify-between"),children:[jsxRuntime.jsxs("span",{children:[n,b&&jsxRuntime.jsx("span",{className:"ml-1 text-[var(--destructive-background)]","aria-hidden":"true",children:jsxRuntime.jsx("strong",{children:"*"})})]}),a&&jsxRuntime.jsx("span",{className:"text-xs font-normal text-[var(--muted-foreground)]",children:a})]}),_e&&jsxRuntime.jsx(reactAriaComponents.Text,{slot:"description",className:c(be()),children:_e}),jsxRuntime.jsxs("div",{className:c(ce,"relative cursor-text motion-safe:transition-colors motion-safe:duration-200"),style:{width:rt},onClick:l=>{l.target===l.currentTarget&&l.currentTarget.querySelector("input")?.focus();},children:[P&&jsxRuntime.jsx("div",{"data-testid":"textfield-prefix",className:"absolute left-3 flex items-center justify-center pointer-events-none text-[var(--content-foreground)]","aria-hidden":"true",children:P}),jsxRuntime.jsx(reactAriaComponents.Input,{type:lt,id:ot,className:c(xe({size:o,state:pt}),de,st&&"shake"),style:{width:"100%",paddingLeft:`${Ae.left}px`,paddingRight:`${Ae.right}px`},autoComplete:te,pattern:oe,onPaste:it,onFocus:nt,onBlur:at,onKeyDown:g?ut:void 0,"aria-required":b?"true":void 0,"aria-readonly":x?"true":void 0,"aria-errormessage":s&&p?Ee:void 0}),Pe&&jsxRuntime.jsx("div",{"data-testid":"textfield-suffix",className:c("absolute right-3 flex items-center justify-center text-[var(--content-foreground)]",we?"":"pointer-events-none"),"aria-hidden":we?void 0:"true",children:Pe})]}),I&&d&&!s&&jsxRuntime.jsx(reactAriaComponents.Text,{slot:"description",className:c(ve()),children:d}),s&&p&&jsxRuntime.jsx(Xe,{id:Ee,children:p}),Ie&&jsxRuntime.jsx("div",{className:"sr-only",role:"status","aria-live":"polite","aria-atomic":"true",children:Ie})]})});Te.displayName="TextField";var Ke=react.forwardRef(({label:t,description:o,errorMessage:n,successMessage:a,hasToggle:i=true,autoComplete:p="current-password","aria-label":d,"aria-labelledby":u,...b},x)=>{process.env.NODE_ENV!=="production"&&!t&&!d&&!u&&console.warn("[PasswordField] Either label, aria-label, or aria-labelledby is required for accessibility (WCAG 1.1.1)");let f=!!n;return jsxRuntime.jsx(Te,{ref:x,type:"password",showPasswordToggle:i,autoComplete:p,label:t,description:f?void 0:o,errorMessage:n,successMessage:f?void 0:a,isInvalid:f,isValid:!!a&&!f,"aria-label":t?void 0:d,"aria-labelledby":u,...b})});Ke.displayName="PasswordField";var Q=zod.z.object({className:zod.z.string().optional(),children:zod.z.any().optional(),id:zod.z.string().optional(),"aria-label":zod.z.string().optional(),"aria-labelledby":zod.z.string().optional(),"aria-describedby":zod.z.string().optional(),"aria-live":zod.z.enum(["off","polite","assertive"]).optional(),"aria-hidden":zod.z.boolean().optional(),"data-testid":zod.z.string().optional()});var Se=zod.z.enum(["off","on","name","honorific-prefix","given-name","additional-name","family-name","honorific-suffix","nickname","email","username","new-password","current-password","one-time-code","organization-title","organization","street-address","address-line1","address-line2","address-line3","address-level4","address-level3","address-level2","address-level1","country","country-name","postal-code","cc-name","cc-given-name","cc-additional-name","cc-family-name","cc-number","cc-exp","cc-exp-month","cc-exp-year","cc-csc","cc-type","transaction-currency","transaction-amount","language","bday","bday-day","bday-month","bday-year","sex","tel","tel-country-code","tel-national","tel-area-code","tel-local","tel-extension","impp","url","photo"]),Bt=[/\(\.\*\)\+/,/\(\.\+\)\+/,/\([^)]*\)\{.*,.*\}/,/\(\?!\)/,/\(\?<=\)/],Mt=t=>{for(let n of Bt)if(n.test(t))return false;return !((t.match(/[*+{}]/g)||[]).length>5)};Q.extend({size:zod.z.enum(["sm","default","lg"]).optional().default("default"),label:zod.z.string().optional(),labelHint:zod.z.string().optional(),description:zod.z.string().optional(),errorMessage:zod.z.string().optional(),successMessage:zod.z.string().optional(),type:zod.z.enum(["text","email","password","url","search"]).optional().default("text"),isRequired:zod.z.boolean().optional(),isReadOnly:zod.z.boolean().optional(),isDisabled:zod.z.boolean().optional(),isInvalid:zod.z.boolean().optional(),isValid:zod.z.boolean().optional(),placeholder:zod.z.string().optional(),value:zod.z.string().optional(),defaultValue:zod.z.string().optional(),name:zod.z.string().optional(),autoFocus:zod.z.boolean().optional(),autoComplete:Se.optional(),maxLength:zod.z.number().optional(),minLength:zod.z.number().optional(),pattern:zod.z.string().optional(),patternDescription:zod.z.string().optional(),disableCopyPaste:zod.z.boolean().optional().default(false),prefix:zod.z.any().optional(),suffix:zod.z.any().optional(),prefixSize:zod.z.number().optional().default(16),suffixSize:zod.z.number().optional().default(16),expandOnFocus:zod.z.boolean().optional().default(false),collapsedWidth:zod.z.string().optional().default("200px"),showPasswordToggle:zod.z.boolean().optional(),isIconHidden:zod.z.boolean().optional().default(false),onSubmit:zod.z.custom().optional(),onClear:zod.z.custom().optional()}).refine(t=>!t.pattern||t.patternDescription,{message:"patternDescription is required when pattern is provided",path:["patternDescription"]}).refine(t=>!t.pattern||Mt(t.pattern),{message:"Unsafe regex pattern detected. Pattern may cause ReDoS vulnerability. Avoid patterns like (.*)+, (.+)+, or excessive quantifiers.",path:["pattern"]}).refine(t=>!(t.successMessage&&t.errorMessage),{message:"Cannot provide both successMessage and errorMessage. Use one based on validation state.",path:["successMessage"]}).refine(t=>(typeof process<"u"&&process.env.NODE_ENV==="development"&&t.isValid&&t.isInvalid&&console.error("[TextField] Both isValid and isInvalid are true. isInvalid takes precedence."),true));zod.z.object({children:zod.z.any().optional(),className:zod.z.string().optional(),htmlFor:zod.z.string().optional(),state:zod.z.enum(["default","error","disabled"]).optional().default("default")});zod.z.object({className:zod.z.string().optional(),size:zod.z.enum(["sm","default","lg"]).optional().default("default"),state:zod.z.enum(["default","error","success","disabled","readonly"]).optional().default("default")});zod.z.object({children:zod.z.any().optional(),className:zod.z.string().optional()});zod.z.object({children:zod.z.any().optional(),className:zod.z.string().optional()});zod.z.object({children:zod.z.any().optional(),className:zod.z.string().optional()});var Ht=Q.extend({size:zod.z.enum(["sm","default","lg"]).optional().default("default"),label:zod.z.string().optional(),description:zod.z.string().optional(),errorMessage:zod.z.string().optional(),successMessage:zod.z.string().optional(),isRequired:zod.z.boolean().optional(),isReadOnly:zod.z.boolean().optional(),isDisabled:zod.z.boolean().optional(),placeholder:zod.z.string().optional(),value:zod.z.string().optional(),defaultValue:zod.z.string().optional(),name:zod.z.string().optional(),autoComplete:Se.optional(),hasToggle:zod.z.boolean().optional().default(true),onChange:zod.z.custom().optional()});var kt=classVarianceAuthority.cva("group flex flex-col gap-1.5 w-full",{variants:{size:{sm:"",default:"",lg:""}},defaultVariants:{size:"default"}}),Gt=classVarianceAuthority.cva("text-[var(--text-primary)] font-medium",{variants:{size:{sm:"text-xs",default:"text-sm",lg:"text-base"}},defaultVariants:{size:"default"}}),zt=classVarianceAuthority.cva("text-[var(--muted-foreground)]",{variants:{size:{sm:"text-xs",default:"text-xs",lg:"text-sm"}},defaultVariants:{size:"default"}}),Ut=classVarianceAuthority.cva("text-[var(--destructive-background)]",{variants:{size:{sm:"text-xs",default:"text-xs",lg:"text-sm"}},defaultVariants:{size:"default"}});exports.PasswordField=Ke;exports.PasswordFieldPropsSchema=Ht;exports.passwordFieldDescriptionVariants=zt;exports.passwordFieldErrorVariants=Ut;exports.passwordFieldLabelVariants=Gt;exports.passwordFieldVariants=kt;//# sourceMappingURL=index.js.map
|
|
2
|
+
'use strict';var react=require('react'),reactAriaComponents=require('react-aria-components'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),lucideReact=require('lucide-react'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime'),zod=require('zod');function c(...t){return tailwindMerge.twMerge(clsx.clsx(t))}var se="data-[pressed]:scale-[0.97]";var ie="data-[hovered]:shadow-md";var Y="hc:data-[hovered]:outline hc:data-[hovered]:outline-2 hc:data-[hovered]:outline-foreground",q="hc:data-[pressed]:outline hc:data-[pressed]:outline-2 hc:data-[pressed]:outline-offset-1 hc:data-[pressed]:outline-foreground",de="disabled:pointer-events-none disabled:opacity-50";var Z={sm:"h-9",default:"h-10",lg:"h-11"},D={sm:`${Z.sm} px-2 text-xs`,default:`${Z.default} px-3 text-sm`,lg:`${Z.lg} px-4 text-base`},ce="min-h-[44px] flex items-center";var ue=classVarianceAuthority.cva("inline-flex justify-center min-h-[44px] min-w-[44px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50",{variants:{fullWidth:{true:"w-full",false:""},inVerticalGroup:{true:"items-stretch",false:"items-center"}},defaultVariants:{fullWidth:false,inVerticalGroup:false}}),pe=classVarianceAuthority.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background motion-safe:transition-transform motion-safe:duration-200 motion-safe:[transition-timing-function:cubic-bezier(0.34,1.56,0.64,1)] motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 relative cursor-pointer",{variants:{variant:{default:"bg-[var(--primary-action)] text-[var(--primary-action-foreground)] shadow-md hover:bg-[var(--primary-action-hover)] hover:-translate-y-1",destructive:"bg-[var(--destructive-background)] text-[var(--destructive-foreground)] shadow-md hover:bg-[var(--destructive-background-hover,var(--destructive-background))] motion-safe:hover:btn-warn-shake",outline:"border border-[var(--input-border)] bg-[var(--page-background)] hover:bg-[var(--input-border)]",secondary:"bg-[var(--secondary)] text-[var(--secondary-foreground)] shadow-md hover:bg-[var(--secondary-hover,var(--secondary))]",ghost:"hover:bg-[var(--accent)] hover:text-[var(--accent-foreground)]",link:"text-[var(--text-link)] underline underline-offset-4 hover:bg-[var(--accent)] hover:text-[var(--text-link-hover)]"},fullWidth:{true:"w-full",false:""},visualSize:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3 text-xs",lg:"h-11 rounded-md px-8",icon:"h-10 w-10",dot:"h-5 w-5 rounded-full p-0 min-h-0 min-w-0"},paywall:{true:"!bg-[var(--paywall)] !text-[var(--paywall-foreground)] !shadow-md hover:!bg-[var(--paywall)]/90 !cursor-not-allowed !border-transparent",false:""}},defaultVariants:{variant:"default",visualSize:"default",paywall:false}});var Le=react.createContext(null);Le.displayName="ButtonGroupContext";function Ve(){return react.useContext(Le)}var De=react.createContext(null);De.displayName="ButtonGroupItemContext";function Be(){return react.useContext(De)}classVarianceAuthority.cva("inline-flex items-center gap-0",{variants:{orientation:{horizontal:"flex-row",vertical:"flex-col w-full"}},defaultVariants:{orientation:"horizontal"}});var Me=classVarianceAuthority.cva("",{variants:{orientation:{horizontal:"min-w-[44px]",vertical:"flex min-h-[44px]"},position:{first:"",middle:"",last:"",only:""}},compoundVariants:[{orientation:"horizontal",position:"first",className:"rounded-r-none border-r-0"},{orientation:"horizontal",position:"middle",className:"rounded-none border-r-0"},{orientation:"horizontal",position:"last",className:"rounded-l-none"},{orientation:"vertical",position:"first",className:"rounded-b-none border-b-0"},{orientation:"vertical",position:"middle",className:"rounded-none border-b-0"},{orientation:"vertical",position:"last",className:"rounded-t-none"}],defaultVariants:{orientation:"horizontal",position:"only"}});classVarianceAuthority.cva("bg-[var(--border)]",{variants:{orientation:{horizontal:"w-px h-6 mx-1",vertical:"h-px w-full my-1"}},defaultVariants:{orientation:"horizontal"}});var M=react.memo(react.forwardRef(({className:t,buttonVisualClassName:o,variant:n,size:a,visualSize:i,fullWidth:p,loading:d=false,loadingText:u="Loading...",shortcut:b,children:x,isDisabled:f,paywall:s=false,paywallRedirect:I,paywallDescription:ee,onPress:te,...G},oe)=>{let y=react.useId(),N=Ve(),z=Be(),A=n??N?.variant??"default",S=a??N?.size,U=f??N?.isDisabled??false,C=N?.orientation==="vertical",h=p||C,$=z?Me({orientation:N?.orientation??"horizontal",position:z.position}):"",_=i??S??"default";return process.env.NODE_ENV!=="production"&&(_==="dot"||_==="icon")&&!G["aria-label"]&&!x&&console.warn('[Button] visualSize="dot" or "icon" requires aria-label when no visible text is provided (WCAG 1.1.1)'),jsxRuntime.jsx(reactAriaComponents.Button,{ref:oe,isDisabled:U||d||void 0,"aria-disabled":s?true:void 0,"aria-describedby":s?y:void 0,onPress:E=>{if(s){I&&window.open(I,"_blank","noopener,noreferrer");return}te?.(E);},className:c(ue({fullWidth:h,inVerticalGroup:C}),t),...G,children:E=>jsxRuntime.jsxs("span",{className:c(pe({variant:A,visualSize:_,paywall:s,fullWidth:h}),$,o,se,ie,Y,q),"data-pressed":E.isPressed||void 0,children:[d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Loader2,{className:"motion-safe:animate-spin","aria-hidden":"true"}),jsxRuntime.jsx("span",{className:"sr-only","aria-live":"polite",children:u})]}),!d&&x,s&&jsxRuntime.jsx(lucideReact.Zap,{"data-testid":"zap-icon","aria-hidden":"true",className:"ml-1"}),s&&jsxRuntime.jsxs("span",{id:y,className:"sr-only",children:["Premium feature: ",ee||"Upgrade required to access this feature"]}),E.isFocusVisible&&b&&jsxRuntime.jsx("kbd",{className:"ml-auto hidden text-xs opacity-60 lg:inline",children:b})]})})}));M.displayName="Button";var He=()=>jsxRuntime.jsxs("svg",{"data-testid":"password-toggle-icon-show",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M1 8s3-5 7-5 7 5 7 5-3 5-7 5-7-5-7-5z"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"2"})]}),ke=()=>jsxRuntime.jsxs("svg",{"data-testid":"password-toggle-icon-hide",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M10.5 5.5l-5 5"}),jsxRuntime.jsx("path",{d:"M1 8s3-5 7-5c1.5 0 2.8.6 4 1.5M15 8s-1.5 2.5-4 4"}),jsxRuntime.jsx("path",{d:"M3 13l2-2m7-7l2-2"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"2"})]});var xe=classVarianceAuthority.cva("flex w-full rounded-md border bg-[var(--content-background)] shadow-xs px-3 py-2 text-sm ring-offset-[var(--content-background)] file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-[var(--content-foreground)] placeholder:text-[var(--menu-muted)] transition-all duration-200",{variants:{size:{sm:`${D.sm} py-1`,default:`${D.default} py-2`,lg:`${D.lg} py-3`},state:{default:"border-[var(--input-border)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2",error:"border-[var(--destructive-background)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--destructive-background)] focus-visible:ring-offset-2",success:"border-[var(--success-background)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--success-ring)] focus-visible:ring-offset-2",disabled:"cursor-not-allowed opacity-50",readonly:"cursor-default bg-[var(--content-background)] opacity-70"}},defaultVariants:{size:"default",state:"default"}}),ge=classVarianceAuthority.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",{variants:{state:{default:"text-[var(--content-foreground)]",error:"text-[var(--destructive-background)]",disabled:"opacity-50 cursor-not-allowed"}},defaultVariants:{state:"default"}}),be=classVarianceAuthority.cva("text-sm text-[var(--content-foreground)]"),ze=classVarianceAuthority.cva("text-sm text-[var(--destructive-background)] font-medium"),ve=classVarianceAuthority.cva("text-sm text-[var(--success-foreground)] font-medium");function $e({expandOnFocus:t,collapsedWidth:o,value:n,defaultValue:a,userOnFocus:i,userOnBlur:p}){let[d,u]=react.useState(false),b=react.useCallback(s=>{t&&u(true),i?.(s);},[t,i]),x=react.useCallback(s=>{t&&s.target.value===""&&u(false),p?.(s);},[t,p]),f=react.useMemo(()=>t?d||(n!==void 0?n!=="":a!==void 0&&a!=="")?"100%":o:void 0,[t,d,n,a,o]);return {handleFocus:b,handleBlur:x,inputWidth:f}}function We({disableCopyPaste:t}){let[o,n]=react.useState(false),[a,i]=react.useState("");react.useEffect(()=>{t&&typeof process<"u"&&process.env.NODE_ENV==="development"&&console.warn("[TextField] Copy/paste prevention should only be used for security-critical fields like password confirmation. This feature can break assistive technology workflows and password managers.");},[t]);let p=react.useCallback(d=>{t&&(d.preventDefault(),n(true),i("Pasting is not allowed in this field. Please type your entry."),setTimeout(()=>{n(false),i("");},250));},[t]);return {isShaking:o,screenReaderMessage:a,handlePaste:p}}function Ye({type:t,showPasswordToggle:o}){let[n,a]=react.useState(false),i=react.useCallback(()=>{a(d=>!d);},[]),p=react.useMemo(()=>t==="password"&&o&&n?"text":t,[t,o,n]);return {showPassword:n,actualType:p,handlePasswordToggle:i}}var Ot=react.forwardRef(({className:t,state:o="default",children:n,...a},i)=>jsxRuntime.jsx(reactAriaComponents.Label,{ref:i,className:c(ge({state:o}),t),...a,children:n}));Ot.displayName="TextFieldLabel";var Ct=react.forwardRef(({className:t,size:o="default",state:n="default",...a},i)=>jsxRuntime.jsx(reactAriaComponents.Input,{ref:i,className:c(xe({size:o,state:n}),de,t),...a}));Ct.displayName="TextFieldInput";var Rt=react.forwardRef(({className:t,children:o,...n},a)=>jsxRuntime.jsx(reactAriaComponents.Text,{ref:a,slot:"description",className:c(be(),t),...n,children:o}));Rt.displayName="TextFieldDescription";var Xe=react.forwardRef(({className:t,children:o,...n},a)=>jsxRuntime.jsx(reactAriaComponents.FieldError,{ref:a,...n,className:c(ze(),t),children:jsxRuntime.jsxs("span",{className:"flex items-center gap-2",role:"alert",children:[jsxRuntime.jsx(lucideReact.CircleAlert,{className:"h-4 w-4"}),o]})}));Xe.displayName="TextFieldError";var Lt=react.forwardRef(({className:t,children:o,...n},a)=>jsxRuntime.jsx(reactAriaComponents.Text,{ref:a,slot:"description",className:c(ve(),t),...n,children:o}));Lt.displayName="TextFieldSuccess";var Te=react.forwardRef(({className:t,size:o="default",label:n,labelHint:a,description:i,errorMessage:p,successMessage:d,type:u="text",isRequired:b=false,isReadOnly:x=false,isDisabled:f=false,isInvalid:s=false,isValid:I=false,id:ee,autoComplete:te,disableCopyPaste:G=false,pattern:oe,patternDescription:y,expandOnFocus:N=false,collapsedWidth:z="200px",prefix:A,suffix:S,prefixSize:U=16,suffixSize:C=16,showPasswordToggle:h,isIconHidden:$=false,onSubmit:_,onClear:ne,value:R,defaultValue:E,onFocus:Qe,onBlur:Je,...L},et)=>{let Ee=react.useId(),tt=react.useId(),ot=ee||tt,{handleFocus:nt,handleBlur:at,inputWidth:rt}=$e({expandOnFocus:N,collapsedWidth:z,value:R,defaultValue:E,userOnFocus:Qe,userOnBlur:Je}),{isShaking:st,screenReaderMessage:Ie,handlePaste:it}=We({disableCopyPaste:G}),{showPassword:ae,actualType:lt,handlePasswordToggle:ye}=Ye({type:u,showPasswordToggle:h}),g=u==="search",[dt,Ne]=react.useState(E??""),V=R!==void 0,T=V?R:dt,ct=react.useCallback(l=>{V||Ne(l),L.onChange?.(l);},[V,L]),W=react.useCallback(()=>{V||Ne(""),L.onChange?.(""),ne?.();},[V,L,ne]),ut=react.useCallback(l=>{l.key==="Enter"&&_&&_(T),l.key==="Escape"&&T&&(l.preventDefault(),W());},[T,_,W]),pt=react.useMemo(()=>f?"disabled":x?"readonly":s?"error":I?"success":"default",[f,x,s,I]),ft=react.useMemo(()=>f?"disabled":s?"error":"default",[f,s]),_e=react.useMemo(()=>i&&y?`${i} ${y}`:i||y,[i,y]),P=react.useMemo(()=>g&&!$&&!A?jsxRuntime.jsx(lucideReact.Search,{className:o==="sm"?"h-3.5 w-3.5":o==="lg"?"h-5 w-5":"h-4 w-4"}):A,[g,$,A,o]),Ae=react.useMemo(()=>{let l={left:12,right:12};if(P){let re=typeof P=="string"?P.length*8+16:U+16;l.left=re;}if(u==="password"&&h)l.right=32;else if(g&&T)l.right=44;else if(S){let re=typeof S=="string"?S.length*8+16:C+16;l.right=re;}return l},[P,A,S,U,C,u,h,g,T]),Pe=react.useMemo(()=>u==="password"&&h?jsxRuntime.jsx(M,{variant:"ghost",visualSize:"icon",onPress:ye,"aria-label":ae?"Hide password":"Show password",className:"!min-h-0 !min-w-0 h-8 w-8",children:ae?jsxRuntime.jsx(ke,{}):jsxRuntime.jsx(He,{})}):g&&T?jsxRuntime.jsx(M,{variant:"ghost",visualSize:"icon",onPress:W,"aria-label":"Clear search",className:"!min-h-0 !min-w-0 h-8 w-8",children:jsxRuntime.jsx(lucideReact.X,{className:o==="sm"?"h-3 w-3":o==="lg"?"h-5 w-5":"h-4 w-4"})}):S,[u,h,ae,S,ye,g,T,o,W]),we=u==="password"&&h||g&&!!T;return jsxRuntime.jsxs(reactAriaComponents.TextField,{ref:et,className:c("flex flex-col gap-1.5",t),isRequired:b,isReadOnly:x,isDisabled:f,isInvalid:s,value:g?T:R,defaultValue:g?void 0:E,onChange:g?ct:void 0,...L,children:[n&&jsxRuntime.jsxs(reactAriaComponents.Label,{className:c(ge({state:ft}),a&&"flex items-baseline justify-between"),children:[jsxRuntime.jsxs("span",{children:[n,b&&jsxRuntime.jsx("span",{className:"ml-1 text-[var(--destructive-background)]","aria-hidden":"true",children:jsxRuntime.jsx("strong",{children:"*"})})]}),a&&jsxRuntime.jsx("span",{className:"text-xs font-normal text-[var(--muted-foreground)]",children:a})]}),_e&&jsxRuntime.jsx(reactAriaComponents.Text,{slot:"description",className:c(be()),children:_e}),jsxRuntime.jsxs("div",{className:c(ce,"relative cursor-text motion-safe:transition-colors motion-safe:duration-200"),style:{width:rt},onClick:l=>{l.target===l.currentTarget&&l.currentTarget.querySelector("input")?.focus();},children:[P&&jsxRuntime.jsx("div",{"data-testid":"textfield-prefix",className:"absolute left-3 flex items-center justify-center pointer-events-none text-[var(--content-foreground)]","aria-hidden":"true",children:P}),jsxRuntime.jsx(reactAriaComponents.Input,{type:lt,id:ot,className:c(xe({size:o,state:pt}),de,st&&"shake"),style:{width:"100%",paddingLeft:`${Ae.left}px`,paddingRight:`${Ae.right}px`},autoComplete:te,pattern:oe,onPaste:it,onFocus:nt,onBlur:at,onKeyDown:g?ut:void 0,"aria-required":b?"true":void 0,"aria-readonly":x?"true":void 0,"aria-errormessage":s&&p?Ee:void 0}),Pe&&jsxRuntime.jsx("div",{"data-testid":"textfield-suffix",className:c("absolute right-3 flex items-center justify-center text-[var(--content-foreground)]",we?"":"pointer-events-none"),"aria-hidden":we?void 0:"true",children:Pe})]}),I&&d&&!s&&jsxRuntime.jsx(reactAriaComponents.Text,{slot:"description",className:c(ve()),children:d}),s&&p&&jsxRuntime.jsx(Xe,{id:Ee,children:p}),Ie&&jsxRuntime.jsx("div",{className:"sr-only",role:"status","aria-live":"polite","aria-atomic":"true",children:Ie})]})});Te.displayName="TextField";var Ke=react.forwardRef(({label:t,description:o,errorMessage:n,successMessage:a,hasToggle:i=true,autoComplete:p="current-password","aria-label":d,"aria-labelledby":u,...b},x)=>{process.env.NODE_ENV!=="production"&&!t&&!d&&!u&&console.warn("[PasswordField] Either label, aria-label, or aria-labelledby is required for accessibility (WCAG 1.1.1)");let f=!!n;return jsxRuntime.jsx(Te,{ref:x,type:"password",showPasswordToggle:i,autoComplete:p,label:t,description:f?void 0:o,errorMessage:n,successMessage:f?void 0:a,isInvalid:f,isValid:!!a&&!f,"aria-label":t?void 0:d,"aria-labelledby":u,...b})});Ke.displayName="PasswordField";var Q=zod.z.object({className:zod.z.string().optional(),children:zod.z.any().optional(),id:zod.z.string().optional(),"aria-label":zod.z.string().optional(),"aria-labelledby":zod.z.string().optional(),"aria-describedby":zod.z.string().optional(),"aria-live":zod.z.enum(["off","polite","assertive"]).optional(),"aria-hidden":zod.z.boolean().optional(),"data-testid":zod.z.string().optional()});var Se=zod.z.enum(["off","on","name","honorific-prefix","given-name","additional-name","family-name","honorific-suffix","nickname","email","username","new-password","current-password","one-time-code","organization-title","organization","street-address","address-line1","address-line2","address-line3","address-level4","address-level3","address-level2","address-level1","country","country-name","postal-code","cc-name","cc-given-name","cc-additional-name","cc-family-name","cc-number","cc-exp","cc-exp-month","cc-exp-year","cc-csc","cc-type","transaction-currency","transaction-amount","language","bday","bday-day","bday-month","bday-year","sex","tel","tel-country-code","tel-national","tel-area-code","tel-local","tel-extension","impp","url","photo"]),Bt=[/\(\.\*\)\+/,/\(\.\+\)\+/,/\([^)]*\)\{.*,.*\}/,/\(\?!\)/,/\(\?<=\)/],Mt=t=>{for(let n of Bt)if(n.test(t))return false;return !((t.match(/[*+{}]/g)||[]).length>5)};Q.extend({size:zod.z.enum(["sm","default","lg"]).optional().default("default"),label:zod.z.string().optional(),labelHint:zod.z.string().optional(),description:zod.z.string().optional(),errorMessage:zod.z.string().optional(),successMessage:zod.z.string().optional(),type:zod.z.enum(["text","email","password","url","search"]).optional().default("text"),isRequired:zod.z.boolean().optional(),isReadOnly:zod.z.boolean().optional(),isDisabled:zod.z.boolean().optional(),isInvalid:zod.z.boolean().optional(),isValid:zod.z.boolean().optional(),placeholder:zod.z.string().optional(),value:zod.z.string().optional(),defaultValue:zod.z.string().optional(),name:zod.z.string().optional(),autoFocus:zod.z.boolean().optional(),autoComplete:Se.optional(),maxLength:zod.z.number().optional(),minLength:zod.z.number().optional(),pattern:zod.z.string().optional(),patternDescription:zod.z.string().optional(),disableCopyPaste:zod.z.boolean().optional().default(false),prefix:zod.z.any().optional(),suffix:zod.z.any().optional(),prefixSize:zod.z.number().optional().default(16),suffixSize:zod.z.number().optional().default(16),expandOnFocus:zod.z.boolean().optional().default(false),collapsedWidth:zod.z.string().optional().default("200px"),showPasswordToggle:zod.z.boolean().optional(),isIconHidden:zod.z.boolean().optional().default(false),onSubmit:zod.z.custom().optional(),onClear:zod.z.custom().optional()}).refine(t=>!t.pattern||t.patternDescription,{message:"patternDescription is required when pattern is provided",path:["patternDescription"]}).refine(t=>!t.pattern||Mt(t.pattern),{message:"Unsafe regex pattern detected. Pattern may cause ReDoS vulnerability. Avoid patterns like (.*)+, (.+)+, or excessive quantifiers.",path:["pattern"]}).refine(t=>!(t.successMessage&&t.errorMessage),{message:"Cannot provide both successMessage and errorMessage. Use one based on validation state.",path:["successMessage"]}).refine(t=>(typeof process<"u"&&process.env.NODE_ENV==="development"&&t.isValid&&t.isInvalid&&console.error("[TextField] Both isValid and isInvalid are true. isInvalid takes precedence."),true));zod.z.object({children:zod.z.any().optional(),className:zod.z.string().optional(),htmlFor:zod.z.string().optional(),state:zod.z.enum(["default","error","disabled"]).optional().default("default")});zod.z.object({className:zod.z.string().optional(),size:zod.z.enum(["sm","default","lg"]).optional().default("default"),state:zod.z.enum(["default","error","success","disabled","readonly"]).optional().default("default")});zod.z.object({children:zod.z.any().optional(),className:zod.z.string().optional()});zod.z.object({children:zod.z.any().optional(),className:zod.z.string().optional()});zod.z.object({children:zod.z.any().optional(),className:zod.z.string().optional()});var Ht=Q.extend({size:zod.z.enum(["sm","default","lg"]).optional().default("default"),label:zod.z.string().optional(),description:zod.z.string().optional(),errorMessage:zod.z.string().optional(),successMessage:zod.z.string().optional(),isRequired:zod.z.boolean().optional(),isReadOnly:zod.z.boolean().optional(),isDisabled:zod.z.boolean().optional(),placeholder:zod.z.string().optional(),value:zod.z.string().optional(),defaultValue:zod.z.string().optional(),name:zod.z.string().optional(),autoComplete:Se.optional(),hasToggle:zod.z.boolean().optional().default(true),onChange:zod.z.custom().optional()});var kt=classVarianceAuthority.cva("group flex flex-col gap-1.5 w-full",{variants:{size:{sm:"",default:"",lg:""}},defaultVariants:{size:"default"}}),Gt=classVarianceAuthority.cva("text-[var(--text-primary)] font-medium",{variants:{size:{sm:"text-xs",default:"text-sm",lg:"text-base"}},defaultVariants:{size:"default"}}),zt=classVarianceAuthority.cva("text-[var(--muted-foreground)]",{variants:{size:{sm:"text-xs",default:"text-xs",lg:"text-sm"}},defaultVariants:{size:"default"}}),Ut=classVarianceAuthority.cva("text-[var(--destructive-background)]",{variants:{size:{sm:"text-xs",default:"text-xs",lg:"text-sm"}},defaultVariants:{size:"default"}});exports.PasswordField=Ke;exports.PasswordFieldPropsSchema=Ht;exports.passwordFieldDescriptionVariants=zt;exports.passwordFieldErrorVariants=Ut;exports.passwordFieldLabelVariants=Gt;exports.passwordFieldVariants=kt;//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|