@blakesteve/roster 5.11.0 → 5.13.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.
- package/README.md +137 -16
- package/dist/components/atoms/Chip/chip-variants.cjs +1 -1
- package/dist/components/atoms/Chip/chip-variants.js +8 -2
- package/dist/components/atoms/Combobox/Combobox.cjs +1 -1
- package/dist/components/atoms/Combobox/Combobox.js +20 -18
- package/dist/components/atoms/MultiSelect/MultiSelect.cjs +1 -1
- package/dist/components/atoms/MultiSelect/MultiSelect.js +22 -20
- package/dist/components/atoms/Select/Select.cjs +1 -1
- package/dist/components/atoms/Select/Select.js +19 -17
- package/dist/components/molecules/Carousel/Carousel.cjs +1 -1
- package/dist/components/molecules/Carousel/Carousel.js +31 -29
- package/dist/components/molecules/FileUpload/FileUpload.cjs +1 -1
- package/dist/components/molecules/FileUpload/FileUpload.js +21 -19
- package/dist/components/molecules/LiquidTabs/LiquidCount.cjs +1 -0
- package/dist/components/molecules/LiquidTabs/LiquidCount.d.ts +29 -0
- package/dist/components/molecules/LiquidTabs/LiquidCount.js +21 -0
- package/dist/components/molecules/LiquidTabs/LiquidNav.cjs +1 -1
- package/dist/components/molecules/LiquidTabs/LiquidNav.d.ts +12 -1
- package/dist/components/molecules/LiquidTabs/LiquidNav.js +50 -44
- package/dist/components/molecules/LiquidTabs/LiquidTabPanel.cjs +1 -0
- package/dist/components/molecules/LiquidTabs/LiquidTabPanel.d.ts +52 -0
- package/dist/components/molecules/LiquidTabs/LiquidTabPanel.js +32 -0
- package/dist/components/molecules/LiquidTabs/LiquidTabs.cjs +1 -1
- package/dist/components/molecules/LiquidTabs/LiquidTabs.d.ts +20 -1
- package/dist/components/molecules/LiquidTabs/LiquidTabs.js +59 -52
- package/dist/components/molecules/LiquidTabs/liquid-count.cjs +1 -0
- package/dist/components/molecules/LiquidTabs/liquid-count.d.ts +37 -0
- package/dist/components/molecules/LiquidTabs/liquid-count.js +9 -0
- package/dist/components/molecules/Menu/Menu.cjs +1 -1
- package/dist/components/molecules/Menu/Menu.js +104 -102
- package/dist/components/molecules/RadioGroup/RadioGroup.cjs +1 -1
- package/dist/components/molecules/RadioGroup/RadioGroup.js +23 -21
- package/dist/components/molecules/RangeSlider/RangeSlider.cjs +1 -1
- package/dist/components/molecules/RangeSlider/RangeSlider.d.ts +8 -3
- package/dist/components/molecules/RangeSlider/RangeSlider.js +38 -36
- package/dist/components/molecules/Slider/Slider.cjs +1 -1
- package/dist/components/molecules/Slider/Slider.d.ts +7 -3
- package/dist/components/molecules/Slider/Slider.js +30 -28
- package/dist/components/molecules/Slider/track-parts.d.ts +2 -1
- package/dist/components/organisms/Dialog/Dialog.cjs +1 -1
- package/dist/components/organisms/Dialog/Dialog.js +19 -17
- package/dist/components/organisms/ModerationQueue/ModerationQueue.cjs +1 -1
- package/dist/components/organisms/ModerationQueue/ModerationQueue.js +230 -207
- package/dist/components/organisms/Navbar/Navbar.cjs +1 -1
- package/dist/components/organisms/Navbar/Navbar.js +24 -22
- package/dist/components/organisms/Sheet/Sheet.cjs +1 -1
- package/dist/components/organisms/Sheet/Sheet.js +25 -23
- package/dist/index.d.ts +2 -0
- package/dist/internal/key-focus.cjs +1 -0
- package/dist/internal/key-focus.d.ts +32 -0
- package/dist/internal/key-focus.js +60 -0
- package/dist/internal/popup.cjs +1 -1
- package/dist/internal/popup.d.ts +15 -1
- package/dist/internal/popup.js +17 -12
- package/dist/meta.json +3 -3
- package/dist/roster.cjs +1 -1
- package/dist/roster.css +1 -1
- package/dist/roster.js +150 -145
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),m=require("react"),f=require("../../../node_modules/@fortawesome/react-fontawesome/dist/index.cjs"),p=require("../../../node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),n=require("../../../lib/utils.cjs"),cr=require("../../../lib/labels.cjs"),q=require("../../atoms/Button/Button.cjs"),E=require("../../atoms/Link/Link.cjs"),J=require("../../atoms/Badge/Badge.cjs"),dr=require("../../atoms/Avatar/Avatar.cjs"),Q=require("../../atoms/Switch/switch-variants.cjs"),d=require("../../molecules/Menu/Menu.cjs"),lr=require("./navbar-variants.cjs"),L=require("../../../node_modules/@headlessui/react/dist/components/popover/popover.cjs"),ur=require("../../../node_modules/@headlessui/react/dist/components/transition/transition.cjs");function T({on:s,size:e}){return r.jsx("span",{"aria-hidden":"true","data-testid":"navbar-theme-track","data-checked":s?"":void 0,className:n.cn(Q.switchTrackVariants({size:e,variant:"neutral"}),"rst:pointer-events-none"),children:r.jsx("span",{className:n.cn(Q.switchThumbVariants({size:e}))})})}const D="rst:gap-2 rst:px-4 rst:[&>[data-menu-lead]]:w-auto rst:text-gray-700 rst:dark:text-gray-200 rst:focus:bg-gray-50 rst:focus:text-gray-700 rst:dark:focus:bg-gray-700 rst:dark:focus:text-gray-200",xr=n.cn(D,"rst:font-semibold rst:rounded-sm rst:hover:text-gray-900 rst:dark:hover:text-gray-100 rst:hover:focus:text-gray-900 rst:dark:hover:focus:text-gray-100"),W=new WeakMap;function hr(s){if(!s||typeof s=="string")return;let e=W.get(s);return e||(e=a=>r.jsx(s,{...a}),W.set(s,e)),e}const Y=n.cn(D,"rst:border rst:border-transparent rst:font-medium rst:text-gray-600 rst:dark:text-gray-400 rst:focus:text-gray-600 rst:dark:focus:text-gray-400 rst:hover:bg-gray-500/10 rst:dark:hover:bg-gray-400/15 rst:hover:focus:bg-gray-500/10 rst:dark:hover:focus:bg-gray-400/15"),Z=(s,e)=>typeof s=="function"?s({close:e}):s,mr={openMainMenu:"Open main menu",closeMainMenu:"Close menu",openUserMenu:"Open user menu",logIn:"Log In",logOut:"Log Out",darkMode:"Dark Mode",pendingInvitations:"Pending Invitations",inbox:s=>`Inbox (${s})`};function gr(s){return m.useSyncExternalStore(e=>{if(!s||typeof document>"u")return()=>{};const a=new MutationObserver(e);return a.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>a.disconnect()},()=>s&&document.documentElement.classList.contains("dark"),()=>!1)}function H(s,e){if(!e||!s)return!1;if(s.contains(e))return!0;const a=e.closest?.("[data-menu-panel]")?.getAttribute("data-menu-tree");return!!a&&!!s.querySelector(`[data-menu-tree="${CSS.escape(a)}"]`)}const yr='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function fr({close:s,panel:e,hamburger:a}){return m.useEffect(()=>{const x=g=>{const b=g.target;!H(e.current,b)&&!a.current?.contains(b)&&s()};return document.addEventListener("pointerdown",x,{capture:!0}),()=>document.removeEventListener("pointerdown",x,{capture:!0})},[s,e,a]),null}function pr({close:s,panel:e}){return m.useEffect(()=>{const a=g=>{g.target!==e.current?.parentElement&&(H(e.current,g.target)||s())},x=requestAnimationFrame(()=>{e.current?.querySelector(yr)?.focus(),document.addEventListener("focusin",a)});return()=>{cancelAnimationFrame(x),document.removeEventListener("focusin",a)}},[s,e]),null}function vr({activePath:s,close:e}){const a=m.useRef(s);return m.useEffect(()=>{a.current!==s&&(a.current=s,e())},[s,e]),null}const br=({logoSrc:s,logoSize:e="2rem",logoHeight:a,logoWidth:x,logoClassName:g,brandName:b,items:_,activePath:w,routerElement:k,user:i,onLogin:M,onLogout:S,onInboxClick:j,onThemeToggle:v,actions:rr,brandElement:z,navActions:tr,userMenuItems:F=[],className:sr,variant:l="default",position:er="sticky",themeMode:O,labels:ar,notificationVariant:P="error",notificationFill:V="solid",...nr})=>{const o=cr.withLabels(mr,ar),ir=hr(k),N=(i?.notificationCount||0)>0,I=h=>typeof h=="number"?`${h}px`:h,$=a!==void 0||x!==void 0,G=$?{width:x===void 0?"auto":I(x),height:a===void 0?"auto":I(a)}:{width:I(e),height:I(e)},K=$&&"rst:object-contain rst:object-left rst:rtl:object-right",or=gr(O==="auto"),u=(O==="auto"?or?"dark":"light":O??(l==="white"||l==="default"?"light":"dark"))==="dark",A=l==="slate"||l==="primary"||l==="default"&&u||l==="white"&&u||l==="transparent"&&u,B=l==="primary"?{brand:"rst:text-primary-700-ink rst:hover:text-primary-700-ink/80 rst:dark:text-white rst:dark:hover:text-gray-200",linkBase:"rst:text-primary-700-ink/80 rst:hover:text-primary-700-ink rst:dark:text-gray-300 rst:dark:hover:text-white",linkActive:"rst:text-primary-700-ink rst:font-semibold rst:hover:text-primary-700-ink/80 rst:dark:text-primary-400 rst:dark:hover:text-primary-300",hamburger:"rst:text-primary-700-ink/80 rst:hover:bg-primary-700-ink/10 rst:hover:text-primary-700-ink rst:dark:text-gray-300 rst:dark:hover:bg-white/10 rst:dark:hover:text-white"}:{brand:A?"rst:text-white rst:dark:text-white rst:hover:text-gray-200 rst:dark:hover:text-gray-200":"rst:text-gray-900 rst:dark:text-gray-900 rst:hover:text-gray-600 rst:dark:hover:text-gray-600",linkBase:A?"rst:text-gray-300 rst:dark:text-gray-300 rst:hover:text-white rst:dark:hover:text-white":"rst:text-gray-600 rst:dark:text-gray-600 rst:hover:text-gray-900 rst:dark:hover:text-gray-900",linkActive:A?"rst:text-primary-400 rst:dark:text-primary-400 rst:font-semibold rst:hover:text-primary-300 rst:dark:hover:text-primary-300":"rst:text-primary-600 rst:dark:text-primary-600 rst:font-semibold rst:hover:text-primary-700 rst:dark:hover:text-primary-700",hamburger:A?"rst:text-gray-300 rst:dark:text-gray-300 rst:hover:bg-white/10 rst:dark:hover:bg-white/10 rst:hover:text-white rst:dark:hover:text-white":"rst:text-gray-500 rst:dark:text-gray-500 rst:hover:bg-gray-100 rst:dark:hover:bg-gray-100 rst:hover:text-gray-700 rst:dark:hover:text-gray-700"},R=m.useRef(null),X=m.useRef(null);return r.jsx(L.Popover,{as:"nav",className:n.cn("rst:z-50",lr.navbarVariants({variant:l,position:er}),sr),...nr,children:({open:h,close:c})=>{const C=Z(rr,c),U=Z(tr,c);return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"rst:container rst:mx-auto rst:flex rst:items-center rst:justify-between rst:px-4 rst:h-16",children:[r.jsxs(E.Link,{as:k,href:"/",to:"/",variant:"neutral",underline:"none",className:n.cn("rst:flex rst:items-center rst:gap-3 rst:transition-opacity",B.brand),children:[r.jsx("img",{src:s,alt:"",style:G,className:n.cn("rst:shrink-0",K,g??"rst:rounded-md")}),z??r.jsx("span",{className:"rst:text-xl rst:font-bold rst:tracking-tight",children:b})]}),r.jsxs("div",{className:"rst:hidden rst:md:flex rst:items-center rst:gap-8",children:[r.jsx("div",{className:"rst:flex rst:items-center rst:gap-6",children:_.map(t=>{const y=w===t.path;return r.jsxs(E.Link,{as:k,href:t.path,to:t.path,variant:"neutral",underline:"none",className:n.cn("rst:inline-flex rst:items-center rst:gap-1.5 rst:text-sm rst:transition-colors rst:duration-200",y?B.linkActive:B.linkBase),children:[t.label,t.badge&&r.jsx("span",{className:"rst:inline-flex",children:t.badge})]},t.path)})}),U,C??(i?r.jsx("div",{className:"rst:relative rst:ml-2",children:r.jsxs(d.Menu,{linkComponent:ir,children:[r.jsxs(d.MenuButton,{plain:!0,className:"rst:relative rst:flex rst:rounded-full rst:text-sm rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:focus-visible:ring-offset-2 rst:ring-offset-background rst:before:absolute rst:before:-inset-1.5 rst:before:content-['']",children:[r.jsx("span",{className:"rst:sr-only",children:o.openUserMenu}),r.jsx(dr.Avatar,{"aria-hidden":"true",alt:"",initials:i.initials,src:i.avatarSrc,size:"sm",shape:"circle",colorScheme:i.avatarColor??"primary"}),N&&r.jsx("div",{className:"rst:absolute rst:-top-1 rst:-right-2",children:r.jsx(J.Badge,{fill:V,size:"xs",statusBadge:!0,variant:P,children:i.notificationCount})})]}),r.jsxs(d.MenuItems,{align:"end",offset:8,className:"rst:w-48 rst:min-w-0 rst:bg-white rst:dark:bg-gray-800 rst:ring-black/5 rst:dark:ring-white/10 rst:divide-y rst:divide-gray-100 rst:dark:divide-gray-700",children:[(N&&j||v)&&r.jsxs(d.MenuGroup,{className:"rst:py-1",children:[N&&j&&r.jsx(d.MenuItem,{onSelect:j,className:Y,icon:r.jsx(f.FontAwesomeIcon,{icon:p.faInbox,className:"rst:text-primary-500 rst:w-4"}),children:o.inbox(i.notificationCount??0)}),v&&r.jsx(d.MenuCheckboxItem,{checked:u,onCheckedChange:()=>v(),closeOnSelect:!1,className:D,icon:r.jsx(f.FontAwesomeIcon,{icon:p.faMoon,className:n.cn("rst:w-4 rst:transition-colors",u?"rst:text-amber-500":"rst:text-gray-400")}),indicator:r.jsx(T,{on:u,size:"xs"}),children:r.jsx("span",{className:"rst:font-medium",children:o.darkMode})})]}),F.length>0&&r.jsx(d.MenuGroup,{className:"rst:py-1",children:F.map(t=>r.jsx(d.MenuItem,{href:t.path,badge:t.badge,className:xr,children:t.label},t.path))}),S&&r.jsx(d.MenuGroup,{className:"rst:py-1",children:r.jsx(d.MenuItem,{onSelect:S,className:Y,icon:r.jsx(f.FontAwesomeIcon,{icon:p.faRightFromBracket,className:"rst:text-gray-400 rst:dark:text-gray-500 rst:w-4"}),children:o.logOut})})]})]})}):r.jsx(q.Button,{size:"sm",variant:"solid",colorScheme:"primary",onClick:M,children:o.logIn}))]}),r.jsx("div",{ref:X,"data-roster-hamburger":!0,className:"rst:flex rst:md:hidden",children:r.jsxs(L.PopoverButton,{className:n.cn("rst:inline-flex rst:items-center rst:justify-center rst:rounded-md rst:p-2 rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:focus-visible:ring-offset-2 rst:ring-offset-background",B.hamburger),children:[r.jsx("span",{className:"rst:sr-only",children:o.openMainMenu}),h?r.jsx(f.FontAwesomeIcon,{icon:p.faXmark,className:"rst:block rst:h-6 rst:w-6","aria-hidden":"true"}):r.jsxs("div",{className:"rst:relative",children:[r.jsx(f.FontAwesomeIcon,{icon:p.faBars,className:"rst:block rst:h-6 rst:w-6","aria-hidden":"true"}),N&&r.jsx("span",{className:"rst:absolute rst:top-0 rst:right-0 rst:block rst:h-2.5 rst:w-2.5 rst:rounded-full rst:bg-error-500 rst:ring-2 rst:ring-transparent rst:transform rst:translate-x-1/4 rst:-translate-y-1/4"})]})]})})]}),h&&r.jsx(fr,{close:c,panel:R,hamburger:X}),h&&r.jsx(pr,{close:c,panel:R}),h&&r.jsx(vr,{activePath:w,close:c}),r.jsx(ur.Transition,{as:m.Fragment,enter:"rst:duration-200 rst:ease-out",enterFrom:"rst:opacity-0 rst:scale-95",enterTo:"rst:opacity-100 rst:scale-100",leave:"rst:duration-100 rst:ease-in",leaveFrom:"rst:opacity-100 rst:scale-100",leaveTo:"rst:opacity-0 rst:scale-95",children:r.jsx(L.PopoverPanel,{className:"rst:absolute rst:top-0 rst:inset-x-0 rst:z-50 rst:origin-top-right rst:transform rst:p-2 rst:transition rst:md:hidden",children:r.jsxs("div",{ref:R,"data-roster-mobile-panel":!0,className:"rst:rounded-lg rst:elevation-anchored rst:ring rst:ring-black/5 rst:dark:ring-white/10 rst:divide-y rst:divide-gray-100 rst:dark:divide-gray-700 rst:bg-white rst:dark:bg-gray-800",children:[r.jsxs("div",{className:"rst:px-5 rst:pt-5 rst:pb-6",children:[r.jsxs("div",{className:"rst:flex rst:items-center rst:justify-between",children:[r.jsxs("div",{className:"rst:flex rst:items-center rst:gap-3",children:[r.jsx("img",{src:s,alt:"",style:G,className:n.cn("rst:shrink-0",K,g??"rst:rounded-md")}),z??r.jsx("span",{className:"rst:font-bold rst:text-gray-900 rst:dark:text-white",children:b})]}),r.jsx("div",{className:"rst:-mr-2",children:r.jsxs(L.PopoverButton,{className:"rst:inline-flex rst:items-center rst:justify-center rst:rounded-md rst:p-2 rst:text-gray-400 rst:hover:bg-gray-100 rst:dark:hover:bg-gray-700 rst:hover:text-gray-500 rst:dark:hover:text-white rst:focus:outline-hidden",children:[r.jsx("span",{className:"rst:sr-only",children:o.closeMainMenu}),r.jsx(f.FontAwesomeIcon,{icon:p.faXmark,className:"rst:h-6 rst:w-6","aria-hidden":"true"})]})})]}),r.jsxs("div",{className:"rst:mt-6",children:[U&&r.jsx("div",{className:"rst:mb-4",children:U}),r.jsxs("nav",{className:"rst:grid rst:gap-y-4",children:[_.map(t=>{const y=w===t.path;return r.jsx(E.Link,{as:k,href:t.path,to:t.path,onClick:()=>c(),variant:"neutral",underline:"none",className:n.cn("rst:-m-3 rst:flex rst:items-center rst:rounded-md rst:p-3 rst:transition-colors","rst:hover:bg-gray-50 rst:dark:hover:bg-gray-700",y?"rst:bg-gray-50 rst:dark:bg-gray-700":"rst:text-gray-900 rst:dark:text-gray-100"),children:r.jsxs("span",{className:n.cn("rst:ml-3 rst:inline-flex rst:items-center rst:gap-1.5 rst:text-base rst:font-medium",y?"rst:text-primary-600 rst:dark:text-primary-400 rst:font-bold":"rst:text-gray-900 rst:dark:text-gray-100"),children:[t.label,t.badge&&r.jsx("span",{className:"rst:inline-flex",children:t.badge})]})},t.path)}),i&&F.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("hr",{className:"rst:border-gray-100 rst:dark:border-gray-700"}),F.map(t=>{const y=w===t.path;return r.jsxs(E.Link,{as:k,href:t.path,to:t.path,onClick:()=>c(),variant:"neutral",underline:"none",className:n.cn("rst:-m-3 rst:flex rst:items-center rst:rounded-md rst:p-3 rst:transition-colors","rst:hover:bg-gray-50 rst:dark:hover:bg-gray-700",y?"rst:bg-gray-50 rst:dark:bg-gray-700":"rst:text-gray-900 rst:dark:text-gray-100"),children:[r.jsx("span",{className:n.cn("rst:ml-3 rst:text-base rst:font-medium",y?"rst:text-primary-600 rst:dark:text-primary-400 rst:font-bold":"rst:text-gray-900 rst:dark:text-gray-100"),children:t.label}),t.badge&&r.jsx("span",{className:"rst:ml-2 rst:inline-flex",children:t.badge})]},t.path)})]})]})]})]}),(i||C||M)&&r.jsx("div",{className:"rst:py-6 rst:px-5 rst:space-y-4",children:C||(!i&&M?r.jsx(q.Button,{variant:"solid",colorScheme:"primary",className:"rst:w-full rst:justify-center",onClick:()=>{M(),c()},children:o.logIn}):r.jsxs(r.Fragment,{children:[N&&j&&r.jsx(q.Button,{variant:"ghost",colorScheme:"neutral",onClick:()=>{j?.(),c()},className:"rst:w-full rst:justify-between rst:px-4 rst:text-base rst:font-medium rst:hover:bg-gray-50 rst:dark:hover:bg-gray-700 rst:text-gray-900 rst:dark:text-gray-100",endIcon:r.jsx(J.Badge,{fill:V,size:"xs",statusBadge:!0,variant:P,children:i?.notificationCount}),children:o.pendingInvitations}),v&&r.jsxs("div",{onClick:t=>{t.preventDefault(),v()},role:"switch","aria-checked":u,tabIndex:0,onKeyDown:t=>{t.repeat||(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),v())},className:"rst:flex rst:w-full rst:items-center rst:justify-between rst:rounded-md rst:px-4 rst:py-2 rst:text-base rst:transition-colors rst:cursor-pointer rst:hover:bg-gray-50 rst:dark:hover:bg-gray-700 rst:text-gray-900 rst:dark:text-gray-100",children:[r.jsxs("div",{className:"rst:flex rst:items-center rst:gap-3 rst:font-medium",children:[r.jsx(f.FontAwesomeIcon,{icon:p.faMoon,className:n.cn("rst:w-5 rst:transition-colors",u?"rst:text-amber-500":"rst:text-gray-400")}),r.jsx("span",{children:o.darkMode})]}),r.jsx(T,{on:u,size:"sm"})]}),S&&r.jsx(q.Button,{variant:"outline",colorScheme:"error",className:"rst:w-full rst:justify-center",onClick:()=>{S?.(),c()},children:o.logOut})]}))})]})})})]})}})};exports.Navbar=br;
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),m=require("react"),f=require("../../../node_modules/@fortawesome/react-fontawesome/dist/index.cjs"),p=require("../../../node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),n=require("../../../lib/utils.cjs"),cr=require("../../../lib/labels.cjs"),C=require("../../atoms/Button/Button.cjs"),E=require("../../atoms/Link/Link.cjs"),J=require("../../atoms/Badge/Badge.cjs"),dr=require("../../atoms/Avatar/Avatar.cjs"),Q=require("../../atoms/Switch/switch-variants.cjs"),d=require("../../molecules/Menu/Menu.cjs"),lr=require("./navbar-variants.cjs"),ur=require("../../../internal/key-focus.cjs"),L=require("../../../node_modules/@headlessui/react/dist/components/popover/popover.cjs"),xr=require("../../../node_modules/@headlessui/react/dist/components/transition/transition.cjs");function T({on:s,size:e}){return r.jsx("span",{"aria-hidden":"true","data-testid":"navbar-theme-track","data-checked":s?"":void 0,className:n.cn(Q.switchTrackVariants({size:e,variant:"neutral"}),"rst:pointer-events-none"),children:r.jsx("span",{className:n.cn(Q.switchThumbVariants({size:e}))})})}const D="rst:gap-2 rst:px-4 rst:[&>[data-menu-lead]]:w-auto rst:text-gray-700 rst:dark:text-gray-200 rst:focus:bg-gray-50 rst:focus:text-gray-700 rst:dark:focus:bg-gray-700 rst:dark:focus:text-gray-200",hr=n.cn(D,"rst:font-semibold rst:rounded-sm rst:hover:text-gray-900 rst:dark:hover:text-gray-100 rst:hover:focus:text-gray-900 rst:dark:hover:focus:text-gray-100"),W=new WeakMap;function mr(s){if(!s||typeof s=="string")return;let e=W.get(s);return e||(e=a=>r.jsx(s,{...a}),W.set(s,e)),e}const Y=n.cn(D,"rst:border rst:border-transparent rst:font-medium rst:text-gray-600 rst:dark:text-gray-400 rst:focus:text-gray-600 rst:dark:focus:text-gray-400 rst:hover:bg-gray-500/10 rst:dark:hover:bg-gray-400/15 rst:hover:focus:bg-gray-500/10 rst:dark:hover:focus:bg-gray-400/15"),Z=(s,e)=>typeof s=="function"?s({close:e}):s,gr={openMainMenu:"Open main menu",closeMainMenu:"Close menu",openUserMenu:"Open user menu",logIn:"Log In",logOut:"Log Out",darkMode:"Dark Mode",pendingInvitations:"Pending Invitations",inbox:s=>`Inbox (${s})`};function yr(s){return m.useSyncExternalStore(e=>{if(!s||typeof document>"u")return()=>{};const a=new MutationObserver(e);return a.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>a.disconnect()},()=>s&&document.documentElement.classList.contains("dark"),()=>!1)}function H(s,e){if(!e||!s)return!1;if(s.contains(e))return!0;const a=e.closest?.("[data-menu-panel]")?.getAttribute("data-menu-tree");return!!a&&!!s.querySelector(`[data-menu-tree="${CSS.escape(a)}"]`)}const fr='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function pr({close:s,panel:e,hamburger:a}){return m.useEffect(()=>{const x=g=>{const b=g.target;!H(e.current,b)&&!a.current?.contains(b)&&s()};return document.addEventListener("pointerdown",x,{capture:!0}),()=>document.removeEventListener("pointerdown",x,{capture:!0})},[s,e,a]),null}function vr({close:s,panel:e}){return m.useEffect(()=>{const a=g=>{g.target!==e.current?.parentElement&&(H(e.current,g.target)||s())},x=requestAnimationFrame(()=>{e.current?.querySelector(fr)?.focus(),document.addEventListener("focusin",a)});return()=>{cancelAnimationFrame(x),document.removeEventListener("focusin",a)}},[s,e]),null}function br({activePath:s,close:e}){const a=m.useRef(s);return m.useEffect(()=>{a.current!==s&&(a.current=s,e())},[s,e]),null}const kr=({logoSrc:s,logoSize:e="2rem",logoHeight:a,logoWidth:x,logoClassName:g,brandName:b,items:_,activePath:w,routerElement:k,user:i,onLogin:M,onLogout:S,onInboxClick:j,onThemeToggle:v,actions:rr,brandElement:z,navActions:tr,userMenuItems:F=[],className:sr,variant:l="default",position:er="sticky",themeMode:O,labels:ar,notificationVariant:P="error",notificationFill:K="solid",...nr})=>{ur.useKeyFocus();const o=cr.withLabels(gr,ar),ir=mr(k),N=(i?.notificationCount||0)>0,I=h=>typeof h=="number"?`${h}px`:h,V=a!==void 0||x!==void 0,$=V?{width:x===void 0?"auto":I(x),height:a===void 0?"auto":I(a)}:{width:I(e),height:I(e)},G=V&&"rst:object-contain rst:object-left rst:rtl:object-right",or=yr(O==="auto"),u=(O==="auto"?or?"dark":"light":O??(l==="white"||l==="default"?"light":"dark"))==="dark",A=l==="slate"||l==="primary"||l==="default"&&u||l==="white"&&u||l==="transparent"&&u,B=l==="primary"?{brand:"rst:text-primary-700-ink rst:hover:text-primary-700-ink/80 rst:dark:text-white rst:dark:hover:text-gray-200",linkBase:"rst:text-primary-700-ink/80 rst:hover:text-primary-700-ink rst:dark:text-gray-300 rst:dark:hover:text-white",linkActive:"rst:text-primary-700-ink rst:font-semibold rst:hover:text-primary-700-ink/80 rst:dark:text-primary-400 rst:dark:hover:text-primary-300",hamburger:"rst:text-primary-700-ink/80 rst:hover:bg-primary-700-ink/10 rst:hover:text-primary-700-ink rst:dark:text-gray-300 rst:dark:hover:bg-white/10 rst:dark:hover:text-white"}:{brand:A?"rst:text-white rst:dark:text-white rst:hover:text-gray-200 rst:dark:hover:text-gray-200":"rst:text-gray-900 rst:dark:text-gray-900 rst:hover:text-gray-600 rst:dark:hover:text-gray-600",linkBase:A?"rst:text-gray-300 rst:dark:text-gray-300 rst:hover:text-white rst:dark:hover:text-white":"rst:text-gray-600 rst:dark:text-gray-600 rst:hover:text-gray-900 rst:dark:hover:text-gray-900",linkActive:A?"rst:text-primary-400 rst:dark:text-primary-400 rst:font-semibold rst:hover:text-primary-300 rst:dark:hover:text-primary-300":"rst:text-primary-600 rst:dark:text-primary-600 rst:font-semibold rst:hover:text-primary-700 rst:dark:hover:text-primary-700",hamburger:A?"rst:text-gray-300 rst:dark:text-gray-300 rst:hover:bg-white/10 rst:dark:hover:bg-white/10 rst:hover:text-white rst:dark:hover:text-white":"rst:text-gray-500 rst:dark:text-gray-500 rst:hover:bg-gray-100 rst:dark:hover:bg-gray-100 rst:hover:text-gray-700 rst:dark:hover:text-gray-700"},R=m.useRef(null),X=m.useRef(null);return r.jsx(L.Popover,{as:"nav",className:n.cn("rst:z-50",lr.navbarVariants({variant:l,position:er}),sr),...nr,children:({open:h,close:c})=>{const q=Z(rr,c),U=Z(tr,c);return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"rst:container rst:mx-auto rst:flex rst:items-center rst:justify-between rst:px-4 rst:h-16",children:[r.jsxs(E.Link,{as:k,href:"/",to:"/",variant:"neutral",underline:"none",className:n.cn("rst:flex rst:items-center rst:gap-3 rst:transition-opacity",B.brand),children:[r.jsx("img",{src:s,alt:"",style:$,className:n.cn("rst:shrink-0",G,g??"rst:rounded-md")}),z??r.jsx("span",{className:"rst:text-xl rst:font-bold rst:tracking-tight",children:b})]}),r.jsxs("div",{className:"rst:hidden rst:md:flex rst:items-center rst:gap-8",children:[r.jsx("div",{className:"rst:flex rst:items-center rst:gap-6",children:_.map(t=>{const y=w===t.path;return r.jsxs(E.Link,{as:k,href:t.path,to:t.path,variant:"neutral",underline:"none",className:n.cn("rst:inline-flex rst:items-center rst:gap-1.5 rst:text-sm rst:transition-colors rst:duration-200",y?B.linkActive:B.linkBase),children:[t.label,t.badge&&r.jsx("span",{className:"rst:inline-flex",children:t.badge})]},t.path)})}),U,q??(i?r.jsx("div",{className:"rst:relative rst:ml-2",children:r.jsxs(d.Menu,{linkComponent:ir,children:[r.jsxs(d.MenuButton,{plain:!0,className:"rst:relative rst:flex rst:rounded-full rst:text-sm rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:focus-visible:ring-offset-2 rst:ring-offset-background rst:before:absolute rst:before:-inset-1.5 rst:before:content-['']",children:[r.jsx("span",{className:"rst:sr-only",children:o.openUserMenu}),r.jsx(dr.Avatar,{"aria-hidden":"true",alt:"",initials:i.initials,src:i.avatarSrc,size:"sm",shape:"circle",colorScheme:i.avatarColor??"primary"}),N&&r.jsx("div",{className:"rst:absolute rst:-top-1 rst:-right-2",children:r.jsx(J.Badge,{fill:K,size:"xs",statusBadge:!0,variant:P,children:i.notificationCount})})]}),r.jsxs(d.MenuItems,{align:"end",offset:8,className:"rst:w-48 rst:min-w-0 rst:bg-white rst:dark:bg-gray-800 rst:ring-black/5 rst:dark:ring-white/10 rst:divide-y rst:divide-gray-100 rst:dark:divide-gray-700",children:[(N&&j||v)&&r.jsxs(d.MenuGroup,{className:"rst:py-1",children:[N&&j&&r.jsx(d.MenuItem,{onSelect:j,className:Y,icon:r.jsx(f.FontAwesomeIcon,{icon:p.faInbox,className:"rst:text-primary-500 rst:w-4"}),children:o.inbox(i.notificationCount??0)}),v&&r.jsx(d.MenuCheckboxItem,{checked:u,onCheckedChange:()=>v(),closeOnSelect:!1,className:D,icon:r.jsx(f.FontAwesomeIcon,{icon:p.faMoon,className:n.cn("rst:w-4 rst:transition-colors",u?"rst:text-amber-500":"rst:text-gray-400")}),indicator:r.jsx(T,{on:u,size:"xs"}),children:r.jsx("span",{className:"rst:font-medium",children:o.darkMode})})]}),F.length>0&&r.jsx(d.MenuGroup,{className:"rst:py-1",children:F.map(t=>r.jsx(d.MenuItem,{href:t.path,badge:t.badge,className:hr,children:t.label},t.path))}),S&&r.jsx(d.MenuGroup,{className:"rst:py-1",children:r.jsx(d.MenuItem,{onSelect:S,className:Y,icon:r.jsx(f.FontAwesomeIcon,{icon:p.faRightFromBracket,className:"rst:text-gray-400 rst:dark:text-gray-500 rst:w-4"}),children:o.logOut})})]})]})}):r.jsx(C.Button,{size:"sm",variant:"solid",colorScheme:"primary",onClick:M,children:o.logIn}))]}),r.jsx("div",{ref:X,"data-roster-hamburger":!0,className:"rst:flex rst:md:hidden",children:r.jsxs(L.PopoverButton,{className:n.cn("rst:inline-flex rst:items-center rst:justify-center rst:rounded-md rst:p-2 rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:focus-visible:ring-offset-2 rst:ring-offset-background",B.hamburger),children:[r.jsx("span",{className:"rst:sr-only",children:o.openMainMenu}),h?r.jsx(f.FontAwesomeIcon,{icon:p.faXmark,className:"rst:block rst:h-6 rst:w-6","aria-hidden":"true"}):r.jsxs("div",{className:"rst:relative",children:[r.jsx(f.FontAwesomeIcon,{icon:p.faBars,className:"rst:block rst:h-6 rst:w-6","aria-hidden":"true"}),N&&r.jsx("span",{className:"rst:absolute rst:top-0 rst:right-0 rst:block rst:h-2.5 rst:w-2.5 rst:rounded-full rst:bg-error-500 rst:ring-2 rst:ring-transparent rst:transform rst:translate-x-1/4 rst:-translate-y-1/4"})]})]})})]}),h&&r.jsx(pr,{close:c,panel:R,hamburger:X}),h&&r.jsx(vr,{close:c,panel:R}),h&&r.jsx(br,{activePath:w,close:c}),r.jsx(xr.Transition,{as:m.Fragment,enter:"rst:duration-200 rst:ease-out",enterFrom:"rst:opacity-0 rst:scale-95",enterTo:"rst:opacity-100 rst:scale-100",leave:"rst:duration-100 rst:ease-in",leaveFrom:"rst:opacity-100 rst:scale-100",leaveTo:"rst:opacity-0 rst:scale-95",children:r.jsx(L.PopoverPanel,{className:"rst:absolute rst:top-0 rst:inset-x-0 rst:z-50 rst:origin-top-right rst:transform rst:p-2 rst:transition rst:md:hidden",children:r.jsxs("div",{ref:R,"data-roster-mobile-panel":!0,className:"rst:rounded-lg rst:elevation-anchored rst:ring rst:ring-black/5 rst:dark:ring-white/10 rst:divide-y rst:divide-gray-100 rst:dark:divide-gray-700 rst:bg-white rst:dark:bg-gray-800",children:[r.jsxs("div",{className:"rst:px-5 rst:pt-5 rst:pb-6",children:[r.jsxs("div",{className:"rst:flex rst:items-center rst:justify-between",children:[r.jsxs("div",{className:"rst:flex rst:items-center rst:gap-3",children:[r.jsx("img",{src:s,alt:"",style:$,className:n.cn("rst:shrink-0",G,g??"rst:rounded-md")}),z??r.jsx("span",{className:"rst:font-bold rst:text-gray-900 rst:dark:text-white",children:b})]}),r.jsx("div",{className:"rst:-mr-2",children:r.jsxs(L.PopoverButton,{className:"rst:inline-flex rst:items-center rst:justify-center rst:rounded-md rst:p-2 rst:text-gray-400 rst:hover:bg-gray-100 rst:dark:hover:bg-gray-700 rst:hover:text-gray-500 rst:dark:hover:text-white rst:focus:outline-hidden",children:[r.jsx("span",{className:"rst:sr-only",children:o.closeMainMenu}),r.jsx(f.FontAwesomeIcon,{icon:p.faXmark,className:"rst:h-6 rst:w-6","aria-hidden":"true"})]})})]}),r.jsxs("div",{className:"rst:mt-6",children:[U&&r.jsx("div",{className:"rst:mb-4",children:U}),r.jsxs("nav",{className:"rst:grid rst:gap-y-4",children:[_.map(t=>{const y=w===t.path;return r.jsx(E.Link,{as:k,href:t.path,to:t.path,onClick:()=>c(),variant:"neutral",underline:"none",className:n.cn("rst:-m-3 rst:flex rst:items-center rst:rounded-md rst:p-3 rst:transition-colors","rst:hover:bg-gray-50 rst:dark:hover:bg-gray-700",y?"rst:bg-gray-50 rst:dark:bg-gray-700":"rst:text-gray-900 rst:dark:text-gray-100"),children:r.jsxs("span",{className:n.cn("rst:ml-3 rst:inline-flex rst:items-center rst:gap-1.5 rst:text-base rst:font-medium",y?"rst:text-primary-600 rst:dark:text-primary-400 rst:font-bold":"rst:text-gray-900 rst:dark:text-gray-100"),children:[t.label,t.badge&&r.jsx("span",{className:"rst:inline-flex",children:t.badge})]})},t.path)}),i&&F.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("hr",{className:"rst:border-gray-100 rst:dark:border-gray-700"}),F.map(t=>{const y=w===t.path;return r.jsxs(E.Link,{as:k,href:t.path,to:t.path,onClick:()=>c(),variant:"neutral",underline:"none",className:n.cn("rst:-m-3 rst:flex rst:items-center rst:rounded-md rst:p-3 rst:transition-colors","rst:hover:bg-gray-50 rst:dark:hover:bg-gray-700",y?"rst:bg-gray-50 rst:dark:bg-gray-700":"rst:text-gray-900 rst:dark:text-gray-100"),children:[r.jsx("span",{className:n.cn("rst:ml-3 rst:text-base rst:font-medium",y?"rst:text-primary-600 rst:dark:text-primary-400 rst:font-bold":"rst:text-gray-900 rst:dark:text-gray-100"),children:t.label}),t.badge&&r.jsx("span",{className:"rst:ml-2 rst:inline-flex",children:t.badge})]},t.path)})]})]})]})]}),(i||q||M)&&r.jsx("div",{className:"rst:py-6 rst:px-5 rst:space-y-4",children:q||(!i&&M?r.jsx(C.Button,{variant:"solid",colorScheme:"primary",className:"rst:w-full rst:justify-center",onClick:()=>{M(),c()},children:o.logIn}):r.jsxs(r.Fragment,{children:[N&&j&&r.jsx(C.Button,{variant:"ghost",colorScheme:"neutral",onClick:()=>{j?.(),c()},className:"rst:w-full rst:justify-between rst:px-4 rst:text-base rst:font-medium rst:hover:bg-gray-50 rst:dark:hover:bg-gray-700 rst:text-gray-900 rst:dark:text-gray-100",endIcon:r.jsx(J.Badge,{fill:K,size:"xs",statusBadge:!0,variant:P,children:i?.notificationCount}),children:o.pendingInvitations}),v&&r.jsxs("div",{onClick:t=>{t.preventDefault(),v()},role:"switch","aria-checked":u,tabIndex:0,onKeyDown:t=>{t.repeat||(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),v())},className:"rst:flex rst:w-full rst:items-center rst:justify-between rst:rounded-md rst:px-4 rst:py-2 rst:text-base rst:transition-colors rst:cursor-pointer rst:hover:bg-gray-50 rst:dark:hover:bg-gray-700 rst:text-gray-900 rst:dark:text-gray-100",children:[r.jsxs("div",{className:"rst:flex rst:items-center rst:gap-3 rst:font-medium",children:[r.jsx(f.FontAwesomeIcon,{icon:p.faMoon,className:n.cn("rst:w-5 rst:transition-colors",u?"rst:text-amber-500":"rst:text-gray-400")}),r.jsx("span",{children:o.darkMode})]}),r.jsx(T,{on:u,size:"sm"})]}),S&&r.jsx(C.Button,{variant:"outline",colorScheme:"error",className:"rst:w-full rst:justify-center",onClick:()=>{S?.(),c()},children:o.logOut})]}))})]})})})]})}})};exports.Navbar=kr;
|
|
@@ -12,8 +12,9 @@ import { Avatar as xr } from "../../atoms/Avatar/Avatar.js";
|
|
|
12
12
|
import { switchThumbVariants as vr, switchTrackVariants as br } from "../../atoms/Switch/switch-variants.js";
|
|
13
13
|
import { Menu as kr, MenuButton as Nr, MenuItems as wr, MenuGroup as D, MenuItem as _, MenuCheckboxItem as Mr } from "../../molecules/Menu/Menu.js";
|
|
14
14
|
import { navbarVariants as Sr } from "./navbar-variants.js";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
15
|
+
import { useKeyFocus as Cr } from "../../../internal/key-focus.js";
|
|
16
|
+
import { Popover as Er, PopoverButton as T, PopoverPanel as Fr } from "../../../node_modules/@headlessui/react/dist/components/popover/popover.js";
|
|
17
|
+
import { Transition as Or } from "../../../node_modules/@headlessui/react/dist/components/transition/transition.js";
|
|
17
18
|
function H({ on: e, size: s }) {
|
|
18
19
|
return /* @__PURE__ */ r(
|
|
19
20
|
"span",
|
|
@@ -26,11 +27,11 @@ function H({ on: e, size: s }) {
|
|
|
26
27
|
}
|
|
27
28
|
);
|
|
28
29
|
}
|
|
29
|
-
const K = "rst:gap-2 rst:px-4 rst:[&>[data-menu-lead]]:w-auto rst:text-gray-700 rst:dark:text-gray-200 rst:focus:bg-gray-50 rst:focus:text-gray-700 rst:dark:focus:bg-gray-700 rst:dark:focus:text-gray-200",
|
|
30
|
+
const K = "rst:gap-2 rst:px-4 rst:[&>[data-menu-lead]]:w-auto rst:text-gray-700 rst:dark:text-gray-200 rst:focus:bg-gray-50 rst:focus:text-gray-700 rst:dark:focus:bg-gray-700 rst:dark:focus:text-gray-200", jr = /* @__PURE__ */ i(
|
|
30
31
|
K,
|
|
31
32
|
"rst:font-semibold rst:rounded-sm rst:hover:text-gray-900 rst:dark:hover:text-gray-100 rst:hover:focus:text-gray-900 rst:dark:hover:focus:text-gray-100"
|
|
32
33
|
), rr = /* @__PURE__ */ new WeakMap();
|
|
33
|
-
function
|
|
34
|
+
function Ar(e) {
|
|
34
35
|
if (!e || typeof e == "string") return;
|
|
35
36
|
let s = rr.get(e);
|
|
36
37
|
return s || (s = (n) => /* @__PURE__ */ r(e, { ...n }), rr.set(e, s)), s;
|
|
@@ -38,7 +39,7 @@ function jr(e) {
|
|
|
38
39
|
const tr = /* @__PURE__ */ i(
|
|
39
40
|
K,
|
|
40
41
|
"rst:border rst:border-transparent rst:font-medium rst:text-gray-600 rst:dark:text-gray-400 rst:focus:text-gray-600 rst:dark:focus:text-gray-400 rst:hover:bg-gray-500/10 rst:dark:hover:bg-gray-400/15 rst:hover:focus:bg-gray-500/10 rst:dark:hover:focus:bg-gray-400/15"
|
|
41
|
-
), er = (e, s) => typeof e == "function" ? e({ close: s }) : e,
|
|
42
|
+
), er = (e, s) => typeof e == "function" ? e({ close: s }) : e, Br = {
|
|
42
43
|
openMainMenu: "Open main menu",
|
|
43
44
|
closeMainMenu: "Close menu",
|
|
44
45
|
openUserMenu: "Open user menu",
|
|
@@ -48,7 +49,7 @@ const tr = /* @__PURE__ */ i(
|
|
|
48
49
|
pendingInvitations: "Pending Invitations",
|
|
49
50
|
inbox: (e) => `Inbox (${e})`
|
|
50
51
|
};
|
|
51
|
-
function
|
|
52
|
+
function Ir(e) {
|
|
52
53
|
return ur.useSyncExternalStore(
|
|
53
54
|
(s) => {
|
|
54
55
|
if (!e || typeof document > "u") return () => {
|
|
@@ -69,8 +70,8 @@ function sr(e, s) {
|
|
|
69
70
|
const n = s.closest?.("[data-menu-panel]")?.getAttribute("data-menu-tree");
|
|
70
71
|
return !!n && !!e.querySelector(`[data-menu-tree="${CSS.escape(n)}"]`);
|
|
71
72
|
}
|
|
72
|
-
const
|
|
73
|
-
function
|
|
73
|
+
const Lr = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
74
|
+
function Ur({ close: e, panel: s, hamburger: n }) {
|
|
74
75
|
return z(() => {
|
|
75
76
|
const u = (g) => {
|
|
76
77
|
const x = g.target;
|
|
@@ -79,19 +80,19 @@ function Lr({ close: e, panel: s, hamburger: n }) {
|
|
|
79
80
|
return document.addEventListener("pointerdown", u, { capture: !0 }), () => document.removeEventListener("pointerdown", u, { capture: !0 });
|
|
80
81
|
}, [e, s, n]), null;
|
|
81
82
|
}
|
|
82
|
-
function
|
|
83
|
+
function Dr({ close: e, panel: s }) {
|
|
83
84
|
return z(() => {
|
|
84
85
|
const n = (g) => {
|
|
85
86
|
g.target !== s.current?.parentElement && (sr(s.current, g.target) || e());
|
|
86
87
|
}, u = requestAnimationFrame(() => {
|
|
87
|
-
s.current?.querySelector(
|
|
88
|
+
s.current?.querySelector(Lr)?.focus(), document.addEventListener("focusin", n);
|
|
88
89
|
});
|
|
89
90
|
return () => {
|
|
90
91
|
cancelAnimationFrame(u), document.removeEventListener("focusin", n);
|
|
91
92
|
};
|
|
92
93
|
}, [e, s]), null;
|
|
93
94
|
}
|
|
94
|
-
function
|
|
95
|
+
function _r({
|
|
95
96
|
activePath: e,
|
|
96
97
|
close: s
|
|
97
98
|
}) {
|
|
@@ -100,7 +101,7 @@ function Dr({
|
|
|
100
101
|
n.current !== e && (n.current = e, s());
|
|
101
102
|
}, [e, s]), null;
|
|
102
103
|
}
|
|
103
|
-
const
|
|
104
|
+
const tt = ({
|
|
104
105
|
logoSrc: e,
|
|
105
106
|
logoSize: s = "2rem",
|
|
106
107
|
logoHeight: n,
|
|
@@ -128,10 +129,11 @@ const Hr = ({
|
|
|
128
129
|
notificationFill: V = "solid",
|
|
129
130
|
...dr
|
|
130
131
|
}) => {
|
|
131
|
-
|
|
132
|
+
Cr();
|
|
133
|
+
const c = pr(Br, cr), lr = Ar(v), k = (o?.notificationCount || 0) > 0, C = (h) => typeof h == "number" ? `${h}px` : h, G = n !== void 0 || u !== void 0, X = G ? {
|
|
132
134
|
width: u === void 0 ? "auto" : C(u),
|
|
133
135
|
height: n === void 0 ? "auto" : C(n)
|
|
134
|
-
} : { width: C(s), height: C(s) }, J = G && "rst:object-contain rst:object-left rst:rtl:object-right", mr =
|
|
136
|
+
} : { width: C(s), height: C(s) }, J = G && "rst:object-contain rst:object-left rst:rtl:object-right", mr = Ir(B === "auto"), m = (B === "auto" ? mr ? "dark" : "light" : B ?? (l === "white" || l === "default" ? "light" : "dark")) === "dark", E = l === "slate" || l === "primary" || l === "default" && m || l === "white" && m || l === "transparent" && m, F = l === "primary" ? {
|
|
135
137
|
// On primary-700, text is that fill's ink (the dimmer links at 80%),
|
|
136
138
|
// so a light primary gets dark text. The dark fill is primary-950,
|
|
137
139
|
// which the ink doesn't describe: there it stays the dark surface's
|
|
@@ -147,7 +149,7 @@ const Hr = ({
|
|
|
147
149
|
hamburger: E ? "rst:text-gray-300 rst:dark:text-gray-300 rst:hover:bg-white/10 rst:dark:hover:bg-white/10 rst:hover:text-white rst:dark:hover:text-white" : "rst:text-gray-500 rst:dark:text-gray-500 rst:hover:bg-gray-100 rst:dark:hover:bg-gray-100 rst:hover:text-gray-700 rst:dark:hover:text-gray-700"
|
|
148
150
|
}, I = R(null), Q = R(null);
|
|
149
151
|
return /* @__PURE__ */ r(
|
|
150
|
-
|
|
152
|
+
Er,
|
|
151
153
|
{
|
|
152
154
|
as: "nav",
|
|
153
155
|
className: i("rst:z-50", Sr({ variant: l, position: or }), ir),
|
|
@@ -275,7 +277,7 @@ const Hr = ({
|
|
|
275
277
|
}
|
|
276
278
|
)
|
|
277
279
|
] }),
|
|
278
|
-
S.length > 0 && /* @__PURE__ */ r(D, { className: "rst:py-1", children: S.map((t) => /* @__PURE__ */ r(_, { href: t.path, badge: t.badge, className:
|
|
280
|
+
S.length > 0 && /* @__PURE__ */ r(D, { className: "rst:py-1", children: S.map((t) => /* @__PURE__ */ r(_, { href: t.path, badge: t.badge, className: jr, children: t.label }, t.path)) }),
|
|
279
281
|
M && /* @__PURE__ */ r(D, { className: "rst:py-1", children: /* @__PURE__ */ r(
|
|
280
282
|
_,
|
|
281
283
|
{
|
|
@@ -321,11 +323,11 @@ const Hr = ({
|
|
|
321
323
|
}
|
|
322
324
|
) })
|
|
323
325
|
] }),
|
|
324
|
-
h && /* @__PURE__ */ r(
|
|
325
|
-
h && /* @__PURE__ */ r(
|
|
326
|
-
h && /* @__PURE__ */ r(
|
|
326
|
+
h && /* @__PURE__ */ r(Ur, { close: d, panel: I, hamburger: Q }),
|
|
327
|
+
h && /* @__PURE__ */ r(Dr, { close: d, panel: I }),
|
|
328
|
+
h && /* @__PURE__ */ r(_r, { activePath: N, close: d }),
|
|
327
329
|
/* @__PURE__ */ r(
|
|
328
|
-
|
|
330
|
+
Or,
|
|
329
331
|
{
|
|
330
332
|
as: hr,
|
|
331
333
|
enter: "rst:duration-200 rst:ease-out",
|
|
@@ -335,7 +337,7 @@ const Hr = ({
|
|
|
335
337
|
leaveFrom: "rst:opacity-100 rst:scale-100",
|
|
336
338
|
leaveTo: "rst:opacity-0 rst:scale-95",
|
|
337
339
|
children: /* @__PURE__ */ r(
|
|
338
|
-
|
|
340
|
+
Fr,
|
|
339
341
|
{
|
|
340
342
|
className: "rst:absolute rst:top-0 rst:inset-x-0 rst:z-50 rst:origin-top-right rst:transform rst:p-2 rst:transition rst:md:hidden",
|
|
341
343
|
children: /* @__PURE__ */ a("div", { ref: I, "data-roster-mobile-panel": !0, className: "rst:rounded-lg rst:elevation-anchored rst:ring rst:ring-black/5 rst:dark:ring-white/10 rst:divide-y rst:divide-gray-100 rst:dark:divide-gray-700 rst:bg-white rst:dark:bg-gray-800", children: [
|
|
@@ -531,5 +533,5 @@ const Hr = ({
|
|
|
531
533
|
);
|
|
532
534
|
};
|
|
533
535
|
export {
|
|
534
|
-
|
|
536
|
+
tt as Navbar
|
|
535
537
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),Q=require("react"),Z=require("../../../node_modules/@headlessui/react/dist/components/description/description.cjs"),
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),Q=require("react"),Z=require("../../../node_modules/@headlessui/react/dist/components/description/description.cjs"),b=require("../../../node_modules/@headlessui/react/dist/components/dialog/dialog.cjs"),W=require("../../../node_modules/@headlessui/react/dist/components/transition/transition.cjs"),f=require("../../../lib/utils.cjs"),O=require("../../../lib/labels.cjs"),tt=require("../../../internal/popup.cjs"),et=require("../../../internal/motion.cjs"),rt=require("../../../internal/page-inert.cjs"),S=require("./sheet-drag.cjs"),st=require("./sheet-title.cjs"),nt=require("../../../internal/key-focus.cjs");function ot(r){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const c in r)if(c!=="default"){const l=Object.getOwnPropertyDescriptor(r,c);Object.defineProperty(i,c,l.get?l:{enumerable:!0,get:()=>r[c]})}}return i.default=r,Object.freeze(i)}const n=ot(Q),at={close:"Close"},it="rst:transition-transform rst:duration-(--roster-sheet-enter-duration) rst:ease-(--roster-sheet-enter-easing) rst:data-leave:duration-(--roster-sheet-leave-duration) rst:data-leave:ease-(--roster-sheet-leave-easing) rst:data-closed:translate-y-full",ct="rst:transition-opacity rst:duration-(--roster-sheet-fade-duration) rst:ease-out rst:data-closed:opacity-0",ut="rst:transition-opacity rst:duration-(--roster-sheet-enter-duration) rst:ease-out rst:data-leave:duration-(--roster-sheet-leave-duration) rst:data-closed:opacity-0",lt="rst:transition-opacity rst:duration-(--roster-sheet-fade-duration) rst:ease-out rst:data-closed:opacity-0",dt=["input:not([type=checkbox]):not([type=radio]):not([type=button]):not([type=submit]):not([type=reset]):not([type=range]):not([type=color]):not([type=file]):not([type=image])","textarea","select","[contenteditable]:not([contenteditable=false])"].join(",");function ft(r){return r?"current"in r?r.current:r:null}function pt({target:r}){const i=n.useRef(r),c=n.useRef(!1);return n.useEffect(()=>{i.current=r}),n.useEffect(()=>(c.current=!1,()=>{c.current=!0,queueMicrotask(()=>{if(!c.current)return;const l=ft(i.current);l?.isConnected&&l.focus()})}),[]),null}function ht(){return s.jsx("svg",{"aria-hidden":"true",focusable:"false",viewBox:"0 0 20 20",className:"rst:h-5 rst:w-5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:s.jsx("path",{d:"M5 5l10 10M15 5L5 15"})})}const gt=({isOpen:r,onClose:i,onAfterClose:c,title:l,hideTitle:T=!1,description:D,actions:L,maxWidth:x=560,initialFocus:v,returnFocus:_,busy:p=!1,dragToDismiss:j=!0,contentKey:h,labels:z,className:B,children:Y})=>{nt.useKeyFocus();const K=O.withLabels(at,z),{ref:R,inDarkScope:U}=tt.useDarkScope(),N=et.useReducedMotion();n.useLayoutEffect(()=>{if(r)return rt.lockPage(R.current)},[r,R]);const u=n.useRef(null),C=n.useRef(null),I=n.useRef(null),E=n.useRef(null),k=n.useRef(null),q=n.useId(),g=st.titleSignature(l),w=n.useRef({signature:g,contentKey:h,open:r,busy:p});n.useEffect(()=>{const t=w.current;if(w.current={signature:g,contentKey:h,open:r,busy:p},!t.open||!r)return;const e=t.contentKey!==h,o=t.signature!==g&&!t.busy;!e&&!o||(I.current?.focus(),k.current&&(k.current.scrollTop=0))},[g,h,r,p]),n.useEffect(()=>{if(!r)return;const t=requestAnimationFrame(()=>{const e=u.current,o=document.activeElement;!e||o&&e.contains(o)||(v?.current??E.current)?.focus()});return()=>cancelAnimationFrame(t)},[r,v]);const[P,M]=n.useState(null);n.useEffect(()=>{if(!r)return;const t=window.visualViewport;if(!t)return;const e=()=>{const o=document.activeElement,d=!!o&&!!u.current?.contains(o)&&o.matches(dt);M(d?Math.round(t.height):null)};return t.addEventListener("resize",e),document.addEventListener("focusin",e),document.addEventListener("focusout",e),()=>{t.removeEventListener("resize",e),document.removeEventListener("focusin",e),document.removeEventListener("focusout",e),M(null)}},[r]);const a=n.useRef(null),m=n.useRef(!1),A=n.useRef(r);n.useEffect(()=>{A.current=r},[r]);const y=t=>{u.current?.style.setProperty("--rst-sheet-drag",`${t}px`)},F=t=>{const e=u.current;a.current=null,e&&(delete e.dataset.dragging,t==="close"?(i(),requestAnimationFrame(()=>{A.current&&!a.current&&y(0)})):y(0))};n.useEffect(()=>{!r&&a.current&&(a.current=null,u.current&&delete u.current.dataset.dragging),r&&!a.current&&y(0)},[r]);const V=t=>{a.current||(m.current=!1,!(!j||!r)&&(t.pointerType==="mouse"&&(t.button!==0||!C.current?.contains(t.target))||(a.current={pointerId:t.pointerId,x0:t.clientX,y0:t.clientY,dy:0,phase:"pending",samples:[{t:t.timeStamp,y:t.clientY}]})))},X=t=>{const e=a.current;if(!e||t.pointerId!==e.pointerId)return;const o=t.clientX-e.x0,d=t.clientY-e.y0;if(e.phase==="pending"){if(!S.exceedsSheetTapSlop(o,d))return;if(Math.abs(o)>Math.abs(d)){e.phase="ignored";return}e.phase="dragging",m.current=!0;try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}u.current&&(u.current.dataset.dragging="")}e.phase==="dragging"&&(e.dy=d,e.samples.push({t:t.timeStamp,y:t.clientY}),e.samples.length>32&&e.samples.shift(),y(Math.max(0,d)))},$=t=>{const e=a.current;if(!e||t.pointerId!==e.pointerId)return;if(e.phase!=="dragging"){a.current=null;return}e.samples.push({t:t.timeStamp,y:t.clientY});const o=t.clientY-e.y0,d=u.current?.getBoundingClientRect().height??0;F(S.sheetDragOutcome(o,d,S.sheetReleaseVelocity(e.samples)))},G=t=>{const e=a.current;!e||t.pointerId!==e.pointerId||(e.phase==="dragging"?F("stay"):a.current=null)},H=t=>{!m.current||t.detail===0||(m.current=!1,t.preventDefault(),t.stopPropagation())},J={"--rst-sheet-max-width":typeof x=="number"?`${x}px`:x,...P!==null&&{"--rst-sheet-keyboard-cap":`${P}px`}};return s.jsxs(s.Fragment,{children:[s.jsx("span",{ref:R,hidden:!0}),s.jsxs(b.Dialog,{open:r,as:"div",onClose:i,initialFocus:v??E,className:f.cn("rst:font-ui rst:relative rst:z-50 rst:focus:outline-hidden",U&&"dark"),children:[s.jsx(b.DialogBackdrop,{transition:!0,"data-testid":"sheet-backdrop",className:f.cn("rst:fixed rst:inset-0 rst:bg-[var(--roster-backdrop,var(--roster-sheet-backdrop))]",N?lt:ut)}),s.jsx("div",{className:"rst:fixed rst:inset-0 rst:flex rst:items-end rst:justify-center",children:s.jsx(W.TransitionChild,{afterLeave:c,children:s.jsxs(b.DialogPanel,{ref:u,style:J,"data-testid":"sheet-panel",className:f.cn("rst:relative rst:flex rst:max-h-[min(92dvh,var(--rst-sheet-keyboard-cap,92dvh))] rst:w-full rst:flex-col","rst:md:max-w-(--rst-sheet-max-width)","rst:rounded-t-2xl rst:border rst:border-b-0 rst:elevation-overlay","rst:bg-[var(--roster-popover-bg)] rst:border-[var(--roster-popover-border)] rst:text-[var(--roster-popover-text)]","rst:[--roster-ring-offset:var(--roster-popover-bg)]","rst:pb-[env(safe-area-inset-bottom)]","rst:translate-y-[var(--rst-sheet-drag,0px)]",N?ct:it,"rst:data-dragging:transition-none",B),children:[s.jsxs("div",{"data-testid":"sheet-drag-zone",className:f.cn("rst:shrink-0",j&&"rst:touch-none"),onPointerDown:V,onPointerMove:X,onPointerUp:$,onPointerCancel:G,onClickCapture:H,children:[s.jsx("div",{ref:C,"aria-hidden":"true","data-testid":"sheet-handle",className:f.cn("rst:flex rst:h-11 rst:items-start rst:justify-center rst:pt-2",j&&"rst:cursor-grab rst:active:cursor-grabbing"),children:s.jsx("span",{className:"rst:h-1 rst:w-10 rst:rounded-full rst:bg-current rst:opacity-30"})}),s.jsxs("div",{className:"rst:-mt-3 rst:flex rst:items-start rst:gap-2 rst:px-5 rst:pb-4",children:[s.jsxs("div",{className:"rst:min-w-0 rst:flex-1 rst:pt-2",children:[s.jsx(b.DialogTitle,{as:"h2",id:q,ref:I,tabIndex:-1,className:f.cn("rst:text-lg rst:font-semibold rst:text-inherit rst:focus:outline-hidden",T&&"rst:sr-only"),children:l}),D&&s.jsx(Z.Description,{as:"p",className:"rst:mt-1 rst:text-sm rst:text-inherit rst:opacity-75",children:D})]}),L&&s.jsx("div",{className:"rst:flex rst:h-11 rst:shrink-0 rst:items-center rst:gap-1",children:L}),s.jsx("button",{ref:E,type:"button",onClick:i,"aria-label":K.close,className:"rst:inline-flex rst:size-11 rst:shrink-0 rst:-mr-2 rst:cursor-pointer rst:items-center rst:justify-center rst:rounded-md rst:bg-transparent rst:text-inherit rst:opacity-60 rst:transition-opacity rst:hover:opacity-100 rst:focus:outline-hidden rst:focus-visible:opacity-100 rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:focus-visible:ring-offset-2 rst:ring-offset-background",children:s.jsx(ht,{})})]})]}),s.jsx("div",{ref:k,role:"region","aria-labelledby":q,tabIndex:0,"data-testid":"sheet-content","aria-busy":p||void 0,className:"rst:min-h-0 rst:flex-1 rst:overflow-y-auto rst:overscroll-contain rst:px-5 rst:pb-4 rst:focus:outline-hidden rst:ring-inset rst:focus-visible:ring-2 rst:focus-visible:ring-ring",children:Y}),s.jsx(pt,{target:_})]})})})]})]})};exports.Sheet=gt;
|
|
@@ -11,28 +11,29 @@ import { useReducedMotion as nt } from "../../../internal/motion.js";
|
|
|
11
11
|
import { lockPage as ot } from "../../../internal/page-inert.js";
|
|
12
12
|
import { sheetDragOutcome as at, sheetReleaseVelocity as it, exceedsSheetTapSlop as ct } from "./sheet-drag.js";
|
|
13
13
|
import { titleSignature as ut } from "./sheet-title.js";
|
|
14
|
-
|
|
14
|
+
import { useKeyFocus as lt } from "../../../internal/key-focus.js";
|
|
15
|
+
const dt = { close: "Close" }, ft = "rst:transition-transform rst:duration-(--roster-sheet-enter-duration) rst:ease-(--roster-sheet-enter-easing) rst:data-leave:duration-(--roster-sheet-leave-duration) rst:data-leave:ease-(--roster-sheet-leave-easing) rst:data-closed:translate-y-full", pt = "rst:transition-opacity rst:duration-(--roster-sheet-fade-duration) rst:ease-out rst:data-closed:opacity-0", mt = "rst:transition-opacity rst:duration-(--roster-sheet-enter-duration) rst:ease-out rst:data-leave:duration-(--roster-sheet-leave-duration) rst:data-closed:opacity-0", ht = "rst:transition-opacity rst:duration-(--roster-sheet-fade-duration) rst:ease-out rst:data-closed:opacity-0", gt = [
|
|
15
16
|
"input:not([type=checkbox]):not([type=radio]):not([type=button]):not([type=submit]):not([type=reset]):not([type=range]):not([type=color]):not([type=file]):not([type=image])",
|
|
16
17
|
"textarea",
|
|
17
18
|
"select",
|
|
18
19
|
"[contenteditable]:not([contenteditable=false])"
|
|
19
20
|
].join(",");
|
|
20
|
-
function
|
|
21
|
+
function yt(r) {
|
|
21
22
|
return r ? "current" in r ? r.current : r : null;
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
+
function bt({ target: r }) {
|
|
24
25
|
const u = s.useRef(r), f = s.useRef(!1);
|
|
25
26
|
return s.useEffect(() => {
|
|
26
27
|
u.current = r;
|
|
27
28
|
}), s.useEffect(() => (f.current = !1, () => {
|
|
28
29
|
f.current = !0, queueMicrotask(() => {
|
|
29
30
|
if (!f.current) return;
|
|
30
|
-
const p =
|
|
31
|
+
const p = yt(u.current);
|
|
31
32
|
p?.isConnected && p.focus();
|
|
32
33
|
});
|
|
33
34
|
}), []), null;
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
+
function vt() {
|
|
36
37
|
return /* @__PURE__ */ n(
|
|
37
38
|
"svg",
|
|
38
39
|
{
|
|
@@ -48,7 +49,7 @@ function bt() {
|
|
|
48
49
|
}
|
|
49
50
|
);
|
|
50
51
|
}
|
|
51
|
-
const
|
|
52
|
+
const Mt = ({
|
|
52
53
|
isOpen: r,
|
|
53
54
|
onClose: u,
|
|
54
55
|
onAfterClose: f,
|
|
@@ -66,7 +67,8 @@ const St = ({
|
|
|
66
67
|
className: T,
|
|
67
68
|
children: _
|
|
68
69
|
}) => {
|
|
69
|
-
|
|
70
|
+
lt();
|
|
71
|
+
const q = rt(dt, Y), { ref: R, inDarkScope: $ } = st(), D = nt();
|
|
70
72
|
s.useLayoutEffect(() => {
|
|
71
73
|
if (r)
|
|
72
74
|
return ot(R.current);
|
|
@@ -91,7 +93,7 @@ const St = ({
|
|
|
91
93
|
const t = window.visualViewport;
|
|
92
94
|
if (!t) return;
|
|
93
95
|
const e = () => {
|
|
94
|
-
const o = document.activeElement, c = !!o && !!i.current?.contains(o) && o.matches(
|
|
96
|
+
const o = document.activeElement, c = !!o && !!i.current?.contains(o) && o.matches(gt);
|
|
95
97
|
A(c ? Math.round(t.height) : null);
|
|
96
98
|
};
|
|
97
99
|
return t.addEventListener("resize", e), document.addEventListener("focusin", e), document.addEventListener("focusout", e), () => {
|
|
@@ -113,7 +115,7 @@ const St = ({
|
|
|
113
115
|
s.useEffect(() => {
|
|
114
116
|
!r && a.current && (a.current = null, i.current && delete i.current.dataset.dragging), r && !a.current && b(0);
|
|
115
117
|
}, [r]);
|
|
116
|
-
const
|
|
118
|
+
const K = (t) => {
|
|
117
119
|
a.current || (y.current = !1, !(!E || !r) && (t.pointerType === "mouse" && (t.button !== 0 || !I.current?.contains(t.target)) || (a.current = {
|
|
118
120
|
pointerId: t.pointerId,
|
|
119
121
|
x0: t.clientX,
|
|
@@ -122,7 +124,7 @@ const St = ({
|
|
|
122
124
|
phase: "pending",
|
|
123
125
|
samples: [{ t: t.timeStamp, y: t.clientY }]
|
|
124
126
|
})));
|
|
125
|
-
},
|
|
127
|
+
}, U = (t) => {
|
|
126
128
|
const e = a.current;
|
|
127
129
|
if (!e || t.pointerId !== e.pointerId) return;
|
|
128
130
|
const o = t.clientX - e.x0, c = t.clientY - e.y0;
|
|
@@ -140,7 +142,7 @@ const St = ({
|
|
|
140
142
|
i.current && (i.current.dataset.dragging = "");
|
|
141
143
|
}
|
|
142
144
|
e.phase === "dragging" && (e.dy = c, e.samples.push({ t: t.timeStamp, y: t.clientY }), e.samples.length > 32 && e.samples.shift(), b(Math.max(0, c)));
|
|
143
|
-
},
|
|
145
|
+
}, V = (t) => {
|
|
144
146
|
const e = a.current;
|
|
145
147
|
if (!e || t.pointerId !== e.pointerId) return;
|
|
146
148
|
if (e.phase !== "dragging") {
|
|
@@ -150,10 +152,10 @@ const St = ({
|
|
|
150
152
|
e.samples.push({ t: t.timeStamp, y: t.clientY });
|
|
151
153
|
const o = t.clientY - e.y0, c = i.current?.getBoundingClientRect().height ?? 0;
|
|
152
154
|
j(at(o, c, it(e.samples)));
|
|
153
|
-
},
|
|
155
|
+
}, X = (t) => {
|
|
154
156
|
const e = a.current;
|
|
155
157
|
!e || t.pointerId !== e.pointerId || (e.phase === "dragging" ? j("stay") : a.current = null);
|
|
156
|
-
},
|
|
158
|
+
}, G = (t) => {
|
|
157
159
|
!y.current || t.detail === 0 || (y.current = !1, t.preventDefault(), t.stopPropagation());
|
|
158
160
|
}, Q = {
|
|
159
161
|
"--rst-sheet-max-width": typeof v == "number" ? `${v}px` : v,
|
|
@@ -180,7 +182,7 @@ const St = ({
|
|
|
180
182
|
"data-testid": "sheet-backdrop",
|
|
181
183
|
className: d(
|
|
182
184
|
"rst:fixed rst:inset-0 rst:bg-[var(--roster-backdrop,var(--roster-sheet-backdrop))]",
|
|
183
|
-
D ?
|
|
185
|
+
D ? ht : mt
|
|
184
186
|
)
|
|
185
187
|
}
|
|
186
188
|
),
|
|
@@ -202,7 +204,7 @@ const St = ({
|
|
|
202
204
|
"rst:[--roster-ring-offset:var(--roster-popover-bg)]",
|
|
203
205
|
"rst:pb-[env(safe-area-inset-bottom)]",
|
|
204
206
|
"rst:translate-y-[var(--rst-sheet-drag,0px)]",
|
|
205
|
-
D ?
|
|
207
|
+
D ? pt : ft,
|
|
206
208
|
"rst:data-dragging:transition-none",
|
|
207
209
|
T
|
|
208
210
|
),
|
|
@@ -212,11 +214,11 @@ const St = ({
|
|
|
212
214
|
{
|
|
213
215
|
"data-testid": "sheet-drag-zone",
|
|
214
216
|
className: d("rst:shrink-0", E && "rst:touch-none"),
|
|
215
|
-
onPointerDown:
|
|
216
|
-
onPointerMove:
|
|
217
|
-
onPointerUp:
|
|
218
|
-
onPointerCancel:
|
|
219
|
-
onClickCapture:
|
|
217
|
+
onPointerDown: K,
|
|
218
|
+
onPointerMove: U,
|
|
219
|
+
onPointerUp: V,
|
|
220
|
+
onPointerCancel: X,
|
|
221
|
+
onClickCapture: G,
|
|
220
222
|
children: [
|
|
221
223
|
/* @__PURE__ */ n(
|
|
222
224
|
"div",
|
|
@@ -272,7 +274,7 @@ const St = ({
|
|
|
272
274
|
onClick: u,
|
|
273
275
|
"aria-label": q.close,
|
|
274
276
|
className: "rst:inline-flex rst:size-11 rst:shrink-0 rst:-mr-2 rst:cursor-pointer rst:items-center rst:justify-center rst:rounded-md rst:bg-transparent rst:text-inherit rst:opacity-60 rst:transition-opacity rst:hover:opacity-100 rst:focus:outline-hidden rst:focus-visible:opacity-100 rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:focus-visible:ring-offset-2 rst:ring-offset-background",
|
|
275
|
-
children: /* @__PURE__ */ n(
|
|
277
|
+
children: /* @__PURE__ */ n(vt, {})
|
|
276
278
|
}
|
|
277
279
|
)
|
|
278
280
|
] })
|
|
@@ -292,7 +294,7 @@ const St = ({
|
|
|
292
294
|
children: _
|
|
293
295
|
}
|
|
294
296
|
),
|
|
295
|
-
/* @__PURE__ */ n(
|
|
297
|
+
/* @__PURE__ */ n(bt, { target: B })
|
|
296
298
|
]
|
|
297
299
|
}
|
|
298
300
|
) }) })
|
|
@@ -302,5 +304,5 @@ const St = ({
|
|
|
302
304
|
] });
|
|
303
305
|
};
|
|
304
306
|
export {
|
|
305
|
-
|
|
307
|
+
Mt as Sheet
|
|
306
308
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -63,6 +63,7 @@ export * from './components/molecules/Breadcrumbs/breadcrumb-variants';
|
|
|
63
63
|
export * from './components/molecules/LiquidTabs/LiquidTabs';
|
|
64
64
|
export * from './components/molecules/LiquidTabs/LiquidNav';
|
|
65
65
|
export * from './components/molecules/LiquidTabs/liquid-tab-id';
|
|
66
|
+
export * from './components/molecules/LiquidTabs/LiquidTabPanel';
|
|
66
67
|
export * from './components/molecules/Carousel/Carousel';
|
|
67
68
|
export * from './components/molecules/CallToAction/CallToAction';
|
|
68
69
|
export * from './components/molecules/CallToAction/call-to-action-variants';
|
|
@@ -96,4 +97,5 @@ export * from './components/organisms/Table/Table';
|
|
|
96
97
|
export * from './components/organisms/Table/table-variants';
|
|
97
98
|
export * from './hooks/useCountdown';
|
|
98
99
|
export * from './hooks/useKeySequence';
|
|
100
|
+
export { useKeyFocus, KEY_FOCUS } from './internal/key-focus';
|
|
99
101
|
export * from './lib/utils';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react");function f(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const c in e)if(c!=="default"){const i=Object.getOwnPropertyDescriptor(e,c);Object.defineProperty(t,c,i.get?i:{enumerable:!0,get:()=>e[c]})}}return t.default=e,Object.freeze(t)}const y=f(l),d=new Set(["Tab","Enter"," ","Escape","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),o="data-key-focus";let u=0,r=!1,n=null;const s=()=>{for(const e of document.querySelectorAll(`[${o}]`))e.removeAttribute(o)};function m(e){e.ctrlKey||e.metaKey||e.altKey&&e.key!=="Tab"||d.has(e.key)&&(r=!0)}function p(e){n=[e.clientX,e.clientY],r=!1,s()}function b(e){const t=!n||n[0]!==e.clientX||n[1]!==e.clientY;n=[e.clientX,e.clientY],t&&(r=!1)}function g(e){r&&e.target instanceof Element&&e.target.setAttribute(o,"")}function w(e){e.target instanceof Element&&e.target.removeAttribute(o)}const a=[["keydown",m],["pointerdown",p],["pointermove",b],["focusin",g],["focusout",w]];function E(){if(u+=1,!(u>1))for(const[e,t]of a)document.addEventListener(e,t,{capture:!0,passive:!0})}function A(){if(u-=1,!(u>0)){for(const[e,t]of a)document.removeEventListener(e,t,{capture:!0});r=!1,n=null,s()}}function O(){y.useEffect(()=>(E(),A),[])}exports.KEY_FOCUS=o;exports.useKeyFocus=O;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The attribute the tracker marks keyboard focus with: `data-key-focus`. For
|
|
3
|
+
* a selector or a test of your own, or a control that marks focus itself (a
|
|
4
|
+
* typeahead that moves focus marks the item it lands on). A ring should match
|
|
5
|
+
* it through the `focus-visible` variant rather than on its own: see
|
|
6
|
+
* `useKeyFocus`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const KEY_FOCUS = "data-key-focus";
|
|
9
|
+
/**
|
|
10
|
+
* Keeps the keyboard-mode listeners installed while the calling component is
|
|
11
|
+
* mounted. Every Roster component that moves focus by script, or opens
|
|
12
|
+
* something that does, calls it.
|
|
13
|
+
*
|
|
14
|
+
* **Call it in your own control when** the control moves focus by script in
|
|
15
|
+
* answer to a key (arrows around a hand-drawn wheel, a grid that roves its own
|
|
16
|
+
* focus) and draws its ring with `focus-visible:`. Once the page has been
|
|
17
|
+
* clicked, WebKit doesn't count that focus as the keyboard's, and the ring
|
|
18
|
+
* doesn't show in Safari. With the hook mounted, the element the keys land on
|
|
19
|
+
* carries `data-key-focus` until it loses focus, and the ring follows it once
|
|
20
|
+
* your `focus-visible` variant matches the mark too, the one line Roster's own
|
|
21
|
+
* stylesheet has:
|
|
22
|
+
*
|
|
23
|
+
* ```css
|
|
24
|
+
* @custom-variant focus-visible (&:is(:focus-visible, [data-key-focus]));
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* Focus the keyboard moves on its own, Tab to a button or a field, rings in
|
|
28
|
+
* every engine and needs neither. Calling it beside Roster's components costs
|
|
29
|
+
* nothing more: the listeners are shared, added for the first caller and
|
|
30
|
+
* removed after the last.
|
|
31
|
+
*/
|
|
32
|
+
export declare function useKeyFocus(): void;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as s from "react";
|
|
3
|
+
const f = /* @__PURE__ */ new Set([
|
|
4
|
+
"Tab",
|
|
5
|
+
"Enter",
|
|
6
|
+
" ",
|
|
7
|
+
"Escape",
|
|
8
|
+
"ArrowUp",
|
|
9
|
+
"ArrowDown",
|
|
10
|
+
"ArrowLeft",
|
|
11
|
+
"ArrowRight",
|
|
12
|
+
"Home",
|
|
13
|
+
"End",
|
|
14
|
+
"PageUp",
|
|
15
|
+
"PageDown"
|
|
16
|
+
]), r = "data-key-focus";
|
|
17
|
+
let c = 0, o = !1, e = null;
|
|
18
|
+
const i = () => {
|
|
19
|
+
for (const t of document.querySelectorAll(`[${r}]`)) t.removeAttribute(r);
|
|
20
|
+
};
|
|
21
|
+
function l(t) {
|
|
22
|
+
t.ctrlKey || t.metaKey || t.altKey && t.key !== "Tab" || f.has(t.key) && (o = !0);
|
|
23
|
+
}
|
|
24
|
+
function a(t) {
|
|
25
|
+
e = [t.clientX, t.clientY], o = !1, i();
|
|
26
|
+
}
|
|
27
|
+
function m(t) {
|
|
28
|
+
const n = !e || e[0] !== t.clientX || e[1] !== t.clientY;
|
|
29
|
+
e = [t.clientX, t.clientY], n && (o = !1);
|
|
30
|
+
}
|
|
31
|
+
function y(t) {
|
|
32
|
+
o && t.target instanceof Element && t.target.setAttribute(r, "");
|
|
33
|
+
}
|
|
34
|
+
function p(t) {
|
|
35
|
+
t.target instanceof Element && t.target.removeAttribute(r);
|
|
36
|
+
}
|
|
37
|
+
const u = [
|
|
38
|
+
["keydown", l],
|
|
39
|
+
["pointerdown", a],
|
|
40
|
+
["pointermove", m],
|
|
41
|
+
["focusin", y],
|
|
42
|
+
["focusout", p]
|
|
43
|
+
];
|
|
44
|
+
function d() {
|
|
45
|
+
if (c += 1, !(c > 1))
|
|
46
|
+
for (const [t, n] of u) document.addEventListener(t, n, { capture: !0, passive: !0 });
|
|
47
|
+
}
|
|
48
|
+
function w() {
|
|
49
|
+
if (c -= 1, !(c > 0)) {
|
|
50
|
+
for (const [t, n] of u) document.removeEventListener(t, n, { capture: !0 });
|
|
51
|
+
o = !1, e = null, i();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function E() {
|
|
55
|
+
s.useEffect(() => (d(), w), []);
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
r as KEY_FOCUS,
|
|
59
|
+
E as useKeyFocus
|
|
60
|
+
};
|
package/dist/internal/popup.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react");function a(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const o=a(c);function s(t){const e=t?.closest(".dark");return!!e&&!e.contains(document.body)}function u(){const t=o.useRef(null),[e,r]=o.useState(!1);return o.useLayoutEffect(()=>{r(s(t.current))},[]),{ref:t,inDarkScope:e}}const P=["rst:font-ui","rst:z-50 rst:rounded-md rst:py-1 rst:elevation-anchored rst:ring rst:focus:outline-hidden","rst:bg-[var(--roster-popover-bg)] rst:text-[var(--roster-popover-text)] rst:ring-[var(--roster-popover-border)]","rst:[--anchor-gap:4px]"].join(" ");function i(t,e){return t||e==="slate"}const p="rst:w-(--button-width)",l="rst:w-(--input-width)",O="bottom start";exports.POPUP_ANCHOR=O;exports.POPUP_PANEL=P;exports.POPUP_WIDTH_OF_BUTTON=p;exports.POPUP_WIDTH_OF_INPUT=l;exports.carriesDark=s;exports.popupInDarkPalette=i;exports.useDarkScope=u;
|
package/dist/internal/popup.d.ts
CHANGED
|
@@ -29,13 +29,27 @@ import * as React from "react";
|
|
|
29
29
|
* `@custom-variant dark (&:where(.dark, .dark *))` matches, so this reproduces
|
|
30
30
|
* the cascade rather than second-guessing it. Applying the class to the panel
|
|
31
31
|
* covers the panel itself through the `&:where(.dark, …)` half, and its
|
|
32
|
-
* options through `.dark *`.
|
|
32
|
+
* options through `.dark *`.
|
|
33
|
+
*
|
|
34
|
+
* **Only when the portal leaves the scope.** When `.dark` is on `<html>` or
|
|
35
|
+
* `<body>`, the panel is already inside it and needs nothing. The class isn't
|
|
36
|
+
* harmless there either: it carries Roster's own `.dark` token block, which
|
|
37
|
+
* declares the default palette on the panel itself, over whatever the page set
|
|
38
|
+
* above it. A consumer's `--roster-*` set inline on `<html>`, or under
|
|
39
|
+
* `html.dark`, stopped at every panel, which drew Roster's grays under the
|
|
40
|
+
* consumer's trigger.
|
|
33
41
|
*
|
|
34
42
|
* Read once, on mount. A theme TOGGLE does not need this at all: it flips
|
|
35
43
|
* `.dark` on `<html>`, and the portal is already a descendant of `<html>`. The
|
|
36
44
|
* only case this covers is a scoped `.dark`, which is part of a page's
|
|
37
45
|
* structure rather than something that changes at runtime.
|
|
38
46
|
*/
|
|
47
|
+
/**
|
|
48
|
+
* Whether a panel portaled out from beside `el` must carry `.dark` itself:
|
|
49
|
+
* `el` is in a `.dark` scope, and the scope doesn't contain `<body>`, where
|
|
50
|
+
* the portal lands. See `useDarkScope` for why carrying it otherwise is wrong.
|
|
51
|
+
*/
|
|
52
|
+
export declare function carriesDark(el: Element | null | undefined): boolean;
|
|
39
53
|
export declare function useDarkScope<T extends HTMLElement>(): {
|
|
40
54
|
ref: React.RefObject<T | null>;
|
|
41
55
|
inDarkScope: boolean;
|