jb-textarea 3.7.0 → 3.7.1

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 CHANGED
@@ -33,7 +33,7 @@ npm i jb-textarea
33
33
 
34
34
  ```js
35
35
  document.querySelector("jb-textarea").value;
36
- // retun inputed text
36
+ // return inputted text
37
37
  document.querySelector("jb-textarea").value = "salam";
38
38
  set value to salam
39
39
  ```
@@ -73,6 +73,7 @@ const result = document.getElementByTagName('jb-textarea').validation.addValidat
73
73
  ### check validation
74
74
 
75
75
  like any other jb design system you can access validation by `validation` property:
76
+
76
77
  ```js
77
78
  //access validation module
78
79
  document.getElementByTagName('jb-textarea').validation
@@ -105,6 +106,7 @@ the good point of set boundary with css variable is you can set different min or
105
106
 
106
107
  in some cases in your project you need to change default style of web-component for example you need zero margin or different border-radius and etc.
107
108
  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
109
+
108
110
  | css variable name | description |
109
111
  | ------------- | ------------- |
110
112
  | --jb-textarea-margin | web-component margin default is `0 12px` |
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "web component",
15
15
  "web-component"
16
16
  ],
17
- "version": "3.7.0",
17
+ "version": "3.7.1",
18
18
  "bugs": "https://github.com/javadbat/jb-textarea/issues",
19
19
  "license": "MIT",
20
20
  "files": [
@@ -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,l)=>{if(n&&"object"==typeof n||"function"==typeof n)for(var c,s=u(n),i=0,f=s.length;i<f;i++)c=s[i],a.call(e,c)||c===o||t(e,c,{get:(e=>n[e]).bind(null,c),enumerable:!(l=r(n,c))||l.enumerable});return e},l=(r,u,a)=>(a=null!=r?e(n(r)):{},o(!u&&r&&r.__esModule?a:t(a,"default",{value:r,enumerable:!0}),r));const c=l(require("react"));require("jb-textarea");const s=l(require("jb-core/react")),i=c.default.forwardRef((e,t)=>{{let r=(0,c.useRef)(null);return(0,c.useImperativeHandle)(t,()=>r?r.current:void 0,[r]),(0,c.useEffect)(()=>{let t=e.value||"";r.current&&(r.current.value=t)},[e.value]),(0,c.useEffect)(()=>{r.current&&(r.current.validation.list=e.validationList||[])},[e.validationList]),(0,c.useEffect)(()=>{r.current&&void 0!==e.required&&(e.required?r.current.setAttribute("required",""):r.current.removeAttribute("required"))},[e.required]),(0,c.useEffect)(()=>{r.current&&(r.current.autoHeight=e.autoHeight||!1)},[e.autoHeight]),(0,c.useEffect)(()=>{e.error?r?.current?.setAttribute("error",e.error):r?.current?.removeAttribute("error")},[e.error]),(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),c.default.createElement("jb-textarea",{placeholder:e.placeholder,class:e.className,style:e.style,ref:r,label:e.label,message:e.message,name:e.name})}});exports.JBTextarea=i;
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})}});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":["import { useEvent } from \"jb-core/react\";\r\nimport { RefObject } from \"react\";\r\nimport type { JBTextareaWebComponent, JBTextareaEventType } from 'jb-textarea';\r\n\r\nexport type EventProps = {\r\n /**\r\n * 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\r\n */\r\n onLoad?: (e: JBTextareaEventType<CustomEvent>) => void,\r\n /**\r\n * 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\r\n */\r\n onInit?: (e: JBTextareaEventType<CustomEvent>) => void,\r\n onChange?: (e: JBTextareaEventType<Event>) => void,\r\n onFocus?: (e: JBTextareaEventType<FocusEvent>) => void,\r\n onBlur?: (e: JBTextareaEventType<FocusEvent>) => void,\r\n onKeyDown?: (e: JBTextareaEventType<KeyboardEvent>) => void,\r\n onKeyUp?: (e: JBTextareaEventType<KeyboardEvent>) => void,\r\n onInput?: (e: JBTextareaEventType<InputEvent>) => void,\r\n onBeforeinput?: (e: JBTextareaEventType<InputEvent>) => void,\r\n\r\n}\r\nexport function useEvents(element: RefObject<JBTextareaWebComponent>, props: EventProps) {\r\n useEvent(element, 'load', props.onLoad, true);\r\n useEvent(element, 'init', props.onInit, true);\r\n useEvent(element, 'change', props.onChange);\r\n useEvent(element, 'keydown', props.onKeyDown);\r\n useEvent(element, 'input', props.onInput);\r\n useEvent(element, 'keyup', props.onKeyUp);\r\n useEvent(element, 'focus', props.onFocus);\r\n useEvent(element, 'blur', props.onBlur);\r\n}","import { JBTextareaWebComponent, type ValidationValue } from \"jb-textarea\";\r\nimport { type ValidationItem } from \"jb-validation\";\r\nimport { RefObject, useEffect } from \"react\";\r\n\r\nexport type JBTextareaAttributes = {\r\n value?: string | null | undefined,\r\n validationList?:ValidationItem<ValidationValue>[],\r\n autoHeight?: boolean,\r\n required?:boolean\r\n error?: string,\r\n}\r\nexport function useJBTextareaAttribute(element: RefObject<JBTextareaWebComponent>, props: JBTextareaAttributes) {\r\n\r\n useEffect(() => {\r\n const value:string = props.value || '';\r\n if(element.current){\r\n element.current.value = value;\r\n }\r\n }, [props.value]);\r\n\r\n useEffect(() => {\r\n if(element.current){\r\n element.current.validation.list = props.validationList || [];\r\n }\r\n }, [props.validationList]);\r\n useEffect(() => {\r\n if(element.current && props.required!== undefined){\r\n props.required?element.current.setAttribute(\"required\",''):element.current.removeAttribute(\"required\");\r\n }\r\n }, [props.required]);\r\n\r\n useEffect(() => {\r\n if(element.current){\r\n element.current.autoHeight = props.autoHeight || false;\r\n }\r\n }, [props.autoHeight]);\r\n \r\n useEffect(() => {\r\n if (props.error) {\r\n element?.current?.setAttribute('error', props.error);\r\n } else {\r\n element?.current?.removeAttribute('error');\r\n }\r\n }, [props.error]);\r\n}","/* eslint-disable no-inner-declarations */\r\nimport React, { useRef, useImperativeHandle, CSSProperties } from 'react';\r\nimport 'jb-textarea';\r\n// eslint-disable-next-line no-duplicate-imports\r\nimport {JBTextareaWebComponent} from 'jb-textarea';\r\nimport { EventProps, useEvents } from './events-hook.js';\r\nimport { JBTextareaAttributes, useJBTextareaAttribute } from './attributes-hook.js';\r\ndeclare global {\r\n // eslint-disable-next-line @typescript-eslint/no-namespace\r\n namespace JSX {\r\n interface IntrinsicElements {\r\n 'jb-textarea': JBTextareaType;\r\n }\r\n interface JBTextareaType extends React.DetailedHTMLProps<React.HTMLAttributes<JBTextareaWebComponent>, JBTextareaWebComponent> {\r\n class?:string,\r\n label?: string,\r\n name?:string,\r\n message?:string,\r\n placeholder?:string,\r\n // ref:React.RefObject<JBDateInputWebComponent>,\r\n }\r\n }\r\n}\r\n// eslint-disable-next-line react/display-name\r\nconst JBTextarea = React.forwardRef((props:Props, ref) => {\r\n {\r\n //we set this state so when ref change we have a render and our event listener will be updated\r\n const element = useRef<JBTextareaWebComponent>(null);\r\n useImperativeHandle(\r\n ref,\r\n () => (element ? element.current : undefined),\r\n [element],\r\n );\r\n useJBTextareaAttribute(element, props);\r\n useEvents(element,props);\r\n return (\r\n <jb-textarea placeholder={props.placeholder} class={props.className} style={props.style} ref={element} label={props.label} message={props.message} name={props.name}></jb-textarea>\r\n );\r\n }\r\n});\r\n\r\nexport type Props = EventProps & JBTextareaAttributes & {\r\n label?: string,\r\n placeholder?:string,\r\n className?: string,\r\n message?:string,\r\n style?:CSSProperties,\r\n name?:string,\r\n}\r\nexport {JBTextarea};"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACO,SAAS,UAAU,SAAQ,OAAA;AAC9B,6BAAS,SAAS,QAAQ,MAAM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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;AAEJ,uBAAA,cAAA,cAAA,eAAA;GACA,aAAA,MAAA;GASM,OAAU,MAAC"}
@@ -23,7 +23,6 @@ declare const JBTextarea: React.ForwardRefExoticComponent<EventProps & JBTextare
23
23
  className?: string;
24
24
  message?: string;
25
25
  style?: CSSProperties;
26
- name?: string;
27
26
  } & React.RefAttributes<unknown>>;
28
27
  export type Props = EventProps & JBTextareaAttributes & {
29
28
  label?: string;
@@ -31,6 +30,5 @@ export type Props = EventProps & JBTextareaAttributes & {
31
30
  className?: string;
32
31
  message?: string;
33
32
  style?: CSSProperties;
34
- name?: string;
35
33
  };
36
34
  export { JBTextarea };
@@ -1,2 +1,2 @@
1
- import e,{useEffect as r,useImperativeHandle as t,useRef as o}from"react";import"jb-textarea";import{useEvent as a}from"jb-core/react";let n=e.forwardRef((n,u)=>{{var i;let l=o(null);return t(u,()=>l?l.current:void 0,[l]),r(()=>{let e=i.value||"";l.current&&(l.current.value=e)},[(i=n).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]),a(l,"load",n.onLoad,!0),a(l,"init",n.onInit,!0),a(l,"change",n.onChange),a(l,"keydown",n.onKeyDown),a(l,"input",n.onInput),a(l,"keyup",n.onKeyUp),a(l,"focus",n.onFocus),a(l,"blur",n.onBlur),e.createElement("jb-textarea",{placeholder:n.placeholder,class:n.className,style:n.style,ref:l,label:n.label,message:n.message,name:n.name})}});export{n as JBTextarea};
1
+ import e,{useEffect as r,useImperativeHandle as t,useRef as a}from"react";import"jb-textarea";import{useEvent as n}from"jb-core/react";let o=e.forwardRef((o,u)=>{{var i;let l=a(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]),n(l,"load",o.onLoad,!0),n(l,"init",o.onInit,!0),n(l,"change",o.onChange),n(l,"keydown",o.onKeyDown),n(l,"input",o.onInput),n(l,"keyup",o.onKeyUp),n(l,"focus",o.onFocus),n(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})}});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":["import { useEvent } from \"jb-core/react\";\r\nimport { RefObject } from \"react\";\r\nimport type { JBTextareaWebComponent, JBTextareaEventType } from 'jb-textarea';\r\n\r\nexport type EventProps = {\r\n /**\r\n * 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\r\n */\r\n onLoad?: (e: JBTextareaEventType<CustomEvent>) => void,\r\n /**\r\n * 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\r\n */\r\n onInit?: (e: JBTextareaEventType<CustomEvent>) => void,\r\n onChange?: (e: JBTextareaEventType<Event>) => void,\r\n onFocus?: (e: JBTextareaEventType<FocusEvent>) => void,\r\n onBlur?: (e: JBTextareaEventType<FocusEvent>) => void,\r\n onKeyDown?: (e: JBTextareaEventType<KeyboardEvent>) => void,\r\n onKeyUp?: (e: JBTextareaEventType<KeyboardEvent>) => void,\r\n onInput?: (e: JBTextareaEventType<InputEvent>) => void,\r\n onBeforeinput?: (e: JBTextareaEventType<InputEvent>) => void,\r\n\r\n}\r\nexport function useEvents(element: RefObject<JBTextareaWebComponent>, props: EventProps) {\r\n useEvent(element, 'load', props.onLoad, true);\r\n useEvent(element, 'init', props.onInit, true);\r\n useEvent(element, 'change', props.onChange);\r\n useEvent(element, 'keydown', props.onKeyDown);\r\n useEvent(element, 'input', props.onInput);\r\n useEvent(element, 'keyup', props.onKeyUp);\r\n useEvent(element, 'focus', props.onFocus);\r\n useEvent(element, 'blur', props.onBlur);\r\n}","import { JBTextareaWebComponent, type ValidationValue } from \"jb-textarea\";\r\nimport { type ValidationItem } from \"jb-validation\";\r\nimport { RefObject, useEffect } from \"react\";\r\n\r\nexport type JBTextareaAttributes = {\r\n value?: string | null | undefined,\r\n validationList?:ValidationItem<ValidationValue>[],\r\n autoHeight?: boolean,\r\n required?:boolean\r\n error?: string,\r\n}\r\nexport function useJBTextareaAttribute(element: RefObject<JBTextareaWebComponent>, props: JBTextareaAttributes) {\r\n\r\n useEffect(() => {\r\n const value:string = props.value || '';\r\n if(element.current){\r\n element.current.value = value;\r\n }\r\n }, [props.value]);\r\n\r\n useEffect(() => {\r\n if(element.current){\r\n element.current.validation.list = props.validationList || [];\r\n }\r\n }, [props.validationList]);\r\n useEffect(() => {\r\n if(element.current && props.required!== undefined){\r\n props.required?element.current.setAttribute(\"required\",''):element.current.removeAttribute(\"required\");\r\n }\r\n }, [props.required]);\r\n\r\n useEffect(() => {\r\n if(element.current){\r\n element.current.autoHeight = props.autoHeight || false;\r\n }\r\n }, [props.autoHeight]);\r\n \r\n useEffect(() => {\r\n if (props.error) {\r\n element?.current?.setAttribute('error', props.error);\r\n } else {\r\n element?.current?.removeAttribute('error');\r\n }\r\n }, [props.error]);\r\n}","/* eslint-disable no-inner-declarations */\r\nimport React, { useRef, useImperativeHandle, CSSProperties } from 'react';\r\nimport 'jb-textarea';\r\n// eslint-disable-next-line no-duplicate-imports\r\nimport {JBTextareaWebComponent} from 'jb-textarea';\r\nimport { EventProps, useEvents } from './events-hook.js';\r\nimport { JBTextareaAttributes, useJBTextareaAttribute } from './attributes-hook.js';\r\ndeclare global {\r\n // eslint-disable-next-line @typescript-eslint/no-namespace\r\n namespace JSX {\r\n interface IntrinsicElements {\r\n 'jb-textarea': JBTextareaType;\r\n }\r\n interface JBTextareaType extends React.DetailedHTMLProps<React.HTMLAttributes<JBTextareaWebComponent>, JBTextareaWebComponent> {\r\n class?:string,\r\n label?: string,\r\n name?:string,\r\n message?:string,\r\n placeholder?:string,\r\n // ref:React.RefObject<JBDateInputWebComponent>,\r\n }\r\n }\r\n}\r\n// eslint-disable-next-line react/display-name\r\nconst JBTextarea = React.forwardRef((props:Props, ref) => {\r\n {\r\n //we set this state so when ref change we have a render and our event listener will be updated\r\n const element = useRef<JBTextareaWebComponent>(null);\r\n useImperativeHandle(\r\n ref,\r\n () => (element ? element.current : undefined),\r\n [element],\r\n );\r\n useJBTextareaAttribute(element, props);\r\n useEvents(element,props);\r\n return (\r\n <jb-textarea placeholder={props.placeholder} class={props.className} style={props.style} ref={element} label={props.label} message={props.message} name={props.name}></jb-textarea>\r\n );\r\n }\r\n});\r\n\r\nexport type Props = EventProps & JBTextareaAttributes & {\r\n label?: string,\r\n placeholder?:string,\r\n className?: string,\r\n message?:string,\r\n style?:CSSProperties,\r\n name?:string,\r\n}\r\nexport {JBTextarea};"],"mappings":";;;;;AACO,SAAS,UAAU,SAAQ,OAAA;AAC9B,UAAS,SA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;;;;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;AAEJ,uBAAA,MAAA,cAAA,eAAA;GACA,aAAA,MAAA;GASM,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,l=Object.getOwnPropertyNames,c=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,s=(e,t,r,u)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var n,c=l(t),s=0,f=c.length;s<f;s++)n=c[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(c(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,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,name:e.name})}});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);
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.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":["import { useEvent } from \"jb-core/react\";\r\nimport { RefObject } from \"react\";\r\nimport type { JBTextareaWebComponent, JBTextareaEventType } from 'jb-textarea';\r\n\r\nexport type EventProps = {\r\n /**\r\n * 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\r\n */\r\n onLoad?: (e: JBTextareaEventType<CustomEvent>) => void,\r\n /**\r\n * 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\r\n */\r\n onInit?: (e: JBTextareaEventType<CustomEvent>) => void,\r\n onChange?: (e: JBTextareaEventType<Event>) => void,\r\n onFocus?: (e: JBTextareaEventType<FocusEvent>) => void,\r\n onBlur?: (e: JBTextareaEventType<FocusEvent>) => void,\r\n onKeyDown?: (e: JBTextareaEventType<KeyboardEvent>) => void,\r\n onKeyUp?: (e: JBTextareaEventType<KeyboardEvent>) => void,\r\n onInput?: (e: JBTextareaEventType<InputEvent>) => void,\r\n onBeforeinput?: (e: JBTextareaEventType<InputEvent>) => void,\r\n\r\n}\r\nexport function useEvents(element: RefObject<JBTextareaWebComponent>, props: EventProps) {\r\n useEvent(element, 'load', props.onLoad, true);\r\n useEvent(element, 'init', props.onInit, true);\r\n useEvent(element, 'change', props.onChange);\r\n useEvent(element, 'keydown', props.onKeyDown);\r\n useEvent(element, 'input', props.onInput);\r\n useEvent(element, 'keyup', props.onKeyUp);\r\n useEvent(element, 'focus', props.onFocus);\r\n useEvent(element, 'blur', props.onBlur);\r\n}","import { JBTextareaWebComponent, type ValidationValue } from \"jb-textarea\";\r\nimport { type ValidationItem } from \"jb-validation\";\r\nimport { RefObject, useEffect } from \"react\";\r\n\r\nexport type JBTextareaAttributes = {\r\n value?: string | null | undefined,\r\n validationList?:ValidationItem<ValidationValue>[],\r\n autoHeight?: boolean,\r\n required?:boolean\r\n error?: string,\r\n}\r\nexport function useJBTextareaAttribute(element: RefObject<JBTextareaWebComponent>, props: JBTextareaAttributes) {\r\n\r\n useEffect(() => {\r\n const value:string = props.value || '';\r\n if(element.current){\r\n element.current.value = value;\r\n }\r\n }, [props.value]);\r\n\r\n useEffect(() => {\r\n if(element.current){\r\n element.current.validation.list = props.validationList || [];\r\n }\r\n }, [props.validationList]);\r\n useEffect(() => {\r\n if(element.current && props.required!== undefined){\r\n props.required?element.current.setAttribute(\"required\",''):element.current.removeAttribute(\"required\");\r\n }\r\n }, [props.required]);\r\n\r\n useEffect(() => {\r\n if(element.current){\r\n element.current.autoHeight = props.autoHeight || false;\r\n }\r\n }, [props.autoHeight]);\r\n \r\n useEffect(() => {\r\n if (props.error) {\r\n element?.current?.setAttribute('error', props.error);\r\n } else {\r\n element?.current?.removeAttribute('error');\r\n }\r\n }, [props.error]);\r\n}","/* eslint-disable no-inner-declarations */\r\nimport React, { useRef, useImperativeHandle, CSSProperties } from 'react';\r\nimport 'jb-textarea';\r\n// eslint-disable-next-line no-duplicate-imports\r\nimport {JBTextareaWebComponent} from 'jb-textarea';\r\nimport { EventProps, useEvents } from './events-hook.js';\r\nimport { JBTextareaAttributes, useJBTextareaAttribute } from './attributes-hook.js';\r\ndeclare global {\r\n // eslint-disable-next-line @typescript-eslint/no-namespace\r\n namespace JSX {\r\n interface IntrinsicElements {\r\n 'jb-textarea': JBTextareaType;\r\n }\r\n interface JBTextareaType extends React.DetailedHTMLProps<React.HTMLAttributes<JBTextareaWebComponent>, JBTextareaWebComponent> {\r\n class?:string,\r\n label?: string,\r\n name?:string,\r\n message?:string,\r\n placeholder?:string,\r\n // ref:React.RefObject<JBDateInputWebComponent>,\r\n }\r\n }\r\n}\r\n// eslint-disable-next-line react/display-name\r\nconst JBTextarea = React.forwardRef((props:Props, ref) => {\r\n {\r\n //we set this state so when ref change we have a render and our event listener will be updated\r\n const element = useRef<JBTextareaWebComponent>(null);\r\n useImperativeHandle(\r\n ref,\r\n () => (element ? element.current : undefined),\r\n [element],\r\n );\r\n useJBTextareaAttribute(element, props);\r\n useEvents(element,props);\r\n return (\r\n <jb-textarea placeholder={props.placeholder} class={props.className} style={props.style} ref={element} label={props.label} message={props.message} name={props.name}></jb-textarea>\r\n );\r\n }\r\n});\r\n\r\nexport type Props = EventProps & JBTextareaAttributes & {\r\n label?: string,\r\n placeholder?:string,\r\n className?: string,\r\n message?:string,\r\n style?:CSSProperties,\r\n name?:string,\r\n}\r\nexport {JBTextarea};"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACO,SAAS,UAAU,SAAQ,OAAA;AAC9B,6BAAS,SAAS,QAAQ,MAAM,QAAQ,KAAK;AACjD,6BAAA,SAAA,QAAA,MAAA,QAAA,KAAA;AACI,6BAAS,SAAS,UAAI,MAAA,SAAA;AACtB,6BAAC,SAAA,WAAA,MAAA,UAAA;AACD,6BAAS,SAAS,SAAS,MAAM,QAAQ;AACzC,6BAAC,SAAA,SAAA,M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ACpD,OAKA,EAAA;AACA,yBAAkB,SAAM,MAAA;AACxB,YACE,SAAA,MAAA;AAEJ,uBAAA,cAAA,cAAA,eAAA;GACA,aAAA,MAAA;GASM,OAAU,MAAC"}
@@ -7,5 +7,6 @@ export type JBTextareaAttributes = {
7
7
  autoHeight?: boolean;
8
8
  required?: boolean;
9
9
  error?: string;
10
+ name?: string;
10
11
  };
11
12
  export declare function useJBTextareaAttribute(element: RefObject<JBTextareaWebComponent>, props: JBTextareaAttributes): void;
@@ -34,7 +34,7 @@ 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} name={props.name}></jb-textarea>
37
+ <jb-textarea placeholder={props.placeholder} class={props.className} style={props.style} ref={element} label={props.label} message={props.message}></jb-textarea>
38
38
  );
39
39
  }
40
40
  });
@@ -45,6 +45,5 @@ export type Props = EventProps & JBTextareaAttributes & {
45
45
  className?: string,
46
46
  message?:string,
47
47
  style?:CSSProperties,
48
- name?:string,
49
48
  }
50
49
  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
- }
@@ -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,4 +0,0 @@
1
- import { MutableRefObject } from "react";
2
- type InitFunc<T> = () => T;
3
- export declare const useLazyRef: <T>(initValFunc: InitFunc<T>) => MutableRefObject<any>;
4
- export {};
@@ -1,4 +0,0 @@
1
- type Initializers = any[];
2
- type Constructor<T extends object = object> = new (...args: any[]) => T;
3
- export declare const useMobx: <T extends object>(Store: Constructor<T>, initializers: Initializers) => T;
4
- export {};
@@ -1 +0,0 @@
1
- export declare const isMobile: () => boolean;
@@ -1,3 +0,0 @@
1
- declare function faToEnDigits(input: string | number): string;
2
- declare function enToFaDigits(input: string | number): string;
3
- export { enToFaDigits, faToEnDigits };
@@ -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;