@primer/components 0.0.0-20219283497 → 0.0.0-202192925146
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 +1 -1
- package/dist/browser.esm.js +2 -2
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +2 -2
- package/dist/browser.umd.js.map +1 -1
- package/lib/Dropdown.d.ts +6 -8
- package/lib/NewButton/button.d.ts +9 -11
- package/lib/NewButton/button.js +3 -2
- package/lib-esm/Dropdown.d.ts +6 -8
- package/lib-esm/NewButton/button.d.ts +9 -11
- package/lib-esm/NewButton/button.js +3 -2
- package/package.json +1 -1
package/dist/browser.umd.js
CHANGED
@@ -23,10 +23,10 @@
|
|
23
23
|
${Yr}
|
24
24
|
${e=>((e,t="default")=>({default:`\n padding: 5px 16px;\n color: ${xt("colors.btn.text")({theme:e})};\n background-color: ${xt("colors.btn.bg")({theme:e})};\n border-width: 1px;\n border-style: solid;\n border-color: ${xt("colors.btn.border")({theme:e})};\n box-shadow: ${xt("shadows.btn.shadow")({theme:e}),xt("shadows.btn.insetShadow")({theme:e})};\n &:hover {\n background-color: ${xt("colors.btn.hoverBg")({theme:e})};\n }\n // focus must come before :active so that the active box shadow overrides\n &:focus {\n box-shadow: ${xt("shadows.btn.focusShadow")({theme:e})};\n }\n &:active {\n background-color: ${xt("colors.btn.selectedBg")({theme:e})};\n box-shadow: ${xt("shadows.btn.shadowActive")({theme:e})};\n }\n &:disabled {\n color: ${xt("colors.primer.fg.disabled")({theme:e})};\n }\n `,primary:`\n padding: 5px 16px;\n color: ${xt("colors.btn.primary.text")({theme:e})};\n background-color: ${xt("colors.btn.primary.bg")({theme:e})};\n border-width: 1px;\n border-style: solid;\n border-color: ${xt("colors.border.subtle")({theme:e})};\n box-shadow: ${xt("shadows.btn.primary.shadow")({theme:e})};\n\n &:hover {\n color: ${xt("colors.btn.primary.hoverText")({theme:e})};\n background-color: ${xt("colors.btn.primary.hoverBg")({theme:e})};\n }\n // focus must come before :active so that the active box shadow overrides\n &:focus {\n box-shadow: ${xt("shadows.btn.primary.focusShadow")({theme:e})};\n }\n\n &:active {\n background-color: ${xt("colors.btn.primary.selectedBg")({theme:e})};\n box-shadow: ${xt("shadows.btn.primary.selectedShadow")({theme:e})};\n }\n\n &:disabled {\n color: ${xt("colors.btn.primary.disabledText")({theme:e})};\n background-color: ${xt("colors.btn.primary.disabledBg")({theme:e})};\n }`,danger:`\n padding: 5px 16px;\n color: ${xt("colors.btn.danger.text")({theme:e})};\n border: 1px solid ${xt("colors.btn.border")({theme:e})};\n background-color: ${xt("colors.btn.bg")({theme:e})};\n box-shadow: ${xt("shadows.btn.shadow")({theme:e})};\n\n &:hover {\n color: ${xt("colors.btn.danger.hoverText")({theme:e})};\n background-color: ${xt("colors.btn.danger.hoverBg")({theme:e})};\n border-color: ${xt("colors.btn.danger.hoverBorder")({theme:e})};\n box-shadow: ${xt("shadows.btn.danger.hoverShadow")({theme:e})};\n }\n // focus must come before :active so that the active box shadow overrides\n &:focus {\n border-color: ${xt("colors.btn.danger.focusBorder")({theme:e})};\n box-shadow: ${xt("shadows.btn.danger.focusShadow")({theme:e})};\n }\n\n &:active {\n color: ${xt("colors.btn.danger.selectedText")({theme:e})};\n background-color: ${xt("colors.btn.danger.selectedBg")({theme:e})};\n box-shadow: ${xt("shadows.btn.danger.selectedShadow")({theme:e})};\n border-color: ${xt("colors.btn.danger.selectedBorder")({theme:e})};\n }\n\n &:disabled {\n color: ${xt("colors.btn.danger.disabledText")({theme:e})};\n background-color: ${xt("colors.btn.danger.disabledBg")({theme:e})};\n border-color: ${xt("colors.btn.danger.disabledBorder")({theme:e})};\n }\n `,invisible:`\n padding: 6px 16px;\n color: ${xt("colors.accent.fg")({theme:e})};\n background-color: transparent;\n border: 0;\n border-radius: ${xt("radii.2")({theme:e})};\n box-shadow: none;\n \n &:disabled {\n color: ${xt("colors.primer.fg.disabled")({theme:e})};\n }\n &:focus {\n box-shadow: ${xt("shadows.btn.focusShadow")({theme:e})};\n }\n &:hover {\n background-color: ${xt("colors.btn.hoverBg")({theme:e})};\n }\n &:active {\n background-color: ${xt("colors.btn.selectedBg")({theme:e})};\n }\n `,block:""}[t]))(e.theme,e.variant)}
|
25
25
|
${eo}
|
26
|
-
${e=>e.
|
26
|
+
${e=>e.icon&&!e.children?"padding: 4px 6px;":""}
|
27
27
|
${Kt}
|
28
28
|
${xe}
|
29
|
-
`,ro=t.forwardRef((({children:e,...t},r)=>{const{icon:o,caret:a}=t;let i=!1;o&&!e&&(i=!0);const l={display:"inline-block",...i?{}:{pr:3}};return n.default.createElement(to,Tt({ref:r},t,{iconOnly:i}),o&&n.default.createElement(qt,{sx:l,"aria-hidden":!i},n.default.createElement(o,null)),e,a&&n.default.createElement(qt,{sx:{display:"inline-block",pl:3},"aria-hidden":!0},n.default.createElement(qr,null)))}));ro.displayName="Button",ro.defaultProps={size:"medium"};var oo=Object.assign(ro,{Counter:Qr});const ao={"outside-top":["outside-bottom","outside-right","outside-left","outside-bottom"],"outside-bottom":["outside-top","outside-right","outside-left","outside-bottom"],"outside-left":["outside-right","outside-bottom","outside-top","outside-bottom"],"outside-right":["outside-left","outside-bottom","outside-top","outside-bottom"]};function no(e,t,r={}){const o=function(e){let t=e.parentNode;for(;null!==t;){if(t instanceof HTMLElement&&"static"!==getComputedStyle(t).position)return t;t=t.parentNode}return document.body}(e),a=function(e){let t=e;for(;null!==t&&t!==document.body;){if("visible"!==getComputedStyle(t).overflow)break;t=t.parentNode}const r=t!==document.body&&t instanceof HTMLElement?t:document.body,o=r.getBoundingClientRect(),a=getComputedStyle(r),[n,i,l,d]=[a.borderTopWidth,a.borderLeftWidth,a.borderRightWidth,a.borderBottomWidth].map((e=>parseInt(e,10)||0));return{top:o.top+n,left:o.left+i,width:o.width-l-i,height:Math.max(o.height-n-d,r===document.body?window.innerHeight:-1/0)}}(o),n=getComputedStyle(o),i=o.getBoundingClientRect(),[l,d]=[n.borderTopWidth,n.borderLeftWidth].map((e=>parseInt(e,10)||0));return function(e,t,r,o,{side:a,align:n,allowOutOfBounds:i,anchorOffset:l,alignmentOffset:d}){const s={top:e.top-t.top,left:e.left-t.left,width:e.width,height:e.height};let c=uo(r,o,a,n,l,d),f=a;if(c.top-=t.top,c.left-=t.left,!i){const i=ao[a];let u=0;if(i){let e=a;for(;u<i.length&&go(e,c,s,r);){const a=i[u++];e=a,c=uo(r,o,a,n,l,d),c.top-=t.top,c.left-=t.left,f=a}}c.top<s.top&&(c.top=s.top),c.left<s.left&&(c.left=s.left),c.left+r.width>e.width+s.left&&(c.left=e.width+s.left-r.width),i&&u<i.length&&c.top+r.height>e.height+s.top&&(c.top=e.height+s.top-r.height)}return{...c,anchorSide:f}}(a,{top:i.top+l,left:i.left+d},e.getBoundingClientRect(),t instanceof Element?t.getBoundingClientRect():t,function(e={}){var t,r,o,a,n;const i=null!==(t=e.side)&&void 0!==t?t:io,l=null!==(r=e.align)&&void 0!==r?r:lo;return{side:i,align:l,anchorOffset:null!==(o=e.anchorOffset)&&void 0!==o?o:"inside-center"===i?0:so,alignmentOffset:null!==(a=e.alignmentOffset)&&void 0!==a?a:"center"!==l&&i.startsWith("inside")?co:0,allowOutOfBounds:null!==(n=e.allowOutOfBounds)&&void 0!==n?n:fo}}(r))}const io="outside-bottom",lo="start",so=4,co=4,fo=!1;function uo(e,t,r,o,a,n){const i=t.left+t.width,l=t.top+t.height;let d=-1,s=-1;return"outside-top"===r?d=t.top-a-e.height:"outside-bottom"===r?d=l+a:"outside-left"===r?s=t.left-a-e.width:"outside-right"===r&&(s=i+a),"outside-top"!==r&&"outside-bottom"!==r||(s="start"===o?t.left+n:"center"===o?t.left-(e.width-t.width)/2+n:i-e.width-n),"outside-left"!==r&&"outside-right"!==r||(d="start"===o?t.top+n:"center"===o?t.top-(e.height-t.height)/2+n:l-e.height-n),"inside-top"===r?d=t.top+a:"inside-bottom"===r?d=l-a-e.height:"inside-left"===r?s=t.left+a:"inside-right"===r?s=i-a-e.width:"inside-center"===r&&(s=(i+t.left)/2-e.width/2+a),"inside-top"===r||"inside-bottom"===r?s="start"===o?t.left+n:"center"===o?t.left-(e.width-t.width)/2+n:i-e.width-n:"inside-left"!==r&&"inside-right"!==r&&"inside-center"!==r||(d="start"===o?t.top+n:"center"===o?t.top-(e.height-t.height)/2+n:l-e.height-n),{top:d,left:s}}function go(e,t,r,o){return"outside-top"===e||"outside-bottom"===e?t.top<r.top||t.top+o.height>r.height+r.top:t.left<r.left||t.left+o.width>r.width+r.left}function po(e,t=[]){const r=yr(null==e?void 0:e.floatingElementRef),o=yr(null==e?void 0:e.anchorElementRef),[a,i]=n.default.useState(void 0),l=n.default.useCallback((()=>{r.current instanceof Element&&o.current instanceof Element?i(no(r.current,o.current,e)):i(void 0)}),[r,o,...t]);var d;return n.default.useLayoutEffect(l,[l]),d=l,n.default.useLayoutEffect((()=>{const e=new window.ResizeObserver((()=>d()));return e.observe(document.documentElement),()=>{e.disconnect()}}),[d]),{floatingElementRef:r,anchorElementRef:o,position:a}}Sr();const bo=[];let ho;function mo(e,t=!1){return gr(e,{reverse:t,strict:!0,onlyTabbable:!0}).next().value}function vo(e,t,r){const o=new AbortController,a=null!=r?r:o.signal;let n;function i(r){if(r instanceof HTMLElement&&document.contains(e)){if(e.contains(r))return void(n=r);if(n&&br(n)&&e.contains(n))return void n.focus();if(t&&e.contains(t))return void t.focus();{const t=null===e.getAttribute("tabindex");return t&&e.setAttribute("tabindex","-1"),e.focus(),void(t&&e.addEventListener("blur",(()=>e.removeAttribute("tabindex")),{once:!0}))}}}e.setAttribute("data-focus-trap","active");const l=function(e){const t=new AbortController;return e.addEventListener("abort",(()=>{t.abort()})),t}(a);if(e.addEventListener("keydown",(t=>{if("Tab"!==t.key||t.defaultPrevented)return;const{target:r}=t,o=mo(e),a=mo(e,!0);r===o&&t.shiftKey?(t.preventDefault(),null==a||a.focus()):r!==a||t.shiftKey||(t.preventDefault(),null==o||o.focus())}),{signal:l.signal}),ho){const e=ho;ho.container.setAttribute("data-focus-trap","suspended"),ho.controller.abort(),bo.push(e)}l.signal.addEventListener("abort",(()=>{ho=void 0})),a.addEventListener("abort",(()=>{e.removeAttribute("data-focus-trap");const t=bo.findIndex((t=>t.container===e));t>=0&&bo.splice(t,1),function(){const e=bo.pop();e&&vo(e.container,e.initialFocus,e.originalSignal)}()})),document.addEventListener("focus",(e=>{i(e.target)}),{signal:l.signal,capture:!0}),i(document.activeElement),ho={container:e,controller:l,initialFocus:t,originalSignal:a};const d=bo.findIndex((t=>t.container===e));if(d>=0&&bo.splice(d,1),!r)return o}function xo(e,t=[]){const r=yr(null==e?void 0:e.containerRef),o=yr(null==e?void 0:e.initialFocusRef),a=null==e?void 0:e.disabled,i=n.default.useRef(),l=n.default.useRef(null);function d(){var t;null===(t=i.current)||void 0===t||t.abort(),null!=e&&e.restoreFocusOnCleanUp&&l.current instanceof HTMLElement&&(l.current.focus(),l.current=null)}return l.current||null!=e&&e.disabled||(l.current=document.activeElement),n.default.useEffect((()=>{if(r.current instanceof HTMLElement){var e;if(!a)return i.current=vo(r.current,null!==(e=o.current)&&void 0!==e?e:void 0),()=>{d()};d()}}),[r,o,a,...t]),{containerRef:r,initialFocusRef:o}}function yo(e={},r=[]){const o=yr(e.containerRef),a=!!e.activeDescendantFocus,i=yr("boolean"!=typeof e.activeDescendantFocus&&e.activeDescendantFocus?e.activeDescendantFocus:void 0),l=e.disabled,d=n.default.useRef();return t.useEffect((()=>{if(o.current instanceof HTMLElement&&(!a||i.current instanceof HTMLElement)){if(!l){var t;const r={...e,activeDescendantControl:null!==(t=i.current)&&void 0!==t?t:void 0};return d.current=Pr(o.current,r),()=>{var e;null===(e=d.current)||void 0===e||e.abort()}}var r;null===(r=d.current)||void 0===r||r.abort()}}),[l,...r]),{containerRef:o,activeDescendantControlRef:i}}const wo="__primerPortalRoot__",Bo="__default__",ko={};function $o(){const e=ko.__default__;if(!e||!document.body.contains(e)){let e=document.getElementById(wo);if(!(e instanceof Element)){e=document.createElement("div"),e.setAttribute("id",wo),e.style.position="absolute",e.style.top="0",e.style.left="0";const t=document.querySelector("[data-portal-root]");t?t.appendChild(e):document.body.appendChild(e)}!function(e,t="__default__"){ko[t]=e}(e)}}var So=({children:e,onMount:t,containerName:r})=>{const a=document.createElement("div");a.style.position="relative",a.style.zIndex="1";const i=n.default.useRef(a);return n.default.useLayoutEffect((()=>{let e=r;void 0===e&&(e=Bo,$o());const o=ko[e];if(!o)throw new Error(`Portal container '${r}' is not yet registered. Container must be registered with registerPortal before use.`);const a=i.current;return o.appendChild(a),null==t||t(),()=>{o.removeChild(a)}}),[i]),o.createPortal(e,i.current)};function To(...e){const r=t.useRef(null);return n.default.useLayoutEffect((()=>{function t(t=null){for(const r of e){if(!r)return;"function"==typeof r?r(t):r.current=t}}return t(r.current),()=>{t(r.current)}}),[...e,r.current]),r}const Eo={prefix:String(Math.round(1e10*Math.random())),current:0},Co=n.default.createContext(Eo);let zo=Boolean("undefined"!=typeof window&&window.document&&window.document.createElement);function Ro(e){let r=t.useContext(Co);return r!==Eo||zo||console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server."),t.useMemo((()=>e||"react-aria"+r.prefix+"-"+ ++r.current),[e])}const No="200ms",Ao=i.default("div")`
|
29
|
+
`,ro=t.forwardRef((({children:e,...t},r)=>{const{icon:o,caret:a}=t;let i=!1;o&&!e&&(i=!0);const l={display:"inline-block",...i?{}:{pr:3}};return n.default.createElement(to,Tt({ref:r},t,{iconOnly:i}),o&&n.default.createElement(qt,{sx:l,"aria-hidden":!i},n.default.createElement(o,null)),e,a&&n.default.createElement(qt,{sx:{display:"inline-block",pl:3},"aria-hidden":!0},n.default.createElement(qr,null)))}));ro.displayName="Button",ro.defaultProps={size:"medium",variant:"default"};var oo=Object.assign(ro,{Counter:Qr});const ao={"outside-top":["outside-bottom","outside-right","outside-left","outside-bottom"],"outside-bottom":["outside-top","outside-right","outside-left","outside-bottom"],"outside-left":["outside-right","outside-bottom","outside-top","outside-bottom"],"outside-right":["outside-left","outside-bottom","outside-top","outside-bottom"]};function no(e,t,r={}){const o=function(e){let t=e.parentNode;for(;null!==t;){if(t instanceof HTMLElement&&"static"!==getComputedStyle(t).position)return t;t=t.parentNode}return document.body}(e),a=function(e){let t=e;for(;null!==t&&t!==document.body;){if("visible"!==getComputedStyle(t).overflow)break;t=t.parentNode}const r=t!==document.body&&t instanceof HTMLElement?t:document.body,o=r.getBoundingClientRect(),a=getComputedStyle(r),[n,i,l,d]=[a.borderTopWidth,a.borderLeftWidth,a.borderRightWidth,a.borderBottomWidth].map((e=>parseInt(e,10)||0));return{top:o.top+n,left:o.left+i,width:o.width-l-i,height:Math.max(o.height-n-d,r===document.body?window.innerHeight:-1/0)}}(o),n=getComputedStyle(o),i=o.getBoundingClientRect(),[l,d]=[n.borderTopWidth,n.borderLeftWidth].map((e=>parseInt(e,10)||0));return function(e,t,r,o,{side:a,align:n,allowOutOfBounds:i,anchorOffset:l,alignmentOffset:d}){const s={top:e.top-t.top,left:e.left-t.left,width:e.width,height:e.height};let c=uo(r,o,a,n,l,d),f=a;if(c.top-=t.top,c.left-=t.left,!i){const i=ao[a];let u=0;if(i){let e=a;for(;u<i.length&&go(e,c,s,r);){const a=i[u++];e=a,c=uo(r,o,a,n,l,d),c.top-=t.top,c.left-=t.left,f=a}}c.top<s.top&&(c.top=s.top),c.left<s.left&&(c.left=s.left),c.left+r.width>e.width+s.left&&(c.left=e.width+s.left-r.width),i&&u<i.length&&c.top+r.height>e.height+s.top&&(c.top=e.height+s.top-r.height)}return{...c,anchorSide:f}}(a,{top:i.top+l,left:i.left+d},e.getBoundingClientRect(),t instanceof Element?t.getBoundingClientRect():t,function(e={}){var t,r,o,a,n;const i=null!==(t=e.side)&&void 0!==t?t:io,l=null!==(r=e.align)&&void 0!==r?r:lo;return{side:i,align:l,anchorOffset:null!==(o=e.anchorOffset)&&void 0!==o?o:"inside-center"===i?0:so,alignmentOffset:null!==(a=e.alignmentOffset)&&void 0!==a?a:"center"!==l&&i.startsWith("inside")?co:0,allowOutOfBounds:null!==(n=e.allowOutOfBounds)&&void 0!==n?n:fo}}(r))}const io="outside-bottom",lo="start",so=4,co=4,fo=!1;function uo(e,t,r,o,a,n){const i=t.left+t.width,l=t.top+t.height;let d=-1,s=-1;return"outside-top"===r?d=t.top-a-e.height:"outside-bottom"===r?d=l+a:"outside-left"===r?s=t.left-a-e.width:"outside-right"===r&&(s=i+a),"outside-top"!==r&&"outside-bottom"!==r||(s="start"===o?t.left+n:"center"===o?t.left-(e.width-t.width)/2+n:i-e.width-n),"outside-left"!==r&&"outside-right"!==r||(d="start"===o?t.top+n:"center"===o?t.top-(e.height-t.height)/2+n:l-e.height-n),"inside-top"===r?d=t.top+a:"inside-bottom"===r?d=l-a-e.height:"inside-left"===r?s=t.left+a:"inside-right"===r?s=i-a-e.width:"inside-center"===r&&(s=(i+t.left)/2-e.width/2+a),"inside-top"===r||"inside-bottom"===r?s="start"===o?t.left+n:"center"===o?t.left-(e.width-t.width)/2+n:i-e.width-n:"inside-left"!==r&&"inside-right"!==r&&"inside-center"!==r||(d="start"===o?t.top+n:"center"===o?t.top-(e.height-t.height)/2+n:l-e.height-n),{top:d,left:s}}function go(e,t,r,o){return"outside-top"===e||"outside-bottom"===e?t.top<r.top||t.top+o.height>r.height+r.top:t.left<r.left||t.left+o.width>r.width+r.left}function po(e,t=[]){const r=yr(null==e?void 0:e.floatingElementRef),o=yr(null==e?void 0:e.anchorElementRef),[a,i]=n.default.useState(void 0),l=n.default.useCallback((()=>{r.current instanceof Element&&o.current instanceof Element?i(no(r.current,o.current,e)):i(void 0)}),[r,o,...t]);var d;return n.default.useLayoutEffect(l,[l]),d=l,n.default.useLayoutEffect((()=>{const e=new window.ResizeObserver((()=>d()));return e.observe(document.documentElement),()=>{e.disconnect()}}),[d]),{floatingElementRef:r,anchorElementRef:o,position:a}}Sr();const bo=[];let ho;function mo(e,t=!1){return gr(e,{reverse:t,strict:!0,onlyTabbable:!0}).next().value}function vo(e,t,r){const o=new AbortController,a=null!=r?r:o.signal;let n;function i(r){if(r instanceof HTMLElement&&document.contains(e)){if(e.contains(r))return void(n=r);if(n&&br(n)&&e.contains(n))return void n.focus();if(t&&e.contains(t))return void t.focus();{const t=null===e.getAttribute("tabindex");return t&&e.setAttribute("tabindex","-1"),e.focus(),void(t&&e.addEventListener("blur",(()=>e.removeAttribute("tabindex")),{once:!0}))}}}e.setAttribute("data-focus-trap","active");const l=function(e){const t=new AbortController;return e.addEventListener("abort",(()=>{t.abort()})),t}(a);if(e.addEventListener("keydown",(t=>{if("Tab"!==t.key||t.defaultPrevented)return;const{target:r}=t,o=mo(e),a=mo(e,!0);r===o&&t.shiftKey?(t.preventDefault(),null==a||a.focus()):r!==a||t.shiftKey||(t.preventDefault(),null==o||o.focus())}),{signal:l.signal}),ho){const e=ho;ho.container.setAttribute("data-focus-trap","suspended"),ho.controller.abort(),bo.push(e)}l.signal.addEventListener("abort",(()=>{ho=void 0})),a.addEventListener("abort",(()=>{e.removeAttribute("data-focus-trap");const t=bo.findIndex((t=>t.container===e));t>=0&&bo.splice(t,1),function(){const e=bo.pop();e&&vo(e.container,e.initialFocus,e.originalSignal)}()})),document.addEventListener("focus",(e=>{i(e.target)}),{signal:l.signal,capture:!0}),i(document.activeElement),ho={container:e,controller:l,initialFocus:t,originalSignal:a};const d=bo.findIndex((t=>t.container===e));if(d>=0&&bo.splice(d,1),!r)return o}function xo(e,t=[]){const r=yr(null==e?void 0:e.containerRef),o=yr(null==e?void 0:e.initialFocusRef),a=null==e?void 0:e.disabled,i=n.default.useRef(),l=n.default.useRef(null);function d(){var t;null===(t=i.current)||void 0===t||t.abort(),null!=e&&e.restoreFocusOnCleanUp&&l.current instanceof HTMLElement&&(l.current.focus(),l.current=null)}return l.current||null!=e&&e.disabled||(l.current=document.activeElement),n.default.useEffect((()=>{if(r.current instanceof HTMLElement){var e;if(!a)return i.current=vo(r.current,null!==(e=o.current)&&void 0!==e?e:void 0),()=>{d()};d()}}),[r,o,a,...t]),{containerRef:r,initialFocusRef:o}}function yo(e={},r=[]){const o=yr(e.containerRef),a=!!e.activeDescendantFocus,i=yr("boolean"!=typeof e.activeDescendantFocus&&e.activeDescendantFocus?e.activeDescendantFocus:void 0),l=e.disabled,d=n.default.useRef();return t.useEffect((()=>{if(o.current instanceof HTMLElement&&(!a||i.current instanceof HTMLElement)){if(!l){var t;const r={...e,activeDescendantControl:null!==(t=i.current)&&void 0!==t?t:void 0};return d.current=Pr(o.current,r),()=>{var e;null===(e=d.current)||void 0===e||e.abort()}}var r;null===(r=d.current)||void 0===r||r.abort()}}),[l,...r]),{containerRef:o,activeDescendantControlRef:i}}const wo="__primerPortalRoot__",Bo="__default__",ko={};function $o(){const e=ko.__default__;if(!e||!document.body.contains(e)){let e=document.getElementById(wo);if(!(e instanceof Element)){e=document.createElement("div"),e.setAttribute("id",wo),e.style.position="absolute",e.style.top="0",e.style.left="0";const t=document.querySelector("[data-portal-root]");t?t.appendChild(e):document.body.appendChild(e)}!function(e,t="__default__"){ko[t]=e}(e)}}var So=({children:e,onMount:t,containerName:r})=>{const a=document.createElement("div");a.style.position="relative",a.style.zIndex="1";const i=n.default.useRef(a);return n.default.useLayoutEffect((()=>{let e=r;void 0===e&&(e=Bo,$o());const o=ko[e];if(!o)throw new Error(`Portal container '${r}' is not yet registered. Container must be registered with registerPortal before use.`);const a=i.current;return o.appendChild(a),null==t||t(),()=>{o.removeChild(a)}}),[i]),o.createPortal(e,i.current)};function To(...e){const r=t.useRef(null);return n.default.useLayoutEffect((()=>{function t(t=null){for(const r of e){if(!r)return;"function"==typeof r?r(t):r.current=t}}return t(r.current),()=>{t(r.current)}}),[...e,r.current]),r}const Eo={prefix:String(Math.round(1e10*Math.random())),current:0},Co=n.default.createContext(Eo);let zo=Boolean("undefined"!=typeof window&&window.document&&window.document.createElement);function Ro(e){let r=t.useContext(Co);return r!==Eo||zo||console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server."),t.useMemo((()=>e||"react-aria"+r.prefix+"-"+ ++r.current),[e])}const No="200ms",Ao=i.default("div")`
|
30
30
|
position: fixed;
|
31
31
|
top: 0;
|
32
32
|
left: 0;
|