@jamsrui/drawer 0.0.15 → 0.0.17

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 +1 @@
1
- import{useRenderElement as o}from"@jamsrui/hooks";import{useDrawerContext as t}from"./drawer-context.mjs";const m=r=>{const{getBodyProps:e}=t();return o("div",{props:[e(r)]})};export{m as DrawerBody};
1
+ "use client";import{useRenderElement as o}from"@jamsrui/hooks";import{useDrawerContext as t}from"./drawer-context.mjs";const m=e=>{const{getBodyProps:r}=t();return o("div",{props:[r(e)]})};export{m as DrawerBody};
@@ -1 +1 @@
1
- import{jsx as o}from"react/jsx-runtime";import{IconButton as r}from"@jamsrui/icon-button";import{CloseIcon as n}from"@jamsrui/icons";import{useDrawerContext as s}from"./drawer-context.mjs";const c=t=>{const{getCloseButtonProps:e}=s();return o(r,{label:"Close Drawer",...e(t),children:o(n,{className:"size-4"})})};export{c as DrawerCloseButton};
1
+ "use client";import{jsx as o}from"react/jsx-runtime";import{IconButton as r}from"@jamsrui/icon-button";import{CloseIcon as n}from"@jamsrui/icons";import{useDrawerContext as s}from"./drawer-context.mjs";const c=t=>{const{getCloseButtonProps:e}=s();return o(r,{label:"Close Drawer",...e(t),children:o(n,{className:"size-4"})})};export{c as DrawerCloseButton};
@@ -1 +1 @@
1
- import{cloneElement as t,isValidElement as n}from"react";import{useDrawerContext as l}from"./drawer-context.mjs";const a=r=>{const{children:e}=r,{getTriggerCloseProps:o}=l();return n(e)?t(e,o()):(console.warn("Invalid children passed to DialogCloseTrigger"),null)};export{a as DrawerCloseTrigger};
1
+ "use client";import{cloneElement as t,isValidElement as n}from"react";import{useDrawerContext as l}from"./drawer-context.mjs";const a=r=>{const{children:e}=r,{getTriggerCloseProps:o}=l();return n(e)?t(e,o()):(console.warn("Invalid children passed to DialogCloseTrigger"),null)};export{a as DrawerCloseTrigger};
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { GlobalConfigProps } from '@jamsrui/core';
2
+ import { WithGlobalConfig } from '@jamsrui/core';
3
3
  import { Drawer } from './drawer.mjs';
4
4
  import './use-drawer.mjs';
5
5
  import '@floating-ui/react';
@@ -21,7 +21,7 @@ declare const DrawerConfig: (props: Omit<Partial<DrawerConfig.Props>, "children"
21
21
  children: React.ReactNode;
22
22
  }) => react_jsx_runtime.JSX.Element;
