@colisweb/rescript-toolkit 2.66.0 → 2.66.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.66.0",
3
+ "version": "2.66.1",
4
4
  "scripts": {
5
5
  "clean": "rescript clean",
6
6
  "build": "rescript build -with-deps",
@@ -139,12 +139,12 @@ module ReactSelectMultipleCreateInput = {
139
139
  @module("react-select/creatable") @react.component
140
140
  external make: (
141
141
  ~components: components,
142
- ~inputValue: string,
142
+ ~inputValue: string=?,
143
143
  ~isClearable: option<bool>=?,
144
144
  ~isMulti: option<bool>=?,
145
145
  ~menuIsOpen: option<bool>=?,
146
- ~onChange: array<string> => unit,
147
- ~onInputChange: string => unit,
146
+ ~onChange: array<string> => unit=?,
147
+ ~onInputChange: string => unit=?,
148
148
  ~onKeyDown: ReactEvent.Keyboard.t => unit,
149
149
  ~placeholder: option<string>=?,
150
150
  ~value: array<string>,
@@ -157,10 +157,10 @@ module ReactSelectMultipleCreateInput = {
157
157
 
158
158
  @react.component
159
159
  let make = (
160
- ~inputValue: string,
161
- ~onInputChange: string => unit,
160
+ ~inputValue: option<string>=?,
161
+ ~onInputChange: option<string => unit>=?,
162
162
  ~value: array<string>,
163
- ~onChange: array<string> => unit,
163
+ ~onChange: option<array<string> => unit>=?,
164
164
  ~isClearable=true,
165
165
  ~placeholder="",
166
166
  ~isDisabled=false,
@@ -172,14 +172,15 @@ module ReactSelectMultipleCreateInput = {
172
172
  components={"DropDownIndicator": React.null}
173
173
  isMulti=true
174
174
  onKeyDown={e => {
175
- if inputValue === "" {
176
- ()
177
- } else {
175
+ switch inputValue {
176
+ | Some("")
177
+ | None => ()
178
+ | Some(inputValue) =>
178
179
  switch e->ReactEvent.Keyboard.key {
179
180
  | "Enter"
180
181
  | "Tab" => {
181
- onInputChange("")
182
- onChange(value->Array.concat([inputValue]))
182
+ onInputChange->Option.forEach(fn => fn(""))
183
+ onChange->Option.forEach(fn => fn(value->Array.concat([inputValue])))
183
184
  e->ReactEvent.Keyboard.preventDefault
184
185
  }
185
186
 
@@ -188,10 +189,10 @@ module ReactSelectMultipleCreateInput = {
188
189
  }
189
190
  }}
190
191
  menuIsOpen={false}
191
- inputValue
192
+ ?inputValue
192
193
  isClearable
193
- onChange
194
- onInputChange
194
+ ?onChange
195
+ ?onInputChange
195
196
  placeholder
196
197
  value
197
198
  isDisabled