@opengovsg/confetti 0.3.4 → 0.5.0

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.
@@ -0,0 +1,5 @@
1
+ import{A as e,B as t,D as n,E as r,F as i,G as a,H as o,I as s,J as c,K as l,L as u,M as d,N as f,O as p,P as m,R as h,T as g,U as _,V as ee,W as v,_ as te,b as ne,c as re,d as ie,g as ae,h as oe,it as se,j as ce,k as y,m as le,t as ue,u as de,w as fe,x as pe,z as me}from"./Button-giwEer5K.js";import{i as he,r as ge,t as _e}from"./internals-B5GhpjgM.js";import b,{createContext as x,forwardRef as S,useCallback as C,useContext as w,useEffect as T,useMemo as E,useReducer as ve,useRef as D,useState as O}from"react";import{useTimeout as ye}from"usehooks-ts";import{Fragment as be,jsx as k,jsxs as xe}from"react/jsx-runtime";import A from"clsx";import Se,{flushSync as Ce}from"react-dom";const we=x(null);x(null),x(null),x(null),x(null);const Te=x({});x(null);const Ee=x(null);var De=class{constructor(e,t,n,r){this._walkerStack=[],this._currentSetFor=new Set,this._acceptNode=e=>{if(e.nodeType===Node.ELEMENT_NODE){let t=e.shadowRoot;if(t){let e=this._doc.createTreeWalker(t,this.whatToShow,{acceptNode:this._acceptNode});return this._walkerStack.unshift(e),NodeFilter.FILTER_ACCEPT}else if(typeof this.filter==`function`)return this.filter(e);else if(this.filter?.acceptNode)return this.filter.acceptNode(e);else if(this.filter===null)return NodeFilter.FILTER_ACCEPT}return NodeFilter.FILTER_SKIP},this._doc=e,this.root=t,this.filter=r??null,this.whatToShow=n??NodeFilter.SHOW_ALL,this._currentNode=t,this._walkerStack.unshift(e.createTreeWalker(t,n,this._acceptNode));let i=t.shadowRoot;if(i){let e=this._doc.createTreeWalker(i,this.whatToShow,{acceptNode:this._acceptNode});this._walkerStack.unshift(e)}}get currentNode(){return this._currentNode}set currentNode(e){if(!d(this.root,e))throw Error(`Cannot set currentNode to a node that is not contained by the root node.`);let t=[],n=e,r=e;for(this._currentNode=e;n&&n!==this.root;)if(n.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let e=n,i=this._doc.createTreeWalker(e,this.whatToShow,{acceptNode:this._acceptNode});t.push(i),i.currentNode=r,this._currentSetFor.add(i),n=r=e.host}else n=n.parentNode;let i=this._doc.createTreeWalker(this.root,this.whatToShow,{acceptNode:this._acceptNode});t.push(i),i.currentNode=r,this._currentSetFor.add(i),this._walkerStack=t}get doc(){return this._doc}firstChild(){let e=this.currentNode,t=this.nextNode();return d(e,t)?(t&&(this.currentNode=t),t):(this.currentNode=e,null)}lastChild(){let e=this._walkerStack[0].lastChild();return e&&(this.currentNode=e),e}nextNode(){let e=this._walkerStack[0].nextNode();if(e){if(e.shadowRoot){let t;if(typeof this.filter==`function`?t=this.filter(e):this.filter?.acceptNode&&(t=this.filter.acceptNode(e)),t===NodeFilter.FILTER_ACCEPT)return this.currentNode=e,e;let n=this.nextNode();return n&&(this.currentNode=n),n}return e&&(this.currentNode=e),e}else if(this._walkerStack.length>1){this._walkerStack.shift();let e=this.nextNode();return e&&(this.currentNode=e),e}else return null}previousNode(){let e=this._walkerStack[0];if(e.currentNode===e.root){if(this._currentSetFor.has(e))if(this._currentSetFor.delete(e),this._walkerStack.length>1){this._walkerStack.shift();let e=this.previousNode();return e&&(this.currentNode=e),e}else return null;return null}let t=e.previousNode();if(t){if(t.shadowRoot){let e;if(typeof this.filter==`function`?e=this.filter(t):this.filter?.acceptNode&&(e=this.filter.acceptNode(t)),e===NodeFilter.FILTER_ACCEPT)return t&&(this.currentNode=t),t;let n=this.lastChild();return n&&(this.currentNode=n),n}return t&&(this.currentNode=t),t}else if(this._walkerStack.length>1){this._walkerStack.shift();let e=this.previousNode();return e&&(this.currentNode=e),e}else return null}nextSibling(){return null}previousSibling(){return null}parentNode(){return null}};function Oe(e,t,n,r){return s()?new De(e,t,n,r):e.createTreeWalker(t,n,r)}function ke(e,t){let{id:n,"aria-label":r,"aria-labelledby":i}=e;return n=ee(n),i&&r?i=[...new Set([n,...i.trim().split(/\s+/)])].join(` `):i&&=i.trim().split(/\s+/).join(` `),!r&&!i&&t&&(r=t),{id:n,"aria-label":r,"aria-labelledby":i}}function j(e,t){if(!e)return!1;let n=window.getComputedStyle(e),r=document.scrollingElement||document.documentElement,i=/(auto|scroll)/.test(n.overflow+n.overflowX+n.overflowY);return e===r&&n.overflow!==`hidden`&&(i=!0),i&&t&&(i=e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth),i}function Ae(e,t){let n=e;for(j(n,t)&&(n=n.parentElement);n&&!j(n,t);)n=n.parentElement;return n||document.scrollingElement||document.documentElement}const je=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function M(e){return e instanceof HTMLInputElement&&!je.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}let N=typeof document<`u`&&window.visualViewport;function Me(){let e=o(),[t,n]=O(()=>e?{width:0,height:0}:P());return T(()=>{let e=e=>{n(t=>e.width===t.width&&e.height===t.height?t:e)},t=()=>{N&&N.scale>1||e(P())},r,a=t=>{N&&N.scale>1||M(i(t))&&(r=requestAnimationFrame(()=>{let t=m();(!t||!M(t))&&e({width:document.documentElement.clientWidth,height:document.documentElement.clientHeight})}))};return e(P()),l()&&window.addEventListener(`blur`,a,!0),N?N.addEventListener(`resize`,t):window.addEventListener(`resize`,t),()=>{cancelAnimationFrame(r),l()&&window.removeEventListener(`blur`,a,!0),N?N.removeEventListener(`resize`,t):window.removeEventListener(`resize`,t)}},[]),t}function P(){return{width:N?Math.min(N.width*N.scale,document.documentElement.clientWidth):document.documentElement.clientWidth,height:N?N.height*N.scale:document.documentElement.clientHeight}}function Ne(e,t=!0){let[n,r]=O(!0),i=n&&t;return _(()=>{if(i&&e.current&&`getAnimations`in e.current)for(let t of e.current.getAnimations())t instanceof CSSTransition&&t.cancel()},[e,i]),Fe(e,i,C(()=>r(!1),[])),i}function Pe(e,t){let[n,r]=O(t?`open`:`closed`);switch(n){case`open`:t||r(`exiting`);break;case`closed`:case`exiting`:t&&r(`open`);break}let i=n===`exiting`;return Fe(e,i,C(()=>{r(e=>e===`exiting`?`closed`:e)},[])),i}function Fe(e,t,n){_(()=>{if(t&&e.current){if(!(`getAnimations`in e.current)){n();return}let t=e.current.getAnimations();if(t.length===0){n();return}let r=!1;return Promise.allSettled(t.map(e=>e.finished)).then(()=>{r||Ce(()=>{n()})}),()=>{r=!0}}},[e,t,n])}const Ie=typeof HTMLElement<`u`&&`inert`in HTMLElement.prototype;function Le(e){return e.dataset.liveAnnouncer===`true`||e.dataset.reactAriaTopLayer!==void 0}let F=new WeakMap,I=[];function Re(e,t){let n=h(e?.[0]),r=t instanceof n.Element?{root:t}:t,i=r?.root??document.body,a=r?.shouldUseInert&&Ie,o=new Set(e),c=new Set,l=e=>a&&e instanceof n.HTMLElement?e.inert:e.getAttribute(`aria-hidden`)===`true`,f=(e,t)=>{a&&e instanceof n.HTMLElement?e.inert=t:t?e.setAttribute(`aria-hidden`,`true`):(e.removeAttribute(`aria-hidden`),e instanceof n.HTMLElement&&(e.inert=!1))},p=new Set;if(s())for(let t of e){let e=t;for(;e&&e!==i;){let t=e.getRootNode();`shadowRoot`in t&&p.add(t.shadowRoot),e=t.parentNode}}let m=e=>{for(let t of e.querySelectorAll(`[data-live-announcer], [data-react-aria-top-layer]`))o.add(t);let t=e=>{if(c.has(e)||o.has(e)||e.parentElement&&c.has(e.parentElement)&&e.parentElement.getAttribute(`role`)!==`row`)return NodeFilter.FILTER_REJECT;for(let t of o)if(d(e,t))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},n=Oe(u(e),e,NodeFilter.SHOW_ELEMENT,{acceptNode:t}),r=t(e);if(r===NodeFilter.FILTER_ACCEPT&&g(e),r!==NodeFilter.FILTER_REJECT){let e=n.nextNode();for(;e!=null;)g(e),e=n.nextNode()}},g=e=>{let t=F.get(e)??0;l(e)&&t===0||(t===0&&f(e,!0),c.add(e),F.set(e,t+1))};I.length&&I[I.length-1].disconnect(),m(i);let _=new MutationObserver(e=>{for(let t of e)if(t.type===`childList`){if(t.target.isConnected&&![...o,...c].some(e=>d(e,t.target)))for(let e of t.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&Le(e)?o.add(e):e instanceof Element&&m(e);if(s()){for(let e of p)if(!e.isConnected){_.disconnect();break}}}});_.observe(i,{childList:!0,subtree:!0});let ee=new Set;if(s())for(let e of p){let t=new MutationObserver(e=>{for(let t of e)if(t.type===`childList`){if(t.target.isConnected&&![...o,...c].some(e=>d(e,t.target)))for(let e of t.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&Le(e)?o.add(e):e instanceof Element&&m(e);if(s()){for(let e of p)if(!e.isConnected){_.disconnect();break}}}});t.observe(e,{childList:!0,subtree:!0}),ee.add(t)}let v={visibleNodes:o,hiddenNodes:c,observe(){_.observe(i,{childList:!0,subtree:!0})},disconnect(){_.disconnect()}};return I.push(v),()=>{if(_.disconnect(),s())for(let e of ee)e.disconnect();for(let e of c){let t=F.get(e);t!=null&&(t===1?(f(e,!1),F.delete(e)):F.set(e,t-1))}v===I[I.length-1]?(I.pop(),I.length&&I[I.length-1].observe()):I.splice(I.indexOf(v),1)}}const ze=new Set([`Arab`,`Syrc`,`Samr`,`Mand`,`Thaa`,`Mend`,`Nkoo`,`Adlm`,`Rohg`,`Hebr`]),Be=new Set([`ae`,`ar`,`arc`,`bcc`,`bqi`,`ckb`,`dv`,`fa`,`glk`,`he`,`ku`,`mzn`,`nqo`,`pnb`,`ps`,`sd`,`ug`,`ur`,`yi`]);function Ve(e){if(Intl.Locale){let t=new Intl.Locale(e).maximize(),n=typeof t.getTextInfo==`function`?t.getTextInfo():t.textInfo;if(n)return n.direction===`rtl`;if(t.script)return ze.has(t.script)}let t=e.split(`-`)[0];return Be.has(t)}const He=Symbol.for(`react-aria.i18n.locale`);function Ue(){let e=typeof window<`u`&&window[He]||typeof navigator<`u`&&(navigator.language||navigator.userLanguage)||`en-US`;try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{e=`en-US`}return{locale:e,direction:Ve(e)?`rtl`:`ltr`}}let We=Ue(),L=new Set;function Ge(){We=Ue();for(let e of L)e(We)}function Ke(){let e=o(),[t,n]=O(We);return T(()=>(L.size===0&&window.addEventListener(`languagechange`,Ge),L.add(n),()=>{L.delete(n),L.size===0&&window.removeEventListener(`languagechange`,Ge)}),[]),e?{locale:typeof window<`u`&&window[He]||`en-US`,direction:`ltr`}:t}const qe=b.createContext(null);function Je(){let e=Ke();return w(qe)||e}const Ye=Symbol.for(`react-aria.i18n.locale`),Xe=Symbol.for(`react-aria.i18n.strings`);let R;var Ze=class e{constructor(e,t=`en-US`){this.strings=Object.fromEntries(Object.entries(e).filter(([,e])=>e)),this.defaultLocale=t}getStringForLocale(e,t){let n=this.getStringsForLocale(t)[e];if(!n)throw Error(`Could not find intl message ${e} in ${t} locale`);return n}getStringsForLocale(e){let t=this.strings[e];return t||(t=Qe(e,this.strings,this.defaultLocale),this.strings[e]=t),t}static getGlobalDictionaryForPackage(t){if(typeof window>`u`)return null;let n=window[Ye];if(R===void 0){let t=window[Xe];if(!t)return null;R={};for(let r in t)R[r]=new e({[n]:t[r]},n)}let r=R?.[t];if(!r)throw Error(`Strings for package "${t}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);return r}};function Qe(e,t,n=`en-US`){if(t[e])return t[e];let r=$e(e);if(t[r])return t[r];for(let e in t)if(e.startsWith(r+`-`))return t[e];return t[n]}function $e(e){return Intl.Locale?new Intl.Locale(e).language:e.split(`-`)[0]}const et=new Map,tt=new Map;var nt=class{constructor(e,t){this.locale=e,this.strings=t}format(e,t){let n=this.strings.getStringForLocale(e,this.locale);return typeof n==`function`?n(t,this):n}plural(e,t,n=`cardinal`){let r=t[`=`+e];if(r)return typeof r==`function`?r():r;let i=this.locale+`:`+n,a=et.get(i);return a||(a=new Intl.PluralRules(this.locale,{type:n}),et.set(i,a)),r=t[a.select(e)]||t.other,typeof r==`function`?r():r}number(e){let t=tt.get(this.locale);return t||(t=new Intl.NumberFormat(this.locale),tt.set(this.locale,t)),t.format(e)}select(e,t){let n=e[t]||e.other;return typeof n==`function`?n():n}};const rt=new WeakMap;function it(e){let t=rt.get(e);return t||(t=new Ze(e),rt.set(e,t)),t}function at(e,t){return t&&Ze.getGlobalDictionaryForPackage(t)||it(e)}function ot(e,t){let{locale:n}=Je(),r=at(e,t);return E(()=>new nt(n,r),[n,r])}const st=b.createContext(null),ct=`react-aria-focus-scope-restore`;let z=null;function lt(e){let{children:t,contain:n,restoreFocus:r,autoFocus:i}=e,a=D(null),o=D(null),s=D([]),{parentNode:c}=w(st)||{},l=E(()=>new wt({scopeRef:s}),[s]);_(()=>{let e=c||q.root;if(q.getTreeNode(e.scopeRef)&&z&&!W(z,e.scopeRef)){let t=q.getTreeNode(z);t&&(e=t)}e.addChild(l),q.addNode(l)},[l,c]),_(()=>{let e=q.getTreeNode(s);e&&(e.contain=!!n)},[n]),_(()=>{let e=a.current?.nextSibling,t=[],n=e=>e.stopPropagation();for(;e&&e!==o.current;)t.push(e),e.addEventListener(ct,n),e=e.nextSibling;return s.current=t,()=>{for(let e of t)e.removeEventListener(ct,n)}},[t]),yt(s,r,n),pt(s,n),xt(s,r,n),vt(s,i),T(()=>{let e=m(u(s.current?s.current[0]:void 0)),t=null;if(H(e,s.current)){for(let n of q.traverse())n.scopeRef&&H(e,n.scopeRef.current)&&(t=n);t===q.getTreeNode(s)&&(z=t.scopeRef)}},[s]),_(()=>()=>{let e=q.getTreeNode(s)?.parent?.scopeRef??null;(s===z||W(s,z))&&(!e||q.getTreeNode(e))&&(z=e),q.removeTreeNode(s)},[s]);let d=E(()=>ut(s),[]),f=E(()=>({focusManager:d,parentNode:l}),[l,d]);return b.createElement(st.Provider,{value:f},b.createElement(`span`,{"data-focus-scope-start":!0,hidden:!0,ref:a}),t,b.createElement(`span`,{"data-focus-scope-end":!0,hidden:!0,ref:o}))}function ut(e){return{focusNext(t={}){let n=e.current,{from:r,tabbable:i,wrap:a,accept:o}=t,s=r||m(u(n[0]??void 0)),c=n[0].previousElementSibling,l=K(B(n),{tabbable:i,accept:o},n);l.currentNode=H(s,n)?s:c;let d=l.nextNode();return!d&&a&&(l.currentNode=c,d=l.nextNode()),d&&G(d,!0),d},focusPrevious(t={}){let n=e.current,{from:r,tabbable:i,wrap:a,accept:o}=t,s=r||m(u(n[0]??void 0)),c=n[n.length-1].nextElementSibling,l=K(B(n),{tabbable:i,accept:o},n);l.currentNode=H(s,n)?s:c;let d=l.previousNode();return!d&&a&&(l.currentNode=c,d=l.previousNode()),d&&G(d,!0),d},focusFirst(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=K(B(n),{tabbable:r,accept:i},n);a.currentNode=n[0].previousElementSibling;let o=a.nextNode();return o&&G(o,!0),o},focusLast(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=K(B(n),{tabbable:r,accept:i},n);a.currentNode=n[n.length-1].nextElementSibling;let o=a.previousNode();return o&&G(o,!0),o}}}function B(e){return e[0].parentElement}function V(e){let t=q.getTreeNode(z);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function dt(e){if(!e.form)return Array.from(u(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)).filter(e=>!e.form);let t=e.form.elements.namedItem(e.name),n=h(e);return t instanceof n.RadioNodeList?Array.from(t).filter(e=>e instanceof n.HTMLInputElement):t instanceof n.HTMLInputElement?[t]:[]}function ft(e){if(e.checked)return!0;let t=dt(e);return t.length>0&&!t.some(e=>e.checked)}function pt(e,t){let n=D(void 0),r=D(void 0);_(()=>{let o=e.current;if(!t){r.current&&=(cancelAnimationFrame(r.current),void 0);return}let s=u(o?o[0]:void 0),c=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!V(e)||t.isComposing)return;let n=m(s),r=e.current;if(!r||!H(n,r))return;let i=K(B(r),{tabbable:!0},r);if(!n)return;i.currentNode=n;let a=t.shiftKey?i.previousNode():i.nextNode();a||=(i.currentNode=t.shiftKey?r[r.length-1].nextElementSibling:r[0].previousElementSibling,t.shiftKey?i.previousNode():i.nextNode()),t.preventDefault(),a&&(G(a,!0),a instanceof h(a).HTMLInputElement&&a.select())},l=t=>{(!z||W(z,e))&&H(i(t),e.current)?(z=e,n.current=i(t)):V(e)&&!U(i(t),e)?n.current?n.current.focus():z&&z.current&&_t(z.current):V(e)&&(n.current=i(t))},d=t=>{r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{let r=ie(),o=(r===`virtual`||r===null)&&a()&&v(),c=m(s);if(!o&&c&&V(e)&&!U(c,e)){z=e;let r=i(t);r&&r.isConnected?(n.current=r,n.current?.focus()):z.current&&_t(z.current)}})};return s.addEventListener(`keydown`,c,!1),s.addEventListener(`focusin`,l,!1),o?.forEach(e=>e.addEventListener(`focusin`,l,!1)),o?.forEach(e=>e.addEventListener(`focusout`,d,!1)),()=>{s.removeEventListener(`keydown`,c,!1),s.removeEventListener(`focusin`,l,!1),o?.forEach(e=>e.removeEventListener(`focusin`,l,!1)),o?.forEach(e=>e.removeEventListener(`focusout`,d,!1))}},[e,t]),_(()=>()=>{r.current&&cancelAnimationFrame(r.current)},[r])}function mt(e){return U(e)}function H(e,t){return!e||!t?!1:t.some(t=>d(t,e))}function U(e,t=null){if(e instanceof Element&&e.closest(`[data-react-aria-top-layer]`))return!0;for(let{scopeRef:n}of q.traverse(q.getTreeNode(t)))if(n&&H(e,n.current))return!0;return!1}function ht(e){return U(e,z)}function W(e,t){let n=q.getTreeNode(t)?.parent;for(;n;){if(n.scopeRef===e)return!0;n=n.parent}return!1}function G(e,t=!1){if(e!=null&&!t)try{de(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function gt(e,t=!0){let n=e[0].previousElementSibling,r=B(e),i=K(r,{tabbable:t},e);i.currentNode=n;let a=i.nextNode();return t&&!a&&(r=B(e),i=K(r,{tabbable:!1},e),i.currentNode=n,a=i.nextNode()),a}function _t(e,t=!0){G(gt(e,t))}function vt(e,t){let n=b.useRef(t);T(()=>{n.current&&(z=e,!H(m(u(e.current?e.current[0]:void 0)),z.current)&&e.current&&_t(e.current)),n.current=!1},[e])}function yt(e,t,n){_(()=>{if(t||n)return;let r=e.current,a=u(r?r[0]:void 0),o=t=>{let n=i(t);H(n,e.current)?z=e:mt(n)||(z=null)};return a.addEventListener(`focusin`,o,!1),r?.forEach(e=>e.addEventListener(`focusin`,o,!1)),()=>{a.removeEventListener(`focusin`,o,!1),r?.forEach(e=>e.removeEventListener(`focusin`,o,!1))}},[e,t,n])}function bt(e){let t=q.getTreeNode(z);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return t?.scopeRef===e}function xt(e,t,n){let r=D(typeof document<`u`?m(u(e.current?e.current[0]:void 0)):null);_(()=>{let r=e.current,i=u(r?r[0]:void 0);if(!t||n)return;let a=()=>{(!z||W(z,e))&&H(m(i),e.current)&&(z=e)};return i.addEventListener(`focusin`,a,!1),r?.forEach(e=>e.addEventListener(`focusin`,a,!1)),()=>{i.removeEventListener(`focusin`,a,!1),r?.forEach(e=>e.removeEventListener(`focusin`,a,!1))}},[e,n]),_(()=>{let r=u(e.current?e.current[0]:void 0);if(!t)return;let i=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!V(e)||t.isComposing)return;let n=r.activeElement;if(!U(n,e)||!bt(e))return;let i=q.getTreeNode(e);if(!i)return;let a=i.nodeToRestore,o=K(r.body,{tabbable:!0});o.currentNode=n;let s=t.shiftKey?o.previousNode():o.nextNode();if((!a||!a.isConnected||a===r.body)&&(a=void 0,i.nodeToRestore=void 0),(!s||!U(s,e))&&a){o.currentNode=a;do s=t.shiftKey?o.previousNode():o.nextNode();while(U(s,e));t.preventDefault(),t.stopPropagation(),s?G(s,!0):mt(a)?G(a,!0):n.blur()}};return n||r.addEventListener(`keydown`,i,!0),()=>{n||r.removeEventListener(`keydown`,i,!0)}},[e,t,n]),_(()=>{let n=u(e.current?e.current[0]:void 0);if(!t)return;let i=q.getTreeNode(e);if(i)return i.nodeToRestore=r.current??void 0,()=>{let r=q.getTreeNode(e);if(!r)return;let i=r.nodeToRestore,a=m(n);if(t&&i&&(a&&U(a,e)||a===n.body&&bt(e))){let t=q.clone();requestAnimationFrame(()=>{if(n.activeElement===n.body){let n=t.getTreeNode(e);for(;n;){if(n.nodeToRestore&&n.nodeToRestore.isConnected){St(n.nodeToRestore);return}n=n.parent}for(n=t.getTreeNode(e);n;){if(n.scopeRef&&n.scopeRef.current&&q.getTreeNode(n.scopeRef)){St(gt(n.scopeRef.current,!0));return}n=n.parent}}})}}},[e,t])}function St(e){e.dispatchEvent(new CustomEvent(ct,{bubbles:!0,cancelable:!0}))&&G(e)}function K(e,t,n){let i=t?.tabbable?r:g,a=u(e?.nodeType===Node.ELEMENT_NODE?e:null),o=Oe(a,e||a,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return d(t?.from,e)||t?.tabbable&&e.tagName===`INPUT`&&e.getAttribute(`type`)===`radio`&&(!ft(e)||o.currentNode.tagName===`INPUT`&&o.currentNode.type===`radio`&&o.currentNode.name===e.name)?NodeFilter.FILTER_REJECT:i(e)&&(!n||H(e,n))&&(!t?.accept||t.accept(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t?.from&&(o.currentNode=t.from),o}var Ct=class e{constructor(){this.fastMap=new Map,this.root=new wt({scopeRef:null}),this.fastMap.set(null,this.root)}get size(){return this.fastMap.size}getTreeNode(e){return this.fastMap.get(e)}addTreeNode(e,t,n){let r=this.fastMap.get(t??null);if(!r)return;let i=new wt({scopeRef:e});r.addChild(i),i.parent=r,this.fastMap.set(e,i),n&&(i.nodeToRestore=n)}addNode(e){this.fastMap.set(e.scopeRef,e)}removeTreeNode(e){if(e===null)return;let t=this.fastMap.get(e);if(!t)return;let n=t.parent;for(let e of this.traverse())e!==t&&t.nodeToRestore&&e.nodeToRestore&&t.scopeRef&&t.scopeRef.current&&H(e.nodeToRestore,t.scopeRef.current)&&(e.nodeToRestore=t.nodeToRestore);let r=t.children;n&&(n.removeChild(t),r.size>0&&r.forEach(e=>n&&n.addChild(e))),this.fastMap.delete(t.scopeRef)}*traverse(e=this.root){if(e.scopeRef!=null&&(yield e),e.children.size>0)for(let t of e.children)yield*this.traverse(t)}clone(){let t=new e;for(let e of this.traverse())t.addTreeNode(e.scopeRef,e.parent?.scopeRef??null,e.nodeToRestore);return t}},wt=class{constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}};let q=new Ct;const Tt=typeof document<`u`?b.useInsertionEffect??b.useLayoutEffect:()=>{};function Et(e,t,n){let[r,i]=O(e||t),a=D(r),o=D(e!==void 0),s=e!==void 0;T(()=>{o.current,o.current=s},[s]);let c=s?e:r;Tt(()=>{a.current=c});let[,l]=ve(()=>({}),{});return[c,C((e,...t)=>{let r=typeof e==`function`?e(a.current):e;Object.is(a.current,r)||(a.current=r,i(r),l(),n?.(r,...t))},[n])]}function Dt({children:e}){let t=E(()=>({register:()=>{}}),[]);return b.createElement(le.Provider,{value:t},e)}function Ot(e){let{ref:t,onInteractOutside:r,isDisabled:i,onInteractOutsideStart:a}=e,o=D({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}),s=n(e=>{r&&kt(e,t)&&(a&&a(e),o.current.isPointerDown=!0)}),c=n(e=>{r&&r(e)});T(()=>{let e=o.current;if(i)return;let n=t.current,r=u(n);if(typeof PointerEvent<`u`){let n=n=>{e.isPointerDown&&kt(n,t)&&c(n),e.isPointerDown=!1};return r.addEventListener(`pointerdown`,s,!0),r.addEventListener(`click`,n,!0),()=>{r.removeEventListener(`pointerdown`,s,!0),r.removeEventListener(`click`,n,!0)}}},[t,i])}function kt(e,t){if(e.button>0)return!1;let n=i(e);if(n){let e=n.ownerDocument;if(!e||!d(e.documentElement,n)||n.closest(`[data-react-aria-top-layer]`))return!1}return t.current?!e.composedPath().includes(t.current):!1}const At={border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`};function jt(e={}){let{style:t,isFocusable:n}=e,[r,i]=O(!1),{focusWithinProps:a}=re({isDisabled:!n,onFocusWithinChange:e=>i(e)}),o=E(()=>r?t:t?{...At,...t}:At,[r]);return{visuallyHiddenProps:{...a,style:o}}}function Mt(t){let{children:n,elementType:r=`div`,isFocusable:i,style:a,...o}=t,{visuallyHiddenProps:s}=jt(t);return b.createElement(r,e(o,s),n)}const Nt=x({});function Pt(){return w(Nt)??{}}const Ft=b.createContext(null);function It(e){let t=o(),{portalContainer:n=t?null:document.body,isExiting:r}=e,[i,a]=O(!1),s=E(()=>({contain:i,setContain:a}),[i,a]),{getContainer:c}=Pt();if(!e.portalContainer&&c&&(n=c()),!n)return null;let l=e.children;return e.disableFocusManagement||(l=b.createElement(lt,{restoreFocus:!0,contain:(e.shouldContainFocus||i)&&!r},l)),l=b.createElement(Ft.Provider,{value:s},b.createElement(Dt,null,l)),Se.createPortal(l,n)}function Lt(){let e=w(Ft)?.setContain;_(()=>{e?.(!0)},[e])}function Rt(e,n){let{role:r=`dialog`}=e,i=t();i=e[`aria-label`]?void 0:i;let a=D(!1);return T(()=>{if(n.current&&!f(n.current)){de(n.current);let e=setTimeout(()=>{(m()===n.current||m()===document.body)&&(a.current=!0,n.current&&(n.current.blur(),de(n.current)),a.current=!1)},500);return()=>{clearTimeout(e)}}},[n]),Lt(),D(!1),T(()=>{}),{dialogProps:{...y(e,{labelable:!0}),role:r,tabIndex:-1,"aria-labelledby":e[`aria-labelledby`]||i,onBlur:e=>{a.current&&e.stopPropagation()}},titleProps:{id:i}}}var zt={};zt={dismiss:`تجاهل`};var Bt={};Bt={dismiss:`Отхвърляне`};var Vt={};Vt={dismiss:`Odstranit`};var Ht={};Ht={dismiss:`Luk`};var Ut={};Ut={dismiss:`Schließen`};var Wt={};Wt={dismiss:`Απόρριψη`};var Gt={};Gt={dismiss:`Dismiss`};var Kt={};Kt={dismiss:`Descartar`};var qt={};qt={dismiss:`Lõpeta`};var Jt={};Jt={dismiss:`Hylkää`};var Yt={};Yt={dismiss:`Rejeter`};var Xt={};Xt={dismiss:`התעלם`};var Zt={};Zt={dismiss:`Odbaci`};var Qt={};Qt={dismiss:`Elutasítás`};var $t={};$t={dismiss:`Ignora`};var en={};en={dismiss:`閉じる`};var tn={};tn={dismiss:`무시`};var nn={};nn={dismiss:`Atmesti`};var rn={};rn={dismiss:`Nerādīt`};var an={};an={dismiss:`Lukk`};var on={};on={dismiss:`Negeren`};var sn={};sn={dismiss:`Zignoruj`};var cn={};cn={dismiss:`Descartar`};var ln={};ln={dismiss:`Dispensar`};var un={};un={dismiss:`Revocare`};var dn={};dn={dismiss:`Пропустить`};var fn={};fn={dismiss:`Zrušiť`};var pn={};pn={dismiss:`Opusti`};var mn={};mn={dismiss:`Odbaci`};var hn={};hn={dismiss:`Avvisa`};var gn={};gn={dismiss:`Kapat`};var _n={};_n={dismiss:`Скасувати`};var vn={};vn={dismiss:`取消`};var yn={};yn={dismiss:`關閉`};var bn={};bn={"ar-AE":zt,"bg-BG":Bt,"cs-CZ":Vt,"da-DK":Ht,"de-DE":Ut,"el-GR":Wt,"en-US":Gt,"es-ES":Kt,"et-EE":qt,"fi-FI":Jt,"fr-FR":Yt,"he-IL":Xt,"hr-HR":Zt,"hu-HU":Qt,"it-IT":$t,"ja-JP":en,"ko-KR":tn,"lt-LT":nn,"lv-LV":rn,"nb-NO":an,"nl-NL":on,"pl-PL":sn,"pt-BR":cn,"pt-PT":ln,"ro-RO":un,"ru-RU":dn,"sk-SK":fn,"sl-SI":pn,"sr-SP":mn,"sv-SE":hn,"tr-TR":gn,"uk-UA":_n,"zh-CN":vn,"zh-TW":yn};function xn(e){return e&&e.__esModule?e.default:e}function Sn(e){let{onDismiss:t,...n}=e,r=ke(n,ot(xn(bn),`@react-aria/overlays`).format(`dismiss`)),i=()=>{t&&t()};return b.createElement(Mt,null,b.createElement(`button`,{...r,tabIndex:-1,onClick:i,style:{width:1,height:1}}))}const J=[];function Cn(e,t){let{onClose:n,shouldCloseOnBlur:r,isOpen:a,isDismissable:o=!1,isKeyboardDismissDisabled:s=!1,shouldCloseOnInteractOutside:c}=e,l=D(void 0);T(()=>{if(a&&!J.includes(t))return J.push(t),()=>{let e=J.indexOf(t);e>=0&&J.splice(e,1)}},[a,t]);let u=()=>{J[J.length-1]===t&&n&&n()},d=e=>{let n=J[J.length-1];l.current=n,(!c||c(i(e)))&&n===t&&e.stopPropagation()},f=e=>{(!c||c(i(e)))&&(J[J.length-1]===t&&e.stopPropagation(),l.current===t&&u()),l.current=void 0},p=e=>{e.key===`Escape`&&!s&&!e.nativeEvent.isComposing&&(e.stopPropagation(),e.preventDefault(),u())};Ot({ref:t,onInteractOutside:o&&a?f:void 0,onInteractOutsideStart:d});let{focusWithinProps:m}=re({isDisabled:!r,onBlurWithin:e=>{!e.relatedTarget||ht(e.relatedTarget)||(!c||c(e.relatedTarget))&&n?.()}});return{overlayProps:{onKeyDown:p,...m},underlayProps:{}}}const Y=typeof document<`u`&&window.visualViewport;let X=0,wn;function Tn(e={}){let{isDisabled:t}=e;_(()=>{if(!t)return X++,X===1&&(wn=l()?Dn():En()),()=>{X--,X===0&&wn()}},[t])}function En(){let e=window.innerWidth-document.documentElement.clientWidth;return me(e>0&&(`scrollbarGutter`in document.documentElement.style?Z(document.documentElement,`scrollbarGutter`,`stable`):Z(document.documentElement,`paddingRight`,`${e}px`)),Z(document.documentElement,`overflow`,`hidden`))}function Dn(){let e=Z(document.documentElement,`overflow`,`hidden`),t,n=!1,r=e=>{let r=i(e);t=j(r)?r:Ae(r,!0),n=!1;let a=r.ownerDocument.defaultView.getSelection();a&&!a.isCollapsed&&a.containsNode(r,!0)&&(n=!0),e.composedPath().some(e=>e instanceof HTMLInputElement&&e.type===`range`)&&(n=!0),`selectionStart`in r&&`selectionEnd`in r&&r.selectionStart<r.selectionEnd&&r.ownerDocument.activeElement===r&&(n=!0)},a=document.createElement(`style`),o=fe();o&&(a.nonce=o),a.textContent=`@layer {
2
+ * {
3
+ overscroll-behavior: contain;
4
+ }
5
+ }`,document.head.prepend(a);let s=e=>{if(!(e.touches.length===2||n)){if(!t||t===document.documentElement||t===document.body){e.preventDefault();return}t.scrollHeight===t.clientHeight&&t.scrollWidth===t.clientWidth&&e.preventDefault()}},c=e=>{let t=i(e),n=e.relatedTarget;n&&M(n)?(n.focus({preventScroll:!0}),kn(n,M(t))):n||(t.parentElement?.closest(`[tabindex]`))?.focus({preventScroll:!0})},l=HTMLElement.prototype.focus;HTMLElement.prototype.focus=function(e){let t=m(),n=t!=null&&M(t);l.call(this,{...e,preventScroll:!0}),(!e||!e.preventScroll)&&kn(this,n)};let u=me(On(document,`touchstart`,r,{passive:!1,capture:!0}),On(document,`touchmove`,s,{passive:!1,capture:!0}),On(document,`blur`,c,!0));return()=>{e(),u(),a.remove(),HTMLElement.prototype.focus=l}}function Z(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function On(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function kn(e,t){t||!Y?An(e):Y.addEventListener(`resize`,()=>An(e),{once:!0})}function An(e){let t=document.scrollingElement||document.documentElement,n=e;for(;n&&n!==t;){let e=Ae(n);if(e!==document.documentElement&&e!==document.body&&e!==n){let t=e.getBoundingClientRect(),r=n.getBoundingClientRect();if(r.top<t.top||r.bottom>t.top+n.clientHeight){let n=t.bottom;Y&&(n=Math.min(n,Y.offsetTop+Y.height));let i=r.top-t.top-((n-t.top)/2-r.height/2);e.scrollTo({top:Math.max(0,Math.min(e.scrollHeight-e.clientHeight,e.scrollTop+i)),behavior:`smooth`})}}n=e.parentElement}}function jn(t,n,r){let{overlayProps:i,underlayProps:a}=Cn({...t,isOpen:n.isOpen,onClose:n.close},r);return Tn({isDisabled:!n.isOpen}),Lt(),T(()=>{if(n.isOpen&&r.current)return Re([r.current],{shouldUseInert:!0})},[n.isOpen,r]),{modalProps:e(i),underlayProps:a}}function Mn(e){let[t,n]=Et(e.isOpen,e.defaultOpen||!1,e.onOpenChange);return{isOpen:t,setOpen:n,open:C(()=>{n(!0)},[n]),close:C(()=>{n(!1)},[n]),toggle:C(()=>{n(!t)},[n,t])}}const Nn=x(null),Q=x(null),Pn=S(function(t,n){let r=t[`aria-labelledby`];[t,n]=ae(t,n,Nn);let{dialogProps:i,titleProps:a}=Rt({...t,"aria-labelledby":r},n),o=w(Q);!i[`aria-label`]&&!i[`aria-labelledby`]&&t[`aria-labelledby`]&&(i[`aria-labelledby`]=t[`aria-labelledby`]);let s=te({defaultClassName:`react-aria-Dialog`,className:t.className,style:t.style,children:t.children,values:{close:o?.close||(()=>{})}}),c=y(t,{global:!0});return b.createElement(pe.section,{...e(c,s,i),render:t.render,ref:n,slot:t.slot||void 0},b.createElement(oe,{values:[[Te,{slots:{[ne]:{},title:{...a,level:2}}}],[ue,{slots:{[ne]:{},close:{onPress:()=>o?.close()}}}]]},s.children))}),Fn=x(null),In=x(null),Ln=S(function(e,t){if(w(In))return b.createElement(Vn,{...e,modalRef:t},e.children);let{isDismissable:n,isKeyboardDismissDisabled:r,isOpen:i,defaultOpen:a,onOpenChange:o,children:s,isEntering:c,isExiting:l,UNSTABLE_portalContainer:u,shouldCloseOnInteractOutside:d,...f}=e;return b.createElement(zn,{isDismissable:n,isKeyboardDismissDisabled:r,isOpen:i,defaultOpen:a,onOpenChange:o,isEntering:c,isExiting:l,UNSTABLE_portalContainer:u,shouldCloseOnInteractOutside:d},b.createElement(Vn,{...f,modalRef:t},s))});function Rn(e,t){[e,t]=ae(e,t,Fn);let n=w(Q),r=Mn(e),i=e.isOpen!=null||e.defaultOpen!=null||!n?r:n,a=p(t),s=D(null),c=Pe(a,i.isOpen),l=Pe(s,i.isOpen),u=c||l||e.isExiting||!1,d=o();return!i.isOpen&&!u||d?null:b.createElement(Bn,{...e,state:i,isExiting:u,overlayRef:a,modalRef:s})}const zn=S(Rn);function Bn({UNSTABLE_portalContainer:t,...n}){let r=n.modalRef,{state:i}=n,{modalProps:a,underlayProps:o}=jn(n,i,r),s=Ne(n.overlayRef)||n.isEntering||!1,c=te({...n,defaultClassName:`react-aria-ModalOverlay`,values:{isEntering:s,isExiting:n.isExiting,state:i}}),l=Me(),u;if(typeof document<`u`){let e=j(document.body)?document.body:document.scrollingElement||document.documentElement,t=e.getBoundingClientRect().height%1;u=e.scrollHeight-t}let d={...c.style,"--visual-viewport-height":l.height+`px`,"--page-height":u===void 0?void 0:u+`px`};return b.createElement(It,{isExiting:n.isExiting,portalContainer:t},b.createElement(pe.div,{...e(y(n,{global:!0}),o),...c,style:d,ref:n.overlayRef,"data-entering":s||void 0,"data-exiting":n.isExiting||void 0},b.createElement(oe,{values:[[In,{modalProps:a,modalRef:r,isExiting:n.isExiting,isDismissable:n.isDismissable}],[Q,i]]},c.children)))}function Vn(t){let{modalProps:n,modalRef:r,isExiting:i,isDismissable:a}=w(In),o=w(Q),s=p(E(()=>ce(t.modalRef,r),[t.modalRef,r])),c=Ne(s),l=te({...t,defaultClassName:`react-aria-Modal`,values:{isEntering:c,isExiting:i,state:o}});return b.createElement(pe.div,{...e(y(t,{global:!0}),n),...l,ref:s,"data-entering":c||void 0,"data-exiting":i||void 0},a&&b.createElement(Sn,{onDismiss:o.close}),l.children)}const Hn=x({}),Un=()=>w(Hn),Wn=x({}),Gn=({type:e,children:t})=>{let n=E(()=>({type:e}),[e]);return k(Wn.Provider,{value:n,children:t})},Kn=()=>w(Wn),$=x(null),qn=({children:e,surveyId:t,publishableKey:n,respondent:r,metadata:i={},apiBaseUrl:a})=>{let{type:o}=Kn(),s=Un(),l=s.version??`0.5.0`,u=s.build,d=D(!1),[f,p]=O(),m=se({publishableKey:n,apiBaseUrl:a});T(()=>{(async()=>{d.current=!1,p(void 0);try{let e=await m.get(`api/v1/cfti/${t}`).json(),n=c.safeParse(e);if(!n.success)return;p(n.data)}catch{}})()},[m,t]);let h=C(async({answers:e})=>{let n=crypto.randomUUID();await m.put(`api/v1/cfti/${t}/response/${n}`,{json:{respondent:r,data:e,metadata:i,telemetry:{...o!==void 0&&{type:o},version:l,...u&&{build:u}}}})},[u,m,i,r,t,l,o]),g=C(()=>{m.post(`api/v1/cfti/${t}/respondent/${r}/event`,{json:{type:`dismiss`}}).catch(()=>{})},[m,r,t]);return T(()=>{d.current||f&&r&&(d.current=!0,m.post(`api/v1/cfti/${t}/respondent/${r}/event`,{json:{type:`view`}}).catch(()=>{}))},[m,r,f,t]),f?k($.Provider,{value:{submit:h,dismiss:g,surveyId:t,survey:f,metadata:i},children:e}):null},Jn=e=>w($)?k(be,{children:e.children}):k(qn,{...e}),Yn=()=>{let e=w($);if(!e)throw Error(`useSurvey must be used within a SurveyProvider`);return e},Xn=()=>{let[e,t]=O(!1);return T(()=>{let e=e=>{let n=he.safeParse(e);n.error||t(n.data.detail.isRecording)};return document.addEventListener(ge,e),()=>{document.removeEventListener(ge,e)}},[]),e},Zn=({className:e,iconClassName:t,onClose:n})=>Xn()?null:k(`button`,{type:`button`,className:e,"aria-label":`Dismiss`,onClick:n,children:k(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`none`,className:t,children:k(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M3.53 3.529c.26-.26.682-.26.942 0l3.529 3.528 3.528-3.528a.667.667 0 0 1 .943.942L8.943 8l3.53 3.528a.667.667 0 0 1-.944.943L8.001 8.943 4.472 12.47a.667.667 0 1 1-.943-.943L7.058 8 3.529 4.47a.667.667 0 0 1 0-.942Z`,clipRule:`evenodd`})})}),Qn=({children:e,classNames:t,isDismissable:n,onDismiss:r,onClose:i,closeOnFinishMs:a,isSubmitted:o,onSubmitted:s})=>{let{survey:c,surveyId:l,dismiss:u}=Yn(),[d,f]=O(!1);return ye(()=>{c&&i?.()},d?a:null),xe(Pn,{"aria-label":`Survey`,id:`${l}-popover`,className:A(`confetti-modal-dialog ${_e}`,t?.dialog),children:[n&&k(Zn,{className:A(`confetti-modal-dialog-close`,t?.closeButton),iconClassName:t?.icon,onClose:async()=>{!o&&!d&&(await u(),r?.()),i?.()}}),typeof e==`function`?e({setIsSubmitted:()=>s?.(),setIsFinished:()=>f(!0)}):e]})},$n=({children:e,classNames:t,onDismiss:n,onClose:r,isDismissable:i=!0,closeOnFinishMs:a=3e3})=>{let{dismiss:o}=Yn(),[s,c]=O(!1);return k(zn,{isOpen:!0,isDismissable:i,isKeyboardDismissDisabled:!i,onOpenChange:async e=>{e||(s||(await o(),n?.()),r?.())},className:A(`confetti-modal-overlay ${_e}`,t?.overlay),children:k(Ln,{className:A(`confetti-modal ${_e}`,t?.modal),children:k(Qn,{classNames:t,isDismissable:i,onDismiss:n,onClose:r,closeOnFinishMs:a,isSubmitted:s,onSubmitted:()=>c(!0),children:e})})})};export{$ as a,Gn as c,K as d,Je as f,we as h,Xn as i,Mt as l,Ee as m,Qn as n,Jn as o,ke as p,Zn as r,Yn as s,$n as t,Et as u};
@@ -1,2 +1,2 @@
1
- import { r as ModalContent } from "./ModalContainer-BT1Bys9H.js";
1
+ import { r as ModalContent } from "./ModalContainer-CbbuRuFl.js";
2
2
  export { ModalContent as UnstableModalContent };
@@ -1 +1 @@
1
- import{n as e}from"./ModalContainer-Br4sC87A.js";export{e as UnstableModalContent};
1
+ import{n as e}from"./ModalContainer-q2SR0m5h.js";export{e as UnstableModalContent};
@@ -0,0 +1,276 @@
1
+ import { n as ModalContainerProps, t as ModalContainer } from "./ModalContainer-CbbuRuFl.js";
2
+ import { c as Question, d as MultiSelectQuestionProperties, f as RatingQuestionProperties, h as TextQuestionProperties, m as StatementQuestionProperties, p as SingleSelectQuestionProperties, r as ConfettiState, t as Answer } from "./types-Sf4fgrFJ.js";
3
+ import { _ as useSurvey, a as BaseFieldProps, c as ConfettiProviderProps, d as RespondentVisibilityProviderProps, g as SurveyProviderProps, h as SurveyProvider, i as BugReportOptions, l as RespondentVisibilityContext, m as SurveyContext, n as Confetti, o as Question$1, p as useRespondentVisibility, r as ConfettiProps, s as ConfettiProvider, t as BaseConfettiProps, u as RespondentVisibilityProvider, v as ConfettiController, y as ConfettiControllerProps } from "./Confetti-gIat3060.js";
4
+ import { HTMLAttributes, JSX, PropsWithChildren, SVGProps } from "react";
5
+
6
+ //#region src/components/container/PopoverContainer.d.ts
7
+ interface PopoverContainerProps {
8
+ closeOnFinishMs?: number | null;
9
+ classNames?: {
10
+ dialog?: string;
11
+ closeButton?: string;
12
+ icon?: string;
13
+ };
14
+ /**
15
+ * Invoked when the user dismisses the survey via the close button before
16
+ * submitting. Not invoked on auto-close after finish, on the Thank-You
17
+ * button, or on any close after submission, all of which close a completed
18
+ * survey rather than dismiss it.
19
+ */
20
+ onDismiss?: () => void;
21
+ /**
22
+ * Invoked on every close path: the close button, the close-on-finish timer,
23
+ * and the Thank-You button. Lets the owning wrapper tear the widget down.
24
+ */
25
+ onClose?: () => void;
26
+ containerProps?: Omit<HTMLAttributes<HTMLDivElement>, 'children'>;
27
+ children: React.ReactNode | ((props: {
28
+ setIsSubmitted: () => void;
29
+ setIsFinished: () => void;
30
+ }) => React.ReactNode);
31
+ }
32
+ declare const PopoverContainer: ({
33
+ children,
34
+ classNames,
35
+ containerProps,
36
+ onDismiss,
37
+ onClose,
38
+ closeOnFinishMs
39
+ }: PopoverContainerProps) => import("react").JSX.Element;
40
+ //#endregion
41
+ //#region src/components/CloseButton.d.ts
42
+ interface CloseButtonProps {
43
+ className?: string;
44
+ iconClassName?: string;
45
+ onClose: () => void;
46
+ }
47
+ declare const CloseButton: ({
48
+ className,
49
+ iconClassName,
50
+ onClose
51
+ }: CloseButtonProps) => import("react").JSX.Element | null;
52
+ //#endregion
53
+ //#region src/components/questions/factory.d.ts
54
+ interface SurveyQuestionFactoryProps extends BugReportOptions {
55
+ question: Question$1;
56
+ onChange: (answer: Answer) => void;
57
+ error?: string;
58
+ }
59
+ declare const SurveyQuestionFactory: ({
60
+ question,
61
+ onChange,
62
+ error,
63
+ maskAllInputs
64
+ }: SurveyQuestionFactoryProps) => import("react").JSX.Element;
65
+ //#endregion
66
+ //#region src/components/questions/Rating.d.ts
67
+ interface RatingProps extends BaseFieldProps {
68
+ properties: RatingQuestionProperties;
69
+ classNames?: {
70
+ question?: string;
71
+ header?: string;
72
+ title?: string;
73
+ description?: string;
74
+ optionalLabel?: string;
75
+ ratingSection?: string;
76
+ ratingDisplay?: string;
77
+ ratingText?: string;
78
+ ratingTextLower?: string;
79
+ ratingTextUpper?: string;
80
+ ratingDisplayStar?: string;
81
+ ratingStar?: string;
82
+ ratingDisplayNumber?: string;
83
+ ratingNumber?: string;
84
+ ratingDisplayEmoji?: string;
85
+ ratingEmoji?: string;
86
+ error?: string;
87
+ };
88
+ }
89
+ declare const Rating: ({
90
+ properties,
91
+ title,
92
+ description,
93
+ classNames,
94
+ onChange,
95
+ id,
96
+ error,
97
+ required
98
+ }: RatingProps) => JSX.Element;
99
+ //#endregion
100
+ //#region src/components/questions/FreeText.d.ts
101
+ interface FreeTextProps extends BaseFieldProps {
102
+ properties: TextQuestionProperties;
103
+ classNames?: {
104
+ question?: string;
105
+ header?: string;
106
+ title?: string;
107
+ optionalLabel?: string;
108
+ description?: string;
109
+ textarea?: string;
110
+ error?: string;
111
+ };
112
+ }
113
+ declare const FreeText: ({
114
+ id,
115
+ title,
116
+ description,
117
+ properties,
118
+ onChange,
119
+ classNames,
120
+ required,
121
+ error
122
+ }: FreeTextProps) => import("react").JSX.Element;
123
+ //#endregion
124
+ //#region src/components/questions/SingleChoice.d.ts
125
+ interface SingleChoiceProps extends BaseFieldProps {
126
+ properties: SingleSelectQuestionProperties;
127
+ classNames?: {
128
+ question?: string;
129
+ header?: string;
130
+ label?: string;
131
+ title?: string;
132
+ description?: string;
133
+ optionalLabel?: string;
134
+ group?: string;
135
+ radio?: string;
136
+ indicator?: string;
137
+ othersChoice?: string;
138
+ othersInput?: string;
139
+ choiceDescription?: string;
140
+ error?: string;
141
+ };
142
+ }
143
+ declare const SingleChoice: ({
144
+ title,
145
+ description,
146
+ properties,
147
+ classNames,
148
+ onChange,
149
+ id,
150
+ required,
151
+ error
152
+ }: SingleChoiceProps) => import("react").JSX.Element;
153
+ //#endregion
154
+ //#region src/components/questions/MultiChoice.d.ts
155
+ interface MultiChoiceProps extends BaseFieldProps {
156
+ properties: MultiSelectQuestionProperties;
157
+ classNames?: {
158
+ question?: string;
159
+ header?: string;
160
+ label?: string;
161
+ title?: string;
162
+ description?: string;
163
+ optionalLabel?: string;
164
+ choiceDescription?: string;
165
+ group?: string;
166
+ checkbox?: string;
167
+ tag?: string;
168
+ tagLabel?: string;
169
+ indicator?: string;
170
+ svg?: string;
171
+ othersChoice?: string;
172
+ othersInput?: string;
173
+ error?: string;
174
+ };
175
+ }
176
+ declare const MultiChoice: ({
177
+ title,
178
+ description,
179
+ properties,
180
+ classNames,
181
+ onChange,
182
+ id,
183
+ required,
184
+ error
185
+ }: MultiChoiceProps) => import("react").JSX.Element;
186
+ //#endregion
187
+ //#region src/components/questions/Statement.d.ts
188
+ interface StatementProps extends BaseFieldProps {
189
+ properties: StatementQuestionProperties;
190
+ classNames?: {
191
+ question?: string;
192
+ header?: string;
193
+ title?: string;
194
+ description?: string;
195
+ ctaButton?: string;
196
+ };
197
+ }
198
+ declare const Statement: ({
199
+ properties: _properties,
200
+ title,
201
+ description,
202
+ classNames
203
+ }: StatementProps) => import("react").JSX.Element;
204
+ //#endregion
205
+ //#region src/components/ThankYouMessage.d.ts
206
+ interface ThankYouMessageProps {
207
+ title?: string;
208
+ description?: string;
209
+ classNames?: {
210
+ question?: string;
211
+ header?: string;
212
+ title?: string;
213
+ description?: string;
214
+ };
215
+ onClose?: () => void;
216
+ }
217
+ declare const ThankYouMessage: ({
218
+ title,
219
+ description,
220
+ classNames,
221
+ onClose
222
+ }: ThankYouMessageProps) => import("react").JSX.Element | null;
223
+ //#endregion
224
+ //#region src/components/presentation/Flow.d.ts
225
+ type ChildField = (_: {
226
+ onChange: (answer: Answer) => void;
227
+ question: Question$1;
228
+ error?: string;
229
+ }) => React.ReactNode;
230
+ interface FlowProps {
231
+ onSubmit: (answer: Answer) => void;
232
+ children: ChildField;
233
+ question: Question$1;
234
+ isLastQuestion: boolean;
235
+ }
236
+ declare const Flow: ({
237
+ onSubmit,
238
+ children,
239
+ question,
240
+ isLastQuestion
241
+ }: FlowProps) => import("react").JSX.Element;
242
+ //#endregion
243
+ //#region src/components/presentation/Embed.d.ts
244
+ type EmbedProps = PropsWithChildren<{
245
+ isCompleted: boolean;
246
+ onSubmit: () => void;
247
+ }>;
248
+ declare const Embed: ({
249
+ isCompleted,
250
+ onSubmit,
251
+ children
252
+ }: EmbedProps) => import("react").JSX.Element;
253
+ //#endregion
254
+ //#region src/components/trigger/ConfettiTriggerIcon.d.ts
255
+ declare const ConfettiTriggerIcon: (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
256
+ //#endregion
257
+ //#region src/components/trigger/DefaultConfettiTrigger.d.ts
258
+ interface DefaultConfettiTriggerProps {
259
+ onClick: () => void;
260
+ isWidgetOpen: boolean;
261
+ label?: string;
262
+ classNames?: {
263
+ trigger?: string;
264
+ icon?: string;
265
+ iconWrapper?: string;
266
+ label?: string;
267
+ };
268
+ }
269
+ declare const DefaultConfettiTrigger: ({
270
+ onClick,
271
+ isWidgetOpen,
272
+ classNames,
273
+ label
274
+ }: DefaultConfettiTriggerProps) => import("react").JSX.Element | null;
275
+ //#endregion
276
+ export { type Answer, type BaseConfettiProps, CloseButton, Confetti, ConfettiController, type ConfettiControllerProps, type ConfettiProps, ConfettiProvider, type ConfettiProviderProps, type ConfettiState, ConfettiTriggerIcon, DefaultConfettiTrigger, type DefaultConfettiTriggerProps, Embed, type EmbedProps, Flow, type FlowProps, FreeText, type FreeTextProps, ModalContainer, type ModalContainerProps, MultiChoice, type MultiChoiceProps, PopoverContainer, type PopoverContainerProps, type Question, Rating, type RatingProps, RespondentVisibilityContext, RespondentVisibilityProvider, type RespondentVisibilityProviderProps, SingleChoice, type SingleChoiceProps, Statement, type StatementProps, SurveyContext, SurveyProvider, type SurveyProviderProps, SurveyQuestionFactory, type SurveyQuestionFactoryProps, ThankYouMessage, useRespondentVisibility, useSurvey };
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./DefaultConfettiTrigger-DFJBQ35H.js";import{a as n,o as r,r as i,s as a,t as o}from"./ModalContainer-q2SR0m5h.js";import{a as s,c,d as l,f as u,i as d,l as f,m as p,n as m,o as h,p as g,r as _,s as v,t as y,u as b}from"./Embed-D-rbeYPB.js";import{ErrorBoundary as x}from"react-error-boundary";import{Fragment as S,jsx as C}from"react/jsx-runtime";const w=({children:e,respondent:t,isSurveyVisible:n,...i})=>{let{respondent:a}=g();return C(r,{...i,respondent:a,children:e})},T=({children:e,...t})=>C(u,{...t,children:C(w,{...t,children:e})}),E=({children:e,onFinished:t,shouldAutoSubmit:n,...r})=>C(x,{fallback:C(S,{}),children:C(T,{...r,children:C(p,{shouldAutoSubmit:n,onFinished:t,children:e})})});export{i as CloseButton,E as Confetti,p as ConfettiController,T as ConfettiProvider,e as ConfettiTriggerIcon,t as DefaultConfettiTrigger,y as Embed,m as Flow,f as FreeText,o as ModalContainer,c as MultiChoice,b as PopoverContainer,v as Rating,l as RespondentVisibilityContext,u as RespondentVisibilityProvider,h as SingleChoice,s as Statement,n as SurveyContext,r as SurveyProvider,d as SurveyQuestionFactory,_ as ThankYouMessage,g as useRespondentVisibility,a as useSurvey};