alope-ui 1.2.56 → 1.2.57

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,8 +1,7 @@
1
- import { default as React, InputHTMLAttributes } from 'react';
1
+ import { default as React, TextareaHTMLAttributes } from 'react';
2
2
  export type TextareaType = {
3
3
  label?: string;
4
4
  error?: string;
5
5
  autoResize?: boolean;
6
- customClassName?: string;
7
- } & InputHTMLAttributes<HTMLTextAreaElement>;
6
+ } & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'className'>;
8
7
  export declare const Textarea: React.FC<TextareaType>;
package/dist/main.cjs CHANGED
@@ -130,9 +130,9 @@ f?.(r?y.filter(r=>r.id!==e.id):[...y,e])})(t)})}),r.map((r,n)=>e.jsx("td",{class
130
130
  return r.useEffect(()=>{!x&&b>=t.length&&g(Math.max(0,t.length-1))},[t,b,x]),r.useEffect(()=>{const e=k.current[b],r=f.current
131
131
  if(e&&r){const a=e.offsetLeft,t=e.offsetWidth
132
132
  r.style.transform=`translateX(${a}px)`,r.style.width=`${t}px`,e.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})}},[b,t]),e.jsxs("div",{children:[e.jsx("div",{className:a.cn("relative",p.wrapper,n),children:e.jsxs("nav",{className:"relative -mb-px flex space-x-2 overflow-x-auto scroll-smooth","aria-label":"Tabs",children:[t.map((r,t)=>{const o=a.cn("hover:cursor-pointer",s&&"flex-1",p.button,l,b===t?a.cn(p.active,d):a.cn(p.inactive,i),r.disabled&&"hover:cursor-not-allowed cursor-not-allowed opacity-50")
133
- return r.link?e.jsx("a",{href:r.disabled?void 0:r.link,ref:e=>{k.current[t]=e},className:o,"aria-disabled":r.disabled,onClick:e=>r.disabled&&e.preventDefault(),children:r.label},r.label):e.jsx("button",{ref:e=>{k.current[t]=e},onClick:()=>(e=>{x?m(e):g(e)})(t),disabled:r.disabled,className:o,children:r.label},r.label)}),e.jsx("div",{ref:f,className:a.cn(h),style:{width:0,transform:"translateX(0px)"}})]})}),e.jsx("div",{className:"mt-4",children:t[b]?.content})]})},exports.TextInput=D,exports.Textarea=({label:t,id:s,name:o,error:n,autoResize:l=!1,customClassName:d,...i})=>{const c=r.useRef(null),m=()=>{const e=c.current
133
+ return r.link?e.jsx("a",{href:r.disabled?void 0:r.link,ref:e=>{k.current[t]=e},className:o,"aria-disabled":r.disabled,onClick:e=>r.disabled&&e.preventDefault(),children:r.label},r.label):e.jsx("button",{ref:e=>{k.current[t]=e},onClick:()=>(e=>{x?m(e):g(e)})(t),disabled:r.disabled,className:o,children:r.label},r.label)}),e.jsx("div",{ref:f,className:a.cn(h),style:{width:0,transform:"translateX(0px)"}})]})}),e.jsx("div",{className:"mt-4",children:t[b]?.content})]})},exports.TextInput=D,exports.Textarea=({label:t,id:s,name:o,error:n,autoResize:l=!1,onInput:d,...i})=>{const c=r.useRef(null),m=()=>{const e=c.current
134
134
  e&&(e.style.height="auto",e.style.height=`${e.scrollHeight}px`)}
135
- return r.useEffect(()=>{l&&m()},[]),e.jsxs("div",{children:[t&&e.jsx("label",{htmlFor:s||o,className:"inline-block text-sm font-medium mb-1 dark:text-white",children:t}),e.jsx("textarea",{id:s||o,name:o,rows:l?1:5,ref:c,onInput:m,className:a.cn("overflow-hidden bg-gray-50 w-full block px-3 py-2 border rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary sm:text-sm border-secondary min-h-[58px] max-h-[10rem]","dark:bg-gray-800 dark:border-secondary-dark dark:text-white dark:placeholder:text-gray-400",l?"resize-none":"resize",n&&"border-error dark:border-error-dark",i.disabled&&"bg-secondary/40 cursor-not-allowed",d),...i}),n&&e.jsx("p",{className:"mt-1 text-sm text-red-600 dark:text-red-500",children:n})]})},exports.Timeline=ue,exports.ToastProvider=({children:a})=>{const[t,s]=r.useState([]),o=Object.keys(W)
135
+ return r.useEffect(()=>{l&&m()},[l,i.value]),e.jsxs("div",{className:"w-full",children:[t&&e.jsx("label",{htmlFor:s||o,className:"inline-block text-sm font-medium mb-1 text-gray-900 dark:text-neutral-100",children:t}),e.jsx("textarea",{id:s||o,name:o,rows:l?1:5,ref:c,onInput:e=>{l&&m(),d?.(e)},className:a.cn("w-full block px-3 py-2 border rounded-md shadow-sm sm:text-sm min-h-[58px] max-h-[10rem] transition-colors","bg-white border-gray-200 text-gray-900 placeholder:text-gray-400","dark:bg-neutral-900 dark:border-neutral-800 dark:text-neutral-100 dark:placeholder:text-neutral-500","focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary dark:focus:ring-primary-dark dark:focus:border-primary-dark",l?"resize-none overflow-hidden":"resize-y overflow-y-auto",n&&"border-error dark:border-error-dark focus:ring-error focus:border-error dark:focus:ring-error-dark dark:focus:border-error-dark",i.disabled&&"opacity-50 bg-gray-100 dark:bg-neutral-800 cursor-not-allowed"),...i}),n&&e.jsx("p",{className:"mt-1 text-sm text-error dark:text-error-dark",children:n})]})},exports.Timeline=ue,exports.ToastProvider=({children:a})=>{const[t,s]=r.useState([]),o=Object.keys(W)
136
136
  return e.jsxs(Z.Provider,{value:{addToast:({title:e,message:r,type:a,variant:t,icon:o,withClose:n=!0,withLoading:l=!1,onClose:d,position:i="bottom-right"})=>{const c=Date.now()+Math.random()
137
137
  s(s=>[...s,{title:e,id:c,message:r,type:a,variant:t,icon:o,withClose:n,withLoading:l,onClose:d,position:i}])}},children:[a,o.map(r=>e.jsx("div",{className:`fixed z-50 ${W[r]}`,children:t.filter(e=>e.position===r).map(r=>e.jsx(U,{title:r.title,message:r.message,type:r.type,variant:r.variant,icon:r.icon,withClose:r.withClose,withLoading:r.withLoading,position:r.position,onClose:()=>{var e
138
138
  r.onClose?.(),e=r.id,s(r=>r.filter(r=>r.id!==e))}},r.id))},r))]})},exports.Toggle=({variant:r="primary",customSize:t="md",thumbShape:s="stadium",label:o,wrapperClassName:n,labelClassName:l,...d})=>{const i=["relative","bg-secondary-700 dark:bg-secondary-dark-700","peer-checked:after:translate-x-full","rtl:peer-checked:after:-translate-x-full","peer-checked:after:border-white","after:absolute","after:bg-white","after:transition-colors","after:transition-transform","duration-500"].filter(Boolean).join(" "),c=["inline-flex items-center cursor-pointer"].filter(Boolean).join(" ")
package/dist/main.js CHANGED
@@ -3269,7 +3269,7 @@ const Textarea = ({
3269
3269
  name,
3270
3270
  error,
3271
3271
  autoResize = false,
3272
- customClassName,
3272
+ onInput,
3273
3273
  ...props
3274
3274
  }) => {
3275
3275
  const textareaRef = useRef(null);
@@ -3282,13 +3282,17 @@ const Textarea = ({
3282
3282
  };
3283
3283
  useEffect(() => {
3284
3284
  if (autoResize) handleResize();
3285
- }, []);
3286
- return /* @__PURE__ */ jsxs("div", { children: [
3285
+ }, [autoResize, props.value]);
3286
+ const handleInput = (e) => {
3287
+ if (autoResize) handleResize();
3288
+ onInput?.(e);
3289
+ };
3290
+ return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
3287
3291
  label && /* @__PURE__ */ jsx(
3288
3292
  "label",
3289
3293
  {
3290
3294
  htmlFor: id || name,
3291
- className: "inline-block text-sm font-medium mb-1 dark:text-white",
3295
+ className: "inline-block text-sm font-medium mb-1 text-gray-900 dark:text-neutral-100",
3292
3296
  children: label
3293
3297
  }
3294
3298
  ),
@@ -3299,19 +3303,20 @@ const Textarea = ({
3299
3303
  name,
3300
3304
  rows: autoResize ? 1 : 5,
3301
3305
  ref: textareaRef,
3302
- onInput: handleResize,
3306
+ onInput: handleInput,
3303
3307
  className: cn(
3304
- `overflow-hidden bg-gray-50 w-full block px-3 py-2 border rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary sm:text-sm border-secondary min-h-[58px] max-h-[10rem]`,
3305
- "dark:bg-gray-800 dark:border-secondary-dark dark:text-white dark:placeholder:text-gray-400",
3306
- autoResize ? "resize-none" : "resize",
3307
- error && "border-error dark:border-error-dark",
3308
- props.disabled && "bg-secondary/40 cursor-not-allowed",
3309
- customClassName
3308
+ "w-full block px-3 py-2 border rounded-md shadow-sm sm:text-sm min-h-[58px] max-h-[10rem] transition-colors",
3309
+ "bg-white border-gray-200 text-gray-900 placeholder:text-gray-400",
3310
+ "dark:bg-neutral-900 dark:border-neutral-800 dark:text-neutral-100 dark:placeholder:text-neutral-500",
3311
+ "focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary dark:focus:ring-primary-dark dark:focus:border-primary-dark",
3312
+ autoResize ? "resize-none overflow-hidden" : "resize-y overflow-y-auto",
3313
+ error && "border-error dark:border-error-dark focus:ring-error focus:border-error dark:focus:ring-error-dark dark:focus:border-error-dark",
3314
+ props.disabled && "opacity-50 bg-gray-100 dark:bg-neutral-800 cursor-not-allowed"
3310
3315
  ),
3311
3316
  ...props
3312
3317
  }
3313
3318
  ),
3314
- error && /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-red-600 dark:text-red-500", children: error })
3319
+ error && /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-error dark:text-error-dark", children: error })
3315
3320
  ] });
3316
3321
  };
3317
3322
  const DotColors = {
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Alope-Community/alope-ui.git"
7
7
  },
8
- "version": "1.2.56",
8
+ "version": "1.2.57",
9
9
  "type": "module",
10
10
  "files": [
11
11
  "dist"