automoby-kit 1.0.47 → 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/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},p)=>{const[b,x]=r.useState(!1),f=r.useRef(null),h=r.useRef(null),m=void 0!==d?d:b,handleToggle=()=>{if(o)return;const e=!m;void 0===d&&x(e),l?.(e)};r.useEffect(()=>{const handleClickOutside=e=>{f.current&&!f.current.contains(e.target)&&(void 0===d&&x(!1),l?.(!1))};if(m)return document.addEventListener("mousedown",handleClickOutside),()=>{document.removeEventListener("mousedown",handleClickOutside)}},[m,d,l]);const v=t("inline-flex items-center justify-center","bg-white border border-neutral-light","rounded-[6px] px-[16px] py-[13px]","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}),y=t("absolute top-full left-0 right-0 z-10 mt-[4px]","bg-white border border-neutral-light","rounded-[6px] py-[13px] px-[16px]","shadow-lg","transition-all duration-200",{"opacity-100 translate-y-0 pointer-events-auto":m,"opacity-0 -translate-y-2 pointer-events-none":!m}),g=t("block w-full text-right","transition-colors duration-200","hover:bg-neutral-lighter rounded-[4px] px-[8px] py-[4px] -mx-[8px]","focus:outline-none focus:bg-neutral-lighter");return e.jsx("div",{ref:p,className:t("relative inline-block",s),...c,children:e.jsxs("div",{ref:f,children:[e.jsx("button",{ref:h,type:"button",className:v,onClick:handleToggle,onKeyDown:e=>{if(!o)switch(e.key){case"Escape":m&&(e.preventDefault(),void 0===d&&x(!1),l?.(!1),h.current?.focus());break;case"ArrowDown":m||(e.preventDefault(),handleToggle());break;case"Enter":case" ":e.preventDefault(),handleToggle()}},disabled:o,"aria-expanded":m,"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:y,children:e.jsx("div",{className:"flex flex-col gap-[16px]",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&&x(!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:m?0:-1,children:a},r.id):e.jsx("button",{...i,type:"button",role:"menuitem",tabIndex:m?0:-1,disabled:r.disabled,children:a},r.id)})})})]})})});a.displayName="Menu",exports.Menu=a;
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/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:p,"aria-label":b,...f},m)=>{const[h,x]=n(!1),v=o(null),g=o(null),y=void 0!==p?p:h,handleToggle=()=>{if(d)return;const e=!y;void 0===p&&x(e),u?.(e)};a(()=>{const handleClickOutside=e=>{v.current&&!v.current.contains(e.target)&&(void 0===p&&x(!1),u?.(!1))};if(y)return document.addEventListener("mousedown",handleClickOutside),()=>{document.removeEventListener("mousedown",handleClickOutside)}},[y,p,u]);const w=i("inline-flex items-center justify-center","bg-white border border-neutral-light","rounded-[6px] px-[16px] py-[13px]","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-[4px]","bg-white border border-neutral-light","rounded-[6px] py-[13px] px-[16px]","shadow-lg","transition-all duration-200",{"opacity-100 translate-y-0 pointer-events-auto":y,"opacity-0 -translate-y-2 pointer-events-none":!y}),N=i("block w-full text-right","transition-colors duration-200","hover:bg-neutral-lighter rounded-[4px] px-[8px] py-[4px] -mx-[8px]","focus:outline-none focus:bg-neutral-lighter");return e("div",{ref:m,className:i("relative inline-block",c),...f,children:r("div",{ref:v,children:[e("button",{ref:g,type:"button",className:w,onClick:handleToggle,onKeyDown:e=>{if(!d)switch(e.key){case"Escape":y&&(e.preventDefault(),void 0===p&&x(!1),u?.(!1),g.current?.focus());break;case"ArrowDown":y||(e.preventDefault(),handleToggle());break;case"Enter":case" ":e.preventDefault(),handleToggle()}},disabled:d,"aria-expanded":y,"aria-haspopup":"true","aria-label":b||`منوی ${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-[16px]",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===p&&x(!1),u?.(!1),e.onClick?.())})(r),"aria-label":`منوی ${r.label}`};return r.href&&!r.disabled?e("a",{...n,href:r.href,role:"menuitem",tabIndex:y?0:-1,children:t},r.id):e("button",{...n,type:"button",role:"menuitem",tabIndex:y?0:-1,disabled:r.disabled,children:t},r.id)})})})]})})});s.displayName="Menu";export{s as Menu};
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};
@@ -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-[6px] px-[16px] py-[13px]', 'transition-colors duration-200',
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-[4px]', 'bg-white border border-neutral-light', 'rounded-[6px] py-[13px] px-[16px]', 'shadow-lg',
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-[4px] px-[8px] py-[4px] -mx-[8px]', '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-[16px]", children: items.map((item) => {
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, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "automoby-kit",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
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",