automoby-kit 1.0.70 → 1.0.72
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/Button.js +1 -1
- package/dist/cjs/Drawer.js +1 -1
- package/dist/esm/Button.js +1 -1
- package/dist/esm/Drawer.js +1 -1
- package/dist/types/Button.js +4 -2
- package/dist/types/Drawer.js +5 -2
- package/dist/types/components/Button/Button.d.ts +2 -1
- package/dist/types/components/Drawer/Drawer.d.ts +4 -0
- package/dist/types/components/Drawer/Drawer.stories.d.ts +7 -0
- package/package.json +1 -1
package/dist/cjs/Button.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("./utils.js"),a=require("./Typography.js");const i={sm:"px-4 py-2",md:"px-4 py-2.5",lg:"px-4 py-3",xl:"px-5 py-3"},n={sm:"body-s-bold",md:"body-m-bold",lg:"body-l-bold",xl:"body-xl-heavy"},l={primary:"\n bg-primary text-white\n hover:bg-primary-dark\n disabled:bg-neutral-light disabled:text-neutral-darker\n ",secondary:"\n bg-primary-lightest text-primary-dark\n hover:bg-primary-lighter\n disabled:bg-neutral-light disabled:text-neutral-darker\n ",tertiary:"\n bg-white border border-primary-light text-primary\n hover:bg-neutral-lighter\n disabled:bg-neutral-light disabled:text-neutral-darker\n ",ghost:"\n bg-transparent text-primary\n hover:bg-primary-lightest\n disabled:bg-neutral-light disabled:text-neutral-darker\n "},s=r.forwardRef(({className:r,variant:s="primary",size:d="md",icon:o,iconPosition:b="right",children:
|
|
1
|
+
"use client";"use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("./utils.js"),a=require("./Typography.js");const i={sm:"px-4 py-2",md:"px-4 py-2.5",lg:"px-4 py-3",xl:"px-5 py-3"},n={sm:"body-s-bold",md:"body-m-bold",lg:"body-l-bold",xl:"body-xl-heavy"},l={primary:"\n bg-primary text-white\n hover:bg-primary-dark\n disabled:bg-neutral-light disabled:text-neutral-darker\n ",secondary:"\n bg-primary-lightest text-primary-dark\n hover:bg-primary-lighter\n disabled:bg-neutral-light disabled:text-neutral-darker\n ",tertiary:"\n bg-white border border-primary-light text-primary\n hover:bg-neutral-lighter\n disabled:bg-neutral-light disabled:text-neutral-darker\n ",ghost:"\n bg-transparent text-primary\n hover:bg-primary-lightest\n disabled:bg-neutral-light disabled:text-neutral-darker\n "},s=r.forwardRef(({className:r,variant:s="primary",size:d="md",icon:o,iconPosition:b="right",children:p,loading:g=!1,disabled:y,textVariant:m,type:h="button",...u},x)=>{const c=m||n[d];return e.jsxs("button",{ref:x,type:h,className:t("inline-flex items-center justify-center rounded-lg transition-colors duration-200",i[d],l[s],a.getTypographyClasses(c),y&&"opacity-50 pointer-events-none",r),disabled:y||g,...u,children:[o&&"left"===b&&e.jsx("span",{className:"mr-2 flex items-center",children:o}),g?"...":p,o&&"right"===b&&e.jsx("span",{className:"ml-2 flex items-center",children:o})]})});s.displayName="Button",exports.Button=s;
|
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"),n=require("./utils.js"),l=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,zIndex:b,...m},h)=>{const[w,x]=t.useState(!1),p=l.useMobile(),y=c??p,v=t.useRef(null),g=t.useRef(null);t.useEffect(()=>{x(!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 k=n("fixed inset-0 transition-all duration-300",`z-[${b??"10000000001"}]`),E=n(k,{"bg-neutral-darker/50 backdrop-blur-sm":s,"bg-transparent pointer-events-none":!s,"hidden invisible absolute inset-0":f&&!w}),j=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 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":!y,"p-4":y},d),q=e.jsx("div",{ref:v,className:E,onClick:e=>{!u&&i&&v.current&&e.target===v.current&&i()},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||!u&&i&&v.current&&e.target===v.current&&i()},tabIndex:-1,role:"button","aria-label":"Close drawer","aria-hidden":!s,children:e.jsx("div",{ref:h||g,className:j,role:"dialog","aria-modal":"true","aria-label":"Drawer",...m,children:o})});return f||w?f&&!w?q:s?r.createPortal(q,document.body):null:null});o.displayName="Drawer",exports.Drawer=o;
|
package/dist/esm/Button.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsxs as r,jsx as e}from"react/jsx-runtime";import t from"react";import i from"./utils.js";import{getTypographyClasses as a}from"./Typography.js";const n={sm:"px-4 py-2",md:"px-4 py-2.5",lg:"px-4 py-3",xl:"px-5 py-3"},l={sm:"body-s-bold",md:"body-m-bold",lg:"body-l-bold",xl:"body-xl-heavy"},d={primary:"\n bg-primary text-white\n hover:bg-primary-dark\n disabled:bg-neutral-light disabled:text-neutral-darker\n ",secondary:"\n bg-primary-lightest text-primary-dark\n hover:bg-primary-lighter\n disabled:bg-neutral-light disabled:text-neutral-darker\n ",tertiary:"\n bg-white border border-primary-light text-primary\n hover:bg-neutral-lighter\n disabled:bg-neutral-light disabled:text-neutral-darker\n ",ghost:"\n bg-transparent text-primary\n hover:bg-primary-lightest\n disabled:bg-neutral-light disabled:text-neutral-darker\n "},s=t.forwardRef(({className:t,variant:s="primary",size:o="md",icon:m,iconPosition:
|
|
1
|
+
"use client";import{jsxs as r,jsx as e}from"react/jsx-runtime";import t from"react";import i from"./utils.js";import{getTypographyClasses as a}from"./Typography.js";const n={sm:"px-4 py-2",md:"px-4 py-2.5",lg:"px-4 py-3",xl:"px-5 py-3"},l={sm:"body-s-bold",md:"body-m-bold",lg:"body-l-bold",xl:"body-xl-heavy"},d={primary:"\n bg-primary text-white\n hover:bg-primary-dark\n disabled:bg-neutral-light disabled:text-neutral-darker\n ",secondary:"\n bg-primary-lightest text-primary-dark\n hover:bg-primary-lighter\n disabled:bg-neutral-light disabled:text-neutral-darker\n ",tertiary:"\n bg-white border border-primary-light text-primary\n hover:bg-neutral-lighter\n disabled:bg-neutral-light disabled:text-neutral-darker\n ",ghost:"\n bg-transparent text-primary\n hover:bg-primary-lightest\n disabled:bg-neutral-light disabled:text-neutral-darker\n "},s=t.forwardRef(({className:t,variant:s="primary",size:o="md",icon:m,iconPosition:p="right",children:b,loading:g=!1,disabled:y,textVariant:h,type:c="button",...x},u)=>r("button",{ref:u,type:c,className:i("inline-flex items-center justify-center rounded-lg transition-colors duration-200",n[o],d[s],a(h||l[o]),y&&"opacity-50 pointer-events-none",t),disabled:y||g,...x,children:[m&&"left"===p&&e("span",{className:"mr-2 flex items-center",children:m}),g?"...":b,m&&"right"===p&&e("span",{className:"ml-2 flex items-center",children:m})]}));s.displayName="Button";export{s as Button};
|
package/dist/esm/Drawer.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import t,{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=t.forwardRef(({children:t,direction:s="bottom",fullScreen:u=!1,isOpen:d=!1,onClose:c,className:m,isMobile:f,keepMounted:b,zIndex:p,...h},w)=>{const[x,y]=r(!1),g=i(),v=f??g,k=o(null),E=o(null);n(()=>{y(!0)},[]),n(()=>{const handleEscape=e=>{"Escape"===e.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 N=a("fixed inset-0 transition-all duration-300",`z-[${p??"10000000001"}]`),j=a(N,{"bg-neutral-darker/50 backdrop-blur-sm":d,"bg-transparent pointer-events-none":!d,"hidden invisible absolute inset-0":b&&!x}),C=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 e="top"===s||"bottom"===s;return u?"w-full h-full":e?"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":!v,"p-4":v},m),D=e("div",{ref:k,className:j,onClick:e=>{!u&&c&&k.current&&e.target===k.current&&c()},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||!u&&c&&k.current&&e.target===k.current&&c()},tabIndex:-1,role:"button","aria-label":"Close drawer","aria-hidden":!d,children:e("div",{ref:w||E,className:C,role:"dialog","aria-modal":"true","aria-label":"Drawer",...h,children:t})});return b||x?b&&!x?D:d?l(D,document.body):null:null});s.displayName="Drawer";export{s as Drawer};
|
package/dist/types/Button.js
CHANGED
|
@@ -37,9 +37,11 @@ const variantClasses = {
|
|
|
37
37
|
disabled:bg-neutral-light disabled:text-neutral-darker
|
|
38
38
|
`,
|
|
39
39
|
};
|
|
40
|
-
const Button = React.forwardRef(({ className, variant = 'primary', size = 'md', icon, iconPosition = 'right', children, loading = false, disabled, textVariant, ...props }, ref) => {
|
|
40
|
+
const Button = React.forwardRef(({ className, variant = 'primary', size = 'md', icon, iconPosition = 'right', children, loading = false, disabled, textVariant, type = 'button', ...props }, ref) => {
|
|
41
41
|
const finalTextVariant = textVariant || defaultTextVariants[size];
|
|
42
|
-
return (jsxs("button", { ref: ref,
|
|
42
|
+
return (jsxs("button", { ref: ref,
|
|
43
|
+
// eslint-disable-next-line react/button-has-type
|
|
44
|
+
type: type, className: cn('inline-flex items-center justify-center rounded-lg transition-colors duration-200', sizeClasses[size], variantClasses[variant], getTypographyClasses(finalTextVariant), disabled && 'opacity-50 pointer-events-none', className), disabled: disabled || loading, ...props, children: [icon && iconPosition === 'left' && (jsx("span", { className: "mr-2 flex items-center", children: icon })), loading ? '...' : children, icon && iconPosition === 'right' && (jsx("span", { className: "ml-2 flex items-center", children: icon }))] }));
|
|
43
45
|
});
|
|
44
46
|
Button.displayName = 'Button';
|
|
45
47
|
|
package/dist/types/Drawer.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createPortal } from 'react-dom';
|
|
|
4
4
|
import cn from './utils.js';
|
|
5
5
|
import { useMobile } from './contexts.js';
|
|
6
6
|
|
|
7
|
-
const Drawer = React.forwardRef(({ children, direction = 'bottom', fullScreen = false, isOpen = false, onClose, className, isMobile, keepMounted, ...props }, ref) => {
|
|
7
|
+
const Drawer = React.forwardRef(({ children, direction = 'bottom', fullScreen = false, isOpen = false, onClose, className, isMobile, keepMounted, zIndex, ...props }, ref) => {
|
|
8
8
|
const [isClient, setIsClient] = useState(false);
|
|
9
9
|
const detectedIsMobile = useMobile();
|
|
10
10
|
const actualIsMobile = isMobile ?? detectedIsMobile;
|
|
@@ -91,7 +91,10 @@ const Drawer = React.forwardRef(({ children, direction = 'bottom', fullScreen =
|
|
|
91
91
|
}
|
|
92
92
|
return 'h-full max-w-[90vw]';
|
|
93
93
|
};
|
|
94
|
-
const
|
|
94
|
+
const defaultZIndex = '10000000001';
|
|
95
|
+
const zIndexValue = zIndex ?? defaultZIndex;
|
|
96
|
+
const zIndexClass = `z-[${zIndexValue}]`;
|
|
97
|
+
const baseOverlayClasses = cn('fixed inset-0 transition-all duration-300', zIndexClass);
|
|
95
98
|
const baseDrawerClasses = 'fixed bg-white shadow-2xl transition-all duration-300 ease-out overflow-auto';
|
|
96
99
|
const overlayClasses = cn(baseOverlayClasses, {
|
|
97
100
|
'bg-neutral-darker/50 backdrop-blur-sm': isOpen,
|
|
@@ -12,6 +12,7 @@ export interface ButtonProps {
|
|
|
12
12
|
loading?: boolean;
|
|
13
13
|
disabled?: boolean;
|
|
14
14
|
children?: React.ReactNode;
|
|
15
|
-
onClick?:
|
|
15
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
16
|
+
type?: 'button' | 'submit' | 'reset';
|
|
16
17
|
}
|
|
17
18
|
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -16,6 +16,10 @@ export type DrawerProps = {
|
|
|
16
16
|
* This allows SSR rendering but keeps it visually hidden until opened.
|
|
17
17
|
*/
|
|
18
18
|
keepMounted?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Custom z-index value for the overlay. Defaults to 10000000001.
|
|
21
|
+
*/
|
|
22
|
+
zIndex?: number | string;
|
|
19
23
|
};
|
|
20
24
|
declare const Drawer: React.ForwardRefExoticComponent<DrawerProps & React.RefAttributes<HTMLDivElement>>;
|
|
21
25
|
export { Drawer };
|