jb-textarea 3.7.0 → 3.8.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/README.md +32 -5
- package/dist/jb-textarea.cjs.js +1 -1
- package/dist/jb-textarea.cjs.js.br +0 -0
- package/dist/jb-textarea.cjs.js.gz +0 -0
- package/dist/jb-textarea.cjs.js.map +1 -1
- package/dist/jb-textarea.js +1 -1
- package/dist/jb-textarea.js.br +0 -0
- package/dist/jb-textarea.js.gz +0 -0
- package/dist/jb-textarea.js.map +1 -1
- package/dist/jb-textarea.umd.js +1 -1
- package/dist/jb-textarea.umd.js.br +0 -0
- package/dist/jb-textarea.umd.js.gz +0 -0
- package/dist/jb-textarea.umd.js.map +1 -1
- package/lib/jb-textarea.html +10 -4
- package/lib/jb-textarea.scss +47 -19
- package/package.json +1 -1
- package/react/README.md +1 -22
- package/react/dist/JBTextarea.cjs.js +1 -1
- package/react/dist/JBTextarea.cjs.js.map +1 -1
- package/react/dist/JBTextarea.d.ts +6 -5
- package/react/dist/JBTextarea.js +1 -1
- package/react/dist/JBTextarea.js.map +1 -1
- package/react/dist/JBTextarea.umd.js +1 -1
- package/react/dist/JBTextarea.umd.js.map +1 -1
- package/react/dist/attributes-hook.d.ts +1 -0
- package/react/lib/JBTextarea.tsx +7 -4
- package/react/lib/attributes-hook.ts +11 -0
- package/dist/lib/jb-textarea.d.ts +0 -37
- package/dist/lib/types.d.ts +0 -10
- package/dist/web-component/jb-textarea/lib/jb-textarea.d.ts +0 -37
- package/dist/web-component/jb-textarea/lib/types.d.ts +0 -10
- package/react/dist/common/hooks/use-event.d.ts +0 -3
- package/react/dist/common/hooks/useLazyRef.d.ts +0 -4
- package/react/dist/common/hooks/useMobx.d.ts +0 -4
- package/react/dist/common/scripts/device-detection.d.ts +0 -1
- package/react/dist/common/scripts/persian-helper.d.ts +0 -3
- package/react/dist/lib/JBTextarea.d.ts +0 -44
- package/react/dist/lib/events-hook.d.ts +0 -20
- package/react/dist/web-component/jb-textarea/react/lib/JBTextarea.d.ts +0 -44
- package/react/dist/web-component/jb-textarea/react/lib/events-hook.d.ts +0 -20
package/package.json
CHANGED
package/react/README.md
CHANGED
|
@@ -89,28 +89,7 @@ the good point of set boundary with css variable is you can set different min or
|
|
|
89
89
|
|
|
90
90
|
## set custom style
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
if you want to set a custom style to this web-component all you need is to set css variable in parent scope of web-component
|
|
94
|
-
| css variable name | description |
|
|
95
|
-
| ------------- | ------------- |
|
|
96
|
-
| --jb-textarea-margin | web-component margin default is `0 12px` |
|
|
97
|
-
| --jb-textarea-border-radius | web-component border-radius default is `16px` |
|
|
98
|
-
| --jb-textarea-border-width | web-component border-width default is `1px` |
|
|
99
|
-
| --jb-textarea-border-color | border color of select in normal mode |
|
|
100
|
-
| --jb-textarea-border-color-focus | border color of select in normal mode |
|
|
101
|
-
| --jb-textarea-bgcolor | background color of input |
|
|
102
|
-
| --jb-textarea-border-botton-width | border bottom thickness default is `3px` |
|
|
103
|
-
| --jb-textarea-label-font-size | font size of input label default is `0.8em` |
|
|
104
|
-
| --jb-textarea-value-font-size | font size of input value default is `1.1em` |
|
|
105
|
-
| --jb-textarea-value-color | color of value default in `initial` |
|
|
106
|
-
| --jb-textarea-message-font-size | font size of message we show under input |
|
|
107
|
-
| --jb-textarea-message-error-color | change color of error we show under input default is `red` |
|
|
108
|
-
| --jb-textarea-min-height | minimum height of text area default is `80px` |
|
|
109
|
-
| --jb-textarea-max-height | minimum height of text area default is `none` |
|
|
110
|
-
| --jb-textarea-placeholder-color | placeholder color default is 'initial' |
|
|
111
|
-
| --jb-textarea-placeholder-font-size | placeholder font-size default is `initial` |
|
|
112
|
-
| --jb-textarea-label-color | label color default is `#1f1735` |
|
|
113
|
-
| --jb-textarea-value-color | value color |
|
|
92
|
+
see see [jb-textarea](https://github.com/javadbat/jb-textarea) document. there is no difference between these 2 in styling.
|
|
114
93
|
|
|
115
94
|
## Other Related Docs:
|
|
116
95
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=Object.create,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,n=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,n,o,
|
|
1
|
+
"use strict";var e=Object.create,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,n=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,n,o,c)=>{if(n&&"object"==typeof n||"function"==typeof n)for(var l,s=u(n),i=0,f=s.length;i<f;i++)l=s[i],a.call(e,l)||l===o||t(e,l,{get:(e=>n[e]).bind(null,l),enumerable:!(c=r(n,l))||c.enumerable});return e},c=(r,u,a)=>(a=null!=r?e(n(r)):{},o(!u&&r&&r.__esModule?a:t(a,"default",{value:r,enumerable:!0}),r));const l=c(require("react"));require("jb-textarea");const s=c(require("jb-core/react")),i=l.default.forwardRef((e,t)=>{{let r=(0,l.useRef)(null);return(0,l.useImperativeHandle)(t,()=>r?r.current:void 0,[r]),(0,l.useEffect)(()=>{let t=e.value||"";r.current&&(r.current.value=t)},[e.value]),(0,l.useEffect)(()=>{r.current&&(r.current.validation.list=e.validationList||[])},[e.validationList]),(0,l.useEffect)(()=>{r.current&&void 0!==e.required&&(e.required?r.current.setAttribute("required",""):r.current.removeAttribute("required"))},[e.required]),(0,l.useEffect)(()=>{r.current&&(r.current.autoHeight=e.autoHeight||!1)},[e.autoHeight]),(0,l.useEffect)(()=>{e.error?r?.current?.setAttribute("error",e.error):r?.current?.removeAttribute("error")},[e.error]),(0,l.useEffect)(()=>{e.name?r?.current?.setAttribute("name",e.name||""):r?.current?.removeAttribute("name")},[e.name]),(0,s.useEvent)(r,"load",e.onLoad,!0),(0,s.useEvent)(r,"init",e.onInit,!0),(0,s.useEvent)(r,"change",e.onChange),(0,s.useEvent)(r,"keydown",e.onKeyDown),(0,s.useEvent)(r,"input",e.onInput),(0,s.useEvent)(r,"keyup",e.onKeyUp),(0,s.useEvent)(r,"focus",e.onFocus),(0,s.useEvent)(r,"blur",e.onBlur),l.default.createElement("jb-textarea",{placeholder:e.placeholder,class:e.className,style:e.style,ref:r,label:e.label,message:e.message},e.children)}});exports.JBTextarea=i;
|
|
2
2
|
//# sourceMappingURL=JBTextarea.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JBTextarea.cjs.js","names":[],"sources":["../lib/events-hook.ts","../lib/attributes-hook.ts","../lib/JBTextarea.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"JBTextarea.cjs.js","names":[],"sources":["../lib/events-hook.ts","../lib/attributes-hook.ts","../lib/JBTextarea.tsx"],"sourcesContent":["","",""],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBM,SAAU,UAAU,SAA4C,OAAiB;AACrF,6BAAS,SAAS,QAAQ,MAAM,QAAQ,KAAK;AAC7C,6BAAS,SAAS,QAAQ,MAAM,QAAQ,KAAK;AAC7C,6BAAS,SAAS,UAAU,MAAM,SAAS;AAC3C,6BAAS,SAAS,WAAW,MAAM,UAAU;AAC7C,6BAAS,SAAS,SAAS,MAAM,QAAQ;AACzC,6BAAS,SAAS,SAAS,MAAM,QAAQ;AACzC,6BAAS,SAAS,SAAS,MAAM,QAAQ;AACzC,6BAAS,SAAS,QAAQ,MAAM,OAAO;AACzC;;;;AClBM,SAAU,uBAAuB,SAA4C,OAA2B;AAE5G,sBAAU,MAAG;EACX,MAAM,QAAe,MAAM,SAAS;AACpC,MAAG,QAAQ,QACT,SAAQ,QAAQ,QAAQ;CAE3B,GAAE,CAEH,MAAU;sBAEN,MAAA;AACF,MAAA,QAAA,QACE,SAAM,QAAc,WAAE,OAAA,MAAA,kBAAA,CAAA;WAGtB;AAEJ,sBAAU,MAAA;AAEV,MAAA,QAAe,WAAA,MAAA,aAAA,UACV,OAAA,WAAgB,QAAA,QAAA,aAAA,YAAA,GAAA,GAAA,QAAA,QAAA,gBAAA,WAAA;KAGjB,MAAM,QAEV,EAAA;sBACM,MAAM;MACR,QAAO,QACT,SAAA,QAAA,aAAA,MAAA,cAAA;KAEA,MAAA,UACD,EAAA;AAEC,sBAAU,MAAG;AACb,MAAI,MAAM,MACR,UAAS,SAAS,aAAa,SAAQ,MAAM,MAAI;gBAC5C,SAAA,gBAAA,QAAA;KAGL,MAAM,KAEZ,EAAA;;;;;;;;;AChCA,MAAA,2BAAA,cAAA,WAAA,CAAA,OAAA,QAAA;CACA;EAEI,MAAA,UAAA,kBAAA,KAAA;AACA,iCAAgB,KAA+B,MAAK,UAAA,QAAA,UAAA,WAAA,CACpD,OAKA,EAAA;AACA,yBAAkB,SAAM,MAAA;AACxB,YACE,SAAA,MAAA;AAIJ,uBAAA,cAAA,cAAA,eAAA;GACA,aAAA,MAAA;GAUF,OAAA,MAAA;GACQ,OAAU,MAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { CSSProperties } from 'react';
|
|
1
|
+
import React, { CSSProperties, type PropsWithChildren } from 'react';
|
|
2
2
|
import 'jb-textarea';
|
|
3
3
|
import { JBTextareaWebComponent } from 'jb-textarea';
|
|
4
4
|
import { EventProps } from './events-hook.js';
|
|
@@ -23,14 +23,15 @@ declare const JBTextarea: React.ForwardRefExoticComponent<EventProps & JBTextare
|
|
|
23
23
|
className?: string;
|
|
24
24
|
message?: string;
|
|
25
25
|
style?: CSSProperties;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
} & {
|
|
27
|
+
children?: React.ReactNode | undefined;
|
|
28
|
+
} & React.HTMLAttributes<JBTextareaWebComponent> & React.RefAttributes<unknown>>;
|
|
29
|
+
type JBTextareaProps = EventProps & JBTextareaAttributes & {
|
|
29
30
|
label?: string;
|
|
30
31
|
placeholder?: string;
|
|
31
32
|
className?: string;
|
|
32
33
|
message?: string;
|
|
33
34
|
style?: CSSProperties;
|
|
34
|
-
name?: string;
|
|
35
35
|
};
|
|
36
|
+
export type Props = PropsWithChildren<JBTextareaProps> & React.HTMLAttributes<JBTextareaWebComponent>;
|
|
36
37
|
export { JBTextarea };
|
package/react/dist/JBTextarea.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e,{useEffect as r,useImperativeHandle as t,useRef as
|
|
1
|
+
import e,{useEffect as r,useImperativeHandle as t,useRef as n}from"react";import"jb-textarea";import{useEvent as a}from"jb-core/react";let o=e.forwardRef((o,u)=>{{var i;let l=n(null);return t(u,()=>l?l.current:void 0,[l]),r(()=>{let e=i.value||"";l.current&&(l.current.value=e)},[(i=o).value]),r(()=>{l.current&&(l.current.validation.list=i.validationList||[])},[i.validationList]),r(()=>{l.current&&void 0!==i.required&&(i.required?l.current.setAttribute("required",""):l.current.removeAttribute("required"))},[i.required]),r(()=>{l.current&&(l.current.autoHeight=i.autoHeight||!1)},[i.autoHeight]),r(()=>{i.error?l?.current?.setAttribute("error",i.error):l?.current?.removeAttribute("error")},[i.error]),r(()=>{i.name?l?.current?.setAttribute("name",i.name||""):l?.current?.removeAttribute("name")},[i.name]),a(l,"load",o.onLoad,!0),a(l,"init",o.onInit,!0),a(l,"change",o.onChange),a(l,"keydown",o.onKeyDown),a(l,"input",o.onInput),a(l,"keyup",o.onKeyUp),a(l,"focus",o.onFocus),a(l,"blur",o.onBlur),e.createElement("jb-textarea",{placeholder:o.placeholder,class:o.className,style:o.style,ref:l,label:o.label,message:o.message},o.children)}});export{o as JBTextarea};
|
|
2
2
|
//# sourceMappingURL=JBTextarea.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JBTextarea.js","names":[],"sources":["../lib/events-hook.ts","../lib/attributes-hook.ts","../lib/JBTextarea.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"JBTextarea.js","names":[],"sources":["../lib/events-hook.ts","../lib/attributes-hook.ts","../lib/JBTextarea.tsx"],"sourcesContent":["","",""],"mappings":";;;;;AAsBM,SAAU,UAAU,SAA4C,OAAiB;AACrF,UAAS,SAAS,QAAQ,MAAM,QAAQ,KAAK;AAC7C,UAAS,SAAS,QAAQ,MAAM,QAAQ,KAAK;AAC7C,UAAS,SAAS,UAAU,MAAM,SAAS;AAC3C,UAAS,SAAS,WAAW,MAAM,UAAU;AAC7C,UAAS,SAAS,SAAS,MAAM,QAAQ;AACzC,UAAS,SAAS,SAAS,MAAM,QAAQ;AACzC,UAAS,SAAS,SAAS,MAAM,QAAQ;AACzC,UAAS,SAAS,QAAQ,MAAM,OAAO;AACzC;;;;AClBM,SAAU,uBAAuB,SAA4C,OAA2B;AAE5G,WAAU,MAAG;EACX,MAAM,QAAe,MAAM,SAAS;AACpC,MAAG,QAAQ,QACT,SAAQ,QAAQ,QAAQ;CAE3B,GAAE,CAEH,MAAU;WAEN,MAAA;AACF,MAAA,QAAA,QACE,SAAM,QAAc,WAAE,OAAA,MAAA,kBAAA,CAAA;WAGtB;AAEJ,WAAU,MAAA;AAEV,MAAA,QAAe,WAAA,MAAA,aAAA,UACV,OAAA,WAAgB,QAAA,QAAA,aAAA,YAAA,GAAA,GAAA,QAAA,QAAA,gBAAA,WAAA;KAGjB,MAAM,QAEV,EAAA;WACM,MAAM;MACR,QAAO,QACT,SAAA,QAAA,aAAA,MAAA,cAAA;KAEA,MAAA,UACD,EAAA;AAEC,WAAU,MAAG;AACb,MAAI,MAAM,MACR,UAAS,SAAS,aAAa,SAAQ,MAAM,MAAI;gBAC5C,SAAA,gBAAA,QAAA;KAGL,MAAM,KAEZ,EAAA;;;;;;;;;AChCA,MAAA,2BAAA,MAAA,WAAA,CAAA,OAAA,QAAA;CACA;EAEI,MAAA,UAAA,OAAA,KAAA;AACA,sBAAgB,KAA+B,MAAK,UAAA,QAAA,UAAA,WAAA,CACpD,OAKA,EAAA;AACA,yBAAkB,SAAM,MAAA;AACxB,YACE,SAAA,MAAA;AAIJ,uBAAA,MAAA,cAAA,eAAA;GACA,aAAA,MAAA;GAUF,OAAA,MAAA;GACQ,OAAU,MAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e,t;e=this,t=function(e,t,r,u){"use strict";var n=Object.create,a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,
|
|
1
|
+
var e,t;e=this,t=function(e,t,r,u){"use strict";var n=Object.create,a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,l=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,s=(e,t,r,u)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var n,l=c(t),s=0,f=l.length;s<f;s++)n=l[s],i.call(e,n)||n===r||a(e,n,{get:(e=>t[e]).bind(null,n),enumerable:!(u=o(t,n))||u.enumerable});return e},f=(e,t,r)=>(r=null!=e?n(l(e)):{},s(!t&&e&&e.__esModule?r:a(r,"default",{value:e,enumerable:!0}),e));t=f(t),u=f(u);let d=t.default.forwardRef((e,r)=>{{let n=(0,t.useRef)(null);return(0,t.useImperativeHandle)(r,()=>n?n.current:void 0,[n]),(0,t.useEffect)(()=>{let t=e.value||"";n.current&&(n.current.value=t)},[e.value]),(0,t.useEffect)(()=>{n.current&&(n.current.validation.list=e.validationList||[])},[e.validationList]),(0,t.useEffect)(()=>{n.current&&void 0!==e.required&&(e.required?n.current.setAttribute("required",""):n.current.removeAttribute("required"))},[e.required]),(0,t.useEffect)(()=>{n.current&&(n.current.autoHeight=e.autoHeight||!1)},[e.autoHeight]),(0,t.useEffect)(()=>{e.error?n?.current?.setAttribute("error",e.error):n?.current?.removeAttribute("error")},[e.error]),(0,t.useEffect)(()=>{e.name?n?.current?.setAttribute("name",e.name||""):n?.current?.removeAttribute("name")},[e.name]),(0,u.useEvent)(n,"load",e.onLoad,!0),(0,u.useEvent)(n,"init",e.onInit,!0),(0,u.useEvent)(n,"change",e.onChange),(0,u.useEvent)(n,"keydown",e.onKeyDown),(0,u.useEvent)(n,"input",e.onInput),(0,u.useEvent)(n,"keyup",e.onKeyUp),(0,u.useEvent)(n,"focus",e.onFocus),(0,u.useEvent)(n,"blur",e.onBlur),t.default.createElement("jb-textarea",{placeholder:e.placeholder,class:e.className,style:e.style,ref:n,label:e.label,message:e.message},e.children)}});e.JBTextarea=d},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("jb-textarea"),require("jb-core/react")):"function"==typeof define&&define.amd?define(["exports","react","jb-textarea","jb-core/react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).JBTextareaReact={},e.React,e.JBTextarea,e.JBCoreReact);
|
|
2
2
|
//# sourceMappingURL=JBTextarea.umd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JBTextarea.umd.js","names":[],"sources":["../lib/events-hook.ts","../lib/attributes-hook.ts","../lib/JBTextarea.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"JBTextarea.umd.js","names":[],"sources":["../lib/events-hook.ts","../lib/attributes-hook.ts","../lib/JBTextarea.tsx"],"sourcesContent":["","",""],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBM,SAAU,UAAU,SAA4C,OAAiB;AACrF,6BAAS,SAAS,QAAQ,MAAM,QAAQ,KAAK;AAC7C,6BAAS,SAAS,QAAQ,MAAM,QAAQ,KAAK;AAC7C,6BAAS,SAAS,UAAU,MAAM,SAAS;AAC3C,6BAAS,SAAS,WAAW,MAAM,UAAU;AAC7C,6BAAS,SAAS,SAAS,MAAM,QAAQ;AACzC,6BAAS,SAAS,SAAS,MAAM,QAAQ;AACzC,6BAAS,SAAS,SAAS,MAAM,QAAQ;AACzC,6BAAS,SAAS,QAAQ,MAAM,OAAO;AACzC;;;;AClBM,SAAU,uBAAuB,SAA4C,OAA2B;AAE5G,sBAAU,MAAG;EACX,MAAM,QAAe,MAAM,SAAS;AACpC,MAAG,QAAQ,QACT,SAAQ,QAAQ,QAAQ;CAE3B,GAAE,CAEH,MAAU;sBAEN,MAAA;AACF,MAAA,QAAA,QACE,SAAM,QAAc,WAAE,OAAA,MAAA,kBAAA,CAAA;WAGtB;AAEJ,sBAAU,MAAA;AAEV,MAAA,QAAe,WAAA,MAAA,aAAA,UACV,OAAA,WAAgB,QAAA,QAAA,aAAA,YAAA,GAAA,GAAA,QAAA,QAAA,gBAAA,WAAA;KAGjB,MAAM,QAEV,EAAA;sBACM,MAAM;MACR,QAAO,QACT,SAAA,QAAA,aAAA,MAAA,cAAA;KAEA,MAAA,UACD,EAAA;AAEC,sBAAU,MAAG;AACb,MAAI,MAAM,MACR,UAAS,SAAS,aAAa,SAAQ,MAAM,MAAI;gBAC5C,SAAA,gBAAA,QAAA;KAGL,MAAM,KAEZ,EAAA;;;;;;;;;AChCA,MAAA,2BAAA,cAAA,WAAA,CAAA,OAAA,QAAA;CACA;EAEI,MAAA,UAAA,kBAAA,KAAA;AACA,iCAAgB,KAA+B,MAAK,UAAA,QAAA,UAAA,WAAA,CACpD,OAKA,EAAA;AACA,yBAAkB,SAAM,MAAA;AACxB,YACE,SAAA,MAAA;AAIJ,uBAAA,cAAA,cAAA,eAAA;GACA,aAAA,MAAA;GAUF,OAAA,MAAA;GACQ,OAAU,MAAC"}
|
package/react/lib/JBTextarea.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-inner-declarations */
|
|
2
|
-
import React, { useRef, useImperativeHandle, CSSProperties } from 'react';
|
|
2
|
+
import React, { useRef, useImperativeHandle, CSSProperties, type PropsWithChildren } from 'react';
|
|
3
3
|
import 'jb-textarea';
|
|
4
4
|
// eslint-disable-next-line no-duplicate-imports
|
|
5
5
|
import {JBTextareaWebComponent} from 'jb-textarea';
|
|
@@ -34,17 +34,20 @@ const JBTextarea = React.forwardRef((props:Props, ref) => {
|
|
|
34
34
|
useJBTextareaAttribute(element, props);
|
|
35
35
|
useEvents(element,props);
|
|
36
36
|
return (
|
|
37
|
-
<jb-textarea placeholder={props.placeholder} class={props.className} style={props.style} ref={element} label={props.label} message={props.message}
|
|
37
|
+
<jb-textarea placeholder={props.placeholder} class={props.className} style={props.style} ref={element} label={props.label} message={props.message}>
|
|
38
|
+
{props.children}
|
|
39
|
+
</jb-textarea>
|
|
38
40
|
);
|
|
39
41
|
}
|
|
40
42
|
});
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
type JBTextareaProps = EventProps & JBTextareaAttributes & {
|
|
43
45
|
label?: string,
|
|
44
46
|
placeholder?:string,
|
|
45
47
|
className?: string,
|
|
46
48
|
message?:string,
|
|
47
49
|
style?:CSSProperties,
|
|
48
|
-
name?:string,
|
|
49
50
|
}
|
|
51
|
+
export type Props = PropsWithChildren<JBTextareaProps> & React.HTMLAttributes<JBTextareaWebComponent>;
|
|
52
|
+
// export type Props = PropsWithChildren<JBTextareaProps> & React.HTMLAttributes<JBTextareaWebComponent>;
|
|
50
53
|
export {JBTextarea};
|
|
@@ -8,6 +8,8 @@ export type JBTextareaAttributes = {
|
|
|
8
8
|
autoHeight?: boolean,
|
|
9
9
|
required?:boolean
|
|
10
10
|
error?: string,
|
|
11
|
+
name?:string,
|
|
12
|
+
|
|
11
13
|
}
|
|
12
14
|
export function useJBTextareaAttribute(element: RefObject<JBTextareaWebComponent>, props: JBTextareaAttributes) {
|
|
13
15
|
|
|
@@ -42,4 +44,13 @@ export function useJBTextareaAttribute(element: RefObject<JBTextareaWebComponent
|
|
|
42
44
|
element?.current?.removeAttribute('error');
|
|
43
45
|
}
|
|
44
46
|
}, [props.error]);
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (props.name) {
|
|
50
|
+
element?.current?.setAttribute('name', props.name || '');
|
|
51
|
+
} else {
|
|
52
|
+
element?.current?.removeAttribute('name');
|
|
53
|
+
}
|
|
54
|
+
}, [props.name]);
|
|
55
|
+
|
|
45
56
|
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { ShowValidationErrorInput, ValidationHelper, type WithValidation } from 'jb-validation';
|
|
2
|
-
import type { JBFormInputStandards } from 'jb-form';
|
|
3
|
-
export * from './types.js';
|
|
4
|
-
export declare class JBTextareaWebComponent extends HTMLElement implements WithValidation, JBFormInputStandards<string> {
|
|
5
|
-
#private;
|
|
6
|
-
static get formAssociated(): boolean;
|
|
7
|
-
get value(): string;
|
|
8
|
-
set value(value: string);
|
|
9
|
-
get isAutoValidationDisabled(): boolean;
|
|
10
|
-
set isAutoValidationDisabled(value: boolean);
|
|
11
|
-
get disabled(): boolean;
|
|
12
|
-
set disabled(value: boolean);
|
|
13
|
-
set required(value: boolean);
|
|
14
|
-
get required(): boolean;
|
|
15
|
-
get name(): string;
|
|
16
|
-
initialValue: string;
|
|
17
|
-
get isDirty(): boolean;
|
|
18
|
-
constructor();
|
|
19
|
-
autoHeight: boolean;
|
|
20
|
-
get validation(): ValidationHelper<string>;
|
|
21
|
-
static get observedAttributes(): string[];
|
|
22
|
-
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
23
|
-
showValidationError(error: ShowValidationErrorInput | string): void;
|
|
24
|
-
clearValidationError(): void;
|
|
25
|
-
get validationMessage(): string;
|
|
26
|
-
/**
|
|
27
|
-
* @public
|
|
28
|
-
* @description this method used to check for validity but doesn't show error to user and just return the result
|
|
29
|
-
* this method used by #internal of component
|
|
30
|
-
*/
|
|
31
|
-
checkValidity(): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* @public
|
|
34
|
-
* @description this method used to check for validity and show error to user
|
|
35
|
-
*/
|
|
36
|
-
reportValidity(): boolean;
|
|
37
|
-
}
|
package/dist/lib/types.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { EventTypeWithTarget } from "jb-core";
|
|
2
|
-
import type { JBTextareaWebComponent } from "./jb-textarea";
|
|
3
|
-
export type JBTextareaElements = {
|
|
4
|
-
textarea: HTMLTextAreaElement;
|
|
5
|
-
label: HTMLLabelElement;
|
|
6
|
-
labelValue: HTMLSpanElement;
|
|
7
|
-
messageBox: HTMLDivElement;
|
|
8
|
-
};
|
|
9
|
-
export type ValidationValue = string;
|
|
10
|
-
export type JBTextareaEventType<TEvent> = EventTypeWithTarget<TEvent, JBTextareaWebComponent>;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { ShowValidationErrorInput, ValidationHelper, type WithValidation } from 'jb-validation';
|
|
2
|
-
import type { JBFormInputStandards } from 'jb-form';
|
|
3
|
-
export * from './types.js';
|
|
4
|
-
export declare class JBTextareaWebComponent extends HTMLElement implements WithValidation, JBFormInputStandards<string> {
|
|
5
|
-
#private;
|
|
6
|
-
static get formAssociated(): boolean;
|
|
7
|
-
get value(): string;
|
|
8
|
-
set value(value: string);
|
|
9
|
-
get isAutoValidationDisabled(): boolean;
|
|
10
|
-
set isAutoValidationDisabled(value: boolean);
|
|
11
|
-
get disabled(): boolean;
|
|
12
|
-
set disabled(value: boolean);
|
|
13
|
-
set required(value: boolean);
|
|
14
|
-
get required(): boolean;
|
|
15
|
-
get name(): string;
|
|
16
|
-
initialValue: string;
|
|
17
|
-
get isDirty(): boolean;
|
|
18
|
-
constructor();
|
|
19
|
-
autoHeight: boolean;
|
|
20
|
-
get validation(): ValidationHelper<string>;
|
|
21
|
-
static get observedAttributes(): string[];
|
|
22
|
-
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
23
|
-
showValidationError(error: ShowValidationErrorInput | string): void;
|
|
24
|
-
clearValidationError(): void;
|
|
25
|
-
get validationMessage(): string;
|
|
26
|
-
/**
|
|
27
|
-
* @public
|
|
28
|
-
* @description this method used to check for validity but doesn't show error to user and just return the result
|
|
29
|
-
* this method used by #internal of component
|
|
30
|
-
*/
|
|
31
|
-
checkValidity(): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* @public
|
|
34
|
-
* @description this method used to check for validity and show error to user
|
|
35
|
-
*/
|
|
36
|
-
reportValidity(): boolean;
|
|
37
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { EventTypeWithTarget } from "jb-core";
|
|
2
|
-
import type { JBTextareaWebComponent } from "./jb-textarea";
|
|
3
|
-
export type JBTextareaElements = {
|
|
4
|
-
textarea: HTMLTextAreaElement;
|
|
5
|
-
label: HTMLLabelElement;
|
|
6
|
-
labelValue: HTMLSpanElement;
|
|
7
|
-
messageBox: HTMLDivElement;
|
|
8
|
-
};
|
|
9
|
-
export type ValidationValue = string;
|
|
10
|
-
export type JBTextareaEventType<TEvent> = EventTypeWithTarget<TEvent, JBTextareaWebComponent>;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export declare function useEvent(dom: HTMLElement, event: any, handler: any, passive?: boolean): void;
|
|
3
|
-
export declare function useBindEvent<TRef extends React.MutableRefObject<any | null>, TEvent>(ref: TRef, event: string, handler: (e: TEvent) => void, passive?: boolean): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const isMobile: () => boolean;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React, { CSSProperties } from 'react';
|
|
2
|
-
import 'jb-textarea';
|
|
3
|
-
import { JBTextareaWebComponent, type ValidationValue } from 'jb-textarea';
|
|
4
|
-
import { type ValidationItem } from "jb-validation";
|
|
5
|
-
import { EventProps } from './events-hook.js';
|
|
6
|
-
declare global {
|
|
7
|
-
namespace JSX {
|
|
8
|
-
interface IntrinsicElements {
|
|
9
|
-
'jb-textarea': JBTextareaType;
|
|
10
|
-
}
|
|
11
|
-
interface JBTextareaType extends React.DetailedHTMLProps<React.HTMLAttributes<JBTextareaWebComponent>, JBTextareaWebComponent> {
|
|
12
|
-
class?: string;
|
|
13
|
-
label?: string;
|
|
14
|
-
name?: string;
|
|
15
|
-
message?: string;
|
|
16
|
-
placeholder?: string;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
declare const JBTextarea: React.ForwardRefExoticComponent<EventProps & {
|
|
21
|
-
label?: string;
|
|
22
|
-
value?: string | null | undefined;
|
|
23
|
-
placeholder?: string;
|
|
24
|
-
className?: string;
|
|
25
|
-
style?: CSSProperties;
|
|
26
|
-
validationList?: ValidationItem<ValidationValue>[];
|
|
27
|
-
autoHeight?: boolean;
|
|
28
|
-
message?: string;
|
|
29
|
-
name?: string;
|
|
30
|
-
required?: boolean;
|
|
31
|
-
} & React.RefAttributes<unknown>>;
|
|
32
|
-
export type Props = EventProps & {
|
|
33
|
-
label?: string;
|
|
34
|
-
value?: string | null | undefined;
|
|
35
|
-
placeholder?: string;
|
|
36
|
-
className?: string;
|
|
37
|
-
style?: CSSProperties;
|
|
38
|
-
validationList?: ValidationItem<ValidationValue>[];
|
|
39
|
-
autoHeight?: boolean;
|
|
40
|
-
message?: string;
|
|
41
|
-
name?: string;
|
|
42
|
-
required?: boolean;
|
|
43
|
-
};
|
|
44
|
-
export { JBTextarea };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { RefObject } from "react";
|
|
2
|
-
import type { JBTextareaWebComponent, JBTextareaEventType } from 'jb-textarea';
|
|
3
|
-
export type EventProps = {
|
|
4
|
-
/**
|
|
5
|
-
* when component loaded, in most cases component is already loaded before react mount so you dont need this but if you load web-component dynamically with lazy load it will be called after react mount
|
|
6
|
-
*/
|
|
7
|
-
onLoad?: (e: JBTextareaEventType<CustomEvent>) => void;
|
|
8
|
-
/**
|
|
9
|
-
* when all property set and ready to use, in most cases component is already loaded before react mount so you dont need this but if you load web-component dynamically with lazy load it will be called after react mount
|
|
10
|
-
*/
|
|
11
|
-
onInit?: (e: JBTextareaEventType<CustomEvent>) => void;
|
|
12
|
-
onChange?: (e: JBTextareaEventType<Event>) => void;
|
|
13
|
-
onFocus?: (e: JBTextareaEventType<FocusEvent>) => void;
|
|
14
|
-
onBlur?: (e: JBTextareaEventType<FocusEvent>) => void;
|
|
15
|
-
onKeyDown?: (e: JBTextareaEventType<KeyboardEvent>) => void;
|
|
16
|
-
onKeyUp?: (e: JBTextareaEventType<KeyboardEvent>) => void;
|
|
17
|
-
onInput?: (e: JBTextareaEventType<InputEvent>) => void;
|
|
18
|
-
onBeforeinput?: (e: JBTextareaEventType<InputEvent>) => void;
|
|
19
|
-
};
|
|
20
|
-
export declare function useEvents(element: RefObject<JBTextareaWebComponent>, props: EventProps): void;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React, { CSSProperties } from 'react';
|
|
2
|
-
import 'jb-textarea';
|
|
3
|
-
import { JBTextareaWebComponent, type ValidationValue } from 'jb-textarea';
|
|
4
|
-
import { type ValidationItem } from "jb-validation";
|
|
5
|
-
import { EventProps } from './events-hook.js';
|
|
6
|
-
declare global {
|
|
7
|
-
namespace JSX {
|
|
8
|
-
interface IntrinsicElements {
|
|
9
|
-
'jb-textarea': JBTextareaType;
|
|
10
|
-
}
|
|
11
|
-
interface JBTextareaType extends React.DetailedHTMLProps<React.HTMLAttributes<JBTextareaWebComponent>, JBTextareaWebComponent> {
|
|
12
|
-
class?: string;
|
|
13
|
-
label?: string;
|
|
14
|
-
name?: string;
|
|
15
|
-
message?: string;
|
|
16
|
-
placeholder?: string;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
declare const JBTextarea: React.ForwardRefExoticComponent<EventProps & {
|
|
21
|
-
label?: string;
|
|
22
|
-
value?: string | null | undefined;
|
|
23
|
-
placeholder?: string;
|
|
24
|
-
className?: string;
|
|
25
|
-
style?: CSSProperties;
|
|
26
|
-
validationList?: ValidationItem<ValidationValue>[];
|
|
27
|
-
autoHeight?: boolean;
|
|
28
|
-
message?: string;
|
|
29
|
-
name?: string;
|
|
30
|
-
required?: boolean;
|
|
31
|
-
} & React.RefAttributes<unknown>>;
|
|
32
|
-
export type Props = EventProps & {
|
|
33
|
-
label?: string;
|
|
34
|
-
value?: string | null | undefined;
|
|
35
|
-
placeholder?: string;
|
|
36
|
-
className?: string;
|
|
37
|
-
style?: CSSProperties;
|
|
38
|
-
validationList?: ValidationItem<ValidationValue>[];
|
|
39
|
-
autoHeight?: boolean;
|
|
40
|
-
message?: string;
|
|
41
|
-
name?: string;
|
|
42
|
-
required?: boolean;
|
|
43
|
-
};
|
|
44
|
-
export { JBTextarea };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { RefObject } from "react";
|
|
2
|
-
import type { JBTextareaWebComponent, JBTextareaEventType } from 'jb-textarea';
|
|
3
|
-
export type EventProps = {
|
|
4
|
-
/**
|
|
5
|
-
* when component loaded, in most cases component is already loaded before react mount so you dont need this but if you load web-component dynamically with lazy load it will be called after react mount
|
|
6
|
-
*/
|
|
7
|
-
onLoad?: (e: JBTextareaEventType<CustomEvent>) => void;
|
|
8
|
-
/**
|
|
9
|
-
* when all property set and ready to use, in most cases component is already loaded before react mount so you dont need this but if you load web-component dynamically with lazy load it will be called after react mount
|
|
10
|
-
*/
|
|
11
|
-
onInit?: (e: JBTextareaEventType<CustomEvent>) => void;
|
|
12
|
-
onChange?: (e: JBTextareaEventType<Event>) => void;
|
|
13
|
-
onFocus?: (e: JBTextareaEventType<FocusEvent>) => void;
|
|
14
|
-
onBlur?: (e: JBTextareaEventType<FocusEvent>) => void;
|
|
15
|
-
onKeyDown?: (e: JBTextareaEventType<KeyboardEvent>) => void;
|
|
16
|
-
onKeyUp?: (e: JBTextareaEventType<KeyboardEvent>) => void;
|
|
17
|
-
onInput?: (e: JBTextareaEventType<InputEvent>) => void;
|
|
18
|
-
onBeforeinput?: (e: JBTextareaEventType<InputEvent>) => void;
|
|
19
|
-
};
|
|
20
|
-
export declare function useEvents(element: RefObject<JBTextareaWebComponent>, props: EventProps): void;
|