@nice2dev/auth 1.4.20 → 1.4.22
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 +82 -0
- package/dist/NiceLoginForm.d.ts +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +37 -52
- package/dist/style.css +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,87 @@
|
|
|
1
1
|
# @nice2dev/auth — Changelog
|
|
2
2
|
|
|
3
|
+
## 1.4.22
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4a84396: Controls B (round 44, 1.4.22): editors, tools and media.
|
|
8
|
+
|
|
9
|
+
- **Built-in icons** (`NiceIcon` without a resolver):
|
|
10
|
+
- `refresh` takes NtdRefresh's shape: two arcs with solid heads, replacing the old corner glyph;
|
|
11
|
+
- `grip` is six dots;
|
|
12
|
+
- `indent` and `outdent` are text lines with a solid arrow head;
|
|
13
|
+
- built-ins can now have filled parts.
|
|
14
|
+
- **NiceCaptcha, NicePasswordGenerator:** the refresh button draws the refresh icon, not a CSS ring.
|
|
15
|
+
The captcha button has no frame.
|
|
16
|
+
- **NiceTaskInbox:** the refresh button is a frameless icon button.
|
|
17
|
+
- **NiceGitManager** fills its container, so the width no longer jumps between tabs.
|
|
18
|
+
- **NiceCodeDiffEditor:**
|
|
19
|
+
- it no longer scrolls past the last line;
|
|
20
|
+
- the line-number gutter is narrow, and the +/- markers have a gap before the code;
|
|
21
|
+
- new `options` passes Monaco settings through.
|
|
22
|
+
- **NiceCodeEditor:** the matching bracket pair gets a tinted box, and the bracket-pair guide line is
|
|
23
|
+
gone.
|
|
24
|
+
- **NiceChatWindow:** the hover actions sit centred beside the bubble.
|
|
25
|
+
- **NiceWorkflowInstanceMonitor:** the process name and the instance id are on two lines.
|
|
26
|
+
- **NiceDataExportCenter:**
|
|
27
|
+
- columns move up and down;
|
|
28
|
+
- a column takes its own header name (new `ExportField.header`);
|
|
29
|
+
- export configurations are saved under a name, picked from a list and deleted from the same bar.
|
|
30
|
+
- **NiceGenericPlayer:**
|
|
31
|
+
- dropped audio and video files join the playlist (`allowFileDrop`, `onFilesAdded`), and video
|
|
32
|
+
files play in the stage (new `'video'` source kind);
|
|
33
|
+
- a Playlist button shows and hides the list (`showPlaylist`);
|
|
34
|
+
- `showProControls` hides the shuffle, repeat, speed and A-B row.
|
|
35
|
+
- **NicePianoRoll:**
|
|
36
|
+
- new `snapToGrid` (on by default) snaps a new note to the grid;
|
|
37
|
+
- new `gridDivisions`, `noteLength` and `readOnly`.
|
|
38
|
+
|
|
39
|
+
## 1.4.21
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- 15ed387: Controls A (round 44, 1.4.21): forms, navigation and layout fixes from the showcase feedback.
|
|
44
|
+
|
|
45
|
+
- **NiceStepper** (and NiceWizard, which uses it):
|
|
46
|
+
- connectors sit level with the middle of the circle, however many lines a description has;
|
|
47
|
+
- vertical steps centre the circle on the item;
|
|
48
|
+
- steps take `status` (`completed`, `active`, `pending`, `error`, `skipped`) and `description`.
|
|
49
|
+
- **NiceDocumentApprovalFlow** draws its steps with NiceStepper. The decision panel stays.
|
|
50
|
+
- **NiceMenu:** new `panelAnchor: 'item' | 'menu'`. With `'menu'`, `panelAlign` lines the panel up
|
|
51
|
+
with the whole bar.
|
|
52
|
+
- **NiceBottomSheet:**
|
|
53
|
+
- snap points are visible dots (`showSnapPoints`), and clicking one jumps there;
|
|
54
|
+
- the handle is a slider (arrow keys, Home, End);
|
|
55
|
+
- a new `initialSnap` or new `snapPoints` move an open sheet.
|
|
56
|
+
- **NiceSortable:** the drop line is measured from the items. It sits midway between two items, and
|
|
57
|
+
in a row it is as tall as an item. Dragging down drops after the hovered item.
|
|
58
|
+
- **NiceDraggable:** marks itself while dragged (`nice-draggable--dragging`). `NICE_DRAG_MIME` and
|
|
59
|
+
`readNiceDrag()` read a drop.
|
|
60
|
+
- **NiceResponsiveBox** follows its own width with a ResizeObserver: it stacks below `stackBelow`
|
|
61
|
+
(480) and wraps at `minItemWidth`.
|
|
62
|
+
- **NiceIconRail, NiceSortableTree:** `size` scales the buttons, the icons and the text, not only the
|
|
63
|
+
spacing.
|
|
64
|
+
- **NiceLoginForm** (auth): an empty `title` hides the heading.
|
|
65
|
+
- **NiceSpeechToText:** errors read as translated sentences, not browser codes, and a new
|
|
66
|
+
`onError(code)` reports the code.
|
|
67
|
+
- **NiceQuestCard:** at 100 % the bar turns green and shows a check mark.
|
|
68
|
+
- **NiceLeaderboard:** players without a photo get initials on one of six theme tones.
|
|
69
|
+
- **NiceTutorial:** new `showBackButton`, `showCloseButton`, `showProgressBar` and `showSpeedControl`.
|
|
70
|
+
- **NiceEntityEditor:** "Add field" and "New entity" open dialogs.
|
|
71
|
+
- **NiceI18nEditor:**
|
|
72
|
+
- removals ask first (`confirmRemove`);
|
|
73
|
+
- Undo and Redo (Ctrl+Z, Ctrl+Y);
|
|
74
|
+
- `onSave` adds a Save button (Ctrl+S);
|
|
75
|
+
- the buttons are icon-only.
|
|
76
|
+
- **Validation:**
|
|
77
|
+
- rules take a `group`, and NiceValidationBuilder has "+ Group";
|
|
78
|
+
- `evaluateValidation(rules, record, { groups, includeUngrouped })` and `isRecordValid` check only
|
|
79
|
+
the chosen groups.
|
|
80
|
+
- **NiceViewRegistry:** the default registry renders `dataGrid`, `chart`, `kpi` and `badge`, so the
|
|
81
|
+
studio's view preview no longer shows "Unknown control".
|
|
82
|
+
- **NiceGantt:** `dependencyStyle="rounded"` draws curves on every route, including arrows that run
|
|
83
|
+
back to the left and links within one row.
|
|
84
|
+
|
|
3
85
|
## 1.4.20
|
|
4
86
|
|
|
5
87
|
No changes in this release.
|
package/dist/NiceLoginForm.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export interface NiceLoginFormProps {
|
|
|
26
26
|
showRegisterLink?: boolean;
|
|
27
27
|
/** Fires when "Register" is clicked. */
|
|
28
28
|
onRegisterClick?: () => void;
|
|
29
|
-
/** Title text. */
|
|
29
|
+
/** Title text. An empty string hides the heading; omitted shows the translated "Sign In". */
|
|
30
30
|
title?: string;
|
|
31
31
|
/** Submit button label. */
|
|
32
32
|
submitLabel?: string;
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),e=require("react/jsx-runtime"),q=require("@nice2dev/ui-core");function re(r={}){const{onLogin:a,onRefresh:n,onLogout:t,storageKey:i="nice_auth",persistAuth:d=!1}=r,[l,c]=s.useState(()=>{if(d&&typeof window<"u")try{const h=localStorage.getItem(i);if(h)return{...JSON.parse(h),loading:!1,error:null}}catch{}return{isAuthenticated:!1,user:null,tokens:null,loading:!1,error:null}}),u=s.useCallback(h=>{c(p=>{const x={...p,...h};return d&&typeof window<"u"&&(x.isAuthenticated?localStorage.setItem(i,JSON.stringify({isAuthenticated:!0,user:x.user})):localStorage.removeItem(i)),x})},[d,i]),k=s.useCallback(async(h,p)=>{u({loading:!0,error:null});try{if(a){const x=await a(h,p);return u({isAuthenticated:!0,user:x.user,tokens:x.tokens,loading:!1}),!0}return u({loading:!1,error:"No login handler configured"}),!1}catch(x){return u({loading:!1,error:(x==null?void 0:x.message)??"Login failed"}),!1}},[a,u]),f=s.useCallback(()=>{t==null||t(),u({isAuthenticated:!1,user:null,tokens:null,loading:!1,error:null})},[t,u]),g=s.useCallback(async()=>{var h;if(!((h=l.tokens)!=null&&h.refreshToken)||!n)return!1;try{const p=await n(l.tokens.refreshToken);return u({tokens:p}),!0}catch{return f(),!1}},[l.tokens,n,u,f]),C=s.useCallback((h,p)=>{u({isAuthenticated:!0,user:h,tokens:p,loading:!1,error:null})},[u]),w=s.useCallback((...h)=>l.user?h.every(p=>l.user.roles.includes(p)):!1,[l.user]),o=s.useCallback((...h)=>l.user?h.every(p=>l.user.permissions.includes(p)):!1,[l.user]),b=s.useCallback(()=>{u({error:null})},[u]);return{...l,login:k,logout:f,refreshToken:g,setAuth:C,hasRoles:w,hasPermissions:o,clearError:b}}const ce=Object.assign(s.forwardRef(({onSubmit:r,loading:a=!1,error:n,showRememberMe:t=!0,showForgotPassword:i=!0,onForgotPassword:d,showRegisterLink:l=!0,onRegisterClick:c,title:u,submitLabel:k,logo:f,footer:g,className:C,style:w,emailLabel:o,passwordLabel:b,tracelessPolicy:h,privacyMessage:p},x)=>{const{t:j}=q.useNiceTranslation(),[$,N]=s.useState(""),[S,F]=s.useState(""),[I,_]=s.useState(!1),P=s.useMemo(()=>!(!t||h&&!h.cookiesAllowed),[t,h]),D=s.useCallback(T=>{T.preventDefault();const R=(h==null?void 0:h.cookiesAllowed)===!1?!1:I;r==null||r({email:$,password:S,rememberMe:R})},[$,S,I,r,h]);return e.jsxs("form",{ref:x,className:`nice-login-form${C?` ${C}`:""}`,style:w,onSubmit:D,noValidate:!0,children:[f&&e.jsx("div",{className:"nice-login-form__logo",children:f}),e.jsx("h2",{className:"nice-login-form__title",children:u??j("loginForm.title","Sign In")}),n&&e.jsx("div",{className:"nice-login-form__error",role:"alert",children:n}),e.jsxs("div",{className:"nice-login-form__field",children:[e.jsx("label",{htmlFor:"nice-login-email",children:o??j("loginForm.email","Email")}),e.jsx("input",{id:"nice-login-email",className:"nice-input",type:"email",value:$,onChange:T=>N(T.target.value),autoComplete:"email",required:!0,disabled:a})]}),e.jsxs("div",{className:"nice-login-form__field",children:[e.jsx("label",{htmlFor:"nice-login-password",children:b??j("loginForm.password","Password")}),e.jsx("input",{id:"nice-login-password",className:"nice-input",type:"password",value:S,onChange:T=>F(T.target.value),autoComplete:"current-password",required:!0,disabled:a})]}),e.jsxs("div",{className:"nice-login-form__options",children:[P&&e.jsxs("label",{className:"nice-login-form__remember",children:[e.jsx("input",{type:"checkbox",checked:I,onChange:T=>_(T.target.checked),disabled:a}),e.jsx("span",{children:j("loginForm.rememberMe","Remember me")})]}),!P&&t&&p&&e.jsx("span",{className:"nice-login-form__privacy-notice",children:p}),i&&e.jsx("button",{type:"button",className:"nice-login-form__forgot",onClick:d,disabled:a,children:j("loginForm.forgotPassword","Forgot password?")})]}),e.jsx("button",{type:"submit",className:"nice-btn nice-btn--primary nice-login-form__submit",disabled:a||!$||!S,children:a?"…":k??j("loginForm.signIn","Sign In")}),l&&e.jsxs("div",{className:"nice-login-form__register",children:[e.jsxs("span",{children:[j("loginForm.dontHaveAnAccount","Don't have an account?")," "]}),e.jsx("button",{type:"button",onClick:c,disabled:a,children:j("loginForm.register","Register")})]}),g&&e.jsx("div",{className:"nice-login-form__footer",children:g})]})}),{displayName:"NiceLoginForm"}),ie={0:"Very weak",1:"Weak",2:"Fair",3:"Strong",4:"Very strong"},oe={0:"#d9534f",1:"#f0ad4e",2:"#5bc0de",3:"#5cb85c",4:"#2e7d32"};function H(r){if(!r)return 0;let a=0;return r.length>=8&&a++,r.length>=12&&a++,/[a-z]/.test(r)&&/[A-Z]/.test(r)&&a++,/\d/.test(r)&&a++,/[^a-zA-Z0-9]/.test(r)&&a++,Math.min(4,a)}const W=Object.assign(s.forwardRef(({password:r,strength:a,showLabel:n=!0,labels:t,className:i},d)=>{const{t:l}=q.useNiceTranslation(),c=a??H(r),u=oe[c],k=(c+1)/5*100;return e.jsxs("div",{ref:d,className:`nice-password-strength${i?` ${i}`:""}`,children:[e.jsx("div",{className:"nice-password-strength__bar",children:e.jsx("div",{className:"nice-password-strength__fill",style:{width:`${k}%`,backgroundColor:u}})}),n&&e.jsx("span",{className:"nice-password-strength__label",style:{color:u},children:t?t[c]:l(`passwordStrength.level.${c}`,ie[c])})]})}),{displayName:"NicePasswordStrength"}),le=Object.assign(s.forwardRef(({onSubmit:r,loading:a=!1,error:n,onLoginClick:t,showPasswordStrength:i=!0,minPasswordStrength:d=2,termsUrl:l,privacyUrl:c,title:u,logo:k,footer:f,className:g,style:C},w)=>{const{t:o}=q.useNiceTranslation(),[b,h]=s.useState(""),[p,x]=s.useState(""),[j,$]=s.useState(""),[N,S]=s.useState(""),[F,I]=s.useState(""),[_,P]=s.useState(!1),D=H(N),T=N===F,R=b&&j&&N&&T&&_&&D>=d&&!a,m=s.useCallback(v=>{v.preventDefault(),R&&(r==null||r({firstName:b,lastName:p,email:j,password:N,acceptTerms:_}))},[R,b,p,j,N,_,r]);return e.jsxs("form",{ref:w,className:`nice-register-form${g?` ${g}`:""}`,style:C,onSubmit:m,noValidate:!0,children:[k&&e.jsx("div",{className:"nice-register-form__logo",children:k}),e.jsx("h2",{className:"nice-register-form__title",children:u??o("registrationForm.title","Create Account")}),n&&e.jsx("div",{className:"nice-register-form__error",role:"alert",children:n}),e.jsxs("div",{className:"nice-register-form__row",children:[e.jsxs("div",{className:"nice-register-form__field",children:[e.jsx("label",{htmlFor:"nice-reg-first",children:o("registrationForm.firstName","First name *")}),e.jsx("input",{id:"nice-reg-first",className:"nice-input",type:"text",value:b,onChange:v=>h(v.target.value),required:!0,disabled:a,autoComplete:"given-name"})]}),e.jsxs("div",{className:"nice-register-form__field",children:[e.jsx("label",{htmlFor:"nice-reg-last",children:o("registrationForm.lastName","Last name")}),e.jsx("input",{id:"nice-reg-last",className:"nice-input",type:"text",value:p,onChange:v=>x(v.target.value),disabled:a,autoComplete:"family-name"})]})]}),e.jsxs("div",{className:"nice-register-form__field",children:[e.jsx("label",{htmlFor:"nice-reg-email",children:o("registrationForm.email","Email *")}),e.jsx("input",{id:"nice-reg-email",className:"nice-input",type:"email",value:j,onChange:v=>$(v.target.value),required:!0,disabled:a,autoComplete:"email"})]}),e.jsxs("div",{className:"nice-register-form__field",children:[e.jsx("label",{htmlFor:"nice-reg-pass",children:o("registrationForm.password","Password *")}),e.jsx("input",{id:"nice-reg-pass",className:"nice-input",type:"password",value:N,onChange:v=>S(v.target.value),required:!0,disabled:a,autoComplete:"new-password"}),i&&N.length>0&&e.jsx(W,{password:N})]}),e.jsxs("div",{className:"nice-register-form__field",children:[e.jsx("label",{htmlFor:"nice-reg-confirm",children:o("registrationForm.confirmPassword","Confirm password *")}),e.jsx("input",{id:"nice-reg-confirm",className:"nice-input",type:"password",value:F,onChange:v=>I(v.target.value),required:!0,disabled:a,autoComplete:"new-password"}),F&&!T&&e.jsx("span",{className:"nice-error-text",children:o("registrationForm.passwordsDoNotMatch","Passwords do not match")})]}),e.jsxs("label",{className:"nice-register-form__terms",children:[e.jsx("input",{type:"checkbox",checked:_,onChange:v=>P(v.target.checked),disabled:a}),e.jsxs("span",{children:[o("registrationForm.iAcceptThe","I accept the")," ",l?e.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",children:o("registrationForm.terms","Terms")}):o("registrationForm.terms","Terms"),c&&e.jsxs(e.Fragment,{children:[" ",o("registrationForm.and","and")," ",e.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",children:o("registrationForm.privacyPolicy","Privacy Policy")})]})," *"]})]}),e.jsx("button",{type:"submit",className:"nice-btn nice-btn--primary nice-register-form__submit",disabled:!R,children:a?"…":o("registrationForm.register","Register")}),t&&e.jsxs("div",{className:"nice-register-form__login",children:[e.jsxs("span",{children:[o("registrationForm.alreadyHaveAnAccount","Already have an account?")," "]}),e.jsx("button",{type:"button",onClick:t,children:o("registrationForm.signIn","Sign in")})]}),f&&e.jsx("div",{className:"nice-register-form__footer",children:f})]})}),{displayName:"NiceRegistrationForm"}),de=({style:r})=>e.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:"0.3em",height:"0.6em",margin:"0 0.35em 0.15em 0.1em",borderRight:"0.12em solid currentColor",borderBottom:"0.12em solid currentColor",transform:"rotate(45deg)",...r}}),ee=({style:r})=>e.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:"0.85em",height:"0.85em",borderRadius:"50%",border:"0.12em solid currentColor",borderTopColor:"transparent",transform:"rotate(-45deg)",...r}}),Y={lowercase:"abcdefghijklmnopqrstuvwxyz",uppercase:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",digits:"0123456789",symbols:"!@#$%^&*()-_=+[]{};:,.?/~"},ue=/[0Oo1lI|]/g,z={length:16,lowercase:!0,uppercase:!0,digits:!0,symbols:!0,excludeAmbiguous:!1},X={password:"Generated password",length:"Length",lowercase:"Lowercase (a–z)",uppercase:"Uppercase (A–Z)",digits:"Digits (0–9)",symbols:"Symbols (!@#…)",excludeAmbiguous:"Avoid look-alikes (0 O 1 l I)",generate:"Generate",copy:"Copy",copied:"Copied",noCharacterSets:"Pick at least one kind of character."},he=r=>{const a=globalThis.crypto;if(!a||typeof a.getRandomValues!="function")throw new Error("generatePassword: crypto.getRandomValues is not available");return a.getRandomValues(r)};let me=0;function Z(r,a){const n=Math.floor(4294967296/r)*r,t=new Uint32Array(1);for(;;){const i=a(t)[0];if(i<n)return i%r}}function J(r={},a=he){const n={...z,...r},t=["lowercase","uppercase","digits","symbols"].filter(c=>n[c]).map(c=>n.excludeAmbiguous?Y[c].replace(ue,""):Y[c]).filter(c=>c.length>0);if(t.length===0)return"";const i=Math.max(t.length,Math.min(1024,Math.floor(n.length))),d=t.join(""),l=t.map(c=>c[Z(c.length,a)]);for(;l.length<i;)l.push(d[Z(d.length,a)]);for(let c=l.length-1;c>0;c--){const u=Z(c+1,a);[l[c],l[u]]=[l[u],l[c]]}return l.join("")}const pe=({value:r,defaultValue:a="",onChange:n,options:t,defaultOptions:i,onOptionsChange:d,minLength:l=8,maxLength:c=64,showStrength:u=!0,showCopy:k=!0,onCopy:f,labels:g,disabled:C=!1,className:w,style:o,id:b})=>{const{t:h}=q.useNiceTranslation(),p={...Object.fromEntries(Object.keys(X).map(M=>[M,h(`passwordGenerator.${M}`,X[M])])),...g},[x]=s.useState(()=>`nice-password-generator-${++me}`),j=b??x,[$,N]=s.useState(()=>({...z,...i})),S=t?{...z,...t}:$,[F,I]=s.useState(()=>r===void 0&&!a?J({...z,...i,...t}):a),_=r??F,[P,D]=s.useState(!1),T=s.useRef(void 0);s.useEffect(()=>()=>clearTimeout(T.current),[]);const R=s.useCallback(M=>{r===void 0&&I(M),D(!1),n==null||n(M)},[r,n]),m=s.useCallback(M=>R(J(M)),[R]),v=(M,E)=>{const U={...S,[M]:E};t||N(U),d==null||d(U),m(U)},G=async()=>{!_||!navigator.clipboard||(await navigator.clipboard.writeText(_),D(!0),clearTimeout(T.current),T.current=setTimeout(()=>D(!1),1500),f==null||f(_))},A=!S.lowercase&&!S.uppercase&&!S.digits&&!S.symbols,V=Math.min(c,Math.max(l,S.length));return e.jsxs("div",{id:b,className:`nice-password-generator${w?` ${w}`:""}`,style:o,children:[e.jsxs("div",{className:"nice-password-generator__output",children:[e.jsx("input",{id:`${j}-value`,className:"nice-password-generator__value",type:"text",readOnly:!0,spellCheck:!1,autoComplete:"off",value:_,"aria-label":p.password}),e.jsx("button",{type:"button",className:"nice-password-generator__button",onClick:()=>m(S),disabled:C||A,"aria-label":p.generate,title:p.generate,children:e.jsx(ee,{})}),k&&e.jsx("button",{type:"button",className:"nice-password-generator__button nice-password-generator__button--copy",onClick:G,disabled:C||!_,"aria-live":"polite",children:P?e.jsxs(e.Fragment,{children:[e.jsx(de,{})," ",p.copied]}):p.copy})]}),u&&e.jsx(W,{password:_}),e.jsxs("div",{className:"nice-password-generator__length",children:[e.jsx("label",{htmlFor:`${j}-length`,children:p.length}),e.jsx("input",{id:`${j}-length`,type:"range",min:l,max:c,value:V,disabled:C,onChange:M=>v("length",Number(M.target.value))}),e.jsx("output",{htmlFor:`${j}-length`,className:"nice-password-generator__length-value",children:V})]}),e.jsx("div",{className:"nice-password-generator__sets",children:["lowercase","uppercase","digits","symbols","excludeAmbiguous"].map(M=>e.jsxs("label",{className:"nice-password-generator__option",children:[e.jsx("input",{type:"checkbox",checked:S[M],disabled:C,onChange:E=>v(M,E.target.checked)}),p[M]]},M))}),A&&e.jsx("p",{className:"nice-password-generator__error",role:"alert",children:p.noCharacterSets})]})},ge=Object.assign(s.forwardRef(({requireCurrentPassword:r=!0,onSubmit:a,loading:n=!1,error:t,success:i,minPasswordStrength:d=2,title:l,className:c,style:u},k)=>{const{t:f}=q.useNiceTranslation(),[g,C]=s.useState(""),[w,o]=s.useState(""),[b,h]=s.useState(""),p=H(w),x=w===b,j=(!r||g.length>0)&&w.length>0&&x&&p>=d&&!n,$=s.useCallback(N=>{N.preventDefault(),j&&(a==null||a({currentPassword:r?g:void 0,newPassword:w}))},[j,g,w,r,a]);return e.jsxs("form",{ref:k,className:`nice-change-password${c?` ${c}`:""}`,style:u,onSubmit:$,noValidate:!0,children:[e.jsx("h3",{className:"nice-change-password__title",children:l??f("changePassword.title","Change Password")}),t&&e.jsx("div",{className:"nice-change-password__error",role:"alert",children:t}),i&&e.jsx("div",{className:"nice-change-password__success",role:"status",children:i}),r&&e.jsxs("div",{className:"nice-change-password__field",children:[e.jsx("label",{htmlFor:"nice-cp-current",children:f("changePassword.currentPassword","Current password")}),e.jsx("input",{id:"nice-cp-current",className:"nice-input",type:"password",value:g,onChange:N=>C(N.target.value),autoComplete:"current-password",disabled:n,required:!0})]}),e.jsxs("div",{className:"nice-change-password__field",children:[e.jsx("label",{htmlFor:"nice-cp-new",children:f("changePassword.newPassword","New password")}),e.jsx("input",{id:"nice-cp-new",className:"nice-input",type:"password",value:w,onChange:N=>o(N.target.value),autoComplete:"new-password",disabled:n,required:!0}),w.length>0&&e.jsx(W,{password:w})]}),e.jsxs("div",{className:"nice-change-password__field",children:[e.jsx("label",{htmlFor:"nice-cp-confirm",children:f("changePassword.confirmNewPassword","Confirm new password")}),e.jsx("input",{id:"nice-cp-confirm",className:"nice-input",type:"password",value:b,onChange:N=>h(N.target.value),autoComplete:"new-password",disabled:n,required:!0}),b&&!x&&e.jsx("span",{className:"nice-error-text",children:f("changePassword.passwordsDoNotMatch","Passwords do not match")})]}),e.jsx("button",{type:"submit",className:"nice-btn nice-btn--primary",disabled:!j,children:n?"…":f("changePassword.changePassword","Change Password")})]})}),{displayName:"NiceChangePassword"}),fe=Object.assign(s.forwardRef(({secret:r,qrCodeUrl:a,issuer:n,accountName:t,onVerify:i,loading:d=!1,error:l,onCancel:c,recoveryCodes:u,step:k="setup",onStepChange:f,className:g,style:C},w)=>{const{t:o}=q.useNiceTranslation(),[b,h]=s.useState(""),[p,x]=s.useState(!1),[j,$]=s.useState(!1),N=s.useCallback(F=>{F.preventDefault(),b.length>=6&&(i==null||i(b))},[b,i]),S=`otpauth://totp/${n?`${n}:`:""}${t??"user"}?secret=${r}${n?`&issuer=${n}`:""}&digits=6&period=30`;return e.jsxs("div",{ref:w,className:`nice-2fa-setup${g?` ${g}`:""}`,style:C,children:[e.jsx("h3",{className:"nice-2fa-setup__title",children:o("twoFaSetup.twoFactorAuthentication","Two-Factor Authentication")}),k==="setup"&&e.jsxs("div",{className:"nice-2fa-setup__step",children:[e.jsx("p",{className:"nice-2fa-setup__instruction",children:o("twoFaSetup.scanThisQrCodeWith","Scan this QR code with your authenticator app (Google Authenticator, Authy, etc.):")}),a?e.jsx("img",{src:a,alt:o("twoFaSetup.n2faQrCode","2FA QR Code"),className:"nice-2fa-setup__qr"}):e.jsxs("div",{className:"nice-2fa-setup__qr-placeholder",children:[e.jsx("span",{children:o("twoFaSetup.qrCode","QR Code")}),e.jsx("code",{className:"nice-2fa-setup__uri",children:S})]}),e.jsxs("div",{className:"nice-2fa-setup__secret",children:[e.jsxs("span",{children:[o("twoFaSetup.orEnterManually","Or enter manually:")," "]}),p?e.jsx("code",{className:"nice-2fa-setup__secret-key",children:r}):e.jsx("button",{type:"button",onClick:()=>x(!0),children:o("twoFaSetup.showSecretKey","Show secret key")})]}),e.jsx("button",{type:"button",className:"nice-btn nice-btn--primary",onClick:()=>f==null?void 0:f("verify"),children:o("twoFaSetup.nextVerify","Next — Verify")})]}),k==="verify"&&e.jsxs("form",{className:"nice-2fa-setup__step",onSubmit:N,children:[e.jsx("p",{className:"nice-2fa-setup__instruction",children:o("twoFaSetup.enterThe6DigitCode","Enter the 6-digit code from your authenticator app:")}),l&&e.jsx("div",{className:"nice-2fa-setup__error",role:"alert",children:l}),e.jsx("input",{className:"nice-input nice-2fa-setup__code-input",type:"text",inputMode:"numeric",maxLength:6,value:b,onChange:F=>h(F.target.value.replace(/\D/g,"").slice(0,6)),placeholder:"000000",autoFocus:!0,disabled:d,autoComplete:"one-time-code"}),e.jsxs("div",{className:"nice-2fa-setup__actions",children:[e.jsx("button",{type:"button",className:"nice-btn",onClick:()=>f==null?void 0:f("setup"),children:o("twoFaSetup.back","Back")}),e.jsx("button",{type:"submit",className:"nice-btn nice-btn--primary",disabled:d||b.length<6,children:d?"…":o("twoFaSetup.verify","Verify")})]})]}),k==="recovery"&&u&&e.jsxs("div",{className:"nice-2fa-setup__step",children:[e.jsx("p",{className:"nice-2fa-setup__instruction",children:o("twoFaSetup.saveTheseRecoveryCodesIn","Save these recovery codes in a safe place. Each code can only be used once:")}),e.jsx("div",{className:"nice-2fa-setup__recovery-codes",children:u.map((F,I)=>e.jsx("code",{className:"nice-2fa-setup__recovery-code",children:F},I))}),e.jsx("button",{type:"button",className:"nice-btn",onClick:()=>{var F;(F=navigator.clipboard)==null||F.writeText(u.join(`
|
|
2
|
-
`)),$(!0)},children:j?o("twoFaSetup.copied","Copied!"):o("twoFaSetup.copyAllCodes","Copy all codes")}),c&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--primary",onClick:c,children:o("twoFaSetup.done","Done")})]}),c&&k!=="recovery"&&e.jsx("button",{type:"button",className:"nice-2fa-setup__cancel",onClick:c,children:o("twoFaSetup.cancel","Cancel")})]})}),{displayName:"NiceTwoFaSetup"}),xe=500;function O(r,a){return Math.floor(Math.random()*(a-r+1))+r}function be(){return`${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`}function je(r,a){switch(r){case"math":{const n=a==="easy"?5:a==="hard"?20:10,t=O(1,n),i=O(1,n),d=a!=="easy"&&t>=i&&Math.random()<.5,l=d?t-i:t+i;return{kind:"math",prompt:`${t} ${d?"−":"+"} ${i}`,answer:l}}case"text":{const n=a==="easy"?4:a==="hard"?7:5,t="ABCDEFGHJKMNPQRSTUVWXYZ23456789";let i="";for(let d=0;d<n;d++)i+=t[O(0,t.length-1)];return{kind:"text",text:i}}case"slider":return{kind:"slider",target:O(70,92),tolerance:a==="easy"?8:a==="hard"?2:4};case"checkbox":default:return{kind:"checkbox"}}}function _e(r,a,n){if(!r)return;const t=r.getContext("2d");if(!t)return;const i=r.width,d=r.height;t.clearRect(0,0,i,d),t.fillStyle=n?"#1a1a1a":"#f3f4f6",t.fillRect(0,0,i,d),t.strokeStyle=n?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.18)",t.lineWidth=1;for(let c=0;c<6;c++)t.beginPath(),t.moveTo(O(0,i),O(0,d)),t.lineTo(O(0,i),O(0,d)),t.stroke();t.fillStyle=n?"#e5e7eb":"#111827",t.textBaseline="middle";const l=i/(a.length+1);for(let c=0;c<a.length;c++){const u=O(22,30);t.save(),t.translate(l*(c+1),d/2+O(-4,4)),t.rotate(O(-22,22)*Math.PI/180),t.font=`bold ${u}px monospace`,t.fillText(a[c],-u/3,0),t.restore()}}const we=Object.assign(s.forwardRef((r,a)=>{const{t:n}=q.useNiceTranslation(),{variant:t,difficulty:i="medium",refreshable:d=!0,verifyToken:l,expiresMs:c,label:u=n("captcha.imNotARobot","I'm not a robot"),provider:k="custom",siteKey:f,onVerify:g,onExpire:C,onError:w,onRefresh:o,theme:b="light",size:h="normal",customRender:p,className:x,style:j}=r,$=s.useRef(null),N=s.useRef(null),S=s.useRef(void 0),[F,I]=s.useState(0),[_,P]=s.useState("idle"),[D,T]=s.useState(""),[R,m]=s.useState(""),[v,G]=s.useState(0),A=s.useMemo(()=>je(t??"checkbox",i),[t,i,F]),V=s.useCallback(()=>{P("idle"),T(""),m(""),G(0),I(y=>y+1)},[]),M=s.useCallback(()=>{V(),o==null||o()},[V,o]);s.useImperativeHandle(a,()=>({reset:V,refresh:M,container:$.current}),[V,M]),s.useEffect(()=>{t==="text"&&A.kind==="text"&&_e(N.current,A.text,b==="dark")},[t,A,b]),s.useEffect(()=>{if(_!=="verified"||!c)return;const y=setTimeout(()=>{C==null||C(),V()},c);return()=>clearTimeout(y)},[_,c,C,V]);const E=s.useCallback(()=>{const y=`ntd-cap:${t}:${be()}`;l?(P("verifying"),T(""),Promise.resolve().then(()=>l(y)).then(Q=>{Q?(P("verified"),g==null||g(y)):(P("error"),T(n("captcha.verificationFailedPleaseTryAgain","Verification failed. Please try again.")),I(ne=>ne+1),m(""))}).catch(Q=>{P("error"),T(n("captcha.verificationErrorPleaseTryAgain","Verification error. Please try again.")),w==null||w(Q)})):(P("verified"),g==null||g(y))},[t,l,g,w,n]),U=s.useCallback(()=>{P("error"),T(n("captcha.incorrectPleaseTryAgain","Incorrect, please try again.")),I(y=>y+1),m("")},[n]),te=s.useCallback(()=>{_==="verifying"||_==="verified"||(P("verifying"),T(""),S.current=setTimeout(E,xe))},[_,E]);s.useEffect(()=>()=>clearTimeout(S.current),[]);const K=s.useCallback(()=>{A.kind==="math"?R.trim()!==""&&Number(R)===A.answer?E():U():A.kind==="text"&&(R.trim().toUpperCase()===A.text?E():U())},[A,R,E,U]),se=s.useCallback(y=>{G(y),!(A.kind!=="slider"||_==="verified"||_==="verifying")&&Math.abs(y-A.target)<=A.tolerance&&E()},[A,_,E]);if(!t)return k==="custom"&&p?e.jsx("div",{ref:$,className:`nice-captcha nice-captcha--custom${x?` ${x}`:""}`,style:j,children:p}):e.jsx("div",{ref:$,className:`nice-captcha nice-captcha--${k} nice-captcha--${b}${h==="compact"?" nice-captcha--compact":""}${x?` ${x}`:""}`,style:j,"data-sitekey":f,"data-theme":b,"data-size":h,children:e.jsxs("div",{className:"nice-captcha__placeholder",children:[e.jsx("span",{children:n("captcha.captcha","Captcha ({provider})").replace("{provider}",String(k))}),e.jsx("p",{children:n("captcha.loadTheSdkToActivate","Load the {provider} SDK to activate verification.").replace("{provider}",String(k))})]})});const L=_==="verifying",B=_==="verified",ae=`nice-captcha nice-captcha--${t} nice-captcha--${b} nice-captcha--${_}${h==="compact"?" nice-captcha--compact":""}${x?` ${x}`:""}`;return e.jsxs("div",{ref:$,className:ae,style:j,role:"group","aria-label":n("captcha.captchaChallenge","Captcha challenge"),"data-variant":t,"data-status":_,"data-theme":b,children:[t==="checkbox"&&e.jsxs("button",{type:"button",className:"nice-captcha__checkbox",role:"checkbox","aria-checked":B,"aria-busy":L,disabled:L||B,onClick:te,children:[e.jsx("span",{className:"nice-captcha__box","aria-hidden":"true",children:L?"…":B?e.jsx("span",{style:{display:"inline-block",width:"0.3em",height:"0.6em",marginBottom:"0.15em",borderRight:"0.12em solid currentColor",borderBottom:"0.12em solid currentColor",transform:"rotate(45deg)"}}):""}),e.jsx("span",{className:"nice-captcha__label",children:u})]}),t==="math"&&A.kind==="math"&&e.jsxs("div",{className:"nice-captcha__challenge",children:[e.jsxs("span",{className:"nice-captcha__prompt","aria-hidden":"true",children:[A.prompt," ="]}),e.jsx("input",{className:"nice-input nice-captcha__answer",type:"number",inputMode:"numeric",value:R,"aria-label":n("captcha.whatIs","What is {prompt}?").replace("{prompt}",String(A.prompt)),disabled:L||B,onChange:y=>m(y.target.value),onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),K())}}),e.jsx("button",{type:"button",className:"nice-btn nice-btn--primary nice-captcha__verify",disabled:L||B||R.trim()==="",onClick:K,children:L?"…":n("captcha.verify","Verify")})]}),t==="text"&&A.kind==="text"&&e.jsxs("div",{className:"nice-captcha__challenge",children:[e.jsx("canvas",{ref:N,className:"nice-captcha__canvas",width:160,height:56,"aria-hidden":"true"}),e.jsx("input",{className:"nice-input nice-captcha__answer",type:"text",autoCapitalize:"characters",autoComplete:"off",value:R,"aria-label":n("captcha.typeTheCharactersShownIn","Type the characters shown in the image"),disabled:L||B,onChange:y=>m(y.target.value),onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),K())}}),e.jsx("button",{type:"button",className:"nice-btn nice-btn--primary nice-captcha__verify",disabled:L||B||R.trim()==="",onClick:K,children:L?"…":n("captcha.verify","Verify")})]}),t==="slider"&&A.kind==="slider"&&e.jsxs("div",{className:"nice-captcha__challenge nice-captcha__challenge--slider",children:[e.jsx("span",{className:"nice-captcha__slider-hint","aria-hidden":"true",children:B?n("captcha.verified","Verified"):n("captcha.slideToTheMarker","Slide to the marker")}),e.jsxs("div",{className:"nice-captcha__track",children:[e.jsx("span",{className:"nice-captcha__target","aria-hidden":"true",style:{left:`${A.target}%`}}),e.jsx("input",{className:"nice-captcha__slider",type:"range",min:0,max:100,value:v,"aria-label":n("captcha.slideTheHandleToThe","Slide the handle to the marker to verify"),"aria-valuetext":`${v}%`,disabled:B||L,onChange:y=>se(Number(y.target.value))})]})]}),e.jsxs("div",{className:"nice-captcha__footer",children:[e.jsx("div",{className:"nice-captcha__message",role:"status","aria-live":"polite",children:D}),d&&e.jsx("button",{type:"button",className:"nice-captcha__refresh","aria-label":n("captcha.refreshChallenge","Refresh challenge"),title:n("captcha.refreshChallenge","Refresh challenge"),onClick:M,children:e.jsx(ee,{})})]})]})}),{displayName:"NiceCaptcha"}),Ne=[{id:"google",label:"Google",color:"#4285f4",textColor:"#fff"},{id:"microsoft",label:"Microsoft",color:"#00a4ef",textColor:"#fff"},{id:"discord",label:"Discord",color:"#5865f2",textColor:"#fff"},{id:"spotify",label:"Spotify",color:"#1db954",textColor:"#fff"},{id:"github",label:"GitHub",color:"#24292e",textColor:"#fff"}],ve=Object.assign(s.forwardRef(({providers:r=Ne,onProviderClick:a,disabled:n=!1,loadingProvider:t,direction:i="vertical",separatorText:d,showSeparator:l=!0,className:c,style:u},k)=>{const{t:f}=q.useNiceTranslation();return e.jsxs("div",{ref:k,className:`nice-oauth nice-oauth--${i}${c?` ${c}`:""}`,style:u,children:[l&&e.jsxs("div",{className:"nice-oauth__separator",children:[e.jsx("hr",{}),e.jsx("span",{children:d??f("oAuthButtons.orContinueWith","or continue with")}),e.jsx("hr",{})]}),e.jsx("div",{className:"nice-oauth__buttons",children:r.map(g=>e.jsxs("button",{type:"button",className:`nice-oauth__btn${t===g.id?" nice-oauth__btn--loading":""}`,style:{backgroundColor:g.color,color:g.textColor},onClick:()=>a==null?void 0:a(g.id),disabled:n||!!t,children:[g.icon&&e.jsx("span",{className:"nice-oauth__btn-icon",children:g.icon}),e.jsx("span",{className:"nice-oauth__btn-label",children:t===g.id?"…":g.label})]},g.id))})]})}),{displayName:"NiceOAuthButtons"}),ke=s.forwardRef(function(a,n){const{t}=q.useNiceTranslation(),{tokens:i,onCreate:d,onRevoke:l,availableScopes:c=[],maxTokens:u=10,title:k=t("tokenManagement.apiTokens","API Tokens"),className:f,style:g}=a,[C,w]=s.useState(!1),[o,b]=s.useState(""),[h,p]=s.useState([]),[x,j]=s.useState("90"),[$,N]=s.useState(null),[S,F]=s.useState(!1),[I,_]=s.useState(null),P=s.useCallback(async()=>{if(!(!d||!o.trim())){F(!0);try{const m=x?parseInt(x,10):void 0,v=await d(o.trim(),h,m);N(v),b(""),p([]),w(!1)}finally{F(!1)}}},[d,o,h,x]),D=s.useCallback(async m=>{if(l){_(m);try{await l(m)}finally{_(null)}}},[l]),T=m=>{p(v=>v.includes(m)?v.filter(G=>G!==m):[...v,m])},R=i.length<u;return e.jsxs("div",{ref:n,className:`nice-token-management ${f??""}`,style:g,children:[e.jsxs("div",{className:"nice-token-management__header",children:[e.jsx("h3",{children:k}),R&&e.jsx("button",{className:"nice-token-management__new-btn",onClick:()=>w(!0),disabled:C,children:t("tokenManagement.newToken","+ New Token")})]}),$&&e.jsxs("div",{className:"nice-token-management__reveal",children:[e.jsxs("p",{children:[e.jsx("strong",{children:t("tokenManagement.newTokenCreated","New token created!")})," ",t("tokenManagement.copyItNowItWont","Copy it now — it won't be shown again.")]}),e.jsx("code",{className:"nice-token-management__token-value",children:$}),e.jsx("button",{onClick:()=>N(null),children:t("tokenManagement.dismiss","Dismiss")})]}),C&&e.jsxs("div",{className:"nice-token-management__create-form",children:[e.jsxs("label",{children:[t("tokenManagement.name","Name"),e.jsx("input",{type:"text",value:o,onChange:m=>b(m.target.value),placeholder:t("tokenManagement.myApiToken","My API token"),maxLength:64})]}),c.length>0&&e.jsxs("fieldset",{children:[e.jsx("legend",{children:t("tokenManagement.scopes","Scopes")}),c.map(m=>e.jsxs("label",{className:"nice-token-management__scope",children:[e.jsx("input",{type:"checkbox",checked:h.includes(m),onChange:()=>T(m)}),m]},m))]}),e.jsxs("label",{children:[t("tokenManagement.expiresInDays","Expires in (days)"),e.jsx("input",{type:"number",value:x,onChange:m=>j(m.target.value),min:1,max:365})]}),e.jsxs("div",{className:"nice-token-management__create-actions",children:[e.jsx("button",{onClick:P,disabled:S||!o.trim(),children:S?t("tokenManagement.creating","Creating…"):t("tokenManagement.createToken","Create Token")}),e.jsx("button",{onClick:()=>w(!1),children:t("tokenManagement.cancel","Cancel")})]})]}),i.length===0?e.jsx("p",{className:"nice-token-management__empty",children:t("tokenManagement.noApiTokensYet","No API tokens yet.")}):e.jsxs("table",{className:"nice-token-management__table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:t("tokenManagement.name","Name")}),e.jsx("th",{children:t("tokenManagement.prefix","Prefix")}),e.jsx("th",{children:t("tokenManagement.created","Created")}),e.jsx("th",{children:t("tokenManagement.expires","Expires")}),e.jsx("th",{children:t("tokenManagement.lastUsed","Last Used")}),e.jsx("th",{children:t("tokenManagement.scopes","Scopes")}),e.jsx("th",{})]})}),e.jsx("tbody",{children:i.map(m=>{var v;return e.jsxs("tr",{children:[e.jsx("td",{children:m.name}),e.jsx("td",{children:e.jsxs("code",{children:[m.prefix,"…"]})}),e.jsx("td",{children:m.createdAt}),e.jsx("td",{children:m.expiresAt??"—"}),e.jsx("td",{children:m.lastUsedAt??t("tokenManagement.never","Never")}),e.jsx("td",{children:((v=m.scopes)==null?void 0:v.join(", "))||"—"}),e.jsx("td",{children:e.jsx("button",{className:"nice-token-management__revoke-btn",onClick:()=>D(m.id),disabled:I===m.id,children:I===m.id?t("tokenManagement.revoking","Revoking…"):t("tokenManagement.revoke","Revoke")})})]},m.id)})})]})]})});exports.NiceCaptcha=we;exports.NiceChangePassword=ge;exports.NiceLoginForm=ce;exports.NiceOAuthButtons=ve;exports.NicePasswordGenerator=pe;exports.NicePasswordStrength=W;exports.NiceRegistrationForm=le;exports.NiceTokenManagement=ke;exports.NiceTwoFaSetup=fe;exports.calcPasswordStrength=H;exports.generatePassword=J;exports.useAuth=re;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),e=require("react/jsx-runtime"),L=require("@nice2dev/ui-core");function ne(r={}){const{onLogin:a,onRefresh:n,onLogout:t,storageKey:i="nice_auth",persistAuth:d=!1}=r,[l,c]=s.useState(()=>{if(d&&typeof window<"u")try{const h=localStorage.getItem(i);if(h)return{...JSON.parse(h),loading:!1,error:null}}catch{}return{isAuthenticated:!1,user:null,tokens:null,loading:!1,error:null}}),u=s.useCallback(h=>{c(p=>{const x={...p,...h};return d&&typeof window<"u"&&(x.isAuthenticated?localStorage.setItem(i,JSON.stringify({isAuthenticated:!0,user:x.user})):localStorage.removeItem(i)),x})},[d,i]),k=s.useCallback(async(h,p)=>{u({loading:!0,error:null});try{if(a){const x=await a(h,p);return u({isAuthenticated:!0,user:x.user,tokens:x.tokens,loading:!1}),!0}return u({loading:!1,error:"No login handler configured"}),!1}catch(x){return u({loading:!1,error:(x==null?void 0:x.message)??"Login failed"}),!1}},[a,u]),f=s.useCallback(()=>{t==null||t(),u({isAuthenticated:!1,user:null,tokens:null,loading:!1,error:null})},[t,u]),g=s.useCallback(async()=>{var h;if(!((h=l.tokens)!=null&&h.refreshToken)||!n)return!1;try{const p=await n(l.tokens.refreshToken);return u({tokens:p}),!0}catch{return f(),!1}},[l.tokens,n,u,f]),C=s.useCallback((h,p)=>{u({isAuthenticated:!0,user:h,tokens:p,loading:!1,error:null})},[u]),w=s.useCallback((...h)=>l.user?h.every(p=>l.user.roles.includes(p)):!1,[l.user]),o=s.useCallback((...h)=>l.user?h.every(p=>l.user.permissions.includes(p)):!1,[l.user]),b=s.useCallback(()=>{u({error:null})},[u]);return{...l,login:k,logout:f,refreshToken:g,setAuth:C,hasRoles:w,hasPermissions:o,clearError:b}}const re=Object.assign(s.forwardRef(({onSubmit:r,loading:a=!1,error:n,showRememberMe:t=!0,showForgotPassword:i=!0,onForgotPassword:d,showRegisterLink:l=!0,onRegisterClick:c,title:u,submitLabel:k,logo:f,footer:g,className:C,style:w,emailLabel:o,passwordLabel:b,tracelessPolicy:h,privacyMessage:p},x)=>{const{t:j}=L.useNiceTranslation(),[$,N]=s.useState(""),[S,F]=s.useState(""),[I,_]=s.useState(!1),P=s.useMemo(()=>!(!t||h&&!h.cookiesAllowed),[t,h]),D=s.useCallback(T=>{T.preventDefault();const R=(h==null?void 0:h.cookiesAllowed)===!1?!1:I;r==null||r({email:$,password:S,rememberMe:R})},[$,S,I,r,h]);return e.jsxs("form",{ref:x,className:`nice-login-form${C?` ${C}`:""}`,style:w,onSubmit:D,noValidate:!0,children:[f&&e.jsx("div",{className:"nice-login-form__logo",children:f}),u!==""&&e.jsx("h2",{className:"nice-login-form__title",children:u??j("loginForm.title","Sign In")}),n&&e.jsx("div",{className:"nice-login-form__error",role:"alert",children:n}),e.jsxs("div",{className:"nice-login-form__field",children:[e.jsx("label",{htmlFor:"nice-login-email",children:o??j("loginForm.email","Email")}),e.jsx("input",{id:"nice-login-email",className:"nice-input",type:"email",value:$,onChange:T=>N(T.target.value),autoComplete:"email",required:!0,disabled:a})]}),e.jsxs("div",{className:"nice-login-form__field",children:[e.jsx("label",{htmlFor:"nice-login-password",children:b??j("loginForm.password","Password")}),e.jsx("input",{id:"nice-login-password",className:"nice-input",type:"password",value:S,onChange:T=>F(T.target.value),autoComplete:"current-password",required:!0,disabled:a})]}),e.jsxs("div",{className:"nice-login-form__options",children:[P&&e.jsxs("label",{className:"nice-login-form__remember",children:[e.jsx("input",{type:"checkbox",checked:I,onChange:T=>_(T.target.checked),disabled:a}),e.jsx("span",{children:j("loginForm.rememberMe","Remember me")})]}),!P&&t&&p&&e.jsx("span",{className:"nice-login-form__privacy-notice",children:p}),i&&e.jsx("button",{type:"button",className:"nice-login-form__forgot",onClick:d,disabled:a,children:j("loginForm.forgotPassword","Forgot password?")})]}),e.jsx("button",{type:"submit",className:"nice-btn nice-btn--primary nice-login-form__submit",disabled:a||!$||!S,children:a?"…":k??j("loginForm.signIn","Sign In")}),l&&e.jsxs("div",{className:"nice-login-form__register",children:[e.jsxs("span",{children:[j("loginForm.dontHaveAnAccount","Don't have an account?")," "]}),e.jsx("button",{type:"button",onClick:c,disabled:a,children:j("loginForm.register","Register")})]}),g&&e.jsx("div",{className:"nice-login-form__footer",children:g})]})}),{displayName:"NiceLoginForm"}),ce={0:"Very weak",1:"Weak",2:"Fair",3:"Strong",4:"Very strong"},ie={0:"#d9534f",1:"#f0ad4e",2:"#5bc0de",3:"#5cb85c",4:"#2e7d32"};function H(r){if(!r)return 0;let a=0;return r.length>=8&&a++,r.length>=12&&a++,/[a-z]/.test(r)&&/[A-Z]/.test(r)&&a++,/\d/.test(r)&&a++,/[^a-zA-Z0-9]/.test(r)&&a++,Math.min(4,a)}const W=Object.assign(s.forwardRef(({password:r,strength:a,showLabel:n=!0,labels:t,className:i},d)=>{const{t:l}=L.useNiceTranslation(),c=a??H(r),u=ie[c],k=(c+1)/5*100;return e.jsxs("div",{ref:d,className:`nice-password-strength${i?` ${i}`:""}`,children:[e.jsx("div",{className:"nice-password-strength__bar",children:e.jsx("div",{className:"nice-password-strength__fill",style:{width:`${k}%`,backgroundColor:u}})}),n&&e.jsx("span",{className:"nice-password-strength__label",style:{color:u},children:t?t[c]:l(`passwordStrength.level.${c}`,ce[c])})]})}),{displayName:"NicePasswordStrength"}),oe=Object.assign(s.forwardRef(({onSubmit:r,loading:a=!1,error:n,onLoginClick:t,showPasswordStrength:i=!0,minPasswordStrength:d=2,termsUrl:l,privacyUrl:c,title:u,logo:k,footer:f,className:g,style:C},w)=>{const{t:o}=L.useNiceTranslation(),[b,h]=s.useState(""),[p,x]=s.useState(""),[j,$]=s.useState(""),[N,S]=s.useState(""),[F,I]=s.useState(""),[_,P]=s.useState(!1),D=H(N),T=N===F,R=b&&j&&N&&T&&_&&D>=d&&!a,m=s.useCallback(v=>{v.preventDefault(),R&&(r==null||r({firstName:b,lastName:p,email:j,password:N,acceptTerms:_}))},[R,b,p,j,N,_,r]);return e.jsxs("form",{ref:w,className:`nice-register-form${g?` ${g}`:""}`,style:C,onSubmit:m,noValidate:!0,children:[k&&e.jsx("div",{className:"nice-register-form__logo",children:k}),e.jsx("h2",{className:"nice-register-form__title",children:u??o("registrationForm.title","Create Account")}),n&&e.jsx("div",{className:"nice-register-form__error",role:"alert",children:n}),e.jsxs("div",{className:"nice-register-form__row",children:[e.jsxs("div",{className:"nice-register-form__field",children:[e.jsx("label",{htmlFor:"nice-reg-first",children:o("registrationForm.firstName","First name *")}),e.jsx("input",{id:"nice-reg-first",className:"nice-input",type:"text",value:b,onChange:v=>h(v.target.value),required:!0,disabled:a,autoComplete:"given-name"})]}),e.jsxs("div",{className:"nice-register-form__field",children:[e.jsx("label",{htmlFor:"nice-reg-last",children:o("registrationForm.lastName","Last name")}),e.jsx("input",{id:"nice-reg-last",className:"nice-input",type:"text",value:p,onChange:v=>x(v.target.value),disabled:a,autoComplete:"family-name"})]})]}),e.jsxs("div",{className:"nice-register-form__field",children:[e.jsx("label",{htmlFor:"nice-reg-email",children:o("registrationForm.email","Email *")}),e.jsx("input",{id:"nice-reg-email",className:"nice-input",type:"email",value:j,onChange:v=>$(v.target.value),required:!0,disabled:a,autoComplete:"email"})]}),e.jsxs("div",{className:"nice-register-form__field",children:[e.jsx("label",{htmlFor:"nice-reg-pass",children:o("registrationForm.password","Password *")}),e.jsx("input",{id:"nice-reg-pass",className:"nice-input",type:"password",value:N,onChange:v=>S(v.target.value),required:!0,disabled:a,autoComplete:"new-password"}),i&&N.length>0&&e.jsx(W,{password:N})]}),e.jsxs("div",{className:"nice-register-form__field",children:[e.jsx("label",{htmlFor:"nice-reg-confirm",children:o("registrationForm.confirmPassword","Confirm password *")}),e.jsx("input",{id:"nice-reg-confirm",className:"nice-input",type:"password",value:F,onChange:v=>I(v.target.value),required:!0,disabled:a,autoComplete:"new-password"}),F&&!T&&e.jsx("span",{className:"nice-error-text",children:o("registrationForm.passwordsDoNotMatch","Passwords do not match")})]}),e.jsxs("label",{className:"nice-register-form__terms",children:[e.jsx("input",{type:"checkbox",checked:_,onChange:v=>P(v.target.checked),disabled:a}),e.jsxs("span",{children:[o("registrationForm.iAcceptThe","I accept the")," ",l?e.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",children:o("registrationForm.terms","Terms")}):o("registrationForm.terms","Terms"),c&&e.jsxs(e.Fragment,{children:[" ",o("registrationForm.and","and")," ",e.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",children:o("registrationForm.privacyPolicy","Privacy Policy")})]})," *"]})]}),e.jsx("button",{type:"submit",className:"nice-btn nice-btn--primary nice-register-form__submit",disabled:!R,children:a?"…":o("registrationForm.register","Register")}),t&&e.jsxs("div",{className:"nice-register-form__login",children:[e.jsxs("span",{children:[o("registrationForm.alreadyHaveAnAccount","Already have an account?")," "]}),e.jsx("button",{type:"button",onClick:t,children:o("registrationForm.signIn","Sign in")})]}),f&&e.jsx("div",{className:"nice-register-form__footer",children:f})]})}),{displayName:"NiceRegistrationForm"}),le=({style:r})=>e.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:"0.3em",height:"0.6em",margin:"0 0.35em 0.15em 0.1em",borderRight:"0.12em solid currentColor",borderBottom:"0.12em solid currentColor",transform:"rotate(45deg)",...r}}),Y={lowercase:"abcdefghijklmnopqrstuvwxyz",uppercase:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",digits:"0123456789",symbols:"!@#$%^&*()-_=+[]{};:,.?/~"},de=/[0Oo1lI|]/g,K={length:16,lowercase:!0,uppercase:!0,digits:!0,symbols:!0,excludeAmbiguous:!1},X={password:"Generated password",length:"Length",lowercase:"Lowercase (a–z)",uppercase:"Uppercase (A–Z)",digits:"Digits (0–9)",symbols:"Symbols (!@#…)",excludeAmbiguous:"Avoid look-alikes (0 O 1 l I)",generate:"Generate",copy:"Copy",copied:"Copied",noCharacterSets:"Pick at least one kind of character."},ue=r=>{const a=globalThis.crypto;if(!a||typeof a.getRandomValues!="function")throw new Error("generatePassword: crypto.getRandomValues is not available");return a.getRandomValues(r)};let he=0;function Z(r,a){const n=Math.floor(4294967296/r)*r,t=new Uint32Array(1);for(;;){const i=a(t)[0];if(i<n)return i%r}}function J(r={},a=ue){const n={...K,...r},t=["lowercase","uppercase","digits","symbols"].filter(c=>n[c]).map(c=>n.excludeAmbiguous?Y[c].replace(de,""):Y[c]).filter(c=>c.length>0);if(t.length===0)return"";const i=Math.max(t.length,Math.min(1024,Math.floor(n.length))),d=t.join(""),l=t.map(c=>c[Z(c.length,a)]);for(;l.length<i;)l.push(d[Z(d.length,a)]);for(let c=l.length-1;c>0;c--){const u=Z(c+1,a);[l[c],l[u]]=[l[u],l[c]]}return l.join("")}const me=({value:r,defaultValue:a="",onChange:n,options:t,defaultOptions:i,onOptionsChange:d,minLength:l=8,maxLength:c=64,showStrength:u=!0,showCopy:k=!0,onCopy:f,labels:g,disabled:C=!1,className:w,style:o,id:b})=>{const{t:h}=L.useNiceTranslation(),p={...Object.fromEntries(Object.keys(X).map(M=>[M,h(`passwordGenerator.${M}`,X[M])])),...g},[x]=s.useState(()=>`nice-password-generator-${++he}`),j=b??x,[$,N]=s.useState(()=>({...K,...i})),S=t?{...K,...t}:$,[F,I]=s.useState(()=>r===void 0&&!a?J({...K,...i,...t}):a),_=r??F,[P,D]=s.useState(!1),T=s.useRef(void 0);s.useEffect(()=>()=>clearTimeout(T.current),[]);const R=s.useCallback(M=>{r===void 0&&I(M),D(!1),n==null||n(M)},[r,n]),m=s.useCallback(M=>R(J(M)),[R]),v=(M,E)=>{const U={...S,[M]:E};t||N(U),d==null||d(U),m(U)},G=async()=>{!_||!navigator.clipboard||(await navigator.clipboard.writeText(_),D(!0),clearTimeout(T.current),T.current=setTimeout(()=>D(!1),1500),f==null||f(_))},A=!S.lowercase&&!S.uppercase&&!S.digits&&!S.symbols,B=Math.min(c,Math.max(l,S.length));return e.jsxs("div",{id:b,className:`nice-password-generator${w?` ${w}`:""}`,style:o,children:[e.jsxs("div",{className:"nice-password-generator__output",children:[e.jsx("input",{id:`${j}-value`,className:"nice-password-generator__value",type:"text",readOnly:!0,spellCheck:!1,autoComplete:"off",value:_,"aria-label":p.password}),e.jsx("button",{type:"button",className:"nice-password-generator__button",onClick:()=>m(S),disabled:C||A,"aria-label":p.generate,title:p.generate,children:e.jsx(L.NiceIcon,{name:"refresh",size:16})}),k&&e.jsx("button",{type:"button",className:"nice-password-generator__button nice-password-generator__button--copy",onClick:G,disabled:C||!_,"aria-live":"polite",children:P?e.jsxs(e.Fragment,{children:[e.jsx(le,{})," ",p.copied]}):p.copy})]}),u&&e.jsx(W,{password:_}),e.jsxs("div",{className:"nice-password-generator__length",children:[e.jsx("label",{htmlFor:`${j}-length`,children:p.length}),e.jsx("input",{id:`${j}-length`,type:"range",min:l,max:c,value:B,disabled:C,onChange:M=>v("length",Number(M.target.value))}),e.jsx("output",{htmlFor:`${j}-length`,className:"nice-password-generator__length-value",children:B})]}),e.jsx("div",{className:"nice-password-generator__sets",children:["lowercase","uppercase","digits","symbols","excludeAmbiguous"].map(M=>e.jsxs("label",{className:"nice-password-generator__option",children:[e.jsx("input",{type:"checkbox",checked:S[M],disabled:C,onChange:E=>v(M,E.target.checked)}),p[M]]},M))}),A&&e.jsx("p",{className:"nice-password-generator__error",role:"alert",children:p.noCharacterSets})]})},pe=Object.assign(s.forwardRef(({requireCurrentPassword:r=!0,onSubmit:a,loading:n=!1,error:t,success:i,minPasswordStrength:d=2,title:l,className:c,style:u},k)=>{const{t:f}=L.useNiceTranslation(),[g,C]=s.useState(""),[w,o]=s.useState(""),[b,h]=s.useState(""),p=H(w),x=w===b,j=(!r||g.length>0)&&w.length>0&&x&&p>=d&&!n,$=s.useCallback(N=>{N.preventDefault(),j&&(a==null||a({currentPassword:r?g:void 0,newPassword:w}))},[j,g,w,r,a]);return e.jsxs("form",{ref:k,className:`nice-change-password${c?` ${c}`:""}`,style:u,onSubmit:$,noValidate:!0,children:[e.jsx("h3",{className:"nice-change-password__title",children:l??f("changePassword.title","Change Password")}),t&&e.jsx("div",{className:"nice-change-password__error",role:"alert",children:t}),i&&e.jsx("div",{className:"nice-change-password__success",role:"status",children:i}),r&&e.jsxs("div",{className:"nice-change-password__field",children:[e.jsx("label",{htmlFor:"nice-cp-current",children:f("changePassword.currentPassword","Current password")}),e.jsx("input",{id:"nice-cp-current",className:"nice-input",type:"password",value:g,onChange:N=>C(N.target.value),autoComplete:"current-password",disabled:n,required:!0})]}),e.jsxs("div",{className:"nice-change-password__field",children:[e.jsx("label",{htmlFor:"nice-cp-new",children:f("changePassword.newPassword","New password")}),e.jsx("input",{id:"nice-cp-new",className:"nice-input",type:"password",value:w,onChange:N=>o(N.target.value),autoComplete:"new-password",disabled:n,required:!0}),w.length>0&&e.jsx(W,{password:w})]}),e.jsxs("div",{className:"nice-change-password__field",children:[e.jsx("label",{htmlFor:"nice-cp-confirm",children:f("changePassword.confirmNewPassword","Confirm new password")}),e.jsx("input",{id:"nice-cp-confirm",className:"nice-input",type:"password",value:b,onChange:N=>h(N.target.value),autoComplete:"new-password",disabled:n,required:!0}),b&&!x&&e.jsx("span",{className:"nice-error-text",children:f("changePassword.passwordsDoNotMatch","Passwords do not match")})]}),e.jsx("button",{type:"submit",className:"nice-btn nice-btn--primary",disabled:!j,children:n?"…":f("changePassword.changePassword","Change Password")})]})}),{displayName:"NiceChangePassword"}),ge=Object.assign(s.forwardRef(({secret:r,qrCodeUrl:a,issuer:n,accountName:t,onVerify:i,loading:d=!1,error:l,onCancel:c,recoveryCodes:u,step:k="setup",onStepChange:f,className:g,style:C},w)=>{const{t:o}=L.useNiceTranslation(),[b,h]=s.useState(""),[p,x]=s.useState(!1),[j,$]=s.useState(!1),N=s.useCallback(F=>{F.preventDefault(),b.length>=6&&(i==null||i(b))},[b,i]),S=`otpauth://totp/${n?`${n}:`:""}${t??"user"}?secret=${r}${n?`&issuer=${n}`:""}&digits=6&period=30`;return e.jsxs("div",{ref:w,className:`nice-2fa-setup${g?` ${g}`:""}`,style:C,children:[e.jsx("h3",{className:"nice-2fa-setup__title",children:o("twoFaSetup.twoFactorAuthentication","Two-Factor Authentication")}),k==="setup"&&e.jsxs("div",{className:"nice-2fa-setup__step",children:[e.jsx("p",{className:"nice-2fa-setup__instruction",children:o("twoFaSetup.scanThisQrCodeWith","Scan this QR code with your authenticator app (Google Authenticator, Authy, etc.):")}),a?e.jsx("img",{src:a,alt:o("twoFaSetup.n2faQrCode","2FA QR Code"),className:"nice-2fa-setup__qr"}):e.jsxs("div",{className:"nice-2fa-setup__qr-placeholder",children:[e.jsx("span",{children:o("twoFaSetup.qrCode","QR Code")}),e.jsx("code",{className:"nice-2fa-setup__uri",children:S})]}),e.jsxs("div",{className:"nice-2fa-setup__secret",children:[e.jsxs("span",{children:[o("twoFaSetup.orEnterManually","Or enter manually:")," "]}),p?e.jsx("code",{className:"nice-2fa-setup__secret-key",children:r}):e.jsx("button",{type:"button",onClick:()=>x(!0),children:o("twoFaSetup.showSecretKey","Show secret key")})]}),e.jsx("button",{type:"button",className:"nice-btn nice-btn--primary",onClick:()=>f==null?void 0:f("verify"),children:o("twoFaSetup.nextVerify","Next — Verify")})]}),k==="verify"&&e.jsxs("form",{className:"nice-2fa-setup__step",onSubmit:N,children:[e.jsx("p",{className:"nice-2fa-setup__instruction",children:o("twoFaSetup.enterThe6DigitCode","Enter the 6-digit code from your authenticator app:")}),l&&e.jsx("div",{className:"nice-2fa-setup__error",role:"alert",children:l}),e.jsx("input",{className:"nice-input nice-2fa-setup__code-input",type:"text",inputMode:"numeric",maxLength:6,value:b,onChange:F=>h(F.target.value.replace(/\D/g,"").slice(0,6)),placeholder:"000000",autoFocus:!0,disabled:d,autoComplete:"one-time-code"}),e.jsxs("div",{className:"nice-2fa-setup__actions",children:[e.jsx("button",{type:"button",className:"nice-btn",onClick:()=>f==null?void 0:f("setup"),children:o("twoFaSetup.back","Back")}),e.jsx("button",{type:"submit",className:"nice-btn nice-btn--primary",disabled:d||b.length<6,children:d?"…":o("twoFaSetup.verify","Verify")})]})]}),k==="recovery"&&u&&e.jsxs("div",{className:"nice-2fa-setup__step",children:[e.jsx("p",{className:"nice-2fa-setup__instruction",children:o("twoFaSetup.saveTheseRecoveryCodesIn","Save these recovery codes in a safe place. Each code can only be used once:")}),e.jsx("div",{className:"nice-2fa-setup__recovery-codes",children:u.map((F,I)=>e.jsx("code",{className:"nice-2fa-setup__recovery-code",children:F},I))}),e.jsx("button",{type:"button",className:"nice-btn",onClick:()=>{var F;(F=navigator.clipboard)==null||F.writeText(u.join(`
|
|
2
|
+
`)),$(!0)},children:j?o("twoFaSetup.copied","Copied!"):o("twoFaSetup.copyAllCodes","Copy all codes")}),c&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--primary",onClick:c,children:o("twoFaSetup.done","Done")})]}),c&&k!=="recovery"&&e.jsx("button",{type:"button",className:"nice-2fa-setup__cancel",onClick:c,children:o("twoFaSetup.cancel","Cancel")})]})}),{displayName:"NiceTwoFaSetup"}),fe=500;function O(r,a){return Math.floor(Math.random()*(a-r+1))+r}function xe(){return`${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`}function be(r,a){switch(r){case"math":{const n=a==="easy"?5:a==="hard"?20:10,t=O(1,n),i=O(1,n),d=a!=="easy"&&t>=i&&Math.random()<.5,l=d?t-i:t+i;return{kind:"math",prompt:`${t} ${d?"−":"+"} ${i}`,answer:l}}case"text":{const n=a==="easy"?4:a==="hard"?7:5,t="ABCDEFGHJKMNPQRSTUVWXYZ23456789";let i="";for(let d=0;d<n;d++)i+=t[O(0,t.length-1)];return{kind:"text",text:i}}case"slider":return{kind:"slider",target:O(70,92),tolerance:a==="easy"?8:a==="hard"?2:4};case"checkbox":default:return{kind:"checkbox"}}}function je(r,a,n){if(!r)return;const t=r.getContext("2d");if(!t)return;const i=r.width,d=r.height;t.clearRect(0,0,i,d),t.fillStyle=n?"#1a1a1a":"#f3f4f6",t.fillRect(0,0,i,d),t.strokeStyle=n?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.18)",t.lineWidth=1;for(let c=0;c<6;c++)t.beginPath(),t.moveTo(O(0,i),O(0,d)),t.lineTo(O(0,i),O(0,d)),t.stroke();t.fillStyle=n?"#e5e7eb":"#111827",t.textBaseline="middle";const l=i/(a.length+1);for(let c=0;c<a.length;c++){const u=O(22,30);t.save(),t.translate(l*(c+1),d/2+O(-4,4)),t.rotate(O(-22,22)*Math.PI/180),t.font=`bold ${u}px monospace`,t.fillText(a[c],-u/3,0),t.restore()}}const _e=Object.assign(s.forwardRef((r,a)=>{const{t:n}=L.useNiceTranslation(),{variant:t,difficulty:i="medium",refreshable:d=!0,verifyToken:l,expiresMs:c,label:u=n("captcha.imNotARobot","I'm not a robot"),provider:k="custom",siteKey:f,onVerify:g,onExpire:C,onError:w,onRefresh:o,theme:b="light",size:h="normal",customRender:p,className:x,style:j}=r,$=s.useRef(null),N=s.useRef(null),S=s.useRef(void 0),[F,I]=s.useState(0),[_,P]=s.useState("idle"),[D,T]=s.useState(""),[R,m]=s.useState(""),[v,G]=s.useState(0),A=s.useMemo(()=>be(t??"checkbox",i),[t,i,F]),B=s.useCallback(()=>{P("idle"),T(""),m(""),G(0),I(y=>y+1)},[]),M=s.useCallback(()=>{B(),o==null||o()},[B,o]);s.useImperativeHandle(a,()=>({reset:B,refresh:M,container:$.current}),[B,M]),s.useEffect(()=>{t==="text"&&A.kind==="text"&&je(N.current,A.text,b==="dark")},[t,A,b]),s.useEffect(()=>{if(_!=="verified"||!c)return;const y=setTimeout(()=>{C==null||C(),B()},c);return()=>clearTimeout(y)},[_,c,C,B]);const E=s.useCallback(()=>{const y=`ntd-cap:${t}:${xe()}`;l?(P("verifying"),T(""),Promise.resolve().then(()=>l(y)).then(Q=>{Q?(P("verified"),g==null||g(y)):(P("error"),T(n("captcha.verificationFailedPleaseTryAgain","Verification failed. Please try again.")),I(ae=>ae+1),m(""))}).catch(Q=>{P("error"),T(n("captcha.verificationErrorPleaseTryAgain","Verification error. Please try again.")),w==null||w(Q)})):(P("verified"),g==null||g(y))},[t,l,g,w,n]),U=s.useCallback(()=>{P("error"),T(n("captcha.incorrectPleaseTryAgain","Incorrect, please try again.")),I(y=>y+1),m("")},[n]),ee=s.useCallback(()=>{_==="verifying"||_==="verified"||(P("verifying"),T(""),S.current=setTimeout(E,fe))},[_,E]);s.useEffect(()=>()=>clearTimeout(S.current),[]);const z=s.useCallback(()=>{A.kind==="math"?R.trim()!==""&&Number(R)===A.answer?E():U():A.kind==="text"&&(R.trim().toUpperCase()===A.text?E():U())},[A,R,E,U]),te=s.useCallback(y=>{G(y),!(A.kind!=="slider"||_==="verified"||_==="verifying")&&Math.abs(y-A.target)<=A.tolerance&&E()},[A,_,E]);if(!t)return k==="custom"&&p?e.jsx("div",{ref:$,className:`nice-captcha nice-captcha--custom${x?` ${x}`:""}`,style:j,children:p}):e.jsx("div",{ref:$,className:`nice-captcha nice-captcha--${k} nice-captcha--${b}${h==="compact"?" nice-captcha--compact":""}${x?` ${x}`:""}`,style:j,"data-sitekey":f,"data-theme":b,"data-size":h,children:e.jsxs("div",{className:"nice-captcha__placeholder",children:[e.jsx("span",{children:n("captcha.captcha","Captcha ({provider})").replace("{provider}",String(k))}),e.jsx("p",{children:n("captcha.loadTheSdkToActivate","Load the {provider} SDK to activate verification.").replace("{provider}",String(k))})]})});const V=_==="verifying",q=_==="verified",se=`nice-captcha nice-captcha--${t} nice-captcha--${b} nice-captcha--${_}${h==="compact"?" nice-captcha--compact":""}${x?` ${x}`:""}`;return e.jsxs("div",{ref:$,className:se,style:j,role:"group","aria-label":n("captcha.captchaChallenge","Captcha challenge"),"data-variant":t,"data-status":_,"data-theme":b,children:[t==="checkbox"&&e.jsxs("button",{type:"button",className:"nice-captcha__checkbox",role:"checkbox","aria-checked":q,"aria-busy":V,disabled:V||q,onClick:ee,children:[e.jsx("span",{className:"nice-captcha__box","aria-hidden":"true",children:V?"…":q?e.jsx("span",{style:{display:"inline-block",width:"0.3em",height:"0.6em",marginBottom:"0.15em",borderRight:"0.12em solid currentColor",borderBottom:"0.12em solid currentColor",transform:"rotate(45deg)"}}):""}),e.jsx("span",{className:"nice-captcha__label",children:u})]}),t==="math"&&A.kind==="math"&&e.jsxs("div",{className:"nice-captcha__challenge",children:[e.jsxs("span",{className:"nice-captcha__prompt","aria-hidden":"true",children:[A.prompt," ="]}),e.jsx("input",{className:"nice-input nice-captcha__answer",type:"number",inputMode:"numeric",value:R,"aria-label":n("captcha.whatIs","What is {prompt}?").replace("{prompt}",String(A.prompt)),disabled:V||q,onChange:y=>m(y.target.value),onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),z())}}),e.jsx("button",{type:"button",className:"nice-btn nice-btn--primary nice-captcha__verify",disabled:V||q||R.trim()==="",onClick:z,children:V?"…":n("captcha.verify","Verify")})]}),t==="text"&&A.kind==="text"&&e.jsxs("div",{className:"nice-captcha__challenge",children:[e.jsx("canvas",{ref:N,className:"nice-captcha__canvas",width:160,height:56,"aria-hidden":"true"}),e.jsx("input",{className:"nice-input nice-captcha__answer",type:"text",autoCapitalize:"characters",autoComplete:"off",value:R,"aria-label":n("captcha.typeTheCharactersShownIn","Type the characters shown in the image"),disabled:V||q,onChange:y=>m(y.target.value),onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),z())}}),e.jsx("button",{type:"button",className:"nice-btn nice-btn--primary nice-captcha__verify",disabled:V||q||R.trim()==="",onClick:z,children:V?"…":n("captcha.verify","Verify")})]}),t==="slider"&&A.kind==="slider"&&e.jsxs("div",{className:"nice-captcha__challenge nice-captcha__challenge--slider",children:[e.jsx("span",{className:"nice-captcha__slider-hint","aria-hidden":"true",children:q?n("captcha.verified","Verified"):n("captcha.slideToTheMarker","Slide to the marker")}),e.jsxs("div",{className:"nice-captcha__track",children:[e.jsx("span",{className:"nice-captcha__target","aria-hidden":"true",style:{left:`${A.target}%`}}),e.jsx("input",{className:"nice-captcha__slider",type:"range",min:0,max:100,value:v,"aria-label":n("captcha.slideTheHandleToThe","Slide the handle to the marker to verify"),"aria-valuetext":`${v}%`,disabled:q||V,onChange:y=>te(Number(y.target.value))})]})]}),e.jsxs("div",{className:"nice-captcha__footer",children:[e.jsx("div",{className:"nice-captcha__message",role:"status","aria-live":"polite",children:D}),d&&e.jsx("button",{type:"button",className:"nice-captcha__refresh","aria-label":n("captcha.refreshChallenge","Refresh challenge"),title:n("captcha.refreshChallenge","Refresh challenge"),onClick:M,children:e.jsx(L.NiceIcon,{name:"refresh",size:16})})]})]})}),{displayName:"NiceCaptcha"}),we=[{id:"google",label:"Google",color:"#4285f4",textColor:"#fff"},{id:"microsoft",label:"Microsoft",color:"#00a4ef",textColor:"#fff"},{id:"discord",label:"Discord",color:"#5865f2",textColor:"#fff"},{id:"spotify",label:"Spotify",color:"#1db954",textColor:"#fff"},{id:"github",label:"GitHub",color:"#24292e",textColor:"#fff"}],Ne=Object.assign(s.forwardRef(({providers:r=we,onProviderClick:a,disabled:n=!1,loadingProvider:t,direction:i="vertical",separatorText:d,showSeparator:l=!0,className:c,style:u},k)=>{const{t:f}=L.useNiceTranslation();return e.jsxs("div",{ref:k,className:`nice-oauth nice-oauth--${i}${c?` ${c}`:""}`,style:u,children:[l&&e.jsxs("div",{className:"nice-oauth__separator",children:[e.jsx("hr",{}),e.jsx("span",{children:d??f("oAuthButtons.orContinueWith","or continue with")}),e.jsx("hr",{})]}),e.jsx("div",{className:"nice-oauth__buttons",children:r.map(g=>e.jsxs("button",{type:"button",className:`nice-oauth__btn${t===g.id?" nice-oauth__btn--loading":""}`,style:{backgroundColor:g.color,color:g.textColor},onClick:()=>a==null?void 0:a(g.id),disabled:n||!!t,children:[g.icon&&e.jsx("span",{className:"nice-oauth__btn-icon",children:g.icon}),e.jsx("span",{className:"nice-oauth__btn-label",children:t===g.id?"…":g.label})]},g.id))})]})}),{displayName:"NiceOAuthButtons"}),ve=s.forwardRef(function(a,n){const{t}=L.useNiceTranslation(),{tokens:i,onCreate:d,onRevoke:l,availableScopes:c=[],maxTokens:u=10,title:k=t("tokenManagement.apiTokens","API Tokens"),className:f,style:g}=a,[C,w]=s.useState(!1),[o,b]=s.useState(""),[h,p]=s.useState([]),[x,j]=s.useState("90"),[$,N]=s.useState(null),[S,F]=s.useState(!1),[I,_]=s.useState(null),P=s.useCallback(async()=>{if(!(!d||!o.trim())){F(!0);try{const m=x?parseInt(x,10):void 0,v=await d(o.trim(),h,m);N(v),b(""),p([]),w(!1)}finally{F(!1)}}},[d,o,h,x]),D=s.useCallback(async m=>{if(l){_(m);try{await l(m)}finally{_(null)}}},[l]),T=m=>{p(v=>v.includes(m)?v.filter(G=>G!==m):[...v,m])},R=i.length<u;return e.jsxs("div",{ref:n,className:`nice-token-management ${f??""}`,style:g,children:[e.jsxs("div",{className:"nice-token-management__header",children:[e.jsx("h3",{children:k}),R&&e.jsx("button",{className:"nice-token-management__new-btn",onClick:()=>w(!0),disabled:C,children:t("tokenManagement.newToken","+ New Token")})]}),$&&e.jsxs("div",{className:"nice-token-management__reveal",children:[e.jsxs("p",{children:[e.jsx("strong",{children:t("tokenManagement.newTokenCreated","New token created!")})," ",t("tokenManagement.copyItNowItWont","Copy it now — it won't be shown again.")]}),e.jsx("code",{className:"nice-token-management__token-value",children:$}),e.jsx("button",{onClick:()=>N(null),children:t("tokenManagement.dismiss","Dismiss")})]}),C&&e.jsxs("div",{className:"nice-token-management__create-form",children:[e.jsxs("label",{children:[t("tokenManagement.name","Name"),e.jsx("input",{type:"text",value:o,onChange:m=>b(m.target.value),placeholder:t("tokenManagement.myApiToken","My API token"),maxLength:64})]}),c.length>0&&e.jsxs("fieldset",{children:[e.jsx("legend",{children:t("tokenManagement.scopes","Scopes")}),c.map(m=>e.jsxs("label",{className:"nice-token-management__scope",children:[e.jsx("input",{type:"checkbox",checked:h.includes(m),onChange:()=>T(m)}),m]},m))]}),e.jsxs("label",{children:[t("tokenManagement.expiresInDays","Expires in (days)"),e.jsx("input",{type:"number",value:x,onChange:m=>j(m.target.value),min:1,max:365})]}),e.jsxs("div",{className:"nice-token-management__create-actions",children:[e.jsx("button",{onClick:P,disabled:S||!o.trim(),children:S?t("tokenManagement.creating","Creating…"):t("tokenManagement.createToken","Create Token")}),e.jsx("button",{onClick:()=>w(!1),children:t("tokenManagement.cancel","Cancel")})]})]}),i.length===0?e.jsx("p",{className:"nice-token-management__empty",children:t("tokenManagement.noApiTokensYet","No API tokens yet.")}):e.jsxs("table",{className:"nice-token-management__table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:t("tokenManagement.name","Name")}),e.jsx("th",{children:t("tokenManagement.prefix","Prefix")}),e.jsx("th",{children:t("tokenManagement.created","Created")}),e.jsx("th",{children:t("tokenManagement.expires","Expires")}),e.jsx("th",{children:t("tokenManagement.lastUsed","Last Used")}),e.jsx("th",{children:t("tokenManagement.scopes","Scopes")}),e.jsx("th",{})]})}),e.jsx("tbody",{children:i.map(m=>{var v;return e.jsxs("tr",{children:[e.jsx("td",{children:m.name}),e.jsx("td",{children:e.jsxs("code",{children:[m.prefix,"…"]})}),e.jsx("td",{children:m.createdAt}),e.jsx("td",{children:m.expiresAt??"—"}),e.jsx("td",{children:m.lastUsedAt??t("tokenManagement.never","Never")}),e.jsx("td",{children:((v=m.scopes)==null?void 0:v.join(", "))||"—"}),e.jsx("td",{children:e.jsx("button",{className:"nice-token-management__revoke-btn",onClick:()=>D(m.id),disabled:I===m.id,children:I===m.id?t("tokenManagement.revoking","Revoking…"):t("tokenManagement.revoke","Revoke")})})]},m.id)})})]})]})});exports.NiceCaptcha=_e;exports.NiceChangePassword=pe;exports.NiceLoginForm=re;exports.NiceOAuthButtons=Ne;exports.NicePasswordGenerator=me;exports.NicePasswordStrength=W;exports.NiceRegistrationForm=oe;exports.NiceTokenManagement=ve;exports.NiceTwoFaSetup=ge;exports.calcPasswordStrength=H;exports.generatePassword=J;exports.useAuth=ne;
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useState as _, useCallback as M, forwardRef as
|
|
1
|
+
import { useState as _, useCallback as M, forwardRef as q, useMemo as se, useRef as Q, useEffect as Z, useImperativeHandle as me } from "react";
|
|
2
2
|
import { jsxs as r, jsx as e, Fragment as ce } from "react/jsx-runtime";
|
|
3
|
-
import { useNiceTranslation as
|
|
3
|
+
import { useNiceTranslation as G, NiceIcon as ie } from "@nice2dev/ui-core";
|
|
4
4
|
function Se(s = {}) {
|
|
5
5
|
const { onLogin: a, onRefresh: n, onLogout: t, storageKey: i = "nice_auth", persistAuth: d = !1 } = s, [l, c] = _(() => {
|
|
6
6
|
if (d && typeof window < "u")
|
|
@@ -82,7 +82,7 @@ function Se(s = {}) {
|
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
const Te = /* @__PURE__ */ Object.assign(
|
|
85
|
-
/* @__PURE__ */
|
|
85
|
+
/* @__PURE__ */ q(
|
|
86
86
|
({
|
|
87
87
|
onSubmit: s,
|
|
88
88
|
loading: a = !1,
|
|
@@ -103,7 +103,7 @@ const Te = /* @__PURE__ */ Object.assign(
|
|
|
103
103
|
tracelessPolicy: m,
|
|
104
104
|
privacyMessage: p
|
|
105
105
|
}, b) => {
|
|
106
|
-
const { t: N } =
|
|
106
|
+
const { t: N } = G(), [I, k] = _(""), [T, $] = _(""), [O, v] = _(!1), E = se(() => !(!t || m && !m.cookiesAllowed), [t, m]), L = M(
|
|
107
107
|
(A) => {
|
|
108
108
|
A.preventDefault();
|
|
109
109
|
const D = (m == null ? void 0 : m.cookiesAllowed) === !1 ? !1 : O;
|
|
@@ -121,7 +121,7 @@ const Te = /* @__PURE__ */ Object.assign(
|
|
|
121
121
|
noValidate: !0,
|
|
122
122
|
children: [
|
|
123
123
|
f && /* @__PURE__ */ e("div", { className: "nice-login-form__logo", children: f }),
|
|
124
|
-
/* @__PURE__ */ e("h2", { className: "nice-login-form__title", children: h ?? N("loginForm.title", "Sign In") }),
|
|
124
|
+
h !== "" && /* @__PURE__ */ e("h2", { className: "nice-login-form__title", children: h ?? N("loginForm.title", "Sign In") }),
|
|
125
125
|
n && /* @__PURE__ */ e("div", { className: "nice-login-form__error", role: "alert", children: n }),
|
|
126
126
|
/* @__PURE__ */ r("div", { className: "nice-login-form__field", children: [
|
|
127
127
|
/* @__PURE__ */ e("label", { htmlFor: "nice-login-email", children: o ?? N("loginForm.email", "Email") }),
|
|
@@ -223,9 +223,9 @@ function ee(s) {
|
|
|
223
223
|
return s.length >= 8 && a++, s.length >= 12 && a++, /[a-z]/.test(s) && /[A-Z]/.test(s) && a++, /\d/.test(s) && a++, /[^a-zA-Z0-9]/.test(s) && a++, Math.min(4, a);
|
|
224
224
|
}
|
|
225
225
|
const te = /* @__PURE__ */ Object.assign(
|
|
226
|
-
/* @__PURE__ */
|
|
226
|
+
/* @__PURE__ */ q(
|
|
227
227
|
({ password: s, strength: a, showLabel: n = !0, labels: t, className: i }, d) => {
|
|
228
|
-
const { t: l } =
|
|
228
|
+
const { t: l } = G(), c = a ?? ee(s), h = pe[c], x = (c + 1) / 5 * 100;
|
|
229
229
|
return /* @__PURE__ */ r("div", { ref: d, className: `nice-password-strength${i ? ` ${i}` : ""}`, children: [
|
|
230
230
|
/* @__PURE__ */ e("div", { className: "nice-password-strength__bar", children: /* @__PURE__ */ e(
|
|
231
231
|
"div",
|
|
@@ -240,7 +240,7 @@ const te = /* @__PURE__ */ Object.assign(
|
|
|
240
240
|
),
|
|
241
241
|
{ displayName: "NicePasswordStrength" }
|
|
242
242
|
), Ae = /* @__PURE__ */ Object.assign(
|
|
243
|
-
/* @__PURE__ */
|
|
243
|
+
/* @__PURE__ */ q(
|
|
244
244
|
({
|
|
245
245
|
onSubmit: s,
|
|
246
246
|
loading: a = !1,
|
|
@@ -256,7 +256,7 @@ const te = /* @__PURE__ */ Object.assign(
|
|
|
256
256
|
className: g,
|
|
257
257
|
style: S
|
|
258
258
|
}, y) => {
|
|
259
|
-
const { t: o } =
|
|
259
|
+
const { t: o } = G(), [w, m] = _(""), [p, b] = _(""), [N, I] = _(""), [k, T] = _(""), [$, O] = _(""), [v, E] = _(!1), L = ee(k), A = k === $, D = w && N && k && A && v && L >= d && !a, u = M(
|
|
260
260
|
(C) => {
|
|
261
261
|
C.preventDefault(), D && (s == null || s({ firstName: w, lastName: p, email: N, password: k, acceptTerms: v }));
|
|
262
262
|
},
|
|
@@ -418,21 +418,6 @@ const te = /* @__PURE__ */ Object.assign(
|
|
|
418
418
|
...s
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
|
-
), ie = ({ style: s }) => /* @__PURE__ */ e(
|
|
422
|
-
"span",
|
|
423
|
-
{
|
|
424
|
-
"aria-hidden": "true",
|
|
425
|
-
style: {
|
|
426
|
-
display: "inline-block",
|
|
427
|
-
width: "0.85em",
|
|
428
|
-
height: "0.85em",
|
|
429
|
-
borderRadius: "50%",
|
|
430
|
-
border: "0.12em solid currentColor",
|
|
431
|
-
borderTopColor: "transparent",
|
|
432
|
-
transform: "rotate(-45deg)",
|
|
433
|
-
...s
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
421
|
), ae = {
|
|
437
422
|
lowercase: "abcdefghijklmnopqrstuvwxyz",
|
|
438
423
|
uppercase: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
|
@@ -503,7 +488,7 @@ const Me = ({
|
|
|
503
488
|
style: o,
|
|
504
489
|
id: w
|
|
505
490
|
}) => {
|
|
506
|
-
const { t: m } =
|
|
491
|
+
const { t: m } = G(), p = {
|
|
507
492
|
...Object.fromEntries(
|
|
508
493
|
Object.keys(ne).map((R) => [
|
|
509
494
|
R,
|
|
@@ -527,8 +512,8 @@ const Me = ({
|
|
|
527
512
|
(R) => D(re(R)),
|
|
528
513
|
[D]
|
|
529
514
|
), C = (R, j) => {
|
|
530
|
-
const
|
|
531
|
-
t || k(
|
|
515
|
+
const K = { ...T, [R]: j };
|
|
516
|
+
t || k(K), d == null || d(K), u(K);
|
|
532
517
|
}, H = async () => {
|
|
533
518
|
!v || !navigator.clipboard || (await navigator.clipboard.writeText(v), L(!0), clearTimeout(A.current), A.current = setTimeout(() => L(!1), 1500), f == null || f(v));
|
|
534
519
|
}, P = !T.lowercase && !T.uppercase && !T.digits && !T.symbols, U = Math.min(c, Math.max(l, T.length));
|
|
@@ -562,7 +547,7 @@ const Me = ({
|
|
|
562
547
|
disabled: S || P,
|
|
563
548
|
"aria-label": p.generate,
|
|
564
549
|
title: p.generate,
|
|
565
|
-
children: /* @__PURE__ */ e(ie, {})
|
|
550
|
+
children: /* @__PURE__ */ e(ie, { name: "refresh", size: 16 })
|
|
566
551
|
}
|
|
567
552
|
),
|
|
568
553
|
x && /* @__PURE__ */ e(
|
|
@@ -617,7 +602,7 @@ const Me = ({
|
|
|
617
602
|
}
|
|
618
603
|
);
|
|
619
604
|
}, $e = /* @__PURE__ */ Object.assign(
|
|
620
|
-
/* @__PURE__ */
|
|
605
|
+
/* @__PURE__ */ q(
|
|
621
606
|
({
|
|
622
607
|
requireCurrentPassword: s = !0,
|
|
623
608
|
onSubmit: a,
|
|
@@ -629,7 +614,7 @@ const Me = ({
|
|
|
629
614
|
className: c,
|
|
630
615
|
style: h
|
|
631
616
|
}, x) => {
|
|
632
|
-
const { t: f } =
|
|
617
|
+
const { t: f } = G(), [g, S] = _(""), [y, o] = _(""), [w, m] = _(""), p = ee(y), b = y === w, N = (!s || g.length > 0) && y.length > 0 && b && p >= d && !n, I = M(
|
|
633
618
|
(k) => {
|
|
634
619
|
k.preventDefault(), N && (a == null || a({
|
|
635
620
|
currentPassword: s ? g : void 0,
|
|
@@ -708,7 +693,7 @@ const Me = ({
|
|
|
708
693
|
),
|
|
709
694
|
{ displayName: "NiceChangePassword" }
|
|
710
695
|
), Pe = /* @__PURE__ */ Object.assign(
|
|
711
|
-
/* @__PURE__ */
|
|
696
|
+
/* @__PURE__ */ q(
|
|
712
697
|
({
|
|
713
698
|
secret: s,
|
|
714
699
|
qrCodeUrl: a,
|
|
@@ -724,7 +709,7 @@ const Me = ({
|
|
|
724
709
|
className: g,
|
|
725
710
|
style: S
|
|
726
711
|
}, y) => {
|
|
727
|
-
const { t: o } =
|
|
712
|
+
const { t: o } = G(), [w, m] = _(""), [p, b] = _(!1), [N, I] = _(!1), k = M(
|
|
728
713
|
($) => {
|
|
729
714
|
$.preventDefault(), w.length >= 6 && (i == null || i(w));
|
|
730
715
|
},
|
|
@@ -878,8 +863,8 @@ function ye(s, a, n) {
|
|
|
878
863
|
}
|
|
879
864
|
}
|
|
880
865
|
const Re = /* @__PURE__ */ Object.assign(
|
|
881
|
-
/* @__PURE__ */
|
|
882
|
-
const { t: n } =
|
|
866
|
+
/* @__PURE__ */ q((s, a) => {
|
|
867
|
+
const { t: n } = G(), {
|
|
883
868
|
variant: t,
|
|
884
869
|
difficulty: i = "medium",
|
|
885
870
|
refreshable: d = !0,
|
|
@@ -930,15 +915,15 @@ const Re = /* @__PURE__ */ Object.assign(
|
|
|
930
915
|
n("captcha.verificationErrorPleaseTryAgain", "Verification error. Please try again.")
|
|
931
916
|
), y == null || y(Y);
|
|
932
917
|
})) : (E("verified"), g == null || g(F));
|
|
933
|
-
}, [t, l, g, y, n]),
|
|
918
|
+
}, [t, l, g, y, n]), K = M(() => {
|
|
934
919
|
E("error"), A(n("captcha.incorrectPleaseTryAgain", "Incorrect, please try again.")), O((F) => F + 1), u("");
|
|
935
920
|
}, [n]), oe = M(() => {
|
|
936
921
|
v === "verifying" || v === "verified" || (E("verifying"), A(""), T.current = setTimeout(j, we));
|
|
937
922
|
}, [v, j]);
|
|
938
923
|
Z(() => () => clearTimeout(T.current), []);
|
|
939
924
|
const W = M(() => {
|
|
940
|
-
P.kind === "math" ? D.trim() !== "" && Number(D) === P.answer ? j() :
|
|
941
|
-
}, [P, D, j,
|
|
925
|
+
P.kind === "math" ? D.trim() !== "" && Number(D) === P.answer ? j() : K() : P.kind === "text" && (D.trim().toUpperCase() === P.text ? j() : K());
|
|
926
|
+
}, [P, D, j, K]), le = M(
|
|
942
927
|
(F) => {
|
|
943
928
|
H(F), !(P.kind !== "slider" || v === "verified" || v === "verifying") && Math.abs(F - P.target) <= P.tolerance && j();
|
|
944
929
|
},
|
|
@@ -971,7 +956,7 @@ const Re = /* @__PURE__ */ Object.assign(
|
|
|
971
956
|
] })
|
|
972
957
|
}
|
|
973
958
|
);
|
|
974
|
-
const B = v === "verifying",
|
|
959
|
+
const B = v === "verifying", z = v === "verified", de = `nice-captcha nice-captcha--${t} nice-captcha--${w} nice-captcha--${v}${m === "compact" ? " nice-captcha--compact" : ""}${b ? ` ${b}` : ""}`;
|
|
975
960
|
return /* @__PURE__ */ r(
|
|
976
961
|
"div",
|
|
977
962
|
{
|
|
@@ -990,12 +975,12 @@ const Re = /* @__PURE__ */ Object.assign(
|
|
|
990
975
|
type: "button",
|
|
991
976
|
className: "nice-captcha__checkbox",
|
|
992
977
|
role: "checkbox",
|
|
993
|
-
"aria-checked":
|
|
978
|
+
"aria-checked": z,
|
|
994
979
|
"aria-busy": B,
|
|
995
|
-
disabled: B ||
|
|
980
|
+
disabled: B || z,
|
|
996
981
|
onClick: oe,
|
|
997
982
|
children: [
|
|
998
|
-
/* @__PURE__ */ e("span", { className: "nice-captcha__box", "aria-hidden": "true", children: B ? "…" :
|
|
983
|
+
/* @__PURE__ */ e("span", { className: "nice-captcha__box", "aria-hidden": "true", children: B ? "…" : z ? /* @__PURE__ */ e(
|
|
999
984
|
"span",
|
|
1000
985
|
{
|
|
1001
986
|
style: {
|
|
@@ -1029,7 +1014,7 @@ const Re = /* @__PURE__ */ Object.assign(
|
|
|
1029
1014
|
"{prompt}",
|
|
1030
1015
|
String(P.prompt)
|
|
1031
1016
|
),
|
|
1032
|
-
disabled: B ||
|
|
1017
|
+
disabled: B || z,
|
|
1033
1018
|
onChange: (F) => u(F.target.value),
|
|
1034
1019
|
onKeyDown: (F) => {
|
|
1035
1020
|
F.key === "Enter" && (F.preventDefault(), W());
|
|
@@ -1041,7 +1026,7 @@ const Re = /* @__PURE__ */ Object.assign(
|
|
|
1041
1026
|
{
|
|
1042
1027
|
type: "button",
|
|
1043
1028
|
className: "nice-btn nice-btn--primary nice-captcha__verify",
|
|
1044
|
-
disabled: B ||
|
|
1029
|
+
disabled: B || z || D.trim() === "",
|
|
1045
1030
|
onClick: W,
|
|
1046
1031
|
children: B ? "…" : n("captcha.verify", "Verify")
|
|
1047
1032
|
}
|
|
@@ -1070,7 +1055,7 @@ const Re = /* @__PURE__ */ Object.assign(
|
|
|
1070
1055
|
"captcha.typeTheCharactersShownIn",
|
|
1071
1056
|
"Type the characters shown in the image"
|
|
1072
1057
|
),
|
|
1073
|
-
disabled: B ||
|
|
1058
|
+
disabled: B || z,
|
|
1074
1059
|
onChange: (F) => u(F.target.value),
|
|
1075
1060
|
onKeyDown: (F) => {
|
|
1076
1061
|
F.key === "Enter" && (F.preventDefault(), W());
|
|
@@ -1082,14 +1067,14 @@ const Re = /* @__PURE__ */ Object.assign(
|
|
|
1082
1067
|
{
|
|
1083
1068
|
type: "button",
|
|
1084
1069
|
className: "nice-btn nice-btn--primary nice-captcha__verify",
|
|
1085
|
-
disabled: B ||
|
|
1070
|
+
disabled: B || z || D.trim() === "",
|
|
1086
1071
|
onClick: W,
|
|
1087
1072
|
children: B ? "…" : n("captcha.verify", "Verify")
|
|
1088
1073
|
}
|
|
1089
1074
|
)
|
|
1090
1075
|
] }),
|
|
1091
1076
|
t === "slider" && P.kind === "slider" && /* @__PURE__ */ r("div", { className: "nice-captcha__challenge nice-captcha__challenge--slider", children: [
|
|
1092
|
-
/* @__PURE__ */ e("span", { className: "nice-captcha__slider-hint", "aria-hidden": "true", children:
|
|
1077
|
+
/* @__PURE__ */ e("span", { className: "nice-captcha__slider-hint", "aria-hidden": "true", children: z ? n("captcha.verified", "Verified") : n("captcha.slideToTheMarker", "Slide to the marker") }),
|
|
1093
1078
|
/* @__PURE__ */ r("div", { className: "nice-captcha__track", children: [
|
|
1094
1079
|
/* @__PURE__ */ e(
|
|
1095
1080
|
"span",
|
|
@@ -1112,7 +1097,7 @@ const Re = /* @__PURE__ */ Object.assign(
|
|
|
1112
1097
|
"Slide the handle to the marker to verify"
|
|
1113
1098
|
),
|
|
1114
1099
|
"aria-valuetext": `${C}%`,
|
|
1115
|
-
disabled:
|
|
1100
|
+
disabled: z || B,
|
|
1116
1101
|
onChange: (F) => le(Number(F.target.value))
|
|
1117
1102
|
}
|
|
1118
1103
|
)
|
|
@@ -1128,7 +1113,7 @@ const Re = /* @__PURE__ */ Object.assign(
|
|
|
1128
1113
|
"aria-label": n("captcha.refreshChallenge", "Refresh challenge"),
|
|
1129
1114
|
title: n("captcha.refreshChallenge", "Refresh challenge"),
|
|
1130
1115
|
onClick: R,
|
|
1131
|
-
children: /* @__PURE__ */ e(ie, {})
|
|
1116
|
+
children: /* @__PURE__ */ e(ie, { name: "refresh", size: 16 })
|
|
1132
1117
|
}
|
|
1133
1118
|
)
|
|
1134
1119
|
] })
|
|
@@ -1144,7 +1129,7 @@ const Re = /* @__PURE__ */ Object.assign(
|
|
|
1144
1129
|
{ id: "spotify", label: "Spotify", color: "#1db954", textColor: "#fff" },
|
|
1145
1130
|
{ id: "github", label: "GitHub", color: "#24292e", textColor: "#fff" }
|
|
1146
1131
|
], Ie = /* @__PURE__ */ Object.assign(
|
|
1147
|
-
/* @__PURE__ */
|
|
1132
|
+
/* @__PURE__ */ q(
|
|
1148
1133
|
({
|
|
1149
1134
|
providers: s = ke,
|
|
1150
1135
|
onProviderClick: a,
|
|
@@ -1156,7 +1141,7 @@ const Re = /* @__PURE__ */ Object.assign(
|
|
|
1156
1141
|
className: c,
|
|
1157
1142
|
style: h
|
|
1158
1143
|
}, x) => {
|
|
1159
|
-
const { t: f } =
|
|
1144
|
+
const { t: f } = G();
|
|
1160
1145
|
return /* @__PURE__ */ r(
|
|
1161
1146
|
"div",
|
|
1162
1147
|
{
|
|
@@ -1190,8 +1175,8 @@ const Re = /* @__PURE__ */ Object.assign(
|
|
|
1190
1175
|
}
|
|
1191
1176
|
),
|
|
1192
1177
|
{ displayName: "NiceOAuthButtons" }
|
|
1193
|
-
), De = /* @__PURE__ */
|
|
1194
|
-
const { t } =
|
|
1178
|
+
), De = /* @__PURE__ */ q(function(a, n) {
|
|
1179
|
+
const { t } = G(), {
|
|
1195
1180
|
tokens: i,
|
|
1196
1181
|
onCreate: d,
|
|
1197
1182
|
onRevoke: l,
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:is(.nice-login-form,.nice-register-form,.nice-change-password,.nice-2fa-setup,.nice-token-management) :where(h2,h3){margin:0;font-weight:var(--nice-font-weight-semibold, 600)}:is(.nice-login-form,.nice-register-form,.nice-change-password,.nice-2fa-setup,.nice-token-management) :where(input:not([type=checkbox],[type=radio]),select){box-sizing:border-box;width:100%;min-width:0;padding:var(--nice-space-2, 8px) var(--nice-space-2-5, 10px);border:1px solid var(--nice-border-color, #e2e8f0);border-radius:var(--nice-radius-md, 6px);background:var(--nice-bg-primary, #fff);color:var(--nice-text-primary, inherit);font:inherit}:is(.nice-login-form,.nice-register-form,.nice-change-password,.nice-2fa-setup,.nice-token-management) :where(button:not(.nice-btn)){display:inline-flex;align-items:center;justify-content:center;gap:var(--nice-space-1-5, 6px);padding:var(--nice-space-1-5, 6px) var(--nice-space-3, 12px);border:1px solid var(--nice-border-color, #e2e8f0);border-radius:var(--nice-radius-md, 6px);background:var(--nice-bg-primary, #fff);color:var(--nice-text-primary, inherit);font:inherit;white-space:nowrap;cursor:pointer}:is(.nice-login-form,.nice-register-form,.nice-change-password,.nice-2fa-setup,.nice-token-management) :where(button:not(.nice-btn):hover:not(:disabled)){background:var(--nice-bg-secondary, #f8fafc)}:is(.nice-login-form,.nice-register-form,.nice-change-password,.nice-2fa-setup,.nice-token-management) :where(button:disabled){opacity:.5;cursor:not-allowed}:is(.nice-login-form,.nice-register-form,.nice-change-password,.nice-2fa-setup,.nice-token-management) :where(button,input,select):focus-visible{outline:none;box-shadow:var(--nice-focus-ring, 0 0 0 2px var(--nice-color-primary, #3b82f6))}.nice-login-form__forgot,.nice-login-form__register button,.nice-register-form__login button,.nice-2fa-setup__secret button,.nice-2fa-setup__cancel{padding:0;border:0;background:transparent;color:var(--nice-color-primary, #3b82f6);font:inherit;cursor:pointer}.nice-login-form__forgot:hover:not(:disabled),.nice-login-form__register button:hover:not(:disabled),.nice-register-form__login button:hover:not(:disabled),.nice-2fa-setup__secret button:hover:not(:disabled),.nice-2fa-setup__cancel:hover:not(:disabled){background:transparent;text-decoration:underline}.nice-login-form__error,.nice-register-form__error,.nice-change-password__error,.nice-2fa-setup__error{padding:var(--nice-space-2, 8px) var(--nice-space-3, 12px);border-radius:var(--nice-radius-md, 6px);background:color-mix(in srgb,var(--nice-color-danger, #ef4444) 12%,transparent);color:var(--nice-color-danger, #dc2626);font-size:var(--nice-font-size-sm, .8125rem)}.nice-change-password__success{padding:var(--nice-space-2, 8px) var(--nice-space-3, 12px);border-radius:var(--nice-radius-md, 6px);background:color-mix(in srgb,var(--nice-color-success, #22c55e) 12%,transparent);color:var(--nice-color-success, #16a34a);font-size:var(--nice-font-size-sm, .8125rem)}.nice-login-form{display:flex;flex-direction:column;gap:var(--nice-space-3, 12px);width:100%;max-width:400px;color:var(--nice-text-primary, inherit);font-size:var(--nice-font-size-sm, .8125rem)}.nice-login-form__logo{display:flex;justify-content:center}.nice-login-form__title{font-size:var(--nice-font-size-xxl, 1.25rem);text-align:center}.nice-login-form__field{display:flex;flex-direction:column;gap:var(--nice-space-1, 4px)}.nice-login-form__field>label{color:var(--nice-text-secondary, #64748b);font-weight:var(--nice-font-weight-medium, 500)}.nice-login-form__options{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:var(--nice-space-2, 8px)}.nice-login-form__remember{display:inline-flex;align-items:center;gap:var(--nice-space-1-5, 6px);cursor:pointer}.nice-login-form__privacy-notice{color:var(--nice-text-muted, #94a3b8);font-size:var(--nice-font-size-xs, .75rem)}.nice-login-form__submit{width:100%;justify-content:center}.nice-login-form__register{color:var(--nice-text-secondary, #64748b);text-align:center}.nice-login-form__footer{color:var(--nice-text-muted, #94a3b8);font-size:var(--nice-font-size-xs, .75rem);text-align:center}.nice-password-strength{display:flex;flex-direction:column;gap:var(--nice-space-1, 4px)}.nice-password-strength__bar{height:6px;overflow:hidden;border-radius:var(--nice-radius-full, 9999px);background:var(--nice-bg-secondary, #f1f5f9)}.nice-password-strength__fill{height:100%;border-radius:inherit;transition:width .2s ease,background-color .2s ease}.nice-password-strength__label{font-size:var(--nice-font-size-sm, .8125rem);font-weight:var(--nice-font-weight-medium, 500)}.nice-register-form{display:flex;flex-direction:column;gap:var(--nice-space-3, 12px);width:100%;max-width:440px;color:var(--nice-text-primary, inherit);font-size:var(--nice-font-size-sm, .8125rem)}.nice-register-form__logo{display:flex;justify-content:center}.nice-register-form__title{font-size:var(--nice-font-size-xxl, 1.25rem);text-align:center}.nice-register-form__row{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:var(--nice-space-3, 12px)}.nice-register-form__field{display:flex;flex-direction:column;gap:var(--nice-space-1, 4px);min-width:0}.nice-register-form__field>label{color:var(--nice-text-secondary, #64748b);font-weight:var(--nice-font-weight-medium, 500)}.nice-register-form__terms{display:inline-flex;align-items:flex-start;gap:var(--nice-space-1-5, 6px);cursor:pointer}.nice-register-form__terms input{margin-top:var(--nice-space-0-5, 2px)}.nice-register-form__terms a{color:var(--nice-color-primary, #3b82f6)}.nice-register-form__submit{width:100%;justify-content:center}.nice-register-form__login{color:var(--nice-text-secondary, #64748b);text-align:center}.nice-register-form__footer{color:var(--nice-text-muted, #94a3b8);font-size:var(--nice-font-size-xs, .75rem);text-align:center}.nice-password-generator{display:flex;flex-direction:column;gap:var(--nice-space-3, 12px);max-width:420px;box-sizing:border-box;color:var(--nice-text-primary, #0f172a);font-size:var(--nice-font-size-md, .875rem)}.nice-password-generator__output{display:flex;gap:var(--nice-space-2, 8px)}.nice-password-generator__value{flex:1 1 auto;min-width:0;box-sizing:border-box;height:40px;padding:0 var(--nice-space-3, 12px);border:1px solid var(--nice-border-color, #cbd5e1);border-radius:var(--nice-radius-md, 6px);background:var(--nice-bg-secondary, #f1f5f9);color:var(--nice-text-primary, #0f172a);font-family:var(--nice-font-mono, ui-monospace, "SFMono-Regular", Consolas, monospace);font-size:var(--nice-font-size-lg, 1rem);letter-spacing:.04em}.nice-password-generator__value:focus-visible{outline:2px solid var(--nice-color-primary, #2563eb);outline-offset:1px}.nice-password-generator__button{display:inline-flex;align-items:center;justify-content:center;gap:var(--nice-space-1, 4px);min-width:40px;height:40px;padding:0 var(--nice-space-3, 12px);border:1px solid var(--nice-border-color, #cbd5e1);border-radius:var(--nice-radius-md, 6px);background:var(--nice-bg-primary, #ffffff);color:var(--nice-text-primary, #0f172a);font:inherit;cursor:pointer}.nice-password-generator__button:hover:not(:disabled){border-color:var(--nice-color-primary, #2563eb)}.nice-password-generator__button:focus-visible{outline:2px solid var(--nice-color-primary, #2563eb);outline-offset:1px}.nice-password-generator__button:disabled{opacity:.5;cursor:not-allowed}.nice-password-generator__button--copy{min-width:88px}.nice-password-generator__length{display:grid;grid-template-columns:auto 1fr 3ch;align-items:center;gap:var(--nice-space-3, 12px)}.nice-password-generator__length input[type=range]{width:100%;accent-color:var(--nice-color-primary, #2563eb)}.nice-password-generator__length-value{font-variant-numeric:tabular-nums;text-align:right}.nice-password-generator__sets{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:var(--nice-space-2, 8px) var(--nice-space-3, 12px)}.nice-password-generator__option{display:inline-flex;align-items:center;gap:var(--nice-space-2, 8px);cursor:pointer}.nice-password-generator__option input{accent-color:var(--nice-color-primary, #2563eb)}.nice-password-generator__error{margin:0;color:var(--nice-danger-text, #991b1b);font-size:var(--nice-font-size-sm, .8125rem)}.nice-change-password{display:flex;flex-direction:column;gap:var(--nice-space-3, 12px);width:100%;max-width:400px;color:var(--nice-text-primary, inherit);font-size:var(--nice-font-size-sm, .8125rem)}.nice-change-password__title{font-size:var(--nice-font-size-lg, 1rem)}.nice-change-password__field{display:flex;flex-direction:column;gap:var(--nice-space-1, 4px)}.nice-change-password__field>label{color:var(--nice-text-secondary, #64748b);font-weight:var(--nice-font-weight-medium, 500)}.nice-change-password>button[type=submit]{align-self:flex-start}.nice-2fa-setup{display:flex;flex-direction:column;gap:var(--nice-space-3, 12px);width:100%;max-width:440px;color:var(--nice-text-primary, inherit);font-size:var(--nice-font-size-sm, .8125rem)}.nice-2fa-setup__title{font-size:var(--nice-font-size-lg, 1rem)}.nice-2fa-setup__step{display:flex;flex-direction:column;align-items:flex-start;gap:var(--nice-space-3, 12px)}.nice-2fa-setup__instruction{margin:0;color:var(--nice-text-secondary, #64748b);line-height:var(--nice-line-height, 1.5)}.nice-2fa-setup__qr{width:180px;height:180px;padding:var(--nice-space-2, 8px);border:1px solid var(--nice-border-color, #e2e8f0);border-radius:var(--nice-radius-lg, 8px);background:var(--nice-bg-primary, #fff)}.nice-2fa-setup__qr-placeholder{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--nice-space-2, 8px);width:180px;min-height:180px;padding:var(--nice-space-3, 12px);border:1px dashed var(--nice-border-strong, #cbd5e1);border-radius:var(--nice-radius-lg, 8px);color:var(--nice-text-muted, #94a3b8);text-align:center}.nice-2fa-setup__uri,.nice-2fa-setup__secret-key,.nice-2fa-setup__recovery-code{font-family:var(--nice-font-mono, ui-monospace, monospace);font-size:var(--nice-font-size-xs, .75rem);overflow-wrap:anywhere}.nice-2fa-setup__secret{display:flex;flex-wrap:wrap;align-items:center;gap:var(--nice-space-1-5, 6px)}.nice-2fa-setup__secret-key{padding:var(--nice-space-0-5, 2px) var(--nice-space-1-5, 6px);border-radius:var(--nice-radius-sm, 4px);background:var(--nice-bg-secondary, #f1f5f9);letter-spacing:.08em}.nice-2fa-setup__code-input{max-width:180px;font-family:var(--nice-font-mono, ui-monospace, monospace);font-size:var(--nice-font-size-xl, 1.125rem);letter-spacing:.4em;text-align:center}.nice-2fa-setup__actions{display:flex;gap:var(--nice-space-2, 8px)}.nice-2fa-setup__recovery-codes{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--nice-space-1-5, 6px);width:100%;padding:var(--nice-space-3, 12px);border-radius:var(--nice-radius-lg, 8px);background:var(--nice-bg-secondary, #f8fafc)}.nice-2fa-setup__recovery-code{text-align:center}.nice-2fa-setup__cancel{align-self:flex-start}.nice-captcha{--nice-captcha-bg: var(--nice-bg-elevated, var(--nice-bg-primary, #ffffff));--nice-captcha-fg: var(--nice-text-primary, #111827);--nice-captcha-muted: var(--nice-text-secondary, #6b7280);--nice-captcha-border: var(--nice-border-color, #d1d5db);--nice-captcha-accent: var(--nice-color-primary, #2563eb);--nice-captcha-ok: var(--nice-color-success, #16a34a);--nice-captcha-err: var(--nice-color-danger, #dc2626);--nice-captcha-radius: var(--nice-radius-md, 8px);display:inline-flex;flex-direction:column;gap:10px;box-sizing:border-box;min-width:260px;padding:14px;font-family:var(--nice-font-family, inherit);font-size:14px;color:var(--nice-captcha-fg);background:var(--nice-captcha-bg);border:1px solid var(--nice-captcha-border);border-radius:var(--nice-captcha-radius)}.nice-captcha--dark{--nice-captcha-bg: var(--nice-bg-elevated, #1a1a1a);--nice-captcha-fg: var(--nice-text-primary, #e5e7eb);--nice-captcha-muted: var(--nice-text-secondary, #9ca3af);--nice-captcha-border: var(--nice-border-color, #2a2a2a)}.nice-captcha--compact{min-width:0;padding:8px 10px;font-size:13px}.nice-captcha__placeholder{display:flex;flex-direction:column;gap:4px;align-items:center;justify-content:center;padding:18px;text-align:center;color:var(--nice-captcha-muted);border:1px dashed var(--nice-captcha-border);border-radius:var(--nice-captcha-radius)}.nice-captcha__placeholder span{font-weight:600;color:var(--nice-captcha-fg)}.nice-captcha__placeholder p{margin:0;font-size:12px}.nice-captcha__checkbox{display:flex;align-items:center;gap:10px;padding:8px 10px;font:inherit;color:inherit;text-align:left;cursor:pointer;background:transparent;border:1px solid var(--nice-captcha-border);border-radius:var(--nice-captcha-radius)}.nice-captcha__checkbox:disabled{cursor:default}.nice-captcha__box{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;font-size:14px;line-height:1;background:var(--nice-bg-primary, #ffffff);border:2px solid var(--nice-captcha-border);border-radius:4px}.nice-captcha--dark .nice-captcha__box{background:var(--nice-bg-primary, #0a0a0a)}.nice-captcha--verified .nice-captcha__box{color:#fff;background:var(--nice-captcha-ok);border-color:var(--nice-captcha-ok)}.nice-captcha__challenge{display:flex;flex-wrap:wrap;gap:8px;align-items:center}.nice-captcha__prompt{font-size:18px;font-weight:700;letter-spacing:.5px;-webkit-user-select:none;user-select:none}.nice-captcha__answer{flex:1 1 80px;min-width:70px}.nice-captcha__canvas{display:block;border:1px solid var(--nice-captcha-border);border-radius:4px}.nice-captcha__challenge--slider{flex-direction:column;align-items:stretch}.nice-captcha__slider-hint{font-size:12px;color:var(--nice-captcha-muted)}.nice-captcha__track{position:relative;display:flex;align-items:center}.nice-captcha__target{position:absolute;top:50%;width:2px;height:18px;background:var(--nice-captcha-accent);border-radius:1px;transform:translate(-1px,-50%);pointer-events:none}.nice-captcha__slider{width:100%;accent-color:var(--nice-captcha-accent)}.nice-captcha--verified .nice-captcha__slider{accent-color:var(--nice-captcha-ok)}.nice-captcha__footer{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:18px}.nice-captcha__message{flex:1;font-size:12px;color:var(--nice-captcha-muted)}.nice-captcha--error .nice-captcha__message{color:var(--nice-captcha-err)}.nice-captcha--verified .nice-captcha__message{color:var(--nice-captcha-ok)}.nice-captcha__refresh{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;font-size:16px;line-height:1;color:var(--nice-captcha-muted);cursor:pointer;background:transparent;border:1px solid var(--nice-captcha-border);border-radius:var(--nice-captcha-radius)}.nice-captcha__refresh:hover{color:var(--nice-captcha-fg);border-color:var(--nice-captcha-accent)}.nice-oauth{display:flex;flex-direction:column;gap:var(--nice-space-3, 12px);width:100%;color:var(--nice-text-primary, inherit);font-size:var(--nice-font-size-sm, .8125rem)}.nice-oauth__separator{display:flex;align-items:center;gap:var(--nice-space-3, 12px);color:var(--nice-text-muted, #94a3b8);font-size:var(--nice-font-size-xs, .75rem);white-space:nowrap}.nice-oauth__separator>hr{flex:1 1 auto;margin:0;border:0;border-top:1px solid var(--nice-border-color, #e2e8f0)}.nice-oauth__buttons{display:flex;flex-direction:column;gap:var(--nice-space-2, 8px)}.nice-oauth--horizontal .nice-oauth__buttons{flex-flow:row wrap}.nice-oauth--horizontal .nice-oauth__btn{flex:1 1 140px}.nice-oauth__btn{display:inline-flex;align-items:center;justify-content:center;gap:var(--nice-space-2, 8px);padding:var(--nice-space-2, 8px) var(--nice-space-3, 12px);border:1px solid var(--nice-border-color, #e2e8f0);border-radius:var(--nice-radius-md, 6px);background:var(--nice-bg-primary, #fff);color:var(--nice-text-primary, inherit);font:inherit;font-weight:var(--nice-font-weight-medium, 500);cursor:pointer;transition:filter var(--nice-transition-fast, .12s ease)}.nice-oauth__btn:hover:not(:disabled){filter:brightness(.96)}.nice-oauth__btn:focus-visible{outline:none;box-shadow:var(--nice-focus-ring, 0 0 0 2px var(--nice-color-primary, #3b82f6))}.nice-oauth__btn:disabled{opacity:.6;cursor:not-allowed}.nice-oauth__btn--loading{cursor:progress}.nice-oauth__btn-icon{display:inline-flex;flex-shrink:0}.nice-token-management{display:flex;flex-direction:column;gap:var(--nice-space-3, 12px);min-width:0;overflow-x:auto;color:var(--nice-text-primary, inherit);font-size:var(--nice-font-size-sm, .8125rem)}.nice-token-management__header{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:var(--nice-space-2, 8px)}.nice-token-management__header>h3{font-size:var(--nice-font-size-lg, 1rem)}.nice-token-management__new-btn{border-color:var(--nice-color-primary, #3b82f6);background:var(--nice-color-primary, #3b82f6);color:var(--nice-text-on-primary, #fff);font-weight:var(--nice-font-weight-medium, 500)}.nice-token-management__new-btn:hover:not(:disabled){background:var(--nice-color-primary, #3b82f6);filter:brightness(1.08)}.nice-token-management__reveal{display:flex;flex-direction:column;align-items:flex-start;gap:var(--nice-space-2, 8px);padding:var(--nice-space-3, 12px);border:1px solid color-mix(in srgb,var(--nice-color-warning, #f59e0b) 45%,transparent);border-radius:var(--nice-radius-lg, 8px);background:color-mix(in srgb,var(--nice-color-warning, #f59e0b) 10%,transparent)}.nice-token-management__reveal>p{margin:0}.nice-token-management__token-value{box-sizing:border-box;width:100%;padding:var(--nice-space-2, 8px) var(--nice-space-2-5, 10px);border-radius:var(--nice-radius-md, 6px);background:var(--nice-bg-primary, #fff);font-family:var(--nice-font-mono, ui-monospace, monospace);font-size:var(--nice-font-size-xs, .75rem);overflow-wrap:anywhere;-webkit-user-select:all;user-select:all}.nice-token-management__create-form{display:flex;flex-direction:column;gap:var(--nice-space-3, 12px);padding:var(--nice-space-3, 12px);border-radius:var(--nice-radius-lg, 8px);background:var(--nice-bg-secondary, #f8fafc)}.nice-token-management__create-form>label{display:flex;flex-direction:column;gap:var(--nice-space-1, 4px);max-width:320px;color:var(--nice-text-secondary, #64748b);font-weight:var(--nice-font-weight-medium, 500)}.nice-token-management__create-form>fieldset{display:flex;flex-wrap:wrap;gap:var(--nice-space-2, 8px) var(--nice-space-4, 16px);margin:0;padding:var(--nice-space-2, 8px) var(--nice-space-3, 12px);border:1px solid var(--nice-border-color, #e2e8f0);border-radius:var(--nice-radius-md, 6px)}.nice-token-management__create-form>fieldset>legend{padding:0 var(--nice-space-1, 4px);color:var(--nice-text-secondary, #64748b);font-weight:var(--nice-font-weight-medium, 500)}.nice-token-management__scope{display:inline-flex;align-items:center;gap:var(--nice-space-1-5, 6px);font-family:var(--nice-font-mono, ui-monospace, monospace);font-size:var(--nice-font-size-xs, .75rem);cursor:pointer}.nice-token-management__create-actions{display:flex;gap:var(--nice-space-2, 8px)}.nice-token-management__empty{margin:0;padding:var(--nice-space-6, 24px);color:var(--nice-text-muted, #94a3b8);text-align:center}.nice-token-management__table{width:100%;border-collapse:collapse}.nice-token-management__table th,.nice-token-management__table td{padding:var(--nice-space-2, 8px) var(--nice-space-2-5, 10px);border-bottom:1px solid var(--nice-border-color, #e2e8f0);text-align:left;vertical-align:middle}.nice-token-management__table th{color:var(--nice-text-secondary, #64748b);font-size:var(--nice-font-size-xs, .75rem);font-weight:var(--nice-font-weight-semibold, 600);white-space:nowrap}.nice-token-management__table code{font-family:var(--nice-font-mono, ui-monospace, monospace);font-size:var(--nice-font-size-xs, .75rem)}.nice-token-management__revoke-btn{color:var(--nice-color-danger, #dc2626)}.nice-token-management__revoke-btn:hover:not(:disabled){border-color:color-mix(in srgb,var(--nice-color-danger, #ef4444) 50%,transparent);background:color-mix(in srgb,var(--nice-color-danger, #ef4444) 10%,transparent)}
|
|
1
|
+
:is(.nice-login-form,.nice-register-form,.nice-change-password,.nice-2fa-setup,.nice-token-management) :where(h2,h3){margin:0;font-weight:var(--nice-font-weight-semibold, 600)}:is(.nice-login-form,.nice-register-form,.nice-change-password,.nice-2fa-setup,.nice-token-management) :where(input:not([type=checkbox],[type=radio]),select){box-sizing:border-box;width:100%;min-width:0;padding:var(--nice-space-2, 8px) var(--nice-space-2-5, 10px);border:1px solid var(--nice-border-color, #e2e8f0);border-radius:var(--nice-radius-md, 6px);background:var(--nice-bg-primary, #fff);color:var(--nice-text-primary, inherit);font:inherit}:is(.nice-login-form,.nice-register-form,.nice-change-password,.nice-2fa-setup,.nice-token-management) :where(button:not(.nice-btn)){display:inline-flex;align-items:center;justify-content:center;gap:var(--nice-space-1-5, 6px);padding:var(--nice-space-1-5, 6px) var(--nice-space-3, 12px);border:1px solid var(--nice-border-color, #e2e8f0);border-radius:var(--nice-radius-md, 6px);background:var(--nice-bg-primary, #fff);color:var(--nice-text-primary, inherit);font:inherit;white-space:nowrap;cursor:pointer}:is(.nice-login-form,.nice-register-form,.nice-change-password,.nice-2fa-setup,.nice-token-management) :where(button:not(.nice-btn):hover:not(:disabled)){background:var(--nice-bg-secondary, #f8fafc)}:is(.nice-login-form,.nice-register-form,.nice-change-password,.nice-2fa-setup,.nice-token-management) :where(button:disabled){opacity:.5;cursor:not-allowed}:is(.nice-login-form,.nice-register-form,.nice-change-password,.nice-2fa-setup,.nice-token-management) :where(button,input,select):focus-visible{outline:none;box-shadow:var(--nice-focus-ring, 0 0 0 2px var(--nice-color-primary, #3b82f6))}.nice-login-form__forgot,.nice-login-form__register button,.nice-register-form__login button,.nice-2fa-setup__secret button,.nice-2fa-setup__cancel{padding:0;border:0;background:transparent;color:var(--nice-color-primary, #3b82f6);font:inherit;cursor:pointer}.nice-login-form__forgot:hover:not(:disabled),.nice-login-form__register button:hover:not(:disabled),.nice-register-form__login button:hover:not(:disabled),.nice-2fa-setup__secret button:hover:not(:disabled),.nice-2fa-setup__cancel:hover:not(:disabled){background:transparent;text-decoration:underline}.nice-login-form__error,.nice-register-form__error,.nice-change-password__error,.nice-2fa-setup__error{padding:var(--nice-space-2, 8px) var(--nice-space-3, 12px);border-radius:var(--nice-radius-md, 6px);background:color-mix(in srgb,var(--nice-color-danger, #ef4444) 12%,transparent);color:var(--nice-color-danger, #dc2626);font-size:var(--nice-font-size-sm, .8125rem)}.nice-change-password__success{padding:var(--nice-space-2, 8px) var(--nice-space-3, 12px);border-radius:var(--nice-radius-md, 6px);background:color-mix(in srgb,var(--nice-color-success, #22c55e) 12%,transparent);color:var(--nice-color-success, #16a34a);font-size:var(--nice-font-size-sm, .8125rem)}.nice-login-form{display:flex;flex-direction:column;gap:var(--nice-space-3, 12px);width:100%;max-width:400px;color:var(--nice-text-primary, inherit);font-size:var(--nice-font-size-sm, .8125rem)}.nice-login-form__logo{display:flex;justify-content:center}.nice-login-form__title{font-size:var(--nice-font-size-xxl, 1.25rem);text-align:center}.nice-login-form__field{display:flex;flex-direction:column;gap:var(--nice-space-1, 4px)}.nice-login-form__field>label{color:var(--nice-text-secondary, #64748b);font-weight:var(--nice-font-weight-medium, 500)}.nice-login-form__options{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:var(--nice-space-2, 8px)}.nice-login-form__remember{display:inline-flex;align-items:center;gap:var(--nice-space-1-5, 6px);cursor:pointer}.nice-login-form__privacy-notice{color:var(--nice-text-muted, #94a3b8);font-size:var(--nice-font-size-xs, .75rem)}.nice-login-form__submit{width:100%;justify-content:center}.nice-login-form__register{color:var(--nice-text-secondary, #64748b);text-align:center}.nice-login-form__footer{color:var(--nice-text-muted, #94a3b8);font-size:var(--nice-font-size-xs, .75rem);text-align:center}.nice-password-strength{display:flex;flex-direction:column;gap:var(--nice-space-1, 4px)}.nice-password-strength__bar{height:6px;overflow:hidden;border-radius:var(--nice-radius-full, 9999px);background:var(--nice-bg-secondary, #f1f5f9)}.nice-password-strength__fill{height:100%;border-radius:inherit;transition:width .2s ease,background-color .2s ease}.nice-password-strength__label{font-size:var(--nice-font-size-sm, .8125rem);font-weight:var(--nice-font-weight-medium, 500)}.nice-register-form{display:flex;flex-direction:column;gap:var(--nice-space-3, 12px);width:100%;max-width:440px;color:var(--nice-text-primary, inherit);font-size:var(--nice-font-size-sm, .8125rem)}.nice-register-form__logo{display:flex;justify-content:center}.nice-register-form__title{font-size:var(--nice-font-size-xxl, 1.25rem);text-align:center}.nice-register-form__row{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:var(--nice-space-3, 12px)}.nice-register-form__field{display:flex;flex-direction:column;gap:var(--nice-space-1, 4px);min-width:0}.nice-register-form__field>label{color:var(--nice-text-secondary, #64748b);font-weight:var(--nice-font-weight-medium, 500)}.nice-register-form__terms{display:inline-flex;align-items:flex-start;gap:var(--nice-space-1-5, 6px);cursor:pointer}.nice-register-form__terms input{margin-top:var(--nice-space-0-5, 2px)}.nice-register-form__terms a{color:var(--nice-color-primary, #3b82f6)}.nice-register-form__submit{width:100%;justify-content:center}.nice-register-form__login{color:var(--nice-text-secondary, #64748b);text-align:center}.nice-register-form__footer{color:var(--nice-text-muted, #94a3b8);font-size:var(--nice-font-size-xs, .75rem);text-align:center}.nice-password-generator{display:flex;flex-direction:column;gap:var(--nice-space-3, 12px);max-width:420px;box-sizing:border-box;color:var(--nice-text-primary, #0f172a);font-size:var(--nice-font-size-md, .875rem)}.nice-password-generator__output{display:flex;gap:var(--nice-space-2, 8px)}.nice-password-generator__value{flex:1 1 auto;min-width:0;box-sizing:border-box;height:40px;padding:0 var(--nice-space-3, 12px);border:1px solid var(--nice-border-color, #cbd5e1);border-radius:var(--nice-radius-md, 6px);background:var(--nice-bg-secondary, #f1f5f9);color:var(--nice-text-primary, #0f172a);font-family:var(--nice-font-mono, ui-monospace, "SFMono-Regular", Consolas, monospace);font-size:var(--nice-font-size-lg, 1rem);letter-spacing:.04em}.nice-password-generator__value:focus-visible{outline:2px solid var(--nice-color-primary, #2563eb);outline-offset:1px}.nice-password-generator__button{display:inline-flex;align-items:center;justify-content:center;gap:var(--nice-space-1, 4px);min-width:40px;height:40px;padding:0 var(--nice-space-3, 12px);border:1px solid var(--nice-border-color, #cbd5e1);border-radius:var(--nice-radius-md, 6px);background:var(--nice-bg-primary, #ffffff);color:var(--nice-text-primary, #0f172a);font:inherit;cursor:pointer}.nice-password-generator__button:hover:not(:disabled){border-color:var(--nice-color-primary, #2563eb)}.nice-password-generator__button:focus-visible{outline:2px solid var(--nice-color-primary, #2563eb);outline-offset:1px}.nice-password-generator__button:disabled{opacity:.5;cursor:not-allowed}.nice-password-generator__button--copy{min-width:88px}.nice-password-generator__length{display:grid;grid-template-columns:auto 1fr 3ch;align-items:center;gap:var(--nice-space-3, 12px)}.nice-password-generator__length input[type=range]{width:100%;accent-color:var(--nice-color-primary, #2563eb)}.nice-password-generator__length-value{font-variant-numeric:tabular-nums;text-align:right}.nice-password-generator__sets{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:var(--nice-space-2, 8px) var(--nice-space-3, 12px)}.nice-password-generator__option{display:inline-flex;align-items:center;gap:var(--nice-space-2, 8px);cursor:pointer}.nice-password-generator__option input{accent-color:var(--nice-color-primary, #2563eb)}.nice-password-generator__error{margin:0;color:var(--nice-danger-text, #991b1b);font-size:var(--nice-font-size-sm, .8125rem)}.nice-change-password{display:flex;flex-direction:column;gap:var(--nice-space-3, 12px);width:100%;max-width:400px;color:var(--nice-text-primary, inherit);font-size:var(--nice-font-size-sm, .8125rem)}.nice-change-password__title{font-size:var(--nice-font-size-lg, 1rem)}.nice-change-password__field{display:flex;flex-direction:column;gap:var(--nice-space-1, 4px)}.nice-change-password__field>label{color:var(--nice-text-secondary, #64748b);font-weight:var(--nice-font-weight-medium, 500)}.nice-change-password>button[type=submit]{align-self:flex-start}.nice-2fa-setup{display:flex;flex-direction:column;gap:var(--nice-space-3, 12px);width:100%;max-width:440px;color:var(--nice-text-primary, inherit);font-size:var(--nice-font-size-sm, .8125rem)}.nice-2fa-setup__title{font-size:var(--nice-font-size-lg, 1rem)}.nice-2fa-setup__step{display:flex;flex-direction:column;align-items:flex-start;gap:var(--nice-space-3, 12px)}.nice-2fa-setup__instruction{margin:0;color:var(--nice-text-secondary, #64748b);line-height:var(--nice-line-height, 1.5)}.nice-2fa-setup__qr{width:180px;height:180px;padding:var(--nice-space-2, 8px);border:1px solid var(--nice-border-color, #e2e8f0);border-radius:var(--nice-radius-lg, 8px);background:var(--nice-bg-primary, #fff)}.nice-2fa-setup__qr-placeholder{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--nice-space-2, 8px);width:180px;min-height:180px;padding:var(--nice-space-3, 12px);border:1px dashed var(--nice-border-strong, #cbd5e1);border-radius:var(--nice-radius-lg, 8px);color:var(--nice-text-muted, #94a3b8);text-align:center}.nice-2fa-setup__uri,.nice-2fa-setup__secret-key,.nice-2fa-setup__recovery-code{font-family:var(--nice-font-mono, ui-monospace, monospace);font-size:var(--nice-font-size-xs, .75rem);overflow-wrap:anywhere}.nice-2fa-setup__secret{display:flex;flex-wrap:wrap;align-items:center;gap:var(--nice-space-1-5, 6px)}.nice-2fa-setup__secret-key{padding:var(--nice-space-0-5, 2px) var(--nice-space-1-5, 6px);border-radius:var(--nice-radius-sm, 4px);background:var(--nice-bg-secondary, #f1f5f9);letter-spacing:.08em}.nice-2fa-setup__code-input{max-width:180px;font-family:var(--nice-font-mono, ui-monospace, monospace);font-size:var(--nice-font-size-xl, 1.125rem);letter-spacing:.4em;text-align:center}.nice-2fa-setup__actions{display:flex;gap:var(--nice-space-2, 8px)}.nice-2fa-setup__recovery-codes{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--nice-space-1-5, 6px);width:100%;padding:var(--nice-space-3, 12px);border-radius:var(--nice-radius-lg, 8px);background:var(--nice-bg-secondary, #f8fafc)}.nice-2fa-setup__recovery-code{text-align:center}.nice-2fa-setup__cancel{align-self:flex-start}.nice-captcha{--nice-captcha-bg: var(--nice-bg-elevated, var(--nice-bg-primary, #ffffff));--nice-captcha-fg: var(--nice-text-primary, #111827);--nice-captcha-muted: var(--nice-text-secondary, #6b7280);--nice-captcha-border: var(--nice-border-color, #d1d5db);--nice-captcha-accent: var(--nice-color-primary, #2563eb);--nice-captcha-ok: var(--nice-color-success, #16a34a);--nice-captcha-err: var(--nice-color-danger, #dc2626);--nice-captcha-radius: var(--nice-radius-md, 8px);display:inline-flex;flex-direction:column;gap:10px;box-sizing:border-box;min-width:260px;padding:14px;font-family:var(--nice-font-family, inherit);font-size:14px;color:var(--nice-captcha-fg);background:var(--nice-captcha-bg);border:1px solid var(--nice-captcha-border);border-radius:var(--nice-captcha-radius)}.nice-captcha--dark{--nice-captcha-bg: var(--nice-bg-elevated, #1a1a1a);--nice-captcha-fg: var(--nice-text-primary, #e5e7eb);--nice-captcha-muted: var(--nice-text-secondary, #9ca3af);--nice-captcha-border: var(--nice-border-color, #2a2a2a)}.nice-captcha--compact{min-width:0;padding:8px 10px;font-size:13px}.nice-captcha__placeholder{display:flex;flex-direction:column;gap:4px;align-items:center;justify-content:center;padding:18px;text-align:center;color:var(--nice-captcha-muted);border:1px dashed var(--nice-captcha-border);border-radius:var(--nice-captcha-radius)}.nice-captcha__placeholder span{font-weight:600;color:var(--nice-captcha-fg)}.nice-captcha__placeholder p{margin:0;font-size:12px}.nice-captcha__checkbox{display:flex;align-items:center;gap:10px;padding:8px 10px;font:inherit;color:inherit;text-align:left;cursor:pointer;background:transparent;border:1px solid var(--nice-captcha-border);border-radius:var(--nice-captcha-radius)}.nice-captcha__checkbox:disabled{cursor:default}.nice-captcha__box{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;font-size:14px;line-height:1;background:var(--nice-bg-primary, #ffffff);border:2px solid var(--nice-captcha-border);border-radius:4px}.nice-captcha--dark .nice-captcha__box{background:var(--nice-bg-primary, #0a0a0a)}.nice-captcha--verified .nice-captcha__box{color:#fff;background:var(--nice-captcha-ok);border-color:var(--nice-captcha-ok)}.nice-captcha__challenge{display:flex;flex-wrap:wrap;gap:8px;align-items:center}.nice-captcha__prompt{font-size:18px;font-weight:700;letter-spacing:.5px;-webkit-user-select:none;user-select:none}.nice-captcha__answer{flex:1 1 80px;min-width:70px}.nice-captcha__canvas{display:block;border:1px solid var(--nice-captcha-border);border-radius:4px}.nice-captcha__challenge--slider{flex-direction:column;align-items:stretch}.nice-captcha__slider-hint{font-size:12px;color:var(--nice-captcha-muted)}.nice-captcha__track{position:relative;display:flex;align-items:center}.nice-captcha__target{position:absolute;top:50%;width:2px;height:18px;background:var(--nice-captcha-accent);border-radius:1px;transform:translate(-1px,-50%);pointer-events:none}.nice-captcha__slider{width:100%;accent-color:var(--nice-captcha-accent)}.nice-captcha--verified .nice-captcha__slider{accent-color:var(--nice-captcha-ok)}.nice-captcha__footer{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:18px}.nice-captcha__message{flex:1;font-size:12px;color:var(--nice-captcha-muted)}.nice-captcha--error .nice-captcha__message{color:var(--nice-captcha-err)}.nice-captcha--verified .nice-captcha__message{color:var(--nice-captcha-ok)}.nice-captcha__refresh{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;font-size:16px;line-height:1;color:var(--nice-captcha-muted);cursor:pointer;background:transparent;border:none;border-radius:var(--nice-captcha-radius)}.nice-captcha__refresh:hover{color:var(--nice-captcha-fg);background:color-mix(in srgb,var(--nice-captcha-fg) 8%,transparent)}.nice-captcha__refresh:focus-visible{outline:2px solid var(--nice-captcha-accent);outline-offset:1px}.nice-oauth{display:flex;flex-direction:column;gap:var(--nice-space-3, 12px);width:100%;color:var(--nice-text-primary, inherit);font-size:var(--nice-font-size-sm, .8125rem)}.nice-oauth__separator{display:flex;align-items:center;gap:var(--nice-space-3, 12px);color:var(--nice-text-muted, #94a3b8);font-size:var(--nice-font-size-xs, .75rem);white-space:nowrap}.nice-oauth__separator>hr{flex:1 1 auto;margin:0;border:0;border-top:1px solid var(--nice-border-color, #e2e8f0)}.nice-oauth__buttons{display:flex;flex-direction:column;gap:var(--nice-space-2, 8px)}.nice-oauth--horizontal .nice-oauth__buttons{flex-flow:row wrap}.nice-oauth--horizontal .nice-oauth__btn{flex:1 1 140px}.nice-oauth__btn{display:inline-flex;align-items:center;justify-content:center;gap:var(--nice-space-2, 8px);padding:var(--nice-space-2, 8px) var(--nice-space-3, 12px);border:1px solid var(--nice-border-color, #e2e8f0);border-radius:var(--nice-radius-md, 6px);background:var(--nice-bg-primary, #fff);color:var(--nice-text-primary, inherit);font:inherit;font-weight:var(--nice-font-weight-medium, 500);cursor:pointer;transition:filter var(--nice-transition-fast, .12s ease)}.nice-oauth__btn:hover:not(:disabled){filter:brightness(.96)}.nice-oauth__btn:focus-visible{outline:none;box-shadow:var(--nice-focus-ring, 0 0 0 2px var(--nice-color-primary, #3b82f6))}.nice-oauth__btn:disabled{opacity:.6;cursor:not-allowed}.nice-oauth__btn--loading{cursor:progress}.nice-oauth__btn-icon{display:inline-flex;flex-shrink:0}.nice-token-management{display:flex;flex-direction:column;gap:var(--nice-space-3, 12px);min-width:0;overflow-x:auto;color:var(--nice-text-primary, inherit);font-size:var(--nice-font-size-sm, .8125rem)}.nice-token-management__header{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:var(--nice-space-2, 8px)}.nice-token-management__header>h3{font-size:var(--nice-font-size-lg, 1rem)}.nice-token-management__new-btn{border-color:var(--nice-color-primary, #3b82f6);background:var(--nice-color-primary, #3b82f6);color:var(--nice-text-on-primary, #fff);font-weight:var(--nice-font-weight-medium, 500)}.nice-token-management__new-btn:hover:not(:disabled){background:var(--nice-color-primary, #3b82f6);filter:brightness(1.08)}.nice-token-management__reveal{display:flex;flex-direction:column;align-items:flex-start;gap:var(--nice-space-2, 8px);padding:var(--nice-space-3, 12px);border:1px solid color-mix(in srgb,var(--nice-color-warning, #f59e0b) 45%,transparent);border-radius:var(--nice-radius-lg, 8px);background:color-mix(in srgb,var(--nice-color-warning, #f59e0b) 10%,transparent)}.nice-token-management__reveal>p{margin:0}.nice-token-management__token-value{box-sizing:border-box;width:100%;padding:var(--nice-space-2, 8px) var(--nice-space-2-5, 10px);border-radius:var(--nice-radius-md, 6px);background:var(--nice-bg-primary, #fff);font-family:var(--nice-font-mono, ui-monospace, monospace);font-size:var(--nice-font-size-xs, .75rem);overflow-wrap:anywhere;-webkit-user-select:all;user-select:all}.nice-token-management__create-form{display:flex;flex-direction:column;gap:var(--nice-space-3, 12px);padding:var(--nice-space-3, 12px);border-radius:var(--nice-radius-lg, 8px);background:var(--nice-bg-secondary, #f8fafc)}.nice-token-management__create-form>label{display:flex;flex-direction:column;gap:var(--nice-space-1, 4px);max-width:320px;color:var(--nice-text-secondary, #64748b);font-weight:var(--nice-font-weight-medium, 500)}.nice-token-management__create-form>fieldset{display:flex;flex-wrap:wrap;gap:var(--nice-space-2, 8px) var(--nice-space-4, 16px);margin:0;padding:var(--nice-space-2, 8px) var(--nice-space-3, 12px);border:1px solid var(--nice-border-color, #e2e8f0);border-radius:var(--nice-radius-md, 6px)}.nice-token-management__create-form>fieldset>legend{padding:0 var(--nice-space-1, 4px);color:var(--nice-text-secondary, #64748b);font-weight:var(--nice-font-weight-medium, 500)}.nice-token-management__scope{display:inline-flex;align-items:center;gap:var(--nice-space-1-5, 6px);font-family:var(--nice-font-mono, ui-monospace, monospace);font-size:var(--nice-font-size-xs, .75rem);cursor:pointer}.nice-token-management__create-actions{display:flex;gap:var(--nice-space-2, 8px)}.nice-token-management__empty{margin:0;padding:var(--nice-space-6, 24px);color:var(--nice-text-muted, #94a3b8);text-align:center}.nice-token-management__table{width:100%;border-collapse:collapse}.nice-token-management__table th,.nice-token-management__table td{padding:var(--nice-space-2, 8px) var(--nice-space-2-5, 10px);border-bottom:1px solid var(--nice-border-color, #e2e8f0);text-align:left;vertical-align:middle}.nice-token-management__table th{color:var(--nice-text-secondary, #64748b);font-size:var(--nice-font-size-xs, .75rem);font-weight:var(--nice-font-weight-semibold, 600);white-space:nowrap}.nice-token-management__table code{font-family:var(--nice-font-mono, ui-monospace, monospace);font-size:var(--nice-font-size-xs, .75rem)}.nice-token-management__revoke-btn{color:var(--nice-color-danger, #dc2626)}.nice-token-management__revoke-btn:hover:not(:disabled){border-color:color-mix(in srgb,var(--nice-color-danger, #ef4444) 50%,transparent);background:color-mix(in srgb,var(--nice-color-danger, #ef4444) 10%,transparent)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nice2dev/auth",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.22",
|
|
4
4
|
"description": "Nice2Dev Auth — Login, registration, OAuth, 2FA, captcha, password strength, token management for React",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"react-dom": ">=17.0.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@nice2dev/ui-core": "^1.4.
|
|
67
|
+
"@nice2dev/ui-core": "^1.4.22",
|
|
68
68
|
"@testing-library/jest-dom": "^7.0.1",
|
|
69
69
|
"@testing-library/react": "^16.3.3",
|
|
70
70
|
"@types/react": "^19.2.18",
|