@stokelp/ui 2.119.0 → 2.119.2

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.
@@ -1,2 +1,2 @@
1
- "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utils/slots.cjs"),n=require("../icon-button/IconButton.cjs"),r=require("../drawer/Drawer.cjs");let i=require("@ark-ui/react"),a=require("@stokelp/styled-system/jsx"),o=require("@stokelp/styled-system/recipes"),s=require("react"),c=require("react/jsx-runtime"),l=require("usehooks-ts"),u=require("@stokelp/styled-system/tokens");var d=e.__exportAll({Backdrop:()=>h,Body:()=>x,CloseTrigger:()=>g,Content:()=>v,Footer:()=>S,Header:()=>b,Positioner:()=>C,Root:()=>m,Title:()=>w,Trigger:()=>T}),{withProvider:f,withContext:p}=t.createStyleContext(o.dialog,{dataAttr:!0}),m=f(i.Dialog.Root,void 0,{defaultProps:{lazyMount:!0,unmountOnExit:!0}}),h=p((0,a.styled)(i.Dialog.Backdrop),`backdrop`),g=p((0,a.styled)(i.Dialog.CloseTrigger),`closeTrigger`),_=(0,s.forwardRef)(({children:e,...t},n)=>{let r=(0,l.useMediaQuery)(`(max-width: ${(0,u.token)(`breakpoints.md`)})`,{defaultValue:!1}),{open:a,getContentProps:o}=(0,i.useDialogContext)();return(0,s.useLayoutEffect)(()=>{if(!a)return;let{id:e}=o();e&&setTimeout(()=>{let t=document.getElementById(e);if(t){let e=t.querySelector(`footer`);e&&(r?t.style.setProperty(`--footer-height`,`${Math.ceil(e.clientHeight)}px`):t.style.setProperty(`--footer-height`,`70px`))}},0)},[a,r]),(0,c.jsxs)(i.Portal,{children:[(0,c.jsx)(h,{}),(0,c.jsx)(C,{children:(0,c.jsx)(i.Dialog.Content,{ref:n,...t,children:e})})]})});_.displayName=i.Dialog.Content.displayName;var v=p((0,a.styled)(_),`content`),y=(0,s.forwardRef)(({children:e,showCloseTrigger:t=!0,...a},o)=>(0,c.jsxs)(i.ark.header,{...a,ref:o,children:[e,t&&(0,c.jsx)(r.DrawerCloseTrigger,{asChild:!0,children:(0,c.jsx)(n.IconButton,{ml:`auto`,"aria-label":`close`,variant:`tertiary`,children:(0,c.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,c.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M3.64645 3.64645C3.84171 3.45118 4.15829 3.45118 4.35355 3.64645L8 7.29289L11.6464 3.64645C11.8417 3.45118 12.1583 3.45118 12.3536 3.64645C12.5488 3.84171 12.5488 4.15829 12.3536 4.35355L8.70711 8L12.3536 11.6464C12.5488 11.8417 12.5488 12.1583 12.3536 12.3536C12.1583 12.5488 11.8417 12.5488 11.6464 12.3536L8 8.70711L4.35355 12.3536C4.15829 12.5488 3.84171 12.5488 3.64645 12.3536C3.45118 12.1583 3.45118 11.8417 3.64645 11.6464L7.29289 8L3.64645 4.35355C3.45118 4.15829 3.45118 3.84171 3.64645 3.64645Z`,fill:`currentColor`})})})})]}));y.displayName=`DialogHeader`;var b=p((0,a.styled)(y),`header`),x=p((0,a.styled)(i.ark.main),`body`),S=p((0,a.styled)(i.ark.footer),`footer`),C=p((0,a.styled)(i.Dialog.Positioner),`positioner`),w=p((0,a.styled)(i.Dialog.Title),`title`),T=p((0,a.styled)(i.Dialog.Trigger),`trigger`);Object.defineProperty(exports,"styled_exports",{enumerable:!0,get:function(){return d}});
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utils/slots.cjs"),n=require("../../utils/overlay-lock-cleanup.cjs"),r=require("../icon-button/IconButton.cjs"),i=require("../drawer/Drawer.cjs");let a=require("@ark-ui/react"),o=require("@stokelp/styled-system/jsx"),s=require("@stokelp/styled-system/recipes"),c=require("react"),l=require("react/jsx-runtime"),u=require("usehooks-ts"),d=require("@stokelp/styled-system/tokens");var f=e.__exportAll({Backdrop:()=>g,Body:()=>S,CloseTrigger:()=>_,Content:()=>y,Footer:()=>C,Header:()=>x,Positioner:()=>w,Root:()=>h,Title:()=>T,Trigger:()=>E}),{withProvider:p,withContext:m}=t.createStyleContext(s.dialog,{dataAttr:!0}),h=p(a.Dialog.Root,void 0,{defaultProps:{lazyMount:!0,unmountOnExit:!0}}),g=m((0,o.styled)(a.Dialog.Backdrop),`backdrop`),_=m((0,o.styled)(a.Dialog.CloseTrigger),`closeTrigger`),v=(0,c.forwardRef)(({children:e,...t},r)=>{let i=(0,u.useMediaQuery)(`(max-width: ${(0,d.token)(`breakpoints.md`)})`,{defaultValue:!1}),{open:o,getContentProps:s}=(0,a.useDialogContext)();return n.useReleaseStaleOverlayLocks(o),(0,c.useLayoutEffect)(()=>{if(!o)return;let{id:e}=s();e&&setTimeout(()=>{let t=document.getElementById(e);if(t){let e=t.querySelector(`footer`);e&&(i?t.style.setProperty(`--footer-height`,`${Math.ceil(e.clientHeight)}px`):t.style.setProperty(`--footer-height`,`70px`))}},0)},[o,i]),(0,l.jsxs)(a.Portal,{children:[(0,l.jsx)(g,{}),(0,l.jsx)(w,{children:(0,l.jsx)(a.Dialog.Content,{ref:r,...t,children:e})})]})});v.displayName=a.Dialog.Content.displayName;var y=m((0,o.styled)(v),`content`),b=(0,c.forwardRef)(({children:e,showCloseTrigger:t=!0,...n},o)=>(0,l.jsxs)(a.ark.header,{...n,ref:o,children:[e,t&&(0,l.jsx)(i.DrawerCloseTrigger,{asChild:!0,children:(0,l.jsx)(r.IconButton,{ml:`auto`,"aria-label":`close`,variant:`tertiary`,children:(0,l.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,l.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M3.64645 3.64645C3.84171 3.45118 4.15829 3.45118 4.35355 3.64645L8 7.29289L11.6464 3.64645C11.8417 3.45118 12.1583 3.45118 12.3536 3.64645C12.5488 3.84171 12.5488 4.15829 12.3536 4.35355L8.70711 8L12.3536 11.6464C12.5488 11.8417 12.5488 12.1583 12.3536 12.3536C12.1583 12.5488 11.8417 12.5488 11.6464 12.3536L8 8.70711L4.35355 12.3536C4.15829 12.5488 3.84171 12.5488 3.64645 12.3536C3.45118 12.1583 3.45118 11.8417 3.64645 11.6464L7.29289 8L3.64645 4.35355C3.45118 4.15829 3.45118 3.84171 3.64645 3.64645Z`,fill:`currentColor`})})})})]}));b.displayName=`DialogHeader`;var x=m((0,o.styled)(b),`header`),S=m((0,o.styled)(a.ark.main),`body`),C=m((0,o.styled)(a.ark.footer),`footer`),w=m((0,o.styled)(a.Dialog.Positioner),`positioner`),T=m((0,o.styled)(a.Dialog.Title),`title`),E=m((0,o.styled)(a.Dialog.Trigger),`trigger`);Object.defineProperty(exports,"styled_exports",{enumerable:!0,get:function(){return f}});
2
2
  //# sourceMappingURL=styled.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"styled.cjs","names":[],"sources":["../../../src/components/dialog/styled.tsx"],"sourcesContent":["import { ark, Dialog as ArkDialog, Portal, useDialogContext } from '@ark-ui/react'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { dialog } from '@stokelp/styled-system/recipes'\nimport { ComponentProps, ComponentPropsWithoutRef, ElementRef, forwardRef, useLayoutEffect } from 'react'\nimport { createStyleContext } from '~/utils/slots'\nimport { IconButton } from '~/components/icon-button'\nimport { DrawerCloseTrigger } from '~/components'\nimport { useMediaQuery } from 'usehooks-ts'\nimport { token } from '@stokelp/styled-system/tokens'\n\nconst { withProvider, withContext } = createStyleContext(dialog, {\n dataAttr: true,\n})\n\nexport const Root = withProvider(ArkDialog.Root, undefined, {\n defaultProps: {\n lazyMount: true,\n unmountOnExit: true,\n },\n})\nexport const Backdrop = withContext(styled(ArkDialog.Backdrop), 'backdrop')\nexport const CloseTrigger = withContext(styled(ArkDialog.CloseTrigger), 'closeTrigger')\n\nconst InternalContent = forwardRef<\n ElementRef<typeof ArkDialog.Content>,\n ComponentPropsWithoutRef<typeof ArkDialog.Content>\n>(({ children, ...props }, ref) => {\n const isMobile = useMediaQuery(`(max-width: ${token('breakpoints.md')})`, {\n defaultValue: false,\n })\n const { open, getContentProps } = useDialogContext()\n\n useLayoutEffect(() => {\n if (!open) return\n const { id } = getContentProps()\n if (!id) return\n setTimeout(() => {\n const $content = document.getElementById(id)\n\n if ($content) {\n const $footer = $content.querySelector('footer')\n if ($footer) {\n if (isMobile) {\n $content.style.setProperty('--footer-height', `${Math.ceil($footer.clientHeight)}px`)\n } else {\n $content.style.setProperty('--footer-height', `70px`)\n }\n }\n }\n }, 0)\n }, [open, isMobile])\n\n return (\n <Portal>\n <Backdrop />\n <Positioner>\n <ArkDialog.Content ref={ref} {...props}>\n {children}\n </ArkDialog.Content>\n </Positioner>\n </Portal>\n )\n})\nInternalContent.displayName = ArkDialog.Content.displayName\n\nexport const Content = withContext(styled(InternalContent), 'content')\n\ntype HeaderProps = ComponentPropsWithoutRef<typeof ark.header> & {\n showCloseTrigger?: boolean\n}\nconst InternalHeader = forwardRef<ElementRef<typeof ark.header>, HeaderProps>(\n ({ children, showCloseTrigger = true, ...props }, ref) => (\n <ark.header {...props} ref={ref}>\n {children}\n {showCloseTrigger && (\n <DrawerCloseTrigger asChild>\n <IconButton ml=\"auto\" aria-label=\"close\" variant=\"tertiary\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M3.64645 3.64645C3.84171 3.45118 4.15829 3.45118 4.35355 3.64645L8 7.29289L11.6464 3.64645C11.8417 3.45118 12.1583 3.45118 12.3536 3.64645C12.5488 3.84171 12.5488 4.15829 12.3536 4.35355L8.70711 8L12.3536 11.6464C12.5488 11.8417 12.5488 12.1583 12.3536 12.3536C12.1583 12.5488 11.8417 12.5488 11.6464 12.3536L8 8.70711L4.35355 12.3536C4.15829 12.5488 3.84171 12.5488 3.64645 12.3536C3.45118 12.1583 3.45118 11.8417 3.64645 11.6464L7.29289 8L3.64645 4.35355C3.45118 4.15829 3.45118 3.84171 3.64645 3.64645Z\"\n fill=\"currentColor\"\n />\n </svg>\n </IconButton>\n </DrawerCloseTrigger>\n )}\n </ark.header>\n ),\n)\nInternalHeader.displayName = 'DialogHeader'\n\nexport const Header = withContext(styled(InternalHeader), 'header')\nexport const Body = withContext(styled(ark.main), 'body')\nexport const Footer = withContext(styled(ark.footer), 'footer')\nexport const Positioner = withContext(styled(ArkDialog.Positioner), 'positioner')\nexport const Title = withContext(styled(ArkDialog.Title), 'title')\nexport const Trigger = withContext(styled(ArkDialog.Trigger), 'trigger')\n\nexport interface DialogProps extends ComponentProps<typeof Root> {}\nexport interface DialogBackdropProps extends ComponentProps<typeof Backdrop> {}\nexport interface DialogCloseTriggerProps extends ComponentProps<typeof CloseTrigger> {}\nexport interface DialogContentProps extends ComponentProps<typeof Content> {}\nexport interface DialogHeaderProps extends ComponentProps<typeof Header> {}\nexport interface DialogBodyProps extends ComponentProps<typeof Body> {}\nexport interface DialogFooterProps extends ComponentProps<typeof Footer> {}\nexport interface DialogPositionerProps extends ComponentProps<typeof Positioner> {}\nexport interface DialogTitleProps extends ComponentProps<typeof Title> {}\nexport interface DialogTriggerProps extends ComponentProps<typeof Trigger> {}\n"],"mappings":"gkBAUM,CAAE,eAAc,eAAgB,EAAA,mBAAmB,EAAA,OAAQ,CAC/D,SAAU,EACZ,CAAC,EAEY,EAAO,EAAa,EAAA,OAAU,KAAM,IAAA,GAAW,CAC1D,aAAc,CACZ,UAAW,GACX,cAAe,EACjB,CACF,CAAC,EACY,EAAW,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,QAAQ,EAAG,UAAU,EAC7D,EAAe,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,YAAY,EAAG,cAAc,EAEhF,GAAA,EAAA,EAAA,aAGH,CAAE,WAAU,GAAG,GAAS,IAAQ,CACjC,IAAM,GAAA,EAAA,EAAA,eA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A,KAAC,OAAD,CACE,SAAS,UACT,SAAS,UACT,EAAE,4fACF,KAAK,cACN,CAAA,CACE,CAAA,CACK,CAAA,CACM,CAAA,CAEZ,GAEhB,EACA,EAAe,YAAc,eAE7B,IAAa,EAAS,GAAA,EAAA,EAAA,QAAmB,CAAc,EAAG,QAAQ,EACrD,EAAO,GAAA,EAAA,EAAA,QAAmB,EAAA,IAAI,IAAI,EAAG,MAAM,EAC3C,EAAS,GAAA,EAAA,EAAA,QAAmB,EAAA,IAAI,MAAM,EAAG,QAAQ,EACjD,EAAa,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,UAAU,EAAG,YAAY,EACnE,EAAQ,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,KAAK,EAAG,OAAO,EACpD,EAAU,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,OAAO,EAAG,SAAS"}
