pulse-dashboard
Version:
A Next.js Dashboard application for real-time monitoring and historical analysis of Playwright test executions, based on playwright-pulse-report. This component provides the UI for visualizing Playwright test results and can be run as a standalone CLI too
1 lines • 3.79 kB
JavaScript
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,42727,e=>{"use strict";var t=e.i(71645),o=e.i(81140),r=e.i(75830),n=e.i(20783),i=e.i(30030),s=e.i(10772),a=e.i(48425),u=e.i(30207),l=e.i(69340),c=e.i(86318),f=e.i(43476),d="rovingFocusGroup.onEntryFocus",p={bubbles:!1,cancelable:!0},v="RovingFocusGroup",[m,w,b]=(0,r.createCollection)(v),[g,R]=(0,i.createContextScope)(v,[b]),[h,E]=g(v),F=t.forwardRef((e,t)=>(0,f.jsx)(m.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,f.jsx)(m.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,f.jsx)(y,{...e,ref:t})})}));F.displayName=v;var y=t.forwardRef((e,r)=>{let{__scopeRovingFocusGroup:i,orientation:s,loop:v=!1,dir:m,currentTabStopId:b,defaultCurrentTabStopId:g,onCurrentTabStopIdChange:R,onEntryFocus:E,preventScrollOnEntryFocus:F=!1,...y}=e,A=t.useRef(null),I=(0,n.useComposedRefs)(r,A),x=(0,c.useDirection)(m),[C=null,D]=(0,l.useControllableState)({prop:b,defaultProp:g,onChange:R}),[S,K]=t.useState(!1),P=(0,u.useCallbackRef)(E),j=w(i),k=t.useRef(!1),[H,G]=t.useState(0);return t.useEffect(()=>{let e=A.current;if(e)return e.addEventListener(d,P),()=>e.removeEventListener(d,P)},[P]),(0,f.jsx)(h,{scope:i,orientation:s,dir:x,loop:v,currentTabStopId:C,onItemFocus:t.useCallback(e=>D(e),[D]),onItemShiftTab:t.useCallback(()=>K(!0),[]),onFocusableItemAdd:t.useCallback(()=>G(e=>e+1),[]),onFocusableItemRemove:t.useCallback(()=>G(e=>e-1),[]),children:(0,f.jsx)(a.Primitive.div,{tabIndex:S||0===H?-1:0,"data-orientation":s,...y,ref:I,style:{outline:"none",...e.style},onMouseDown:(0,o.composeEventHandlers)(e.onMouseDown,()=>{k.current=!0}),onFocus:(0,o.composeEventHandlers)(e.onFocus,e=>{let t=!k.current;if(e.target===e.currentTarget&&t&&!S){let t=new CustomEvent(d,p);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=j().filter(e=>e.focusable);T([e.find(e=>e.active),e.find(e=>e.id===C),...e].filter(Boolean).map(e=>e.ref.current),F)}}k.current=!1}),onBlur:(0,o.composeEventHandlers)(e.onBlur,()=>K(!1))})})}),A="RovingFocusGroupItem",I=t.forwardRef((e,r)=>{let{__scopeRovingFocusGroup:n,focusable:i=!0,active:u=!1,tabStopId:l,...c}=e,d=(0,s.useId)(),p=l||d,v=E(A,n),b=v.currentTabStopId===p,g=w(n),{onFocusableItemAdd:R,onFocusableItemRemove:h}=v;return t.useEffect(()=>{if(i)return R(),()=>h()},[i,R,h]),(0,f.jsx)(m.ItemSlot,{scope:n,id:p,focusable:i,active:u,children:(0,f.jsx)(a.Primitive.span,{tabIndex:b?0:-1,"data-orientation":v.orientation,...c,ref:r,onMouseDown:(0,o.composeEventHandlers)(e.onMouseDown,e=>{i?v.onItemFocus(p):e.preventDefault()}),onFocus:(0,o.composeEventHandlers)(e.onFocus,()=>v.onItemFocus(p)),onKeyDown:(0,o.composeEventHandlers)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void v.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=function(e,t,o){var r;let n=(r=e.key,"rtl"!==o?r:"ArrowLeft"===r?"ArrowRight":"ArrowRight"===r?"ArrowLeft":r);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(n))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(n)))return x[n]}(e,v.orientation,v.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=g().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)n.reverse();else if("prev"===t||"next"===t){var o,r;"prev"===t&&n.reverse();let i=n.indexOf(e.currentTarget);n=v.loop?(o=n,r=i+1,o.map((e,t)=>o[(r+t)%o.length])):n.slice(i+1)}setTimeout(()=>T(n))}})})})});I.displayName=A;var x={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function T(e,t=!1){let o=document.activeElement;for(let r of e)if(r===o||(r.focus({preventScroll:t}),document.activeElement!==o))return}e.s(["Item",()=>I,"Root",()=>F,"createRovingFocusGroupScope",()=>R])}]);