@colisweb/rescript-toolkit 5.31.1 → 5.31.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colisweb/rescript-toolkit",
3
- "version": "5.31.1",
3
+ "version": "5.31.3",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "clean": "rescript clean",
@@ -1,3 +1,3 @@
1
1
  // From https://github.com/jquense/yup/blob/92668947dafc2bb60bb7565c53b39091a6213167/src/string.ts#L22
2
2
 
3
- let email = %re("/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/")
3
+ let email = %re("/^[\w.+-]+@([\w-]+\.)+[\w-]{2,4}$/")
@@ -16,7 +16,7 @@ let autoExpand: Dom.element => unit = %raw(`
16
16
  `)
17
17
 
18
18
  @react.component
19
- let make = (
19
+ let make = React.forwardRef((
20
20
  ~id,
21
21
  ~name=?,
22
22
  ~value=?,
@@ -31,6 +31,7 @@ let make = (
31
31
  ~onChange: option<ReactEvent.Form.t => unit>=?,
32
32
  ~isInvalid=?,
33
33
  ~className="",
34
+ ref: Js.Nullable.t<React.ref<Js.Nullable.t<Dom.element>>>,
34
35
  ) => {
35
36
  let textareaRef = React.useRef(Js.Nullable.null)
36
37
 
@@ -40,7 +41,14 @@ let make = (
40
41
  }
41
42
 
42
43
  React.useEffect(() => {
43
- textareaRef.current->Js.Nullable.toOption->Option.forEach(autoExpand)
44
+ textareaRef.current
45
+ ->Js.Nullable.toOption
46
+ ->Option.forEach(autoExpand)
47
+
48
+ ref
49
+ ->Js.Nullable.toOption
50
+ ->Option.forEach(ref => ref.current = textareaRef.current)
51
+
44
52
  None
45
53
  }, [textareaRef.current])
46
54
 
@@ -74,4 +82,4 @@ let make = (
74
82
  ?onBlur
75
83
  ?onKeyDown
76
84
  />
77
- }
85
+ })