@colisweb/rescript-toolkit 5.49.0 → 5.49.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": "5.49.0",
3
+ "version": "5.49.2",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "clean": "rescript clean",
@@ -189,7 +189,7 @@ module Make = (Config: Config) => {
189
189
  let use = (
190
190
  ~initialState,
191
191
  ~schema=[]: Validation.schema,
192
- ~beforeSubmit: option<state => bool>=None,
192
+ ~beforeSubmit: state => bool=_ => false,
193
193
  ~onSubmit,
194
194
  ~onSubmitFail=ignore,
195
195
  ~i18n: ReSchemaI18n.t=ReSchemaI18n.default,
@@ -200,8 +200,7 @@ module Make = (Config: Config) => {
200
200
  (state, action) => {
201
201
  switch action {
202
202
  | Submit =>
203
- state.formState == Submitting ||
204
- beforeSubmit->Option.mapWithDefault(false, fn => fn(state))
203
+ state.formState == Submitting || beforeSubmit(state)
205
204
  ? NoUpdate
206
205
  : UpdateWithSideEffects(
207
206
  {...state, formState: Submitting},
@@ -49,6 +49,7 @@ type contentParams = {index: int}
49
49
  type timelinePointExtras = {
50
50
  className?: string,
51
51
  content?: contentParams => React.element,
52
+ onClick?: unit => unit,
52
53
  popoverContent?: React.element,
53
54
  popoverContentOptions?: Radix.Popover.Content.options,
54
55
  }
@@ -301,6 +302,7 @@ module Timeline = {
301
302
  | None =>
302
303
  <div
303
304
  className={"w-full h-[--markerHeight] text-center font-semibold text-sm"}
305
+ onClick={_ => extras.onClick->Option.forEach(fn => fn())}
304
306
  style={{
305
307
  "--markerHeight": switch marker {
306
308
  | Cluster(_) => markerWidth +. 10.
@@ -313,6 +315,7 @@ module Timeline = {
313
315
  <Toolkit__Ui_Popover
314
316
  triggerAsChild={true}
315
317
  trigger={<div
318
+ onClick={_ => extras.onClick->Option.forEach(fn => fn())}
316
319
  className={"w-full h-[--markerHeight] cursor-pointer text-center font-semibold text-sm"}
317
320
  style={{
318
321
  "--markerHeight": switch marker {