automoby-kit 1.0.46 → 1.0.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Drawer.js +1 -1
- package/dist/cjs/Menu.js +1 -1
- package/dist/esm/Drawer.js +1 -1
- package/dist/esm/Menu.js +1 -1
- package/dist/types/Drawer.js +4 -1
- package/dist/types/Menu.js +4 -4
- package/package.json +1 -1
package/dist/cjs/Drawer.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("react-dom"),
|
|
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;
|
package/dist/cjs/Menu.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("./utils.js"),n=require("./Typography.js");const a=r.forwardRef(({buttonText:a,items:i,disabled:o=!1,className:s,onOpenChange:l,isOpen:d,"aria-label":u,...c},
|
|
1
|
+
"use client";"use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("./utils.js"),n=require("./Typography.js");const a=r.forwardRef(({buttonText:a,items:i,disabled:o=!1,className:s,onOpenChange:l,isOpen:d,"aria-label":u,...c},b)=>{const[p,f]=r.useState(!1),h=r.useRef(null),m=r.useRef(null),v=void 0!==d?d:p,handleToggle=()=>{if(o)return;const e=!v;void 0===d&&f(e),l?.(e)};r.useEffect(()=>{const handleClickOutside=e=>{h.current&&!h.current.contains(e.target)&&(void 0===d&&f(!1),l?.(!1))};if(v)return document.addEventListener("mousedown",handleClickOutside),()=>{document.removeEventListener("mousedown",handleClickOutside)}},[v,d,l]);const y=t("inline-flex items-center justify-center","bg-white border border-neutral-light","rounded-md px-4 py-3","transition-colors duration-200","hover:bg-neutral-lighter","focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2",{"opacity-50 cursor-not-allowed":o,"cursor-pointer":!o}),x=t("absolute top-full left-0 right-0 z-10 mt-1","bg-white border border-neutral-light","rounded-md py-3 px-4","shadow-lg","transition-all duration-200",{"opacity-100 translate-y-0 pointer-events-auto":v,"opacity-0 -translate-y-2 pointer-events-none":!v}),g=t("block w-full text-right","transition-colors duration-200","hover:bg-neutral-lighter rounded px-2 py-1 -mx-2","focus:outline-none focus:bg-neutral-lighter");return e.jsx("div",{ref:b,className:t("relative inline-block",s),...c,children:e.jsxs("div",{ref:h,children:[e.jsx("button",{ref:m,type:"button",className:y,onClick:handleToggle,onKeyDown:e=>{if(!o)switch(e.key){case"Escape":v&&(e.preventDefault(),void 0===d&&f(!1),l?.(!1),m.current?.focus());break;case"ArrowDown":v||(e.preventDefault(),handleToggle());break;case"Enter":case" ":e.preventDefault(),handleToggle()}},disabled:o,"aria-expanded":v,"aria-haspopup":"true","aria-label":u||`منوی ${a}`,children:e.jsx(n.Typography,{variant:"body-s-heavy",color:"neutral-darker",className:"text-right",children:a})}),e.jsx("div",{className:x,children:e.jsx("div",{className:"flex flex-col gap-4",children:i.map(r=>{const a=e.jsx(n.Typography,{variant:"body-s-heavy",color:r.disabled?"neutral-main":"neutral-darker",className:"text-right",children:r.label}),i={className:t(g,{"opacity-50 cursor-not-allowed":r.disabled,"cursor-pointer":!r.disabled}),onClick:r.disabled?void 0:()=>(e=>{e.disabled||(void 0===d&&f(!1),l?.(!1),e.onClick?.())})(r),"aria-label":`منوی ${r.label}`};return r.href&&!r.disabled?e.jsx("a",{...i,href:r.href,role:"menuitem",tabIndex:v?0:-1,children:a},r.id):e.jsx("button",{...i,type:"button",role:"menuitem",tabIndex:v?0:-1,disabled:r.disabled,children:a},r.id)})})})]})})});a.displayName="Menu",exports.Menu=a;
|
package/dist/esm/Drawer.js
CHANGED
|
@@ -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};
|
package/dist/esm/Menu.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import t,{useState as n,useRef as o,useEffect as a}from"react";import i from"./utils.js";import{Typography as l}from"./Typography.js";const s=t.forwardRef(({buttonText:t,items:s,disabled:d=!1,className:c,onOpenChange:u,isOpen:
|
|
1
|
+
"use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import t,{useState as n,useRef as o,useEffect as a}from"react";import i from"./utils.js";import{Typography as l}from"./Typography.js";const s=t.forwardRef(({buttonText:t,items:s,disabled:d=!1,className:c,onOpenChange:u,isOpen:b,"aria-label":p,...m},f)=>{const[h,v]=n(!1),g=o(null),y=o(null),x=void 0!==b?b:h,handleToggle=()=>{if(d)return;const e=!x;void 0===b&&v(e),u?.(e)};a(()=>{const handleClickOutside=e=>{g.current&&!g.current.contains(e.target)&&(void 0===b&&v(!1),u?.(!1))};if(x)return document.addEventListener("mousedown",handleClickOutside),()=>{document.removeEventListener("mousedown",handleClickOutside)}},[x,b,u]);const w=i("inline-flex items-center justify-center","bg-white border border-neutral-light","rounded-md px-4 py-3","transition-colors duration-200","hover:bg-neutral-lighter","focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2",{"opacity-50 cursor-not-allowed":d,"cursor-pointer":!d}),k=i("absolute top-full left-0 right-0 z-10 mt-1","bg-white border border-neutral-light","rounded-md py-3 px-4","shadow-lg","transition-all duration-200",{"opacity-100 translate-y-0 pointer-events-auto":x,"opacity-0 -translate-y-2 pointer-events-none":!x}),N=i("block w-full text-right","transition-colors duration-200","hover:bg-neutral-lighter rounded px-2 py-1 -mx-2","focus:outline-none focus:bg-neutral-lighter");return e("div",{ref:f,className:i("relative inline-block",c),...m,children:r("div",{ref:g,children:[e("button",{ref:y,type:"button",className:w,onClick:handleToggle,onKeyDown:e=>{if(!d)switch(e.key){case"Escape":x&&(e.preventDefault(),void 0===b&&v(!1),u?.(!1),y.current?.focus());break;case"ArrowDown":x||(e.preventDefault(),handleToggle());break;case"Enter":case" ":e.preventDefault(),handleToggle()}},disabled:d,"aria-expanded":x,"aria-haspopup":"true","aria-label":p||`منوی ${t}`,children:e(l,{variant:"body-s-heavy",color:"neutral-darker",className:"text-right",children:t})}),e("div",{className:k,children:e("div",{className:"flex flex-col gap-4",children:s.map(r=>{const t=e(l,{variant:"body-s-heavy",color:r.disabled?"neutral-main":"neutral-darker",className:"text-right",children:r.label}),n={className:i(N,{"opacity-50 cursor-not-allowed":r.disabled,"cursor-pointer":!r.disabled}),onClick:r.disabled?void 0:()=>(e=>{e.disabled||(void 0===b&&v(!1),u?.(!1),e.onClick?.())})(r),"aria-label":`منوی ${r.label}`};return r.href&&!r.disabled?e("a",{...n,href:r.href,role:"menuitem",tabIndex:x?0:-1,children:t},r.id):e("button",{...n,type:"button",role:"menuitem",tabIndex:x?0:-1,disabled:r.disabled,children:t},r.id)})})})]})})});s.displayName="Menu";export{s as Menu};
|
package/dist/types/Drawer.js
CHANGED
|
@@ -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
|
-
|
|
120
|
+
if (isOpen) {
|
|
121
|
+
return createPortal(content, document.body);
|
|
122
|
+
}
|
|
123
|
+
return null;
|
|
121
124
|
});
|
|
122
125
|
Drawer.displayName = 'Drawer';
|
|
123
126
|
|
package/dist/types/Menu.js
CHANGED
|
@@ -78,7 +78,7 @@ const Menu = React.forwardRef(({ buttonText, items, disabled = false, className,
|
|
|
78
78
|
};
|
|
79
79
|
const buttonClasses = cn(
|
|
80
80
|
// Base button styles matching Figma design
|
|
81
|
-
'inline-flex items-center justify-center', 'bg-white border border-neutral-light', 'rounded-
|
|
81
|
+
'inline-flex items-center justify-center', 'bg-white border border-neutral-light', 'rounded-md px-4 py-3', 'transition-colors duration-200',
|
|
82
82
|
// Interactive states
|
|
83
83
|
'hover:bg-neutral-lighter', 'focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2',
|
|
84
84
|
// Disabled state
|
|
@@ -88,14 +88,14 @@ const Menu = React.forwardRef(({ buttonText, items, disabled = false, className,
|
|
|
88
88
|
});
|
|
89
89
|
const dropdownClasses = cn(
|
|
90
90
|
// Base dropdown styles
|
|
91
|
-
'absolute top-full left-0 right-0 z-10 mt-
|
|
91
|
+
'absolute top-full left-0 right-0 z-10 mt-1', 'bg-white border border-neutral-light', 'rounded-md py-3 px-4', 'shadow-lg',
|
|
92
92
|
// Animation
|
|
93
93
|
'transition-all duration-200', {
|
|
94
94
|
'opacity-100 translate-y-0 pointer-events-auto': isOpen,
|
|
95
95
|
'opacity-0 -translate-y-2 pointer-events-none': !isOpen,
|
|
96
96
|
});
|
|
97
|
-
const itemClasses = cn('block w-full text-right', 'transition-colors duration-200', 'hover:bg-neutral-lighter rounded
|
|
98
|
-
return (jsx("div", { ref: ref, className: cn('relative inline-block', className), ...props, children: jsxs("div", { ref: menuRef, children: [jsx("button", { ref: buttonRef, type: "button", className: buttonClasses, onClick: handleToggle, onKeyDown: handleKeyDown, disabled: disabled, "aria-expanded": isOpen, "aria-haspopup": "true", "aria-label": ariaLabel || `منوی ${buttonText}`, children: jsx(Typography, { variant: "body-s-heavy", color: "neutral-darker", className: "text-right", children: buttonText }) }), jsx("div", { className: dropdownClasses, children: jsx("div", { className: "flex flex-col gap-
|
|
97
|
+
const itemClasses = cn('block w-full text-right', 'transition-colors duration-200', 'hover:bg-neutral-lighter rounded px-2 py-1 -mx-2', 'focus:outline-none focus:bg-neutral-lighter');
|
|
98
|
+
return (jsx("div", { ref: ref, className: cn('relative inline-block', className), ...props, children: jsxs("div", { ref: menuRef, children: [jsx("button", { ref: buttonRef, type: "button", className: buttonClasses, onClick: handleToggle, onKeyDown: handleKeyDown, disabled: disabled, "aria-expanded": isOpen, "aria-haspopup": "true", "aria-label": ariaLabel || `منوی ${buttonText}`, children: jsx(Typography, { variant: "body-s-heavy", color: "neutral-darker", className: "text-right", children: buttonText }) }), jsx("div", { className: dropdownClasses, children: jsx("div", { className: "flex flex-col gap-4", children: items.map((item) => {
|
|
99
99
|
const content = (jsx(Typography, { variant: "body-s-heavy", color: item.disabled ? 'neutral-main' : 'neutral-darker', className: "text-right", children: item.label }));
|
|
100
100
|
const commonProps = {
|
|
101
101
|
className: cn(itemClasses, {
|