automoby-kit 1.0.46 → 1.0.47

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
- "use client";"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("react-dom"),n=require("./utils.js"),o=require("./contexts.js");const l=t.forwardRef(({children:l,direction:a="bottom",fullScreen:s=!1,isOpen:u=!1,onClose:i,className:d,isMobile:c,keepMounted:f,...b},m)=>{const[h,w]=t.useState(!1),x=o.useMobile(),p=c??x,y=t.useRef(null),v=t.useRef(null);t.useEffect(()=>{w(!0)},[]),t.useEffect(()=>{const handleEscape=e=>{"Escape"===e.key&&u&&i&&i()};return u&&(document.addEventListener("keydown",handleEscape),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",handleEscape),document.body.style.overflow="auto"}},[u,i]);const g=n("fixed inset-0 z-[1000] transition-all duration-300",{"bg-neutral-darker/50 backdrop-blur-sm":u,"bg-transparent pointer-events-none":!u,"hidden invisible absolute inset-0":f&&!h}),k=n("fixed bg-white shadow-2xl transition-all duration-300 ease-out overflow-auto",(()=>{switch(a){case"top":return"top-0 left-0 right-0";case"bottom":default:return"bottom-0 left-0 right-0";case"left":return"top-0 left-0 bottom-0";case"right":return"top-0 right-0 bottom-0"}})(),(()=>{const e="top"===a||"bottom"===a;return s?"w-full h-full":e?"w-full max-h-[90vh]":"h-full max-w-[90vw]"})(),(()=>{if(!u)switch(a){case"top":return"-translate-y-full";case"bottom":default:return"translate-y-full";case"left":return"-translate-x-full";case"right":return"translate-x-full"}return"translate-x-0 translate-y-0"})(),{"rounded-t-2xl":"bottom"===a&&!s,"rounded-b-2xl":"top"===a&&!s,"rounded-r-2xl":"left"===a&&!s,"rounded-l-2xl":"right"===a&&!s,"p-6":!p,"p-4":p},d),E=e.jsx("div",{ref:y,className:g,onClick:e=>{!s&&i&&y.current&&e.target===y.current&&i()},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||!s&&i&&y.current&&e.target===y.current&&i()},tabIndex:-1,role:"button","aria-label":"Close drawer","aria-hidden":!u,children:e.jsx("div",{ref:m||v,className:k,role:"dialog","aria-modal":"true","aria-label":"Drawer",...b,children:l})});return f||h?f&&!h?E:r.createPortal(E,document.body):null});l.displayName="Drawer",exports.Drawer=l;
1
+ "use client";"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("react-dom"),l=require("./utils.js"),n=require("./contexts.js");const o=t.forwardRef(({children:o,direction:a="bottom",fullScreen:u=!1,isOpen:s=!1,onClose:i,className:d,isMobile:c,keepMounted:f,...b},m)=>{const[h,w]=t.useState(!1),x=n.useMobile(),p=c??x,y=t.useRef(null),v=t.useRef(null);t.useEffect(()=>{w(!0)},[]),t.useEffect(()=>{const handleEscape=e=>{"Escape"===e.key&&s&&i&&i()};return s&&(document.addEventListener("keydown",handleEscape),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",handleEscape),document.body.style.overflow="auto"}},[s,i]);const g=l("fixed inset-0 z-[1000] transition-all duration-300",{"bg-neutral-darker/50 backdrop-blur-sm":s,"bg-transparent pointer-events-none":!s,"hidden invisible absolute inset-0":f&&!h}),k=l("fixed bg-white shadow-2xl transition-all duration-300 ease-out overflow-auto",(()=>{switch(a){case"top":return"top-0 left-0 right-0";case"bottom":default:return"bottom-0 left-0 right-0";case"left":return"top-0 left-0 bottom-0";case"right":return"top-0 right-0 bottom-0"}})(),(()=>{const e="top"===a||"bottom"===a;return u?"w-full h-full":e?"w-full max-h-[90vh]":"h-full max-w-[90vw]"})(),(()=>{if(!s)switch(a){case"top":return"-translate-y-full";case"bottom":default:return"translate-y-full";case"left":return"-translate-x-full";case"right":return"translate-x-full"}return"translate-x-0 translate-y-0"})(),{"rounded-t-2xl":"bottom"===a&&!u,"rounded-b-2xl":"top"===a&&!u,"rounded-r-2xl":"left"===a&&!u,"rounded-l-2xl":"right"===a&&!u,"p-6":!p,"p-4":p},d),E=e.jsx("div",{ref:y,className:g,onClick:e=>{!u&&i&&y.current&&e.target===y.current&&i()},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||!u&&i&&y.current&&e.target===y.current&&i()},tabIndex:-1,role:"button","aria-label":"Close drawer","aria-hidden":!s,children:e.jsx("div",{ref:m||v,className:k,role:"dialog","aria-modal":"true","aria-label":"Drawer",...b,children:o})});return f||h?f&&!h?E:s?r.createPortal(E,document.body):null:null});o.displayName="Drawer",exports.Drawer=o;
@@ -1 +1 @@
1
- "use client";import{jsx as t}from"react/jsx-runtime";import e,{useState as r,useRef as o,useEffect as n}from"react";import{createPortal as l}from"react-dom";import a from"./utils.js";import{useMobile as i}from"./contexts.js";const s=e.forwardRef(({children:e,direction:s="bottom",fullScreen:u=!1,isOpen:d=!1,onClose:c,className:m,isMobile:f,keepMounted:b,...p},h)=>{const[w,x]=r(!1),y=i(),g=f??y,v=o(null),k=o(null);n(()=>{x(!0)},[]),n(()=>{const handleEscape=t=>{"Escape"===t.key&&d&&c&&c()};return d&&(document.addEventListener("keydown",handleEscape),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",handleEscape),document.body.style.overflow="auto"}},[d,c]);const E=a("fixed inset-0 z-[1000] transition-all duration-300",{"bg-neutral-darker/50 backdrop-blur-sm":d,"bg-transparent pointer-events-none":!d,"hidden invisible absolute inset-0":b&&!w}),N=a("fixed bg-white shadow-2xl transition-all duration-300 ease-out overflow-auto",(()=>{switch(s){case"top":return"top-0 left-0 right-0";case"bottom":default:return"bottom-0 left-0 right-0";case"left":return"top-0 left-0 bottom-0";case"right":return"top-0 right-0 bottom-0"}})(),(()=>{const t="top"===s||"bottom"===s;return u?"w-full h-full":t?"w-full max-h-[90vh]":"h-full max-w-[90vw]"})(),(()=>{if(!d)switch(s){case"top":return"-translate-y-full";case"bottom":default:return"translate-y-full";case"left":return"-translate-x-full";case"right":return"translate-x-full"}return"translate-x-0 translate-y-0"})(),{"rounded-t-2xl":"bottom"===s&&!u,"rounded-b-2xl":"top"===s&&!u,"rounded-r-2xl":"left"===s&&!u,"rounded-l-2xl":"right"===s&&!u,"p-6":!g,"p-4":g},m),j=t("div",{ref:v,className:E,onClick:t=>{!u&&c&&v.current&&t.target===v.current&&c()},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||!u&&c&&v.current&&t.target===v.current&&c()},tabIndex:-1,role:"button","aria-label":"Close drawer","aria-hidden":!d,children:t("div",{ref:h||k,className:N,role:"dialog","aria-modal":"true","aria-label":"Drawer",...p,children:e})});return b||w?b&&!w?j:l(j,document.body):null});s.displayName="Drawer";export{s as Drawer};
1
+ "use client";import{jsx as t}from"react/jsx-runtime";import e,{useState as r,useRef as o,useEffect as n}from"react";import{createPortal as l}from"react-dom";import a from"./utils.js";import{useMobile as i}from"./contexts.js";const s=e.forwardRef(({children:e,direction:s="bottom",fullScreen:u=!1,isOpen:d=!1,onClose:c,className:m,isMobile:f,keepMounted:b,...p},h)=>{const[w,x]=r(!1),y=i(),g=f??y,v=o(null),k=o(null);n(()=>{x(!0)},[]),n(()=>{const handleEscape=t=>{"Escape"===t.key&&d&&c&&c()};return d&&(document.addEventListener("keydown",handleEscape),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",handleEscape),document.body.style.overflow="auto"}},[d,c]);const E=a("fixed inset-0 z-[1000] transition-all duration-300",{"bg-neutral-darker/50 backdrop-blur-sm":d,"bg-transparent pointer-events-none":!d,"hidden invisible absolute inset-0":b&&!w}),N=a("fixed bg-white shadow-2xl transition-all duration-300 ease-out overflow-auto",(()=>{switch(s){case"top":return"top-0 left-0 right-0";case"bottom":default:return"bottom-0 left-0 right-0";case"left":return"top-0 left-0 bottom-0";case"right":return"top-0 right-0 bottom-0"}})(),(()=>{const t="top"===s||"bottom"===s;return u?"w-full h-full":t?"w-full max-h-[90vh]":"h-full max-w-[90vw]"})(),(()=>{if(!d)switch(s){case"top":return"-translate-y-full";case"bottom":default:return"translate-y-full";case"left":return"-translate-x-full";case"right":return"translate-x-full"}return"translate-x-0 translate-y-0"})(),{"rounded-t-2xl":"bottom"===s&&!u,"rounded-b-2xl":"top"===s&&!u,"rounded-r-2xl":"left"===s&&!u,"rounded-l-2xl":"right"===s&&!u,"p-6":!g,"p-4":g},m),j=t("div",{ref:v,className:E,onClick:t=>{!u&&c&&v.current&&t.target===v.current&&c()},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||!u&&c&&v.current&&t.target===v.current&&c()},tabIndex:-1,role:"button","aria-label":"Close drawer","aria-hidden":!d,children:t("div",{ref:h||k,className:N,role:"dialog","aria-modal":"true","aria-label":"Drawer",...p,children:e})});return b||w?b&&!w?j:d?l(j,document.body):null:null});s.displayName="Drawer";export{s as Drawer};
@@ -117,7 +117,10 @@ const Drawer = React.forwardRef(({ children, direction = 'bottom', fullScreen =
117
117
  return content;
118
118
  }
119
119
  // On the client, render into body using a portal.
120
- return createPortal(content, document.body);
120
+ if (isOpen) {
121
+ return createPortal(content, document.body);
122
+ }
123
+ return null;
121
124
  });
122
125
  Drawer.displayName = 'Drawer';
123
126
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "automoby-kit",
3
- "version": "1.0.46",
3
+ "version": "1.0.47",
4
4
  "description": "A comprehensive React UI component library - created in war 2025",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",