@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/CHANGELOG.md
CHANGED
package/dist/browser.esm.js
CHANGED
@@ -23,10 +23,10 @@ import e,{useState as t,useRef as r,useCallback as o,useEffect as a,useMemo as n
|
|
23
23
|
${to}
|
24
24
|
${e=>((e,t="default")=>({default:`\n padding: 5px 16px;\n color: ${Nt("colors.btn.text")({theme:e})};\n background-color: ${Nt("colors.btn.bg")({theme:e})};\n border-width: 1px;\n border-style: solid;\n border-color: ${Nt("colors.btn.border")({theme:e})};\n box-shadow: ${Nt("shadows.btn.shadow")({theme:e}),Nt("shadows.btn.insetShadow")({theme:e})};\n &:hover {\n background-color: ${Nt("colors.btn.hoverBg")({theme:e})};\n }\n // focus must come before :active so that the active box shadow overrides\n &:focus {\n box-shadow: ${Nt("shadows.btn.focusShadow")({theme:e})};\n }\n &:active {\n background-color: ${Nt("colors.btn.selectedBg")({theme:e})};\n box-shadow: ${Nt("shadows.btn.shadowActive")({theme:e})};\n }\n &:disabled {\n color: ${Nt("colors.primer.fg.disabled")({theme:e})};\n }\n `,primary:`\n padding: 5px 16px;\n color: ${Nt("colors.btn.primary.text")({theme:e})};\n background-color: ${Nt("colors.btn.primary.bg")({theme:e})};\n border-width: 1px;\n border-style: solid;\n border-color: ${Nt("colors.border.subtle")({theme:e})};\n box-shadow: ${Nt("shadows.btn.primary.shadow")({theme:e})};\n\n &:hover {\n color: ${Nt("colors.btn.primary.hoverText")({theme:e})};\n background-color: ${Nt("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: ${Nt("shadows.btn.primary.focusShadow")({theme:e})};\n }\n\n &:active {\n background-color: ${Nt("colors.btn.primary.selectedBg")({theme:e})};\n box-shadow: ${Nt("shadows.btn.primary.selectedShadow")({theme:e})};\n }\n\n &:disabled {\n color: ${Nt("colors.btn.primary.disabledText")({theme:e})};\n background-color: ${Nt("colors.btn.primary.disabledBg")({theme:e})};\n }`,danger:`\n padding: 5px 16px;\n color: ${Nt("colors.btn.danger.text")({theme:e})};\n border: 1px solid ${Nt("colors.btn.border")({theme:e})};\n background-color: ${Nt("colors.btn.bg")({theme:e})};\n box-shadow: ${Nt("shadows.btn.shadow")({theme:e})};\n\n &:hover {\n color: ${Nt("colors.btn.danger.hoverText")({theme:e})};\n background-color: ${Nt("colors.btn.danger.hoverBg")({theme:e})};\n border-color: ${Nt("colors.btn.danger.hoverBorder")({theme:e})};\n box-shadow: ${Nt("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: ${Nt("colors.btn.danger.focusBorder")({theme:e})};\n box-shadow: ${Nt("shadows.btn.danger.focusShadow")({theme:e})};\n }\n\n &:active {\n color: ${Nt("colors.btn.danger.selectedText")({theme:e})};\n background-color: ${Nt("colors.btn.danger.selectedBg")({theme:e})};\n box-shadow: ${Nt("shadows.btn.danger.selectedShadow")({theme:e})};\n border-color: ${Nt("colors.btn.danger.selectedBorder")({theme:e})};\n }\n\n &:disabled {\n color: ${Nt("colors.btn.danger.disabledText")({theme:e})};\n background-color: ${Nt("colors.btn.danger.disabledBg")({theme:e})};\n border-color: ${Nt("colors.btn.danger.disabledBorder")({theme:e})};\n }\n `,invisible:`\n padding: 6px 16px;\n color: ${Nt("colors.accent.fg")({theme:e})};\n background-color: transparent;\n border: 0;\n border-radius: ${Nt("radii.2")({theme:e})};\n box-shadow: none;\n \n &:disabled {\n color: ${Nt("colors.primer.fg.disabled")({theme:e})};\n }\n &:focus {\n box-shadow: ${Nt("shadows.btn.focusShadow")({theme:e})};\n }\n &:hover {\n background-color: ${Nt("colors.btn.hoverBg")({theme:e})};\n }\n &:active {\n background-color: ${Nt("colors.btn.selectedBg")({theme:e})};\n }\n `,block:""}[t]))(e.theme,e.variant)}
|
25
25
|
${no}
|
26
|
-
${e=>e.
|
26
|
+
${e=>e.icon&&!e.children?"padding: 4px 6px;":""}
|
27
27
|
${rr}
|
28
28
|
${Ne}
|
29
|
-
`,lo=i((({children:t,...r},o)=>{const{icon:a,caret:n}=r;let i=!1;a&&!t&&(i=!0);const l={display:"inline-block",...i?{}:{pr:3}};return e.createElement(io,Pt({ref:o},r,{iconOnly:i}),a&&e.createElement(or,{sx:l,"aria-hidden":!i},e.createElement(a,null)),t,n&&e.createElement(or,{sx:{display:"inline-block",pl:3},"aria-hidden":!0},e.createElement(Qr,null)))}));lo.displayName="Button",lo.defaultProps={size:"medium"};var so=Object.assign(lo,{Counter:ao});const co={"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 fo(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=mo(r,o,a,n,l,d),f=a;if(c.top-=t.top,c.left-=t.left,!i){const i=co[a];let g=0;if(i){let e=a;for(;g<i.length&&vo(e,c,s,r);){const a=i[g++];e=a,c=mo(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&&g<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:go,l=null!==(r=e.align)&&void 0!==r?r:uo;return{side:i,align:l,anchorOffset:null!==(o=e.anchorOffset)&&void 0!==o?o:"inside-center"===i?0:po,alignmentOffset:null!==(a=e.alignmentOffset)&&void 0!==a?a:"center"!==l&&i.startsWith("inside")?bo:0,allowOutOfBounds:null!==(n=e.allowOutOfBounds)&&void 0!==n?n:ho}}(r))}const go="outside-bottom",uo="start",po=4,bo=4,ho=!1;function mo(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 vo(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 xo(t,r=[]){const o=zr(null==t?void 0:t.floatingElementRef),a=zr(null==t?void 0:t.anchorElementRef),[n,i]=e.useState(void 0),l=e.useCallback((()=>{o.current instanceof Element&&a.current instanceof Element?i(fo(o.current,a.current,t)):i(void 0)}),[o,a,...r]);var d;return e.useLayoutEffect(l,[l]),d=l,e.useLayoutEffect((()=>{const e=new window.ResizeObserver((()=>d()));return e.observe(document.documentElement),()=>{e.disconnect()}}),[d]),{floatingElementRef:o,anchorElementRef:a,position:n}}Lr();const yo=[];let wo;function Bo(e,t=!1){return Br(e,{reverse:t,strict:!0,onlyTabbable:!0}).next().value}function $o(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&&kr(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=Bo(e),a=Bo(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}),wo){const e=wo;wo.container.setAttribute("data-focus-trap","suspended"),wo.controller.abort(),yo.push(e)}l.signal.addEventListener("abort",(()=>{wo=void 0})),a.addEventListener("abort",(()=>{e.removeAttribute("data-focus-trap");const t=yo.findIndex((t=>t.container===e));t>=0&&yo.splice(t,1),function(){const e=yo.pop();e&&$o(e.container,e.initialFocus,e.originalSignal)}()})),document.addEventListener("focus",(e=>{i(e.target)}),{signal:l.signal,capture:!0}),i(document.activeElement),wo={container:e,controller:l,initialFocus:t,originalSignal:a};const d=yo.findIndex((t=>t.container===e));if(d>=0&&yo.splice(d,1),!r)return o}function ko(t,r=[]){const o=zr(null==t?void 0:t.containerRef),a=zr(null==t?void 0:t.initialFocusRef),n=null==t?void 0:t.disabled,i=e.useRef(),l=e.useRef(null);function d(){var e;null===(e=i.current)||void 0===e||e.abort(),null!=t&&t.restoreFocusOnCleanUp&&l.current instanceof HTMLElement&&(l.current.focus(),l.current=null)}return l.current||null!=t&&t.disabled||(l.current=document.activeElement),e.useEffect((()=>{if(o.current instanceof HTMLElement){var e;if(!n)return i.current=$o(o.current,null!==(e=a.current)&&void 0!==e?e:void 0),()=>{d()};d()}}),[o,a,n,...r]),{containerRef:o,initialFocusRef:a}}function To(t={},r=[]){const o=zr(t.containerRef),n=!!t.activeDescendantFocus,i=zr("boolean"!=typeof t.activeDescendantFocus&&t.activeDescendantFocus?t.activeDescendantFocus:void 0),l=t.disabled,d=e.useRef();return a((()=>{if(o.current instanceof HTMLElement&&(!n||i.current instanceof HTMLElement)){if(!l){var e;const r={...t,activeDescendantControl:null!==(e=i.current)&&void 0!==e?e:void 0};return d.current=_r(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 So={};function Eo(){const e=So.__default__;if(!e||!document.body.contains(e)){let e=document.getElementById("__primerPortalRoot__");if(!(e instanceof Element)){e=document.createElement("div"),e.setAttribute("id","__primerPortalRoot__"),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__"){So[t]=e}(e)}}var Co=({children:t,onMount:r,containerName:o})=>{const a=document.createElement("div");a.style.position="relative",a.style.zIndex="1";const n=e.useRef(a);return e.useLayoutEffect((()=>{let e=o;void 0===e&&(e="__default__",Eo());const t=So[e];if(!t)throw new Error(`Portal container '${o}' is not yet registered. Container must be registered with registerPortal before use.`);const a=n.current;return t.appendChild(a),null==r||r(),()=>{t.removeChild(a)}}),[n]),v(t,n.current)};function zo(...t){const o=r(null);return e.useLayoutEffect((()=>{function e(e=null){for(const r of t){if(!r)return;"function"==typeof r?r(e):r.current=e}}return e(o.current),()=>{e(o.current)}}),[...t,o.current]),o}const No={prefix:String(Math.round(1e10*Math.random())),current:0},Io=e.createContext(No);function Ao(t){let r=l(Io),o=n((()=>({prefix:r===No?"":r.prefix+"-"+ ++r.current,current:0})),[r]);return e.createElement(Io.Provider,{value:o},t.children)}let Ro=Boolean("undefined"!=typeof window&&window.document&&window.document.createElement);function Lo(e){let t=l(Io);return t!==No||Ro||console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server."),n((()=>e||"react-aria"+t.prefix+"-"+ ++t.current),[e])}const Oo=f("div")`
|
29
|
+
`,lo=i((({children:t,...r},o)=>{const{icon:a,caret:n}=r;let i=!1;a&&!t&&(i=!0);const l={display:"inline-block",...i?{}:{pr:3}};return e.createElement(io,Pt({ref:o},r,{iconOnly:i}),a&&e.createElement(or,{sx:l,"aria-hidden":!i},e.createElement(a,null)),t,n&&e.createElement(or,{sx:{display:"inline-block",pl:3},"aria-hidden":!0},e.createElement(Qr,null)))}));lo.displayName="Button",lo.defaultProps={size:"medium",variant:"default"};var so=Object.assign(lo,{Counter:ao});const co={"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 fo(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=mo(r,o,a,n,l,d),f=a;if(c.top-=t.top,c.left-=t.left,!i){const i=co[a];let g=0;if(i){let e=a;for(;g<i.length&&vo(e,c,s,r);){const a=i[g++];e=a,c=mo(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&&g<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:go,l=null!==(r=e.align)&&void 0!==r?r:uo;return{side:i,align:l,anchorOffset:null!==(o=e.anchorOffset)&&void 0!==o?o:"inside-center"===i?0:po,alignmentOffset:null!==(a=e.alignmentOffset)&&void 0!==a?a:"center"!==l&&i.startsWith("inside")?bo:0,allowOutOfBounds:null!==(n=e.allowOutOfBounds)&&void 0!==n?n:ho}}(r))}const go="outside-bottom",uo="start",po=4,bo=4,ho=!1;function mo(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 vo(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 xo(t,r=[]){const o=zr(null==t?void 0:t.floatingElementRef),a=zr(null==t?void 0:t.anchorElementRef),[n,i]=e.useState(void 0),l=e.useCallback((()=>{o.current instanceof Element&&a.current instanceof Element?i(fo(o.current,a.current,t)):i(void 0)}),[o,a,...r]);var d;return e.useLayoutEffect(l,[l]),d=l,e.useLayoutEffect((()=>{const e=new window.ResizeObserver((()=>d()));return e.observe(document.documentElement),()=>{e.disconnect()}}),[d]),{floatingElementRef:o,anchorElementRef:a,position:n}}Lr();const yo=[];let wo;function Bo(e,t=!1){return Br(e,{reverse:t,strict:!0,onlyTabbable:!0}).next().value}function $o(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&&kr(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=Bo(e),a=Bo(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}),wo){const e=wo;wo.container.setAttribute("data-focus-trap","suspended"),wo.controller.abort(),yo.push(e)}l.signal.addEventListener("abort",(()=>{wo=void 0})),a.addEventListener("abort",(()=>{e.removeAttribute("data-focus-trap");const t=yo.findIndex((t=>t.container===e));t>=0&&yo.splice(t,1),function(){const e=yo.pop();e&&$o(e.container,e.initialFocus,e.originalSignal)}()})),document.addEventListener("focus",(e=>{i(e.target)}),{signal:l.signal,capture:!0}),i(document.activeElement),wo={container:e,controller:l,initialFocus:t,originalSignal:a};const d=yo.findIndex((t=>t.container===e));if(d>=0&&yo.splice(d,1),!r)return o}function ko(t,r=[]){const o=zr(null==t?void 0:t.containerRef),a=zr(null==t?void 0:t.initialFocusRef),n=null==t?void 0:t.disabled,i=e.useRef(),l=e.useRef(null);function d(){var e;null===(e=i.current)||void 0===e||e.abort(),null!=t&&t.restoreFocusOnCleanUp&&l.current instanceof HTMLElement&&(l.current.focus(),l.current=null)}return l.current||null!=t&&t.disabled||(l.current=document.activeElement),e.useEffect((()=>{if(o.current instanceof HTMLElement){var e;if(!n)return i.current=$o(o.current,null!==(e=a.current)&&void 0!==e?e:void 0),()=>{d()};d()}}),[o,a,n,...r]),{containerRef:o,initialFocusRef:a}}function To(t={},r=[]){const o=zr(t.containerRef),n=!!t.activeDescendantFocus,i=zr("boolean"!=typeof t.activeDescendantFocus&&t.activeDescendantFocus?t.activeDescendantFocus:void 0),l=t.disabled,d=e.useRef();return a((()=>{if(o.current instanceof HTMLElement&&(!n||i.current instanceof HTMLElement)){if(!l){var e;const r={...t,activeDescendantControl:null!==(e=i.current)&&void 0!==e?e:void 0};return d.current=_r(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 So={};function Eo(){const e=So.__default__;if(!e||!document.body.contains(e)){let e=document.getElementById("__primerPortalRoot__");if(!(e instanceof Element)){e=document.createElement("div"),e.setAttribute("id","__primerPortalRoot__"),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__"){So[t]=e}(e)}}var Co=({children:t,onMount:r,containerName:o})=>{const a=document.createElement("div");a.style.position="relative",a.style.zIndex="1";const n=e.useRef(a);return e.useLayoutEffect((()=>{let e=o;void 0===e&&(e="__default__",Eo());const t=So[e];if(!t)throw new Error(`Portal container '${o}' is not yet registered. Container must be registered with registerPortal before use.`);const a=n.current;return t.appendChild(a),null==r||r(),()=>{t.removeChild(a)}}),[n]),v(t,n.current)};function zo(...t){const o=r(null);return e.useLayoutEffect((()=>{function e(e=null){for(const r of t){if(!r)return;"function"==typeof r?r(e):r.current=e}}return e(o.current),()=>{e(o.current)}}),[...t,o.current]),o}const No={prefix:String(Math.round(1e10*Math.random())),current:0},Io=e.createContext(No);function Ao(t){let r=l(Io),o=n((()=>({prefix:r===No?"":r.prefix+"-"+ ++r.current,current:0})),[r]);return e.createElement(Io.Provider,{value:o},t.children)}let Ro=Boolean("undefined"!=typeof window&&window.document&&window.document.createElement);function Lo(e){let t=l(Io);return t!==No||Ro||console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server."),n((()=>e||"react-aria"+t.prefix+"-"+ ++t.current),[e])}const Oo=f("div")`
|
30
30
|
position: fixed;
|
31
31
|
top: 0;
|
32
32
|
left: 0;
|