1
+ {"version":3,"file":"styled.cjs","names":[],"sources":["../../../src/components/dialog/styled.tsx"],"sourcesContent":["import { ark, Dialog as ArkDialog, Portal, useDialogContext } from '@ark-ui/react'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { dialog } from '@stokelp/styled-system/recipes'\nimport { ComponentProps, ComponentPropsWithoutRef, ElementRef, forwardRef, useLayoutEffect } from 'react'\nimport { createStyleContext } from '~/utils/slots'\nimport { useReleaseStaleOverlayLocks } from '~/utils/overlay-lock-cleanup'\nimport { IconButton } from '~/components/icon-button'\nimport { DrawerCloseTrigger } from '~/components'\nimport { useMediaQuery } from 'usehooks-ts'\nimport { token } from '@stokelp/styled-system/tokens'\n\nconst { withProvider, withContext } = createStyleContext(dialog, {\n dataAttr: true,\n})\n\nexport const Root = withProvider(ArkDialog.Root, undefined, {\n defaultProps: {\n lazyMount: true,\n unmountOnExit: true,\n },\n})\nexport const Backdrop = withContext(styled(ArkDialog.Backdrop), 'backdrop')\nexport const CloseTrigger = withContext(styled(ArkDialog.CloseTrigger), 'closeTrigger')\n\nconst InternalContent = forwardRef<\n ElementRef<typeof ArkDialog.Content>,\n ComponentPropsWithoutRef<typeof ArkDialog.Content>\n>(({ children, ...props }, ref) => {\n const isMobile = useMediaQuery(`(max-width: ${token('breakpoints.md')})`, {\n defaultValue: false,\n })\n const { open, getContentProps } = useDialogContext()\n\n // Release body locks (scroll lock + pointer-events / inert) that @zag-js can\n // leak when a consumer force-unmounts the Dialog on close. See\n // useReleaseStaleOverlayLocks for the full explanation.\n useReleaseStaleOverlayLocks(open)\n\n useLayoutEffect(() => {\n if (!open) return\n const { id } = getContentProps()\n if (!id) return\n setTimeout(() => {\n const $content = document.getElementById(id)\n\n if ($content) {\n const $footer = $content.querySelector('footer')\n if ($footer) {\n if (isMobile) {\n $content.style.setProperty('--footer-height', `${Math.ceil($footer.clientHeight)}px`)\n } else {\n $content.style.setProperty('--footer-height', `70px`)\n }\n }\n }\n }, 0)\n }, [open, isMobile])\n\n return (\n <Portal>\n <Backdrop />\n <Positioner>\n <ArkDialog.Content ref={ref} {...props}>\n {children}\n </ArkDialog.Content>\n </Positioner>\n </Portal>\n )\n})\nInternalContent.displayName = ArkDialog.Content.displayName\n\nexport const Content = withContext(styled(InternalContent), 'content')\n\ntype HeaderProps = ComponentPropsWithoutRef<typeof ark.header> & {\n showCloseTrigger?: boolean\n}\nconst InternalHeader = forwardRef<ElementRef<typeof ark.header>, HeaderProps>(\n ({ children, showCloseTrigger = true, ...props }, ref) => (\n <ark.header {...props} ref={ref}>\n {children}\n {showCloseTrigger && (\n <DrawerCloseTrigger asChild>\n <IconButton ml=\"auto\" aria-label=\"close\" variant=\"tertiary\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M3.64645 3.64645C3.84171 3.45118 4.15829 3.45118 4.35355 3.64645L8 7.29289L11.6464 3.64645C11.8417 3.45118 12.1583 3.45118 12.3536 3.64645C12.5488 3.84171 12.5488 4.15829 12.3536 4.35355L8.70711 8L12.3536 11.6464C12.5488 11.8417 12.5488 12.1583 12.3536 12.3536C12.1583 12.5488 11.8417 12.5488 11.6464 12.3536L8 8.70711L4.35355 12.3536C4.15829 12.5488 3.84171 12.5488 3.64645 12.3536C3.45118 12.1583 3.45118 11.8417 3.64645 11.6464L7.29289 8L3.64645 4.35355C3.45118 4.15829 3.45118 3.84171 3.64645 3.64645Z\"\n fill=\"currentColor\"\n />\n </svg>\n </IconButton>\n </DrawerCloseTrigger>\n )}\n </ark.header>\n ),\n)\nInternalHeader.displayName = 'DialogHeader'\n\nexport const Header = withContext(styled(InternalHeader), 'header')\nexport const Body = withContext(styled(ark.main), 'body')\nexport const Footer = withContext(styled(ark.footer), 'footer')\nexport const Positioner = withContext(styled(ArkDialog.Positioner), 'positioner')\nexport const Title = withContext(styled(ArkDialog.Title), 'title')\nexport const Trigger = withContext(styled(ArkDialog.Trigger), 'trigger')\n\nexport interface DialogProps extends ComponentProps<typeof Root> {}\nexport interface DialogBackdropProps extends ComponentProps<typeof Backdrop> {}\nexport interface DialogCloseTriggerProps extends ComponentProps<typeof CloseTrigger> {}\nexport interface DialogContentProps extends ComponentProps<typeof Content> {}\nexport interface DialogHeaderProps extends ComponentProps<typeof Header> {}\nexport interface DialogBodyProps extends ComponentProps<typeof Body> {}\nexport interface DialogFooterProps extends ComponentProps<typeof Footer> {}\nexport interface DialogPositionerProps extends ComponentProps<typeof Positioner> {}\nexport interface DialogTitleProps extends ComponentProps<typeof Title> {}\nexport interface DialogTriggerProps extends ComponentProps<typeof Trigger> {}\n"],"mappings":"knBAWM,CAAE,eAAc,eAAgB,EAAA,mBAAmB,EAAA,OAAQ,CAC/D,SAAU,EACZ,CAAC,EAEY,EAAO,EAAa,EAAA,OAAU,KAAM,IAAA,GAAW,CAC1D,aAAc,CACZ,UAAW,GACX,cAAe,EACjB,CACF,CAAC,EACY,EAAW,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,QAAQ,EAAG,UAAU,EAC7D,EA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ClB,EAAA,EAAA,KAAC,EAAA,WAAD,CAAY,GAAG,OAAO,aAAW,QAAQ,QAAQ,qBAC/C,EAAA,EAAA,KAAC,MAAD,CAAK,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OAAO,MAAM,uCAChE,EAAA,EAAA,KAAC,OAAD,CACE,SAAS,UACT,SAAS,UACT,EAAE,4fACF,KAAK,cACN,CAAA,CACE,CAAA,CACK,CAAA,CACM,CAAA,CAEZ,GAEhB,EACA,EAAe,YAAc,eAE7B,IAAa,EAAS,GAAA,EAAA,EAAA,QAAmB,CAAc,EAAG,QAAQ,EACrD,EAAO,GAAA,EAAA,EAAA,QAAmB,EAAA,IAAI,IAAI,EAAG,MAAM,EAC3C,EAAS,GAAA,EAAA,EAAA,QAAmB,EAAA,IAAI,MAAM,EAAG,QAAQ,EACjD,EAAa,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,UAAU,EAAG,YAAY,EACnE,EAAQ,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,KAAK,EAAG,OAAO,EACpD,EAAU,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,OAAO,EAAG,SAAS"}
@@ -1,65 +1,66 @@
1
1
  "use client";
2
2
  import { __exportAll as e } from "../../_virtual/_rolldown/runtime.js";
3
3
  import { createStyleContext as t } from "../../utils/slots.js";
4
- import { IconButton as n } from "../icon-button/IconButton.js";
5
- import { DrawerCloseTrigger as r } from "../drawer/Drawer.js";
6
- import { Dialog as i, Portal as a, ark as o, useDialogContext as s } from "@ark-ui/react";
7
- import { styled as c } from "@stokelp/styled-system/jsx";
8
- import { dialog as l } from "@stokelp/styled-system/recipes";
9
- import { forwardRef as u, useLayoutEffect as d } from "react";
10
- import { jsx as f, jsxs as p } from "react/jsx-runtime";
11
- import { useMediaQuery as m } from "usehooks-ts";
12
- import { token as h } from "@stokelp/styled-system/tokens";
4
+ import { useReleaseStaleOverlayLocks as n } from "../../utils/overlay-lock-cleanup.js";
5
+ import { IconButton as r } from "../icon-button/IconButton.js";
6
+ import { DrawerCloseTrigger as i } from "../drawer/Drawer.js";
7
+ import { Dialog as a, Portal as o, ark as s, useDialogContext as c } from "@ark-ui/react";
8
+ import { styled as l } from "@stokelp/styled-system/jsx";
9
+ import { dialog as u } from "@stokelp/styled-system/recipes";
10
+ import { forwardRef as d, useLayoutEffect as f } from "react";
11
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
12
+ import { useMediaQuery as h } from "usehooks-ts";
13
+ import { token as g } from "@stokelp/styled-system/tokens";
13
14
  //#region src/components/dialog/styled.tsx
