@colisweb/rescript-toolkit 2.54.0 → 2.54.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colisweb/rescript-toolkit",
3
- "version": "2.54.0",
3
+ "version": "2.54.1",
4
4
  "scripts": {
5
5
  "clean": "rescript clean",
6
6
  "build": "rescript build -with-deps",
@@ -14,15 +14,18 @@ let make = (
14
14
  ~containerClassName="",
15
15
  ~defaultIsOpen=false,
16
16
  ~onButtonClick=?,
17
+ ~onClickOutside=?,
17
18
  ~buttonColor: Toolkit__Ui_Button.color=#white,
18
19
  ~buttonSize: Toolkit__Ui_Button.size=#md,
19
20
  ~buttonVariant: Toolkit__Ui_Button.variant=#default,
20
21
  ) => {
21
22
  let dropDownRef = React.useRef(Js.Nullable.null)
22
23
  let buttonRef = React.useRef(Js.Nullable.null)
23
- let {isOpen, hide, toggle} = Toolkit__Hooks.useDisclosure(~defaultIsOpen, ())
24
+ let disclosure = Toolkit__Hooks.useDisclosure(~defaultIsOpen, ())
25
+ let {isOpen, hide, toggle} = disclosure
24
26
 
25
27
  Toolkit__Hooks.useOnClickOutside(dropDownRef, _ => {
28
+ onClickOutside->Option.forEach(fn => fn())
26
29
  hide()
27
30
  })
28
31
 
@@ -93,7 +96,7 @@ let make = (
93
96
  dropdownClassName,
94
97
  ])}
95
98
  style={adjustmentStyle->Option.getWithDefault(ReactDOM.Style.make())}>
96
- children
99
+ {children(disclosure)}
97
100
  </div>
98
101
  </ReachUi.Portal>
99
102
  : React.null}