@starasia/textarea 3.1.0 → 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.
- package/dist/textarea.es.js +2 -2
- package/dist/textarea.umd.js +2 -2
- package/package.json +6 -6
package/dist/textarea.es.js
CHANGED
|
@@ -21,7 +21,7 @@ const Q = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@30
|
|
|
21
21
|
--sa-tx-border-danger: var(--sa-border-danger, #c9184a);
|
|
22
22
|
--sa-tx-border-danger-subtle: var(--sa-color-error-200, #ffb3c1);
|
|
23
23
|
--sa-tx-border-success: var(--sa-background-success, #28ac6e);
|
|
24
|
-
--sa-tx-border-disabled: var(--sa-border-disabled, #
|
|
24
|
+
--sa-tx-border-disabled: var(--sa-border-disabled, #0515240e);
|
|
25
25
|
|
|
26
26
|
--sa-tx-bg-neutral: var(--sa-background-neutral, #f0f1f2);
|
|
27
27
|
--sa-tx-bg-error-subtlest: var(--sa-background-error-subtlest, #fff0f3);
|
|
@@ -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 = !
|
|
341
|
+
fullWidth: v = !0,
|
|
342
342
|
className: A,
|
|
343
343
|
style: P,
|
|
344
344
|
...t
|
package/dist/textarea.umd.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
--sa-tx-border-danger: var(--sa-border-danger, #c9184a);
|
|
20
20
|
--sa-tx-border-danger-subtle: var(--sa-color-error-200, #ffb3c1);
|
|
21
21
|
--sa-tx-border-success: var(--sa-background-success, #28ac6e);
|
|
22
|
-
--sa-tx-border-disabled: var(--sa-border-disabled, #
|
|
22
|
+
--sa-tx-border-disabled: var(--sa-border-disabled, #0515240e);
|
|
23
23
|
|
|
24
24
|
--sa-tx-bg-neutral: var(--sa-background-neutral, #f0f1f2);
|
|
25
25
|
--sa-tx-bg-error-subtlest: var(--sa-background-error-subtlest, #fff0f3);
|
|
@@ -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=!
|
|
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
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "textarea component for starasia UI",
|
|
5
5
|
"author": "Prawito Hudoro",
|
|
6
6
|
"main": "dist/textarea.umd.js",
|
|
@@ -12,10 +12,6 @@
|
|
|
12
12
|
"dist/*.map",
|
|
13
13
|
"dist/*.css"
|
|
14
14
|
],
|
|
15
|
-
"scripts": {
|
|
16
|
-
"dev": "vite --config vite.config.ts --port 3000",
|
|
17
|
-
"build": "vite build --config vite.config.ts"
|
|
18
|
-
},
|
|
19
15
|
"keywords": [],
|
|
20
16
|
"license": "ISC",
|
|
21
17
|
"type": "module",
|
|
@@ -37,5 +33,9 @@
|
|
|
37
33
|
"react-dom": "^18.2.0",
|
|
38
34
|
"@types/react": "^18.2.55",
|
|
39
35
|
"@types/react-dom": "^18.2.19"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"dev": "vite --config vite.config.ts --port 3000",
|
|
39
|
+
"build": "vite build --config vite.config.ts"
|
|
40
40
|
}
|
|
41
|
-
}
|
|
41
|
+
}
|