23
23
  declare namespace DrawerConfig {
24
- interface Props extends Drawer.Props, GlobalConfigProps<Drawer.Props> {
24
+ interface Props extends WithGlobalConfig<Drawer.Props> {
25
25
  }
26
26
  }
27
27
 
@@ -1 +1 @@
1
- import{createConfigContext as r}from"@jamsrui/utils";const[e,a]=r({displayName:"DrawerConfig"});export{e as DrawerConfig,a as useDrawerConfig};
1
+ "use client";import{createConfigContext as r}from"@jamsrui/utils";const[o,a]=r({displayName:"DrawerConfig"});export{o as DrawerConfig,a as useDrawerConfig};
@@ -1 +1 @@
1
- import{jsx as o,jsxs as f}from"react/jsx-runtime";import{FloatingOverlay as p,FloatingPortal as m}from"@floating-ui/react";import{AnimatePresence as l,motion as s}from"motion/react";import{DrawerCloseButton as c}from"./drawer-close-button.mjs";import{useDrawerContext as P}from"./drawer-context.mjs";import{DrawerPopover as d}from"./drawer-popover.mjs";const h=r=>{const{children:e}=r,{getContentProps:t,isOpen:n,getBackdropProps:i,hideCloseButton:a}=P();return o(l,{children:n?o(m,{children:o(p,{...i(),children:o(d,{children:f(s.div,{...t(r),children:[!a&&o(c,{}),e]})})})}):null})};export{h as DrawerContent};
1
+ "use client";import{jsx as o,jsxs as f}from"react/jsx-runtime";import{FloatingOverlay as p,FloatingPortal as m}from"@floating-ui/react";import{AnimatePresence as l,motion as s}from"motion/react";import{DrawerCloseButton as c}from"./drawer-close-button.mjs";import{useDrawerContext as P}from"./drawer-context.mjs";import{DrawerPopover as d}from"./drawer-popover.mjs";const u=e=>{const{children:r}=e,{getContentProps:t,isOpen:n,getBackdropProps:i,hideCloseButton:a}=P();return o(l,{children:n?o(m,{children:o(p,{...i(),children:o(d,{children:f(s.div,{...t(e),children:[!a&&o(c,{}),r]})})})}):null})};export{u as DrawerContent};
@@ -1 +1 @@
1
- import{createContext as r,use as t}from"react";const o=r(null),s=()=>{const e=t(o);if(!e)throw new Error("useDrawerContext must be used within DrawerContext");return e};export{o as DrawerContext,s as useDrawerContext};
1
+ "use client";import{createContext as r,use as t}from"react";const o=r(null),s=()=>{const e=t(o);if(!e)throw new Error("useDrawerContext must be used within DrawerContext");return e};export{o as DrawerContext,s as useDrawerContext};
@@ -1 +1 @@
1
- import{useRenderElement as o}from"@jamsrui/hooks";import{useDrawerContext as t}from"./drawer-context.mjs";const m=r=>{const{getFooterProps:e}=t();return o("div",{props:[e(r)]})};export{m as DrawerFooter};
1
+ "use client";import{useRenderElement as o}from"@jamsrui/hooks";import{useDrawerContext as t}from"./drawer-context.mjs";const m=e=>{const{getFooterProps:r}=t();return o("div",{props:[r(e)]})};export{m as DrawerFooter};
@@ -1 +1 @@
1
- import{useRenderElement as t}from"@jamsrui/hooks";import{useDrawerContext as o}from"./drawer-context.mjs";const a=e=>{const{getHeaderProps:r}=o();return t("div",{props:[r(e)]})};export{a as DrawerHeader};
1
+ "use client";import{useRenderElement as t}from"@jamsrui/hooks";import{useDrawerContext as o}from"./drawer-context.mjs";const a=e=>{const{getHeaderProps:r}=o();return t("div",{props:[r(e)]})};export{a as DrawerHeader};
@@ -1 +1 @@
1
- import{useRenderElement as o}from"@jamsrui/hooks";import{useDrawerContext as t}from"./drawer-context.mjs";const m=r=>{const{getPopoverProps:e}=t();return o("div",{props:[e(r)]})};export{m as DrawerPopover};
1
+ "use client";import{useRenderElement as o}from"@jamsrui/hooks";import{useDrawerContext as t}from"./drawer-context.mjs";const m=e=>{const{getPopoverProps:r}=t();return o("div",{props:[r(e)]})};export{m as DrawerPopover};
@@ -1 +1 @@
1
- import{cloneElement as n,isValidElement as o}from"react";import{useDrawerContext as i}from"./drawer-context.mjs";const c=e=>{const{children:r}=e,{getTriggerProps:t}=i();return o(r)?n(r,t()):(console.warn("Invalid children passed to DialogTrigger"),null)};export{c as DrawerTrigger};
1
+ "use client";import{cloneElement as n,isValidElement as o}from"react";import{useDrawerContext as i}from"./drawer-context.mjs";const c=r=>{const{children:e}=r,{getTriggerProps:t}=i();return o(e)?n(e,t()):(console.warn("Invalid children passed to DialogTrigger"),null)};export{c as DrawerTrigger};
package/dist/drawer.mjs CHANGED
@@ -1 +1 @@
1
- import{jsx as m}from"react/jsx-runtime";import{mergeConfigProps as a}from"@jamsrui/utils";import{useDrawerConfig as s}from"./drawer-config.mjs";import{DrawerContext as c}from"./drawer-context.mjs";import{useDrawer as p}from"./use-drawer.mjs";const x=r=>{const{children:o}=r,e=s(),t=a(e,e,r),n=p(t);return m(c,{value:n,children:o})};export{x as Drawer};
1
+ "use client";import{jsx as p}from"react/jsx-runtime";import{mergeConfigProps as n}from"@jamsrui/utils";import{useDrawerConfig as s}from"./drawer-config.mjs";import{DrawerContext as c}from"./drawer-context.mjs";import{drawerVariants as i}from"./styles.mjs";import{useDrawer as m}from"./use-drawer.mjs";const x=r=>{const{children:e}=r,o=s(),t=n(i.defaultVariants,o,r),a=m(t);return p(c,{value:a,children:e})};export{x as Drawer};
package/dist/index.d.mts CHANGED
@@ -1,19 +1,53 @@
1
- export { Drawer } from './drawer.mjs';
2
- export { DrawerBody } from './drawer-body.mjs';
3
- export { DrawerCloseButton } from './drawer-close-button.mjs';
4
- export { DrawerCloseTrigger } from './drawer-close-trigger.mjs';
5
- export { DrawerConfig, useDrawerConfig } from './drawer-config.mjs';
6
- export { DrawerContent } from './drawer-content.mjs';
7
- export { DrawerFooter } from './drawer-footer.mjs';
8
- export { DrawerHeader } from './drawer-header.mjs';
9
- export { DrawerTrigger } from './drawer-trigger.mjs';
10
- import 'react/jsx-runtime';
1
+ import * as react from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { Drawer as Drawer$1 } from './drawer.mjs';
4
+ import { DrawerBody } from './drawer-body.mjs';
5
+ import { DrawerCloseButton } from './drawer-close-button.mjs';
6
+ import { DrawerCloseTrigger } from './drawer-close-trigger.mjs';
7
+ import { DrawerConfig } from './drawer-config.mjs';
8
+ export { useDrawerConfig } from './drawer-config.mjs';
9
+ export { DrawerContext, useDrawerContext } from './drawer-context.mjs';
10
+ import { DrawerContent } from './drawer-content.mjs';
11
+ import { DrawerFooter } from './drawer-footer.mjs';
12
+ import { DrawerHeader } from './drawer-header.mjs';
13
+ import { DrawerTrigger } from './drawer-trigger.mjs';
11
14
  import './use-drawer.mjs';
12
15
  import '@floating-ui/react';
13
16
  import '@jamsrui/utils';
14
17
  import './drawer-popover.mjs';
15
- import 'react';
16
18
  import './styles.mjs';
17
19
  import '@jamsrui/icon-button';
18
20
  import '@jamsrui/core';
19
21
  import 'motion/react';
22
+
23
+ declare const Drawer: ((props: Drawer$1.Props) => react_jsx_runtime.JSX.Element) & {
24
+ Body: (props: DrawerBody.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
25
+ CloseButton: (props: DrawerCloseButton.Props) => react_jsx_runtime.JSX.Element;
26
+ CloseTrigger: (props: DrawerCloseTrigger.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | null;
27
+ Content: (props: DrawerContent.Props) => react_jsx_runtime.JSX.Element;
28
+ Footer: (props: DrawerFooter.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
29
+ Header: (props: DrawerHeader.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
30
+ Trigger: (props: DrawerTrigger.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | null;
31
+ };
32
+ declare namespace Drawer {
33
+ interface Props extends Drawer$1.Props {
34
+ }
35
+ interface Config extends DrawerConfig.Props {
36
+ }
37
+ interface Body extends DrawerBody.Props {
38
+ }
39
+ interface CloseButton extends DrawerCloseButton.Props {
40
+ }
41
+ interface CloseTrigger extends DrawerCloseTrigger.Props {
42
+ }
43
+ interface Content extends DrawerContent.Props {
44
+ }
45
+ interface Footer extends DrawerFooter.Props {
46
+ }
47
+ interface Header extends DrawerHeader.Props {
48
+ }
49
+ interface Trigger extends DrawerTrigger.Props {
50
+ }
51
+ }
52
+
53
+ export { Drawer, DrawerBody, DrawerCloseButton, DrawerCloseTrigger, DrawerConfig, DrawerContent, DrawerFooter, DrawerHeader, DrawerTrigger };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- "use client";import{Drawer as o}from"./drawer.mjs";import{DrawerBody as a}from"./drawer-body.mjs";import{DrawerCloseButton as w}from"./drawer-close-button.mjs";import{DrawerCloseTrigger as m}from"./drawer-close-trigger.mjs";import{DrawerConfig as x,useDrawerConfig as g}from"./drawer-config.mjs";import{DrawerContent as i}from"./drawer-content.mjs";import{DrawerFooter as s}from"./drawer-footer.mjs";import{DrawerHeader as u}from"./drawer-header.mjs";import{DrawerTrigger as B}from"./drawer-trigger.mjs";export{o as Drawer,a as DrawerBody,w as DrawerCloseButton,m as DrawerCloseTrigger,x as DrawerConfig,i as DrawerContent,s as DrawerFooter,u as DrawerHeader,B as DrawerTrigger,g as useDrawerConfig};
1
+ import{Drawer as p}from"./drawer.mjs";import{DrawerBody as r}from"./drawer-body.mjs";import{DrawerCloseButton as e}from"./drawer-close-button.mjs";import{DrawerCloseTrigger as o}from"./drawer-close-trigger.mjs";import{DrawerConfig as i,useDrawerConfig as w}from"./drawer-config.mjs";import{DrawerContext as D,useDrawerContext as f}from"./drawer-context.mjs";import{DrawerContent as t}from"./drawer-content.mjs";import{DrawerFooter as a}from"./drawer-footer.mjs";import{DrawerHeader as n}from"./drawer-header.mjs";import{DrawerTrigger as s}from"./drawer-trigger.mjs";const u=Object.assign(p,{Body:r,CloseButton:e,CloseTrigger:o,Content:t,Footer:a,Header:n,Trigger:s});export{u as Drawer,r as DrawerBody,e as DrawerCloseButton,o as DrawerCloseTrigger,i as DrawerConfig,t as DrawerContent,D as DrawerContext,a as DrawerFooter,n as DrawerHeader,s as DrawerTrigger,w as useDrawerConfig,f as useDrawerContext};
@@ -1 +1 @@
1
- import{useCallback as t,useMemo as j}from"react";import{useClick as z,useDismiss as A,useFloating as E,useInteractions as $,useRole as q}from"@floating-ui/react";import{useControlledState as J}from"@jamsrui/hooks";import{cn as a,dataAttrDev as n,mapPropsVariants as L,mergeProps as p}from"@jamsrui/utils";import{drawerVariants as O}from"./styles.mjs";const _=k=>{const[x,G]=L(k,O.variantKeys),{classNames:s,slotProps:e,defaultOpen:S,isOpen:T,onOpenChange:H,isDismissible:I,isKeyboardDismissible:K,hideCloseButton:d=!1}=x,r=O(G),[i,m]=J({defaultProp:S,onChange:H,prop:T}),{context:l,refs:{setFloating:P,setReference:u}}=E({open:i,onOpenChange:m}),M=z(l,{enabled:!0}),V=A(l,{escapeKey:K,outsidePressEvent:"click",outsidePress:I}),R=q(l),U=$([M,V,R]),{getFloatingProps:f,getReferenceProps:g}=U,c=t(()=>{m(!1)},[m]),y=t(o=>({...p(e?.header,o),"data-slot":n("header"),className:r.header({className:a(e?.header?.className,s?.header,o.className)})}),[s?.header,e?.header,r]),w=t(o=>({...p(e?.footer,o),"data-slot":n("footer"),className:r.footer({className:a(e?.footer?.className,s?.footer,o.className)})}),[s?.footer,e?.footer,r]),D=t(o=>({...p(e?.body,o),"data-slot":n("body"),className:r.body({className:a(e?.body?.className,s?.body,o.className)})}),[s?.body,e?.body,r]),N=t(o=>({...p(e?.popover,o),"data-slot":n("popover"),className:r.popover({className:a(e?.popover?.className,s?.popover,o.className)}),ref:P,...f()}),[s?.popover,f,P,e?.popover,r]),b=t(o=>({...p(e?.content,o),"data-slot":n("content"),className:r.content({className:a(e?.content?.className,s?.content,o.className)}),initial:{opacity:0,x:"100%",transition:{type:"spring",stiffness:180,damping:30,mass:.9}},animate:{opacity:1,x:0,transition:{type:"spring",stiffness:120,damping:20,mass:.8}},exit:{opacity:0,x:"100%",transition:{type:"spring",stiffness:300,damping:30,mass:.6}}}),[s?.content,e?.content,r]),C=t(o=>({...p(e?.closeButton,o),"data-slot":n("closeButton"),className:r.closeButton({className:a(e?.closeButton?.className,s?.closeButton,o.className)}),radius:"full",size:"sm",onClick:c}),[s?.closeButton,c,e?.closeButton,r]),v=t(()=>({lockScroll:!0,"data-slot":n("backdrop"),className:r.backdrop({className:a(s?.backdrop)})}),[s?.backdrop,r]),B=t(()=>({context:l,modal:!0}),[l]),h=t(()=>({...g({ref:u})}),[g,u]),F=t(()=>({onClick:c}),[c]);return j(()=>({getHeaderProps:y,getFooterProps:w,getBodyProps:D,getContentProps:b,getCloseButtonProps:C,getBackdropProps:v,getFocusManagerProps:B,getTriggerProps:h,getTriggerCloseProps:F,isOpen:i,getPopoverProps:N,hideCloseButton:d}),[y,w,D,b,C,v,B,h,F,i,N,d])};export{_ as useDrawer};
1
+ "use client";import{useCallback as t,useMemo as j}from"react";import{useClick as z,useDismiss as A,useFloating as E,useInteractions as $,useRole as q}from"@floating-ui/react";import{useControlledState as J}from"@jamsrui/hooks";import{cn as a,dataAttrDev as n,mapPropsVariants as L,mergeProps as p}from"@jamsrui/utils";import{drawerVariants as O}from"./styles.mjs";const _=k=>{const[x,G]=L(k,O.variantKeys),{classNames:s,slotProps:e,defaultOpen:S,isOpen:T,onOpenChange:H,isDismissible:I,isKeyboardDismissible:K,hideCloseButton:d=!1}=x,r=O(G),[i,m]=J({defaultProp:S,onChange:H,prop:T}),{context:l,refs:{setFloating:P,setReference:u}}=E({open:i,onOpenChange:m}),M=z(l,{enabled:!0}),V=A(l,{escapeKey:K,outsidePressEvent:"click",outsidePress:I}),R=q(l),U=$([M,V,R]),{getFloatingProps:f,getReferenceProps:g}=U,c=t(()=>{m(!1)},[m]),y=t(o=>({...p(e?.header,o),"data-slot":n("header"),className:r.header({className:a(e?.header?.className,s?.header,o.className)})}),[s?.header,e?.header,r]),w=t(o=>({...p(e?.footer,o),"data-slot":n("footer"),className:r.footer({className:a(e?.footer?.className,s?.footer,o.className)})}),[s?.footer,e?.footer,r]),D=t(o=>({...p(e?.body,o),"data-slot":n("body"),className:r.body({className:a(e?.body?.className,s?.body,o.className)})}),[s?.body,e?.body,r]),N=t(o=>({...p(e?.popover,o),"data-slot":n("popover"),className:r.popover({className:a(e?.popover?.className,s?.popover,o.className)}),ref:P,...f()}),[s?.popover,f,P,e?.popover,r]),b=t(o=>({...p(e?.content,o),"data-slot":n("content"),className:r.content({className:a(e?.content?.className,s?.content,o.className)}),initial:{opacity:0,x:"100%",transition:{type:"spring",stiffness:180,damping:30,mass:.9}},animate:{opacity:1,x:0,transition:{type:"spring",stiffness:120,damping:20,mass:.8}},exit:{opacity:0,x:"100%",transition:{type:"spring",stiffness:300,damping:30,mass:.6}}}),[s?.content,e?.content,r]),C=t(o=>({...p(e?.closeButton,o),"data-slot":n("closeButton"),className:r.closeButton({className:a(e?.closeButton?.className,s?.closeButton,o.className)}),radius:"full",size:"sm",onClick:c}),[s?.closeButton,c,e?.closeButton,r]),v=t(()=>({lockScroll:!0,"data-slot":n("backdrop"),className:r.backdrop({className:a(s?.backdrop)})}),[s?.backdrop,r]),B=t(()=>({context:l,modal:!0}),[l]),h=t(()=>({...g({ref:u})}),[g,u]),F=t(()=>({onClick:c}),[c]);return j(()=>({getHeaderProps:y,getFooterProps:w,getBodyProps:D,getContentProps:b,getCloseButtonProps:C,getBackdropProps:v,getFocusManagerProps:B,getTriggerProps:h,getTriggerCloseProps:F,isOpen:i,getPopoverProps:N,hideCloseButton:d}),[y,w,D,b,C,v,B,h,F,i,N,d])};export{_ as useDrawer};
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@jamsrui/drawer",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "peerDependencies": {
5
5
  "motion": ">=12",
6
6
  "react": ">=19"
7
7
  },
8
8
  "dependencies": {
9
9
  "@floating-ui/react": ">=0.27",
10
- "@jamsrui/hooks": "^0.0.15",
11
- "@jamsrui/core": "^0.0.13",
12
- "@jamsrui/utils": "^0.0.15",
13
- "@jamsrui/icons": "^0.0.13",
14
- "@jamsrui/icon-button": "^0.0.15"
10
+ "@jamsrui/hooks": "^0.0.17",
11
+ "@jamsrui/icons": "^0.0.14",
12
+ "@jamsrui/utils": "^0.0.17",
13
+ "@jamsrui/core": "^0.0.14",
14
+ "@jamsrui/icon-button": "^0.0.17"
15
15
  },
16
16
  "exports": {
17
17
  ".": {