automoby-kit 1.0.33 → 1.0.35
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
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("./utils.js"),l=require("./contexts.js");const n=t.forwardRef(({children:n,direction:o="bottom",fullScreen:a=!1,isOpen:s=!1,onClose:u,className:i,isMobile:d,...c},f)=>{const b=l.useMobile(),m=d??b,w=t.useRef(null),
|
|
1
|
+
"use client";"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("./utils.js"),l=require("./contexts.js");const n=t.forwardRef(({children:n,direction:o="bottom",fullScreen:a=!1,isOpen:s=!1,onClose:u,className:i,isMobile:d,...c},f)=>{const b=l.useMobile(),m=d??b,w=t.useRef(null),x=t.useRef(null);t.useEffect(()=>{const handleEscape=e=>{"Escape"===e.key&&s&&u&&u()};return s&&(document.addEventListener("keydown",handleEscape),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",handleEscape),document.body.style.overflow="auto"}},[s,u]);const h=r("fixed inset-0 z-index-drawer transition-all duration-300",{"bg-neutral-darker/50 backdrop-blur-sm":s,"bg-transparent pointer-events-none":!s}),p=r("fixed bg-white shadow-2xl transition-all duration-300 ease-out overflow-auto",(()=>{switch(o){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"===o||"bottom"===o;return a?"w-full h-full":e?"w-full max-h-[90vh]":"h-full max-w-[90vw]"})(),(()=>{if(!s)switch(o){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"===o&&!a,"rounded-b-2xl":"top"===o&&!a,"rounded-r-2xl":"left"===o&&!a,"rounded-l-2xl":"right"===o&&!a,"p-6":!m,"p-4":m},i);return s?e.jsx("div",{ref:w,className:h,onClick:e=>{!a&&u&&w.current&&e.target===w.current&&u()},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||!a&&u&&w.current&&e.target===w.current&&u()},tabIndex:-1,role:"button","aria-label":"Close drawer",children:e.jsx("div",{ref:f||x,className:p,role:"dialog","aria-modal":"true","aria-label":"Drawer",...c,children:n})}):null});n.displayName="Drawer",exports.Drawer=n;
|
package/dist/cjs/Input.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("./utils.js"),l=require("./contexts.js");const a=t.forwardRef(({state:a="default",label:n,value:i,onChange:
|
|
1
|
+
"use client";"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("./utils.js"),l=require("./contexts.js");const a=t.forwardRef(({state:a="default",label:n,value:i,onChange:o,helperText:s,startIcon:u,endIcon:d,type:x="text",placeholder:h,isMobile:p,...c},m)=>{const[f,g]=t.useState(!1),b=t.useId(),j=l.useMobile(),v=p??j,w=f||""!==i&&null!=i,y="disabled"===a,N=r("relative flex items-center border rounded-lg transition-all duration-300 w-90",{"h-14":!v,"h-12":v,"border-neutral-light":"default"===a&&!f,"border-primary":"default"===a&&f,"border-error":"error"===a,"bg-white border-neutral-light cursor-not-allowed":y}),I=r("absolute pointer-events-none transition-all duration-300",{"-top-2.5 bg-white px-1 mx-3 font-medium":w,"text-s":!v&&w||v&&!w,"text-xs":v&&w,"text-m":!v&&!w,"right-1":u,"right-3":!u,"top-1/2 -translate-y-1/2 text-m font-medium":!w,"right-11":!w&&u,"right-4":!w&&!u,"text-neutral-main":!f&&"default"===a,"text-neutral-light":y,"text-primary":f&&"default"===a,"text-error":w&&"error"===a}),q=r("peer w-full h-full bg-transparent outline-none text-m font-medium disabled:text-neutral-light",{"pr-12":u,"pl-12":d,"px-4":!u&&!d,"pr-4 pl-12":!u&&d,"pl-4 pr-12":u&&!d,"cursor-not-allowed text-red-500":y,"text-neutral-dark":!f,"text-neutral-darker":f}),F=r("absolute h-5 w-5 transition-colors duration-300",{"text-neutral-main":"error"!==a&&!f,"text-primary":"default"===a&&f,"text-error":"error"===a,"text-neutral-light":y}),k=r("font-light mt-1 px-2 h-4",{"text-s":!v,"text-xs":v,"text-neutral-main":"default"===a,"text-primary":"default"===a&&f,"text-error":"error"===a,"text-neutral-light":y}),B=h&&!f?void 0:h;return e.jsxs("div",{children:[e.jsxs("div",{className:N,children:[d&&e.jsx("span",{className:r(F,"left-4"),children:d}),e.jsx("label",{htmlFor:b,className:I,children:n}),e.jsx("input",{ref:m,id:b,type:x,value:i,onChange:o,onFocus:e=>{y||(g(!0),c.onFocus?.(e))},onBlur:e=>{y||(g(!1),c.onBlur?.(e))},disabled:y,placeholder:B,className:q,...c}),u&&e.jsx("span",{className:r(F,"right-4"),children:u})]}),s&&e.jsx("p",{className:k,children:s})]})});a.displayName="Input",exports.Input=a;
|
package/dist/esm/Drawer.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t}from"react/jsx-runtime";import e,{useRef as r,useEffect as o}from"react";import l from"./utils.js";import{useMobile as n}from"./contexts.js";const a=e.forwardRef(({children:e,direction:a="bottom",fullScreen:s=!1,isOpen:u=!1,onClose:i,className:d,isMobile:c,...f},m)=>{const b=n(),p=c??b,
|
|
1
|
+
"use client";import{jsx as t}from"react/jsx-runtime";import e,{useRef as r,useEffect as o}from"react";import l from"./utils.js";import{useMobile as n}from"./contexts.js";const a=e.forwardRef(({children:e,direction:a="bottom",fullScreen:s=!1,isOpen:u=!1,onClose:i,className:d,isMobile:c,...f},m)=>{const b=n(),p=c??b,w=r(null),h=r(null);o(()=>{const handleEscape=t=>{"Escape"===t.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 x=l("fixed inset-0 z-index-drawer transition-all duration-300",{"bg-neutral-darker/50 backdrop-blur-sm":u,"bg-transparent pointer-events-none":!u}),y=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 t="top"===a||"bottom"===a;return s?"w-full h-full":t?"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);return u?t("div",{ref:w,className:x,onClick:t=>{!s&&i&&w.current&&t.target===w.current&&i()},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||!s&&i&&w.current&&t.target===w.current&&i()},tabIndex:-1,role:"button","aria-label":"Close drawer",children:t("div",{ref:m||h,className:y,role:"dialog","aria-modal":"true","aria-label":"Drawer",...f,children:e})}):null});a.displayName="Drawer";export{a as Drawer};
|
package/dist/esm/Input.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsxs as t,jsx as e}from"react/jsx-runtime";import r,{useState as l,useId as a}from"react";import n from"./utils.js";import{useMobile as o}from"./contexts.js";const i=r.forwardRef(({state:r="default",label:i,value:
|
|
1
|
+
"use client";import{jsxs as t,jsx as e}from"react/jsx-runtime";import r,{useState as l,useId as a}from"react";import n from"./utils.js";import{useMobile as o}from"./contexts.js";const i=r.forwardRef(({state:r="default",label:i,value:d,onChange:s,helperText:u,startIcon:m,endIcon:x,type:p="text",placeholder:h,isMobile:c,...f},g)=>{const[b,w]=l(!1),y=a(),v=o(),N=c??v,j=b||""!==d&&null!=d,F="disabled"===r,I=n("relative flex items-center border rounded-lg transition-all duration-300 w-90",{"h-14":!N,"h-12":N,"border-neutral-light":"default"===r&&!b,"border-primary":"default"===r&&b,"border-error":"error"===r,"bg-white border-neutral-light cursor-not-allowed":F}),k=n("absolute pointer-events-none transition-all duration-300",{"-top-2.5 bg-white px-1 mx-3 font-medium":j,"text-s":!N&&j||N&&!j,"text-xs":N&&j,"text-m":!N&&!j,"right-1":m,"right-3":!m,"top-1/2 -translate-y-1/2 text-m font-medium":!j,"right-11":!j&&m,"right-4":!j&&!m,"text-neutral-main":!b&&"default"===r,"text-neutral-light":F,"text-primary":b&&"default"===r,"text-error":j&&"error"===r}),B=n("peer w-full h-full bg-transparent outline-none text-m font-medium disabled:text-neutral-light",{"pr-12":m,"pl-12":x,"px-4":!m&&!x,"pr-4 pl-12":!m&&x,"pl-4 pr-12":m&&!x,"cursor-not-allowed text-red-500":F,"text-neutral-dark":!b,"text-neutral-darker":b}),C=n("absolute h-5 w-5 transition-colors duration-300",{"text-neutral-main":"error"!==r&&!b,"text-primary":"default"===r&&b,"text-error":"error"===r,"text-neutral-light":F}),M=n("font-light mt-1 px-2 h-4",{"text-s":!N,"text-xs":N,"text-neutral-main":"default"===r,"text-primary":"default"===r&&b,"text-error":"error"===r,"text-neutral-light":F}),R=h&&!b?void 0:h;return t("div",{children:[t("div",{className:I,children:[x&&e("span",{className:n(C,"left-4"),children:x}),e("label",{htmlFor:y,className:k,children:i}),e("input",{ref:g,id:y,type:p,value:d,onChange:s,onFocus:t=>{F||(w(!0),f.onFocus?.(t))},onBlur:t=>{F||(w(!1),f.onBlur?.(t))},disabled:F,placeholder:R,className:B,...f}),m&&e("span",{className:n(C,"right-4"),children:m})]}),u&&e("p",{className:M,children:u})]})});i.displayName="Input";export{i as Input};
|
package/dist/types/Drawer.js
CHANGED
|
@@ -86,7 +86,7 @@ const Drawer = React.forwardRef(({ children, direction = 'bottom', fullScreen =
|
|
|
86
86
|
}
|
|
87
87
|
return 'h-full max-w-[90vw]';
|
|
88
88
|
};
|
|
89
|
-
const baseOverlayClasses = 'fixed inset-0 z-
|
|
89
|
+
const baseOverlayClasses = 'fixed inset-0 z-index-drawer transition-all duration-300';
|
|
90
90
|
const baseDrawerClasses = 'fixed bg-white shadow-2xl transition-all duration-300 ease-out overflow-auto';
|
|
91
91
|
const overlayClasses = cn(baseOverlayClasses, {
|
|
92
92
|
'bg-neutral-darker/50 backdrop-blur-sm': isOpen,
|
package/dist/types/Input.js
CHANGED
|
@@ -3,7 +3,7 @@ import React, { useState, useId } from 'react';
|
|
|
3
3
|
import cn from './utils.js';
|
|
4
4
|
import { useMobile } from './contexts.js';
|
|
5
5
|
|
|
6
|
-
const Input = React.forwardRef(({ state = 'default', label, value, onChange, helperText, startIcon, endIcon, type = 'text', isMobile, ...props }, ref) => {
|
|
6
|
+
const Input = React.forwardRef(({ state = 'default', label, value, onChange, helperText, startIcon, endIcon, type = 'text', placeholder, isMobile, ...props }, ref) => {
|
|
7
7
|
const [isFocused, setIsFocused] = useState(false);
|
|
8
8
|
const id = useId();
|
|
9
9
|
const detectedIsMobile = useMobile();
|
|
@@ -75,7 +75,9 @@ const Input = React.forwardRef(({ state = 'default', label, value, onChange, hel
|
|
|
75
75
|
'text-error': state === 'error',
|
|
76
76
|
'text-neutral-light': isDisabled,
|
|
77
77
|
});
|
|
78
|
-
|
|
78
|
+
// If both label and placeholder are provided, hide placeholder when not focused
|
|
79
|
+
const computedPlaceholder = placeholder && !isFocused ? undefined : placeholder;
|
|
80
|
+
return (jsxs("div", { children: [jsxs("div", { className: containerClasses, children: [endIcon && (jsx("span", { className: cn(iconClasses, 'left-4'), children: endIcon })), jsx("label", { htmlFor: id, className: labelClasses, children: label }), jsx("input", { ref: ref, id: id, type: type, value: value, onChange: onChange, onFocus: handleFocus, onBlur: handleBlur, disabled: isDisabled, placeholder: computedPlaceholder, className: inputClasses, ...props }), startIcon && (jsx("span", { className: cn(iconClasses, 'right-4'), children: startIcon }))] }), helperText && jsx("p", { className: helperTextClasses, children: helperText })] }));
|
|
79
81
|
});
|
|
80
82
|
Input.displayName = 'Input';
|
|
81
83
|
|
|
@@ -51,6 +51,12 @@ declare const _default: {
|
|
|
51
51
|
type: string;
|
|
52
52
|
};
|
|
53
53
|
};
|
|
54
|
+
placeholder: {
|
|
55
|
+
name: string;
|
|
56
|
+
control: {
|
|
57
|
+
type: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
54
60
|
startIcon: {
|
|
55
61
|
table: {
|
|
56
62
|
disable: boolean;
|
|
@@ -83,6 +89,7 @@ export declare const Default: {
|
|
|
83
89
|
initialValue: string;
|
|
84
90
|
helperText: string;
|
|
85
91
|
isMobile: boolean;
|
|
92
|
+
placeholder: string;
|
|
86
93
|
};
|
|
87
94
|
};
|
|
88
95
|
export declare const ErrorState: {
|
|
@@ -94,6 +101,7 @@ export declare const ErrorState: {
|
|
|
94
101
|
initialValue: string;
|
|
95
102
|
helperText: string;
|
|
96
103
|
isMobile: boolean;
|
|
104
|
+
placeholder: string;
|
|
97
105
|
};
|
|
98
106
|
};
|
|
99
107
|
export declare const DisabledState: {
|
|
@@ -105,6 +113,7 @@ export declare const DisabledState: {
|
|
|
105
113
|
helperText: string;
|
|
106
114
|
initialValue: string;
|
|
107
115
|
isMobile: boolean;
|
|
116
|
+
placeholder: string;
|
|
108
117
|
};
|
|
109
118
|
};
|
|
110
119
|
export declare const WithIcons: {
|
|
@@ -116,6 +125,7 @@ export declare const WithIcons: {
|
|
|
116
125
|
initialValue: string;
|
|
117
126
|
helperText: string;
|
|
118
127
|
isMobile: boolean;
|
|
128
|
+
placeholder: string;
|
|
119
129
|
};
|
|
120
130
|
};
|
|
121
131
|
export declare const MobileVersion: {
|
|
@@ -127,5 +137,18 @@ export declare const MobileVersion: {
|
|
|
127
137
|
helperText: string;
|
|
128
138
|
state: string;
|
|
129
139
|
initialValue: string;
|
|
140
|
+
placeholder: string;
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
export declare const WithLabelAndPlaceholder: {
|
|
144
|
+
(args: StoryArgs): import("react/jsx-runtime").JSX.Element;
|
|
145
|
+
storyName: string;
|
|
146
|
+
args: {
|
|
147
|
+
state: string;
|
|
148
|
+
label: string;
|
|
149
|
+
initialValue: string;
|
|
150
|
+
helperText: string;
|
|
151
|
+
isMobile: boolean;
|
|
152
|
+
placeholder: string;
|
|
130
153
|
};
|
|
131
154
|
};
|