14
- var g = /* @__PURE__ */ e({
15
- Backdrop: () => b,
16
- Body: () => E,
17
- CloseTrigger: () => x,
18
- Content: () => C,
19
- Footer: () => D,
20
- Header: () => T,
21
- Positioner: () => O,
22
- Root: () => y,
23
- Title: () => k,
24
- Trigger: () => A
25
- }), { withProvider: _, withContext: v } = t(l, { dataAttr: !0 }), y = _(i.Root, void 0, { defaultProps: {
15
+ var _ = /* @__PURE__ */ e({
16
+ Backdrop: () => x,
17
+ Body: () => D,
18
+ CloseTrigger: () => S,
19
+ Content: () => w,
20
+ Footer: () => O,
21
+ Header: () => E,
22
+ Positioner: () => k,
23
+ Root: () => b,
24
+ Title: () => A,
25
+ Trigger: () => j
26
+ }), { withProvider: v, withContext: y } = t(u, { dataAttr: !0 }), b = v(a.Root, void 0, { defaultProps: {
26
27
  lazyMount: !0,
27
28
  unmountOnExit: !0
28
- } }), b = v(c(i.Backdrop), "backdrop"), x = v(c(i.CloseTrigger), "closeTrigger"), S = u(({ children: e, ...t }, n) => {
29
- let r = m(`(max-width: ${h("breakpoints.md")})`, { defaultValue: !1 }), { open: o, getContentProps: c } = s();
30
- return d(() => {
31
- if (!o) return;
32
- let { id: e } = c();
29
+ } }), x = y(l(a.Backdrop), "backdrop"), S = y(l(a.CloseTrigger), "closeTrigger"), C = d(({ children: e, ...t }, r) => {
30
+ let i = h(`(max-width: ${g("breakpoints.md")})`, { defaultValue: !1 }), { open: s, getContentProps: l } = c();
31
+ return n(s), f(() => {
32
+ if (!s) return;
33
+ let { id: e } = l();
33
34
  e && setTimeout(() => {
34
35
  let t = document.getElementById(e);
35
36
  if (t) {
36
37
  let e = t.querySelector("footer");
37
- e && (r ? t.style.setProperty("--footer-height", `${Math.ceil(e.clientHeight)}px`) : t.style.setProperty("--footer-height", "70px"));
38
+ e && (i ? t.style.setProperty("--footer-height", `${Math.ceil(e.clientHeight)}px`) : t.style.setProperty("--footer-height", "70px"));
38
39
  }
39
40
  }, 0);
40
- }, [o, r]), /* @__PURE__ */ p(a, { children: [/* @__PURE__ */ f(b, {}), /* @__PURE__ */ f(O, { children: /* @__PURE__ */ f(i.Content, {
41
- ref: n,
41
+ }, [s, i]), /* @__PURE__ */ m(o, { children: [/* @__PURE__ */ p(x, {}), /* @__PURE__ */ p(k, { children: /* @__PURE__ */ p(a.Content, {
42
+ ref: r,
42
43
  ...t,
43
44
  children: e
44
45
  }) })] });
45
46
  });
46
- S.displayName = i.Content.displayName;
47
- var C = v(c(S), "content"), w = u(({ children: e, showCloseTrigger: t = !0, ...i }, a) => /* @__PURE__ */ p(o.header, {
48
- ...i,
47
+ C.displayName = a.Content.displayName;
48
+ var w = y(l(C), "content"), T = d(({ children: e, showCloseTrigger: t = !0, ...n }, a) => /* @__PURE__ */ m(s.header, {
49
+ ...n,
49
50
  ref: a,
50
- children: [e, t && /* @__PURE__ */ f(r, {
51
+ children: [e, t && /* @__PURE__ */ p(i, {
51
52
  asChild: !0,
52
- children: /* @__PURE__ */ f(n, {
53
+ children: /* @__PURE__ */ p(r, {
53
54
  ml: "auto",
54
55
  "aria-label": "close",
55
56
  variant: "tertiary",
56
- children: /* @__PURE__ */ f("svg", {
57
+ children: /* @__PURE__ */ p("svg", {
57
58
  width: "16",
58
59
  height: "16",
59
60
  viewBox: "0 0 16 16",
60
61
  fill: "none",
61
62
  xmlns: "http://www.w3.org/2000/svg",
62
- children: /* @__PURE__ */ f("path", {
63
+ children: /* @__PURE__ */ p("path", {
63
64
  fillRule: "evenodd",
64
65
  clipRule: "evenodd",
65
66
  d: "M3.64645 3.64645C3.84171 3.45118 4.15829 3.45118 4.35355 3.64645L8 7.29289L11.6464 3.64645C11.8417 3.45118 12.1583 3.45118 12.3536 3.64645C12.5488 3.84171 12.5488 4.15829 12.3536 4.35355L8.70711 8L12.3536 11.6464C12.5488 11.8417 12.5488 12.1583 12.3536 12.3536C12.1583 12.5488 11.8417 12.5488 11.6464 12.3536L8 8.70711L4.35355 12.3536C4.15829 12.5488 3.84171 12.5488 3.64645 12.3536C3.45118 12.1583 3.45118 11.8417 3.64645 11.6464L7.29289 8L3.64645 4.35355C3.45118 4.15829 3.45118 3.84171 3.64645 3.64645Z",
@@ -69,9 +70,9 @@ var C = v(c(S), "content"), w = u(({ children: e, showCloseTrigger: t = !0, ...i
69
70
  })
70
71
  })]
71
72
  }));
72
- w.displayName = "DialogHeader";
73
- var T = v(c(w), "header"), E = v(c(o.main), "body"), D = v(c(o.footer), "footer"), O = v(c(i.Positioner), "positioner"), k = v(c(i.Title), "title"), A = v(c(i.Trigger), "trigger");
73
+ T.displayName = "DialogHeader";
74
+ var E = y(l(T), "header"), D = y(l(s.main), "body"), O = y(l(s.footer), "footer"), k = y(l(a.Positioner), "positioner"), A = y(l(a.Title), "title"), j = y(l(a.Trigger), "trigger");
74
75
  //#endregion
75
- export { g as styled_exports };
76
+ export { _ as styled_exports };
76
77
 
77
78
  //# sourceMappingURL=styled.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styled.js","names":[],"sources":["../../../src/components/dialog/styled.tsx"],"sourcesContent":["import { ark, Dialog as ArkDialog, Portal, useDialogContext } from '@ark-ui/react'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { dialog } from '@stokelp/styled-system/recipes'\nimport { ComponentProps, ComponentPropsWithoutRef, ElementRef, forwardRef, useLayoutEffect } from 'react'\nimport { createStyleContext } from '~/utils/slots'\nimport { IconButton } from '~/components/icon-button'\nimport { DrawerCloseTrigger } from '~/components'\nimport { useMediaQuery } from 'usehooks-ts'\nimport { token } from '@stokelp/styled-system/tokens'\n\nconst { withProvider, withContext } = createStyleContext(dialog, {\n dataAttr: true,\n})\n\nexport const Root = withProvider(ArkDialog.Root, undefined, {\n defaultProps: {\n lazyMount: true,\n unmountOnExit: true,\n },\n})\nexport const Backdrop = withContext(styled(ArkDialog.Backdrop), 'backdrop')\nexport const CloseTrigger = withContext(styled(ArkDialog.CloseTrigger), 'closeTrigger')\n\nconst InternalContent = forwardRef<\n ElementRef<typeof ArkDialog.Content>,\n ComponentPropsWithoutRef<typeof ArkDialog.Content>\n>(({ children, ...props }, ref) => {\n const isMobile = useMediaQuery(`(max-width: ${token('breakpoints.md')})`, {\n defaultValue: false,\n })\n const { open, getContentProps } = useDialogContext()\n\n useLayoutEffect(() => {\n if (!open) return\n const { id } = getContentProps()\n if (!id) return\n setTimeout(() => {\n const $content = document.getElementById(id)\n\n if ($content) {\n const $footer = $content.querySelector('footer')\n if ($footer) {\n if (isMobile) {\n $content.style.setProperty('--footer-height', `${Math.ceil($footer.clientHeight)}px`)\n } else {\n $content.style.setProperty('--footer-height', `70px`)\n }\n }\n }\n }, 0)\n }, [open, isMobile])\n\n return (\n <Portal>\n <Backdrop />\n <Positioner>\n <ArkDialog.Content ref={ref} {...props}>\n {children}\n </ArkDialog.Content>\n </Positioner>\n </Portal>\n )\n})\nInternalContent.displayName = ArkDialog.Content.displayName\n\nexport const Content = withContext(styled(InternalContent), 'content')\n\ntype HeaderProps = ComponentPropsWithoutRef<typeof ark.header> & {\n showCloseTrigger?: boolean\n}\nconst InternalHeader = forwardRef<ElementRef<typeof ark.header>, HeaderProps>(\n ({ children, showCloseTrigger = true, ...props }, ref) => (\n <ark.header {...props} ref={ref}>\n {children}\n {showCloseTrigger && (\n <DrawerCloseTrigger asChild>\n <IconButton ml=\"auto\" aria-label=\"close\" variant=\"tertiary\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M3.64645 3.64645C3.84171 3.45118 4.15829 3.45118 4.35355 3.64645L8 7.29289L11.6464 3.64645C11.8417 3.45118 12.1583 3.45118 12.3536 3.64645C12.5488 3.84171 12.5488 4.15829 12.3536 4.35355L8.70711 8L12.3536 11.6464C12.5488 11.8417 12.5488 12.1583 12.3536 12.3536C12.1583 12.5488 11.8417 12.5488 11.6464 12.3536L8 8.70711L4.35355 12.3536C4.15829 12.5488 3.84171 12.5488 3.64645 12.3536C3.45118 12.1583 3.45118 11.8417 3.64645 11.6464L7.29289 8L3.64645 4.35355C3.45118 4.15829 3.45118 3.84171 3.64645 3.64645Z\"\n fill=\"currentColor\"\n />\n </svg>\n </IconButton>\n </DrawerCloseTrigger>\n )}\n </ark.header>\n ),\n)\nInternalHeader.displayName = 'DialogHeader'\n\nexport const Header = withContext(styled(InternalHeader), 'header')\nexport const Body = withContext(styled(ark.main), 'body')\nexport const Footer = withContext(styled(ark.footer), 'footer')\nexport const Positioner = withContext(styled(ArkDialog.Positioner), 'positioner')\nexport const Title = withContext(styled(ArkDialog.Title), 'title')\nexport const Trigger = withContext(styled(ArkDialog.Trigger), 'trigger')\n\nexport interface DialogProps extends ComponentProps<typeof Root> {}\nexport interface DialogBackdropProps extends ComponentProps<typeof Backdrop> {}\nexport interface DialogCloseTriggerProps extends ComponentProps<typeof CloseTrigger> {}\nexport interface DialogContentProps extends ComponentProps<typeof Content> {}\nexport interface DialogHeaderProps extends ComponentProps<typeof Header> {}\nexport interface DialogBodyProps extends ComponentProps<typeof Body> {}\nexport interface DialogFooterProps extends ComponentProps<typeof Footer> {}\nexport interface DialogPositionerProps extends ComponentProps<typeof Positioner> {}\nexport interface DialogTitleProps extends ComponentProps<typeof Title> {}\nexport interface DialogTriggerProps extends ComponentProps<typeof Trigger> {}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;IAUM,EAAE,iBAA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AY,IAAG;GAAO,cAAW;GAAQ,SAAQ;aAC/C,kBAAC,OAAD;IAAK,OAAM;IAAK,QAAO;IAAK,SAAQ;IAAY,MAAK;IAAO,OAAM;cAChE,kBAAC,QAAD;KACE,UAAS;KACT,UAAS;KACT,GAAE;KACF,MAAK;IACN,CAAA;GACE,CAAA;EACK,CAAA;CACM,CAAA,CAEZ;EAEhB;AACA,EAAe,cAAc;AAE7B,IAAa,IAAS,EAAY,EAAO,CAAc,GAAG,QAAQ,GACrD,IAAO,EAAY,EAAO,EAAI,IAAI,GAAG,MAAM,GAC3C,IAAS,EAAY,EAAO,EAAI,MAAM,GAAG,QAAQ,GACjD,IAAa,EAAY,EAAO,EAAU,UAAU,GAAG,YAAY,GACnE,IAAQ,EAAY,EAAO,EAAU,KAAK,GAAG,OAAO,GACpD,IAAU,EAAY,EAAO,EAAU,OAAO,GAAG,SAAS"}
1
+ {"version":3,"file":"styled.js","names":[],"sources":["../../../src/components/dialog/styled.tsx"],"sourcesContent":["import { ark, Dialog as ArkDialog, Portal, useDialogContext } from '@ark-ui/react'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { dialog } from '@stokelp/styled-system/recipes'\nimport { ComponentProps, ComponentPropsWithoutRef, ElementRef, forwardRef, useLayoutEffect } from 'react'\nimport { createStyleContext } from '~/utils/slots'\nimport { useReleaseStaleOverlayLocks } from '~/utils/overlay-lock-cleanup'\nimport { IconButton } from '~/components/icon-button'\nimport { DrawerCloseTrigger } from '~/components'\nimport { useMediaQuery } from 'usehooks-ts'\nimport { token } from '@stokelp/styled-system/tokens'\n\nconst { withProvider, withContext } = createStyleContext(dialog, {\n dataAttr: true,\n})\n\nexport const Root = withProvider(ArkDialog.Root, undefined, {\n defaultProps: {\n lazyMount: true,\n unmountOnExit: true,\n },\n})\nexport const Backdrop = withContext(styled(ArkDialog.Backdrop), 'backdrop')\nexport const CloseTrigger = withContext(styled(ArkDialog.CloseTrigger), 'closeTrigger')\n\nconst InternalContent = forwardRef<\n ElementRef<typeof ArkDialog.Content>,\n ComponentPropsWithoutRef<typeof ArkDialog.Content>\n>(({ children, ...props }, ref) => {\n const isMobile = useMediaQuery(`(max-width: ${token('breakpoints.md')})`, {\n defaultValue: false,\n })\n const { open, getContentProps } = useDialogContext()\n\n // Release body locks (scroll lock + pointer-events / inert) that @zag-js can\n // leak when a consumer force-unmounts the Dialog on close. See\n // useReleaseStaleOverlayLocks for the full explanation.\n useReleaseStaleOverlayLocks(open)\n\n useLayoutEffect(() => {\n if (!open) return\n const { id } = getContentProps()\n if (!id) return\n setTimeout(() => {\n const $content = document.getElementById(id)\n\n if ($content) {\n const $footer = $content.querySelector('footer')\n if ($footer) {\n if (isMobile) {\n $content.style.setProperty('--footer-height', `${Math.ceil($footer.clientHeight)}px`)\n } else {\n $content.style.setProperty('--footer-height', `70px`)\n }\n }\n }\n }, 0)\n }, [open, isMobile])\n\n return (\n <Portal>\n <Backdrop />\n <Positioner>\n <ArkDialog.Content ref={ref} {...props}>\n {children}\n </ArkDialog.Content>\n </Positioner>\n </Portal>\n )\n})\nInternalContent.displayName = ArkDialog.Content.displayName\n\nexport const Content = withContext(styled(InternalContent), 'content')\n\ntype HeaderProps = ComponentPropsWithoutRef<typeof ark.header> & {\n showCloseTrigger?: boolean\n}\nconst InternalHeader = forwardRef<ElementRef<typeof ark.header>, HeaderProps>(\n ({ children, showCloseTrigger = true, ...props }, ref) => (\n <ark.header {...props} ref={ref}>\n {children}\n {showCloseTrigger && (\n <DrawerCloseTrigger asChild>\n <IconButton ml=\"auto\" aria-label=\"close\" variant=\"tertiary\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M3.64645 3.64645C3.84171 3.45118 4.15829 3.45118 4.35355 3.64645L8 7.29289L11.6464 3.64645C11.8417 3.45118 12.1583 3.45118 12.3536 3.64645C12.5488 3.84171 12.5488 4.15829 12.3536 4.35355L8.70711 8L12.3536 11.6464C12.5488 11.8417 12.5488 12.1583 12.3536 12.3536C12.1583 12.5488 11.8417 12.5488 11.6464 12.3536L8 8.70711L4.35355 12.3536C4.15829 12.5488 3.84171 12.5488 3.64645 12.3536C3.45118 12.1583 3.45118 11.8417 3.64645 11.6464L7.29289 8L3.64645 4.35355C3.45118 4.15829 3.45118 3.84171 3.64645 3.64645Z\"\n fill=\"currentColor\"\n />\n </svg>\n </IconButton>\n </DrawerCloseTrigger>\n )}\n </ark.header>\n ),\n)\nInternalHeader.displayName = 'DialogHeader'\n\nexport const Header = withContext(styled(InternalHeader), 'header')\nexport const Body = withContext(styled(ark.main), 'body')\nexport const Footer = withContext(styled(ark.footer), 'footer')\nexport const Positioner = withContext(styled(ArkDialog.Positioner), 'positioner')\nexport const Title = withContext(styled(ArkDialog.Title), 'title')\nexport const Trigger = withContext(styled(ArkDialog.Trigger), 'trigger')\n\nexport interface DialogProps extends ComponentProps<typeof Root> {}\nexport interface DialogBackdropProps extends ComponentProps<typeof Backdrop> {}\nexport interface DialogCloseTriggerProps extends ComponentProps<typeof CloseTrigger> {}\nexport interface DialogContentProps extends ComponentProps<typeof Content> {}\nexport interface DialogHeaderProps extends ComponentProps<typeof Header> {}\nexport interface DialogBodyProps extends ComponentProps<typeof Body> {}\nexport interface DialogFooterProps extends ComponentProps<typeof Footer> {}\nexport interface DialogPositionerProps extends ComponentProps<typeof Positioner> {}\nexport interface DialogTitleProps extends ComponentProps<typeof Title> {}\nexport interface DialogTriggerProps extends ComponentProps<typeof Trigger> {}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;IAWM,EAAE,iBAAc,mBAAgB,EAAmB,GAAQ,EAC/D,UAAU,GACZ,CAAC,GAEY,IAAO,EAAa,EAAU,MAAM,KAAA,GAAW,EAC1D,cAAc;CACZ,WAAW;CACX,eAAe;AACjB,EACF,CAAC,GACY,IAAW,EAAY,EAAO,EAAU,QAAQ,GAAG,UAAU,GAC7D,I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IACN,CAAA;GACE,CAAA;EACK,CAAA;CACM,CAAA,CAEZ;EAEhB;AACA,EAAe,cAAc;AAE7B,IAAa,IAAS,EAAY,EAAO,CAAc,GAAG,QAAQ,GACrD,IAAO,EAAY,EAAO,EAAI,IAAI,GAAG,MAAM,GAC3C,IAAS,EAAY,EAAO,EAAI,MAAM,GAAG,QAAQ,GACjD,IAAa,EAAY,EAAO,EAAU,UAAU,GAAG,YAAY,GACnE,IAAQ,EAAY,EAAO,EAAU,KAAK,GAAG,OAAO,GACpD,IAAU,EAAY,EAAO,EAAU,OAAO,GAAG,SAAS"}
@@ -1,2 +1,2 @@
1
- "use client";const e=require("../../utils/slots.cjs"),t=require("../icon-button/IconButton.cjs");let n=require("@ark-ui/react"),r=require("@stokelp/styled-system/jsx"),i=require("@stokelp/styled-system/recipes"),a=require("react"),o=require("react/jsx-runtime"),s=require("usehooks-ts"),c=require("@stokelp/styled-system/tokens");var{withProvider:l,withContext:u}=e.createStyleContext(i.drawer),d=l(n.Dialog.Root,void 0,{defaultProps:{unmountOnExit:!0,lazyMount:!0}}),f=u((0,r.styled)(n.ark.main),`body`),p=u((0,r.styled)(n.Dialog.CloseTrigger),`closeTrigger`),m=u((0,r.styled)(n.ark.footer),`footer`),h=(0,a.forwardRef)(({children:e,showCloseTrigger:r=!0,...i},a)=>(0,o.jsxs)(n.ark.header,{...i,ref:a,children:[e,r&&(0,o.jsx)(p,{asChild:!0,children:(0,o.jsx)(t.IconButton,{ml:`auto`,"aria-label":`close`,variant:`tertiary`,children:(0,o.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,o.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M3.64645 3.64645C3.84171 3.45118 4.15829 3.45118 4.35355 3.64645L8 7.29289L11.6464 3.64645C11.8417 3.45118 12.1583 3.45118 12.3536 3.64645C12.5488 3.84171 12.5488 4.15829 12.3536 4.35355L8.70711 8L12.3536 11.6464C12.5488 11.8417 12.5488 12.1583 12.3536 12.3536C12.1583 12.5488 11.8417 12.5488 11.6464 12.3536L8 8.70711L4.35355 12.3536C4.15829 12.5488 3.84171 12.5488 3.64645 12.3536C3.45118 12.1583 3.45118 11.8417 3.64645 11.6464L7.29289 8L3.64645 4.35355C3.45118 4.15829 3.45118 3.84171 3.64645 3.64645Z`,fill:`currentColor`})})})})]}));h.displayName=`DrawerHeader`;var g=u(h,`header`),_=u((0,r.styled)(n.Dialog.Title),`title`),v=u((0,r.styled)(n.Dialog.Trigger),`trigger`),y=u((0,r.styled)(n.Dialog.Positioner),`positioner`),b=u((0,r.styled)(n.Dialog.Backdrop),`backdrop`),x=(0,a.forwardRef)(({children:e,...t},r)=>{let i=(0,s.useMediaQuery)(`(max-width: ${(0,c.token)(`breakpoints.md`)})`,{defaultValue:!1}),{open:l,getContentProps:u}=(0,n.useDialogContext)();return(0,a.useLayoutEffect)(()=>{if(!l)return;let{id:e}=u();if(!e)return;let t=document.getElementById(e);if(t){let e=t.querySelector(`footer`);e&&(i?t.style.setProperty(`--footer-height`,`${Math.ceil(e.clientHeight)}px`):t.style.setProperty(`--footer-height`,`70px`))}},[l,i]),(0,a.useEffect)(()=>{if(process.env.NODE_ENV===`production`)return;let e=()=>window.setTimeout(()=>{let e=document.body;document.querySelector(`[data-scope="dialog"][data-state="open"]`)||(e.style.pointerEvents===`none`&&(e.style.pointerEvents=``),e.hasAttribute(`data-inert`)&&e.removeAttribute(`data-inert`),e.getAttribute(`style`)===``&&e.removeAttribute(`style`))},350);return l||e(),()=>{e()}},[l]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(b,{}),(0,o.jsx)(y,{children:(0,o.jsx)(n.Dialog.Content,{ref:r,...t,children:e})})]})});x.displayName=n.Dialog.Content.displayName;var S=u((0,r.styled)(x),`content`),C=n.Dialog.Context;exports.Drawer=d,exports.DrawerBody=f,exports.DrawerCloseTrigger=p,exports.DrawerContent=S,exports.DrawerContext=C,exports.DrawerFooter=m,exports.DrawerHeader=g,exports.DrawerTitle=_,exports.DrawerTrigger=v;
1
+ "use client";const e=require("../../utils/slots.cjs"),t=require("../../utils/overlay-lock-cleanup.cjs"),n=require("../icon-button/IconButton.cjs");let r=require("@ark-ui/react"),i=require("@stokelp/styled-system/jsx"),a=require("@stokelp/styled-system/recipes"),o=require("react"),s=require("react/jsx-runtime"),c=require("usehooks-ts"),l=require("@stokelp/styled-system/tokens");var{withProvider:u,withContext:d}=e.createStyleContext(a.drawer),f=u(r.Dialog.Root,void 0,{defaultProps:{unmountOnExit:!0,lazyMount:!0}}),p=d((0,i.styled)(r.ark.main),`body`),m=d((0,i.styled)(r.Dialog.CloseTrigger),`closeTrigger`),h=d((0,i.styled)(r.ark.footer),`footer`),g=(0,o.forwardRef)(({children:e,showCloseTrigger:t=!0,...i},a)=>(0,s.jsxs)(r.ark.header,{...i,ref:a,children:[e,t&&(0,s.jsx)(m,{asChild:!0,children:(0,s.jsx)(n.IconButton,{ml:`auto`,"aria-label":`close`,variant:`tertiary`,children:(0,s.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,s.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M3.64645 3.64645C3.84171 3.45118 4.15829 3.45118 4.35355 3.64645L8 7.29289L11.6464 3.64645C11.8417 3.45118 12.1583 3.45118 12.3536 3.64645C12.5488 3.84171 12.5488 4.15829 12.3536 4.35355L8.70711 8L12.3536 11.6464C12.5488 11.8417 12.5488 12.1583 12.3536 12.3536C12.1583 12.5488 11.8417 12.5488 11.6464 12.3536L8 8.70711L4.35355 12.3536C4.15829 12.5488 3.84171 12.5488 3.64645 12.3536C3.45118 12.1583 3.45118 11.8417 3.64645 11.6464L7.29289 8L3.64645 4.35355C3.45118 4.15829 3.45118 3.84171 3.64645 3.64645Z`,fill:`currentColor`})})})})]}));g.displayName=`DrawerHeader`;var _=d(g,`header`),v=d((0,i.styled)(r.Dialog.Title),`title`),y=d((0,i.styled)(r.Dialog.Trigger),`trigger`),b=d((0,i.styled)(r.Dialog.Positioner),`positioner`),x=d((0,i.styled)(r.Dialog.Backdrop),`backdrop`),S=(0,o.forwardRef)(({children:e,...n},i)=>{let a=(0,c.useMediaQuery)(`(max-width: ${(0,l.token)(`breakpoints.md`)})`,{defaultValue:!1}),{open:u,getContentProps:d}=(0,r.useDialogContext)();return(0,o.useLayoutEffect)(()=>{if(!u)return;let{id:e}=d();if(!e)return;let t=document.getElementById(e);if(t){let e=t.querySelector(`footer`);e&&(a?t.style.setProperty(`--footer-height`,`${Math.ceil(e.clientHeight)}px`):t.style.setProperty(`--footer-height`,`70px`))}},[u,a]),t.useReleaseStaleOverlayLocks(u),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(x,{}),(0,s.jsx)(b,{children:(0,s.jsx)(r.Dialog.Content,{ref:i,...n,children:e})})]})});S.displayName=r.Dialog.Content.displayName;var C=d((0,i.styled)(S),`content`),w=r.Dialog.Context;exports.Drawer=f,exports.DrawerBody=p,exports.DrawerCloseTrigger=m,exports.DrawerContent=C,exports.DrawerContext=w,exports.DrawerFooter=h,exports.DrawerHeader=_,exports.DrawerTitle=v,exports.DrawerTrigger=y;
2
2
  //# sourceMappingURL=Drawer.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.cjs","names":[],"sources":["../../../src/components/drawer/Drawer.tsx"],"sourcesContent":["import { ark, Dialog as ArkDrawer, useDialogContext } from '@ark-ui/react'\nimport { useMediaQuery } from 'usehooks-ts'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { drawer } from '@stokelp/styled-system/recipes'\nimport { token } from '@stokelp/styled-system/tokens'\nimport { ComponentProps, ComponentPropsWithoutRef, ElementRef, forwardRef, useEffect, useLayoutEffect } from 'react'\n\nimport { createStyleContext } from '~/utils/slots'\nimport { IconButton } from '~/components/icon-button'\n\nconst { withProvider, withContext } = createStyleContext(drawer)\n\nexport const Drawer = withProvider(ArkDrawer.Root, undefined, {\n defaultProps: {\n unmountOnExit: true,\n lazyMount: true,\n },\n})\nexport const DrawerBody = withContext(styled(ark.main), 'body')\nexport const DrawerCloseTrigger = withContext(styled(ArkDrawer.CloseTrigger), 'closeTrigger')\nexport const DrawerFooter = withContext(styled(ark.footer), 'footer')\n\ntype HeaderProps = ComponentPropsWithoutRef<typeof ark.header> & {\n showCloseTrigger?: boolean\n}\n\nconst Header = forwardRef<ElementRef<typeof ark.header>, HeaderProps>(\n ({ children, showCloseTrigger = true, ...props }, ref) => (\n <ark.header {...props} ref={ref}>\n {children}\n {showCloseTrigger && (\n <DrawerCloseTrigger asChild>\n <IconButton ml=\"auto\" aria-label=\"close\" variant=\"tertiary\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M3.64645 3.64645C3.84171 3.45118 4.15829 3.45118 4.35355 3.64645L8 7.29289L11.6464 3.64645C11.8417 3.45118 12.1583 3.45118 12.3536 3.64645C12.5488 3.84171 12.5488 4.15829 12.3536 4.35355L8.70711 8L12.3536 11.6464C12.5488 11.8417 12.5488 12.1583 12.3536 12.3536C12.1583 12.5488 11.8417 12.5488 11.6464 12.3536L8 8.70711L4.35355 12.3536C4.15829 12.5488 3.84171 12.5488 3.64645 12.3536C3.45118 12.1583 3.45118 11.8417 3.64645 11.6464L7.29289 8L3.64645 4.35355C3.45118 4.15829 3.45118 3.84171 3.64645 3.64645Z\"\n fill=\"currentColor\"\n />\n </svg>\n </IconButton>\n </DrawerCloseTrigger>\n )}\n </ark.header>\n ),\n)\nHeader.displayName = 'DrawerHeader'\n\nexport const DrawerHeader = withContext(Header, 'header')\nexport const DrawerTitle = withContext(styled(ArkDrawer.Title), 'title')\nexport const DrawerTrigger = withContext(styled(ArkDrawer.Trigger), 'trigger')\n\nconst DrawerPositioner = withContext(styled(ArkDrawer.Positioner), 'positioner')\nconst DrawerBackdrop = withContext(styled(ArkDrawer.Backdrop), 'backdrop')\n\nconst Content = forwardRef<ElementRef<typeof ArkDrawer.Content>, ComponentPropsWithoutRef<typeof ArkDrawer.Content>>(\n ({ children, ...props }, ref) => {\n const isMobile = useMediaQuery(`(max-width: ${token('breakpoints.md')})`, {\n defaultValue: false,\n })\n const { open, getContentProps } = useDialogContext()\n\n useLayoutEffect(() => {\n if (!open) return\n const { id } = getContentProps()\n if (!id) return\n const $content = document.getElementById(id)\n if ($content) {\n const $footer = $content.querySelector('footer')\n if ($footer) {\n if (isMobile) {\n $content.style.setProperty('--footer-height', `${Math.ceil($footer.clientHeight)}px`)\n } else {\n $content.style.setProperty('--footer-height', `70px`)\n }\n }\n }\n }, [open, isMobile])\n\n // Workaround: @zag-js/dismissable's disablePointerEventsOutside can leave\n // `<body>` with `pointer-events: none` / `data-inert`, freezing the page\n // after close. Two triggers we've hit:\n // 1. React StrictMode (Next.js dev) double-invokes the dismissable\n // effect, and its module-level `originalBodyPointerEvents` singleton\n // can be poisoned to `'none'` (worsened by nested dialogs).\n // 2. A consumer conditionally renders the Drawer Root and unmounts it on\n // close, so `open` never transitions to false within a mounted Content\n // — the close-path branch below never runs.\n // Gated inside the effect body so consumer bundlers DCE it in production.\n // The timer is fire-and-forget: React does NOT cancel a setTimeout queued\n // from an effect or its cleanup, so the restore still runs after Content\n // unmounts. The restore is idempotent and the stillOpen guard prevents it\n // from clobbering a dialog that is genuinely open.\n useEffect(() => {\n if (process.env.NODE_ENV === 'production') return\n const restorePointerEvents = () =>\n window.setTimeout(() => {\n const body = document.body\n const stillOpen = document.querySelector('[data-scope=\"dialog\"][data-state=\"open\"]')\n if (stillOpen) return\n if (body.style.pointerEvents === 'none') body.style.pointerEvents = ''\n if (body.hasAttribute('data-inert')) body.removeAttribute('data-inert')\n if (body.getAttribute('style') === '') body.removeAttribute('style')\n }, 350)\n // Normal close path: the Drawer stays mounted and `open` flips to false.\n if (!open) restorePointerEvents()\n // Unmount path: consumer yanked the Drawer Root while it was still open.\n return () => {\n restorePointerEvents()\n }\n }, [open])\n\n return (\n <>\n <DrawerBackdrop />\n <DrawerPositioner>\n <ArkDrawer.Content ref={ref} {...props}>\n {children}\n </ArkDrawer.Content>\n </DrawerPositioner>\n </>\n )\n },\n)\nContent.displayName = ArkDrawer.Content.displayName\n\nexport const DrawerContent = withContext(styled(Content), 'content')\nexport const DrawerContext = ArkDrawer.Context\n\nexport interface DrawerProps extends ComponentProps<typeof Drawer> {}\nexport interface DrawerBackdropProps extends ComponentProps<typeof DrawerBackdrop> {}\nexport interface DrawerBodyProps extends ComponentProps<typeof DrawerBody> {}\nexport interface DrawerCloseTriggerProps extends ComponentProps<typeof DrawerCloseTrigger> {}\nexport interface DrawerContentProps extends ComponentProps<typeof DrawerContent> {}\nexport interface DrawerFooterProps extends ComponentProps<typeof DrawerFooter> {}\nexport interface DrawerHeaderProps extends ComponentProps<typeof DrawerHeader> {}\nexport interface DrawerPositionerProps extends ComponentProps<typeof DrawerPositioner> {}\nexport interface DrawerTitleProps extends ComponentProps<typeof DrawerTitle> {}\nexport interface DrawerTriggerProps extends ComponentProps<typeof DrawerTrigger> {}\nexport interface DrawerContextProps extends ComponentProps<typeof DrawerContext> {}\n"],"mappings":"0UAUA,GAAM,CAAE,eAAc,eAAgB,EAAA,mBAAmB,EAAA,MAAM,EAElD,EAAS,EAAa,EAAA,OAAU,KAAM,IAAA,GAAW,CAC5D,aAAc,CACZ,cAAe,GACf,UAAW,EACb,CACF,CAAC,EACY,EAAa,GAAA,EAAA,EAAA,QAAmB,EAAA,IAAI,IAAI,EAAG,MAAM,EACjD,EAAqB,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,YAAY,EAAG,cAAc,EAC/E,EAAe,GAAA,EAAA,EAAA,QAAmB,EAAA,IAAI,MAAM,EAAG,QAAQ,EAM9D,GAAA,EAAA,EAAA,aACH,CAAE,WAAU,mBAAmB,GAAM,GAAG,GAAS,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KAAK,EAAQ,YAAY,EAAE,GAAG,EAEpF,EAAS,MAAM,YAAY,kBAAmB,MAAM,EAG1D,CACF,EAAG,CAAC,EAAM,CAAQ,CAAC,GAgBnB,EAAA,EAAA,eAAgB,CACd,GAAA,QAAA,IAAA,WAA6B,aAAc,OAC3C,IAAM,MACJ,OAAO,eAAiB,CACtB,IAAM,EAAO,SAAS,KACJ,SAAS,cAAc,0CACrC,IACA,EAAK,MAAM,gBAAkB,SAAQ,EAAK,MAAM,cAAgB,IAChE,EAAK,aAAa,YAAY,GAAG,EAAK,gBAAgB,YAAY,EAClE,EAAK,aAAa,OAAO,IAAM,IAAI,EAAK,gBAAgB,OAAO,EACrE,EAAG,GAAG,EAIR,OAFK,GAAM,EAAqB,MAEnB,CACX,EAAqB,CACvB,CACF,EAAG,CAAC,CAAI,CAAC,GAGP,EAAA,EAAA,MAAA,EAAA,SAAA,CAAA,SAAA,EACE,EAAA,EAAA,KAAC,EAAD,CAAiB,CAAA,GACjB,EAAA,EAAA,KAAC,EAAD,CAAA,UACE,EAAA,EAAA,KAAC,EAAA,OAAU,QAAX,CAAwB,MAAK,GAAI,EAC9B,UACgB,CAAA,CACH,CAAA,CAClB,CAAA,CAAA,CAEN,CACF,EACA,EAAQ,YAAc,EAAA,OAAU,QAAQ,YAExC,IAAa,EAAgB,GAAA,EAAA,EAAA,QAAmB,CAAO,EAAG,SAAS,EACtD,EAAgB,EAAA,OAAU"}
1
+ {"version":3,"file":"Drawer.cjs","names":[],"sources":["../../../src/components/drawer/Drawer.tsx"],"sourcesContent":["import { ark, Dialog as ArkDrawer, useDialogContext } from '@ark-ui/react'\nimport { useMediaQuery } from 'usehooks-ts'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { drawer } from '@stokelp/styled-system/recipes'\nimport { token } from '@stokelp/styled-system/tokens'\nimport { ComponentProps, ComponentPropsWithoutRef, ElementRef, forwardRef, useLayoutEffect } from 'react'\n\nimport { createStyleContext } from '~/utils/slots'\nimport { useReleaseStaleOverlayLocks } from '~/utils/overlay-lock-cleanup'\nimport { IconButton } from '~/components/icon-button'\n\nconst { withProvider, withContext } = createStyleContext(drawer)\n\nexport const Drawer = withProvider(ArkDrawer.Root, undefined, {\n defaultProps: {\n unmountOnExit: true,\n lazyMount: true,\n },\n})\nexport const DrawerBody = withContext(styled(ark.main), 'body')\nexport const DrawerCloseTrigger = withContext(styled(ArkDrawer.CloseTrigger), 'closeTrigger')\nexport const DrawerFooter = withContext(styled(ark.footer), 'footer')\n\ntype HeaderProps = ComponentPropsWithoutRef<typeof ark.header> & {\n showCloseTrigger?: boolean\n}\n\nconst Header = forwardRef<ElementRef<typeof ark.header>, HeaderProps>(\n ({ children, showCloseTrigger = true, ...props }, ref) => (\n <ark.header {...props} ref={ref}>\n {children}\n {showCloseTrigger && (\n <DrawerCloseTrigger asChild>\n <IconButton ml=\"auto\" aria-label=\"close\" variant=\"tertiary\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M3.64645 3.64645C3.84171 3.45118 4.15829 3.45118 4.35355 3.64645L8 7.29289L11.6464 3.64645C11.8417 3.45118 12.1583 3.45118 12.3536 3.64645C12.5488 3.84171 12.5488 4.15829 12.3536 4.35355L8.70711 8L12.3536 11.6464C12.5488 11.8417 12.5488 12.1583 12.3536 12.3536C12.1583 12.5488 11.8417 12.5488 11.6464 12.3536L8 8.70711L4.35355 12.3536C4.15829 12.5488 3.84171 12.5488 3.64645 12.3536C3.45118 12.1583 3.45118 11.8417 3.64645 11.6464L7.29289 8L3.64645 4.35355C3.45118 4.15829 3.45118 3.84171 3.64645 3.64645Z\"\n fill=\"currentColor\"\n />\n </svg>\n </IconButton>\n </DrawerCloseTrigger>\n )}\n </ark.header>\n ),\n)\nHeader.displayName = 'DrawerHeader'\n\nexport const DrawerHeader = withContext(Header, 'header')\nexport const DrawerTitle = withContext(styled(ArkDrawer.Title), 'title')\nexport const DrawerTrigger = withContext(styled(ArkDrawer.Trigger), 'trigger')\n\nconst DrawerPositioner = withContext(styled(ArkDrawer.Positioner), 'positioner')\nconst DrawerBackdrop = withContext(styled(ArkDrawer.Backdrop), 'backdrop')\n\nconst Content = forwardRef<ElementRef<typeof ArkDrawer.Content>, ComponentPropsWithoutRef<typeof ArkDrawer.Content>>(\n ({ children, ...props }, ref) => {\n const isMobile = useMediaQuery(`(max-width: ${token('breakpoints.md')})`, {\n defaultValue: false,\n })\n const { open, getContentProps } = useDialogContext()\n\n useLayoutEffect(() => {\n if (!open) return\n const { id } = getContentProps()\n if (!id) return\n const $content = document.getElementById(id)\n if ($content) {\n const $footer = $content.querySelector('footer')\n if ($footer) {\n if (isMobile) {\n $content.style.setProperty('--footer-height', `${Math.ceil($footer.clientHeight)}px`)\n } else {\n $content.style.setProperty('--footer-height', `70px`)\n }\n }\n }\n }, [open, isMobile])\n\n // Release body locks (scroll lock + pointer-events / inert) that @zag-js can\n // leak when a consumer force-unmounts the Drawer on close. See\n // useReleaseStaleOverlayLocks for the full explanation.\n useReleaseStaleOverlayLocks(open)\n\n return (\n <>\n <DrawerBackdrop />\n <DrawerPositioner>\n <ArkDrawer.Content ref={ref} {...props}>\n {children}\n </ArkDrawer.Content>\n </DrawerPositioner>\n </>\n )\n },\n)\nContent.displayName = ArkDrawer.Content.displayName\n\nexport const DrawerContent = withContext(styled(Content), 'content')\nexport const DrawerContext = ArkDrawer.Context\n\nexport interface DrawerProps extends ComponentProps<typeof Drawer> {}\nexport interface DrawerBackdropProps extends ComponentProps<typeof DrawerBackdrop> {}\nexport interface DrawerBodyProps extends ComponentProps<typeof DrawerBody> {}\nexport interface DrawerCloseTriggerProps extends ComponentProps<typeof DrawerCloseTrigger> {}\nexport interface DrawerContentProps extends ComponentProps<typeof DrawerContent> {}\nexport interface DrawerFooterProps extends ComponentProps<typeof DrawerFooter> {}\nexport interface DrawerHeaderProps extends ComponentProps<typeof DrawerHeader> {}\nexport interface DrawerPositionerProps extends ComponentProps<typeof DrawerPositioner> {}\nexport interface DrawerTitleProps extends ComponentProps<typeof DrawerTitle> {}\nexport interface DrawerTriggerProps extends ComponentProps<typeof DrawerTrigger> {}\nexport interface DrawerContextProps extends ComponentProps<typeof DrawerContext> {}\n"],"mappings":"4XAWA,GAAM,CAAE,eAAc,eAAgB,EAAA,mBAAmB,EAAA,MAAM,EAElD,EAAS,EAAa,EAAA,OAAU,KAAM,IAAA,GAAW,CAC5D,aAAc,CACZ,cAAe,GACf,UAAW,EACb,CACF,CAAC,EACY,EAAa,GAAA,EAAA,EAAA,QAAmB,EAAA,IAAI,IAAI,EAAG,MAAM,EACjD,EAAqB,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,YAAY,EAAG,cAAc,EAC/E,EAAe,GAAA,EAAA,EAAA,QAAmB,EAAA,IAAI,MAAM,EAAG,QAAQ,EAM9D,GAAA,EAAA,EAAA,aACH,CAAE,WAAU,mBAAmB,GAAM,GAAG,GAAS,KAChD,EAAA,EAAA,MAAC,EAAA,IAAI,OAAL,CAAY,GAAI,EAAY,eAA5B,CACG,EACA,IACC,EAAA,EAAA,KAAC,EAAD,CAAoB,QAAA,aAClB,EAAA,EAAA,KAAC,EAAA,WAAD,CAAY,GAAG,OAAO,aAAW,QAAQ,QAAQ,qBAC/C,EAAA,EAAA,KAAC,MAAD,CAAK,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OAAO,MAAM,uCAChE,EAAA,EAAA,KAAC,OAAD,CACE,SAAS,UACT,SAAS,UACT,EAAE,4fACF,KAAK,cACN,CAAA,CACE,CAAA,CACK,CAAA,CACM,CAAA,CAEZ,GAEhB,EACA,EAAO,YAAc,eAErB,IAAa,EAAe,EAAY,EAAQ,QAAQ,EAC3C,EAAc,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,KAAK,EAAG,OAAO,EAC1D,EAAgB,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,OAA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icon-button/IconButton.js";
4
- import { Dialog as n, ark as r, useDialogContext as i } from "@ark-ui/react";
5
- import { styled as a } from "@stokelp/styled-system/jsx";
6
- import { drawer as o } from "@stokelp/styled-system/recipes";
7
- import { forwardRef as s, useEffect as c, useLayoutEffect as l } from "react";
3
+ import { useReleaseStaleOverlayLocks as t } from "../../utils/overlay-lock-cleanup.js";
4
+ import { IconButton as n } from "../icon-button/IconButton.js";
5
+ import { Dialog as r, ark as i, useDialogContext as a } from "@ark-ui/react";
6
+ import { styled as o } from "@stokelp/styled-system/jsx";
7
+ import { drawer as s } from "@stokelp/styled-system/recipes";
8
+ import { forwardRef as c, useLayoutEffect as l } from "react";
8
9
  import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
9
10
  import { useMediaQuery as p } from "usehooks-ts";
10
11
  import { token as m } from "@stokelp/styled-system/tokens";
11
12
  //#region src/components/drawer/Drawer.tsx
12
- var { withProvider: h, withContext: g } = e(o), _ = h(n.Root, void 0, { defaultProps: {
13
+ var { withProvider: h, withContext: g } = e(s), _ = h(r.Root, void 0, { defaultProps: {
13
14
  unmountOnExit: !0,
14
15
  lazyMount: !0
15
- } }), v = g(a(r.main), "body"), y = g(a(n.CloseTrigger), "closeTrigger"), b = g(a(r.footer), "footer"), x = s(({ children: e, showCloseTrigger: n = !0, ...i }, a) => /* @__PURE__ */ f(r.header, {
16
- ...i,
16
+ } }), v = g(o(i.main), "body"), y = g(o(r.CloseTrigger), "closeTrigger"), b = g(o(i.footer), "footer"), x = c(({ children: e, showCloseTrigger: t = !0, ...r }, a) => /* @__PURE__ */ f(i.header, {
17
+ ...r,
17
18
  ref: a,
18
- children: [e, n && /* @__PURE__ */ d(y, {
19
+ children: [e, t && /* @__PURE__ */ d(y, {
19
20
  asChild: !0,
20
- children: /* @__PURE__ */ d(t, {
21
+ children: /* @__PURE__ */ d(n, {
21
22
  ml: "auto",
22
23
  "aria-label": "close",
23
24
  variant: "tertiary",
@@ -38,34 +39,25 @@ var { withProvider: h, withContext: g } = e(o), _ = h(n.Root, void 0, { defaultP
38
39
  })]
39
40
  }));
40
41
  x.displayName = "DrawerHeader";
41
- var S = g(x, "header"), C = g(a(n.Title), "title"), w = g(a(n.Trigger), "trigger"), T = g(a(n.Positioner), "positioner"), E = g(a(n.Backdrop), "backdrop"), D = s(({ children: e, ...t }, r) => {
42
- let a = p(`(max-width: ${m("breakpoints.md")})`, { defaultValue: !1 }), { open: o, getContentProps: s } = i();
42
+ var S = g(x, "header"), C = g(o(r.Title), "title"), w = g(o(r.Trigger), "trigger"), T = g(o(r.Positioner), "positioner"), E = g(o(r.Backdrop), "backdrop"), D = c(({ children: e, ...n }, i) => {
43
+ let o = p(`(max-width: ${m("breakpoints.md")})`, { defaultValue: !1 }), { open: s, getContentProps: c } = a();
43
44
  return l(() => {
44
- if (!o) return;
45
- let { id: e } = s();
45
+ if (!s) return;
46
+ let { id: e } = c();
46
47
  if (!e) return;
47
48
  let t = document.getElementById(e);
48
49
  if (t) {
49
50
  let e = t.querySelector("footer");
50
- e && (a ? t.style.setProperty("--footer-height", `${Math.ceil(e.clientHeight)}px`) : t.style.setProperty("--footer-height", "70px"));
51
+ e && (o ? t.style.setProperty("--footer-height", `${Math.ceil(e.clientHeight)}px`) : t.style.setProperty("--footer-height", "70px"));
51
52
  }
52
- }, [o, a]), c(() => {
53
- if (process.env.NODE_ENV === "production") return;
54
- let e = () => window.setTimeout(() => {
55
- let e = document.body;
56
- document.querySelector("[data-scope=\"dialog\"][data-state=\"open\"]") || (e.style.pointerEvents === "none" && (e.style.pointerEvents = ""), e.hasAttribute("data-inert") && e.removeAttribute("data-inert"), e.getAttribute("style") === "" && e.removeAttribute("style"));
57
- }, 350);
58
- return o || e(), () => {
59
- e();
60
- };
61
- }, [o]), /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(E, {}), /* @__PURE__ */ d(T, { children: /* @__PURE__ */ d(n.Content, {
62
- ref: r,
63
- ...t,
53
+ }, [s, o]), t(s), /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(E, {}), /* @__PURE__ */ d(T, { children: /* @__PURE__ */ d(r.Content, {
54
+ ref: i,
55
+ ...n,
64
56
  children: e
65
57
  }) })] });
66
58
  });
67
- D.displayName = n.Content.displayName;
68
- var O = g(a(D), "content"), k = n.Context;
59
+ D.displayName = r.Content.displayName;
60
+ var O = g(o(D), "content"), k = r.Context;
69
61
  //#endregion
70
62
  export { _ as Drawer, v as DrawerBody, y as DrawerCloseTrigger, O as DrawerContent, k as DrawerContext, b as DrawerFooter, S as DrawerHeader, C as DrawerTitle, w as DrawerTrigger };
71
63
 
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.js","names":[],"sources":["../../../src/components/drawer/Drawer.tsx"],"sourcesContent":["import { ark, Dialog as ArkDrawer, useDialogContext } from '@ark-ui/react'\nimport { useMediaQuery } from 'usehooks-ts'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { drawer } from '@stokelp/styled-system/recipes'\nimport { token } from '@stokelp/styled-system/tokens'\nimport { ComponentProps, ComponentPropsWithoutRef, ElementRef, forwardRef, useEffect, useLayoutEffect } from 'react'\n\nimport { createStyleContext } from '~/utils/slots'\nimport { IconButton } from '~/components/icon-button'\n\nconst { withProvider, withContext } = createStyleContext(drawer)\n\nexport const Drawer = withProvider(ArkDrawer.Root, undefined, {\n defaultProps: {\n unmountOnExit: true,\n lazyMount: true,\n },\n})\nexport const DrawerBody = withContext(styled(ark.main), 'body')\nexport const DrawerCloseTrigger = withContext(styled(ArkDrawer.CloseTrigger), 'closeTrigger')\nexport const DrawerFooter = withContext(styled(ark.footer), 'footer')\n\ntype HeaderProps = ComponentPropsWithoutRef<typeof ark.header> & {\n showCloseTrigger?: boolean\n}\n\nconst Header = forwardRef<ElementRef<typeof ark.header>, HeaderProps>(\n ({ children, showCloseTrigger = true, ...props }, ref) => (\n <ark.header {...props} ref={ref}>\n {children}\n {showCloseTrigger && (\n <DrawerCloseTrigger asChild>\n <IconButton ml=\"auto\" aria-label=\"close\" variant=\"tertiary\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M3.64645 3.64645C3.84171 3.45118 4.15829 3.45118 4.35355 3.64645L8 7.29289L11.6464 3.64645C11.8417 3.45118 12.1583 3.45118 12.3536 3.64645C12.5488 3.84171 12.5488 4.15829 12.3536 4.35355L8.70711 8L12.3536 11.6464C12.5488 11.8417 12.5488 12.1583 12.3536 12.3536C12.1583 12.5488 11.8417 12.5488 11.6464 12.3536L8 8.70711L4.35355 12.3536C4.15829 12.5488 3.84171 12.5488 3.64645 12.3536C3.45118 12.1583 3.45118 11.8417 3.64645 11.6464L7.29289 8L3.64645 4.35355C3.45118 4.15829 3.45118 3.84171 3.64645 3.64645Z\"\n fill=\"currentColor\"\n />\n </svg>\n </IconButton>\n </DrawerCloseTrigger>\n )}\n </ark.header>\n ),\n)\nHeader.displayName = 'DrawerHeader'\n\nexport const DrawerHeader = withContext(Header, 'header')\nexport const DrawerTitle = withContext(styled(ArkDrawer.Title), 'title')\nexport const DrawerTrigger = withContext(styled(ArkDrawer.Trigger), 'trigger')\n\nconst DrawerPositioner = withContext(styled(ArkDrawer.Positioner), 'positioner')\nconst DrawerBackdrop = withContext(styled(ArkDrawer.Backdrop), 'backdrop')\n\nconst Content = forwardRef<ElementRef<typeof ArkDrawer.Content>, ComponentPropsWithoutRef<typeof ArkDrawer.Content>>(\n ({ children, ...props }, ref) => {\n const isMobile = useMediaQuery(`(max-width: ${token('breakpoints.md')})`, {\n defaultValue: false,\n })\n const { open, getContentProps } = useDialogContext()\n\n useLayoutEffect(() => {\n if (!open) return\n const { id } = getContentProps()\n if (!id) return\n const $content = document.getElementById(id)\n if ($content) {\n const $footer = $content.querySelector('footer')\n if ($footer) {\n if (isMobile) {\n $content.style.setProperty('--footer-height', `${Math.ceil($footer.clientHeight)}px`)\n } else {\n $content.style.setProperty('--footer-height', `70px`)\n }\n }\n }\n }, [open, isMobile])\n\n // Workaround: @zag-js/dismissable's disablePointerEventsOutside can leave\n // `<body>` with `pointer-events: none` / `data-inert`, freezing the page\n // after close. Two triggers we've hit:\n // 1. React StrictMode (Next.js dev) double-invokes the dismissable\n // effect, and its module-level `originalBodyPointerEvents` singleton\n // can be poisoned to `'none'` (worsened by nested dialogs).\n // 2. A consumer conditionally renders the Drawer Root and unmounts it on\n // close, so `open` never transitions to false within a mounted Content\n // — the close-path branch below never runs.\n // Gated inside the effect body so consumer bundlers DCE it in production.\n // The timer is fire-and-forget: React does NOT cancel a setTimeout queued\n // from an effect or its cleanup, so the restore still runs after Content\n // unmounts. The restore is idempotent and the stillOpen guard prevents it\n // from clobbering a dialog that is genuinely open.\n useEffect(() => {\n if (process.env.NODE_ENV === 'production') return\n const restorePointerEvents = () =>\n window.setTimeout(() => {\n const body = document.body\n const stillOpen = document.querySelector('[data-scope=\"dialog\"][data-state=\"open\"]')\n if (stillOpen) return\n if (body.style.pointerEvents === 'none') body.style.pointerEvents = ''\n if (body.hasAttribute('data-inert')) body.removeAttribute('data-inert')\n if (body.getAttribute('style') === '') body.removeAttribute('style')\n }, 350)\n // Normal close path: the Drawer stays mounted and `open` flips to false.\n if (!open) restorePointerEvents()\n // Unmount path: consumer yanked the Drawer Root while it was still open.\n return () => {\n restorePointerEvents()\n }\n }, [open])\n\n return (\n <>\n <DrawerBackdrop />\n <DrawerPositioner>\n <ArkDrawer.Content ref={ref} {...props}>\n {children}\n </ArkDrawer.Content>\n </DrawerPositioner>\n </>\n )\n },\n)\nContent.displayName = ArkDrawer.Content.displayName\n\nexport const DrawerContent = withContext(styled(Content), 'content')\nexport const DrawerContext = ArkDrawer.Context\n\nexport interface DrawerProps extends ComponentProps<typeof Drawer> {}\nexport interface DrawerBackdropProps extends ComponentProps<typeof DrawerBackdrop> {}\nexport interface DrawerBodyProps extends ComponentProps<typeof DrawerBody> {}\nexport interface DrawerCloseTriggerProps extends ComponentProps<typeof DrawerCloseTrigger> {}\nexport interface DrawerContentProps extends ComponentProps<typeof DrawerContent> {}\nexport interface DrawerFooterProps extends ComponentProps<typeof DrawerFooter> {}\nexport interface DrawerHeaderProps extends ComponentProps<typeof DrawerHeader> {}\nexport interface DrawerPositionerProps extends ComponentProps<typeof DrawerPositioner> {}\nexport interface DrawerTitleProps extends ComponentProps<typeof DrawerTitle> {}\nexport interface DrawerTriggerProps extends ComponentProps<typeof DrawerTrigger> {}\nexport interface DrawerContextProps extends ComponentProps<typeof DrawerContext> {}\n"],"mappings":";;;;;;;;;;;AAUA,IAAM,EAAE,iBAAc,mBAAgB,EAAmB,CAAM,GAElD,IAAS,EAAa,EAAU,MAAM,KAAA,GAAW,EAC5D,cAAc;CACZ,eAAe;CACf,WAAW;AACb,EACF,CAAC,GACY,IAAa,EAAY,EAAO,EAAI,IAAI,GAAG,MAAM,GACjD,IAAqB,EAAY,EAAO,EAAU,YAAY,GAAG,cAAc,GAC/E,IAAe,EAAY,EAAO,EAAI,MAAM,GAAG,QAAQ,GAM9D,IAAS,GACZ,EAAE,aAAU,sBAAmB,IAAM,GAAG,KAAS,MAChD,kBAAC,EAAI,QAAL;CAAY,GAAI;CAAY;WAA5B,CACG,GACA,KACC,kBAAC,GAAD;EAAoB,SAAA;YAClB,kBAAC,GAAD;GAAY,IAAG;GAAO,cAAW;GAAQ,SAAQ;aAC/C,kBAAC,OAAD;IAAK,OAAM;IAAK,QAAO;IAAK,SAAQ;IAAY,MAAK;IAAO,OAAM;cAChE,kBAAC,QAAD;KACE,UAAS;KACT,UAAS;KACT,GAAE;KACF,MAAK;IACN,CAAA;GACE,CAAA;EACK,CAAA;CACM,CAAA,CAEZ;EAEhB;AACA,EAAO,cAAc;AAErB,IAAa,IAAe,EAAY,GAAQ,QAAQ,GAC3C,IAAc,EAAY,EAAO,EAAU,KAAK,GAAG,OAAO,GAC1D,IAAgB,EAAY,EAAO,EAAU,OAAO,GAAG,SAAS,GAEvE,IAAmB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;AAExC,IAAa,IAAgB,EAAY,EAAO,CAAO,GAAG,SAAS,GACtD,IAAgB,EAAU"}
1
+ {"version":3,"file":"Drawer.js","names":[],"sources":["../../../src/components/drawer/Drawer.tsx"],"sourcesContent":["import { ark, Dialog as ArkDrawer, useDialogContext } from '@ark-ui/react'\nimport { useMediaQuery } from 'usehooks-ts'\nimport { styled } from '@stokelp/styled-system/jsx'\nimport { drawer } from '@stokelp/styled-system/recipes'\nimport { token } from '@stokelp/styled-system/tokens'\nimport { ComponentProps, ComponentPropsWithoutRef, ElementRef, forwardRef, useLayoutEffect } from 'react'\n\nimport { createStyleContext } from '~/utils/slots'\nimport { useReleaseStaleOverlayLocks } from '~/utils/overlay-lock-cleanup'\nimport { IconButton } from '~/components/icon-button'\n\nconst { withProvider, withContext } = createStyleContext(drawer)\n\nexport const Drawer = withProvider(ArkDrawer.Root, undefined, {\n defaultProps: {\n unmountOnExit: true,\n lazyMount: true,\n },\n})\nexport const DrawerBody = withContext(styled(ark.main), 'body')\nexport const DrawerCloseTrigger = withContext(styled(ArkDrawer.CloseTrigger), 'closeTrigger')\nexport const DrawerFooter = withContext(styled(ark.footer), 'footer')\n\ntype HeaderProps = ComponentPropsWithoutRef<typeof ark.header> & {\n showCloseTrigger?: boolean\n}\n\nconst Header = forwardRef<ElementRef<typeof ark.header>, HeaderProps>(\n ({ children, showCloseTrigger = true, ...props }, ref) => (\n <ark.header {...props} ref={ref}>\n {children}\n {showCloseTrigger && (\n <DrawerCloseTrigger asChild>\n <IconButton ml=\"auto\" aria-label=\"close\" variant=\"tertiary\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M3.64645 3.64645C3.84171 3.45118 4.15829 3.45118 4.35355 3.64645L8 7.29289L11.6464 3.64645C11.8417 3.45118 12.1583 3.45118 12.3536 3.64645C12.5488 3.84171 12.5488 4.15829 12.3536 4.35355L8.70711 8L12.3536 11.6464C12.5488 11.8417 12.5488 12.1583 12.3536 12.3536C12.1583 12.5488 11.8417 12.5488 11.6464 12.3536L8 8.70711L4.35355 12.3536C4.15829 12.5488 3.84171 12.5488 3.64645 12.3536C3.45118 12.1583 3.45118 11.8417 3.64645 11.6464L7.29289 8L3.64645 4.35355C3.45118 4.15829 3.45118 3.84171 3.64645 3.64645Z\"\n fill=\"currentColor\"\n />\n </svg>\n </IconButton>\n </DrawerCloseTrigger>\n )}\n </ark.header>\n ),\n)\nHeader.displayName = 'DrawerHeader'\n\nexport const DrawerHeader = withContext(Header, 'header')\nexport const DrawerTitle = withContext(styled(ArkDrawer.Title), 'title')\nexport const DrawerTrigger = withContext(styled(ArkDrawer.Trigger), 'trigger')\n\nconst DrawerPositioner = withContext(styled(ArkDrawer.Positioner), 'positioner')\nconst DrawerBackdrop = withContext(styled(ArkDrawer.Backdrop), 'backdrop')\n\nconst Content = forwardRef<ElementRef<typeof ArkDrawer.Content>, ComponentPropsWithoutRef<typeof ArkDrawer.Content>>(\n ({ children, ...props }, ref) => {\n const isMobile = useMediaQuery(`(max-width: ${token('breakpoints.md')})`, {\n defaultValue: false,\n })\n const { open, getContentProps } = useDialogContext()\n\n useLayoutEffect(() => {\n if (!open) return\n const { id } = getContentProps()\n if (!id) return\n const $content = document.getElementById(id)\n if ($content) {\n const $footer = $content.querySelector('footer')\n if ($footer) {\n if (isMobile) {\n $content.style.setProperty('--footer-height', `${Math.ceil($footer.clientHeight)}px`)\n } else {\n $content.style.setProperty('--footer-height', `70px`)\n }\n }\n }\n }, [open, isMobile])\n\n // Release body locks (scroll lock + pointer-events / inert) that @zag-js can\n // leak when a consumer force-unmounts the Drawer on close. See\n // useReleaseStaleOverlayLocks for the full explanation.\n useReleaseStaleOverlayLocks(open)\n\n return (\n <>\n <DrawerBackdrop />\n <DrawerPositioner>\n <ArkDrawer.Content ref={ref} {...props}>\n {children}\n </ArkDrawer.Content>\n </DrawerPositioner>\n </>\n )\n },\n)\nContent.displayName = ArkDrawer.Content.displayName\n\nexport const DrawerContent = withContext(styled(Content), 'content')\nexport const DrawerContext = ArkDrawer.Context\n\nexport interface DrawerProps extends ComponentProps<typeof Drawer> {}\nexport interface DrawerBackdropProps extends ComponentProps<typeof DrawerBackdrop> {}\nexport interface DrawerBodyProps extends ComponentProps<typeof DrawerBody> {}\nexport interface DrawerCloseTriggerProps extends ComponentProps<typeof DrawerCloseTrigger> {}\nexport interface DrawerContentProps extends ComponentProps<typeof DrawerContent> {}\nexport interface DrawerFooterProps extends ComponentProps<typeof DrawerFooter> {}\nexport interface DrawerHeaderProps extends ComponentProps<typeof DrawerHeader> {}\nexport interface DrawerPositionerProps extends ComponentProps<typeof DrawerPositioner> {}\nexport interface DrawerTitleProps extends ComponentProps<typeof DrawerTitle> {}\nexport interface DrawerTriggerProps extends ComponentProps<typeof DrawerTrigger> {}\nexport interface DrawerContextProps extends ComponentProps<typeof DrawerContext> {}\n"],"mappings":";;;;;;;;;;;;AAWA,IAAM,EAAE,iBAAc,mBAAgB,EAAmB,CAAM,GAElD,IAAS,EAAa,EAAU,MAAM,KAAA,GAAW,EAC5D,cAAc;CACZ,eAAe;CACf,WAAW;AACb,EACF,CAAC,GACY,IAAa,EAAY,EAAO,EAAI,IAAI,GAAG,MAAM,GACjD,IAAqB,EAAY,EAAO,EAAU,YAAY,GAAG,cAAc,GAC/E,IAAe,EAAY,EAAO,EAAI,MAAM,GAAG,QAAQ,GAM9D,IAAS,GACZ,EAAE,aAAU,sBAAmB,IAAM,GAAG,KAAS,MAChD,kBAAC,EAAI,QAAL;CAAY,GAAI;CAAY;WAA5B,CACG,GACA,KACC,kBAAC,GAAD;EAAoB,SAAA;YAClB,kBAAC,GAAD;GAAY,IAAG;GAAO,cAAW;GAAQ,SAAQ;aAC/C,kBAAC,OAAD;IAAK,OAAM;IAAK,QAAO;IAAK,SAAQ;IAAY,MAAK;IAAO,OAAM;cAChE,kBAAC,QAAD;KACE,UAAS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ils/slots.cjs"),t=require("../tooltip/Tooltip.cjs"),n=require("../text/Text.cjs"),r=require("../../shared/ConditionalWrapper.cjs");let i=require("@ark-ui/react"),a=require("@stokelp/styled-system/jsx"),o=require("@stokelp/styled-system/recipes"),s=require("react"),c=require("react/jsx-runtime"),l=require("@stokelp/styled-system/css"),u=require("react-window");var{withProvider:d,withContext:f}=e.createStyleContext(o.select),p=d((0,a.styled)(i.Select.Root),`root`,{defaultProps:{loopFocus:!0}}),m=f((0,a.styled)(i.Select.ClearTrigger),`clearTrigger`),h=f((0,a.styled)(i.Select.Content),`content`),g=f((0,a.styled)(i.Select.Control),`control`),_=f((0,a.styled)(i.Select.Indicator),`indicator`),v=f((0,a.styled)(i.Select.Item),`item`),y=f((0,a.styled)(i.Select.ItemText),`itemText`),b=f((0,a.styled)(i.Select.Positioner),`positioner`),x=f((0,a.styled)(i.Select.Trigger),`trigger`),S=f((0,a.styled)(i.Select.ValueText),`valueText`),C=()=>(0,c.jsxs)(`svg`,{width:`16`,height:`17`,viewBox:`0 0 16 17`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,c.jsx)(`rect`,{x:`0.5`,y:`1`,width:`15`,height:`15`,rx:`3.5`,fill:`white`}),(0,c.jsx)(`rect`,{x:`0.5`,y:`1`,width:`15`,height:`15`,rx:`3.5`,className:(0,l.css)({stroke:`grey.100`})})]}),w=()=>(0,c.jsxs)(`svg`,{width:`16`,height:`17`,viewBox:`0 0 16 17`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,c.jsx)(`rect`,{y:`0.5`,width:`16`,height:`16`,rx:`4`,className:(0,l.css)({fill:`primary.500`})}),(0,c.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M11.958 4.81298C12.1303 4.92787 12.1769 5.16069 12.062 5.33301L7.56202 12.083C7.4997 12.1765 7.39875 12.2371 7.28695 12.2482C7.17515 12.2592 7.06428 12.2196 6.98483 12.1402L3.98483 9.14017C3.83839 8.99372 3.83839 8.75628 3.98483 8.60984C4.13128 8.46339 4.36872 8.46339 4.51517 8.60984L7.19172 11.2864L11.438 4.91699C11.5529 4.74467 11.7857 4.6981 11.958 4.81298Z`,fill:`white`})]});function T({placeholder:e,allSelectedLabel:t}){let n=(0,i.useSelectContext)(),r=n.collection.items,a=n.selectedItems;return n.multiple&&a.filter(e=>!e.disabled).length>=r.filter(e=>!e.disabled).length&&t?(0,c.jsx)(S,{className:`custom`,truncate:!0,children:t}):(0,c.jsx)(S,{truncate:!0,placeholder:e})}function E({renderTrigger:e,placeholder:t,allSelectedLabel:n}){let r=(0,i.useSelectContext)(),a=r.value&&r.value.length>0?r.collection.findMany(r.value):[];if(a.length===0)return(0,c.jsx)(S,{className:`custom`,truncate:!0,placeholder:t});let o=r.selectedItems;return r.multiple&&o.filter(e=>!e.disabled).length>=r.collection.items.filter(e=>!e.disabled).length&&n?(0,c.jsx)(S,{className:`custom`,truncate:!0,children:n}):(0,c.jsx)(S,{className:`custom`,placeholder:t,children:a.map(t=>(0,c.jsx)(`span`,{children:e(t)},t.value))})}function D({item:e,isMultiple:t,renderItem:n}){let r=(0,i.useSelectItemContext)();return(0,c.jsxs)(c.Fragment,{children:[t?r.selected?(0,c.jsx)(w,{}):(0,c.jsx)(C,{}):null,n?n(e):(0,c.jsx)(y,{truncate:!0,children:e.label})]})}function O({items:e,placeholder:a,emptyLabel:o,usePortal:l=!0,positioning:d,renderItem:f,renderTrigger:y,virtualized:S,rowHeight:C=34,...w}){let O=(0,i.createListCollection)({items:e}),k=(0,s.useRef)(null);return(0,c.jsxs)(p,{lazyMount:!0,unmountOnExit:!0,collection:O,positioning:{sameWidth:!0,gutter:0,...d},"data-recipe":`select`,...w,ref:e=>{e&&(k.current=e.closest(`[role="dialog"]`))},children:[(0,c.jsxs)(g,{children:[(0,c.jsxs)(x,{children:[y?(0,c.jsx)(E,{renderTrigger:y,placeholder:a,allSelectedLabel:w.allSelectedLabel}):(0,c.jsx)(T,{placeholder:a,allSelectedLabel:w.allSelectedLabel}),(0,c.jsx)(_,{asChild:!0,children:(0,c.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,c.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12.5303 16.2803C12.2374 16.5732 11.7626 16.5732 11.4697 16.2803L3.96967 8.78033C3.67678 8.48744 3.67678 8.01256 3.96967 7.71967C4.26256 7.42678 4.73744 7.42678 5.03033 7.71967L12 14.6893L18.9697 7.71967C19.2626 7.42678 19.7374 7.42678 20.0303 7.71967C20.3232 8.01256 20.3232 8.48744 20.0303 8.78033L12.5303 16.2803Z`,fill:`currentColor`})})})]}),(0,c.jsx)(m,{disabled:w.readOnly,asChild:!0,children:(0,c.jsx)(`button`,{children:(0,c.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,c.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M10 3.125C6.20304 3.125 3.125 6.20304 3.125 10C3.125 13.797 6.20304 16.875 10 16.875C13.797 16.875 16.875 13.797 16.875 10C16.875 6.20304 13.797 3.125 10 3.125ZM1.875 10C1.875 5.51269 5.51269 1.875 10 1.875C14.4873 1.875 18.125 5.51269 18.125 10C18.125 14.4873 14.4873 18.125 10 18.125C5.51269 18.125 1.875 14.4873 1.875 10ZM7.68306 7.68306C7.92714 7.43898 8.32286 7.43898 8.56694 7.68306L10 9.11612L11.4331 7.68306C11.6771 7.43898 12.0729 7.43898 12.3169 7.68306C12.561 7.92714 12.561 8.32286 12.3169 8.56694L10.8839 10L12.3169 11.4331C12.561 11.6771 12.561 12.0729 12.3169 12.3169C12.0729 12.561 11.6771 12.561 11.4331 12.3169L10 10.8839L8.56694 12.3169C8.32286 12.561 7.92714 12.561 7.68306 12.3169C7.43898 12.0729 7.43898 11.6771 7.68306 11.4331L9.11612 10L7.68306 8.56694C7.43898 8.32286 7.43898 7.92714 7.68306 7.68306Z`,fill:`currentColor`})})})})]}),(0,c.jsx)(r.ConditionalWrapper,{when:l,wrapper:e=>(0,c.jsx)(i.Portal,{container:k,children:e}),children:(0,c.jsx)(b,{children:(0,c.jsx)(h,{children:e.length===0?(0,c.jsx)(n.Text,{px:`space-8`,textAlign:`center`,children:o??`Aucun résultat`}):S?(0,c.jsx)(c.Fragment,{children:(0,c.jsx)(u.FixedSizeList,{height:Math.min(C*e.length,180),itemCount:e.length,itemSize:C,width:`100%`,children:({index:n,style:i})=>(0,c.jsx)(r.ConditionalWrapper,{when:!!e[n].tooltip,wrapper:r=>(0,c.jsx)(t.Tooltip,{label:e[n].tooltip,children:r}),children:(0,c.jsx)(v,{item:e[n],style:i,children:(0,c.jsx)(D,{renderItem:f,item:e[n]})},e[n].value)},e[n].value)})}):e.map(e=>(0,c.jsx)(r.ConditionalWrapper,{when:!!e.tooltip,wrapper:n=>(0,c.jsx)(t.Tooltip,{label:e.tooltip,children:n}),children:(0,c.jsx)(v,{item:e,children:(0,c.jsx)(D,{renderItem:f,item:e,isMultiple:w.multiple})},e.value)},e.value))})})}),(0,c.jsx)(i.Select.HiddenSelect,{})]})}exports.Select=O;
1
+ "use client";const e=require("../../utils/slots.cjs"),t=require("../tooltip/Tooltip.cjs"),n=require("../text/Text.cjs"),r=require("../../shared/ConditionalWrapper.cjs");let i=require("@ark-ui/react"),a=require("@stokelp/styled-system/jsx"),o=require("@stokelp/styled-system/recipes"),s=require("react"),c=require("react/jsx-runtime"),l=require("@stokelp/styled-system/css"),u=require("react-window");var{withProvider:d,withContext:f}=e.createStyleContext(o.select),p=d((0,a.styled)(i.Select.Root),`root`,{defaultProps:{loopFocus:!0}}),m=f((0,a.styled)(i.Select.ClearTrigger),`clearTrigger`),h=f((0,a.styled)(i.Select.Content),`content`),g=f((0,a.styled)(i.Select.Control),`control`),_=f((0,a.styled)(i.Select.Indicator),`indicator`),v=f((0,a.styled)(i.Select.Item),`item`),y=f((0,a.styled)(i.Select.ItemText),`itemText`),b=f((0,a.styled)(i.Select.Positioner),`positioner`),x=f((0,a.styled)(i.Select.Trigger),`trigger`),S=f((0,a.styled)(i.Select.ValueText),`valueText`),C=()=>(0,c.jsxs)(`svg`,{width:`16`,height:`17`,viewBox:`0 0 16 17`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,c.jsx)(`rect`,{x:`0.5`,y:`1`,width:`15`,height:`15`,rx:`3.5`,fill:`white`}),(0,c.jsx)(`rect`,{x:`0.5`,y:`1`,width:`15`,height:`15`,rx:`3.5`,className:(0,l.css)({stroke:`grey.100`})})]}),w=()=>(0,c.jsxs)(`svg`,{width:`16`,height:`17`,viewBox:`0 0 16 17`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,c.jsx)(`rect`,{y:`0.5`,width:`16`,height:`16`,rx:`4`,className:(0,l.css)({fill:`primary.500`})}),(0,c.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M11.958 4.81298C12.1303 4.92787 12.1769 5.16069 12.062 5.33301L7.56202 12.083C7.4997 12.1765 7.39875 12.2371 7.28695 12.2482C7.17515 12.2592 7.06428 12.2196 6.98483 12.1402L3.98483 9.14017C3.83839 8.99372 3.83839 8.75628 3.98483 8.60984C4.13128 8.46339 4.36872 8.46339 4.51517 8.60984L7.19172 11.2864L11.438 4.91699C11.5529 4.74467 11.7857 4.6981 11.958 4.81298Z`,fill:`white`})]});function T({placeholder:e,allSelectedLabel:t}){let n=(0,i.useSelectContext)(),r=n.collection.items,a=n.selectedItems;return n.multiple&&a.filter(e=>!e.disabled).length>=r.filter(e=>!e.disabled).length&&t?(0,c.jsx)(S,{className:`custom`,truncate:!0,children:t}):(0,c.jsx)(S,{truncate:!0,placeholder:e})}function E({renderTrigger:e,placeholder:t,allSelectedLabel:n}){let r=(0,i.useSelectContext)(),a=r.value&&r.value.length>0?r.collection.findMany(r.value):[];if(a.length===0)return(0,c.jsx)(S,{className:`custom`,truncate:!0,placeholder:t});let o=r.selectedItems;return r.multiple&&o.filter(e=>!e.disabled).length>=r.collection.items.filter(e=>!e.disabled).length&&n?(0,c.jsx)(S,{className:`custom`,truncate:!0,children:n}):(0,c.jsx)(S,{className:`custom`,placeholder:t,children:a.map(t=>(0,c.jsx)(`span`,{children:e(t)},t.value))})}function D({item:e,isMultiple:t,renderItem:n}){let r=(0,i.useSelectItemContext)();return(0,c.jsxs)(c.Fragment,{children:[t?r.selected?(0,c.jsx)(w,{}):(0,c.jsx)(C,{}):null,n?n(e):(0,c.jsx)(y,{truncate:!0,children:e.label})]})}function O({items:e,placeholder:a,emptyLabel:o,usePortal:d=!0,positioning:f,renderItem:y,renderTrigger:S,virtualized:C,rowHeight:w=34,...O}){let k=(0,i.createListCollection)({items:e}),A=(0,s.useRef)(null);return(0,c.jsxs)(p,{lazyMount:!0,unmountOnExit:!0,collection:k,positioning:{sameWidth:!0,gutter:0,...f},"data-recipe":`select`,...O,ref:e=>{e&&(A.current=e.closest(`[role="dialog"]`))},children:[(0,c.jsxs)(g,{children:[(0,c.jsxs)(x,{children:[S?(0,c.jsx)(E,{renderTrigger:S,placeholder:a,allSelectedLabel:O.allSelectedLabel}):(0,c.jsx)(T,{placeholder:a,allSelectedLabel:O.allSelectedLabel}),(0,c.jsx)(_,{asChild:!0,children:(0,c.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,c.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12.5303 16.2803C12.2374 16.5732 11.7626 16.5732 11.4697 16.2803L3.96967 8.78033C3.67678 8.48744 3.67678 8.01256 3.96967 7.71967C4.26256 7.42678 4.73744 7.42678 5.03033 7.71967L12 14.6893L18.9697 7.71967C19.2626 7.42678 19.7374 7.42678 20.0303 7.71967C20.3232 8.01256 20.3232 8.48744 20.0303 8.78033L12.5303 16.2803Z`,fill:`currentColor`})})})]}),(0,c.jsx)(m,{disabled:O.readOnly,asChild:!0,children:(0,c.jsx)(`button`,{children:(0,c.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,c.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M10 3.125C6.20304 3.125 3.125 6.20304 3.125 10C3.125 13.797 6.20304 16.875 10 16.875C13.797 16.875 16.875 13.797 16.875 10C16.875 6.20304 13.797 3.125 10 3.125ZM1.875 10C1.875 5.51269 5.51269 1.875 10 1.875C14.4873 1.875 18.125 5.51269 18.125 10C18.125 14.4873 14.4873 18.125 10 18.125C5.51269 18.125 1.875 14.4873 1.875 10ZM7.68306 7.68306C7.92714 7.43898 8.32286 7.43898 8.56694 7.68306L10 9.11612L11.4331 7.68306C11.6771 7.43898 12.0729 7.43898 12.3169 7.68306C12.561 7.92714 12.561 8.32286 12.3169 8.56694L10.8839 10L12.3169 11.4331C12.561 11.6771 12.561 12.0729 12.3169 12.3169C12.0729 12.561 11.6771 12.561 11.4331 12.3169L10 10.8839L8.56694 12.3169C8.32286 12.561 7.92714 12.561 7.68306 12.3169C7.43898 12.0729 7.43898 11.6771 7.68306 11.4331L9.11612 10L7.68306 8.56694C7.43898 8.32286 7.43898 7.92714 7.68306 7.68306Z`,fill:`currentColor`})})})})]}),(0,c.jsx)(r.ConditionalWrapper,{when:d,wrapper:e=>(0,c.jsx)(i.Portal,{container:A,children:e}),children:(0,c.jsx)(b,{children:(0,c.jsx)(h,{children:e.length===0?(0,c.jsx)(n.Text,{px:`space-8`,textAlign:`center`,children:o??`Aucun résultat`}):C?(0,c.jsx)(c.Fragment,{children:(0,c.jsx)(u.FixedSizeList,{height:Math.min(w*e.length,180),itemCount:e.length,itemSize:w,width:`100%`,children:({index:n,style:i})=>(0,c.jsx)(r.ConditionalWrapper,{when:!!e[n].tooltip,wrapper:r=>(0,c.jsx)(t.Tooltip,{label:e[n].tooltip,children:r}),children:(0,c.jsx)(v,{item:e[n],style:i,children:(0,c.jsx)(D,{renderItem:y,item:e[n]})},e[n].value)},e[n].value)})}):e.map(e=>(0,c.jsxs)(s.Fragment,{children:[(0,c.jsx)(r.ConditionalWrapper,{when:!!e.tooltip,wrapper:n=>(0,c.jsx)(t.Tooltip,{label:e.tooltip,children:n}),children:(0,c.jsx)(v,{item:e,children:(0,c.jsx)(D,{renderItem:y,item:e,isMultiple:O.multiple})},e.value)},e.value),e.separatorAfter&&(0,c.jsx)(`div`,{role:`separator`,className:(0,l.css)({height:`1px`,flexShrink:0,backgroundColor:`grey.100`,marginY:`space-4`,marginX:`space-8`})})]},e.value))})})}),(0,c.jsx)(i.Select.HiddenSelect,{})]})}exports.Select=O;
2
2
  //# sourceMappingURL=Select.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Select.cjs","names":[],"sources":["../../../src/components/select/Select.tsx"],"sourcesContent":["import {\n createListCollection,\n Portal,\n Select as ArkSelect,\n type SelectRootProps,\n useSelectItemContext,\n useSelectContext,\n} from '@ark-ui/react'\nimport { FC, ReactNode, useRef } from 'react'\nimport { styled } from '@stokelp/styled-system/jsx'\n\nimport { select } from '@stokelp/styled-system/recipes'\nimport { createStyleContext } from '~/utils/slots'\n\nimport { ConditionalWrapper } from '~/shared/ConditionalWrapper'\nimport { Text } from '~/components/text/Text'\nimport { Tooltip } from '~/components/tooltip/Tooltip'\nimport { HTMLStyledProps, RecipeVariantProps } from '@stokelp/styled-system/types'\nimport { FixedSizeList } from 'react-window'\nimport { css } from '@stokelp/styled-system/css'\n\nconst { withProvider, withContext } = createStyleContext(select)\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst Root = withProvider(styled(ArkSelect.Root<any>), 'root', {\n defaultProps: {\n loopFocus: true,\n },\n})\n\nconst ClearTrigger = withContext(styled(ArkSelect.ClearTrigger), 'clearTrigger')\nconst Content = withContext(styled(ArkSelect.Content), 'content')\nconst Control = withContext(styled(ArkSelect.Control), 'control')\nconst Indicator = withContext(styled(ArkSelect.Indicator), 'indicator')\nconst Item = withContext(styled(ArkSelect.Item), 'item')\nconst ItemText = withContext(styled(ArkSelect.ItemText), 'itemText')\nconst Positioner = withContext(styled(ArkSelect.Positioner), 'positioner')\nconst Trigger = withContext(styled(ArkSelect.Trigger), 'trigger')\nconst ValueText = withContext(styled(ArkSelect.ValueText), 'valueText')\n\nexport interface SelectItem {\n value: string | number\n label: string\n tooltip?: ReactNode\n disabled?: boolean\n}\n\nexport type SelectProps<Item extends SelectItem> = Omit<SelectRootProps<Item>, 'collection'> & {\n items: Item[] | readonly Item[]\n renderItem?: (item: Item) => ReactNode\n renderTrigger?: (item: Item) => ReactNode\n emptyLabel?: string\n placeholder?: string\n allSelectedLabel?: string\n usePortal?: boolean\n virtualized?: boolean\n rowHeight?: number\n} & HTMLStyledProps<'div'> &\n RecipeVariantProps<typeof select>\n\nconst MultipleUncheckedIndicator: FC = () => (\n <svg width=\"16\" height=\"17\" viewBox=\"0 0 16 17\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect x=\"0.5\" y=\"1\" width=\"15\" height=\"15\" rx=\"3.5\" fill=\"white\" />\n <rect x=\"0.5\" y=\"1\" width=\"15\" height=\"15\" rx=\"3.5\" className={css({ stroke: 'grey.100' })} />\n </svg>\n)\n\nconst MultipleCheckedIndicator: FC = () => (\n <svg width=\"16\" height=\"17\" viewBox=\"0 0 16 17\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect y=\"0.5\" width=\"16\" height=\"16\" rx=\"4\" className={css({ fill: 'primary.500' })} />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M11.958 4.81298C12.1303 4.92787 12.1769 5.16069 12.062 5.33301L7.56202 12.083C7.4997 12.1765 7.39875 12.2371 7.28695 12.2482C7.17515 12.2592 7.06428 12.2196 6.98483 12.1402L3.98483 9.14017C3.83839 8.99372 3.83839 8.75628 3.98483 8.60984C4.13128 8.46339 4.36872 8.46339 4.51517 8.60984L7.19172 11.2864L11.438 4.91699C11.5529 4.74467 11.7857 4.6981 11.958 4.81298Z\"\n fill=\"white\"\n />\n </svg>\n)\n\ninterface InnerItemProps<Item extends SelectItem> {\n item: Item\n isMultiple?: boolean\n renderItem?: (item: Item) => ReactNode\n}\n\ninterface InnerTriggerProps<Item extends SelectItem> {\n renderTrigger: (item: Item) => ReactNode\n placeholder?: string\n allSelectedLabel?: string\n}\n\ninterface DefaultInnerTriggerProps {\n placeholder?: string\n allSelectedLabel?: string\n}\n\nfunction DefaultInnerTrigger({ placeholder, allSelectedLabel }: DefaultInnerTriggerProps) {\n const context = useSelectContext()\n const items = context.collection.items\n const selectedItems = context.selectedItems\n\n if (\n context.multiple &&\n selectedItems.filter(item => !item.disabled).length >= items.filter(item => !item.disabled).length &&\n allSelectedLabel\n ) {\n return (\n <ValueText className=\"custom\" truncate>\n {allSelectedLabel}\n </ValueText>\n )\n }\n\n return <ValueText truncate placeholder={placeholder} />\n}\n\nfunction CustomInnerTrigger<Item extends SelectItem>({\n renderTrigger,\n placeholder,\n allSelectedLabel,\n}: InnerTriggerProps<Item>) {\n const context = useSelectContext()\n const items = context.value && context.value.length > 0 ? context.collection.findMany(context.value) : []\n\n if (items.length === 0) {\n return <ValueText className=\"custom\" truncate placeholder={placeholder} />\n }\n\n const selectedItems = context.selectedItems\n\n if (\n context.multiple &&\n selectedItems.filter(item => !item.disabled).length >=\n context.collection.items.filter(item => !item.disabled).length &&\n allSelectedLabel\n ) {\n return (\n <ValueText className=\"custom\" truncate>\n {allSelectedLabel}\n </ValueText>\n )\n }\n\n return (\n <ValueText className=\"custom\" placeholder={placeholder}>\n {items.map(item => (\n <span key={item.value}>{renderTrigger(item)}</span>\n ))}\n </ValueText>\n )\n}\n\nfunction CustomInnerItem<Item extends SelectItem>({ item, isMultiple, renderItem }: InnerItemProps<Item>) {\n const context = useSelectItemContext()\n\n return (\n <>\n {isMultiple ? context.selected ? <MultipleCheckedIndicator /> : <MultipleUncheckedIndicator /> : null}\n {renderItem ? renderItem(item) : <ItemText truncate>{item.label}</ItemText>}\n </>\n )\n}\n\nexport function Select<Item extends SelectItem>({\n items,\n placeholder,\n emptyLabel,\n usePortal = true,\n positioning,\n renderItem,\n renderTrigger,\n virtualized,\n rowHeight = 34,\n ...props\n}: SelectProps<Item>) {\n const collection = createListCollection({\n items,\n })\n const $dialogContent = useRef<HTMLDivElement | null>(null)\n\n return (\n <Root\n lazyMount\n unmountOnExit\n collection={collection}\n positioning={{ sameWidth: true, gutter: 0, ...positioning }}\n data-recipe=\"select\"\n {...props}\n ref={(node: HTMLDivElement | null) => {\n if (node) {\n $dialogContent.current = node.closest('[role=\"dialog\"]') as HTMLDivElement | null\n }\n }}\n >\n <Control>\n <Trigger>\n {renderTrigger ? (\n <CustomInnerTrigger\n renderTrigger={renderTrigger}\n placeholder={placeholder}\n allSelectedLabel={props.allSelectedLabel}\n />\n ) : (\n <DefaultInnerTrigger placeholder={placeholder} allSelectedLabel={props.allSelectedLabel} />\n )}\n <Indicator asChild>\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M12.5303 16.2803C12.2374 16.5732 11.7626 16.5732 11.4697 16.2803L3.96967 8.78033C3.67678 8.48744 3.67678 8.01256 3.96967 7.71967C4.26256 7.42678 4.73744 7.42678 5.03033 7.71967L12 14.6893L18.9697 7.71967C19.2626 7.42678 19.7374 7.42678 20.0303 7.71967C20.3232 8.01256 20.3232 8.48744 20.0303 8.78033L12.5303 16.2803Z\"\n fill=\"currentColor\"\n />\n </svg>\n </Indicator>\n </Trigger>\n <ClearTrigger disabled={props.readOnly} asChild>\n <button>\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M10 3.125C6.20304 3.125 3.125 6.20304 3.125 10C3.125 13.797 6.20304 16.875 10 16.875C13.797 16.875 16.875 13.797 16.875 10C16.875 6.20304 13.797 3.125 10 3.125ZM1.875 10C1.875 5.51269 5.51269 1.875 10 1.875C14.4873 1.875 18.125 5.51269 18.125 10C18.125 14.4873 14.4873 18.125 10 18.125C5.51269 18.125 1.875 14.4873 1.875 10ZM7.68306 7.68306C7.92714 7.43898 8.32286 7.43898 8.56694 7.68306L10 9.11612L11.4331 7.68306C11.6771 7.43898 12.0729 7.43898 12.3169 7.68306C12.561 7.92714 12.561 8.32286 12.3169 8.56694L10.8839 10L12.3169 11.4331C12.561 11.6771 12.561 12.0729 12.3169 12.3169C12.0729 12.561 11.6771 12.561 11.4331 12.3169L10 10.8839L8.56694 12.3169C8.32286 12.561 7.92714 12.561 7.68306 12.3169C7.43898 12.0729 7.43898 11.6771 7.68306 11.4331L9.11612 10L7.68306 8.56694C7.43898 8.32286 7.43898 7.92714 7.68306 7.68306Z\"\n fill=\"currentColor\"\n />\n </svg>\n </button>\n </ClearTrigger>\n </Control>\n <ConditionalWrapper when={usePortal} wrapper={children => <Portal container={$dialogContent}>{children}</Portal>}>\n <Positioner>\n <Content>\n {items.length === 0 ? (\n <Text px=\"space-8\" textAlign=\"center\">\n {emptyLabel ?? 'Aucun résultat'}\n </Text>\n ) : virtualized ? (\n <>\n <FixedSizeList\n height={Math.min(rowHeight * items.length, 180)}\n itemCount={items.length}\n itemSize={rowHeight}\n width=\"100%\"\n >\n {({ index, style }) => (\n <ConditionalWrapper\n key={items[index].value}\n when={!!items[index].tooltip}\n wrapper={children => <Tooltip label={items[index].tooltip}>{children}</Tooltip>}\n >\n <Item key={items[index].value} item={items[index]} style={style}>\n <CustomInnerItem renderItem={renderItem} item={items[index]} />\n </Item>\n </ConditionalWrapper>\n )}\n </FixedSizeList>\n </>\n ) : (\n items.map((item: Item) => (\n <ConditionalWrapper\n key={item.value}\n when={!!item.tooltip}\n wrapper={children => <Tooltip label={item.tooltip}>{children}</Tooltip>}\n >\n <Item key={item.value} item={item}>\n <CustomInnerItem renderItem={renderItem} item={item} isMultiple={props.multiple} />\n </Item>\n </ConditionalWrapper>\n ))\n )}\n </Content>\n </Positioner>\n </ConditionalWrapper>\n <ArkSelect.HiddenSelect />\n </Root>\n )\n}\n"],"mappings":"gZAqBA,GAAM,CAAE,eAAc,eAAgB,EAAA,mBAAmB,EAAA,MAAM,EAGzD,EAAO,GAAA,EAAA,EAAA,QAAoB,EAAA,OAAU,IAAS,EAAG,OAAQ,CAC7D,aAAc,CACZ,UAAW,EACb,CACF,CAAC,EAEK,EAAe,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,YAAY,EAAG,cAAc,EACzE,EAAU,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,OAAO,EAAG,SAAS,EAC1D,EAAU,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,OAAO,EAAG,SAAS,EAC1D,EAAY,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,SAAS,EAAG,WAAW,EAChE,EAAO,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,IAAI,EAAG,MAAM,EACjD,EAAW,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,QAAQ,EAAG,UAAU,EAC7D,EAAa,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,UAAU,EAAG,YAAY,EACnE,EAAU,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,OAAO,EAAG,SAAS,EAC1D,EAAY,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,SAAS,EAAG,WAAW,EAsBhE,OACJ,EAAA,EAAA,MAAC,MAAD,CAAK,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OAAO,MAAM,sCAAlE,EACE,EAAA,EAAA,KAAC,OAAD,CAAM,EAAE,MAAM,EAAE,IAAI,MAAM,KAAK,OAAO,KAAK,GAAG,MAAM,KAAK,OAAS,CAAA,GAClE,EAAA,EAAA,KAAC,OAAD,CAAM,EAAE,MAAM,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C,CAAC,EAAM,GAAO,QACrB,QAAS,IAAY,EAAA,EAAA,KAAC,EAAA,QAAD,CAAS,MAAO,EAAM,GAAO,QAAU,UAAkB,CAAA,YAE9E,EAAA,EAAA,KAAC,EAAD,CAA+B,KAAM,EAAM,GAAe,kBACxD,EAAA,EAAA,KAAC,EAAD,CAA6B,aAAY,KAAM,EAAM,EAAS,CAAA,CAC1D,EAFK,EAAM,GAAO,KAElB,CACY,EAPb,EAAM,GAAO,KAOA,CAET,CAAA,CACf,CAAA,EAEF,EAAM,IAAK,IACT,EAAA,EAAA,KAAC,EAAA,mBAAD,CAEE,KAAM,CAAC,CAAC,EAAK,QACb,QAAS,IAAY,EAAA,EAAA,KAAC,EAAA,QAAD,CAAS,MAAO,EAAK,QAAU,UAAkB,CAAA,YAEtE,EAAA,EAAA,KAAC,EAAD,CAA6B,iBAC3B,EAAA,EAAA,KAAC,EAAD,CAA6B,aAAkB,OAAM,WAAY,EAAM,QAAW,CAAA,CAC9E,EAFK,EAAK,KAEV,CACY,EAPb,EAAK,KAOQ,CACrB,CAEI,CAAA,CACC,CAAA,CACM,CAAA,GACpB,EAAA,EAAA,KAAC,EAAA,OAAU,aAAX,CAAyB,CAAA,CACrB,GAEV"}
1
+ {"version":3,"file":"Select.cjs","names":[],"sources":["../../../src/components/select/Select.tsx"],"sourcesContent":["import {\n createListCollection,\n Portal,\n Select as ArkSelect,\n type SelectRootProps,\n useSelectItemContext,\n useSelectContext,\n} from '@ark-ui/react'\nimport { FC, Fragment, ReactNode, useRef } from 'react'\nimport { styled } from '@stokelp/styled-system/jsx'\n\nimport { select } from '@stokelp/styled-system/recipes'\nimport { createStyleContext } from '~/utils/slots'\n\nimport { ConditionalWrapper } from '~/shared/ConditionalWrapper'\nimport { Text } from '~/components/text/Text'\nimport { Tooltip } from '~/components/tooltip/Tooltip'\nimport { HTMLStyledProps, RecipeVariantProps } from '@stokelp/styled-system/types'\nimport { FixedSizeList } from 'react-window'\nimport { css } from '@stokelp/styled-system/css'\n\nconst { withProvider, withContext } = createStyleContext(select)\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst Root = withProvider(styled(ArkSelect.Root<any>), 'root', {\n defaultProps: {\n loopFocus: true,\n },\n})\n\nconst ClearTrigger = withContext(styled(ArkSelect.ClearTrigger), 'clearTrigger')\nconst Content = withContext(styled(ArkSelect.Content), 'content')\nconst Control = withContext(styled(ArkSelect.Control), 'control')\nconst Indicator = withContext(styled(ArkSelect.Indicator), 'indicator')\nconst Item = withContext(styled(ArkSelect.Item), 'item')\nconst ItemText = withContext(styled(ArkSelect.ItemText), 'itemText')\nconst Positioner = withContext(styled(ArkSelect.Positioner), 'positioner')\nconst Trigger = withContext(styled(ArkSelect.Trigger), 'trigger')\nconst ValueText = withContext(styled(ArkSelect.ValueText), 'valueText')\n\nexport interface SelectItem {\n value: string | number\n label: string\n tooltip?: ReactNode\n disabled?: boolean\n /**\n * Renders a thin divider line after this item, separating option groups.\n * Ignored by the virtualized list (fixed row heights).\n */\n separatorAfter?: boolean\n}\n\nexport type SelectProps<Item extends SelectItem> = Omit<SelectRootProps<Item>, 'collection'> & {\n items: Item[] | readonly Item[]\n renderItem?: (item: Item) => ReactNode\n renderTrigger?: (item: Item) => ReactNode\n emptyLabel?: string\n placeholder?: string\n allSelectedLabel?: string\n usePortal?: boolean\n virtualized?: boolean\n rowHeight?: number\n} & HTMLStyledProps<'div'> &\n RecipeVariantProps<typeof select>\n\nconst MultipleUncheckedIndicator: FC = () => (\n <svg width=\"16\" height=\"17\" viewBox=\"0 0 16 17\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect x=\"0.5\" y=\"1\" width=\"15\" height=\"15\" rx=\"3.5\" fill=\"white\" />\n <rect x=\"0.5\" y=\"1\" width=\"15\" height=\"15\" rx=\"3.5\" className={css({ stroke: 'grey.100' })} />\n </svg>\n)\n\nconst MultipleCheckedIndicator: FC = () => (\n <svg width=\"16\" height=\"17\" viewBox=\"0 0 16 17\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect y=\"0.5\" width=\"16\" height=\"16\" rx=\"4\" className={css({ fill: 'primary.500' })} />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M11.958 4.81298C12.1303 4.92787 12.1769 5.16069 12.062 5.33301L7.56202 12.083C7.4997 12.1765 7.39875 12.2371 7.28695 12.2482C7.17515 12.2592 7.06428 12.2196 6.98483 12.1402L3.98483 9.14017C3.83839 8.99372 3.83839 8.75628 3.98483 8.60984C4.13128 8.46339 4.36872 8.46339 4.51517 8.60984L7.19172 11.2864L11.438 4.91699C11.5529 4.74467 11.7857 4.6981 11.958 4.81298Z\"\n fill=\"white\"\n />\n </svg>\n)\n\ninterface InnerItemProps<Item extends SelectItem> {\n item: Item\n isMultiple?: boolean\n renderItem?: (item: Item) => ReactNode\n}\n\ninterface InnerTriggerProps<Item extends SelectItem> {\n renderTrigger: (item: Item) => ReactNode\n placeholder?: string\n allSelectedLabel?: string\n}\n\ninterface DefaultInnerTriggerProps {\n placeholder?: string\n allSelectedLabel?: string\n}\n\nfunction DefaultInnerTrigger({ placeholder, allSelectedLabel }: DefaultInnerTriggerProps) {\n const context = useSelectContext()\n const items = context.collection.items\n const selectedItems = context.selectedItems\n\n if (\n context.multiple &&\n selectedItems.filter(item => !item.disabled).length >= items.filter(item => !item.disabled).length &&\n allSelectedLabel\n ) {\n return (\n <ValueText className=\"custom\" truncate>\n {allSelectedLabel}\n </ValueText>\n )\n }\n\n return <ValueText truncate placeholder={placeholder} />\n}\n\nfunction CustomInnerTrigger<Item extends SelectItem>({\n renderTrigger,\n placeholder,\n allSelectedLabel,\n}: InnerTriggerProps<Item>) {\n const context = useSelectContext()\n const items = context.value && context.value.length > 0 ? context.collection.findMany(context.value) : []\n\n if (items.length === 0) {\n return <ValueText className=\"custom\" truncate placeholder={placeholder} />\n }\n\n const selectedItems = context.selectedItems\n\n if (\n context.multiple &&\n selectedItems.filter(item => !item.disabled).length >=\n context.collection.items.filter(item => !item.disabled).length &&\n allSelectedLabel\n ) {\n return (\n <ValueText className=\"custom\" truncate>\n {allSelectedLabel}\n </ValueText>\n )\n }\n\n return (\n <ValueText className=\"custom\" placeholder={placeholder}>\n {items.map(item => (\n <span key={item.value}>{renderTrigger(item)}</span>\n ))}\n </ValueText>\n )\n}\n\nfunction CustomInnerItem<Item extends SelectItem>({ item, isMultiple, renderItem }: InnerItemProps<Item>) {\n const context = useSelectItemContext()\n\n return (\n <>\n {isMultiple ? context.selected ? <MultipleCheckedIndicator /> : <MultipleUncheckedIndicator /> : null}\n {renderItem ? renderItem(item) : <ItemText truncate>{item.label}</ItemText>}\n </>\n )\n}\n\nexport function Select<Item extends SelectItem>({\n items,\n placeholder,\n emptyLabel,\n usePortal = true,\n positioning,\n renderItem,\n renderTrigger,\n virtualized,\n rowHeight = 34,\n ...props\n}: SelectProps<Item>) {\n const collection = createListCollection({\n items,\n })\n const $dialogContent = useRef<HTMLDivElement | null>(null)\n\n return (\n <Root\n lazyMount\n unmountOnExit\n collection={collection}\n positioning={{ sameWidth: true, gutter: 0, ...positioning }}\n data-recipe=\"select\"\n {...props}\n ref={(node: HTMLDivElement | null) => {\n if (node) {\n $dialogContent.current = node.closest('[role=\"dialog\"]') as HTMLDivElement | null\n }\n }}\n >\n <Control>\n <Trigger>\n {renderTrigger ? (\n <CustomInnerTrigger\n renderTrigger={renderTrigger}\n placeholder={placeholder}\n allSelectedLabel={props.allSelectedLabel}\n />\n ) : (\n <DefaultInnerTrigger placeholder={placeholder} allSelectedLabel={props.allSelectedLabel} />\n )}\n <Indicator asChild>\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M12.5303 16.2803C12.2374 16.5732 11.7626 16.5732 11.4697 16.2803L3.96967 8.78033C3.67678 8.48744 3.67678 8.01256 3.96967 7.71967C4.26256 7.42678 4.73744 7.42678 5.03033 7.71967L12 14.6893L18.9697 7.71967C19.2626 7.42678 19.7374 7.42678 20.0303 7.71967C20.3232 8.01256 20.3232 8.48744 20.0303 8.78033L12.5303 16.2803Z\"\n fill=\"currentColor\"\n />\n </svg>\n </Indicator>\n </Trigger>\n <ClearTrigger disabled={props.readOnly} asChild>\n <button>\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M10 3.125C6.20304 3.125 3.125 6.20304 3.125 10C3.125 13.797 6.20304 16.875 10 16.875C13.797 16.875 16.875 13.797 16.875 10C16.875 6.20304 13.797 3.125 10 3.125ZM1.875 10C1.875 5.51269 5.51269 1.875 10 1.875C14.4873 1.875 18.125 5.51269 18.125 10C18.125 14.4873 14.4873 18.125 10 18.125C5.51269 18.125 1.875 14.4873 1.875 10ZM7.68306 7.68306C7.92714 7.43898 8.32286 7.43898 8.56694 7.68306L10 9.11612L11.4331 7.68306C11.6771 7.43898 12.0729 7.43898 12.3169 7.68306C12.561 7.92714 12.561 8.32286 12.3169 8.56694L10.8839 10L12.3169 11.4331C12.561 11.6771 12.561 12.0729 12.3169 12.3169C12.0729 12.561 11.6771 12.561 11.4331 12.3169L10 10.8839L8.56694 12.3169C8.32286 12.561 7.92714 12.561 7.68306 12.3169C7.43898 12.0729 7.43898 11.6771 7.68306 11.4331L9.11612 10L7.68306 8.56694C7.43898 8.32286 7.43898 7.92714 7.68306 7.68306Z\"\n fill=\"currentColor\"\n />\n </svg>\n </button>\n </ClearTrigger>\n </Control>\n <ConditionalWrapper when={usePortal} wrapper={children => <Portal container={$dialogContent}>{children}</Portal>}>\n <Positioner>\n <Content>\n {items.length === 0 ? (\n <Text px=\"space-8\" textAlign=\"center\">\n {emptyLabel ?? 'Aucun résultat'}\n </Text>\n ) : virtualized ? (\n <>\n <FixedSizeList\n height={Math.min(rowHeight * items.length, 180)}\n itemCount={items.length}\n itemSize={rowHeight}\n width=\"100%\"\n >\n {({ index, style }) => (\n <ConditionalWrapper\n key={items[index].value}\n when={!!items[index].tooltip}\n wrapper={children => <Tooltip label={items[index].tooltip}>{children}</Tooltip>}\n >\n <Item key={items[index].value} item={items[index]} style={style}>\n <CustomInnerItem renderItem={renderItem} item={items[index]} />\n </Item>\n </ConditionalWrapper>\n )}\n </FixedSizeList>\n </>\n ) : (\n items.map((item: Item) => (\n <Fragment key={item.value}>\n <ConditionalWrapper\n key={item.value}\n when={!!item.tooltip}\n wrapper={children => <Tooltip label={item.tooltip}>{children}</Tooltip>}\n >\n <Item key={item.value} item={item}>\n <CustomInnerItem renderItem={renderItem} item={item} isMultiple={props.multiple} />\n </Item>\n </ConditionalWrapper>\n {item.separatorAfter && (\n <div\n role=\"separator\"\n className={css({\n height: '1px',\n flexShrink: 0,\n backgroundColor: 'grey.100',\n marginY: 'space-4',\n marginX: 'space-8',\n })}\n />\n )}\n </Fragment>\n ))\n )}\n </Content>\n </Positioner>\n </ConditionalWrapper>\n <ArkSelect.HiddenSelect />\n </Root>\n )\n}\n"],"mappings":"gZAqBA,GAAM,CAAE,eAAc,eAAgB,EAAA,mBAAmB,EAAA,MAAM,EAGzD,EAAO,GAAA,EAAA,EAAA,QAAoB,EAAA,OAAU,IAAS,EAAG,OAAQ,CAC7D,aAAc,CACZ,UAAW,EACb,CACF,CAAC,EAEK,EAAe,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,YAAY,EAAG,cAAc,EACzE,EAAU,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,OAAO,EAAG,SAAS,EAC1D,EAAU,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,OAAO,EAAG,SAAS,EAC1D,EAAY,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,SAAS,EAAG,WAAW,EAChE,EAAO,GAAA,EAAA,EAAA,QAAmB,EAAA,OAAU,IAAI,EAAG,MAAM,EACjD,EAAW,GAAA,EAAA,EA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,EAAA,EAAA,KAAC,MAAD,CACE,KAAK,YACL,WAAA,EAAA,EAAA,KAAe,CACb,OAAQ,MACR,WAAY,EACZ,gBAAiB,WACjB,QAAS,UACT,QAAS,SACX,CAAC,CACF,CAAA,CAEK,CAAA,EAtBK,EAAK,KAsBV,CACX,CAEI,CAAA,CACC,CAAA,CACM,CAAA,GACpB,EAAA,EAAA,KAAC,EAAA,OAAU,aAAX,CAAyB,CAAA,CACrB,GAEV"}
@@ -7,6 +7,11 @@ export interface SelectItem {
7
7
  label: string;
8
8
  tooltip?: ReactNode;
9
9
  disabled?: boolean;
10
+ /**
11
+ * Renders a thin divider line after this item, separating option groups.
12
+ * Ignored by the virtualized list (fixed row heights).
13
+ */
14
+ separatorAfter?: boolean;
10
15
  }
11
16
  export type SelectProps<Item extends SelectItem> = Omit<SelectRootProps<Item>, 'collection'> & {
12
17
  items: Item[] | readonly Item[];