PageSourceSearch

https://reatta.org/rs-confirm-dialog.component-WBJ3FEZG.js

js reatta.org collected 2026-10-08 09:05:13 UTC 10,130 bytes, 2 lines download raw bytes

1import{a as $}from"./chunk-MNQEOOER.js";import{x as F}from"./chunk-PDHRS2CT.js";import{$c as P,Ba as I,Db as C,Eb as l,Ec as s,Fc as c,Gc as B,Ia as d,Ja as p,Ka as T,La as V,Mc as h,Nc as b,Pd as w,Qc as S,Rc as u,Sc as r,Tb as L,Ud as k,Va as M,Ya as R,_c as z,ed as N,fd as x,gd as q,hd as y,rc as g,tc as _,vc as f}from"./chunk-YN3BWQS4.js";import"./chunk-R4PMCUPT.js";var Y=["cancelBtn"],G=["dialog"],O=["promptInput"];function J(a,n){if(a&1&&(s(0,"p",12),x(1),c()),a&2){let e=r(),t=r();b("id",t.bodyId),l(),q(e.body)}}function U(a,n){if(a&1&&(s(0,"label",16),x(1),c()),a&2){let e=r(2),t=r();g("for",t.inputId),l(),y(" ",e.input.label," ")}}function W(a,n){if(a&1){let e=h();s(0,"textarea",19,2),u("input",function(i){d(e);let o=r(3);return p(o.onInputChange(i))}),c()}if(a&2){let e=r(2),t=r();b("id",t.inputId)("placeholder",e.input.placeholder??"")("value",t.inputValue()),g("aria-label",e.input.label?null:e.input.placeholder||"Enter a value")}}function X(a,n){if(a&1){let e=h();s(0,"input",20,2),u("input",function(i){d(e);let o=r(3);return p(o.onInputChange(i))})("keydown.enter",function(i){d(e);let o=r(3);return p(o.onPromptEnter(i))}),c()}if(a&2){let e=r(2),t=r();b("id",t.inputId)("placeholder",e.input.placeholder??"")("value",t.inputValue()),g("aria-label",e.input.label?null:e.input.placeholder||"Enter a value")}}function Z(a,n){if(a&1&&(_(0,U,2,2,"label",16),_(1,W,2,4,"textarea",17)(2,X,2,4,"input",18)),a&2){let e=r();f(e.input.label?0:-1),l(),f(e.input.multiline?1:2)}}function ee(a,n){if(a&1){let e=h();s(0,"div",4),u("mousedown",function(i){d(e);let o=r();return p(o.onScrim(i))}),s(1,"div",5,0)(3,"div",6)(4,"h2",7),x(5),c(),s(6,"button",8),u("click",function(){d(e);let i=r();return p(i.resolve(!1))}),T(),s(7,"svg",9),B(8,"line",10)(9,"line",11),c()()(),_(10,J,2,2,"p",12),_(11,Z,3,2),V(),s(12,"div",13)(13,"button",14,1),u("click",function(){d(e);let i=r();return p(i.resolve(!1))}),x(15),c(),s(16,"button",15),u("click",function(){d(e);let i=r();return p(i.onConfirmClick())}),x(17),c()()()()}if(a&2){let e=n,t=r();g("aria-labelledby",t.titleId)("aria-describedby",t.bodyId),l(4),b("id",t.titleId),l(),y(" ",e.title," "),l(5),f(e.body?10:-1),l(),f(e.input?11:-1),l(4),y(" ",e.cancelLabel," "),l(),N(t.confirmBtnClass()),b("disabled",t.promptInvalid()),l(),y(" ",e.confirmLabel," ")}}var v=class v{constructor(){this.service=I($);this.state=this.service.state;this.titleId="rs-cd-title";this.bodyId="rs-cd-body";this.inputId="rs-cd-input";this.cancelBtn=k("cancelBtn");this.dialog=k("dialog");this.promptInput=k("promptInput");this.inputValue=M("");this.promptInvalid=w(()=>{let n=this.state();if(!n?.input)return!1;let e=n.input.matchText;return e!=null?this.inputValue().trim()!==e:n.input.required??!0?!this.inputValue().trim():!1});this.confirmBtnClass=w(()=>{let n=this.state(),e="rs-cd__btn";return n?n.destructive?`${e} rs-cd__btn--destructive`:`${e} rs-cd__btn--confirm`:e});this.previouslyFocused=null;R(()=>{let n=this.state();if(n)this.previouslyFocused=document.activeElement,this.inputValue.set(n.input?.initialValue??""),queueMicrotask(()=>{n.input?this.promptInput()?.nativeElement?.focus():this.cancelBtn()?.nativeElement?.focus()});else{let e=this.previouslyFocused;this.previouslyFocused=null,e&&typeof e.focus=="function"&&e.isConnected&&e.focus()}})}onInputChange(n){let e=n.target,t=e?.value??"";if(this.state()?.input?.format==="currency"&&e instanceof HTMLInputElement){let o=t.replace(/[^\d.]/g,""),m=o.indexOf(".");if(m!==-1){let K=o.slice(0,m),Q=o.slice(m+1).replace(/\./g,"").slice(0,2);o=`${K}.${Q}`}let[j="",H]=o.split("."),D=j.replace(/\B(?=(\d{3})+(?!\d))/g,","),E=H!==void 0?`${D}.${H}`:D;this.inputValue.set(E),e.value!==E&&(e.value=E);return}this.inputValue.set(t)}onPromptEnter(n){n.preventDefault(),!this.promptInvalid()&&this.onConfirmClick()}onConfirmClick(){let n=this.state();if(n?.input){let e=this.inputValue().trim();n.input.format==="currency"&&(e=e.replace(/,/g,"")),this.service.resolve(e)}else this.service.resolve(!0)}cancel(){this.state()?.input?this.service.resolve(null):this.service.resolve(!1)}onScrim(n){n.target===n.currentTarget&&this.cancel()}onEsc(){this.state()&&this.cancel()}onTab(n){let e=this.dialog()?.nativeElement;if(!e||!this.state())return;let t=Array.from(e.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), [tabindex]:not
1([tabindex="-1"])'));if(!t.length)return;let i=t[0],o=t[t.length-1],m=document.activeElement;n.shiftKey&&m===i?(n.preventDefault(),o.focus()):!n.shiftKey&&m===o&&(n.preventDefault(),i.focus())}resolve(n){this.service.resolve(n)}};v.\u0275fac=function(e){return new(e||v)},v.\u0275cmp=L({type:v,selectors:[["rs-confirm-dialog-host"]],viewQuery:function(e,t){e&1&&z(t.cancelBtn,Y,5)(t.dialog,G,5)(t.promptInput,O,5),e&2&&P(3)},hostBindings:function(e,t){e&1&&S("keydown.escape",function(){return t.onEsc()},C)("keydown.tab",function(o){return t.onTab(o)},C)("keydown.shift.tab",function(o){return t.onTab(o)},C)},decls:1,vars:1,consts:[["dialog",""],["cancelBtn",""],["promptInput",""],["role","dialog","aria-modal","true",1,"rs-cd__overlay"],["role","dialog","aria-modal","true",1,"rs-cd__overlay",3,"mousedown"],[1,"rs-cd__dialog"],[1,"rs-cd__head"],[1,"rs-cd__title",3,"id"],["type","button","aria-label","Close",1,"rs-cd__close",3,"click"],["width","16","height","16","viewBox","0 0 24 24","fill","none","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round","aria-hidden","true"],["x1","18","y1","6","x2","6","y2","18"],["x1","6","y1","6","x2","18","y2","18"],[1,"rs-cd__body",3,"id"],[1,"rs-cd__actions"],["type","button","data-testid","confirm-dialog-cancel",1,"rs-cd__btn","rs-cd__btn--cancel",3,"click"],["type","button","data-testid","confirm-dialog-confirm",3,"click","disabled"],[1,"rs-cd__input-label"],["rows","3","spellcheck","false","autocorrect","off","autocapitalize","off","autocomplete","off",1,"rs-cd__input","rs-cd__input--multiline",3,"id","placeholder","value"],["type","text","spellcheck","false","autocorrect","off","autocapitalize","off","autocomplete","off",1,"rs-cd__input",3,"id","placeholder","value"],["rows","3","spellcheck","false","autocorrect","off","autocapitalize","off","autocomplete","off",1,"rs-cd__input","rs-cd__input--multiline",3,"input","id","placeholder","value"],["type","text","spellcheck","false","autocorrect","off","autocapitalize","off","autocomplete","off",1,"rs-cd__input",3,"input","keydown.enter","id","placeholder","value"]],template:function(e,t){if(e&1&&_(0,ee,18,11,"div",3),e&2){let i;f((i=t.state())?0:-1,i)}},dependencies:[F],styles:[`.rs-cd__overlay{position:fixed;inset:0;z-index:9999;background:#0000008c;backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);display:grid;place-items:center;padding:24px;animation:rs-cd-overlay-in .14s ease-out both}@keyframes rs-cd-overlay-in{0%{opacity:0}to{opacity:1}}.rs-cd__dialog{width:min(420px,100%);background:var(--bg-elevated, var(--bg-raised, var(--bg-surface)));color:var(--text-primary);border:1px solid var(--border-default);border-radius:16px;box-shadow:0 24px 64px #0006,0 4px 12px #00000040;padding:22px 22px 18px;animation:rs-cd-dialog-in .18s cubic-bezier(.2,.8,.2,1) both}@keyframes rs-cd-dialog-in{0%{opacity:0;transform:scale(.96) translateY(4px)}to{opacity:1;transform:scale(1) translateY(0)}}.rs-cd__head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:8px}.rs-cd__title{font-size:17px;font-weight:700;letter-spacing:-.01em;line-height:1.3;color:var(--text-primary);margin:0}.rs-cd__close{-webkit-appearance:none;appearance:none;border:none;background:transparent;width:28px;height:28px;border-radius:8px;display:grid;place-items:center;color:var(--text-tertiary);cursor:pointer;transition:color .12s,background .12s;flex-shrink:0;margin:-4px -4px 0 0}.rs-cd__close:hover{color:var(--text-primary);background:var(--bg-hover)}.rs-cd__close:focus-visible{outline:none;box-shadow:0 0 0 3px var(--focus-ring)}.rs-cd__body{font-size:14.5px;line-height:1.5;color:var(--text-secondary);margin:0 0 18px}.rs-cd__input-label{display:block;font-size:12.5px;font-weight:600;color:var(--text-secondary);margin:0 0 6px}.rs-cd__input{display:block;width:100%;box-sizing:border-box;font:inherit;font-size:14px;color:var(--text-primary);background:var(--bg-input, var(--bg-surface));border:1px solid var(--border-default);border-radius:10px;padding:9px 12px;margin:0 0 20px;transition:border-color .12s,box-shadow .12s}.rs-cd__input--multiline{resize:vertical;min-height:64px;font-family:inherit}.rs-cd__input:focus{outline:none;border-color:var(--primary);box-shadow:0 0 0 3px color-mix(in oklab,var(--primary) 25%,transparent)}.rs-cd__actions{display:flex;justify-content:flex-end;
1gap:8px}.rs-cd__btn{-webkit-appearance:none;appearance:none;border:1px solid var(--border-default);background:transparent;color:var(--text-primary);font:inherit;font-size:13.5px;font-weight:600;padding:9px 16px;border-radius:10px;cursor:pointer;transition:background .12s,border-color .12s,color .12s,transform 80ms;min-width:84px}.rs-cd__btn:active{transform:translateY(1px)}.rs-cd__btn:focus-visible{outline:none;box-shadow:0 0 0 3px var(--focus-ring)}.rs-cd__btn--cancel:hover{background:var(--bg-hover);border-color:var(--border-strong)}.rs-cd__btn--confirm{background:var(--primary-fill);border-color:var(--primary-fill);color:var(--on-primary, #fff)}.rs-cd__btn--confirm:hover{background:color-mix(in oklab,var(--primary-fill) 86%,black);border-color:color-mix(in oklab,var(--primary-fill) 86%,black)}.rs-cd__btn--destructive{background:var(--danger, #dc2626);border-color:var(--danger, #dc2626);color:#fff}.rs-cd__btn--destructive:hover{background:color-mix(in oklab,var(--danger, #dc2626) 86%,black);border-color:color-mix(in oklab,var(--danger, #dc2626) 86%,black)}@media(max-width:480px){.rs-cd__overlay{padding:16px;align-items:flex-end}.rs-cd__dialog{width:100%;padding:18px 18px 14px;border-radius:16px 16px 12px 12px}.rs-cd__actions{flex-direction:column-reverse}.rs-cd__btn{width:100%;padding:12px 16px}}
2`],encapsulation:2,changeDetection:0});var A=v;export{A as RsConfirmDialogHostComponent};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.