Module 250634

1,936 characters · in 0438af5e0bf5a2bb.js
Dependencies
Required by (2)
Lazily required by (0)none
Lazily requires (0)none
Source Raw
function(e,t,s){"use strict";s.d(t,{$:()=>n,O:()=>c});var i=s(331250),r=s(693321),l=s(3388),o=s(290424),a=s(64700),d=s(402112);function n(e,t,s){let{isDisabled:i}=e,{toolbarProps:n}=function(e,t){let{"aria-label":s,"aria-labelledby":i,orientation:n="horizontal"}=e,[c,u]=(0,a.useState)(!1);(0,l.N)(()=>{var e;u(!!(t.current&&(null==(e=t.current.parentElement)?void 0:e.closest('[role="toolbar"]'))))});let{direction:v}=(0,d.Y)(),b="rtl"===v&&"horizontal"===n,p=(0,r.C7)(t),f=(0,a.useRef)(null);return{toolbarProps:{...(0,o.$)(e,{labelable:!0}),role:c?"group":"toolbar","aria-orientation":n,"aria-label":s,"aria-labelledby":null==s?i:void 0,onKeyDownCapture:c?void 0:e=>{if(e.currentTarget.contains(e.target)){if("horizontal"===n&&"ArrowRight"===e.key||"vertical"===n&&"ArrowDown"===e.key)b?p.focusPrevious():p.focusNext();else if("horizontal"===n&&"ArrowLeft"===e.key||"vertical"===n&&"ArrowUp"===e.key)b?p.focusNext():p.focusPrevious();else{if("Tab"!==e.key)return;e.stopPropagation(),f.current=document.activeElement,e.shiftKey?p.focusFirst():p.focusLast();return}e.stopPropagation(),e.preventDefault()}},onFocusCapture:c?void 0:e=>{var s,i;f.current&&!e.currentTarget.contains(e.relatedTarget)&&(null==(s=t.current)?void 0:s.contains(e.target))&&(null==(i=f.current)||i.focus(),f.current=null)},onBlurCapture:c?void 0:e=>{e.currentTarget.contains(e.relatedTarget)||f.current||(f.current=e.target)}}}}(e,s);return{groupProps:{...n,role:"single"===t.selectionMode?"radiogroup":n.role,"aria-disabled":i}}}function c(e,t,s){let r={isSelected:t.selectedKeys.has(e.id),defaultSelected:!1,setSelected(s){t.setSelected(e.id,s)},toggle(){t.toggleKey(e.id)}},{isPressed:l,isSelected:o,isDisabled:a,buttonProps:d}=(0,i.q)({...e,id:void 0,isDisabled:e.isDisabled||t.isDisabled},r,s);return"single"===t.selectionMode&&(d.role="radio",d["aria-checked"]=r.isSelected,delete d["aria-pressed"]),{isPressed:l,isSelected:o,isDisabled:a,buttonProps:d}}}