@colisweb/rescript-toolkit 2.13.2 → 2.13.5

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.13.2",
3
+ "version": "2.13.5",
4
4
  "scripts": {
5
5
  "clean": "rescript clean",
6
6
  "build": "rescript build",
@@ -254,7 +254,7 @@ module Make = (Config: RouterConfig) => {
254
254
  <span
255
255
  className={cx([
256
256
  "transition-all duration-200 ease-in-out absolute ml-12 w-40 transform top-1/2 -translate-y-1/2 text-left",
257
- isNavOpen ? "pl-1 opacity-100" : "opacity-0",
257
+ isNavOpen ? "pl-1 opacity-100 delay-75" : "opacity-0 invisible",
258
258
  ])}>
259
259
  groupInfo.label
260
260
  </span>
@@ -127,3 +127,71 @@ module ReactAsyncSelectMultiple = {
127
127
  ~loadOptions: string => Promise.Js.t<array<labelOption<'value>>, string>,
128
128
  ) => React.element = "default"
129
129
  }
130
+
131
+ module ReactSelectMultipleCreateInput = {
132
+ module ReactSelect = {
133
+ type components = {"DropDownIndicator": React.element}
134
+
135
+ @module("react-select/creatable") @react.component
136
+ external make: (
137
+ ~components: components,
138
+ ~inputValue: string,
139
+ ~isClearable: option<bool>=?,
140
+ ~isMulti: option<bool>=?,
141
+ ~menuIsOpen: option<bool>=?,
142
+ ~onChange: array<string> => unit,
143
+ ~onInputChange: string => unit,
144
+ ~onKeyDown: ReactEvent.Keyboard.t => unit,
145
+ ~placeholder: option<string>=?,
146
+ ~value: array<string>,
147
+ ~isDisabled: option<bool>=?,
148
+ ~isLoading: option<bool>=?,
149
+ ~className: option<string>=?,
150
+ ~id: option<string>=?,
151
+ ) => React.element = "CreatableSelect"
152
+ }
153
+
154
+ @react.component
155
+ let make = (
156
+ ~inputValue: string,
157
+ ~onInputChange: string => unit,
158
+ ~value: array<string>,
159
+ ~onChange: array<string> => unit,
160
+ ~isClearable=true,
161
+ ~placeholder="",
162
+ ~isDisabled=false,
163
+ ~isLoading=false,
164
+ ~className: option<string>=?,
165
+ ~id: option<string>=?,
166
+ ) =>
167
+ <ReactSelect
168
+ components={"DropDownIndicator": React.null}
169
+ isMulti=true
170
+ onKeyDown={e => {
171
+ if inputValue === "" {
172
+ ()
173
+ } else {
174
+ switch e->ReactEvent.Keyboard.key {
175
+ | "Enter"
176
+ | "Tab" => {
177
+ onInputChange("")
178
+ onChange(value->Array.concat([inputValue]))
179
+ e->ReactEvent.Keyboard.preventDefault
180
+ }
181
+ | _ => ()
182
+ }
183
+ }
184
+ }}
185
+ menuIsOpen={false}
186
+ inputValue
187
+ isClearable
188
+ onChange
189
+ onInputChange
190
+ placeholder
191
+ value
192
+ isDisabled
193
+ isLoading
194
+ ?className
195
+ ?id
196
+ />
197
+ }