@starasia/textarea 3.1.1 → 4.0.0

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.
@@ -338,7 +338,7 @@ const Y = (e) => e ? e === "warning" ? "error" : e : "default", Z = J(
338
338
  showCount: l,
339
339
  height: O,
340
340
  width: V,
341
- fullWidth: v = !1,
341
+ fullWidth: v = !0,
342
342
  className: A,
343
343
  style: P,
344
344
  ...t
@@ -312,4 +312,4 @@
312
312
  background-color: transparent !important;
313
313
  color: var(--sa-tx-text-primary);
314
314
  }
315
- `,v="sa-textarea-styles";(r=>{if(!(typeof document>"u")&&!document.getElementById(v)){const i=document.createElement("style");i.id=v,i.textContent=r,document.head.appendChild(i)}})(F);const $=r=>r?r==="warning"?"error":r:"default",g=o.forwardRef((r,i)=>{const{size:B="md",variant:I="outline",status:O,label:u,labelPosition:m="outside-top",required:L,optional:q,description:l,helperText:b,errorText:p,resize:P="vertical",showCount:x,height:V,width:A,fullWidth:w=!1,className:D,style:M,...a}=r,d=$(O),y=a.value!==void 0,W=a.value!==void 0?String(a.value??""):String(a.defaultValue??""),[X,H]=o.useState(W),[G,z]=o.useState(!1),k=o.useRef(null);o.useImperativeHandle(i,()=>k.current);const N=o.useRef(a.id??`sa-tx-${Math.random().toString(36).slice(2,9)}`),f=y?String(a.value??""):X,c=d==="disable"||a.disabled,J=c?"disable":d,S=["sa-tx",`sa-tx-variant-${I}`,`sa-tx-size-${B}`,`sa-tx-status-${J}`,`sa-tx-label-${m}`,`sa-tx-resize-${P}`,G?"sa-tx-focused":"",c?"sa-tx-disabled":"",u?"":"sa-tx-no-label",w?"sa-tx-fullwidth":""].filter(Boolean).join(" "),K=s=>{var e;y||H(s.target.value),(e=a.onChange)==null||e.call(a,s)},T=s=>u?t.jsxs("div",{className:s,children:[t.jsx("label",{htmlFor:N.current,style:{cursor:c?"not-allowed":"pointer"},children:u}),q?t.jsx("span",{className:"sa-tx-optional",children:"Optional"}):null,L?t.jsx("span",{className:"sa-tx-required","aria-hidden":"true",children:"*"}):null]}):null,j=(typeof x=="number"?x:void 0)??a.maxLength,h=x!==!1&&x!==void 0?j!==void 0?`${f.length} / ${j}`:`${f.length}`:null,C=b||p&&d==="error"||h?t.jsxs("div",{className:"sa-tx-footer",children:[t.jsx("div",{className:"sa-tx-footer-text",children:p&&d==="error"?t.jsx("p",{className:"sa-tx-error",children:p}):b?t.jsx("p",{className:"sa-tx-helper",children:b}):null}),h?t.jsx("p",{className:"sa-tx-counter sa-tx-footer-counter",children:h}):null]}):null,Q=t.jsx("div",{className:"sa-tx-field-wrap",children:t.jsx("textarea",{...a,id:N.current,ref:k,className:["sa-tx-input",D].filter(Boolean).join(" "),disabled:c,value:f,style:{height:V,width:w?"100%":A,...M},onFocus:s=>{var e;z(!0),(e=a.onFocus)==null||e.call(a,s)},onBlur:s=>{var e;z(!1),(e=a.onBlur)==null||e.call(a,s)},onChange:K})}),E=t.jsx("div",{className:"sa-tx-box",children:Q});return m==="outside-left"?t.jsxs("div",{className:S,children:[t.jsxs("div",{className:"sa-tx-label-col",children:[T("sa-tx-label"),l?t.jsx("p",{className:"sa-tx-desc-top",children:l}):null]}),t.jsxs("div",{className:"sa-tx-input-col",children:[E,C]})]}):t.jsxs("div",{className:S,children:[T("sa-tx-label"),l?t.jsx("p",{className:"sa-tx-desc-top",children:l}):null,E,C]})});g.displayName="Textarea",n.Textarea=g,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
315
+ `,v="sa-textarea-styles";(r=>{if(!(typeof document>"u")&&!document.getElementById(v)){const i=document.createElement("style");i.id=v,i.textContent=r,document.head.appendChild(i)}})(F);const $=r=>r?r==="warning"?"error":r:"default",g=o.forwardRef((r,i)=>{const{size:B="md",variant:I="outline",status:O,label:u,labelPosition:m="outside-top",required:L,optional:q,description:l,helperText:b,errorText:p,resize:P="vertical",showCount:x,height:V,width:A,fullWidth:w=!0,className:D,style:M,...a}=r,d=$(O),y=a.value!==void 0,W=a.value!==void 0?String(a.value??""):String(a.defaultValue??""),[X,H]=o.useState(W),[G,z]=o.useState(!1),k=o.useRef(null);o.useImperativeHandle(i,()=>k.current);const N=o.useRef(a.id??`sa-tx-${Math.random().toString(36).slice(2,9)}`),f=y?String(a.value??""):X,c=d==="disable"||a.disabled,J=c?"disable":d,S=["sa-tx",`sa-tx-variant-${I}`,`sa-tx-size-${B}`,`sa-tx-status-${J}`,`sa-tx-label-${m}`,`sa-tx-resize-${P}`,G?"sa-tx-focused":"",c?"sa-tx-disabled":"",u?"":"sa-tx-no-label",w?"sa-tx-fullwidth":""].filter(Boolean).join(" "),K=s=>{var e;y||H(s.target.value),(e=a.onChange)==null||e.call(a,s)},T=s=>u?t.jsxs("div",{className:s,children:[t.jsx("label",{htmlFor:N.current,style:{cursor:c?"not-allowed":"pointer"},children:u}),q?t.jsx("span",{className:"sa-tx-optional",children:"Optional"}):null,L?t.jsx("span",{className:"sa-tx-required","aria-hidden":"true",children:"*"}):null]}):null,j=(typeof x=="number"?x:void 0)??a.maxLength,h=x!==!1&&x!==void 0?j!==void 0?`${f.length} / ${j}`:`${f.length}`:null,C=b||p&&d==="error"||h?t.jsxs("div",{className:"sa-tx-footer",children:[t.jsx("div",{className:"sa-tx-footer-text",children:p&&d==="error"?t.jsx("p",{className:"sa-tx-error",children:p}):b?t.jsx("p",{className:"sa-tx-helper",children:b}):null}),h?t.jsx("p",{className:"sa-tx-counter sa-tx-footer-counter",children:h}):null]}):null,Q=t.jsx("div",{className:"sa-tx-field-wrap",children:t.jsx("textarea",{...a,id:N.current,ref:k,className:["sa-tx-input",D].filter(Boolean).join(" "),disabled:c,value:f,style:{height:V,width:w?"100%":A,...M},onFocus:s=>{var e;z(!0),(e=a.onFocus)==null||e.call(a,s)},onBlur:s=>{var e;z(!1),(e=a.onBlur)==null||e.call(a,s)},onChange:K})}),E=t.jsx("div",{className:"sa-tx-box",children:Q});return m==="outside-left"?t.jsxs("div",{className:S,children:[t.jsxs("div",{className:"sa-tx-label-col",children:[T("sa-tx-label"),l?t.jsx("p",{className:"sa-tx-desc-top",children:l}):null]}),t.jsxs("div",{className:"sa-tx-input-col",children:[E,C]})]}):t.jsxs("div",{className:S,children:[T("sa-tx-label"),l?t.jsx("p",{className:"sa-tx-desc-top",children:l}):null,E,C]})});g.displayName="Textarea",n.Textarea=g,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starasia/textarea",
3
- "version": "3.1.1",
3
+ "version": "4.0.0",
4
4
  "description": "textarea component for starasia UI",
5
5
  "author": "Prawito Hudoro",
6
6
  "main": "dist/textarea.umd.js",