@colisweb/rescript-toolkit 2.54.0 → 2.54.2

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.2",
4
4
  "scripts": {
5
5
  "clean": "rescript clean",
6
6
  "build": "rescript build -with-deps",
@@ -10,11 +10,15 @@ module Make = (Config: Config) => {
10
10
  ~options: option<Swr.fetcherOptions>=?,
11
11
  key: option<Config.Request.argument>,
12
12
  ): Toolkit__Hooks.fetcher<Config.Request.response> =>
13
- Toolkit__Hooks.useFetcher(~options?, key->Option.map(Config.key), () => {
14
- let key = key->Option.getExn
13
+ Toolkit__Hooks.useFetcher(
14
+ ~options?,
15
+ key->Option.map(k => Config.key(k)->Js.Array2.joinWith("--")),
16
+ () => {
17
+ let key = key->Option.getExn
15
18
 
16
- Config.Request.exec(key)->Promise.Js.fromResult
17
- })
19
+ Config.Request.exec(key)->Promise.Js.fromResult
20
+ },
21
+ )
18
22
 
19
23
  let useOptional = (
20
24
  ~options: option<Swr.fetcherOptions>=?,
@@ -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}